/* English for Logistics and Transport — premium theme */
:root,
[data-theme="midnight"] {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-solid: #141f36;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8edf7;
  --text-soft: #d5dcea;
  --muted: #8b97ad;
  --gold: #d4af5f;
  --gold-2: #a7853f;
  --gold-bright: #eccb84;
  --gold-soft: rgba(212, 175, 95, .45);
  --gold-wash: rgba(212, 175, 95, .07);
  --accent: #4f8ff7;
  --accent-wash: rgba(79, 143, 247, .12);
  --accent-chip: rgba(79, 143, 247, .08);
  --accent-chip-border: rgba(79, 143, 247, .2);
  --green: #3ecf8e;
  --red: #f36c6c;
  --overlay-1: rgba(255, 255, 255, .03);
  --overlay-2: rgba(255, 255, 255, .06);
  --overlay-3: rgba(255, 255, 255, .1);
  --overlay-hover: rgba(255, 255, 255, .065);
  --track-bg: rgba(255, 255, 255, .08);
  --divider: rgba(255, 255, 255, .05);
  --input-bg: rgba(0, 0, 0, .3);
  --switch-bg: rgba(0, 0, 0, .28);
  --glow-1: rgba(79, 143, 247, 0.14);
  --glow-2: rgba(212, 175, 95, 0.10);
  --hero-grad: linear-gradient(120deg, #17233f 0%, #101a30 55%, #16213a 100%);
  --card-grad-a: #1a2745;
  --card-grad-b: #121c33;
  --card-grad-c: #253355;
  --card-grad-d: #16223d;
  --selection: rgba(212, 175, 95, .35);
  --dark-ink: #17130b;
  --radius: 16px;
  --sidebar-w: 292px;
  font-size: 16px;
}

[data-theme="lavender"] {
  --bg: #f6f3fc;
  --panel: rgba(109, 40, 217, 0.045);
  --panel-solid: #ffffff;
  --border: rgba(109, 40, 217, 0.14);
  --text: #2c1a4d;
  --text-soft: #4a3670;
  --muted: #7c6a99;
  --gold: #8b5cf6;
  --gold-2: #6d28d9;
  --gold-bright: #6d28d9;
  --gold-soft: rgba(139, 92, 246, .45);
  --gold-wash: rgba(139, 92, 246, .10);
  --accent: #6366f1;
  --accent-wash: rgba(99, 102, 241, .14);
  --accent-chip: rgba(99, 102, 241, .09);
  --accent-chip-border: rgba(99, 102, 241, .24);
  --green: #16a34a;
  --red: #dc2626;
  --overlay-1: rgba(109, 40, 217, .035);
  --overlay-2: rgba(109, 40, 217, .06);
  --overlay-3: rgba(109, 40, 217, .09);
  --overlay-hover: rgba(109, 40, 217, .05);
  --track-bg: rgba(109, 40, 217, .08);
  --divider: rgba(109, 40, 217, .09);
  --input-bg: rgba(109, 40, 217, .045);
  --switch-bg: rgba(109, 40, 217, .06);
  --glow-1: rgba(139, 92, 246, 0.14);
  --glow-2: rgba(216, 180, 254, 0.28);
  --hero-grad: linear-gradient(120deg, #f4eefd 0%, #ece2fb 55%, #f6eefe 100%);
  --card-grad-a: #ffffff;
  --card-grad-b: #f3ecfd;
  --card-grad-c: #ffffff;
  --card-grad-d: #f3ecfd;
  --selection: rgba(139, 92, 246, .3);
  --dark-ink: #ffffff;
}

[data-theme="daylight"] {
  --bg: #f2f4fa;
  --panel: rgba(15, 23, 42, 0.035);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.10);
  --text: #1b2438;
  --text-soft: #33405c;
  --muted: #64748b;
  --gold: #c9973f;
  --gold-2: #8a6425;
  --gold-bright: #8a5a12;
  --gold-soft: rgba(201, 151, 63, .5);
  --gold-wash: rgba(201, 151, 63, .12);
  --accent: #2f6fed;
  --accent-wash: rgba(47, 111, 237, .12);
  --accent-chip: rgba(47, 111, 237, .07);
  --accent-chip-border: rgba(47, 111, 237, .22);
  --green: #1f9d66;
  --red: #d33a3a;
  --overlay-1: rgba(15, 23, 42, .035);
  --overlay-2: rgba(15, 23, 42, .06);
  --overlay-3: rgba(15, 23, 42, .09);
  --overlay-hover: rgba(15, 23, 42, .05);
  --track-bg: rgba(15, 23, 42, .08);
  --divider: rgba(15, 23, 42, .09);
  --input-bg: rgba(15, 23, 42, .045);
  --switch-bg: rgba(15, 23, 42, .06);
  --glow-1: rgba(47, 111, 237, 0.10);
  --glow-2: rgba(201, 151, 63, 0.14);
  --hero-grad: linear-gradient(120deg, #eef2fb 0%, #e6ecf9 55%, #eef1fa 100%);
  --card-grad-a: #ffffff;
  --card-grad-b: #eef1f8;
  --card-grad-c: #ffffff;
  --card-grad-d: #eef1f8;
  --selection: rgba(201, 151, 63, .3);
  --dark-ink: #1b2438;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--glow-2), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

/* ---------- Auth gate ---------- */
.auth-gate {
  display: none; position: fixed; inset: 0; z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(1100px 600px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--glow-2), transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(400px, 100%); background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 30px; box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.auth-logo { display: block; width: 100%; max-width: 220px; margin: 0 auto 22px; }
.auth-tabs { display: flex; background: var(--switch-bg); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px 0; border: 0; border-radius: 9px; cursor: pointer; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; transition: all .2s; }
.auth-tab.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--dark-ink); }
.auth-invite-note { background: var(--gold-wash); border: 1px solid var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text-soft); margin-bottom: 16px; }
.auth-error { color: var(--red); font-size: 13px; min-height: 0; }
.auth-error:not(:empty) { margin-bottom: 12px; }
.auth-hint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-hint a { color: var(--gold-bright); text-decoration: none; font-weight: 600; }
.auth-hint a:hover { text-decoration: underline; }

::selection { background: var(--selection); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed; top: 20px; right: 26px; z-index: 300;
  display: flex; gap: 4px;
  background: var(--switch-bg); border: 1px solid var(--border);
  border-radius: 13px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
}
.theme-toggle button {
  width: 36px; height: 36px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 16px;
  display: grid; place-items: center; transition: all .18s;
}
.theme-toggle button:hover { background: var(--overlay-2); color: var(--text); }
.theme-toggle button.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--dark-ink); box-shadow: 0 2px 10px var(--gold-soft);
}

