/* === B1 English — Modern UI === */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --primary:        #1e3a8a;
  --primary-hover:  #1e40af;
  --primary-light:  #eff6ff;
  --accent:         #2563eb;
  --success:        #059669;
  --danger:         #dc2626;
  --warning:        #d97706;
  --border:         #e2e8f0;
  --border-strong:  #94a3b8;
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05), 0 1px 4px rgba(0,0,0,.04);
  --shadow:         0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.14);
  --nav-bg:         #0f172a;
  /* backward compat */
  --card-shadow:         0 1px 2px rgba(0,0,0,.05), 0 1px 4px rgba(0,0,0,.04);
  --card-shadow-hover:   0 8px 28px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > .container { flex: 1; }

/* ─────────────────────────────────────────────────────────
   NAVBAR
───────────────────────────────────────────────────────── */
.navbar {
  background: var(--nav-bg) !important;
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 0.5rem 0;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff !important;
}

.navbar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(99,102,241,.5);
}

/* Inactive nav link */
.navbar .nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,.5) !important;
  padding: 0.4rem 0.875rem !important;
  border-radius: 7px;
  transition: background .15s, color .15s;
}
.navbar .nav-link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9) !important;
}

/* Active nav link — super obvious: white pill + blue text */
.navbar .nav-link.active {
  background: #fff !important;
  color: var(--accent) !important;
  font-weight: 700;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
}

.navbar .dropdown-menu {
  border: none;
  border-radius: 14px;
  padding: 0.35rem;
  min-width: 220px;
  margin-top: 10px;
  background: #0f172a;
  box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08);
}

/* Mũi tên nhỏ trỏ lên navbar */
.navbar .dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px; height: 12px;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,.08);
  border-left: 1px solid rgba(255,255,255,.08);
  transform: rotate(45deg);
  border-radius: 2px 0 0 0;
}

.navbar .dropdown-item {
  border-radius: 9px;
  font-size: 0.855rem;
  padding: 0.52rem 0.875rem;
  color: rgba(255,255,255,.62);
  font-weight: 500;
  transition: background .13s, color .13s;
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.navbar .dropdown-item:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
}
.navbar .dropdown-item i {
  width: 18px;
  text-align: center;
  opacity: .7;
  transition: opacity .13s;
}
.navbar .dropdown-item:hover i { opacity: 1; }

/* Đăng xuất — đỏ */
.navbar .dropdown-item.text-danger {
  color: #f87171 !important;
}
.navbar .dropdown-item.text-danger:hover {
  background: rgba(239,68,68,.18) !important;
  color: #fca5a5 !important;
}

.navbar .dropdown-divider {
  border-color: rgba(255,255,255,.08) !important;
  margin: 0.25rem 0.5rem;
}

/* User info box bên trong dropdown user */
.navbar .dropdown-menu .px-3.py-2 {
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  margin-bottom: 0.25rem;
  padding: 0.65rem 0.875rem !important;
}
.navbar .dropdown-menu .px-3.py-2 div:first-child {
  color: rgba(255,255,255,.92) !important;
}
.navbar .dropdown-menu .px-3.py-2 div:last-child {
  color: rgba(255,255,255,.38) !important;
}

/* User avatar */
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-role-badge {
  font-size: 0.64rem;
  padding: 0.12rem 0.42rem;
  border-radius: 20px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.navbar-toggler { border: none !important; box-shadow: none !important; }

/* ─────────────────────────────────────────────────────────
   MOBILE DRAWER (offcanvas-start, đặt ngoài navbar)
───────────────────────────────────────────────────────── */

/* Drawer container */
#navDrawer {
  --bs-offcanvas-width: 288px;
  background: linear-gradient(170deg, #0f172a 0%, #131e35 100%);
  border-right: 1px solid rgba(255,255,255,.07) !important;
  box-shadow: 4px 0 32px rgba(0,0,0,.45);
}

/* Header row */
#navDrawer .offcanvas-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  align-items: center;
}

.navbar-drawer-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: #fff;
}

/* Body */
#navDrawer .offcanvas-body {
  padding: .625rem .875rem 1.25rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 0;
}

/* ── Nav list ─────────────────────── */
.drawer-nav {
  list-style: none;
  padding: .375rem 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  text-decoration: none;
  transition: background .13s, color .13s;
  line-height: 1.4;
}
.drawer-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .13s;
}
.drawer-link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
}
.drawer-link:hover i { opacity: 1; }

.drawer-link.active {
  background: linear-gradient(135deg, rgba(37,99,235,.85), rgba(79,70,229,.75));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(37,99,235,.35);
}
.drawer-link.active i { opacity: 1; }

