/* B1 ACADEMY design system — "Night Track"
   Inspired by premium sports & tech product sites: true black, Apple-style graphite surfaces,
   athletic condensed uppercase headlines, pill buttons, one high-energy lime accent, fluid motion.
   Type: Bahnschrift (variable, built into Windows) condensed for display; Segoe UI Variable for reading. */
:root {
  --ink: #000000;
  --ink-2: #0b0b0c;
  --forest: #161618;
  --emerald: #232326;
  --emerald-2: #2f2f33;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.14);
  --glass: rgba(22, 22, 24, 0.72);
  --glass-2: rgba(30, 30, 33, 0.82);
  --text: #e8e8ed;
  --text-dim: #a1a1a6;
  --text-faint: #6e6e73;
  --heading: #ffffff;
  --signal: #8b7bff;
  --signal-soft: rgba(139, 123, 255, 0.12);
  --signal-glow: rgba(139, 123, 255, 0.4);
  --amber: #ffb340;
  --amber-soft: rgba(255, 179, 64, 0.13);
  --coral: #ff5a47;
  --coral-soft: rgba(255, 90, 71, 0.13);
  --sky: #64d2ff;
  --r-s: 10px; --r-m: 18px; --r-l: 28px;
  --display: "Bahnschrift", "DIN Condensed", "Arial Narrow", "Segoe UI Variable Display", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, sans-serif;
  --arabic: "Segoe UI", "Arial", "Tahoma", sans-serif;
  --ease: cubic-bezier(.22,1,.36,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --dur: 420ms;
  --side: 256px;
}
:root.reduce-motion { --dur: 0ms; }
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { :root:not(.allow-motion) { --dur: 0ms; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font: 15px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before { /* single atmospheric light, fixed */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(139, 123, 255, 0.35), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(40, 40, 46, 0.45), transparent 60%);
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(139, 123, 255, 0.3); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--heading); font-weight: 600; letter-spacing: 0.005em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 2.1rem; font-weight: 700; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .9em; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.ar { font-family: var(--arabic); direction: rtl; unicode-bidi: isolate; font-size: 1.05em; }
.de { font-weight: 600; color: var(--heading); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
kbd { font: 12px var(--body); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--forest); }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(12, 12, 13, 0.92), rgba(0, 0, 0, 0.96));
  border-right: 1px solid var(--line);
  padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin; scrollbar-color: var(--emerald) transparent;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; color: var(--heading); letter-spacing: .06em; line-height: 1; }
.brand-sub { font-size: .72rem; color: var(--text-faint); margin-top: 4px; }
.nav-group { font-size: .72rem; color: var(--text-faint); padding: 14px 12px 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: .92rem; text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { color: var(--heading); background: rgba(139, 123, 255, 0.05); }
.nav a.active { color: var(--heading); background: linear-gradient(90deg, rgba(139, 123, 255,0.13), rgba(139, 123, 255,0.02)); }
.nav a.active svg { color: var(--signal); opacity: 1; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); box-shadow: 0 0 12px var(--signal-glow); }
.nav .badge { margin-left: auto; font-size: .7rem; padding: 1px 7px; border-radius: 99px; background: var(--coral-soft); color: var(--coral); }
.side-foot { margin-top: auto; padding: 14px 12px 0; font-size: .74rem; color: var(--text-faint); border-top: 1px solid var(--line); }
.side-foot .streak { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: .85rem; margin-bottom: 6px; }