.search-trigger {
  position: fixed; top: 20px; right: 168px; z-index: 300;
  width: 44px; height: 44px; border-radius: 13px; border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer;
  background: var(--switch-bg); color: var(--muted);
  box-shadow: 0 8px 24px rgba(0,0,0,.22); backdrop-filter: blur(10px);
  transition: all .18s;
}
.search-trigger:hover { color: var(--text); background: var(--overlay-2); }

.search-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.search-overlay.open { display: flex; }
.search-box {
  width: min(560px, 90vw); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
#search-input {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; font-size: 16px; padding: 12px 14px; flex-shrink: 0;
}
#search-input:focus { outline: none; border-color: var(--gold); }
.search-results { overflow-y: auto; margin-top: 12px; flex: 1; }
.search-result-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.search-result-item:hover { background: var(--overlay-2); }
.search-result-term { font-weight: 700; color: var(--gold-bright); font-size: 14.5px; }
.search-result-meta { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 1px; }
.search-result-def { font-size: 13px; color: var(--text-soft); margin-top: 3px; }
.search-hint { margin-top: 10px; font-size: 11.5px; color: var(--muted); text-align: right; flex-shrink: 0; }
.search-empty { padding: 24px 4px; text-align: center; color: var(--muted); font-size: 14px; }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 900; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -20px; width: 9px; height: 14px; opacity: .9; border-radius: 2px;
  animation-name: confetti-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--overlay-1), transparent);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--overlay-3); border-radius: 8px; }

.main { flex: 1; padding: 36px 48px 80px; max-width: 1060px; margin: 0 auto; width: 100%; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--overlay-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-soft); }

button:focus-visible, input:focus-visible, select:focus-visible, .unit-card:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* ---------- Brand ---------- */
.brand {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  padding: 6px 4px 20px; margin-bottom: 12px;
  transition: transform .2s ease;
}
.brand:hover { transform: translateY(-2px); }
.brand-logo-full {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.25));
}
/* The logo's wordmark is dark navy — invert it to a light silhouette on dark themes so it stays legible. */
[data-theme="midnight"] .brand-logo-full {
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0,0,0,.4));
}

