﻿:root{
  --bg:#f5f6fa; --surface:#ffffff; --surface-2:#eef0f6; --text:#1a1e29; --muted:#5b6274; --border:#e0e3ec;
  --accent:#4f46e5; --accent-soft:#eceeff; --on-accent:#ffffff;
  --ok:#15803d; --ok-soft:#e5f6eb; --bad:#c62828; --bad-soft:#fdecea; --warn:#b45309; --warn-soft:#fff4e2;
  --c-l:#2563eb; --c-r:#0f8a80; --c-s:#e2580b; --c-w:#8b33d6; --c-v:#d0266f;
  --shadow:0 1px 2px rgba(16,24,40,.05),0 6px 18px rgba(16,24,40,.06);
  --radius:14px;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0e1016; --surface:#171a23; --surface-2:#20242f; --text:#e8eaf0; --muted:#9ba2b3; --border:#2b303d;
    --accent:#8b93ff; --accent-soft:#25284a; --on-accent:#0e1016;
    --ok:#4ade80; --ok-soft:#11301e; --bad:#f87171; --bad-soft:#3a1818; --warn:#fbbf24; --warn-soft:#33270e;
    --c-l:#60a5fa; --c-r:#2dd4bf; --c-s:#fb923c; --c-w:#c084fc; --c-v:#f472b6;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 18px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"]{
  --bg:#0e1016; --surface:#171a23; --surface-2:#20242f; --text:#e8eaf0; --muted:#9ba2b3; --border:#2b303d;
  --accent:#8b93ff; --accent-soft:#25284a; --on-accent:#0e1016;
  --ok:#4ade80; --ok-soft:#11301e; --bad:#f87171; --bad-soft:#3a1818; --warn:#fbbf24; --warn-soft:#33270e;
  --c-l:#60a5fa; --c-r:#2dd4bf; --c-s:#fb923c; --c-w:#c084fc; --c-v:#f472b6;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 18px rgba(0,0,0,.25);
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--text);font-family:"Be Vietnam Pro",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased}
button,input,textarea,select{font:inherit;color:inherit}
h1,h2,h3{line-height:1.25;margin:0 0 .5rem}
h2{font-size:1.5rem}
h3{font-size:1.1rem}
p{margin:0 0 .75rem}
.top{position:sticky;top:0;z-index:10;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(10px);border-bottom:1px solid var(--border)}
.top-in{max-width:980px;margin:0 auto;padding:10px 16px;display:flex;align-items:center;gap:12px}
.brand{font-weight:700;font-size:1.05rem;white-space:nowrap;display:flex;align-items:center;gap:8px}
.brand .logo{width:30px;height:30px;border-radius:9px;background:var(--accent);color:var(--on-accent);display:grid;place-items:center;font-size:.8rem;font-weight:700}
nav{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none;flex:1}
nav::-webkit-scrollbar{display:none}
nav button{border:0;background:transparent;padding:7px 12px;border-radius:999px;cursor:pointer;white-space:nowrap;color:var(--muted);font-weight:500}
nav button:hover{background:var(--surface-2);color:var(--text)}
nav button.on{background:var(--accent-soft);color:var(--accent);font-weight:600}
.icon-btn{border:1px solid var(--border);background:var(--surface);border-radius:999px;width:36px;height:36px;cursor:pointer;flex:none}
main{max-width:980px;margin:0 auto;padding:24px 16px 80px}
.lead{color:var(--muted);margin-bottom:1.25rem}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);margin-bottom:16px}
.grid{display:grid;gap:14px}
.g2{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.g3{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.skill{border-top:4px solid var(--sc);display:flex;flex-direction:column;gap:6px;margin:0}
.skill .ttl{display:flex;align-items:center;gap:8px;font-weight:600;font-size:1.05rem}
.skill .sub{color:var(--muted);font-size:.88rem}
.prog{height:8px;background:var(--surface-2);border-radius:99px;overflow:hidden}
.prog i{display:block;height:100%;background:var(--sc,var(--accent));border-radius:99px;transition:width .3s}
.stat{font-size:1.9rem;font-weight:700;line-height:1.1}
.muted{color:var(--muted)}
.small{font-size:.88rem}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.spread{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.btn{border:1px solid var(--border);background:var(--surface);padding:8px 14px;border-radius:10px;cursor:pointer;font-weight:500;display:inline-flex;align-items:center;gap:6px}
.btn:hover{background:var(--surface-2)}
.btn.pri{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn.pri:hover{filter:brightness(1.08)}
.btn.playing{background:var(--bad-soft);border-color:var(--bad);color:var(--bad)}
.btn:disabled{opacity:.5;cursor:default}
.tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:16px}
.tabs button{border:1px solid var(--border);background:var(--surface);padding:7px 14px;border-radius:999px;cursor:pointer;font-weight:500;font-size:.93rem}
.tabs button.on{background:var(--text);color:var(--bg);border-color:var(--text)}
.tag{display:inline-block;font-size:.75rem;font-weight:600;padding:2px 9px;border-radius:99px;background:var(--surface-2);color:var(--muted)}
.meta{font-size:.82rem;color:var(--muted);font-weight:500;margin-bottom:8px;text-transform:uppercase;letter-spacing:.04em}
.q{font-size:1.08rem;font-weight:500;margin-bottom:12px}
.blank{display:inline-block;min-width:70px;border-bottom:2px solid var(--accent);margin:0 3px}
.opts{display:grid;gap:8px}
.opt{display:flex;gap:10px;align-items:flex-start;text-align:left;border:1.5px solid var(--border);background:var(--surface);padding:10px 14px;border-radius:10px;cursor:pointer;width:100%}
.opt:hover:not(:disabled){border-color:var(--accent);background:var(--accent-soft)}
.opt b{flex:none;width:24px;height:24px;border-radius:7px;background:var(--surface-2);display:grid;place-items:center;font-size:.85rem}
.opt:disabled{cursor:default}
.opt.right{border-color:var(--ok);background:var(--ok-soft)}
.opt.right b{background:var(--ok);color:var(--surface)}
.opt.wrong{border-color:var(--bad);background:var(--bad-soft)}
.opt.wrong b{background:var(--bad);color:var(--surface)}
.opts.p2{grid-template-columns:repeat(3,1fr)}
.opts.p2 .opt{flex-direction:column;align-items:center;text-align:center}
.opts.p2 .otext{font-size:.9rem}
.exp{margin-top:12px;padding:12px 14px;border-radius:10px;font-size:.95rem}
.exp.ok{background:var(--ok-soft)}
.exp.bad{background:var(--bad-soft)}
.box{background:var(--surface-2);border-radius:10px;padding:12px 14px;font-size:.95rem}
.passage{font-size:1.08rem;line-height:1.85;background:var(--surface-2);padding:16px 18px;border-radius:12px;margin-bottom:14px}
.passage.doc{font-size:.98rem;line-height:1.7;border-left:4px solid var(--c-r)}
.pager{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.dot{width:30px;height:30px;border-radius:8px;border:1.5px solid var(--border);background:var(--surface);cursor:pointer;font-size:.8rem;font-weight:600;color:var(--muted)}
.dot.ok{background:var(--ok-soft);border-color:var(--ok);color:var(--ok)}
.dot.bad{background:var(--bad-soft);border-color:var(--bad);color:var(--bad)}
.dot.cur{outline:2px solid var(--accent);outline-offset:1px;color:var(--text)}
.runner{margin-top:14px;padding:14px;border-radius:12px;background:var(--accent-soft)}
.runner .bar{height:8px;background:var(--surface);border-radius:99px;overflow:hidden;margin:8px 0 10px}
.runner .bar i{display:block;height:100%;width:0;background:var(--accent);transition:width .1s linear}
.live{font-style:italic;color:var(--muted);min-height:1.2em;margin-top:8px}
.result:empty{display:none}
.result{margin-top:14px}
.w-ok{color:var(--ok);font-weight:500}
.w-miss{color:var(--bad);text-decoration:underline wavy;text-underline-offset:4px}
.score{display:flex;align-items:center;gap:14px;margin-bottom:10px}
.ring{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;font-weight:700;background:conic-gradient(var(--rc) calc(var(--v)*1%),var(--surface-2) 0)}
.ring span{width:50px;height:50px;border-radius:50%;background:var(--surface);display:grid;place-items:center;font-size:.95rem}
details{margin-top:12px}
summary{cursor:pointer;font-weight:600;color:var(--accent)}
details .box{margin-top:8px}
textarea,input[type=text]{width:100%;border:1.5px solid var(--border);border-radius:10px;padding:12px;background:var(--surface);resize:vertical}
textarea:focus,input[type=text]:focus{outline:none;border-color:var(--accent)}
.tips{margin:0;padding-left:1.2rem;display:grid;gap:6px}
.tips li::marker{color:var(--accent)}
.opt.picked{border-color:var(--accent);background:var(--accent-soft)}
.opt.picked b{background:var(--accent);color:var(--on-accent)}
button.lesson{width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer}
button.lesson:hover{border-color:var(--sc)}
.lesson-body h4{margin:1.1rem 0 .4rem;font-size:1.02rem}
.lesson-body h4:first-child{margin-top:0}
.lesson-body ul{padding-left:1.2rem;margin:.3rem 0 .8rem}
.lesson-body table{margin:.5rem 0 1rem}
.test-bar{position:sticky;top:57px;z-index:5;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 14px;margin-bottom:14px;box-shadow:var(--shadow)}
.checks{list-style:none;padding:0;margin:10px 0 0;display:grid;gap:4px}
.checks li{font-size:.95rem}
.checks .y::before{content:"✓ ";color:var(--ok);font-weight:700}
.checks .n::before{content:"✗ ";color:var(--bad);font-weight:700}
.timer{font-variant-numeric:tabular-nums;font-weight:700;font-size:1.1rem;padding:4px 12px;border-radius:8px;background:var(--surface-2)}
.timer.end{background:var(--bad-soft);color:var(--bad)}
.kw{display:inline-block;padding:4px 12px;border-radius:8px;background:var(--accent-soft);color:var(--accent);font-weight:600;margin-right:6px}
.scene{font-size:3.2rem;line-height:1;margin-bottom:8px}
.flash{perspective:1000px;height:250px;cursor:pointer;margin-bottom:14px}
.flash-in{position:relative;width:100%;height:100%;transition:transform .5s;transform-style:preserve-3d}
.flash.flip .flash-in{transform:rotateY(180deg)}
.face{position:absolute;inset:0;backface-visibility:hidden;border-radius:var(--radius);border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;text-align:center}
.face.back{transform:rotateY(180deg);background:var(--accent-soft)}
.face .word{font-size:2.2rem;font-weight:700}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{border:1px solid var(--border);background:var(--surface);padding:4px 10px;border-radius:99px;font-size:.85rem;cursor:pointer}
.chip.known{background:var(--ok-soft);border-color:var(--ok);color:var(--ok)}
.chip.cur{outline:2px solid var(--accent)}
table{width:100%;border-collapse:collapse;font-size:.93rem}
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--border)}
th{color:var(--muted);font-weight:600;font-size:.82rem;text-transform:uppercase;letter-spacing:.03em}
.table-wrap{overflow-x:auto}
.notice{background:var(--warn-soft);color:var(--text);border-left:4px solid var(--warn);padding:10px 14px;border-radius:8px;font-size:.92rem;margin-bottom:14px}
.dlg-line{margin:4px 0}
.dlg-line b{display:inline-block;min-width:28px;color:var(--accent)}
.toggle{display:inline-flex;align-items:center;gap:8px;font-size:.92rem;cursor:pointer;user-select:none}
.speed{display:inline-flex;align-items:center;gap:8px;font-size:.9rem;color:var(--muted)}
.speed input{width:110px;accent-color:var(--accent)}
@media (max-width:560px){
  .brand .name{display:none}
  .card{padding:16px}
  .opts.p2{grid-template-columns:1fr}
  .opts.p2 .opt{flex-direction:row;text-align:left}
  .stat{font-size:1.6rem}
}

.voicebar{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.voicebar select{max-width:220px}