:root{
  --bg:#f4f1ea; --paper:#fffdf8; --ink:#23211c; --muted:#7d7768;
  --line:#e4ded1; --accent:#b23a2e; --accent-soft:#f3e3df;
  --blue:#2f4858; --good:#3c7a4e; --bad:#b23a2e; --gold:#c89b3c;
  --shadow:0 1px 2px rgba(40,33,20,.06),0 8px 24px rgba(40,33,20,.07);
  --radius:16px;
}


:root[data-theme="dark"]{
  --bg:#111314; --paper:#1a1f22; --ink:#eef1ec; --muted:#a1aca5;
  --line:#2c3538; --accent:#ea7d6f; --accent-soft:#2b1d1d;
  --blue:#7aa6c2; --good:#5f9f6a; --bad:#ea7d6f; --gold:#d2b26a;
  --shadow:0 1px 2px rgba(0,0,0,.35),0 14px 36px rgba(0,0,0,.38);
  color-scheme: dark;
}

:root[data-theme="light"]{
  color-scheme: light;
}

:root[data-theme="dark"] body{
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(122,166,194,.09), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(234,125,111,.07), transparent 45%),
    var(--bg);
}

:root[data-theme="dark"] .wd-overlay{background:rgba(0,0,0,.62)}
:root[data-theme="dark"] .chip.eg{background:rgba(255,255,255,.08)}
:root[data-theme="dark"] .wd-extra .chip.eg,:root[data-theme="dark"] .wd-egs .chip.eg,:root[data-theme="dark"] .ex-item{background:#22292d}
:root[data-theme="dark"] .mbar{background:#283033}
:root[data-theme="dark"] .opt.correct .kbd, :root[data-theme="dark"] .opt.wrong .kbd{background:rgba(255,255,255,.16)}
}

html{color-scheme: light}
html[data-theme="dark"]{color-scheme: dark}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:Pretendard,-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-font-smoothing:antialiased; line-height:1.5;
  display:flex; flex-direction:column; min-height:100vh;
}
button{font-family:inherit; cursor:pointer; border:none; background:none; color:inherit}

/* ---- top bar ---- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:1rem clamp(1rem,4vw,2.5rem); flex-wrap:wrap;
  border-bottom:1px solid var(--line); background:var(--paper);
}
.brand{display:flex; align-items:center; gap:.85rem}
.logo{
  font-size:1.9rem; font-weight:800; letter-spacing:-.04em; color:var(--accent);
  background:var(--accent-soft); padding:.1em .35em; border-radius:12px; line-height:1;
}
.brand-text h1{font-size:1.05rem; font-weight:700; letter-spacing:-.01em}
.brand-text p{font-size:.78rem; color:var(--muted); margin-top:2px}
.head-controls{display:flex; align-items:center; gap:.9rem; flex-wrap:wrap}
.lang-toggle{display:inline-flex; border:1px solid var(--line); border-radius:999px; overflow:hidden; background:var(--paper)}
.lang-toggle button{font-size:.78rem; font-weight:700; color:var(--muted); padding:.4rem .7rem; transition:.15s}
.lang-toggle button.active{background:var(--ink); color:var(--paper)}
.theme-toggle{
  font-size:.78rem; font-weight:700; color:var(--muted); padding:.4rem .75rem;
  border:1px solid var(--line); border-radius:999px; background:var(--paper); transition:.15s;
}
.theme-toggle:hover{color:var(--ink); border-color:var(--blue)}
.day-picker,.deck-picker{display:flex; align-items:center; gap:.5rem; font-size:.85rem}
.day-picker label,.deck-picker label{color:var(--muted); font-weight:600}
#day,#deck{
  font-family:inherit; font-size:.9rem; font-weight:600; color:var(--ink);
  padding:.45rem .7rem; border:1px solid var(--line); border-radius:10px;
  background:var(--paper); cursor:pointer; max-width:11rem;
}
.deck-edit{
  font-size:.95rem; line-height:1; color:var(--muted); padding:.4rem .5rem;
  border:1px solid var(--line); border-radius:9px; background:var(--paper); cursor:pointer; transition:.15s;
}
.deck-edit:hover{color:var(--accent); border-color:var(--accent)}
.day-meta{color:var(--muted); font-size:.78rem}

/* ---- tabs ---- */
.tabs{
  display:flex; gap:.25rem; padding:.6rem clamp(1rem,4vw,2.5rem); flex-wrap:wrap;
  position:sticky; top:0; background:var(--bg); z-index:5; border-bottom:1px solid var(--line);
}
.tabs button{
  font-size:.85rem; font-weight:600; color:var(--muted);
  padding:.45rem .9rem; border-radius:999px; transition:.15s;
}
.tabs button:hover{color:var(--ink); background:var(--paper)}
.tabs button.active{color:var(--paper); background:var(--ink)}