.copyright {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted); opacity: .75; line-height: 1.6;
}

/* ---------- View switch ---------- */
.seg-switch {
  display: flex; background: var(--switch-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; margin-bottom: 22px;
}
.seg-switch button {
  flex: 1; padding: 9px 0; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  transition: all .2s;
}
.seg-switch button.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--dark-ink); box-shadow: 0 2px 10px var(--gold-soft);
}

.lvl-chip {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700;
  background: var(--accent-chip); border: 1px solid var(--accent-chip-border); color: var(--text);
  letter-spacing: .3px; vertical-align: middle;
}

/* ---------- Nav ---------- */
.nav-label { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin: 10px 6px 10px; }
.unit-nav { display: flex; flex-direction: column; gap: 6px; }
.unit-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; transition: all .18s;
}
.unit-link:hover { background: var(--panel); }
.unit-link.active { background: var(--panel); border-color: var(--border); }
.unit-link .u-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-chip); font-size: 16px;
}
.unit-link .u-meta { min-width: 0; flex: 1; }
.unit-link .u-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-link .u-num { font-size: 11px; color: var(--muted); }
.unit-link .u-check { font-size: 12px; color: var(--green); }

.exit-test-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; margin-top: 10px;
  border: 1px solid var(--gold-soft); background: var(--gold-wash); transition: all .18s;
}
.exit-test-link:hover { background: var(--overlay-hover); }
.exit-test-link.active { border-color: var(--gold); }
.exit-test-link .u-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); font-size: 16px;
}
.exit-test-link .u-meta { min-width: 0; flex: 1; }
.exit-test-link .u-title { font-size: 13.5px; font-weight: 700; color: var(--gold-bright); }
.exit-test-link .u-num { font-size: 11px; color: var(--muted); }
.exit-test-link .u-check { font-size: 12px; color: var(--green); }

.teacher-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; margin-top: 8px;
  border: 1px solid var(--border); background: var(--overlay-1); transition: all .18s;
}
.teacher-link:hover { background: var(--overlay-hover); }
.teacher-link.active { border-color: var(--accent); }
.teacher-link .u-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-chip); font-size: 15px;
}
.teacher-link .u-meta { min-width: 0; flex: 1; }
.teacher-link .u-title { font-size: 13.5px; font-weight: 700; }
.teacher-link .u-num { font-size: 10.5px; color: var(--muted); }