.main { min-width: 0; padding: 30px clamp(18px, 4vw, 52px) 80px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 10px 14px 10px 38px; }
.topbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--text-faint); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.view { animation: viewIn var(--dur) var(--ease) both; max-width: 1180px; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { color: var(--text-dim); margin: 6px 0 0; max-width: 64ch; }
.crumb { font-size: .82rem; color: var(--text-faint); margin-bottom: 8px; }
.crumb a { color: var(--text-dim); }

/* ---------- surfaces ---------- */
.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 22px; backdrop-filter: blur(14px) saturate(120%); -webkit-backdrop-filter: blur(14px) saturate(120%);
}
.panel.tight { padding: 16px; }
.panel.flat { background: rgba(22, 22, 24, 0.6); backdrop-filter: none; }
.panel h3 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* ---------- controls ---------- */
button, .btn {
  font: 600 .9rem var(--body); cursor: pointer; border: 1px solid var(--line-2); color: var(--heading);
  background: rgba(44, 44, 48, 0.45); padding: 9px 16px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 120ms var(--ease);
  text-decoration: none;
}
button:hover, .btn:hover { background: rgba(62, 62, 68, 0.6); border-color: rgba(139, 123, 255, 0.35); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button svg, .btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--signal); color: #000000; border-color: transparent; }
.btn-primary:hover { background: #b4a8ff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: rgba(139, 123, 255,.06); color: var(--heading); }
.btn-sm { padding: 5px 11px; font-size: .8rem; border-radius: 8px; }
.btn-danger { color: var(--coral); }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=time], select, textarea {
  font: inherit; color: var(--heading); background: rgba(14, 14, 16, 0.7); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: rgba(139, 123, 255,.55); box-shadow: 0 0 0 3px rgba(139, 123, 255,.12); }
textarea { width: 100%; min-height: 220px; resize: vertical; line-height: 1.7; }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--signal); width: 16px; height: 16px; margin-top: 3px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--emerald); border: 1px solid var(--line-2); transition: background var(--dur); cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-dim); transition: transform var(--dur) var(--ease), background var(--dur); }
.switch input:checked + span { background: rgba(139, 123, 255,.3); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--signal); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(14, 14, 16, 0.65); border: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; color: var(--text-dim); padding: 7px 14px; border-radius: 9px; font-weight: 600; }
.tabs button.on { background: var(--emerald-2); color: var(--heading); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text-dim); white-space: nowrap; }
.chip.official { color: var(--sky); border-color: rgba(124,200,255,.35); background: rgba(124,200,255,.08); }
.chip.original { color: var(--signal); border-color: rgba(139, 123, 255,.3); background: var(--signal-soft); }
.chip.reported { color: var(--amber); border-color: rgba(243,188,85,.35); background: var(--amber-soft); }
.chip.level { color: var(--heading); background: var(--emerald); border-color: transparent; }
.chip.warn { color: var(--coral); border-color: rgba(255,122,107,.35); background: var(--coral-soft); }
.chip.done { color: var(--signal); border-color: transparent; background: var(--signal-soft); }