/* ---- main ---- */
main{
  flex:1; width:100%; max-width:640px; margin:0 auto;
  padding:clamp(1.2rem,4vw,2.4rem) 1.2rem;
}

/* ---- flashcard ---- */
.deck-meta{display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; font-size:.82rem; color:var(--muted); gap:.8rem}
.flash-filter{
  font-size:.74rem; font-weight:700; color:var(--muted); padding:.3rem .7rem;
  border:1px solid var(--line); border-radius:999px; background:var(--paper); transition:.15s;
}
.flash-filter:hover{color:var(--ink); border-color:var(--blue)}
.deck-meta b{color:var(--ink)}
.card{
  position:relative; width:100%; aspect-ratio:3/2; perspective:1600px; cursor:pointer; user-select:none;
}
.card-inner{
  position:absolute; inset:0; transition:transform .5s cubic-bezier(.4,.2,.2,1);
  transform-style:preserve-3d;
}
.card.flipped .card-inner{transform:rotateY(180deg)}
.face{
  position:absolute; inset:0; backface-visibility:hidden;
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:1.5rem; text-align:center;
}
.face .tag{position:absolute; top:14px; left:16px; font-size:.7rem; font-weight:700; color:var(--muted); letter-spacing:.06em; text-transform:uppercase}
.face .num{position:absolute; top:14px; right:16px; font-size:.72rem; color:var(--muted); font-variant-numeric:tabular-nums}
.word{font-size:clamp(2.4rem,9vw,3.6rem); font-weight:800; letter-spacing:-.03em}
.hint{margin-top:.6rem; font-size:.8rem; color:var(--muted)}
.back{transform:rotateY(180deg); background:var(--blue); color:#f4f1ea; border-color:var(--blue)}
.back .meaning .m-uz{font-size:clamp(1.7rem,7vw,2.4rem); font-weight:800; letter-spacing:-.02em}
.back .meaning .m-en{font-size:clamp(1.1rem,4.5vw,1.4rem); font-weight:500; opacity:.78; margin-top:.3rem}
.back .extra{margin-top:.9rem; font-size:1.2rem; opacity:.92; line-height:1.9}
.chip{display:inline-block; font-size:.92rem; padding:.15em .6em; border-radius:999px; margin:.15em}
.extra .chip{font-size:1.08rem; padding:.22em .72em; margin:.2em}
.chip.syn{background:rgba(60,122,78,.25)} .chip.ant{background:rgba(178,58,46,.3)}
.chip.eg{background:rgba(255,255,255,.12)}
.eg-row{margin:.35em 0}
.eg-uz{display:block; font-size:.82em; color:var(--muted); margin:.15em 0 0 .3em; line-height:1.35}

/* ---- audio speaker button ---- */
.spk{
  display:inline-flex; align-items:center; justify-content:center;
  width:2.2em; height:2.2em; padding:0; font-size:1rem; line-height:1; cursor:pointer;
  background:var(--paper); color:var(--ink); border:1px solid var(--line);
  border-radius:50%; box-shadow:var(--shadow); transition:transform .1s, background .15s;
}
.spk:hover{background:var(--bg)} .spk:active{transform:scale(.92)}
.face .spk{margin-top:.7rem}

.controls{display:flex; gap:.6rem; margin-top:1.3rem}
.controls button{
  flex:1; padding:.85rem; border-radius:12px; font-weight:700; font-size:.9rem;
  border:1px solid var(--line); background:var(--paper); transition:.15s;
}
.controls .know{background:var(--good); color:#fff; border-color:var(--good)}
.controls .dunno{background:var(--paper); color:var(--accent)}
.controls button:hover{transform:translateY(-1px)}
.navrow{display:flex; justify-content:space-between; margin-top:.8rem; font-size:.85rem; color:var(--muted)}
.navrow button{padding:.4rem .8rem; border-radius:8px; font-weight:600}
.navrow button:hover{background:var(--paper); color:var(--ink)}

/* ---- quiz ---- */
.q-prompt{text-align:center; margin:1rem 0 1.6rem}
.q-prompt .lbl{font-size:.78rem; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:700}
.q-prompt .big{font-size:clamp(2rem,8vw,3rem); font-weight:800; letter-spacing:-.03em; margin-top:.4rem}
.q-prompt .big.en{font-size:clamp(1.4rem,6vw,2.1rem); font-weight:700}
.q-prompt .big.ex{font-size:clamp(1.3rem,5.5vw,1.9rem); font-weight:700; line-height:1.45; word-break:keep-all}
.options{display:grid; gap:.7rem}
.opt{
  display:flex; align-items:center; gap:.75rem; text-align:left; width:100%;
  padding:.85rem 1rem; border:1px solid var(--line); border-radius:12px;
  background:var(--paper); font-size:1.05rem; font-weight:600; transition:.12s; box-shadow:var(--shadow);
}
.opt .kbd{
  flex:none; width:1.6em; height:1.6em; display:grid; place-items:center;
  font-size:.78rem; font-weight:700; color:var(--muted);
  background:var(--bg); border:1px solid var(--line); border-radius:7px;
}
.opt .opt-label{flex:1}
.options.kor .opt-label{font-size:1.22rem}
.opt:hover{border-color:var(--blue)}
.opt:hover .kbd{border-color:var(--blue); color:var(--blue)}
.opt.correct .kbd, .opt.wrong .kbd{background:rgba(255,255,255,.25); color:inherit; border-color:transparent}
.opt.correct{background:var(--good); color:#fff; border-color:var(--good)}
.opt.wrong{background:var(--accent-soft); color:var(--accent); border-color:var(--accent)}
.opt:disabled{cursor:default}
.tip{font-size:.75rem; color:var(--muted); opacity:.7; text-align:center; display:block; margin-top:.6rem}
.q-foot .tip{margin-top:0}
.q-foot{display:flex; justify-content:space-between; align-items:center; margin-top:1.4rem; font-size:.85rem; color:var(--muted)}
.next-btn{padding:.7rem 1.3rem; border-radius:10px; background:var(--ink); color:var(--paper); font-weight:700}
.score b{color:var(--ink)}

/* ---- typing ---- */
.type-in{
  width:100%; font-family:inherit; font-size:1.6rem; font-weight:700; text-align:center;
  padding:1rem; border:1px solid var(--line); border-radius:12px; background:var(--paper); color:var(--ink);
  margin-top:1rem;
}
.type-in:focus{outline:none; border-color:var(--blue)}
.type-in.ok{border-color:var(--good); background:rgba(60,122,78,.08)}
.type-in.no{border-color:var(--accent); background:var(--accent-soft)}
.reveal{text-align:center; margin-top:1rem; font-size:1.1rem; min-height:1.6em}
.reveal .ans{font-weight:800; color:var(--blue)}
.reveal .sent-full{margin-top:.5rem; font-size:.95rem; font-weight:500; color:var(--muted); line-height:1.5; word-break:keep-all}

/* ---- sentences (cloze typing test) ---- */
.sent-head{display:flex; justify-content:space-between; align-items:center;
  font-size:.85rem; color:var(--muted); margin-bottom:1rem}
.sent-head .sent-count{font-weight:700; color:var(--ink)}

/* ---- list ---- */
.list{display:flex; flex-direction:column; gap:.3rem}
.list-search{margin-bottom:.7rem}
.list-q{
  width:100%; box-sizing:border-box; padding:.6rem .9rem; font-size:1rem;
  background:var(--paper); color:var(--ink); border:1px solid var(--line); border-radius:10px;
}
.list-q:focus{outline:none; border-color:var(--blue)}
.row{
  display:grid; grid-template-columns:auto auto 1fr auto auto; gap:.8rem; align-items:center;
  padding:.7rem .9rem; background:var(--paper); border:1px solid var(--line); border-radius:10px;
}
.row-spk{width:1.9em; height:1.9em; font-size:.8rem; box-shadow:none}
.row-spk-empty{width:1.9em}
.row .n{font-size:.75rem; color:var(--muted); font-variant-numeric:tabular-nums; width:2.5em}
.row .kw{font-size:1.15rem; font-weight:700}
.row .mn{color:var(--muted); font-size:.9rem; justify-self:start}
.row .mark{font-size:.9rem}
.row{cursor:pointer; transition:border-color .15s, background .15s}
.row:hover{border-color:var(--blue)}

/* ---- word-detail card (from list tap) ---- */
.wd-overlay{
  position:fixed; inset:0; z-index:50; display:flex; align-items:center; justify-content:center;
  padding:1.2rem; background:rgba(40,33,20,.45); backdrop-filter:blur(2px);
  animation:wd-fade .15s ease-out;
}
@keyframes wd-fade{from{opacity:0}to{opacity:1}}
.wd-card{
  position:relative; width:100%; max-width:440px; max-height:85vh; overflow-y:auto;
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:1.6rem 1.4rem 1.4rem; text-align:center;
}
.wd-close{
  position:absolute; top:.7rem; right:.7rem; width:2em; height:2em; padding:0;
  font-size:1rem; line-height:1; cursor:pointer; color:var(--muted);
  background:transparent; border:none; border-radius:50%;
}
.wd-close:hover{background:var(--bg); color:var(--ink)}
.wd-head{display:flex; justify-content:center; gap:.6rem; font-size:.74rem; color:var(--muted); font-variant-numeric:tabular-nums}
.wd-word-row{display:flex; align-items:center; justify-content:center; gap:.6rem; margin:.5rem 0 .2rem}
.wd-word{font-size:clamp(2rem,8vw,3rem); font-weight:800; letter-spacing:-.03em}
.wd-mean .m-uz{font-size:1.4rem; font-weight:700; margin-top:.3rem}
.wd-mean .m-en{font-size:1.05rem; font-weight:500; color:var(--muted); margin-top:.2rem}
.wd-extra{margin-top:1rem; font-size:1.2rem; line-height:1.9; text-align:left}
.wd-extra .chip.eg{background:var(--bg)}
.sa-grp{margin-top:.9rem}
.sa-lbl{font-size:.74rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); margin-bottom:.35rem}
.sa-row{display:flex; align-items:baseline; gap:.5rem; margin:.25em 0; flex-wrap:wrap}
.sa-uz{font-size:.95rem; color:var(--muted); line-height:1.35}
.wd-egs{margin-top:1.1rem; text-align:left}
.wd-egs .chip.eg{background:var(--bg); font-size:1.05rem}
.wd-sents{margin-top:1.1rem; text-align:left}
.wd-ex-h{font-size:.74rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); margin-bottom:.5rem}
.ex-item{padding:.6rem .8rem; margin-bottom:.5rem; background:var(--bg); border-radius:10px}
.ex-ko{font-size:1.12rem; font-weight:600; line-height:1.5}
.ex-tr{font-size:1rem; color:var(--muted); margin-top:.25rem; line-height:1.45}

/* ---- learn: mastery bar ---- */
.mbar-wrap{margin-bottom:1.4rem}
.mbar{display:flex; height:10px; border-radius:999px; overflow:hidden; background:var(--line); gap:2px}
.mbar .seg{transition:flex .4s}
.seg.m2{background:var(--good)} .seg.m3{background:#8cc63f} .seg.m1{background:var(--gold)} .seg.m0{background:#cfc8b8}
.legend{display:flex; gap:1rem; margin-top:.55rem; font-size:.74rem; color:var(--muted); flex-wrap:wrap}
.legend span{display:flex; align-items:center; gap:.35em}
.legend .d{width:9px; height:9px; border-radius:50%; display:inline-block}
.d.m2{background:var(--good)} .d.m3{background:#8cc63f} .d.m1{background:var(--gold)} .d.m0{background:#cfc8b8}

/* ---- completion / checkpoint card ---- */
.done-card{
  text-align:center; background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:2.2rem 1.4rem; margin-top:1rem;
}
.done-emoji{font-size:2.6rem; line-height:1}
.done-card h2{font-size:1.4rem; margin:.5rem 0 .3rem; letter-spacing:-.02em}
.done-card p{color:var(--muted); font-size:.92rem}
.done-card .controls{margin-top:1.4rem}
.link-btn{color:var(--muted); font-weight:600; font-size:.85rem; text-decoration:underline; text-underline-offset:3px}
.link-btn:hover{color:var(--accent)}

/* ---- match intro ---- */
.match-stats{
  max-width:280px; margin:1rem auto 0; display:flex; flex-direction:column; gap:.4rem;
  text-align:left;
}
.done-card .hint{margin-top:.8rem}

/* ---- match game ---- */
.match-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem}
.match-head .timer{font-variant-numeric:tabular-nums; font-weight:800; font-size:1.1rem; color:var(--blue)}
.match-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:.6rem}
.tile{
  aspect-ratio:5/4; display:flex; align-items:center; justify-content:center; text-align:center;
  padding:.5rem; border:1px solid var(--line); border-radius:12px; background:var(--paper);
  font-weight:700; font-size:1rem; line-height:1.25; box-shadow:var(--shadow); transition:.13s;
}
.tile.k{font-size:1.25rem}
.tile.e{color:var(--blue); font-size:.92rem; font-weight:600}
.tile:hover{border-color:var(--blue)}
.tile.sel{background:var(--blue); color:#f4f1ea; border-color:var(--blue); transform:translateY(-2px)}
.tile.miss{background:var(--accent-soft); border-color:var(--accent); color:var(--accent)}
.tile.gone{opacity:0; pointer-events:none; transform:scale(.85)}
@media(max-width:480px){ .tile{font-size:.9rem} .tile.k{font-size:1.05rem} }

/* ---- account ---- */
.account{position:relative; display:flex; align-items:center}
.signin-btn{
  font-size:.8rem; font-weight:700; padding:.45rem .9rem; border-radius:999px;
  background:var(--ink); color:var(--paper); transition:.15s;
}
.signin-btn:hover{background:var(--blue)}
.avatar{
  width:2.1rem; height:2.1rem; border-radius:50%; display:grid; place-items:center;
  background:var(--blue); color:#f4f1ea; font-weight:800; font-size:.95rem;
}
.acct-dd{
  display:none; position:absolute; top:calc(100% + .5rem); right:0; z-index:20;
  min-width:200px; background:var(--paper); border:1px solid var(--line); border-radius:12px;
  box-shadow:var(--shadow); padding:.8rem; font-size:.82rem;
}
.acct-dd.open{display:block}
.acct-email{font-weight:700; word-break:break-all}
.acct-sync{display:flex; align-items:center; gap:.4em; color:var(--muted); margin:.5rem 0}
.acct-sync .dot{width:8px; height:8px; border-radius:50%; display:inline-block; background:var(--line)}
.acct-sync .dot.synced{background:var(--good)}
.acct-sync .dot.pending{background:var(--gold)}
.acct-sync .dot.error{background:var(--bad)}
.acct-out{
  width:100%; padding:.5rem; border-radius:8px; font-weight:700;
  border:1px solid var(--line); color:var(--accent); transition:.15s;
}
.acct-out:hover{background:var(--accent-soft)}

/* ---- home ---- */
.home-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:.8rem}
.home-card{
  text-align:left; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:1.1rem 1.2rem;
  transition:.15s; display:flex; flex-direction:column; gap:.3rem;
}
.home-card:hover{border-color:var(--blue); transform:translateY(-2px)}
.home-card.review{grid-column:1/-1; border-color:var(--gold); background:rgba(200,155,60,.1)}
.hc-head{display:flex; justify-content:space-between; align-items:baseline; gap:.6rem}
.hc-title{font-size:1.05rem; font-weight:800; letter-spacing:-.01em}
.hc-stat{font-size:.74rem; font-weight:700; color:var(--good); font-variant-numeric:tabular-nums; white-space:nowrap}
.hc-desc{font-size:.8rem; color:var(--muted); line-height:1.4}
@media(max-width:380px){ .home-grid{grid-template-columns:1fr} }

/* ---- difficulty tier picker ---- */
.tier-picker{display:flex; flex-direction:column; gap:.8rem; max-width:520px; margin:0 auto}
.tier-title{font-size:1.3rem; font-weight:800; letter-spacing:-.02em; text-align:center; margin:.4rem 0 0}
.tier-hint{font-size:.85rem; color:var(--muted); text-align:center; margin:0 0 .4rem; line-height:1.4}
.tier-card{
  text-align:left; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:1.1rem 1.2rem;
  transition:.15s; display:grid; grid-template-columns:1fr auto; gap:.25rem .6rem; align-items:baseline; cursor:pointer;
}
.tier-card:hover{transform:translateY(-2px)}
.tier-card.tier-easy:hover{border-color:var(--good)}
.tier-card.tier-medium:hover{border-color:var(--gold)}
.tier-card.tier-hard:hover{border-color:var(--accent)}
.tier-name{font-size:1.1rem; font-weight:800; letter-spacing:-.01em}
.tier-easy .tier-name{color:var(--good)}
.tier-medium .tier-name{color:var(--gold)}
.tier-hard .tier-name{color:var(--accent)}
.tier-desc{grid-column:1/-1; font-size:.82rem; color:var(--muted); line-height:1.4}
.tier-prog{font-size:.78rem; font-weight:700; color:var(--good); font-variant-numeric:tabular-nums; white-space:nowrap}
.tier-chip{
  display:inline-flex; align-items:center; gap:.3em; margin-bottom:.9rem; padding:.3rem .8rem;
  border-radius:999px; border:1px solid var(--line); background:var(--paper);
  color:var(--muted); font-weight:700; font-size:.78rem; transition:.15s; cursor:pointer;
}
.tier-chip::before{content:'⚙'; font-size:.85em}
.tier-chip:hover{border-color:var(--blue); color:var(--ink)}

/* ---- ladder builder ---- */
.ladder-picker{display:flex; flex-direction:column; gap:.7rem; max-width:520px; margin:0 auto}
.ladder-presets{display:flex; gap:.5rem; justify-content:center; flex-wrap:wrap}
.preset-btn{
  padding:.4rem .9rem; border-radius:999px; border:1px solid var(--line); background:var(--paper);
  color:var(--ink); font-weight:700; font-size:.85rem; cursor:pointer; transition:.15s;
}
.preset-btn:hover{border-color:var(--blue)}
.ladder-steps{display:flex; flex-direction:column; gap:.5rem}
.ladder-step{
  display:flex; align-items:center; gap:.5rem; background:var(--paper);
  border:1px solid var(--line); border-radius:12px; padding:.5rem .6rem;
}
.step-num{width:1.4rem; text-align:center; font-weight:800; color:var(--muted); font-variant-numeric:tabular-nums}
.step-sel{
  flex:1; min-width:0; padding:.45rem .5rem; border-radius:8px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); font-size:.95rem; font-weight:600;
}
.step-mini{
  width:2rem; height:2rem; flex:none; border-radius:8px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); font-size:1rem; cursor:pointer; transition:.15s;
}
.step-mini:hover:not(:disabled){border-color:var(--blue)}
.step-mini:disabled{opacity:.3; cursor:default}
.step-mini.danger:hover:not(:disabled){border-color:var(--bad); color:var(--bad)}
.ladder-add{
  align-self:center; padding:.45rem 1rem; border-radius:999px; border:1px dashed var(--line);
  background:transparent; color:var(--muted); font-weight:700; font-size:.85rem; cursor:pointer; transition:.15s;
}
.ladder-add:hover{border-color:var(--blue); color:var(--ink)}
.ladder-master{text-align:center; font-weight:800; color:var(--good); font-size:.95rem}
.fail-picker{margin-top:.3rem}
.fail-lbl{font-size:.8rem; color:var(--muted); font-weight:700; text-align:center; margin-bottom:.4rem}
.fail-opts{display:flex; gap:.4rem; justify-content:center; flex-wrap:wrap}
.fail-opt{
  padding:.4rem .8rem; border-radius:999px; border:1px solid var(--line); background:var(--paper);
  color:var(--muted); font-weight:700; font-size:.82rem; cursor:pointer; transition:.15s;
}
.fail-opt.on{border-color:var(--blue); color:var(--ink); background:rgba(60,120,200,.1)}
.ladder-start{
  margin-top:.6rem; padding:.75rem 1rem; border-radius:12px; border:none;
  background:var(--accent); color:#fff; font-weight:800; font-size:1rem; cursor:pointer; transition:.15s;
}
.ladder-start:hover{filter:brightness(1.05)}
/* flip step */
.flip-word{display:flex; align-items:center; justify-content:center; gap:.5rem}
.flip-mean{text-align:center; color:var(--muted); font-size:1.15rem; margin-top:.3rem; line-height:1.4}