.sidebar-footer { margin-top: auto; padding-top: 20px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- Dashboard ---------- */
.hero {
  position: relative; z-index: 0; overflow: hidden;
  border-radius: 24px; padding: 44px 46px;
  background: var(--hero-grad);
  border: 1px solid var(--border);
  margin-bottom: 30px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 20px 50px -20px rgba(0,0,0,.35);
}
.hero-art {
  position: absolute; top: 0; right: 0; height: 100%; width: 42%; z-index: -1;
  object-fit: cover; object-position: 35% center; pointer-events: none;
  opacity: .5;
  -webkit-mask-image: linear-gradient(to right, transparent, black 60%);
  mask-image: linear-gradient(to right, transparent, black 60%);
}
[data-theme="daylight"] .hero-art, [data-theme="lavender"] .hero-art { opacity: .75; }
.hero .eyebrow { color: var(--gold-bright); font-size: 12.5px; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; margin-bottom: 12px; }
.hero h2 { font-size: 34px; font-weight: 800; line-height: 1.15; max-width: 560px; }
.hero p { color: var(--muted); margin-top: 12px; max-width: 540px; font-size: 15.5px; line-height: 1.6; }
.course-note {
  margin-top: 18px; max-width: 620px; font-size: 13.5px; line-height: 1.6; color: var(--text-soft);
  background: var(--gold-wash); border: 1px solid var(--gold-soft); border-radius: 12px; padding: 12px 16px;
}
.course-note strong { color: var(--gold-bright); }
.hero-stats { display: flex; gap: 34px; margin-top: 28px; }
.hero-stat .v { font-size: 26px; font-weight: 800; color: var(--gold-bright); }
.hero-stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.review-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; margin-top: 18px; box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.review-banner-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.review-banner-sub { color: var(--muted); font-size: 13.5px; }

.review-ratings { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rating-btn { color: #fff; font-weight: 700; }
.rating-again { background: #c0392b; }
.rating-hard { background: #c9761f; }
.rating-good { background: #2f8f5b; }
.rating-easy { background: #2a6fd6; }
.rating-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

.cert-id { margin-top: 20px; font-size: 11px; color: var(--muted); letter-spacing: .3px; line-height: 1.6; word-break: break-all; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 16px; }
.section-head h3 { font-size: 20px; font-weight: 700; }
.section-head .hint { color: var(--muted); font-size: 13px; }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.unit-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; cursor: pointer; transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.unit-card:hover { transform: translateY(-4px); border-color: var(--gold-soft); background: var(--overlay-hover); box-shadow: 0 16px 34px -12px rgba(0,0,0,.28); }
.unit-card .top { display: flex; justify-content: space-between; align-items: flex-start; }
.unit-card .icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent-chip), var(--gold-wash));
  border: 1px solid var(--border);
}
.unit-card h4 { font-size: 17px; font-weight: 700; }
.unit-card .sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.unit-card .unit-tag { font-size: 11px; color: var(--gold-bright); letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; }

.progress-ring { position: relative; width: 46px; height: 46px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--gold-bright); }

.bar { height: 6px; border-radius: 4px; background: var(--track-bg); overflow: hidden; }
.bar > div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width .4s; }

/* ---------- Unit page ---------- */
.crumb { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; cursor: pointer; }
.crumb:hover { color: var(--gold-bright); }

.unit-head { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.unit-head .big-icon {
  width: 74px; height: 74px; border-radius: 20px; display: grid; place-items: center; font-size: 36px;
  background: linear-gradient(135deg, var(--accent-chip), var(--gold-wash));
  border: 1px solid var(--border);
}
.unit-head h2 { font-size: 28px; font-weight: 800; }
.unit-head .sub { color: var(--muted); margin-top: 4px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 28px; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 10px 10px 0 0; transition: color .15s, background .15s;
}
.tabs button:hover { color: var(--text); background: var(--overlay-1); }
.tabs button.active { color: var(--gold-bright); border-bottom-color: var(--gold); background: var(--gold-wash); }
.tabs button .done-dot { color: var(--green); margin-left: 5px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transition: box-shadow .2s ease;
}
.card:hover { box-shadow: 0 8px 28px rgba(0,0,0,.12); }
.card h4 { font-size: 17px; margin-bottom: 12px; font-weight: 700; }
.card p.lede { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head-row h4 { margin-bottom: 0; }

.objectives li { margin: 8px 0 8px 20px; line-height: 1.5; font-size: 15px; }
.objectives li::marker { color: var(--gold); }

/* ---------- Flashcards ---------- */
.flash-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.flashcard {
  width: min(560px, 100%); height: 270px; perspective: 1200px; cursor: pointer;
}
.flashcard .inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .55s cubic-bezier(.4, .1, .2, 1); transform-style: preserve-3d;
}
.flashcard.flipped .inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 20px; padding: 30px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  border: 1px solid var(--border);
}
.flash-front { background: linear-gradient(135deg, var(--card-grad-a), var(--card-grad-b)); }
.flash-front .term { font-size: 30px; font-weight: 800; color: var(--gold-bright); }
.flash-front .pos { color: var(--muted); font-size: 13px; margin-top: 8px; font-style: italic; }
.flash-front .tap { position: absolute; bottom: 18px; font-size: 12px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.flash-back { background: linear-gradient(135deg, var(--card-grad-c), var(--card-grad-d)); transform: rotateY(180deg); }
.flash-back .def { font-size: 17px; line-height: 1.55; }
.flash-back .ex { margin-top: 16px; color: var(--gold-bright); font-style: italic; font-size: 14.5px; line-height: 1.5; }
.flash-controls { display: flex; align-items: center; gap: 16px; }
.flash-count { color: var(--muted); font-size: 14px; min-width: 64px; text-align: center; }

.vocab-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.vocab-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.vocab-table td { padding: 12px; border-bottom: 1px solid var(--divider); vertical-align: top; line-height: 1.5; }
.vocab-table td.t { color: var(--gold-bright); font-weight: 700; white-space: nowrap; }
.vocab-table td.p { color: var(--muted); font-style: italic; white-space: nowrap; }
.speak-btn { background: none; border: 0; cursor: pointer; font-size: 15px; opacity: .7; }
.speak-btn:hover { opacity: 1; }

/* ---------- Reading ---------- */
.reading-text p { line-height: 1.8; font-size: 15.5px; margin-bottom: 16px; color: var(--text-soft); }
.reading-text p::first-letter { color: var(--gold-bright); }

/* ---------- Quiz ---------- */
.quiz-q { margin-bottom: 24px; }
.quiz-q .qt { font-weight: 600; margin-bottom: 12px; font-size: 15.5px; line-height: 1.5; }
.quiz-q .qt .qnum { color: var(--gold-bright); margin-right: 8px; }
.quiz-section-head {
  font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold-bright); margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.quiz-section-head:first-child { margin-top: 0; }
.quiz-section-note { color: var(--muted); font-size: 13.5px; margin: -6px 0 14px; line-height: 1.5; }

/* ---------- Exit Test ---------- */
.et-section-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 12px; }
.et-badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: var(--dark-ink);
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); padding: 3px 11px; border-radius: 20px;
}
.et-clip { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; background: var(--overlay-1); }
.et-clip-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14.5px; }
.et-transcript { margin-bottom: 16px; font-size: 13.5px; color: var(--text-soft); }
.et-transcript summary { cursor: pointer; color: var(--gold-bright); font-weight: 600; margin-bottom: 8px; }
.et-transcript p { margin: 6px 0; line-height: 1.5; }
.et-writing-textarea {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: inherit; font-size: 14.5px; padding: 14px 16px; resize: vertical; line-height: 1.6;
}
.et-writing-textarea:focus { outline: none; border-color: var(--gold); }
.et-checklist { margin-top: 18px; padding: 14px 18px; border-radius: 12px; background: var(--overlay-1); border: 1px solid var(--border); }
.et-checklist-title { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--gold-bright); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px; border-radius: 12px; cursor: pointer;
  background: var(--overlay-1); border: 1px solid var(--border);
  font-size: 14.5px; transition: all .15s; line-height: 1.45;
}
.opt:hover { border-color: var(--gold-soft); }
.opt .letter {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center;
  background: var(--overlay-2); font-size: 12.5px; font-weight: 700; color: var(--muted);
}
.opt.selected { border-color: var(--accent); background: var(--accent-wash); }
.opt.selected .letter { background: var(--accent); color: #fff; }
.opt.correct { border-color: var(--green); background: rgba(62,207,142,.12); }
.opt.correct .letter { background: var(--green); color: #06281a; }
.opt.wrong { border-color: var(--red); background: rgba(243,108,108,.10); }
.opt.wrong .letter { background: var(--red); color: #2b0c0c; }
.opt.disabled { pointer-events: none; }

/* ---------- Gap fill ---------- */
.gap-item { margin-bottom: 18px; font-size: 15.5px; line-height: 2; }
.gap-item .gnum { color: var(--gold-bright); font-weight: 700; margin-right: 8px; }
.gap-input {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 14.5px; padding: 6px 12px; width: 170px;
  margin: 0 6px; transition: border-color .15s;
}
.gap-input:focus { outline: none; border-color: var(--gold); }
.gap-input.ok { border-color: var(--green); background: rgba(62,207,142,.1); }
.gap-input.bad { border-color: var(--red); background: rgba(243,108,108,.08); }
.gap-answer { color: var(--green); font-size: 13px; margin-left: 8px; }

/* ---------- Word practice ---------- */
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.bank-chip {
  padding: 6px 13px; border-radius: 20px; font-size: 13.5px; font-weight: 600;
  background: var(--accent-chip); border: 1px solid var(--accent-chip-border); color: var(--text);
}
.match-list { display: flex; flex-direction: column; gap: 10px; }
.match-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.match-term { min-width: 170px; font-weight: 700; color: var(--gold-bright); font-size: 14.5px; }
.match-select {
  flex: 1; min-width: 220px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 14px; padding: 8px 12px; transition: border-color .15s;
}
.match-select:focus { outline: none; border-color: var(--gold); }
.match-select.ok { border-color: var(--green); background: rgba(62,207,142,.1); }
.match-select.bad { border-color: var(--red); background: rgba(243,108,108,.08); }
.match-mark { width: 20px; font-weight: 800; font-size: 15px; text-align: center; }

/* ---------- Speaking ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 16px; }
.role-card { background: var(--overlay-1); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.role-label { color: var(--gold-bright); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.role-brief { font-size: 14.5px; line-height: 1.55; }

/* ---------- Listening ---------- */
.listen-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.context-note { color: var(--muted); font-style: italic; margin-bottom: 18px; font-size: 14.5px; }
.dialogue { display: flex; flex-direction: column; gap: 12px; }
.turn {
  display: flex; gap: 14px; padding: 13px 16px; border-radius: 14px;
  background: var(--overlay-1); border: 1px solid transparent; transition: all .25s;
}
.turn.speaking { border-color: var(--gold); background: var(--gold-wash); box-shadow: 0 0 0 1px var(--gold-soft); }
.turn .avatar {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #10182b;
}
.turn .who { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.turn .line { font-size: 15px; line-height: 1.55; }
.dialogue.hidden-script .line { filter: blur(6px); user-select: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 22px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 700; transition: all .18s;
}
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--dark-ink); box-shadow: 0 4px 16px var(--gold-soft); }
.btn-gold:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 22px var(--gold-soft); }
.btn-gold:active { transform: translateY(0); filter: brightness(.98); }
.btn-ghost { background: var(--overlay-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--overlay-3); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.quiz-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Results ---------- */
.result-banner {
  display: flex; align-items: center; gap: 18px;
  border-radius: var(--radius); padding: 20px 24px; margin-top: 20px;
  border: 1px solid var(--border); background: var(--overlay-1); animation: pop .3s ease;
}
.result-banner .score { font-size: 30px; font-weight: 800; color: var(--gold-bright); }
.result-banner .msg { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.result-banner.pass { border-color: rgba(62,207,142,.4); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lesson-video-wrap {
  position: relative; width: 100%; padding-top: 56.25%; margin-top: 16px;
  border-radius: 14px; overflow: hidden; background: #000;
}
.lesson-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.grammar-box {
  border-left: 3px solid var(--gold); padding: 16px 20px; border-radius: 0 14px 14px 0;
  background: var(--gold-wash); margin-bottom: 20px; line-height: 1.65; font-size: 15px;
}
.example-chip {
  display: block; padding: 10px 16px; margin: 8px 0; border-radius: 12px;
  background: var(--accent-chip); border: 1px solid var(--accent-chip-border);
  font-style: italic; font-size: 14.5px; line-height: 1.5;
}

.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dashboard ---------- */
.dash-clock {
  display: inline-block; font-size: 13.5px; font-weight: 600; color: var(--gold-bright);
  background: var(--gold-wash); border: 1px solid var(--gold-soft); border-radius: 12px;
  padding: 10px 18px; margin-bottom: 20px;
}
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }

.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; color: var(--dark-ink);
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
}
.profile-name { font-size: 16px; font-weight: 700; }
.profile-email { color: var(--muted); font-size: 13px; margin-top: 2px; }
.profile-since { color: var(--muted); font-size: 12px; margin-top: 4px; }

.pr-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pr-meta { color: var(--muted); font-size: 13px; }
.pr-stats { display: flex; gap: 30px; margin-bottom: 22px; flex-wrap: wrap; }
.pr-stat .v { font-size: 24px; font-weight: 800; color: var(--gold-bright); }
.pr-stat .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.pr-table { font-size: 13.5px; }
.pr-table th, .pr-table td { white-space: nowrap; }

.cert-card, .teacher-print-doc { display: none; }

/* ---------- Teacher grading & communication ---------- */
.grading-row { margin-bottom: 10px; }
.grading-label { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: var(--gold-bright); }
.grading-submission {
  background: var(--overlay-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-size: 14.5px; line-height: 1.6; margin-bottom: 12px; white-space: pre-wrap;
}
.grading-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.grading-controls input {
  width: 70px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 14px; padding: 6px 10px;
}
.grading-outof { color: var(--muted); font-size: 13px; }
.speaking-grade-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--divider);
}
.speaking-grade-unit { flex: 1; min-width: 180px; font-size: 14px; font-weight: 600; }
.speaking-score-input {
  width: 56px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 14px; padding: 6px 8px;
}
.speaking-fb-input {
  flex: 1; min-width: 140px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 13.5px; padding: 6px 10px;
}
.notes-list { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; margin-bottom: 6px; }
.note-item { background: var(--overlay-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.note-date { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.note-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.cert-inner {
  text-align: center; padding: 56px 40px; border: 2px solid var(--gold); border-radius: 20px;
  background: var(--gold-wash);
}
.cert-logo { display: block; width: 76px; height: 76px; margin: 0 auto 18px; object-fit: contain; }
.cert-eyebrow { color: var(--gold-bright); font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; font-weight: 700; }
.cert-course { font-size: 21px; font-weight: 800; margin-top: 14px; }
.cert-sub { color: var(--muted); font-size: 13px; margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }
.cert-name { font-size: 34px; font-weight: 800; color: var(--gold-bright); margin: 24px 0 14px; }
.cert-text { max-width: 520px; margin: 0 auto; line-height: 1.7; color: var(--text-soft); font-size: 15px; }
.cert-date { margin-top: 28px; color: var(--muted); font-size: 13px; }

.doc-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.doc-brand-logo { width: 50px; height: 50px; object-fit: contain; flex-shrink: 0; }
.doc-brand-course { font-size: 15px; font-weight: 800; }
.doc-brand-level { font-size: 11.5px; color: var(--gold-bright); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; font-weight: 700; }

/* ---------- Printable worksheets ---------- */
.worksheet { display: none; }
.worksheet-head { border-bottom: 2px solid var(--gold); padding-bottom: 12px; margin-bottom: 18px; }
.worksheet-head h2 { font-size: 22px; font-weight: 800; }
.worksheet-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.ws-gap { margin-bottom: 16px; font-size: 15px; line-height: 1.9; }
.ws-q { margin-bottom: 16px; }
.ws-qtext { font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.ws-opt { margin: 0 0 4px 18px; font-size: 14.5px; }
.ws-match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 10px; }
.ws-col-title { font-weight: 700; color: var(--gold-bright); margin-bottom: 10px; text-transform: uppercase; font-size: 12.5px; letter-spacing: 1px; }
.ws-match-item { margin-bottom: 10px; font-size: 14.5px; line-height: 1.5; }
.ws-transcript p { margin-bottom: 10px; line-height: 1.6; font-size: 14.5px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .theme-toggle, .seg-switch, .tabs { display: none !important; }
  body * { visibility: hidden; }
  .print-area.active-print, .print-area.active-print * { visibility: visible; }
  .print-area.active-print {
    display: block !important; position: absolute; top: 0; left: 0; width: 100%;
    background: #fff !important; color: #111 !important; border: none !important; box-shadow: none !important;
    padding: 24px;
  }
  .print-area.active-print h2, .print-area.active-print h4, .print-area.active-print .pr-meta, .print-area.active-print .pr-stat .l,
  .print-area.active-print .cert-course, .print-area.active-print .cert-sub, .print-area.active-print .cert-date,
  .print-area.active-print .cert-text, .print-area.active-print td, .print-area.active-print th,
  .print-area.active-print p, .print-area.active-print .worksheet-meta, .print-area.active-print .ws-qtext,
  .print-area.active-print .ws-opt, .print-area.active-print .ws-gap, .print-area.active-print .ws-match-item,
  .print-area.active-print .ws-transcript p, .print-area.active-print .lede, .print-area.active-print .doc-brand-course {
    color: #111 !important;
  }
  .print-area.active-print .pr-stat .v, .print-area.active-print .cert-eyebrow, .print-area.active-print .cert-name,
  .print-area.active-print .ws-col-title, .print-area.active-print .doc-brand-level {
    color: #6d28d9 !important;
  }
  .print-area.active-print th, .print-area.active-print td { border-color: #ccc !important; }
  .print-area.active-print .cert-inner { background: #fff !important; border-color: #c9973f !important; }
  .print-area.active-print .worksheet-head { border-bottom-color: #6d28d9 !important; }
  .print-area.active-print .doc-brand { border-bottom-color: #ccc !important; }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 24px 20px 60px; }
  .hero { padding: 30px 26px; }
  .hero h2 { font-size: 26px; }
  .theme-toggle { top: 12px; right: 12px; }
  .search-trigger { top: 12px; right: 154px; width: 40px; height: 40px; }
}