/* ---------- dashboard ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; margin-bottom: 18px; }
.hero-main { position: relative; overflow: hidden; padding: 28px; }
.hero-main h1 { font-size: 2.35rem; margin-bottom: 8px; }
.hero-main .lead { color: var(--text-dim); max-width: 52ch; }
.hero-main .cta { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.next-task { margin-top: 20px; padding: 14px 16px; border-radius: var(--r-m); background: rgba(14,14,16,.55); border: 1px solid var(--line); display: flex; align-items: center; gap: 14px; }
.next-task .k { font-size: .76rem; color: var(--text-faint); }
.next-task .t { color: var(--heading); font-weight: 600; }

.gauge-panel { padding: 22px 22px 18px; }
.gauge-wrap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gauge { text-align: center; }
.gauge svg { width: 100%; max-width: 112px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.gauge .lbl { font-family: var(--display); font-size: .86rem; color: var(--heading); margin-top: 4px; }
.gauge .sub { font-size: .72rem; color: var(--text-faint); }
.gauge .ring-bg { stroke: rgba(255,255,255,.09); }
.gauge .ring-fg { transition: stroke-dashoffset 1100ms var(--ease); }
.gauge .pass-tick { stroke: var(--amber); }
.gauge-legend { display: flex; gap: 16px; font-size: .74rem; color: var(--text-faint); margin-top: 14px; justify-content: center; }
.gauge-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.stat { padding: 18px 20px; }
.stat .v { font-family: var(--display); font-size: 2rem; color: var(--heading); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .8rem; color: var(--text-dim); margin-top: 6px; }
.stat .bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); margin-top: 12px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--signal); border-radius: 4px; transition: width 900ms var(--ease); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { color: var(--heading); font-weight: 600; }
.list .s { font-size: .82rem; color: var(--text-dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot.ok { background: var(--signal); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--coral); }

/* ---------- cards / lesson tiles ---------- */
.tile { display: block; padding: 18px; border-radius: var(--r-m); background: rgba(24, 24, 27, 0.66); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.tile:hover { border-color: rgba(139, 123, 255,.32); background: rgba(34, 34, 38, 0.8); text-decoration: none; transform: translateY(-2px); }
.tile h4 { margin: 8px 0 4px; font-size: 1.02rem; }
.tile .s { font-size: .84rem; color: var(--text-dim); }
.tile .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tile .progress-line { height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 14px; overflow: hidden; }
.tile .progress-line i { display: block; height: 100%; background: var(--signal); }
.level-band { margin-bottom: 30px; }
.level-band > h2 { display: flex; align-items: baseline; gap: 12px; }
.level-band > h2 small { font: 400 .85rem var(--body); color: var(--text-faint); }

/* ---------- lesson reader ---------- */
.reader { max-width: 760px; }
.reader .section { margin-bottom: 30px; }
.reader .section h2 { font-size: 1.3rem; }
.prose { font-size: 1.02rem; line-height: 1.75; }
.prose b, .prose strong { color: var(--heading); }
.prose table, table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .93rem; }
.prose th, .prose td, table.data th, table.data td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th, table.data th { color: var(--text-dim); font-weight: 600; font-size: .82rem; background: rgba(14,14,16,.4); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 4px 0; }
.prose .hl { background: var(--signal-soft); color: var(--heading); padding: 0 4px; border-radius: 4px; }
.prose .note, .prose .rule { padding: 14px 16px; border-radius: var(--r-m); margin: 14px 0; }
.prose .note { background: rgba(124,200,255,.07); border: 1px solid rgba(124,200,255,.2); }
.prose .rule { background: var(--signal-soft); border: 1px solid rgba(139, 123, 255,.25); }
.prose .note p:last-child, .prose .rule p:last-child { margin-bottom: 0; }
.example { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.example .de-line { color: var(--heading); font-size: 1.02rem; }
.example .en-line { color: var(--text-faint); font-size: .86rem; }
.mistake { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mistake .w { color: var(--coral); text-decoration: line-through; text-decoration-color: rgba(255,122,107,.5); }
.mistake .r { color: var(--signal); }
.mistake .why { grid-column: 1 / -1; font-size: .86rem; color: var(--text-dim); }
.toc { position: sticky; top: 24px; font-size: .86rem; }
.toc a { display: block; padding: 5px 10px; color: var(--text-dim); border-left: 2px solid var(--line); }
.toc a:hover { color: var(--heading); border-color: var(--signal); text-decoration: none; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 40px; }

/* ---------- questions ---------- */
.q { padding: 16px 18px; border-radius: var(--r-m); background: rgba(20, 20, 22, 0.6); border: 1px solid var(--line); margin-bottom: 12px; transition: border-color var(--dur) var(--ease); }
.q .qn { font-family: var(--display); color: var(--text-faint); font-size: .82rem; margin-right: 8px; }
.q .prompt { color: var(--heading); margin-bottom: 10px; }
.q .opts { display: flex; flex-direction: column; gap: 6px; }
.q .opts.inline { flex-direction: row; flex-wrap: wrap; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; background: rgba(14,14,16,.4); transition: border-color var(--dur), background var(--dur); }
.opt:hover { border-color: var(--line-2); background: rgba(44,44,48,.3); }
.opt.sel { border-color: rgba(139, 123, 255,.5); background: var(--signal-soft); }
.opt input { margin-top: 4px; }
.q.correct { border-color: rgba(139, 123, 255,.45); }
.q.wrong { border-color: rgba(255,122,107,.45); }
.opt.is-answer { border-color: rgba(139, 123, 255,.6); }
.opt.is-wrong { border-color: rgba(255,122,107,.6); background: var(--coral-soft); }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; background: rgba(124,200,255,.06); border-left: 3px solid var(--sky); color: var(--text); animation: viewIn var(--dur) var(--ease); }
.explain .verdict { font-weight: 700; margin-right: 6px; }
.explain .verdict.ok { color: var(--signal); } .explain .verdict.bad { color: var(--coral); }
.gap-input { width: 160px; display: inline-block; }
.order-bank { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; min-height: 40px; }
.order-bank button { padding: 5px 12px; font-weight: 500; }
.order-answer { min-height: 44px; padding: 8px; border-radius: 10px; border: 1px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: 6px; }
.score-banner { display: flex; align-items: center; gap: 22px; padding: 20px 24px; margin-bottom: 18px; }
.score-banner .big { font-family: var(--display); font-size: 3rem; color: var(--heading); line-height: 1; }

/* ---------- exam ---------- */
.exam-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 18px; margin: -30px calc(-1 * clamp(18px, 4vw, 52px)) 22px; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.exam-bar .title { font-family: var(--display); color: var(--heading); font-size: 1.05rem; }
.timer { display: flex; align-items: center; gap: 10px; margin-left: auto; font-family: var(--display); font-size: 1.35rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.timer svg { width: 34px; height: 34px; transform: rotate(-90deg); }
.timer .t-bg { stroke: rgba(255,255,255,.12); }
.timer .t-fg { stroke: var(--signal); transition: stroke-dashoffset 1s linear, stroke 400ms; }
.timer.low { color: var(--amber); } .timer.low .t-fg { stroke: var(--amber); }
.timer.crit { color: var(--coral); animation: pulse 1s ease-in-out infinite; } .timer.crit .t-fg { stroke: var(--coral); }
@keyframes pulse { 50% { opacity: .55; } }
.exam-part { margin-bottom: 34px; }
.exam-part > h2 { display: flex; align-items: baseline; gap: 12px; }
.instructions { padding: 12px 16px; border-radius: var(--r-m); background: rgba(124,200,255,.06); border: 1px solid rgba(124,200,255,.16); margin-bottom: 16px; font-size: .95rem; }
.text-sheet { background: #eef3ef; color: #17231d; border-radius: var(--r-m); padding: 22px 26px; font: 1rem/1.75 Georgia, "Cambria", serif; margin-bottom: 14px; box-shadow: 0 18px 40px -24px rgba(0,0,0,.8); }
.text-sheet h4 { color: #0c2a1d; font-family: var(--display); margin-bottom: 8px; }
.text-sheet p { margin-bottom: .8em; }
.ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ad { background: #eef3ef; color: #17231d; border-radius: 10px; padding: 12px 14px; font-size: .88rem; line-height: 1.5; }
.ad b { font-family: var(--display); color: #0c2a1d; }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.split .sticky { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }

.player { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-m); background: rgba(14,14,16,.6); border: 1px solid var(--line-2); margin-bottom: 14px; }
.player .play { width: 46px; height: 46px; border-radius: 50%; justify-content: center; padding: 0; background: var(--signal); color: #000000; border: 0; }
.player .play svg { width: 20px; height: 20px; }
.player .wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; }
.player .wave i { flex: 1; background: rgba(139, 123, 255,.25); border-radius: 2px; height: 30%; transition: height 200ms; }
.player.playing .wave i { animation: wave 1s ease-in-out infinite; background: rgba(139, 123, 255,.6); }
@keyframes wave { 0%,100% { height: 20%; } 50% { height: 90%; } }
.player .plays { font-size: .8rem; color: var(--text-dim); white-space: nowrap; }
.transcript { font-size: .92rem; }
.transcript p { margin: 0 0 6px; }
.transcript .sp { color: var(--signal); font-weight: 600; margin-right: 6px; }

/* ---------- vocabulary ---------- */
.vocab-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.vocab-table th { position: sticky; top: 0; background: var(--ink-2); text-align: left; padding: 10px 12px; font-size: .78rem; color: var(--text-faint); font-weight: 600; border-bottom: 1px solid var(--line-2); z-index: 1; }
.vocab-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vocab-table tr:hover td { background: rgba(139, 123, 255,.035); }
.art { font-weight: 700; }
.art-der { color: #6aa8ff; } .art-die { color: #ff7b7b; } .art-das { color: #8b7bff; }
.flash-stage { perspective: 1400px; display: flex; justify-content: center; margin: 10px 0 22px; }
.flashcard { width: min(560px, 100%); height: 330px; position: relative; transform-style: preserve-3d; transition: transform 560ms var(--ease); cursor: pointer; }
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r-l); padding: 30px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border: 1px solid var(--line-2); }
.flashcard .front { background: radial-gradient(500px 300px at 50% 0%, rgba(139, 123, 255,.12), transparent 70%), linear-gradient(160deg, #1a1a1d, #0b0b0c); }
.flashcard .back { transform: rotateY(180deg); background: linear-gradient(160deg, #1f1f22, #111113); }
.flashcard .word { font-family: var(--display); font-size: 2.6rem; color: var(--heading); line-height: 1.1; }
.flashcard .hint { margin-top: 16px; font-size: .8rem; color: var(--text-faint); }
.flashcard .en { font-size: 1.4rem; color: var(--heading); }
.flashcard .ar { font-size: 1.5rem; color: var(--signal); margin-top: 8px; }
.flashcard .ex { margin-top: 18px; font-size: .92rem; color: var(--text-dim); max-width: 44ch; }
.grade-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.grade-row button { min-width: 120px; justify-content: center; }
.grade-row .again { border-color: rgba(255,122,107,.4); }
.grade-row .hard { border-color: rgba(243,188,85,.4); }
.grade-row .good { border-color: rgba(139, 123, 255,.4); }

/* ---------- translation popup ---------- */
.lookup-pop {
  position: absolute; z-index: 1000; width: 340px; max-width: calc(100vw - 20px);
  background: rgba(24, 24, 27, 0.94); border: 1px solid rgba(139, 123, 255,.28); border-radius: 16px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(0,0,0,.4);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: 16px 18px 14px; font-size: .9rem; transform-origin: top left;
  animation: popIn 200ms var(--ease) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.lookup-pop .lp-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-right: 26px; }
.lookup-pop .lp-word { font-family: var(--display); font-size: 1.45rem; color: var(--heading); line-height: 1.1; }
.lookup-pop .lp-close { position: absolute; top: 10px; right: 10px; padding: 4px; background: transparent; border: 0; color: var(--text-faint); }
.lookup-pop .lp-close:hover { color: var(--heading); background: transparent; }
.lookup-pop .lp-meta { font-size: .78rem; color: var(--text-dim); margin-top: 4px; }
.lookup-pop .lp-from { font-size: .78rem; color: var(--amber); margin-top: 6px; }
.lookup-pop .lp-en { color: var(--heading); margin-top: 10px; font-size: .98rem; }
.lookup-pop .lp-ar { color: var(--signal); font-size: 1.15rem; margin-top: 4px; text-align: right; }
.lookup-pop .lp-ex { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--text-dim); }
.lookup-pop .lp-ex b { color: var(--text); font-weight: 500; }
.lookup-pop .lp-gram { margin-top: 8px; font-size: .8rem; color: var(--text-dim); }
.lookup-pop .lp-senses { margin: 8px 0 0; padding-left: 16px; color: var(--text); font-size: .86rem; }
.lookup-pop .lp-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.lookup-pop .lp-src { margin-top: 10px; font-size: .7rem; color: var(--text-faint); }
.lookup-pop .lp-none { color: var(--amber); margin-top: 8px; }
.lookup-hint { font-size: .78rem; color: var(--text-faint); display: inline-flex; align-items: center; gap: 6px; }
.dbl { cursor: text; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fadeIn var(--dur) var(--ease); }
.modal { width: min(620px, 100%); max-height: 86vh; overflow: auto; background: #161618; border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 26px; animation: modalIn var(--dur) var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1c1c1f; border: 1px solid rgba(139, 123, 255,.3); color: var(--heading); padding: 11px 16px; border-radius: 12px; font-size: .9rem; box-shadow: 0 14px 30px -12px rgba(0,0,0,.8); animation: modalIn var(--dur) var(--ease); }
.toast.warn { border-color: rgba(243,188,85,.4); }
.milestone { position: fixed; inset: 0; z-index: 1200; pointer-events: none; display: grid; place-items: center; }
.milestone .m-card { pointer-events: auto; text-align: center; padding: 30px 40px; border-radius: var(--r-l); background: rgba(24,24,27,.95); border: 1px solid rgba(139, 123, 255,.4); box-shadow: 0 0 80px -10px var(--signal-glow); animation: modalIn 420ms var(--ease); }
.milestone .m-card h2 { font-size: 1.8rem; }
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); animation: spark 900ms var(--ease) forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* ---------- loading ---------- */
.loading { display: flex; align-items: center; gap: 12px; color: var(--text-dim); padding: 40px 0; }
.loading i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--emerald-2); border-top-color: var(--signal); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 34px 20px; color: var(--text-dim); }
.empty h3 { margin-bottom: 6px; }

/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: rgba(255,255,255,.12); }
.chart text { fill: var(--text-faint); font: 11px var(--body); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, 14px); gap: 4px; }
.heat i { width: 14px; height: 14px; border-radius: 3px; background: rgba(255,255,255,.06); }
.heat i.l1 { background: rgba(139, 123, 255,.2); } .heat i.l2 { background: rgba(139, 123, 255,.42); } .heat i.l3 { background: rgba(139, 123, 255,.68); } .heat i.l4 { background: var(--signal); }

/* ---------- plan ---------- */
.week { margin-bottom: 22px; }
.day-card { padding: 14px 16px; border-radius: var(--r-m); background: rgba(20,20,22,.6); border: 1px solid var(--line); }
.day-card.today { border-color: rgba(139, 123, 255,.45); box-shadow: 0 0 0 1px rgba(139, 123, 255,.15) inset; }
.day-card h4 { font-size: .95rem; margin-bottom: 8px; display: flex; justify-content: space-between; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: .88rem; }
.task .min { margin-left: auto; color: var(--text-faint); font-size: .78rem; white-space: nowrap; }
.task.done .tt { color: var(--text-faint); text-decoration: line-through; }
.phase { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }

/* ---------- writing feedback ---------- */
.fb-item { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; background: rgba(14,14,16,.5); border-left: 3px solid var(--amber); font-size: .9rem; }
.fb-item.good { border-left-color: var(--signal); }
.fb-item.bad { border-left-color: var(--coral); }
.fb-item .fx { font-size: .84rem; color: var(--text-dim); margin-top: 4px; }
mark.err { background: rgba(255,122,107,.22); color: var(--heading); border-bottom: 2px solid var(--coral); border-radius: 2px; padding: 0 1px; }
.wordcount { font-family: var(--display); font-size: .95rem; }

/* ---------- pdf reader ---------- */
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 20px 40px -20px rgba(0,0,0,.9); border-radius: 4px; }
.pdf-page canvas { display: block; border-radius: 4px; }
/* pdf.js text layer (rules adapted from pdf.js viewer.css, Apache-2.0) */
.pdf-page .textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; letter-spacing: normal; word-spacing: normal; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 0;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.pdf-page .textLayer span, .pdf-page .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; user-select: text; }
.pdf-page .textLayer > :not(.markedContent), .pdf-page .textLayer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height)); --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.pdf-page .textLayer .markedContent { display: contents; }
.pdf-page .textLayer ::selection { background: rgba(139, 123, 255,.35); }
.drop { border: 2px dashed var(--line-2); border-radius: var(--r-l); padding: 34px; text-align: center; color: var(--text-dim); transition: border-color var(--dur), background var(--dur); }
.drop.over { border-color: var(--signal); background: var(--signal-soft); }
.reader-text { font: 1.08rem/1.85 Georgia, Cambria, serif; color: var(--heading); white-space: pre-wrap; }