/* Section label — Admin */
.drawer-section-label {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,.22);
  padding: 1.1rem .875rem .3rem;
}

/* Danger / logout link */
.drawer-link-danger {
  color: #f87171;
}
.drawer-link-danger i { opacity: 1; color: #f87171; }
.drawer-link-danger:hover {
  background: rgba(239,68,68,.16);
  color: #fca5a5;
}

/* ── User card (bottom) ───────────── */
.drawer-user-section {
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.drawer-user-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .875rem;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: .35rem;
}

.drawer-user-card .user-avatar {
  width: 38px;
  height: 38px;
  font-size: .8rem;
  flex-shrink: 0;
}

.drawer-user-info {
  flex: 1;
  min-width: 0;
}

.drawer-user-name {
  font-size: .875rem;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-email {
  font-size: .72rem;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .1rem;
}

/* ─────────────────────────────────────────────────────────
   BREADCRUMB — replace "/" with "›"
───────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.82rem;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  flex-wrap: nowrap;
  overflow: hidden;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›" !important;
  color: #94a3b8;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1;
}

.breadcrumb-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.breadcrumb-item a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb-item.active { color: var(--text-muted); font-weight: 600; }

/* Breadcrumb wrapper (used by some pages with custom class) */
.parts-breadcrumb,
.writing-breadcrumb,
.result-breadcrumb,
.grade-breadcrumb,
.create-breadcrumb,
.users-breadcrumb,
.spk-breadcrumb {
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.4rem;
  flex-wrap: wrap;
}
.parts-breadcrumb a,
.writing-breadcrumb a,
.result-breadcrumb a,
.grade-breadcrumb a,
.create-breadcrumb a,
.users-breadcrumb a,
.spk-breadcrumb a {
  color: var(--accent); text-decoration: none; font-weight: 500;
}
.parts-breadcrumb a:hover,
.writing-breadcrumb a:hover,
.result-breadcrumb a:hover,
.grade-breadcrumb a:hover,
.create-breadcrumb a:hover,
.users-breadcrumb a:hover,
.spk-breadcrumb a:hover { text-decoration: underline; }

/* Sep in custom breadcrumbs (.sep class) */
.sep { color: #94a3b8 !important; font-size: 1rem; }

/* ─────────────────────────────────────────────────────────
   AUTH PAGES (split-screen)
───────────────────────────────────────────────────────── */
.auth-body { background: #f1f5f9; }

.auth-split {
  min-height: 100vh;
  display: flex;
}

.auth-brand-panel {
  display: none;
  width: 420px;
  min-width: 400px;
  background: linear-gradient(150deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
  padding: 3rem 2.75rem;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}
@media (min-width: 860px) { .auth-brand-panel { display: flex; } }

.auth-panel-logo {
  width: 56px; height: 56px;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin-bottom: 1.25rem;
}
.auth-panel-brand    { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
.auth-panel-tagline  { font-size: .9rem; opacity: .75; line-height: 1.65; }

.auth-features { display: flex; flex-direction: column; gap: 1rem; }
.auth-feat {
  display: flex; align-items: center; gap: 1rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px; padding: .9rem 1.1rem;
}
.auth-feat-icon {
  width: 40px; height: 40px; min-width: 40px;
  background: rgba(255,255,255,.18); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.auth-feat-title { font-weight: 700; font-size: .9rem; margin-bottom: .1rem; }
.auth-feat-sub   { font-size: .76rem; opacity: .7; }

.auth-panel-deco {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.auth-panel-deco-1 { width: 300px; height: 300px; bottom: -90px; right: -90px; }
.auth-panel-deco-2 { width: 180px; height: 180px; top: 30px; right: -40px; }

.auth-form-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem 1.5rem;
  background: #fff;
  overflow-y: auto;
}
.auth-form-inner { width: 100%; max-width: 400px; }

.auth-mobile-brand {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: 2rem;
}
.auth-mobile-brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #2563eb, #6366f1); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.auth-mobile-brand-name { font-size: 1.15rem; font-weight: 800; color: #0f172a; }

.auth-form-title  { font-size: 1.6rem; font-weight: 800; color: #0f172a; letter-spacing: -.03em; margin-bottom: .35rem; }
.auth-form-sub    { font-size: .875rem; color: #64748b; margin-bottom: 1.75rem; }

.auth-field       { margin-bottom: 1.1rem; }
.auth-label {
  display: block; font-size: .8125rem; font-weight: 600;
  color: #374151; margin-bottom: .4rem;
}
.auth-input-wrap        { position: relative; }
.auth-input-icon-left   {
  position: absolute; left: .875rem; top: 50%; transform: translateY(-50%);
  color: #9ca3af; font-size: .9rem; pointer-events: none;
}
.auth-input {
  width: 100%;
  padding: .7rem .875rem .7rem 2.5rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px; font-size: .9375rem;
  color: #0f172a; background: #f8fafc;
  transition: border-color .18s, box-shadow .18s, background .18s;
  outline: none; font-family: inherit;
}
.auth-input:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.auth-input.has-right { padding-right: 2.5rem; }
.auth-eye-btn {
  position: absolute; right: .875rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #9ca3af;
  cursor: pointer; font-size: .9rem; padding: .1rem;
  transition: color .18s; line-height: 1;
}
.auth-eye-btn:hover { color: #475569; }

.auth-submit {
  width: 100%; padding: .8rem;
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border: none;
  border-radius: 10px; font-size: .9375rem; font-weight: 700;
  font-family: inherit; cursor: pointer; letter-spacing: -.01em;
  transition: opacity .18s, box-shadow .18s, transform .12s;
  margin-top: .5rem;
}
.auth-submit:hover {
  opacity: .92;
  box-shadow: 0 6px 24px rgba(30,58,138,.35);
  transform: translateY(-1px);
}
.auth-submit:active { transform: translateY(0); }

.auth-switch {
  text-align: center; color: #64748b;
  font-size: .875rem; margin-top: 1.5rem; margin-bottom: 0;
}
.auth-switch a { color: #2563eb; font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.auth-alert {
  display: flex; align-items: flex-start; gap: .45rem;
  padding: .75rem .875rem; border-radius: 8px;
  font-size: .875rem; margin-bottom: 1.25rem; line-height: 1.5;
}
.auth-alert-danger  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.auth-alert-success { background: #f0fdf4; color: #059669; border: 1px solid #bbf7d0; }

/* Backward compat alert aliases */
.alert-modern         { display: flex; align-items: flex-start; gap: .45rem; padding: .75rem .875rem; border-radius: 8px; font-size: .875rem; margin-bottom: 1rem; line-height: 1.5; }
.alert-modern-danger  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-modern-success { background: #f0fdf4; color: #059669; border: 1px solid #bbf7d0; }
.alert-modern-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ─────────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text);
  background: #f8fafc;
  padding: 0.875rem 1.25rem;
}

/* ─────────────────────────────────────────────────────────
   STAT CARDS
───────────────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.stat-card-blue   .stat-card-accent { background: #2563eb; }
.stat-card-green  .stat-card-accent { background: #059669; }
.stat-card-orange .stat-card-accent { background: #d97706; }
.stat-card-teal   .stat-card-accent { background: #0891b2; }

.stat-card-value {
  font-size: 2rem; font-weight: 800;
  letter-spacing: -0.04em; line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-card-blue   .stat-card-value { color: #2563eb; }
.stat-card-green  .stat-card-value { color: #059669; }
.stat-card-orange .stat-card-value { color: #d97706; }
.stat-card-teal   .stat-card-value { color: #0891b2; }

.stat-card-label {
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-card-icon {
  position: absolute; right: 1.25rem; top: 50%;
  transform: translateY(-50%);
  font-size: 2.2rem; opacity: 0.08;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────
   SKILL CARDS (practice/index.php)
───────────────────────────────────────────────────────── */
.skill-card {
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, border-color .2s;
  cursor: pointer;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius) !important;
}
.skill-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0,0,0,.14);
  border-color: var(--accent) !important;
}

.skill-icon-wrap {
  width: 72px; height: 72px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.skill-icon-listening { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.skill-icon-reading   { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.skill-icon-writing   { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }

.skill-name { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.skill-name-listening { color: #1d4ed8; }
.skill-name-reading   { color: #065f46; }
.skill-name-writing   { color: #92400e; }

/* ─────────────────────────────────────────────────────────
   PART CARDS
───────────────────────────────────────────────────────── */
.part-card {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.part-card:hover {
  border-color: var(--accent) !important;
  background: #f0f7ff !important;
  box-shadow: var(--shadow-sm);
}

.part-badge {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
}

/* ─────────────────────────────────────────────────────────
   EXAM LAYOUT
───────────────────────────────────────────────────────── */
.exam-page-wrap {
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 4rem;
}

.exam-part-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

/* Part tab navigation */
.part-tab-bar {
  display: flex; gap: .35rem; margin-bottom: 1.5rem;
  background: #f1f5f9; border-radius: 12px; padding: .3rem;
}
.part-tab-btn {
  flex: 1; border: none; background: transparent; border-radius: 9px;
  padding: .6rem .4rem; font-size: .82rem; font-weight: 600; color: #64748b;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.part-tab-btn.active { background: #fff; color: #1d4ed8; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.part-tab-btn.visited { color: #059669; }

.btn-next-part {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: .65rem 1.5rem; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn-next-part:hover { background: var(--primary); box-shadow: 0 4px 16px rgba(37,99,235,.3); }

.exam-part-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-part-title {
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.exam-part-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.2rem 0.65rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.exam-part-body { padding: 1.5rem; }

.exam-instructions {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--accent);
}

/* ─────────────────────────────────────────────────────────
   AUDIO PLAYER
───────────────────────────────────────────────────────── */
.audio-player-wrap {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
}
.audio-player-wrap audio { width: 100%; margin-top: 0.5rem; }

/* ─────────────────────────────────────────────────────────
   PASSAGE BOX (exam paper style)
───────────────────────────────────────────────────────── */
.passage-box {
  border: 1.5px solid #94a3b8;
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  background: #fff;
  font-family: 'Lora', Georgia, Cambria, serif;
  font-size: 0.9375rem;
  line-height: 1.85;
  margin-bottom: 1.5rem;
}

.passage-title {
  font-size: 1.05rem; font-weight: 700;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  font-family: 'Lora', Georgia, Cambria, serif;
  color: #0f172a;
}

/* ─────────────────────────────────────────────────────────
   QUESTION STYLES
───────────────────────────────────────────────────────── */
.q-block {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #f1f5f9;
}
.q-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.q-header {
  display: flex; align-items: flex-start; gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.q-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px;
  background: var(--accent); color: #fff;
  border-radius: 50%;
  font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
  margin-top: 1px;
  box-shadow: 0 2px 6px rgba(37,99,235,.3);
}

.q-text {
  font-weight: 600; font-size: 0.9375rem;
  color: var(--text); line-height: 1.5; flex: 1;
}

/* Short text box (Part 1 Reading) */
.short-text-box {
  border: 1.5px solid #94a3b8;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 1rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.875rem;
  line-height: 1.7;
  min-height: 90px;
  display: flex; align-items: center;
}
.short-text-box--img { padding: 0; overflow: hidden; display: block; }
.short-text-box--img img { width: 100%; height: auto; display: block; border-radius: calc(var(--radius-sm) - 2px); object-fit: cover; }

/* ─────────────────────────────────────────────────────────
   MCQ OPTIONS
───────────────────────────────────────────────────────── */
.option-list { list-style: none; padding: 0; margin: 0; }

.option-item {
  display: flex; align-items: flex-start; gap: 0;
  margin-bottom: 0.4rem;
}

.option-input { display: none; }

.option-label {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  font-size: 0.9rem; line-height: 1.5;
  margin-bottom: 0.55rem;
  transition: border-color .15s, background .15s, box-shadow .15s;
  background: #fff;
}
.option-label:hover {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.06);
}

.option-letter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px;
  border: 1.5px solid #cbd5e1;
  border-radius: 50%;
  font-size: 0.78rem; font-weight: 700;
  color: #64748b; flex-shrink: 0; margin-top: 0;
  transition: all .15s;
}

.option-input:checked + .option-label {
  border-color: var(--accent);
  background: #eff6ff;
}
.option-input:checked + .option-label .option-letter {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ─────────────────────────────────────────────────────────
   IMAGE MCQ (Listening Part 1)
───────────────────────────────────────────────────────── */
.img-option-input { display: none; }
.img-option-label { cursor: pointer; display: block; }

.img-opt-img-box {
  border: 2px solid #e2e8f0; border-radius: var(--radius-sm); overflow: hidden;
  background: #f8fafc; margin-bottom: 0.45rem;
  transition: border-color .15s, box-shadow .15s;
}
.img-opt-img-box img { width: 100%; height: 140px; object-fit: contain; display: block; }
.img-opt-img-box .img-placeholder { height: 140px; display: flex; align-items: center; justify-content: center; }

.img-opt-tick-row { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.img-opt-tick {
  width: 24px; height: 24px; border: 1.5px solid #cbd5e1; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0; color: #fff; font-weight: 900; transition: all .15s;
}
.img-opt-letter { font-weight: 700; font-size: 0.875rem; color: #374151; transition: color .15s; }

.img-option-input:checked + .img-option-label .img-opt-img-box {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.img-option-input:checked + .img-option-label .img-opt-tick {
  background: var(--accent); border-color: var(--accent); font-size: 0.9rem;
}
.img-option-input:checked + .img-option-label .img-opt-letter { color: var(--accent); }
.img-option-label:hover .img-opt-img-box { border-color: var(--accent); }

/* ─────────────────────────────────────────────────────────
   TICK MCQ (Listening Part 2)
───────────────────────────────────────────────────────── */
.tick-option-input { display: none; }
.tick-option-label {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid #e2e8f0; border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 0.55rem; font-size: 0.9rem; line-height: 1.5;
  background: #fff;
}
.tick-option-label:hover { border-color: var(--accent); background: #eff6ff; }

.tick-box {
  width: 22px; height: 22px; min-width: 22px;
  border: 1.5px solid #cbd5e1; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0; color: transparent; font-weight: 900;
  transition: all .15s; margin-top: 1px;
}
.tick-option-input:checked + .tick-option-label { border-color: var(--accent); background: #eff6ff; }
.tick-option-input:checked + .tick-option-label .tick-box {
  background: var(--accent); border-color: var(--accent); color: #fff; font-size: 0.85rem;
}
.tick-option-letter { font-weight: 700; min-width: 16px; color: #374151; flex-shrink: 0; margin-top: 1px; }

/* ─────────────────────────────────────────────────────────
   TRUE/FALSE (Listening Part 4)
───────────────────────────────────────────────────────── */
.tf-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.tf-table thead th {
  background: #f8fafc; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: #64748b;
  padding: 0.65rem 1rem; border-bottom: 2px solid var(--border);
}
.tf-table thead th.tf-th-yn { width: 80px; text-align: center; }
.tf-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tf-table tbody tr:last-child td { border-bottom: none; }
.tf-table tbody tr:hover td { background: #f8faff; }
.tf-answered td { background: #f0fdf4 !important; }

.tf-box-input { display: none; }
.tf-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 7px; cursor: pointer;
  font-size: 0; font-weight: 900; transition: all .15s;
}
.tf-box-yes { border: 1.5px solid #86efac; background: #f0fdf4; color: var(--success); }
.tf-box-yes:hover { border-color: var(--success); background: #dcfce7; }
.tf-box-no  { border: 1.5px solid #fca5a5; background: #fff1f2; color: var(--danger); }
.tf-box-no:hover  { border-color: var(--danger); background: #fee2e2; }
.tf-box-input:checked + .tf-box-yes { background: var(--success); border-color: var(--success); color: #fff; font-size: 1rem; }
.tf-box-input:checked + .tf-box-no  { background: var(--danger); border-color: var(--danger); color: #fff; font-size: 1rem; }
.tf-stmt { font-size: 0.9rem; line-height: 1.5; color: var(--text); }

/* ─────────────────────────────────────────────────────────
   GAPPED OPTIONS PANEL
───────────────────────────────────────────────────────── */
.gap-panel {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.gap-sentence-item {
  display: flex; gap: 0.5rem; align-items: flex-start;
  padding: 0.5rem 0.6rem; border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem; line-height: 1.5;
}
.gap-sentence-item:last-child { border-bottom: none; }
.gap-sentence-label {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  background: var(--accent); color: #fff;
  border-radius: 5px; font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.gap-sentence-label.distractor { background: var(--accent); }

/* Gap inputs */
.gap-input {
  display: inline-block; min-width: 100px;
  border: none; border-bottom: 2px solid var(--accent);
  background: #eff6ff; padding: 0.1rem 0.35rem;
  border-radius: 4px 4px 0 0; font-size: 0.875rem;
  text-align: center; outline: none; font-family: inherit;
}

.gap-select {
  display: inline-block; min-width: 120px;
  border: 1.5px solid var(--accent); border-radius: 6px;
  padding: 0.1rem 0.3rem; font-size: 0.82rem;
  background: #eff6ff; font-family: inherit; cursor: pointer;
}

/* ─────────────────────────────────────────────────────────
   CLOZE MCQ OPTIONS ROW
───────────────────────────────────────────────────────── */
.cloze-q-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 0.45rem; background: #fff;
  font-size: 0.875rem;
}
.cloze-q-num { font-weight: 700; color: var(--accent); min-width: 26px; flex-shrink: 0; }

.cloze-radio-input { display: none; }
.cloze-radio-label {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
  padding: 0.32rem 0.5rem;
  border: 1.5px solid #e2e8f0; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem; text-align: center;
  transition: border-color .12s, background .12s;
  min-width: 70px;
}
.cloze-radio-label:hover { border-color: var(--accent); background: #eff6ff; }
.cloze-radio-input:checked + .cloze-radio-label {
  border-color: var(--accent); background: #eff6ff; font-weight: 600; color: var(--accent);
}

/* ─────────────────────────────────────────────────────────
   MATCHING LAYOUT
───────────────────────────────────────────────────────── */
.matching-person {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem 1.1rem; border: 1.5px solid #e2e8f0;
  border-radius: 14px; margin-bottom: 0.65rem; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.matching-person:hover { border-color: #c7d2fe; box-shadow: 0 4px 14px rgba(99,102,241,.1); }

.matching-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 0.82rem; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.matching-person-photo { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; flex-shrink: 0; border: 2px solid #e2e8f0; }
.matching-person-body  { flex: 1; font-size: 0.875rem; line-height: 1.55; min-width: 0; }
.matching-person-name  { font-weight: 700; color: #0f172a; font-size: .9rem; }
.matching-person-desc  { color: #374151; margin-top: .15rem; }
.matching-select {
  min-width: 90px; font-size: 0.875rem; font-weight: 700;
  border: 2px solid var(--accent); border-radius: 8px;
  padding: 0.4rem 0.5rem; background: #eff6ff; color: var(--accent);
  flex-shrink: 0; align-self: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.matching-select:focus { outline: none; border-color: #6366f1; background: #eef2ff; }

.matching-options-panel { background: #f8fafc; border-radius: 14px; padding: 1rem; }
.matching-option-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 0.75rem 0.875rem; border: 1.5px solid #e2e8f0;
  border-radius: 10px; margin-bottom: 0.5rem; background: #fff;
  font-size: 0.85rem; line-height: 1.55;
  transition: border-color .12s;
}
.matching-option-item:last-child { margin-bottom: 0; }
.matching-option-item:hover { border-color: #a5b4fc; }
.matching-option-label {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; background: #6366f1; color: #fff;
  border-radius: 7px; font-size: 0.8rem; font-weight: 800;
  flex-shrink: 0; margin-top: .05rem;
}
.matching-option-body  { flex: 1; min-width: 0; }
.matching-option-title { font-weight: 700; color: #1e293b; margin-bottom: .1rem; }

/* ─────────────────────────────────────────────────────────
   WRITING PAGE
───────────────────────────────────────────────────────── */
.writing-prompt-box {
  border: 1.5px solid #fbbf24;
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  border-radius: var(--radius-sm);
  padding: 1.25rem; margin-bottom: 1.25rem;
}
#writing-area {
  font-size: 1rem; line-height: 1.8;
  min-height: 280px; resize: vertical; font-family: inherit;
}
.word-counter { color: var(--text-muted); font-size: 0.8rem; }

/* ─────────────────────────────────────────────────────────
   RESULT PAGE
───────────────────────────────────────────────────────── */
.result-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff; border-radius: var(--radius);
  padding: 1.75rem; margin-bottom: 1.5rem;
}

.result-score-circle {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800;
  border: 3px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}

.answer-correct { background: #f0fdf4 !important; border-left: 4px solid var(--success) !important; }
.answer-wrong   { background: #fef2f2 !important; border-left: 4px solid var(--danger) !important; }
.answer-badge-correct { background: var(--success) !important; }
.answer-badge-wrong   { background: var(--danger) !important; }

/* ─────────────────────────────────────────────────────────
   ADMIN AREA
───────────────────────────────────────────────────────── */
.admin-stat-card { border-left: 4px solid var(--primary); }
.admin-stat-card.stat-listening { border-left-color: #2563eb; }
.admin-stat-card.stat-reading   { border-left-color: var(--success); }
.admin-stat-card.stat-writing   { border-left-color: #d97706; }

.badge-listening { background: #2563eb !important; color: #fff !important; }
.badge-reading   { background: var(--success) !important; color: #fff !important; }
.badge-writing   { background: #d97706 !important; color: #fff !important; }

/* ─────────────────────────────────────────────────────────
   FORM OVERRIDES
───────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid #e2e8f0;
  font-size: 0.9375rem;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-label { font-weight: 600; font-size: 0.875rem; color: #374151; }
.required::after { content: " *"; color: var(--danger); }

/* ─────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 0.875rem; }
.btn-primary  { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover  { background: var(--primary); border-color: var(--primary); }
.btn-success  { background: var(--success); border-color: var(--success); }
.btn-success:hover  { background: #047857; border-color: #047857; }
.btn-warning  { background: #d97706; border-color: #d97706; color: #fff; }
.btn-warning:hover  { background: #b45309; border-color: #b45309; color: #fff; }
.btn-info     { background: #0891b2; border-color: #0891b2; color: #fff; }
.btn-info:hover     { background: #0e7490; border-color: #0e7490; color: #fff; }

.btn-exam-submit {
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border: none;
  padding: 0.75rem 2.5rem; border-radius: 10px;
  font-size: 1rem; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: opacity .2s, box-shadow .2s;
}
.btn-exam-submit:hover {
  opacity: .92;
  box-shadow: 0 6px 24px rgba(30,58,138,.35);
}

/* ─────────────────────────────────────────────────────────
   ALERT
───────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); border: none; }

/* ─────────────────────────────────────────────────────────
   TABLE
───────────────────────────────────────────────────────── */
.table { font-size: 0.9rem; }
.table thead th { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────
   FOOTER
───────────────────────────────────────────────────────── */
.site-footer {
  background: var(--nav-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.45);
  padding: 1.5rem 0;
  margin-top: 3rem;
  font-size: 0.875rem;
}
.site-footer strong, .site-footer b { color: rgba(255,255,255,.85); }

/* ─────────────────────────────────────────────────────────
   DASHBOARD — hero + cards (overrides inline styles on page)
───────────────────────────────────────────────────────── */
.db-hero {
  background: linear-gradient(130deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  border-radius: 20px;
  padding: 2rem 2.25rem;
  color: #fff;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}
.db-hero::before {
  content: '';
  position: absolute; right: -80px; top: -80px;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  pointer-events: none;
}
.db-hero::after {
  content: '';
  position: absolute; left: -40px; bottom: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  pointer-events: none;
}
.db-hero-greeting { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .25rem; }
.db-hero-sub      { font-size: .9rem; opacity: .7; margin-bottom: 1.5rem; }
.db-hero-stats    { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.db-hero-stat     { display: flex; flex-direction: column; }
.db-hero-stat-val { font-size: 1.6rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.db-hero-stat-lbl { font-size: .72rem; opacity: .6; margin-top: .25rem; text-transform: uppercase; letter-spacing: .05em; }
.db-hero-divider  { width: 1px; background: rgba(255,255,255,.2); align-self: stretch; margin: .2rem 0; }
.db-hero-btn {
  position: absolute; right: 2.25rem; bottom: 2rem;
  background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.2);
  color: #fff; padding: .55rem 1.25rem; border-radius: 10px;
  font-size: .875rem; font-weight: 700; text-decoration: none;
  transition: background .18s; display: inline-flex; align-items: center; gap: .4rem;
}
.db-hero-btn:hover { background: rgba(255,255,255,.22); color: #fff; }

/* Skill grid */
.db-skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.db-skill-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  text-decoration: none;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, border-color .2s;
  display: block;
}
.db-skill-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0,0,0,.12);
  border-color: #93c5fd;
}
.db-skill-icon {
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin: 0 auto .875rem;
}
.db-skill-name  { font-size: 1rem; font-weight: 800; letter-spacing: .03em; margin-bottom: .2rem; }
.db-skill-desc  { font-size: .75rem; color: #94a3b8; margin-bottom: .75rem; }
.db-skill-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .2rem .65rem; border-radius: 20px; color: #fff;
}

/* Section heading */
.db-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem;
}
.db-section-title { font-size: 1rem; font-weight: 700; color: #0f172a; margin: 0; }
.db-section-link {
  font-size: .78rem; color: #2563eb; font-weight: 600;
  text-decoration: none; display: flex; align-items: center; gap: .25rem;
}
.db-section-link:hover { text-decoration: underline; }

/* Activity list */
.db-activity {
  background: #fff; border: 1.5px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
  margin-bottom: 2rem;
}
.db-activity-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s; cursor: default;
}
.db-activity-row:last-child { border-bottom: none; }
.db-activity-row:hover { background: #f8faff; }
.db-score-ring {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem;
}
.db-activity-info    { flex: 1; min-width: 0; }
.db-activity-title   { font-weight: 600; font-size: .875rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .2rem; }
.db-activity-meta    { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.db-skill-chip       { display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .5rem; border-radius: 20px; font-size: .7rem; font-weight: 600; }
.db-time-chip        { font-size: .71rem; color: #94a3b8; }
.db-score-bar        { width: 70px; flex-shrink: 0; }
.db-score-bar-track  { height: 4px; background: #f1f5f9; border-radius: 2px; margin-bottom: .2rem; }
.db-score-bar-fill   { height: 100%; border-radius: 2px; }
.db-score-bar-val    { font-size: .7rem; font-weight: 700; text-align: right; }
.db-result-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .3rem .8rem; border-radius: 7px;
  font-size: .78rem; font-weight: 600; flex-shrink: 0;
  background: #eff6ff; color: #2563eb;
  border: 1.5px solid #bfdbfe; text-decoration: none;
  transition: all .15s;
}
.db-result-btn:hover { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Writing cards */
.db-writing { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 16px; overflow: hidden; }
.db-writing-row {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .875rem 1.25rem; border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.db-writing-row:last-child { border-bottom: none; }
.db-writing-row:hover { background: #f8faff; }

/* ── Exam history rows (clickable cards) ─────────────────── */
.db-exam-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none; color: inherit;
  transition: background .12s;
}
.db-exam-row:last-child { border-bottom: none; }
.db-exam-row.clickable:hover {
  background: #f0f7ff;
  text-decoration: none;
}
.db-exam-row.clickable:hover .db-exam-arrow { opacity: 1; transform: translateX(3px); }

.db-exam-skill-icon {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
}

.db-exam-info    { flex: 1; min-width: 0; }
.db-exam-title   { font-weight: 600; font-size: .9rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .3rem; }
.db-exam-meta    { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.db-exam-skill-tag {
  font-size: .7rem; font-weight: 700; padding: .15rem .55rem;
  border-radius: 20px; white-space: nowrap;
}
.db-exam-date    { font-size: .72rem; color: #94a3b8; display: flex; align-items: center; gap: .25rem; }
.db-exam-pending { font-size: .72rem; color: #d97706; font-weight: 600; display: flex; align-items: center; gap: .25rem; }

.db-exam-right   { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.db-exam-score {
  min-width: 52px; height: 36px; border-radius: 9px; border: 1.5px solid;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem; padding: 0 .5rem;
}
.db-exam-arrow {
  color: #94a3b8; font-size: .85rem;
  opacity: .4; transition: opacity .15s, transform .15s;
}

/* Empty state */
.db-empty {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 16px;
  padding: 3rem 1rem; text-align: center; margin-bottom: 2rem;
}
.db-empty-icon  { font-size: 2.5rem; color: #cbd5e1; margin-bottom: .875rem; }
.db-empty-title { font-weight: 700; color: #0f172a; margin-bottom: .35rem; }
.db-empty-sub   { font-size: .875rem; color: #94a3b8; margin-bottom: 1.25rem; }

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — general
───────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .exam-part-body { padding: 1rem; }
  .passage-box { font-size: 0.875rem; }
  .stat-card-value { font-size: 1.75rem; }
  .img-opt-img-box img { height: 100px; }
  .auth-card-body { padding: 1.5rem; }
  .db-hero { padding: 1.5rem 1.25rem; }
  .db-hero-btn { display: none !important; }
  .db-hero-greeting { font-size: 1.3rem; }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — EXAM PARTS (mobile fixes)
───────────────────────────────────────────────────────── */

/* Passage box: cho phép scroll ngang thay vì tràn ra ngoài */
.passage-box {
  overflow-x: auto;
  word-break: break-word;
}

/* ── Listening Part 3 — audio_fill: gap-input nhỏ hơn ── */
@media (max-width: 640px) {
  .gap-input {
    min-width: 70px;
    max-width: 100px;
    font-size: .8rem;
    padding: .1rem .25rem;
  }
}

/* ── Listening Part 4 — audio_true_false: table compact ── */
@media (max-width: 640px) {
  .tf-table { font-size: .82rem; }
  .tf-table thead th { padding: .5rem .6rem; font-size: .68rem; }
  .tf-table thead th.tf-th-yn { width: 54px; }
  .tf-table tbody td { padding: .6rem .6rem; }
  .tf-box { width: 30px; height: 30px; border-radius: 6px; }
  .tf-stmt { font-size: .82rem; }
}

/* ── Reading Part 2 — matching: reflow thành 2 dòng trên mobile ── */
@media (max-width: 640px) {
  .matching-person {
    flex-wrap: wrap;
    gap: .6rem .5rem;
    padding: .875rem .875rem;
  }

  /* Số thứ tự + ảnh + nội dung = dòng 1 */
  .matching-num { order: 0; flex-shrink: 0; }

  .matching-person-photo {
    order: 1;
    width: 52px; height: 52px;
  }

  .matching-person-body {
    order: 2;
    flex: 1 1 calc(100% - 110px);
    min-width: 0;
  }

  /* Select "Chọn" = dòng 2, full width */
  .matching-person > div:last-child {
    order: 10;
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-left: 2rem;
  }

  .matching-select {
    flex: 1;
    min-width: 0;
    width: 100%;
    font-size: .8rem;
  }
}

/* ── Reading Part 4 — gapped_text: gap-select nhỏ hơn ── */
@media (max-width: 640px) {
  .gap-select {
    min-width: 90px;
    font-size: .78rem;
    padding: .05rem .2rem;
  }

  /* Passage chứa inline select: line-height ngắn hơn cho dễ đọc */
  .passage-box { line-height: 1.85; }
}

/* ── Cloze radio labels wrap đúng trên mobile ── */
@media (max-width: 520px) {
  .cloze-q-row {
    flex-wrap: wrap;
    gap: .35rem;
  }
  .cloze-radio-label {
    flex: 1 1 42%;
    min-width: 0;
    font-size: .8rem;
  }
}

/* ── Part tab bar scroll ngang khi nhiều tab ── */
@media (max-width: 576px) {
  .part-tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .part-tab-bar::-webkit-scrollbar { display: none; }
  .part-tab-btn { flex-shrink: 0; font-size: .78rem; padding: .55rem .5rem; }
}
}
