:root {
  --navy-950: #0b1629;
  --navy-900: #132542;
  --navy-800: #1f3864;
  --blue-600: #1d7ec2;
  --blue-500: #2d9cdb;
  --blue-400: #4db6f7;
  --blue-100: #e6f4fd;
  --blue-50: #f2f9fe;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --purple-600: #7c3aed;
  --purple-100: #ede9fe;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 45px -12px rgba(19, 37, 66, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--slate-50);
  color: var(--slate-900);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  margin: 0;
}

button, input, select, textarea {
  font-family: inherit;
}

a { color: var(--blue-600); text-decoration: none; }

/* Boot Loader */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--slate-600);
}
.boot-logo { width: 64px; height: 64px; object-fit: contain; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth / Landing Gate */
.auth-page {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 15%, rgba(77, 182, 247, 0.22), transparent 45%),
              radial-gradient(circle at 85% 80%, rgba(31, 56, 100, 0.18), transparent 50%),
              linear-gradient(135deg, #0b1629 0%, #132542 55%, #19355e 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
}

.auth-topbar {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
}
.auth-brand-link img {
  height: 44px;
  width: auto;
  object-fit: contain;
}
.site-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #bae6fd;
  font-size: 13px;
  font-weight: 600;
}

.auth-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 44px;
  align-items: center;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(77, 182, 247, 0.16);
  border: 1px solid rgba(77, 182, 247, 0.35);
  color: #7dd3fc;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.auth-hero h1 {
  font-size: clamp(32px, 4.2vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.auth-hero h1 span {
  background: linear-gradient(90deg, #7dd3fc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-hero p {
  font-size: 17px;
  line-height: 1.65;
  color: #cbd5e1;
  margin: 0 0 28px;
  max-width: 580px;
}

.auth-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.auth-stat {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px;
}
.auth-stat strong {
  display: block;
  font-size: 24px;
  color: #7dd3fc;
  margin-bottom: 4px;
}
.auth-stat span {
  font-size: 13px;
  color: #cbd5e1;
}

.auth-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  font-size: 14px;
  color: #e2e8f0;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-feature .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  flex-shrink: 0;
}

.auth-card {
  background: var(--white);
  color: var(--slate-900);
  border-radius: 22px;
  padding: 36px 32px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45);
}
.auth-card-logo {
  height: 46px;
  margin-bottom: 18px;
}
.auth-card h2 {
  font-size: 24px;
  color: var(--navy-800);
  margin-bottom: 8px;
}
.auth-card .sub {
  color: var(--slate-600);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 24px;
}

.google-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.gis-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
.btn-google-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-900);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-google-fallback:hover {
  background: var(--slate-50);
  border-color: var(--blue-500);
  box-shadow: var(--shadow-sm);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--slate-500);
  font-size: 12.5px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}
.auth-note {
  background: var(--blue-50);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--navy-800);
  line-height: 1.5;
}