/* ---------- markdown doc ---------- */
.md { max-width: 860px; }
.md h1 { font-size: 1.8rem; } .md h2 { margin-top: 1.6em; font-size: 1.35rem; } .md h3 { margin-top: 1.3em; }
.md table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 12px 0; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { color: var(--text-dim); background: rgba(14,14,16,.45); }
.md code { background: rgba(14,14,16,.7); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
.md blockquote { margin: 12px 0; padding: 8px 16px; border-left: 3px solid var(--amber); background: var(--amber-soft); border-radius: 0 10px 10px 0; }
.md ul, .md ol { padding-left: 1.4em; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .lesson-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 800; width: 270px; left: 0; transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: 30px 0 60px -20px rgba(0,0,0,.8); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .split { grid-template-columns: 1fr; }
  .split .sticky { position: static; max-height: none; }
  h1, .hero-main h1 { font-size: 1.7rem; }
  .main { padding-top: 18px; }
  .exam-bar { margin-top: -18px; }
  .gauge-wrap { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .mistake { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .flashcard { height: 290px; }
  .flashcard .word { font-size: 2rem; }
  .topbar .search { display: none; }
  .topbar .lookup-hint { display: none; }
}
@media print { .sidebar, .topbar, .exam-bar { display: none; } .shell { display: block; } body { background: #fff; color: #000; } }
