/* ===== Key 4 Aptis Design System ===== */
:root {
  --navy: #1E3A8A;      /* Chủ đạo - Xanh dương đậm */
  --navy-700: #172e6e;
  --emerald: #10B981;   /* Chủ đạo - Xanh ngọc */
  --emerald-600: #0ea371;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;  /* Phụ trợ - Xám nhạt */
  --gray-200: #E5E7EB;
  --gray-400: #9CA3AF;
  --gray-600: #4B5563;
  --gray-800: #1F2937;
  --orange: #F97316;    /* CTA - Cam sáng */
  --orange-600: #ea6a0c;
  --white: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(30, 58, 138, 0.08);
  --shadow-lg: 0 12px 40px rgba(30, 58, 138, 0.14);
  --container: 1180px;
  --font: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--emerald-600); }
img { max-width: 100%; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.site-main { min-height: 60vh; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; cursor: pointer;
  border: 2px solid transparent; transition: all .15s ease; white-space: nowrap;
}
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-cta { background: var(--orange); color: #fff; }
.btn-cta:hover { background: var(--orange-600); color: #fff; transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); color: #fff; }
.btn-emerald { background: var(--emerald); color: #fff; }
.btn-emerald:hover { background: var(--emerald-600); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--gray-200); }
.btn-ghost:hover { border-color: var(--navy); background: var(--gray-100); }

/* ===== Header ===== */
.site-header { background: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
/* Tên hiển thị "Key for Aptis" (thương hiệu/domain: key4aptis) - nhấn chữ Key */
.brand-key { color: var(--emerald); }
.brand-for { color: var(--orange); }
.brand-aptis { color: var(--navy); }
.brand-text { letter-spacing: -.3px; }

.main-nav { display: flex; align-items: center; flex: 1; gap: 12px; }
.nav-list { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-item { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 4px; padding: 10px 12px;
  color: var(--gray-800); font-weight: 600; font-size: 14.5px; border-radius: var(--radius-sm);
}
.nav-link:hover { background: var(--gray-100); color: var(--navy); }
.nav-link.active { color: var(--navy); background: var(--gray-100); }
.caret { font-size: 10px; color: var(--gray-400); }
.nav-cta .nav-link { background: var(--orange); color: #fff; }
.nav-cta .nav-link:hover { background: var(--orange-600); color: #fff; }

.submenu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .15s ease; z-index: 120;
}
.nav-item.has-children:hover > .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu li { position: relative; }
.submenu-link { display: block; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; color: var(--gray-800); }
.submenu-link:hover, .submenu-link.active { background: var(--gray-100); color: var(--navy); }
.caret-right { float: right; color: var(--gray-400); font-size: 11px; }
/* Menu con cấp 2 (flyout sang phải) */
.submenu-nested { top: -8px; left: calc(100% + 4px); }
.submenu li.has-children:hover > .submenu-nested { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-auth { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; color: var(--gray-600); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropdown tài khoản */
.user-menu { position: relative; }
.user-trigger { display: flex; align-items: center; gap: 6px; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 999px; padding: 8px 16px; font-size: 14px; color: var(--gray-800); cursor: pointer; font-family: inherit; }
.user-trigger:hover { background: var(--gray-200); }
.user-trigger strong { color: var(--navy); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .15s ease; z-index: 130;
}
.user-menu.open .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown li a { display: block; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; color: var(--gray-800); }
.user-dropdown li a:hover { background: var(--gray-100); color: var(--navy); }

/* Divider trên trang đăng nhập */
.auth-sep { display: flex; align-items: center; text-align: center; color: var(--gray-400); font-size: 13px; margin: 20px 0 14px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--gray-200); }
.auth-sep span { padding: 0 12px; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2.5px; background: var(--navy); border-radius: 2px; }

.click-banner {
  background: linear-gradient(90deg, var(--navy), var(--emerald));
  color: #fff; text-align: center; padding: 8px 16px; font-size: 14px;
}
.click-banner a { color: #fff; text-decoration: underline; font-weight: 700; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #23499f 55%, var(--emerald) 160%);
  color: #fff; padding: 72px 0 84px;
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 42px; line-height: 1.15; margin: 0 0 16px; letter-spacing: -1px; }
.hero .highlight { color: #FBBF77; }
.hero p.lead { font-size: 18px; color: #dbe4ff; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 36px; }
.hero-stat b { display: block; font-size: 26px; }
.hero-stat span { color: #cdd9ff; font-size: 13px; }
.hero-art { display: flex; justify-content: center; }
.hero-card {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px; padding: 26px; width: 100%; backdrop-filter: blur(4px);
}
.hero-card h3 { margin: 0 0 14px; font-size: 16px; }
.skill-pill { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.12); padding: 12px 16px; border-radius: 10px; margin-bottom: 10px; }
.skill-pill b { font-weight: 700; }
.skill-pill em { font-style: normal; color: #cdeee0; font-size: 13px; }

/* ===== Sections ===== */
.section { padding: 64px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 42px; }
.section-head h2 { font-size: 30px; color: var(--navy); margin: 0 0 10px; }
.section-head p { color: var(--gray-600); font-size: 16px; margin: 0; }
.eyebrow { color: var(--emerald-600); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }

/* ===== Cards grid ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; }
.card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card .icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; background: var(--gray-100); }
.card h3 { margin: 0 0 8px; color: var(--navy); font-size: 19px; }
.card p { margin: 0 0 16px; color: var(--gray-600); font-size: 14.5px; }
.card-link { font-weight: 700; color: var(--emerald-600); }

.icon-navy { background: rgba(30,58,138,.1) !important; color: var(--navy); }
.icon-emerald { background: rgba(16,185,129,.12) !important; color: var(--emerald-600); }
.icon-orange { background: rgba(249,115,22,.12) !important; color: var(--orange-600); }

/* ===== Steps ===== */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 22px; }
.step { background: #fff; border-radius: var(--radius); padding: 24px; border: 1px solid var(--gray-200); }
.step .num { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 14px; }
.step h4 { margin: 0 0 6px; color: var(--navy); }
.step p { margin: 0; color: var(--gray-600); font-size: 14px; }

/* ===== CTA band ===== */
.cta-band { background: var(--navy); color: #fff; border-radius: 18px; padding: 44px; text-align: center; margin: 20px 0; }
.cta-band h2 { margin: 0 0 10px; font-size: 28px; }
.cta-band p { color: #cdd9ff; margin: 0 0 22px; }

/* ===== Page header (skill pages) ===== */
.page-head { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 40px 0; }
.page-head .eyebrow { display: block; margin-bottom: 6px; }
.page-head h1 { margin: 0 0 8px; color: var(--navy); font-size: 32px; }
.page-head p { margin: 0; color: var(--gray-600); }
.breadcrumb { font-size: 13px; color: var(--gray-400); margin-bottom: 14px; }
.breadcrumb a { color: var(--gray-600); }

/* ===== Auth ===== */
.auth-wrap { max-width: 440px; margin: 48px auto; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px; }
.auth-wrap h1 { margin: 0 0 6px; color: var(--navy); font-size: 24px; text-align: center; }
.auth-wrap .sub { text-align: center; color: var(--gray-600); margin: 0 0 22px; font-size: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-control { width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--navy); }
.form-note { font-size: 13px; color: var(--gray-600); margin: 6px 0 0; line-height: 1.5; }
select.form-control { cursor: pointer; }
.btn-block { width: 100%; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; }
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-success { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--gray-600); }
.limit-note { background: linear-gradient(90deg, rgba(249,115,22,.12), rgba(16,185,129,.12)); border: 1px solid var(--gray-200); }

/* ===== Info / center panels ===== */
.panel { max-width: 560px; margin: 60px auto; background:#fff; border:1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; text-align: center; }
.panel .big-emoji { font-size: 48px; }
.panel h1 { color: var(--navy); margin: 12px 0 8px; }
.panel p { color: var(--gray-600); }

/* ===== List (sections placeholder) ===== */
.placeholder-box { background: #fff; border: 1.5px dashed var(--gray-200); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--gray-600); }
.placeholder-box .big-emoji { font-size: 40px; }

/* ===== Reading - Học theo bộ đề ===== */
.exam-note { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; border-radius: 12px; padding: 14px 18px; font-size: 14px; margin-bottom: 26px; line-height: 1.7; }
.exam-card .exam-topics { list-style: none; padding: 0; margin: 12px 0 16px; font-size: 13px; color: var(--gray-600); }
.exam-card .exam-topics li { padding: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-part-tag { display: inline-block; min-width: 24px; text-align: center; background: var(--gray-100); color: var(--gray-600); font-weight: 700; font-size: 11px; padding: 1px 5px; border-radius: 4px; margin-right: 6px; }

/* Thanh bước Part 1..5 */
.rex-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.rex-step { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--gray-100); color: var(--gray-400); }
.rex-step.is-done { background: rgba(16,185,129,.12); color: var(--emerald-600); }
.rex-step.is-current { background: var(--navy); color: #fff; }
.rex-progress { font-size: 14px; color: var(--gray-600); margin-right: 6px; }

/* Trang kết quả */
.rex-result { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 30px; background: #fff; border: 2px solid var(--gray-200); border-radius: 16px; padding: 28px 30px; box-shadow: var(--shadow); }
.rex-result.is-good { border-color: var(--emerald); }
.rex-result.is-ok { border-color: var(--orange); }
.rex-result.is-low { border-color: #FCA5A5; }
.rex-score-big { font-size: 52px; font-weight: 800; color: var(--navy); line-height: 1; }
.rex-score-big span { font-size: 24px; color: var(--gray-400); }
.rex-percent { font-size: 24px; font-weight: 800; color: var(--emerald-600); }
.rex-rating { font-size: 14px; font-weight: 700; color: var(--gray-600); }
.rex-bars { display: flex; flex-direction: column; gap: 7px; }
.rex-bar-row { display: flex; align-items: center; gap: 10px; }
.rex-bar-label { font-size: 12px; font-weight: 700; color: var(--gray-600); min-width: 46px; }
.rex-bar { flex: 1; height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.rex-bar span { display: block; height: 100%; background: linear-gradient(90deg, #2563EB, var(--emerald)); border-radius: 999px; }
.rex-bar-score { font-size: 12px; font-weight: 700; color: var(--gray-800); min-width: 34px; text-align: right; }

.rex-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.rex-review-hint { font-size: 14px; color: var(--gray-600); margin: 0 0 14px; }
.rex-part-card { margin-bottom: 18px; }
.rex-part-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rex-part-score { font-size: 15px; font-weight: 800; color: var(--gray-600); background: var(--gray-100); padding: 3px 12px; border-radius: 999px; }
.rex-part-score.is-full { background: rgba(16,185,129,.12); color: var(--emerald-600); }
.rex-table td { vertical-align: top; }

@media (max-width: 780px) {
  .rex-result { grid-template-columns: 1fr; gap: 18px; text-align: center; }
  .rex-bars { text-align: left; }
}

/* ===== Listening - Học theo bộ đề ===== */
.lex-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.lex-step { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 8px; background: var(--gray-100); color: var(--gray-600); font-size: 12px; font-weight: 700; transition: all .12s ease; }
.lex-step:hover { background: var(--gray-200); color: var(--navy); }
.lex-step.is-current { background: var(--navy); color: #fff; }

.lex-audio-wrap { margin-bottom: 8px; }
.lex-audio-wrap.is-exhausted .lex-audio { opacity: .5; pointer-events: none; }
.lex-plays { font-size: 13px; font-weight: 700; color: var(--gray-600); margin: 6px 0 18px; }
.lex-plays-left { color: var(--emerald-600); }
.lex-plays-done { color: #DC2626; }
.lex-audio-wrap.is-exhausted .lex-plays-left { color: #DC2626; }

.lex-talk { margin-bottom: 32px; }
.lex-talk-title { font-size: 19px; color: var(--navy); margin: 0 0 10px; }
.lex-subq { padding: 14px 0; border-top: 1px dashed var(--gray-200); }
.lex-subq:first-child { border-top: none; padding-top: 0; }

.lex-tr { border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 8px; }
.lex-tr summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--navy); }
.lex-tr[open] summary { border-bottom: 1px solid var(--gray-200); }
.lex-tr-text { margin: 0; padding: 14px; font-size: 15px; line-height: 1.75; color: var(--gray-800); white-space: pre-line; }

/* Banner nhắc khách chưa đăng nhập (trên trang luyện tập) */
.guest-note { background: #EFF6FF; border-bottom: 1px solid #DBEAFE; color: #1E40AF; text-align: center; font-size: 14px; padding: 9px 16px; }
.guest-note a { font-weight: 700; text-decoration: underline; }
.guest-note.activate-note { background: #FEF3C7; border-bottom-color: #FDE68A; color: #92400E; }

/* Trang "cần kích hoạt" / "đăng ký thành công" */
.act-box { text-align: left; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 12px; padding: 20px 22px; margin: 22px 0; }
.act-box-title { font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.act-box p { color: var(--gray-600); font-size: 14px; margin: 0 0 8px; }
.act-warn { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E !important; border-radius: 8px; padding: 10px 12px; font-size: 13px !important; }
.act-note { color: var(--gray-400) !important; font-size: 13px !important; margin: 0 !important; }
.act-steps { margin: 0 0 12px; padding-left: 20px; color: var(--gray-600); font-size: 14px; line-height: 1.9; }
.act-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }

/* ===== Gia hạn / Gói cước ===== */
.bill-alert { border-radius: 12px; padding: 14px 18px; margin-bottom: 26px; font-size: 15px; }
.bill-alert-warn { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; }
.bill-alert-ok { background: #ECFDF5; border: 1px solid #D1FAE5; color: #065F46; }

.bill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; }
.bill-card { position: relative; background: #fff; border: 1.5px solid var(--gray-200); border-radius: 16px; padding: 28px 22px; text-align: center; transition: transform .15s ease, box-shadow .15s ease; }
.bill-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.bill-card.is-popular { border-color: var(--emerald); }
.bill-card.is-best { border-color: var(--orange); }
.bill-tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--emerald); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.bill-tag-best { background: var(--orange); }
.bill-price { font-size: 30px; font-weight: 800; color: var(--navy); }
.bill-days { font-size: 17px; font-weight: 700; color: var(--emerald-600); margin-top: 2px; }
.bill-desc { color: var(--gray-600); font-size: 14px; margin: 10px 0 18px; }
.bill-btn { width: 100%; }

.bill-referral { margin-top: 40px; background: linear-gradient(135deg, #EFF6FF, #ECFDF5); border: 1px solid #DBEAFE; border-radius: 16px; padding: 28px; text-align: center; }
.bill-referral h3 { margin: 0 0 8px; color: var(--navy); }
.bill-referral p { color: var(--gray-600); margin: 0 0 16px; }
/* Khi tắt bán gói -> khối giới thiệu là nội dung chính của trang */
.bill-referral.is-only { margin-top: 0; padding: 36px 28px; }
.bill-ref-row { display: flex; gap: 10px; max-width: 620px; margin: 0 auto; }
.bill-ref-more { margin: 16px 0 0 !important; font-size: 14px; }
@media (max-width: 640px) { .bill-ref-row { flex-direction: column; } }

/* ===== Trang thanh toán QR ===== */
.pay-wrap { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 34px; background: #fff; border: 1px solid var(--gray-200); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); }
.pay-qr { text-align: center; }
.pay-qr-img { width: 100%; max-width: 300px; border: 1px solid var(--gray-200); border-radius: 12px; }
.pay-qr-note { font-size: 13px; color: var(--gray-600); margin-top: 12px; }
.pay-qr-missing { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; border-radius: 12px; padding: 24px; font-size: 14px; line-height: 1.7; }

.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--gray-200); }
.pay-label { color: var(--gray-600); font-size: 14px; }
.pay-value { font-weight: 700; color: var(--gray-800); text-align: right; }
.pay-amount { color: var(--orange-600); font-size: 20px; }
.pay-code { color: var(--navy); font-size: 19px; letter-spacing: 1px; background: #EFF6FF; padding: 3px 10px; border-radius: 6px; }
.pay-copy { cursor: pointer; margin-left: 8px; background: #fff; border: 1px solid var(--gray-200); border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 700; color: var(--gray-600); }
.pay-copy:hover { border-color: var(--navy); color: var(--navy); }
.pay-copy.is-copied { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.pay-warn { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-top: 18px; }
.pay-status { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 14px; font-weight: 700; color: var(--gray-600); }
.pay-spinner { width: 15px; height: 15px; border: 2px solid var(--gray-200); border-top-color: var(--emerald); border-radius: 50%; animation: pay-spin .8s linear infinite; }
@keyframes pay-spin { to { transform: rotate(360deg); } }

.pay-done { text-align: center; background: #fff; border: 2px solid var(--emerald); border-radius: 16px; padding: 50px 30px; box-shadow: var(--shadow-lg); }
.pay-done-icon { font-size: 60px; }
.pay-done h2 { color: var(--emerald-600); margin: 10px 0 8px; }
.pay-done p { color: var(--gray-600); }
.pay-done-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }

/* ===== Trang tài khoản ===== */
.acc-wrap { display: flex; flex-direction: column; gap: 20px; max-width: 860px; }
.acc-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.acc-label { display: block; font-size: 13px; font-weight: 800; letter-spacing: .6px; color: var(--gray-400); text-transform: uppercase; margin-bottom: 10px; }
.acc-note { color: var(--gray-600); font-size: 14px; margin: 8px 0 0; }
.acc-expiry { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.acc-expiry.is-expired { border-color: #FCA5A5; background: #FEF2F2; }
.acc-big { font-size: 28px; font-weight: 800; color: var(--emerald-600); }
.acc-big-red { color: #DC2626; }

.acc-ref-row { display: flex; gap: 10px; margin-top: 12px; }
.acc-ref-input { flex: 1; border: 1.5px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--gray-800); background: var(--gray-50); font-family: inherit; }
.acc-ref-stat { margin-top: 14px; font-size: 14px; color: var(--gray-600); }
.acc-ref-earned { color: var(--emerald-600); font-weight: 700; margin-left: 6px; }

.acc-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; }
.acc-table th { text-align: left; color: var(--gray-400); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--gray-200); }
.acc-table td { padding: 11px 10px; border-bottom: 1px solid var(--gray-100); }
.acc-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--gray-100); color: var(--gray-600); }
.acc-badge-ok { background: rgba(16,185,129,.12); color: var(--emerald-600); }
.acc-badge-wait { background: rgba(249,115,22,.12); color: var(--orange-600); }
.acc-soon { opacity: .7; }

/* ===== Danh sách người đã giới thiệu ===== */
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ref-stat { background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; text-align: center; box-shadow: var(--shadow); }
.ref-stat-num { display: block; font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.ref-stat-label { font-size: 13px; color: var(--gray-600); font-weight: 600; }
.ref-stat-ok .ref-stat-num { color: var(--emerald-600); }
.ref-stat-day .ref-stat-num { color: var(--orange-600); }

.ref-email { background: var(--gray-100); padding: 3px 8px; border-radius: 6px; font-size: 13px; color: var(--gray-800); letter-spacing: .5px; }
.ref-table td:first-child { color: var(--gray-400); font-weight: 700; }
.ref-note { font-size: 13px; color: var(--gray-600); margin: 16px 0 0; }
.ref-empty { text-align: center; padding: 34px 20px; color: var(--gray-600); }
.ref-empty-icon { font-size: 46px; }
.ref-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.ref-pager-info { font-size: 14px; color: var(--gray-600); }

@media (max-width: 640px) { .ref-stats { grid-template-columns: 1fr; } }

/* ===== 2 trụ cột trang chủ: Key & AI theo band ===== */
.pillars { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pillar { border-radius: 18px; padding: 30px; border: 1.5px solid var(--gray-200); background: #fff; }
.pillar-key { background: linear-gradient(135deg, #ECFDF5, #F0FDF9); border-color: #A7F3D0; }
.pillar-ai { background: linear-gradient(135deg, #FFF7ED, #FEF3C7); border-color: #FED7AA; }
.pillar h3 { margin: 0 0 10px; color: var(--navy); font-size: 21px; }
.pillar > p { color: var(--gray-600); margin: 0 0 14px; }
.pillar-list { list-style: none; padding: 0; margin: 0; }
.pillar-list li { position: relative; padding: 5px 0 5px 22px; font-size: 14px; color: var(--gray-800); }
.pillar-list li::before { content: '✓'; position: absolute; left: 0; font-weight: 800; }
.pillar-key .pillar-list li::before { color: var(--emerald-600); }
.pillar-ai .pillar-list li::before { color: var(--orange-600); }

@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } }

/* ===== Facebook: icon header · khối trang chủ · footer ===== */
:root { --fb: #1877F2; --fb-dark: #0f5fd1; }

.nav-fb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  color: var(--fb); background: rgba(24,119,242,.1); padding: 6px 12px; border-radius: 999px; white-space: nowrap; transition: all .15s ease; }
.nav-fb:hover { background: var(--fb); color: #fff; }

.fb-band { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px;
  background: linear-gradient(135deg, #EFF6FF, #E0EAFF); border: 1.5px solid #BFDBFE; border-radius: 18px; padding: 32px 34px; }
.fb-band-icon { color: var(--fb); display: flex; }
.fb-band-text h2 { margin: 0 0 8px; color: var(--navy); font-size: 24px; }
.fb-band-text p { margin: 0 0 12px; color: var(--gray-600); }
.fb-band-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; font-weight: 600; color: var(--gray-800); }
.fb-band-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn-fb { background: var(--fb); color: #fff; border: none; white-space: nowrap; }
.btn-fb:hover { background: var(--fb-dark); color: #fff; }
.fb-band-page { font-size: 13px; color: var(--gray-600); }
.fb-band-page:hover { color: var(--fb); }

.footer-social { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.footer-social a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #a9b7d6; }
.footer-social a:hover { color: #fff; }

@media (max-width: 900px) {
  .fb-band { grid-template-columns: 1fr; text-align: center; gap: 18px; padding: 28px 22px; }
  .fb-band-icon { justify-content: center; }
  .fb-band-list { justify-content: center; }
}
@media (max-width: 920px) { .nav-fb { align-self: flex-start; } }

@media (max-width: 780px) {
  .pay-wrap { grid-template-columns: 1fr; }
  .acc-expiry { flex-direction: column; align-items: stretch; }
  .acc-ref-row { flex-direction: column; }
  .acc-table thead { display: none; }
  .acc-table td { display: flex; justify-content: space-between; gap: 12px; }
}

/* ===== Trang chưa xây dựng (chỉ icon + dòng chữ) ===== */
.under-construction { min-height: 55vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 60px 20px; }
.under-construction .uc-icon { font-size: 72px; line-height: 1; }
.under-construction .uc-text { color: var(--navy); font-size: 22px; font-weight: 800; margin: 0; }

/* ===== Footer ===== */
.site-footer { background: #0f1f45; color: #c7d2e8; margin-top: 60px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 40px; padding: 48px 20px 30px; }
.footer-brand { display: flex; gap: 12px; }
.footer-brand .brand-text { font-size: 18px; font-weight: 800; }
.footer-brand .brand-aptis { color: #fff; } /* nền footer tối -> Aptis phải trắng */
.footer-slogan { color: #93a4c8; font-size: 13px; margin: 4px 0 0; }
.footer-cols { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.footer-col h4 { color: #fff; font-size: 14px; margin: 0 0 12px; }
.footer-col a { display: block; color: #a9b7d6; font-size: 14px; padding: 4px 0; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 18px 20px; font-size: 13px; color: #8697bd; }

/* ===== Responsive ===== */
@media (max-width: 920px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; margin-left: auto; }
  .main-nav {
    position: fixed; top: 68px; right: 0; bottom: 0; width: 300px; max-width: 85%;
    background: #fff; flex-direction: column; align-items: stretch; padding: 16px;
    box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .2s ease;
    overflow-y: auto;
  }
  .main-nav.open { transform: translateX(0); }
  .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }
  .submenu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; padding: 4px 0 4px 14px; }
  .nav-auth { margin-top: 16px; flex-direction: column; align-items: stretch; }
  .hero h1 { font-size: 32px; }
}

/* ===== Count badge (reading overview) ===== */
.count-badge { font-size: 12px; font-weight: 700; color: var(--emerald-600); background: rgba(16,185,129,.12); padding: 4px 10px; border-radius: 999px; }
.count-badge.soon { color: var(--gray-600); background: var(--gray-100); }
.card-meta { font-size: 13px; color: var(--gray-600); margin: 10px 0 16px !important; font-weight: 600; }

/* ===== Speaking - Học theo câu hỏi (Part 1) - trong exam layout ===== */
.sp-qrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 26px; }
.sp-question { margin: 0; font-size: 26px; font-weight: 800; color: #0f172a; line-height: 1.35; }

.sp-record { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  background: #E11D48; color: #fff; font-size: 16px; font-weight: 700; padding: 13px 26px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(225,29,72,.28); transition: background .15s ease, transform .1s ease; }
.sp-record:hover { background: #be123c; }
.sp-record:active { transform: scale(.97); }
.sp-record .sp-mic { display: inline-flex; }
.sp-record.is-recording { background: #0f172a; box-shadow: 0 6px 16px rgba(15,23,42,.3); animation: sp-pulse 1.3s infinite; }
@keyframes sp-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(225,29,72,.45); } 50% { box-shadow: 0 0 0 10px rgba(225,29,72,0); } }

.sp-label { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--gray-400); text-transform: uppercase; margin-bottom: 10px; }
.sp-answer { min-height: 130px; border: 1.5px solid var(--gray-200); border-radius: 12px; background: var(--gray-50); padding: 16px 18px; font-size: 16px; line-height: 1.7; color: var(--gray-800); }
.sp-answer .sp-answer-ph { color: var(--gray-400); font-style: italic; }
.sp-answer.has-text .sp-answer-ph { display: none; }
.sp-answer .sp-answer-text .interim { color: var(--gray-400); }
.sp-rec-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; min-height: 4px; }
.sp-rec-status { font-size: 13px; font-weight: 700; color: #E11D48; }
.sp-playback { height: 36px; }

.sp-div { border: none; border-top: 1px dashed var(--gray-200); margin: 26px 0 22px; }

.sp-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.sp-tab { cursor: pointer; background: #fff; border: 1.5px solid var(--gray-200); border-radius: 12px; padding: 15px; font-size: 15px; font-weight: 700; color: var(--gray-600); transition: all .15s ease; }
.sp-tab-1 { color: #2563EB; }
.sp-tab-2 { color: var(--emerald-600); }
.sp-tab-1.is-active { border-color: #2563EB; background: #EFF6FF; }
.sp-tab-2.is-active { border-color: var(--emerald); background: #ECFDF5; }

.sp-sample { background: #EFF6FF; border: 1px solid #DBEAFE; border-radius: 14px; padding: 20px 22px; }
.sp-sample-2 { background: #ECFDF5; border-color: #D1FAE5; }
.sp-sample-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sp-sample-title { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--gray-600); text-transform: uppercase; }
.sp-read { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--gray-200); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; color: var(--gray-800); }
.sp-read:hover { border-color: var(--gray-400); }
.sp-read.is-playing { background: var(--navy); color: #fff; border-color: var(--navy); }
.sp-sample-text { margin: 0; font-size: 16px; line-height: 1.75; color: var(--gray-800); }

/* Part 2: ảnh + tab câu hỏi con */
.sp-image { border: 1px solid var(--gray-200); border-radius: 14px; padding: 14px; text-align: center; background: #fff; margin-bottom: 24px; }
.sp-image img { max-width: 100%; max-height: 440px; border-radius: 8px; }

/* Part 3: cặp 2 ảnh so sánh */
.sp-image-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.sp-image-pair .sp-image { margin-bottom: 0; position: relative; }
.sp-image-pair .sp-image img { max-height: 300px; }
.sp-image-badge { position: absolute; top: 20px; left: 20px; background: rgba(15,23,42,.72); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }

.sp-subtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.sp-subtab { cursor: pointer; background: #fff; border: 1.5px solid var(--gray-200); border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 700; color: var(--gray-600); transition: all .15s ease; }
.sp-subtab:hover { border-color: var(--gray-400); }
.sp-subtab.is-active { border-color: #2563EB; background: #EFF6FF; color: #2563EB; }

/* Part 4: badge thời gian chuẩn bị / nói */
.sp-p4-badge { display: inline-flex; align-items: center; gap: 10px; background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 10px; margin: 0 0 20px; }
.sp-p4-badge .sp-p4-sep { color: #D97706; }

.sp-sampletoggle { display: block; width: 100%; cursor: pointer; background: #fff; border: 1.5px solid #BFDBFE; border-radius: 12px; padding: 15px; font-size: 15px; font-weight: 700; color: #2563EB; transition: background .15s ease; }
.sp-sampletoggle:hover, .sp-sampletoggle.is-active { background: #EFF6FF; border-color: #2563EB; }
.sp-subpanel .sp-sample { margin-top: 16px; }

@media (max-width: 640px) {
  .sp-qrow { flex-direction: column; }
  .sp-record { align-self: flex-start; }
  .sp-question { font-size: 22px; }
  .sp-tabs, .sp-subtabs, .sp-image-pair { grid-template-columns: 1fr; }
}

/* ===== Exam mode ===== */
.exam-body { background: #fff; display: flex; flex-direction: column; min-height: 100vh; }
.exam-top {
  display: flex; align-items: center; gap: 20px; padding: 14px 28px;
  position: sticky; top: 0; background: #fff; z-index: 50;
}
.exam-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--gray-800); flex: 1; }
.exam-timer { font-size: 15px; color: var(--gray-800); font-weight: 600; text-align: center; flex: 1; }
.exam-timer strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.exam-timer.warning strong { color: #DC2626; }
.exam-timer.times-up strong { color: #DC2626; }
.exam-label { font-weight: 800; color: var(--navy); flex: 1; text-align: right; }
.exam-progressbar { height: 3px; background: linear-gradient(90deg, #EF4444, #F97316); }

.exam-main { flex: 1; padding: 40px 28px 120px; }
.exam-content { max-width: 1100px; margin: 0 auto; }
.exam-qtitle { font-size: 38px; color: var(--gray-800); margin: 0 0 18px; font-weight: 800; }
.exam-qtitle .qnum { border-bottom: 3px solid var(--navy); padding: 0 10px; color: var(--navy); }
.exam-instruction { font-size: 16px; color: var(--gray-800); margin: 0 0 28px; }
.vn-note { color: var(--gray-400); font-size: 14px; }

/* Gap rows */
.q1-form { display: flex; flex-direction: column; gap: 14px; }
.gap-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  background: var(--gray-50); border: 1.5px solid var(--gray-100); border-radius: 12px;
  padding: 20px 24px; font-size: 17px; transition: all .15s ease;
}
.gap-text { color: var(--gray-800); }
.gap-select {
  padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; min-width: 120px; cursor: pointer;
}
.gap-select:focus { outline: none; border-color: var(--navy); }
.gap-mark { font-weight: 700; margin-left: auto; font-size: 14px; }
.gap-row.is-correct { background: #ECFDF5; border-color: #A7F3D0; }
.gap-row.is-correct .gap-mark { color: var(--emerald-600); }
.gap-row.is-correct .gap-select { border-color: var(--emerald); }
.gap-row.is-wrong { background: #FEF2F2; border-color: #FECACA; }
.gap-row.is-wrong .gap-mark { color: #DC2626; }
.gap-row.is-wrong .gap-select { border-color: #EF4444; }

.q1-result { margin-top: 26px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.q1-score { font-size: 18px; color: var(--gray-800); background: var(--gray-100); padding: 12px 20px; border-radius: 10px; }
.q1-score.all-correct { background: #ECFDF5; color: var(--emerald-600); }
.q1-score strong { color: var(--navy); }
.q1-score.all-correct strong { color: var(--emerald-600); }

/* Bottom bar */
.exam-bottom {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--gray-100);
  border-top: 1px solid var(--gray-200); padding: 14px 28px; z-index: 50;
}
.exam-bottom-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.exam-nav-btn { min-width: 110px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 720px) {
  .exam-top { flex-wrap: wrap; padding: 12px 16px; gap: 8px; }
  .exam-brand, .exam-timer, .exam-label { flex: none; }
  .exam-brand { flex: 1; }
  .exam-timer { order: 3; width: 100%; text-align: left; }
  .exam-main { padding: 24px 16px 110px; }
  .exam-qtitle { font-size: 28px; }
  .gap-row { padding: 16px; font-size: 16px; }
  .exam-nav-btn { min-width: 90px; }
}

/* ===== Modal review (chấm điểm) ===== */
body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,.3);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 24px; border-bottom: 1px solid var(--gray-200);
}
.modal-title { margin: 0; font-size: 21px; color: var(--gray-800); font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 30px; line-height: 1; color: var(--gray-400);
  cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--gray-800); }
.modal-body { padding: 24px; }
.modal-score { text-align: center; font-size: 27px; font-weight: 800; color: var(--emerald-600); margin-bottom: 6px; }
.modal-class { text-align: center; font-size: 24px; font-weight: 800; color: #2563EB; margin-bottom: 22px; }

.review-table { width: 100%; border-collapse: collapse; }
.review-table th, .review-table td {
  border: 1px solid var(--gray-200); padding: 14px 16px; text-align: center; font-size: 16px;
}
.review-table th { font-weight: 700; color: var(--gray-800); }
.review-table td.ans-correct { color: var(--emerald-600); font-weight: 600; }
.review-table td.ans-wrong { color: #DC2626; font-weight: 600; }
.review-table td.ans-empty { color: #DC2626; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Nút Mẹo (bóng đèn phát sáng) */
.exam-center-btns { display: flex; align-items: center; gap: 10px; }
.btn-tip {
  background: #FEF3C7; color: #92400E; border-color: #FDE68A;
}
.btn-tip:hover { background: #FDE68A; color: #92400E; transform: translateY(-1px); }
.tip-bulb { display: inline-block; filter: drop-shadow(0 0 0 rgba(251,191,36,0)); animation: bulbGlow 1.8s ease-in-out infinite; }
@keyframes bulbGlow {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(251,191,36,.4)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 8px rgba(251,191,36,.95)); transform: scale(1.12); }
}

/* Modal mẹo */
.modal-card-tip { max-width: 520px; }
.tip-hint { color: var(--gray-600); font-size: 15px; margin: 0 0 14px; }
.tip-sentence {
  margin: 0; padding: 20px 22px; font-size: 19px; line-height: 1.7; color: var(--gray-800);
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7); border-left: 5px solid #F59E0B;
  border-radius: 12px; font-weight: 500;
}
/* Part 4: mẹo nhiều dòng (mỗi người A/B/C/D một dòng) */
.tip-sentence-multi { white-space: pre-line; font-size: 16px; }
.tip-badge {
  display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700;
  color: var(--emerald-600); background: rgba(16,185,129,.12); padding: 5px 12px; border-radius: 999px;
}
.tip-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.tip-login-note { margin: 4px 0 0; font-size: 14px; color: var(--gray-600); }
.tip-login-note a { font-weight: 700; }
.tip-textarea {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--gray-200); border-radius: 12px;
  font-family: inherit; font-size: 17px; line-height: 1.6; resize: vertical; color: var(--gray-800);
}
.tip-textarea:focus { outline: none; border-color: #F59E0B; }
.tip-edit-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.tip-msg { margin-right: auto; font-size: 13px; color: var(--gray-600); }

/* ===== Part 2+3: sắp xếp câu (kéo thả) ===== */
.q2-subtitle { font-size: 26px; font-weight: 800; color: var(--gray-800); margin: 0 0 18px; }
.q2-subtitle .qnum { border-bottom: 3px solid var(--navy); padding: 0 8px; color: var(--navy); }
.q2-topic { font-size: 20px; color: var(--navy); margin: 0 0 18px; font-weight: 700; }

.q2-area { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.q2-panel {
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 14px;
  padding: 20px; min-height: 320px;
}
.q2-pool.drag-over { background: #EFF6FF; border-color: var(--navy); }

.q2-slot-row { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; }
.q2-slot-num {
  flex: 0 0 28px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--gray-400); font-size: 15px;
}
.q2-slot {
  flex: 1; min-height: 54px; border: 1.5px dashed var(--gray-400); border-radius: 10px;
  background: #fff; display: flex; align-items: center; transition: all .12s ease;
}
.q2-slot.drag-over { border-color: var(--navy); border-style: solid; background: #EFF6FF; }
.q2-slot.filled { border-style: solid; border-color: var(--gray-200); padding: 0; }
.q2-slot.is-correct { border-color: var(--emerald); background: #ECFDF5; }
.q2-slot.is-wrong { border-color: #EF4444; background: #FEF2F2; }
.q2-slot .q2-card { margin: 0; width: 100%; }

.q2-card {
  background: #fff; border: 1.5px solid var(--gray-200); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px; font-size: 15.5px; line-height: 1.55; color: var(--gray-800);
  cursor: grab; user-select: none; transition: box-shadow .12s ease, border-color .12s ease;
}
.q2-card:last-child { margin-bottom: 0; }
.q2-card:hover { box-shadow: var(--shadow); border-color: var(--navy); }
.q2-card:active { cursor: grabbing; }
.q2-card.dragging { opacity: .5; }
.q2-card.selected { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.2); }

.review-table.q2-review td { text-align: left; }

@media (max-width: 720px) {
  .q2-area { grid-template-columns: 1fr; gap: 16px; }
  .q2-panel { min-height: auto; }
  .q2-card { font-size: 15px; }
}

/* ===== Part 4: ghép câu hỏi với người ===== */
.q4-people { margin-bottom: 30px; }
.q4-person { margin-bottom: 18px; }
.q4-person-name { margin: 0 0 6px; color: var(--navy); font-size: 16px; font-weight: 700; }
.q4-person-text { margin: 0; color: var(--gray-800); font-size: 15.5px; line-height: 1.65; }

/* Câu hỏi căn phải đồng bộ */
.q4-questions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.q4-qrow {
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 10px;
  padding: 10px 14px;
}
.q4-qlabel { color: var(--gray-800); font-size: 15.5px; text-align: right; }
.q4-dash { color: var(--gray-400); }
.q4-select {
  padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; min-width: 72px; cursor: pointer;
}
.q4-select:focus { outline: none; border-color: var(--navy); }
.q4-qrow.is-correct { background: #ECFDF5; border-color: #A7F3D0; }
.q4-qrow.is-correct .q4-select { border-color: var(--emerald); }
.q4-qrow.is-wrong { background: #FEF2F2; border-color: #FECACA; }
.q4-qrow.is-wrong .q4-select { border-color: #EF4444; }

/* Modal so sánh đáp án (3 cột) */
.modal-card-wide { max-width: 760px; }
.modal-compare-title { text-align: center; font-size: 27px; font-weight: 800; color: var(--gray-800); margin-bottom: 20px; }
.review-table.q4-review td { text-align: center; }
.review-table.q4-review td.q4-qcell { text-align: center; color: var(--gray-800); }

@media (max-width: 720px) {
  .q4-questions { align-items: stretch; }
  .q4-qrow { flex-wrap: wrap; }
  .q4-qlabel { text-align: left; }
  .review-table.q4-review th, .review-table.q4-review td { padding: 8px; font-size: 13px; }
}

/* ===== Part 5: chọn tiêu đề cho đoạn ===== */
.q5-title { font-size: 30px; font-weight: 800; color: var(--gray-800); margin: 0 0 22px; }
.q5-paras { display: flex; flex-direction: column; gap: 26px; }
.q5-para-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q5-num { font-weight: 700; color: var(--gray-800); font-size: 16px; min-width: 24px; }
.q5-select {
  flex: 1; max-width: 580px; padding: 10px 14px; border: 1.5px solid var(--gray-300, #D1D5DB);
  border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; cursor: pointer;
}
.q5-select:focus { outline: none; border-color: var(--navy); }
.q5-para-text { margin: 0; color: var(--gray-800); font-size: 15.5px; line-height: 1.7; }
.q5-para.is-correct .q5-select { border-color: var(--emerald); background: #ECFDF5; }
.q5-para.is-wrong .q5-select { border-color: #EF4444; background: #FEF2F2; }

/* Điểm trong modal so sánh (chữ tối, nhỏ hơn tiêu đề) */
.compare-score { text-align: center; font-size: 18px; font-weight: 700; color: var(--gray-800); margin: -6px 0 20px; }
.compare-score.all-correct { color: var(--emerald-600); }
.review-table.q5-review td { text-align: center; }
.review-table.q5-review td.q5-numcell { font-weight: 700; color: var(--gray-800); }

@media (max-width: 720px) {
  .q5-title { font-size: 24px; }
  .q5-select { max-width: 100%; }
  .review-table.q5-review th, .review-table.q5-review td { padding: 8px; font-size: 13px; }
}

/* ===== Tra từ vựng & dịch câu (Part 1) ===== */
.gap-item { display: flex; flex-direction: column; }
.vocab-word { position: relative; cursor: pointer; border-radius: 4px; padding: 0 1px; transition: background .1s ease; }
.vocab-word:hover { background: #FEF3C7; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
/* Tooltip báo cho user biết bấm vào để dịch */
.vocab-word:hover::after {
  content: "Ấn vào để dịch sang tiếng Việt";
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 6px; padding: 5px 9px; border-radius: 6px;
  background: var(--gray-800); color: #fff; font-size: 12px; font-weight: 400;
  line-height: 1.2; white-space: nowrap; letter-spacing: 0; z-index: 400;
  pointer-events: none; box-shadow: var(--shadow);
}
.vocab-word:hover::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 1px; border: 5px solid transparent; border-top-color: var(--gray-800);
  z-index: 400; pointer-events: none;
}

.gap-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px 2px; }
.btn-sentence-vi {
  background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; border-radius: 999px;
  padding: 5px 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-sentence-vi:hover:not(:disabled) { background: #DBEAFE; }
.btn-sentence-vi:disabled { opacity: .5; cursor: not-allowed; }
.sentence-vi {
  font-size: 15px; color: var(--gray-800); background: #ECFDF5; border-left: 4px solid var(--emerald);
  border-radius: 8px; padding: 8px 14px;
}

.vocab-popup {
  position: absolute; z-index: 300; background: #fff; border: 1px solid var(--gray-200);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 14px; max-width: 280px;
  display: flex; flex-direction: column; gap: 3px;
}
.vocab-popup[hidden] { display: none; }
.vp-word { font-weight: 700; color: var(--navy); font-size: 15px; }
.vp-meaning { color: var(--gray-800); font-size: 14px; }
.vp-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; border-top: 1px solid var(--gray-100); padding-top: 8px; }
.vp-save { background: var(--emerald); color: #fff; border: none; border-radius: 6px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.vp-save:disabled { opacity: .5; cursor: default; }
.vp-status { font-size: 12px; color: var(--gray-600); }
.vp-status a { font-weight: 700; }

/* ===== Listening: audio + câu hỏi ===== */
.lis-audio { width: 100%; height: 44px; margin-bottom: 22px; }

.lis-qbox { background: var(--gray-100); border-radius: 12px; padding: 24px 26px; margin-bottom: 20px; }
.lis-question { font-weight: 700; font-size: 17px; color: var(--gray-800); margin-bottom: 6px; }
.lis-question-vi { color: var(--emerald-600); font-size: 15px; margin: 4px 0 14px; }
.lis-options { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.lis-option { display: flex; align-items: baseline; gap: 10px; cursor: pointer; font-size: 16px; color: var(--gray-800); }
.lis-option input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; position: relative; top: 3px; }
.lis-opt-vi { color: var(--emerald-600); font-size: 14px; }
.lis-tools { margin-top: 16px; }

.lis-para-toggle-wrap { margin-bottom: 14px; }
.btn-para-toggle { background: #2563EB; color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-para-toggle:hover { background: #1D4ED8; }
.lis-paragraph { border: 1px solid var(--gray-200); border-radius: 12px; padding: 20px 24px; }
.lis-para-label { font-weight: 700; color: var(--gray-800); margin-bottom: 10px; }
.lis-para-text { margin: 0; line-height: 1.85; color: var(--gray-800); font-size: 15.5px; }
.para-vi { background: #ECFDF5; border-left: 4px solid var(--emerald); border-radius: 8px; padding: 10px 14px; color: var(--gray-800); font-size: 15px; margin-top: 12px; }

/* ===== Listening Câu 14 ===== */
.q14-topic { font-size: 18px; font-weight: 700; color: var(--gray-800); margin: 0 0 10px; }
.q14-instruction { color: var(--gray-700, #374151); font-size: 15px; margin: 0 0 20px; }
.q14-persons { display: flex; flex-direction: column; gap: 14px; }
.q14-prow { display: flex; align-items: center; gap: 16px; }
.q14-plabel { min-width: 74px; color: var(--gray-800); font-size: 15px; }
.q14-select {
  flex: 1; padding: 12px 14px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; cursor: pointer;
}
.q14-select:focus { outline: none; border-color: var(--navy); }
.q14-prow.is-correct .q14-select { border-color: var(--emerald); background: #ECFDF5; }
.q14-prow.is-wrong .q14-select { border-color: #EF4444; background: #FEF2F2; }

.q14-answers-vi { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.q14-ans-vi-row { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14.5px; background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px; }
.q14-ans-en { color: var(--gray-800); }
.q14-ans-vi { color: var(--emerald-600); }

.q14-para-block { margin-bottom: 16px; }
.q14-person-para { margin: 0; line-height: 1.8; color: var(--gray-800); font-size: 15.5px; }
.q14-para-vi { margin-top: 6px; color: var(--emerald-600); font-size: 14.5px; background: #ECFDF5; border-left: 3px solid var(--emerald); border-radius: 6px; padding: 6px 12px; }

@media (max-width: 720px) {
  .q14-prow { flex-direction: column; align-items: stretch; gap: 4px; }
  .q14-plabel { min-width: 0; font-weight: 600; }
}

/* ===== Listening Câu 15 (Man/Woman/Both) ===== */
.q15-statements { display: flex; flex-direction: column; gap: 14px; }
.q15-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.q15-stext { color: var(--gray-800); font-size: 15.5px; }
.q15-num { font-weight: 700; margin-right: 2px; }
.q15-select {
  padding: 9px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; cursor: pointer; min-width: 190px;
}
.q15-select:focus { outline: none; border-color: var(--navy); }
.q15-row.is-correct .q15-select { border-color: var(--emerald); background: #ECFDF5; }
.q15-row.is-wrong .q15-select { border-color: #EF4444; background: #FEF2F2; }
.q15-vi { flex-basis: 100%; color: var(--emerald-600); font-size: 14px; margin-left: 18px; }

/* ===== Listening Câu 16 & 17 (bài dài + câu con) ===== */
.l1617-sub { margin-bottom: 22px; }
.l1617-q { font-weight: 600; font-size: 15.5px; color: var(--gray-800); margin-bottom: 4px; }
.l1617-qid { font-weight: 700; margin-right: 4px; }
.l1617-q-vi { color: var(--emerald-600); font-size: 14px; margin: 4px 0 8px; }

/* ===== Writing: danh sách câu lạc bộ ===== */
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.club-card {
  display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: all .15s ease;
}
.club-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--navy); }
.club-num { width: 42px; height: 42px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(30,58,138,.1); color: var(--navy); font-weight: 800; border-radius: 10px; font-size: 15px; }
.club-info { display: flex; flex-direction: column; flex: 1; }
.club-name { font-weight: 700; color: var(--gray-800); font-size: 16px; }
.club-key { font-size: 12.5px; color: var(--gray-400); }
.club-arrow { color: var(--emerald-600); font-weight: 700; }

/* ===== Writing: thực hành ===== */
.wr-content { max-width: 1000px; }
.wr-instruction { font-weight: 700; color: var(--gray-800); font-size: 16px; margin: 0 0 26px; line-height: 1.6; }
.wr-list { display: flex; flex-direction: column; gap: 22px; }
.wr-block { }
.wr-q { display: block; color: var(--gray-800); font-size: 15.5px; margin-bottom: 8px; }
.wr-q.wr-strong { font-weight: 700; }
.wr-email-main { color: var(--gray-700, #374151); font-size: 15px; line-height: 1.7; margin: 0 0 8px; }
.wr-input, .wr-textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 15px; font-family: inherit; color: var(--gray-800);
}
.wr-input:focus, .wr-textarea:focus { outline: none; border-color: var(--navy); }
.wr-textarea { resize: vertical; line-height: 1.6; }
.wr-wc { text-align: right; color: var(--gray-600); font-size: 14px; margin-top: 6px; }
.wr-sample {
  margin-top: 10px; background: #ECFDF5; border-left: 4px solid var(--emerald);
  border-radius: 8px; padding: 12px 16px; color: var(--gray-800); font-size: 15px; line-height: 1.7;
}
.wr-sample-label { font-weight: 700; color: var(--emerald-600); }

/* Nút Đáp án mẫu (cyan) */
.btn-info { background: #22CDE6; color: #083344; border: none; }
.btn-info:hover { background: #10bcd6; color: #083344; }

/* ===== Trang kho từ vựng ===== */
.vocab-count { color: var(--gray-600); margin-bottom: 16px; }
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.vocab-card { position: relative; background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.vocab-en { font-weight: 700; color: var(--navy); font-size: 17px; margin-bottom: 4px; }
.vocab-vi { color: var(--gray-600); font-size: 14.5px; }
.vocab-del { position: absolute; top: 6px; right: 10px; background: none; border: none; color: var(--gray-400); font-size: 20px; cursor: pointer; line-height: 1; }
.vocab-del:hover { color: #DC2626; }

@media (max-width: 720px) {
  .lis-qbox { padding: 18px; }
}

@media (max-width: 560px) {
  .modal-title { font-size: 18px; }
  .modal-score { font-size: 23px; }
  .modal-class { font-size: 20px; }
  .review-table th, .review-table td { padding: 10px; font-size: 14px; }
}


/* ==========================================================================
   Pop-up "Mới cập nhật" (góc phải dưới) — chỉ dùng ở trang chủ
   ========================================================================== */
.announce {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 340px; max-width: calc(100vw - 32px);
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(14px); transition: opacity .25s ease, transform .25s ease;
}
.announce.is-open { opacity: 1; transform: translateY(0); }
.announce-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; background: var(--navy); color: var(--white);
}
.announce-title { font-size: 14px; font-weight: 700; }
.announce-close {
  border: 0; background: transparent; color: rgba(255, 255, 255, .8);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.announce-close:hover { color: var(--white); }
.announce-scroll { max-height: 232px; overflow: hidden; position: relative; }
.announce-track { list-style: none; margin: 0; padding: 0; }
.announce-track.is-scrolling {
  animation: announce-scroll var(--announce-duration, 18s) linear infinite;
}
/* Rê chuột vào để đọc -> dừng cuộn */
.announce:hover .announce-track.is-scrolling,
.announce:focus-within .announce-track.is-scrolling { animation-play-state: paused; }
@keyframes announce-scroll {
  from { transform: translateY(0); }
  to { transform: translateY(calc(-1 * var(--announce-shift, 0px))); }
}
.announce-item + .announce-item { border-top: 1px solid var(--gray-100); }
.announce-row {
  display: flex; gap: 10px; padding: 12px 14px;
  text-decoration: none; color: inherit; transition: background .15s ease;
}
.announce-row.is-link:hover { background: var(--gray-50); }
.announce-icon { font-size: 20px; line-height: 1.3; flex-shrink: 0; }
.announce-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.announce-body b { font-size: 14px; color: var(--navy); }
.announce-text { font-size: 13px; color: var(--gray-600); line-height: 1.45; }
.announce-date { font-size: 12px; color: var(--gray-400); }
.announce-row.is-link:hover .announce-body b { color: var(--emerald-600); }

@media (max-width: 480px) {
  .announce { right: 12px; left: 12px; bottom: 12px; width: auto; }
}

/* Người tắt hiệu ứng chuyển động: bỏ cuộn tự động, trả lại thanh cuộn tay */
@media (prefers-reduced-motion: reduce) {
  .announce { transition: none; }
  .announce-track.is-scrolling { animation: none; }
  .announce-scroll { overflow-y: auto; }
}