/* App Shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
}
.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.brand-btn img {
  height: 36px;
  width: auto;
}
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}
.nav-tab {
  border: none;
  background: transparent;
  color: var(--slate-600);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-tab:hover {
  background: var(--slate-100);
  color: var(--navy-800);
}
.nav-tab.active {
  background: var(--blue-50);
  color: var(--blue-600);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lang-toggle {
  display: inline-flex;
  background: var(--slate-100);
  border-radius: 8px;
  padding: 2px;
}
.lang-toggle button {
  border: none;
  background: transparent;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  cursor: pointer;
}
.lang-toggle button.active {
  background: var(--white);
  color: var(--navy-800);
  box-shadow: var(--shadow-sm);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: var(--slate-100);
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy-800);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-900);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-logout:hover { background: var(--red-100); color: var(--red-600); border-color: #fecaca; }

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 20px 64px;
}

/* Dashboard Hero */
.hero-banner {
  background: linear-gradient(125deg, var(--navy-900) 0%, var(--navy-800) 55%, #1b5e96 100%);
  color: var(--white);
  border-radius: 20px;
  padding: 30px 32px;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 26px;
}
.hero-banner h1 { font-size: 28px; margin-bottom: 8px; }
.hero-banner p { color: #cbd5e1; margin: 0 0 20px; line-height: 1.55; max-width: 600px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-score-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.kpi-mini span { display: block; font-size: 12px; color: #bae6fd; margin-bottom: 4px; }
.kpi-mini strong { font-size: 24px; color: var(--white); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
  color: var(--white);
  box-shadow: 0 4px 14px rgba(45, 156, 219, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.22); }
.btn-outline {
  background: var(--white);
  color: var(--navy-800);
  border: 1px solid var(--slate-300);
}
.btn-outline:hover { background: var(--slate-50); border-color: var(--blue-500); }
.btn-danger {
  background: var(--red-600);
  color: var(--white);
}
.btn-success {
  background: var(--green-600);
  color: var(--white);
}
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* Skill Cards */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 21px; color: var(--navy-800); }
.section-sub { font-size: 14px; color: var(--slate-600); margin-top: 4px; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}
.skill-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.skill-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}
.skill-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 14px;
}
.skill-icon.listening { background: #e0f2fe; color: #0284c7; }
.skill-icon.reading { background: #ede9fe; color: #6d28d9; }
.skill-icon.writing { background: #dcfce7; color: #15803d; }
.skill-icon.speaking { background: #fef3c7; color: #b45309; }
.skill-card h3 { font-size: 18px; margin-bottom: 6px; color: var(--navy-800); }
.skill-card p { font-size: 13.5px; color: var(--slate-600); line-height: 1.5; margin: 0 0 16px; }
.skill-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 12px;
}
.progress-track {
  height: 7px;
  background: var(--slate-100);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-400));
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-c1 { background: #dcfce7; color: #15803d; }
.badge-b2 { background: #dbeafe; color: #1d4ed8; }
.badge-b1 { background: #fef3c7; color: #b45309; }
.badge-low { background: #fee2e2; color: #b91c1c; }
.badge-neutral { background: var(--slate-100); color: var(--slate-600); }

/* Test Catalog Grid */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-600);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.filter-pill.active {
  background: var(--navy-800);
  color: var(--white);
  border-color: var(--navy-800);
}
.search-input {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  font-size: 14px;
  min-width: 220px;
}

.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
}
.test-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.test-card:hover { border-color: var(--blue-400); box-shadow: var(--shadow-md); }
.test-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.test-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 800;
  font-size: 12.5px;
}
.test-card h3 { font-size: 16.5px; color: var(--navy-800); }
.test-card .meta { font-size: 12.5px; color: var(--slate-500); }
.test-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

/* =========================================================
   EXAM RUNNER (LISTENING & READING)
   ========================================================= */
.exam-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--slate-100);
}
.exam-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy-900);
  color: var(--white);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(11, 22, 41, 0.25);
}
.exam-header-left { display: flex; align-items: center; gap: 14px; }
.exam-title { font-size: 16px; font-weight: 700; }
.exam-mode-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(77, 182, 247, 0.2);
  color: #7dd3fc;
  text-transform: uppercase;
}
.exam-timer {
  font-family: 'Plus Jakarta Sans', monospace;
  font-size: 18px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  letter-spacing: 0.04em;
}
.exam-timer.warn { background: #b91c1c; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.78; } }

.exam-part-bar {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.part-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.part-tab {
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-700);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.part-tab.active {
  background: var(--navy-800);
  color: var(--white);
  border-color: var(--navy-800);
}

/* Audio Bar for Listening */
.audio-bar {
  background: #0f172a;
  color: var(--white);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid #1e293b;
}
.audio-bar audio {
  flex: 1;
  min-width: 240px;
  height: 36px;
}
.audio-status {
  font-size: 13px;
  color: #7dd3fc;
  font-weight: 600;
  white-space: nowrap;
}
.speed-pills { display: flex; gap: 4px; }
.speed-pill {
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.speed-pill.active { background: var(--blue-500); color: var(--white); border-color: var(--blue-500); }

/* Listening Workspace */
.listening-workspace {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 20px 90px;
}
.part-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 16px;
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
}
.part-card-head {
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.part-card-head h2 { font-size: 20px; color: var(--navy-800); margin-bottom: 6px; }
.part-instr { font-size: 14px; color: var(--slate-600); line-height: 1.5; margin: 0; }

/* Question Styles */
.q-list { display: flex; flex-direction: column; gap: 16px; }
.q-item {
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--slate-50);
}
.q-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.q-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--navy-800);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  margin-right: 8px;
}
.q-prompt { font-size: 15px; font-weight: 600; color: var(--slate-900); line-height: 1.45; }
.flag-btn {
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-500);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.flag-btn.flagged { background: var(--amber-100); color: var(--amber-600); border-color: #fcd34d; }

.opt-grid { display: flex; flex-direction: column; gap: 8px; }
.opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-900);
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.12s;
}
.opt-btn:hover { border-color: var(--blue-400); background: var(--blue-50); }
.opt-btn.selected {
  border-color: var(--blue-600);
  background: var(--blue-50);
  box-shadow: 0 0 0 2px rgba(45, 156, 219, 0.2);
}
.opt-key {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--slate-100);
  color: var(--navy-800);
  font-weight: 700;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.opt-btn.selected .opt-key { background: var(--blue-600); color: var(--white); }