/* ---- review pill ---- */
.review-pill{
  display:block; width:100%; margin-bottom:1rem; padding:.6rem 1rem;
  border-radius:12px; border:1px solid var(--gold); background:rgba(200,155,60,.12);
  color:var(--ink); font-weight:700; font-size:.88rem; transition:.15s; text-align:center;
}
.review-pill:hover{background:rgba(200,155,60,.25)}

/* ---- stats ---- */
.stat-hero{display:flex; gap:1rem; margin-bottom:1.4rem; flex-wrap:wrap}
.stat-big{
  flex:0 0 auto; min-width:7.5rem; text-align:center; background:var(--paper);
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:1.2rem 1.4rem; display:flex; flex-direction:column; justify-content:center;
}
.stat-num{font-size:2.6rem; font-weight:800; letter-spacing:-.04em; color:var(--accent); line-height:1.1}
.stat-lbl{font-size:.78rem; color:var(--muted); font-weight:600}
.stat-totals{
  flex:1; min-width:200px; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:1rem 1.2rem;
  display:flex; flex-direction:column; gap:.45rem; justify-content:center;
}
.stat-line{display:flex; justify-content:space-between; font-size:.88rem}
.stat-line-lbl{color:var(--muted); font-weight:600}
.stat-line-val{font-weight:800}
.stat-totals .review-pill{margin:.4rem 0 0}
.stat-table{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:.6rem 1.1rem; margin-bottom:1.4rem;
}
.stat-row{display:grid; grid-template-columns:1fr auto auto; gap:1.2rem; padding:.45rem 0; font-size:.88rem; border-bottom:1px solid var(--line)}
.stat-row:last-child{border-bottom:none}
.stat-row span:nth-child(2),.stat-row span:nth-child(3){font-variant-numeric:tabular-nums; min-width:3.5em; text-align:right; font-weight:700}
.stat-row.head{font-size:.74rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:700}
.stat-row.head span{font-weight:700}
.stat-grid-title{font-size:.78rem; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:700; margin-bottom:.6rem}
.stat-grid{display:grid; grid-template-columns:repeat(10,1fr); gap:.35rem}
.day-cell{
  position:relative; aspect-ratio:1; border:1px solid var(--line); border-radius:8px;
  font-size:.78rem; font-weight:700; color:var(--ink); overflow:hidden; transition:.13s;
}
.day-cell:hover{border-color:var(--blue); transform:translateY(-1px)}
.syn-sub{position:absolute; left:0; bottom:0; height:3px; background:var(--gold); display:block}
.done-dot{position:absolute; top:4px; right:4px; width:5px; height:5px; border-radius:50%; background:var(--gold)}
.day-done-count{font-size:.78rem; color:var(--gold); font-weight:700; margin-top:.3rem}
.day2-note{font-size:.74rem; color:var(--muted); margin-top:1rem; text-align:center}
@media(max-width:480px){ .stat-grid{grid-template-columns:repeat(5,1fr)} }

