:root{--navy:#142b4a;--blue:#2563a6;--red:#d94848;--cream:#f5f7fb;--ink:#172235;--muted:#5d6c81;--green:#1d7a53;--light-blue:#eef4fc}
*{box-sizing:border-box}
body{margin:0;background:var(--cream);color:var(--ink);font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
header{background:url(mountains.svg) center bottom/cover no-repeat,linear-gradient(120deg,#142b4a,#2563a6);color:white;padding:30px 0 66px;border-bottom:6px solid var(--red)}
.headrow{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.kicker{display:flex;align-items:center;gap:10px;font-size:.85rem;font-weight:700;letter-spacing:.04em}
.kicker img{border-radius:4px}
#accountBtn{background:#ffffff26;border:1px solid #ffffff66;color:white;white-space:nowrap}
.wrap{max-width:1000px;margin:auto;padding-left:16px;padding-right:16px}
h1{font-size:clamp(1.6rem,4vw,2.5rem);line-height:1.15;letter-spacing:-.02em;margin:10px 0 8px;text-wrap:balance}
header p{margin:0;color:#e8f0fb}
main{padding-top:20px;padding-bottom:40px}
.tabs{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin:16px 0}
.tabs button{display:flex;align-items:center;gap:10px;padding:12px;text-align:left;background:white;border:1px solid #dde5ef;border-radius:16px;line-height:1.25;box-shadow:0 2px 8px #1834510a;transition:transform .15s,box-shadow .15s}
.tabs button:hover{transform:translateY(-2px);box-shadow:0 8px 20px #1834511f}
.tabs b,.tabs small{display:block}
.tabs b{font-size:.95rem}
.tabs small{font-size:.8rem;font-weight:500;color:var(--muted)}
.num{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:var(--light-blue);color:var(--blue);font-weight:800}
.tabs button.active{background:var(--blue);border-color:var(--blue);color:white}
.tabs button.active small{color:#e3eefb}
.tabs button.active .num{background:white}
button,select,input{font:inherit}
button{border:0;border-radius:12px;padding:11px 16px;background:#e5ebf3;color:var(--navy);font-weight:650;cursor:pointer}
button.active,.primary{background:var(--blue);color:white}
button:hover:enabled{filter:brightness(.96)}
button:disabled{cursor:default}
.start button:disabled,dialog button:disabled{opacity:.6}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #f3b53f;outline-offset:2px}
.panel{background:white;border:1px solid #e1e7ef;border-radius:18px;padding:24px;box-shadow:0 8px 28px #1834510c}
#saveBar{display:flex;align-items:center;gap:10px;margin:0 4px 12px;font-size:.9rem;color:var(--navy)}
.dot{flex:none;width:10px;height:10px;border-radius:50%;background:#3c9c73;box-shadow:0 0 0 4px #3c9c7326}
#saveBar[data-status=saving] .dot,#saveBar[data-status=local] .dot{background:var(--blue);box-shadow:0 0 0 4px #2563a626}
#saveBar[data-status=offline] .dot,#saveBar[data-status=busy] .dot{background:#d88a12;box-shadow:0 0 0 4px #d88a1226}
#saveStatus{font-weight:650}
.overview{background:white;border:1px solid #e1e7ef;border-radius:18px;padding:18px 18px 4px;box-shadow:0 8px 28px #1834510c}
.stats{display:grid;grid-template-columns:repeat(3,1fr)}
.stat{padding:2px 12px;text-align:center;border-left:1px solid #e1e7ef}
.stat:first-child{border:0}
.stat strong{display:block;font-size:1.9rem;line-height:1.2;font-weight:800;color:var(--navy)}
.stat.green strong{color:var(--green)}
.stat.red strong{color:#c23a3a}
.stat span{font-size:.85rem;color:var(--muted)}
.controls{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.controls select{border:1px solid #ccd6e3;border-radius:10px;padding:10px;background:white;color:var(--ink);max-width:100%}
.filterbar{display:grid;gap:12px;margin-bottom:16px}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{padding:8px 14px;border-radius:999px;background:white;border:1px solid #cfdae7;font-size:.9rem}
.chip small{color:var(--muted);font-weight:500}
.chip[aria-pressed=true]{background:var(--navy);border-color:var(--navy);color:white}
.chip[aria-pressed=true] small{color:#d5e2f2}
.cardbox{text-align:center;padding:18px 10px 10px}
.eyebrow{text-transform:uppercase;letter-spacing:.12em;color:var(--muted);font-size:.78rem;font-weight:700}
.word{font-size:clamp(1.5rem,4.5vw,2.2rem);line-height:1.3;font-weight:800;color:var(--navy);margin:10px 0}
.word.long{font-size:clamp(1.15rem,3vw,1.45rem)}
.context-sentence{background:#f8fafc;border-left:4px solid var(--blue);padding:14px 18px;border-radius:0 12px 12px 0;margin:14px auto;max-width:760px;font-size:1.12rem;line-height:1.65;text-align:left}
.context-sentence.large{font-size:1.2rem}
.gap{display:inline-block;min-width:120px;border-bottom:2px dashed var(--blue);color:var(--blue);font-weight:700;text-align:center;padding:0 6px}
.translation{font-size:1.1rem;color:var(--green);font-weight:700;min-height:1.8rem;margin-top:8px}
.hint{color:var(--muted);font-size:.92rem;margin:6px 0}
.hint.strong{font-weight:600;color:var(--navy)}
.center{text-align:center}
.actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:16px}
.answergrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:18px 0}
.answergrid button{background:#f7f9fc;border:2px solid #dbe3ed;padding:15px 16px;text-align:left;line-height:1.4}
.answergrid button:hover:enabled{border-color:var(--blue);filter:none}
.answergrid button.correct{background:#e5f5ed;border-color:#68b68f;color:#176342}
.answergrid button.wrong{background:#fff0ef;border-color:#e89a94;color:#a32d2d}
input:not([type=checkbox]){display:block;width:100%;max-width:560px;min-height:48px;padding:13px;border:1px solid #b9c6d6;border-radius:11px;margin:10px auto;color:var(--ink);background:white}
input:not([type=checkbox]):disabled{background:#f1f5fa}
.controls #search{max-width:440px;margin:0}
#testInteractive input.answer{margin-left:0}
.feedback{min-height:28px;font-weight:700;margin:10px 0}
.good{color:var(--green)}.bad{color:#b93838}
.progress{height:9px;background:#e8edf4;border-radius:20px;overflow:hidden;margin:12px 0 18px}
.progress>div{height:100%;background:linear-gradient(90deg,var(--red),#f0776a);border-radius:20px;width:0;transition:width .3s}
.list{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
.vrow{border:1px solid #e2e8f0;border-radius:12px;padding:12px 14px;display:flex;justify-content:space-between;align-items:flex-start;gap:14px}
.vrow b{color:var(--navy);font-size:1.05rem}
.vrow .def-text{color:var(--green);font-weight:600;font-size:.95rem;margin-top:2px}
.vrow .ex-text{color:var(--muted);font-size:.9rem;margin-top:4px;font-style:italic}
.vrow .gap{display:inline;min-width:0;padding:0;border:0;color:inherit;font-weight:inherit;text-decoration:underline}
.vside{display:flex;align-items:center;gap:4px;flex:none}
.done{color:var(--green);font-size:1.2rem;font-weight:700;min-width:1.2rem;text-align:center}
.icon{background:none;padding:0;width:44px;height:44px;font-size:1.2rem}
.icon:hover:enabled{background:var(--light-blue)}
.no-voice .speak{display:none}
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:.75rem;font-weight:700;background:var(--light-blue);color:var(--blue);margin-left:6px;vertical-align:middle}
.result{font-size:2rem;font-weight:800;color:var(--navy);margin:8px 0}
.review{padding-left:20px}
.hidden{display:none!important}
.small{font-size:.9rem;color:var(--muted)}
footer{text-align:center;color:var(--muted);font-size:.85rem;margin-top:28px}
footer p{margin:0}
.link{background:none;color:var(--blue);text-decoration:underline;font-weight:600}
.danger{background:#fff0ef;color:#a32d2d}
.start{max-width:470px;margin:8px auto 0;padding:28px}
.start h2{margin:0;font-size:1.7rem;color:var(--navy)}
.start>p{margin:6px 0 20px}
form label{display:block;margin-top:14px;font-weight:650}
form label.check{font-weight:400;margin-bottom:12px}
.start input:not([type=checkbox]),dialog input:not([type=checkbox]){max-width:none;margin:6px 0 12px}
.wide{width:100%}
.google{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;background:white;border:1px solid #747775;color:#1f1f1f}
.or{display:flex;align-items:center;gap:12px;color:var(--muted);margin:16px 0}
.or:before,.or:after{content:"";flex:1;border-top:1px solid #dbe3ed}
.segments{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;margin-bottom:18px;background:#e9eff6;border-radius:14px}
.segments button{background:none;padding:10px}
.segments [aria-pressed=true]{background:white;box-shadow:0 1px 5px #18345126}
#codeForm{border-top:1px solid #e1e7ef;margin-top:16px}
dialog{width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #e1e7ef;border-radius:18px;padding:22px;color:var(--ink);box-shadow:0 18px 50px #14284a40}
dialog::backdrop{background:#142b4a80}
dialog h2{margin:0 0 8px;color:var(--navy)}
dialog h3{margin:18px 0 6px;color:var(--navy);border-top:1px solid #e1e7ef;padding-top:16px}
dialog p{margin:8px 0}
dialog li{margin-bottom:8px}
.dialoghead{display:flex;justify-content:space-between;align-items:center}
.actions.left{justify-content:flex-start}
summary{cursor:pointer;color:var(--blue);font-weight:650;padding:6px 0;border-radius:6px}
#myCode{font:800 clamp(1.25rem,6vw,1.8rem)/1.3 ui-monospace,Consolas,monospace;color:var(--navy);background:var(--light-blue);border-radius:12px;padding:14px 8px;text-align:center;margin:14px 0;user-select:all}
@media(max-width:640px){
  .answergrid{grid-template-columns:1fr}
  .panel{padding:16px}
  .cardbox{padding:8px 0}
  header{padding:22px 0 54px}
  .headrow{flex-direction:column-reverse;gap:10px}
  #accountBtn{align-self:flex-end;padding:8px 14px}
  .stat{padding:2px 6px}
  .stat strong{font-size:1.5rem}
  .tabs{grid-template-columns:1fr 1fr}
  .tabs button:last-child{grid-column:1/-1}
  .chips{flex-wrap:nowrap;overflow-x:auto;margin:0 -16px;padding:4px 16px}
  .chip{flex:none}
  .vrow{flex-direction:column;gap:4px}
  .vside{align-self:flex-end}
}
@media(min-width:641px) and (max-width:960px){.tabs{grid-template-columns:repeat(6,1fr)}.tabs button{grid-column:span 2}.tabs button:nth-child(n+4){grid-column:span 3}}
@media(prefers-reduced-motion:reduce){.progress>div,.tabs button{transition:none}}