/* Inline Note / Cloze Blank Inputs */
.note-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 20px 22px;
  font-size: 15.5px;
  line-height: 2.1;
  white-space: pre-wrap;
}
.inline-blank-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 3px;
  vertical-align: baseline;
}
.inline-blank-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--blue-600);
  background: var(--blue-100);
  padding: 1px 6px;
  border-radius: 5px;
}
.inline-blank-input {
  width: 148px;
  padding: 4px 10px;
  border: 1.5px solid var(--slate-300);
  border-radius: 7px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--navy-800);
  background: var(--white);
  outline: none;
}
.inline-blank-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(45, 156, 219, 0.2);
}

/* Map Labelling Split View */
.map-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}
.map-frame {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.map-frame img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: zoom-in;
}
.letter-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.letter-pill {
  min-width: 34px;
  height: 34px;
  border: 1.5px solid var(--slate-300);
  background: var(--white);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--slate-700);
  cursor: pointer;
}
.letter-pill:hover { border-color: var(--blue-500); background: var(--blue-50); }
.letter-pill.selected {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
}

/* Matching Reference Box */
.ref-box {
  background: var(--blue-50);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.ref-box h4 { font-size: 14px; color: var(--navy-800); margin-bottom: 10px; }
.ref-options-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 16px;
  font-size: 14px;
}
.ref-opt-row { display: flex; gap: 8px; line-height: 1.45; }
.ref-opt-row strong { color: var(--blue-600); min-width: 18px; }