/* ---- update toast ---- */
.update-toast{
  position:fixed; bottom:1.2rem; left:50%; transform:translateX(-50%); z-index:50;
  background:var(--ink); color:var(--paper); font-weight:700; font-size:.85rem;
  padding:.7rem 1.2rem; border-radius:999px; box-shadow:var(--shadow);
}
.update-toast:hover{background:var(--blue)}

/* ---- empty / misc ---- */
.empty{text-align:center; color:var(--muted); padding:3rem 1rem; font-size:.95rem}
.foot{
  display:flex; justify-content:space-between; padding:.9rem clamp(1rem,4vw,2.5rem);
  border-top:1px solid var(--line); font-size:.75rem; color:var(--muted); background:var(--paper);
}
.foot .src{opacity:.7}
@media(max-width:480px){
  .brand-text h1{font-size:.95rem}
  .controls button{padding:.75rem; font-size:.85rem}
}

/* ---- deck editor ---- */
.editor{max-width:640px; margin:0 auto}
.ed-top{display:flex; gap:.6rem; align-items:center; margin-bottom:.9rem}
.ed-name{
  flex:1; font-family:inherit; font-size:1.05rem; font-weight:700; color:var(--ink);
  padding:.55rem .8rem; border:1px solid var(--line); border-radius:11px; background:var(--paper);
}
.ed-done{
  padding:.55rem 1.1rem; border-radius:10px; background:var(--ink); color:var(--paper);
  font-weight:700; font-size:.85rem; white-space:nowrap;
}
.ed-hint{
  font-size:.8rem; color:var(--muted); background:var(--accent-soft); border:1px solid var(--line);
  padding:.6rem .8rem; border-radius:10px; margin-bottom:.9rem;
}
.ed-form{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:1rem; box-shadow:var(--shadow); margin-bottom:1.2rem;
}
.ed-grid{display:grid; grid-template-columns:1fr 1fr; gap:.7rem}
.ed-field{display:flex; flex-direction:column; gap:.3rem}
.ed-field.wide{margin-top:.7rem}
.ed-lbl{font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:700}
.ed-field input,.ed-field textarea{
  font-family:inherit; font-size:.92rem; color:var(--ink);
  padding:.6rem .7rem; border:1px solid var(--line); border-radius:10px; background:var(--bg); width:100%;
}
.ed-field textarea{resize:vertical; line-height:1.4}
.ed-field input:focus,.ed-field textarea:focus,.ed-name:focus{outline:none; border-color:var(--blue); background:var(--paper)}
.ed-actions{display:flex; gap:.6rem; margin-top:.9rem}
.ed-save{padding:.65rem 1.2rem; border-radius:10px; background:var(--good); color:#fff; font-weight:700; font-size:.88rem}
.ed-cancel{padding:.65rem 1.1rem; border-radius:10px; background:var(--paper); color:var(--muted); border:1px solid var(--line); font-weight:600; font-size:.88rem}
.ed-listhead{font-size:.8rem; color:var(--muted); font-weight:700; margin-bottom:.5rem}
.ed-day{font-size:.74rem; font-weight:800; color:var(--blue); text-transform:uppercase; letter-spacing:.05em; margin:.8rem 0 .35rem}
.ed-row{
  display:grid; grid-template-columns:1fr 1.3fr auto auto; align-items:center; gap:.6rem;
  padding:.55rem .7rem; background:var(--paper); border:1px solid var(--line); border-radius:10px; margin-bottom:.4rem;
}
.ed-row.active{border-color:var(--blue); background:var(--accent-soft)}
.ed-row .kw{font-weight:700; color:var(--ink)}
.ed-row .mn{color:var(--muted); font-size:.88rem}
.ed-mini{
  font-size:.85rem; padding:.3rem .5rem; border-radius:8px; border:1px solid var(--line);
  background:var(--bg); color:var(--muted); cursor:pointer; transition:.15s;
}
.ed-mini:hover{color:var(--ink); border-color:var(--blue)}
.ed-mini.del:hover{color:var(--bad); border-color:var(--bad)}
.ed-delete-deck{
  display:block; margin:1.6rem auto 0; font-size:.8rem; font-weight:600; color:var(--bad);
  padding:.5rem 1rem; border:1px solid var(--line); border-radius:9px; background:var(--paper); transition:.15s;
}
.ed-delete-deck:hover{background:var(--accent-soft); border-color:var(--bad)}
@media (max-width:520px){
  .ed-grid{grid-template-columns:1fr}
  .ed-row{grid-template-columns:1fr 1fr auto auto}
}

/* ---- extra built-in decks: usage notes, speech register, sentence audio, named topics ---- */
.w-note{
  margin:.5rem auto 0; max-width:34rem; padding:.45rem .7rem; text-align:left;
  font-size:.85rem; font-weight:500; line-height:1.45; color:var(--muted);
  background:var(--bg); border-left:3px solid var(--gold); border-radius:0 8px 8px 0;
  word-break:keep-all; overflow-wrap:anywhere;
}
.reveal .w-note{margin-top:.7rem}
.row .mn .w-note{margin:.3rem 0 0; padding:.2rem .5rem; font-size:.78rem}
.back .w-note{background:rgba(255,255,255,.1); color:inherit; opacity:.9; margin-top:.7rem; font-size:.8rem}
.wd-note{margin-top:1rem; text-align:left}
.wd-note .w-note{margin:0; max-width:none; font-size:.92rem}
.reg{
  display:inline-block; vertical-align:middle; margin-left:.45em; padding:.08em .5em;
  font-size:.68rem; font-weight:700; letter-spacing:.02em; white-space:nowrap;
  color:var(--blue); border:1px solid var(--line); border-radius:999px; background:var(--paper);
}
.ex-tags{white-space:nowrap}
.ex-spk,.sent-spk{width:1.8em; height:1.8em; font-size:.75rem; margin-left:.45em; vertical-align:middle; box-shadow:none}
.stat-grid.named{grid-template-columns:repeat(auto-fill,minmax(7.2rem,1fr))}
.stat-grid.named .day-cell{aspect-ratio:auto; min-height:3.6rem; padding:.4rem .3rem; font-size:.85rem; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.15rem}
.day-cell-n{font-size:.7rem; font-weight:600; opacity:.75; font-variant-numeric:tabular-nums}
@media(max-width:480px){ .stat-grid.named{grid-template-columns:repeat(2,1fr)} }
/* flashcards of phrase decks: room for long meanings and the note */
.card.wordy{aspect-ratio:4/3}
.card.wordy .face{overflow-y:auto; justify-content:safe center; padding-top:2.6rem}
.card.wordy .back .meaning .m-uz{font-size:clamp(1.3rem,5.5vw,1.9rem)}
.card.wordy .back .meaning .m-en{font-size:clamp(1rem,4vw,1.2rem)}
@media(max-width:480px){ .card.wordy{aspect-ratio:1/1} }
@media(max-width:640px){
  .list.wordy .row{grid-template-columns:auto 1fr auto auto; grid-template-areas:"n kw spk mk" "n mn spk mk"; row-gap:.25rem}
  .list.wordy .row .n{grid-area:n} .list.wordy .row .kw{grid-area:kw; word-break:keep-all}
  .list.wordy .row .mn{grid-area:mn} .list.wordy .row .row-spk{grid-area:spk} .list.wordy .row .mark{grid-area:mk}
}
.match-grid.wordy{grid-template-columns:repeat(3,minmax(0,1fr))}
.match-grid.wordy .tile{word-break:keep-all; overflow-wrap:anywhere}
@media(max-width:480px){ .match-grid.wordy .tile{font-size:.82rem} .match-grid.wordy .tile.k{font-size:.95rem} }
.home-card.review.other{border-color:var(--line); border-style:dashed; background:var(--paper); padding:.75rem 1.2rem; flex-direction:row; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:.2rem .8rem}
.home-card.review.other .hc-title{font-size:.92rem}
.home-card.review.other .hc-desc{font-size:.78rem; color:var(--blue); font-weight:600}
.deck-toast{width:max-content; max-width:calc(100% - 2rem); text-align:center; border-radius:14px; word-break:keep-all}
