/* V7 Academy — navy / white / teal accent. Hand-written CSS (no build step). */
:root {
  --navy-950: #0b1426; --navy-900: #0f1b33; --navy-800: #16264a; --navy-700: #22355f; --navy-600: #33497a;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --bg: #f5f7fb; --card: #ffffff;
  --accent: #0e9f8e; --accent-ink: #075e55; --accent-soft: #e6f6f4;
  --blue: #2563eb; --blue-soft: #eaf1ff;
  --good: #15803d; --good-soft: #e8f6ed; --warn: #b45309; --warn-soft: #fdf3e2; --bad: #b91c1c; --bad-soft: #fdecec;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .92rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; border-radius: 6px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--navy-900) 248px, var(--bg) 248px); }
.sidebar { background: var(--navy-900); color: #cbd5e1; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; letter-spacing: -.03em; }
.brand-name { font-weight: 700; line-height: 1.1; } .brand-sub { font-size: .74rem; color: #94a3b8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #cbd5e1; font-weight: 500; }
.nav a:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--navy-700); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--navy-700); padding: 12px 8px 0; font-size: .82rem; }
.sidebar-foot .who { color: #fff; font-weight: 600; } .sidebar-foot button { margin-top: 8px; }
.main { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.bottom-nav { display: none; }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.main, .shell > * { min-width: 0; }
.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)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { background: #f8fafc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(148, 163, 184, .15); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: .85rem; border-radius: 7px; }
.btn-icon { width: 36px; padding: 0; }
.sidebar .btn-ghost { color: #cbd5e1; }
.btn svg { width: 16px; height: 16px; }
.btn.recording { background: var(--bad); border-color: var(--bad); color: #fff; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #eef2f7; color: var(--ink-2); white-space: nowrap; }
.b-pass { background: var(--good-soft); color: var(--good); } .b-improve { background: var(--warn-soft); color: var(--warn); }
.b-retry { background: var(--bad-soft); color: var(--bad); } .b-new { background: #eef2f7; color: var(--muted); }
.b-pending { background: var(--blue-soft); color: var(--blue); } .b-locked { background: #eef2f7; color: var(--muted); }

.stat { padding: 16px 18px; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.65rem; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.bar { height: 8px; background: #edf1f7; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.notice { border: 1px solid var(--line); border-left: 4px solid var(--blue); background: var(--blue-soft); padding: 12px 14px; border-radius: 8px; font-size: .9rem; }
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.notice.good { border-left-color: var(--good); background: var(--good-soft); }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 10px; background: #fbfcfe; }

label.field { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
label.field span.hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  display: block; width: 100%; margin-top: 6px; height: 42px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.input-prefix { position: relative; } .input-prefix > b { position: absolute; left: 12px; top: calc(50% + 3px); transform: translateY(-50%); color: var(--muted); font-weight: 500; }
.input-prefix input { padding-left: 26px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--navy-900); color: #cbd5e1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 2rem; max-width: 420px; }
.auth-side li { margin-bottom: 8px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .btn { width: 100%; }

/* ---------- academy ---------- */
.level { padding: 0; overflow: hidden; }
.level-head { padding: 16px 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.level-num { width: 38px; height: 38px; border-radius: 10px; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-weight: 750; flex: none; }
.level.locked .level-num { background: #cbd5e1; }
.level-list { border-top: 1px solid var(--line); }
.ex-row { display: grid; grid-template-columns: 42px 1fr auto auto; gap: 12px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.ex-row:last-child { border-bottom: 0; }
.ex-row:hover { background: #f8fafc; text-decoration: none; }
.ex-row .n { color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.ex-row .t { font-weight: 600; } .ex-row .s { font-size: .8rem; color: var(--muted); }

/* ---------- exercise ---------- */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 18px; }
.step-tab { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; text-align: left; font: inherit; cursor: pointer; color: var(--ink-2); }
.step-tab .k { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.step-tab .v { font-weight: 650; font-size: .9rem; display: flex; justify-content: space-between; align-items: center; }
.step-tab[aria-selected="true"] { border-color: var(--navy-800); box-shadow: inset 0 0 0 1px var(--navy-800); color: var(--ink); }
.step-tab.done .v::after { content: "✓"; color: var(--good); font-weight: 800; }
.line { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.line + .line { margin-top: 10px; }
.line .en { font-size: 1.12rem; font-weight: 650; color: var(--ink); }
.line .ur { color: var(--ink-2); font-size: .92rem; }
.line .guide { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; color: var(--accent-ink); background: var(--accent-soft); display: inline-block; padding: 2px 8px; border-radius: 6px; margin-top: 6px; }
.line .tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.line.hidden-script .en { filter: blur(6px); user-select: none; }
.ur-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink-2); }
.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.vocab .v { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.vocab .w { font-weight: 700; } .vocab .ipa { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; color: var(--muted); }
.word { display: inline-block; padding: 1px 5px; border-radius: 5px; margin: 1px; }
.word.ok { background: var(--good-soft); color: var(--good); } .word.miss { background: var(--bad-soft); color: var(--bad); text-decoration: underline wavy; }
.option { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 12px 14px; font: inherit; cursor: pointer; margin-bottom: 8px; }
.option:hover { border-color: var(--navy-600); }
.option[aria-pressed="true"] { border-color: var(--navy-800); box-shadow: inset 0 0 0 1px var(--navy-800); background: #f8fafc; }
.option.correct { border-color: var(--good); background: var(--good-soft); } .option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.tech-bubble { background: var(--navy-900); color: #fff; border-radius: 12px 12px 12px 4px; padding: 12px 14px; display: inline-block; max-width: 100%; }
.tech-bubble .who { font-size: .72rem; color: #94a3b8; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.score-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.score-cat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.score-cat .n { font-size: 1.25rem; font-weight: 750; }
.big-score { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }
.mic-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; display: inline-block; }
.mic-dot.on { background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .mic-dot.on { animation: none; } }

/* ---------- scripts ---------- */
.script-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.cat-list { position: sticky; top: 16px; padding: 8px; max-height: calc(100vh - 32px); overflow: auto; }
.cat-list button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: .88rem; cursor: pointer; color: var(--ink-2); }
.cat-list button:hover { background: #f1f5f9; }
.cat-list button[aria-pressed="true"] { background: var(--navy-800); color: #fff; }
.script { padding: 16px 18px; }
.script .en { font-size: 1.05rem; font-weight: 650; }
.script .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; font-size: .85rem; }
.script .meta b { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- calculator ---------- */
.calc-out .rowline { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.calc-out .rowline.total { font-weight: 750; font-size: 1.05rem; border-bottom: 0; }
.calc-out .rowline.mine { color: var(--accent-ink); font-weight: 700; }
.split { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #edf1f7; margin: 12px 0 6px; }
.split .a { background: var(--accent); } .split .b { background: var(--navy-600); } .split .c { background: #f59e0b; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: .9rem; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .script-layout { grid-template-columns: 1fr; }
  .cat-list { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; }
  .cat-list button { white-space: nowrap; width: auto; }
  .cat-list button .count { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { display: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; background: var(--navy-900); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
  .main { padding: 18px 16px 96px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: .7rem; color: var(--muted); font-weight: 600; }
  .bottom-nav a[aria-current="page"] { color: var(--navy-800); }
  .bottom-nav svg { width: 20px; height: 20px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .step-tab { padding: 8px 3px; text-align: center; } .step-tab .k { display: none; } .step-tab .v { font-size: .7rem; justify-content: center; } .step-tab.done .v::after { content: none; } .step-tab.done { border-color: var(--good); background: var(--good-soft); }
  .score-cats { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; }
  .ex-row { grid-template-columns: 32px 1fr auto; } .ex-row .score { display: none; }
  .script .meta { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
}