/* Extract Box in Listening Part 5 */
.extract-card {
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  background: var(--white);
}
.extract-head {
  font-size: 13px;
  font-weight: 800;
  color: var(--blue-600);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.extract-context {
  font-size: 14px;
  color: var(--slate-600);
  font-style: italic;
  margin: 0 0 14px;
}

/* =========================================================
   READING SPLIT-SCREEN EXAM WORKSPACE
   ========================================================= */
.reading-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 165px);
  min-height: 520px;
}
.reading-pane {
  overflow-y: auto;
  padding: 22px 26px 80px;
}
.reading-pane-left {
  background: var(--white);
  border-right: 1px solid var(--slate-200);
}
.reading-pane-right {
  background: var(--slate-50);
}
.passage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--slate-200);
  flex-wrap: wrap;
}
.passage-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn {
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.tool-btn:hover { background: var(--slate-100); }
.tool-btn.hl { background: #fef08a; border-color: #eab308; color: #713f12; }

.passage-title {
  font-size: 22px;
  color: var(--navy-800);
  margin-bottom: 14px;
}
.passage-body {
  font-size: 15.5px;
  line-height: 1.75;
  color: #1e293b;
}
.passage-body p { margin: 0 0 14px; }
.para-label {
  display: inline-block;
  font-weight: 800;
  color: var(--blue-600);
  margin-right: 6px;
}
mark.user-hl {
  background: #fef08a;
  color: inherit;
  padding: 1px 2px;
  border-radius: 3px;
  cursor: pointer;
}

.notice-card, .text-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.notice-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-weight: 800;
  color: var(--blue-600);
  font-size: 13.5px;
}
.notice-card pre {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
}

/* Bottom Question Palette */
.exam-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}
.q-palette {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 0;
}
.pal-btn {
  min-width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.pal-btn.answered { background: var(--navy-800); color: var(--white); border-color: var(--navy-800); }
.pal-btn.flagged { box-shadow: inset 0 -3px 0 #f59e0b; }

/* Results & Review */
.result-hero {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: var(--white);
  border-radius: 20px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 26px;
  align-items: center;
  margin-bottom: 24px;
}
.score-circle {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 4px solid #38bdf8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-circle strong { font-size: 32px; line-height: 1; }
.score-circle span { font-size: 12px; color: #bae6fd; margin-top: 4px; }

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
.bd-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px 16px;
}
.bd-card .lbl { font-size: 12.5px; color: var(--slate-500); font-weight: 600; }
.bd-card .val { font-size: 20px; font-weight: 800; color: var(--navy-800); margin: 4px 0 8px; }

.review-item {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-left: 5px solid var(--slate-300);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.review-item.ok { border-left-color: var(--green-600); }
.review-item.bad { border-left-color: var(--red-600); }
.review-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0;
  font-size: 14px;
}
.ans-pill {
  padding: 4px 10px;
  border-radius: 7px;
  font-weight: 700;
}
.ans-pill.ok { background: var(--green-100); color: #166534; }
.ans-pill.bad { background: var(--red-100); color: #991b1b; }
.ans-pill.key { background: var(--blue-100); color: var(--navy-800); }
.evidence-box {
  background: var(--slate-50);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--slate-700);
  margin-top: 8px;
  line-height: 1.5;
}
.izoh-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #78350f;
  margin-top: 6px;
  line-height: 1.5;
}

/* Writing & Speaking */
.ws-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
  align-items: start;
}
.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.essay-textarea {
  width: 100%;
  min-height: 320px;
  padding: 14px 16px;
  border: 1.5px solid var(--slate-300);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
}
.essay-textarea:focus { border-color: var(--blue-500); }
.word-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.rec-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red-600);
  animation: pulse 0.9s infinite;
}

/* History Table */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--slate-100); }
th { background: var(--slate-50); color: var(--slate-600); font-weight: 700; font-size: 12.5px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-box {
  background: var(--white);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  padding: 26px;
  box-shadow: var(--shadow-lg);
}
.modal-box.wide { max-width: 960px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--navy-900);
  color: var(--white);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
.toast.ok { background: var(--green-600); }
.toast.err { background: var(--red-600); }

/* Responsive */
@media (max-width: 1024px) {
  .auth-main, .hero-banner, .skills-grid, .map-split, .reading-split, .ws-grid {
    grid-template-columns: 1fr;
  }
  .reading-split { height: auto; }
  .reading-pane-left { border-right: none; border-bottom: 1px solid var(--slate-200); }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .result-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}
@media (max-width: 640px) {
  .skills-grid { grid-template-columns: 1fr; }
  .auth-stats-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }
}
