/* Lavender, cute, with a Kuromi-style midnight mode */
:root{
  --bg:#f5effe; --surface:#ffffff; --surface-2:#f1e9ff; --surface-3:#e4d6fb;
  --ink:#2b1d47; --muted:#5f4f80; --line:#e6dbf7;
  --accent:#6d3fc0; --accent-ink:#ffffff; --accent-soft:#ede3ff;
  --brass:#a3316b; --brass-soft:#fde7f2;
  --good:#1f7a52; --good-soft:#e1f5ea;
  --bad:#c0264b; --bad-soft:#fde6ec;
  --mid:#94570a; --mid-soft:#fdf0d9;
  --mark:#b0328a; --mark-soft:#fbe3f3;
  --hero-a:#7c4dd6; --hero-b:#5b30a8; --hero-ink:#ffffff;
  --dots:rgba(109,63,192,.11); --lift:rgba(60,30,110,.16);
  --bg-grad:linear-gradient(180deg, #f8f3ff 0%, #f1e8ff 55%, #ece0ff 100%);
  --radius:22px; --radius-sm:14px;
  --shadow:0 1px 2px rgba(80,40,140,.06), 0 10px 28px rgba(60,30,110,.09);
  --ui:'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display:'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif;
  --read:'Nunito', ui-rounded, system-ui, -apple-system, sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#140f1f; --surface:#1d1630; --surface-2:#271e40; --surface-3:#372b57;
    --ink:#f3edff; --muted:#b9abd8; --line:#342851;
    --accent:#c3a5ff; --accent-ink:#1a1030; --accent-soft:#2c2050;
    --brass:#ff9fd0; --brass-soft:#3b1a31;
    --good:#6fd6a0; --good-soft:#14291f;
    --bad:#ff8fa8; --bad-soft:#3a1624;
    --mid:#f2c46b; --mid-soft:#33270f;
    --mark:#f59fe0; --mark-soft:#3a1838;
    --hero-a:#3b2a66; --hero-b:#24183f; --hero-ink:#f3edff;
    --dots:rgba(195,165,255,.07); --lift:rgba(0,0,0,.45);
    --bg-grad:linear-gradient(180deg, #171126 0%, #140f1f 60%, #120d1c 100%);
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.3);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#140f1f; --surface:#1d1630; --surface-2:#271e40; --surface-3:#372b57;
  --ink:#f3edff; --muted:#b9abd8; --line:#342851;
  --accent:#c3a5ff; --accent-ink:#1a1030; --accent-soft:#2c2050;
  --brass:#ff9fd0; --brass-soft:#3b1a31;
  --good:#6fd6a0; --good-soft:#14291f;
  --bad:#ff8fa8; --bad-soft:#3a1624;
  --mid:#f2c46b; --mid-soft:#33270f;
  --mark:#f59fe0; --mark-soft:#3a1838;
  --hero-a:#3b2a66; --hero-b:#24183f; --hero-ink:#f3edff;
  --dots:rgba(195,165,255,.07); --lift:rgba(0,0,0,.45);
  --bg-grad:linear-gradient(180deg, #171126 0%, #140f1f 60%, #120d1c 100%);
  --shadow:0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.3);
  color-scheme:dark;
}

*{box-sizing:border-box}
[hidden]{display:none !important}
html{-webkit-text-size-adjust:100%}
body{margin:0; background:var(--bg); color:var(--ink); font-family:var(--ui); font-size:16px; line-height:1.5}
a{color:var(--accent)}
button{font:inherit; color:inherit}
h1,h2,h3{line-height:1.2; margin:0}
h1{text-wrap:balance}
:focus-visible{outline:3px solid var(--accent); outline-offset:2px; border-radius:6px}

/* ---------- top bar ---------- */
.topbar{position:sticky; top:0; z-index:20; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); border-bottom:1px solid var(--line)}
.topbar-in{max-width:1120px; margin:0 auto; padding:10px 16px; display:flex; align-items:center; gap:18px}
.brand{display:flex; align-items:center; gap:10px; font-weight:700; color:var(--ink); text-decoration:none; white-space:nowrap; letter-spacing:-.01em}
.brand-mark{display:grid; place-items:center; width:30px; height:30px; border-radius:9px; background:var(--accent); color:var(--accent-ink); font-family:var(--read); font-weight:600}
/* every tab stays visible: the nav wraps onto a second line instead of scrolling sideways */
.nav{display:flex; flex-wrap:wrap; gap:4px; flex:1; min-width:0}
.nav a{padding:8px 12px; border-radius:999px; text-decoration:none; color:var(--muted); font-weight:600; font-size:15px; white-space:nowrap}
.nav a.active{color:var(--accent); background:var(--accent-soft)}
.nav a:focus-visible{outline-offset:-3px}
.theme-btn{border:1px solid var(--line); background:var(--surface); width:36px; height:36px; border-radius:999px; cursor:pointer; flex:none}
/* English / GS subject switch */
.mode-switch{display:inline-flex; flex:none; padding:3px; gap:2px; border:1px solid var(--line); border-radius:999px; background:var(--surface)}
.mode-switch button{border:0; background:transparent; padding:6px 12px; border-radius:999px; font-weight:700; font-size:14px; color:var(--muted); cursor:pointer; white-space:nowrap}
.mode-switch button.active{background:var(--accent); color:var(--accent-ink)}
/* difficulty level picker + level chips */
.level-row{display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:0 0 16px}
.level-pick{display:flex; flex-wrap:wrap; gap:6px}
.level-pick button{display:inline-flex; align-items:center; gap:4px; border:1.5px solid var(--line); background:var(--surface); color:var(--ink); border-radius:999px; padding:6px 12px; font-weight:700; font-size:14px; cursor:pointer}
.level-pick button .n{font-size:12px; font-weight:700; color:var(--muted); margin-left:4px; font-variant-numeric:tabular-nums}
.level-pick button.active{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.level-pick button.active .n{color:inherit; opacity:.85}
.level-pick button:disabled{opacity:.45; cursor:not-allowed}
@media (hover:hover){ .level-pick button:not(:disabled):not(.active):hover{border-color:var(--accent)} }
.lv-mix{display:flex; gap:12px; margin:0 0 10px}
.chip.lv-beginner{background:var(--good-soft); color:var(--good)}
.chip.lv-moderate{background:var(--accent-soft); color:var(--accent)}
.chip.lv-achiever{background:var(--brass-soft); color:var(--brass)}
/* no subject switching mid-quiz, mid-review or mid-game */
body.focus .mode-switch{visibility:hidden}
/* brand + switch + seven tabs never fit the 1120px bar in one row, so the tabs always get their own row */
.topbar-in{flex-wrap:wrap; gap:8px 12px}
.brand{order:1}
.mode-switch{order:2; margin-left:auto}
.theme-btn{order:3}
.nav{order:4; flex-basis:100%}
@media (max-width:820px){ .nav a .e{display:none} }
@media (max-width:640px){
  .nav{gap:2px 4px}
  .nav a{padding:6px 9px; font-size:14px}
  .nav a .long{display:none}
}
@media (max-width:380px){ .brand span:last-child{display:none} }
@media (hover:hover){
  .nav a:hover{color:var(--ink); background:var(--surface-2)}
  .mode-switch button:hover{color:var(--ink)}
}

.container{max-width:1120px; margin:0 auto; padding:28px 16px 80px; outline:none}

/* ---------- primitives ---------- */
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px}
.eyebrow{margin:0 0 8px; font-size:13px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted)}
.lede{color:var(--muted); font-size:17px; max-width:60ch; margin:10px 0 0}
.muted{color:var(--muted)}
.small{font-size:14px}
.row{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.spacer{flex:1}
.stack > * + *{margin-top:14px}
.page-head{display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; margin-bottom:22px}
.page-head h1{font-size:clamp(26px, 4vw, 34px); letter-spacing:-.02em}
.section-h{font-size:19px; margin:34px 0 12px; letter-spacing:-.01em}

.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; border-radius:10px; border:1px solid var(--line); background:var(--surface); color:var(--ink); font-weight:600; text-decoration:none; cursor:pointer; transition:background .15s, border-color .15s, transform .1s; min-height:42px}
@media (hover:hover){ .btn:hover{background:var(--surface-2)} }
.btn:active{transform:translateY(1px)}
.btn.primary{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.btn.primary:hover{filter:brightness(1.08); background:var(--accent)}
.btn.ghost{background:transparent}
.btn.small{padding:6px 12px; min-height:34px; font-size:14px}
.btn.block{width:100%}
.btn[disabled]{opacity:.5; cursor:not-allowed}
.btn.on{background:var(--mark-soft); border-color:var(--mark); color:var(--mark)}

.chip{display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; font-size:13px; font-weight:600; background:var(--surface-2); color:var(--muted); border:1px solid transparent; white-space:nowrap}
.chip.good{background:var(--good-soft); color:var(--good)}
.chip.bad{background:var(--bad-soft); color:var(--bad)}
.chip.mid{background:var(--mid-soft); color:var(--mid)}
.chip.brass{background:var(--brass-soft); color:var(--brass)}
.chip.accent{background:var(--accent-soft); color:var(--accent)}
.chip.mark{background:var(--mark-soft); color:var(--mark)}
a.chip{text-decoration:none}

.bar{height:8px; border-radius:999px; background:var(--surface-3); overflow:hidden}
.bar > i{display:block; height:100%; border-radius:inherit; background:var(--accent); transition:width .4s ease}
.bar.good > i{background:var(--good)} .bar.bad > i{background:var(--bad)} .bar.mid > i{background:var(--mid)}

.grid{display:grid; gap:16px}
.grid > *{min-width:0}
.g2{grid-template-columns:repeat(auto-fit, minmax(min(100%, 320px), 1fr))}
.g3{grid-template-columns:repeat(auto-fit, minmax(min(100%, 260px), 1fr))}
.g4{grid-template-columns:repeat(4, minmax(0, 1fr))}
@media (max-width:900px){ .g4{grid-template-columns:repeat(2, minmax(0, 1fr))} }
@media (max-width:340px){ .g4{grid-template-columns:minmax(0, 1fr)} }
@media (max-width:640px){ .quick{padding:14px} .quick p{font-size:13px} }
@media (max-width:420px){ .g2,.g3{grid-template-columns:minmax(0, 1fr)} }

.tile{padding:16px 18px}
.tile .k{font-size:13px; color:var(--muted); font-weight:600}
.tile .v{font-size:30px; font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; margin-top:2px}
.tile .s{font-size:13px; color:var(--muted)}

.empty{text-align:center; padding:48px 20px}
.empty h2{font-size:22px; margin-bottom:8px}

/* ---------- home ---------- */
.hero{display:grid; grid-template-columns:1.5fr 1fr; gap:20px; align-items:stretch; margin-bottom:22px}
.hero h1{font-size:clamp(30px, 5vw, 46px); letter-spacing:-.03em; max-width:18ch}
.hero .row{margin-top:20px}
@media (max-width:820px){ .hero{grid-template-columns:1fr} }
.wotd{background:var(--accent); color:var(--accent-ink); border:0; display:flex; flex-direction:column}
.wotd .eyebrow{color:inherit; opacity:.8}
.wotd .w{font-family:var(--read); font-size:34px; font-weight:600; letter-spacing:-.01em}
.wotd .pos{opacity:.8; font-style:italic; margin-left:6px; font-size:16px}
.wotd p{margin:8px 0 0}
.wotd .ex{font-family:var(--read); font-style:italic; opacity:.9}
.wotd .mt-auto{margin-top:auto; padding-top:14px}
.wotd .chip{background:rgba(255,255,255,.16); color:inherit}
.resume{display:flex; flex-wrap:wrap; align-items:center; gap:12px; border-color:var(--mark); background:var(--mark-soft); margin-bottom:20px}
.resume b{color:var(--mark)}
.topic-chips{display:flex; flex-wrap:wrap; gap:8px; margin-top:10px}
.spark{display:block; width:100%; height:56px}
.recent-list{list-style:none; margin:12px 0 0; padding:0}
.recent-list li{display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--line)}
.recent-list li:first-child{border-top:0}
.recent-list .t{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600}
.quick{display:flex; flex-direction:column; gap:6px; text-decoration:none; color:var(--ink); transition:transform .15s, border-color .15s}
@media (hover:hover){ .quick:hover{transform:translateY(-2px); border-color:var(--accent)} }
.quick .ic{font-size:22px}
.quick h3{font-size:17px}
.quick p{margin:0; color:var(--muted); font-size:14px}

/* ---------- quizzes list ---------- */
.sec-card{display:flex; flex-direction:column; gap:12px}
.sec-card h3{font-size:18px}
.sec-card p{margin:0}
.sets{display:flex; flex-wrap:wrap; gap:8px}
.sec-meta{display:flex; flex-wrap:wrap; gap:8px; align-items:center}

/* ---------- setup ---------- */
.setup{max-width:760px; margin:0 auto}
.slots{display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:10px; margin-top:12px}
.slot{position:relative; display:block; cursor:pointer}
.slot input{position:absolute; opacity:0; pointer-events:none}
.slot .box{display:block; padding:14px 16px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); height:100%}
.slot .box b{display:block}
.slot .box span{display:block; font-size:13px; color:var(--muted); margin-top:2px}
.slot .box em{display:block; font-style:normal; font-weight:700; font-variant-numeric:tabular-nums; margin-top:6px; color:var(--accent)}
.slot input:checked + .box{border-color:var(--accent); background:var(--accent-soft)}
.slot input:focus-visible + .box{outline:3px solid var(--accent); outline-offset:2px}
.custom-min{display:flex; align-items:center; gap:8px; margin-top:12px}
.custom-min input, .search{font:inherit; padding:9px 12px; border-radius:10px; border:1px solid var(--line); background:var(--surface); color:var(--ink); width:90px}
.toggle{display:flex; align-items:flex-start; gap:10px; padding:12px 0; border-top:1px solid var(--line); cursor:pointer}
.toggle input{width:18px; height:18px; margin-top:3px; accent-color:var(--accent)}
.warnbox{padding:12px 14px; border-radius:10px; background:var(--mark-soft); color:var(--ink); border:1px solid var(--mark); font-size:14px}

/* ---------- play ---------- */
.quiz{display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:18px; align-items:start}
.mini-timer{display:none; font-variant-numeric:tabular-nums}
.mini-timer.warn{background:var(--bad-soft); color:var(--bad)}
.q-main{scroll-margin-top:calc(var(--topbar-h, 64px) + 12px)}
@media (max-width:900px){ .quiz{grid-template-columns:1fr} .mini-timer{display:inline-flex} .q-top{position:sticky; top:var(--topbar-h, 96px); z-index:5; background:var(--surface); margin:-20px -20px 14px; padding:14px 20px 10px; border-radius:var(--radius) var(--radius) 0 0; border-bottom:1px solid var(--line)} }
.q-top{display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; margin-bottom:14px}
.q-count{font-weight:700; font-variant-numeric:tabular-nums}
.q-text{font-family:var(--read); font-weight:500; font-size:clamp(19px, 2.6vw, 22px); line-height:1.45; margin:6px 0 4px}
.q-sentence{font-family:var(--read); font-size:17px; line-height:1.6; padding:12px 14px; background:var(--surface-2); border-radius:10px; margin:12px 0 4px; color:var(--ink)}
.q-sentence .sep{color:var(--muted); padding:0 4px}
.q-sentence .pk{font-family:var(--ui); font-size:12px; font-weight:700; color:var(--muted); vertical-align:2px}
.pqrs{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; margin-top:10px}
@media (max-width:480px){ .pqrs{grid-template-columns:1fr} }
.pqrs > div{display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px dashed var(--line); border-radius:10px; font-family:var(--read); font-size:17px}
.pqrs .opt-k{background:var(--accent-soft); color:var(--accent); text-transform:none}
.opts{display:flex; flex-direction:column; gap:10px; margin-top:16px}
.opt{display:flex; align-items:flex-start; gap:12px; text-align:left; width:100%; padding:13px 14px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); cursor:pointer; transition:border-color .12s, background .12s}
@media (hover:hover){ .opt:hover{border-color:var(--accent)} }
.opt.sel{border-color:var(--accent); background:var(--accent-soft)}
.opt-k{flex:none; display:grid; place-items:center; width:28px; height:28px; border-radius:8px; background:var(--surface-2); font-weight:700; font-size:14px; text-transform:lowercase}
.opt.sel .opt-k{background:var(--accent); color:var(--accent-ink)}
.opt-t{font-family:var(--read); font-size:17px; line-height:1.45; padding-top:1px}
.q-actions{display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; padding-top:16px; border-top:1px solid var(--line)}
.q-actions .primary{margin-left:auto}
@media (max-width:520px){ .q-actions .btn{flex:1 1 45%} .q-actions .primary{margin-left:0} }
.kbd-hint{font-size:13px; color:var(--muted); margin:12px 0 0}
.q-side{position:sticky; top:76px}
@media (max-width:900px){ .q-side{position:static} }
.timer{padding-bottom:14px; border-bottom:1px solid var(--line); margin-bottom:14px}
.t-label{display:block; font-size:13px; font-weight:600; color:var(--muted)}
.t-val{display:block; font-size:34px; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.02em}
.timer.warn .t-val{color:var(--bad)}
.timer .bar{margin-top:8px}
.timer.warn .bar > i{background:var(--bad)}
.legend{display:grid; grid-template-columns:1fr 1fr; gap:6px 10px; font-size:13px; color:var(--muted); margin-bottom:12px}
.legend span{display:flex; align-items:center; gap:6px}
.legend i{width:14px; height:14px; border-radius:4px; display:inline-block; flex:none; border:2px solid transparent}
.palette{display:grid; grid-template-columns:repeat(auto-fill, minmax(38px, 1fr)); gap:6px; margin-bottom:16px; max-height:300px; overflow:auto; padding:2px}
.pal{height:38px; border-radius:8px; border:1.5px solid var(--line); background:var(--surface-2); font-weight:700; font-size:14px; cursor:pointer; font-variant-numeric:tabular-nums; position:relative}
.pal.seen, .legend .seen{background:var(--bad-soft); border-color:var(--bad); color:var(--bad)}
.pal.done, .legend .done{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.pal.mark, .legend .mark{background:var(--mark-soft); border-color:var(--mark); color:var(--mark)}
.pal.done.mark, .legend .donemark{background:var(--accent); border-color:var(--mark); color:var(--accent-ink); box-shadow:inset 0 0 0 2px var(--mark)}
.legend .nv{background:var(--surface-2); border:1.5px solid var(--line)}
.pal.cur{outline:2.5px solid var(--ink); outline-offset:1px}
.link-quiet{display:block; text-align:center; margin-top:12px; font-size:14px; color:var(--muted)}

/* ---------- results / review ---------- */
.score-hero{display:grid; grid-template-columns:auto 1fr; gap:26px; align-items:center}
@media (max-width:640px){ .score-hero{grid-template-columns:1fr} }
.ring{--p:0; width:150px; height:150px; border-radius:50%; display:grid; place-items:center; background:conic-gradient(var(--ring, var(--accent)) calc(var(--p) * 1%), var(--surface-3) 0)}
.ring > div{width:118px; height:118px; border-radius:50%; background:var(--surface); display:grid; place-items:center; text-align:center}
.ring b{font-size:32px; letter-spacing:-.02em; display:block; line-height:1}
.ring span{font-size:12px; color:var(--muted); font-weight:600}
.score-line{font-size:clamp(24px, 4vw, 32px); font-weight:700; letter-spacing:-.02em}
.trow{display:grid; grid-template-columns:minmax(0, 1.7fr) minmax(60px, 1fr) auto; gap:12px; align-items:center; padding:11px 0; border-top:1px solid var(--line)}
.trow:first-child{border-top:0}
.trow .nm{font-weight:600}
.trow .nm small{display:block; font-weight:500; color:var(--muted); font-size:13px}
.trow .num{font-variant-numeric:tabular-nums; font-weight:700; text-align:right; min-width:90px}
.trow .num small{display:block; color:var(--muted); font-weight:500; font-size:12px}
@media (max-width:560px){ .trow{grid-template-columns:1fr auto} .trow .bar{grid-column:1 / -1; order:3} }
.tabs{display:flex; flex-wrap:wrap; gap:6px; margin:4px 0 18px}
.tabs button{border:1px solid var(--line); background:var(--surface); padding:7px 14px; border-radius:999px; font-weight:600; font-size:14px; cursor:pointer; color:var(--muted)}
.tabs button.active{background:var(--ink); color:var(--bg); border-color:var(--ink)}
.rq{margin-bottom:14px}
.rq-head{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:6px}
.rq .opt{cursor:default}
@media (hover:hover){ .rq .opt:hover{border-color:var(--line)} }
.rq .opt.right{border-color:var(--good); background:var(--good-soft)}
.rq .opt.right .opt-k{background:var(--good); color:var(--surface)}
.rq .opt.wrong{border-color:var(--bad); background:var(--bad-soft)}
.rq .opt.wrong .opt-k{background:var(--bad); color:var(--surface)}
.opt .tagline{display:block; font-family:var(--ui); font-size:12px; font-weight:700; margin-top:2px}
.opt.right .tagline{color:var(--good)} .opt.wrong .tagline{color:var(--bad)}
.explain{margin-top:12px; padding:12px 14px; background:var(--accent-soft); border-radius:14px; font-size:15px}
.explain::before{content:'💡 Why'; display:block; font-weight:800; font-size:13px; color:var(--accent); margin-bottom:4px}
.explain p{margin:0}
.explain p + p{margin-top:6px}
.att-row .chip{white-space:normal}
.att-row{display:grid; grid-template-columns:minmax(0, 1fr) auto auto; gap:14px; align-items:center; padding:12px 0; border-top:1px solid var(--line)}
.att-row:first-child{border-top:0}
.att-row .t{font-weight:600}
.att-row .t small{display:block; color:var(--muted); font-weight:500}
.att-row .n{font-variant-numeric:tabular-nums; font-weight:700; text-align:right}
@media (max-width:560px){ .att-row{grid-template-columns:minmax(0, 1fr) auto} .att-row .btn{grid-column:1 / -1} }

/* ---------- topics ---------- */
.status-col h3{font-size:16px; display:flex; align-items:center; gap:8px}
.area h2{font-size:18px; margin-bottom:6px}

/* ---------- vocab ---------- */
.game-card{display:flex; flex-direction:column; gap:8px; text-decoration:none; color:var(--ink); transition:transform .15s, border-color .15s}
@media (hover:hover){ .game-card:hover{transform:translateY(-2px); border-color:var(--accent)} }
.game-card .ic{font-size:28px}
.game-card h3{font-size:18px}
.game-card p{margin:0; color:var(--muted); font-size:14px}
.game-card .best{margin-top:auto; padding-top:6px}
.game-wrap{max-width:720px; margin:0 auto}
.game-top{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:16px}
.game-top .stat{font-weight:700; font-variant-numeric:tabular-nums}

.flash{perspective:1200px; margin:8px 0 16px}
.flash-in{position:relative; min-height:300px; transition:transform .5s cubic-bezier(.2,.7,.2,1); transform-style:preserve-3d; cursor:pointer}
.flash.flipped .flash-in{transform:rotateY(180deg)}
.face{position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:28px}
.face.back{transform:rotateY(180deg)}
.face .w{font-family:var(--read); font-size:clamp(34px, 7vw, 48px); font-weight:600; letter-spacing:-.01em}
.face .pos{color:var(--muted); font-style:italic}
.face .m{font-family:var(--read); font-size:21px; max-width:32ch}
.face .ex{font-family:var(--read); font-style:italic; color:var(--muted); max-width:44ch}
.face .tap{font-size:13px; color:var(--muted); margin-top:18px}
.wordline{display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-top:10px}

.match{display:grid; grid-template-columns:1fr 1.4fr; gap:12px}
.match .col{display:flex; flex-direction:column; gap:8px}
.mt{padding:12px 14px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); text-align:left; cursor:pointer; min-height:52px; transition:border-color .12s, background .12s, opacity .3s}
.mt.word{font-family:var(--read); font-weight:600; font-size:18px}
.mt.mean{font-size:15px}
@media (hover:hover){ .mt:hover{border-color:var(--accent)} }
.mt.sel{border-color:var(--accent); background:var(--accent-soft)}
.mt.done{border-color:var(--good); background:var(--good-soft); color:var(--good); cursor:default}
.mt.nope{animation:shake .35s}
@keyframes shake{20%,60%{transform:translateX(-5px)} 40%,80%{transform:translateX(5px)}}
@media (max-width:520px){ .match{grid-template-columns:1fr 1.3fr; gap:8px} .mt{padding:10px} .mt.word{font-size:16px} .mt.mean{font-size:13px} }

.prompt-word{font-family:var(--read); font-size:clamp(32px, 7vw, 46px); font-weight:600; text-align:center; margin:6px 0}
.prompt-sub{text-align:center; color:var(--muted); margin:0 0 4px}
.mode-badge{display:block; width:max-content; margin:0 auto 8px}
.choices{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:18px}
@media (max-width:460px){ .choices{grid-template-columns:1fr} }
.choice{padding:16px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); font-weight:600; font-size:17px; cursor:pointer; transition:border-color .12s, background .12s}
@media (hover:hover){ .choice:hover{border-color:var(--accent)} }
.choice.right{border-color:var(--good); background:var(--good-soft); color:var(--good)}
.choice.wrong{border-color:var(--bad); background:var(--bad-soft); color:var(--bad)}
.feedback{min-height:24px; text-align:center; margin-top:12px; font-weight:600}
.feedback.good{color:var(--good)} .feedback.bad{color:var(--bad)}

.slots-row{display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin:20px 0 14px}
.lt{width:44px; height:52px; display:grid; place-items:center; border-radius:10px; font-weight:700; font-size:22px; text-transform:uppercase; font-family:var(--read)}
.lt.slot{border:2px dashed var(--line); background:var(--surface-2)}
.lt.slot.filled{border-style:solid; border-color:var(--accent); background:var(--accent-soft); cursor:pointer}
.lt.slot.hint{border-color:var(--brass); background:var(--brass-soft); color:var(--brass)}
.lt.tile{border:1.5px solid var(--line); background:var(--surface); cursor:pointer; box-shadow:var(--shadow)}
@media (hover:hover){ .lt.tile:hover{border-color:var(--accent)} }
.lt.tile.used{visibility:hidden}
.slots-row.nope{animation:shake .35s}
.slots-row.yes .lt.slot{border-color:var(--good); background:var(--good-soft); color:var(--good)}
@media (max-width:460px){ .lt{width:36px; height:44px; font-size:18px} }

.sentence-gap{font-family:var(--read); font-size:clamp(19px, 3vw, 22px); line-height:1.6; text-align:center; margin:8px 0}
.sentence-gap .gap{display:inline-block; min-width:110px; border-bottom:2.5px solid var(--accent); color:var(--accent); font-weight:600}

.wl-row{display:grid; grid-template-columns:minmax(120px, 1fr) 2fr auto; gap:12px; align-items:start; padding:12px 0; border-top:1px solid var(--line)}
.wl-row:first-child{border-top:0}
.wl-row .w{font-family:var(--read); font-weight:600; font-size:18px}
.wl-row .w small{font-family:var(--ui); font-style:italic; font-weight:500; color:var(--muted); font-size:13px; margin-left:4px}
.wl-row .d{font-size:15px}
.wl-row .d .ex{display:block; color:var(--muted); font-family:var(--read); font-style:italic; margin-top:4px}
@media (max-width:560px){ .wl-row{grid-template-columns:1fr auto} .wl-row .d{grid-column:1 / -1} }
.search{width:100%; max-width:320px}

.end-card{text-align:center; padding:36px 20px}
.end-card .big{font-size:48px; font-weight:700; letter-spacing:-.03em; font-variant-numeric:tabular-nums}

/* ---------- modal + toast ---------- */
.modal-back{position:fixed; inset:0; background:rgba(10,14,22,.5); display:grid; place-items:center; padding:16px; z-index:60}
.modal{width:100%; max-width:440px}
.modal h2{font-size:20px; margin-bottom:8px}
.modal .row{justify-content:flex-end; margin-top:18px}
.toast{position:fixed; left:50%; bottom:24px; transform:translate(-50%, 20px); opacity:0; pointer-events:none; background:var(--ink); color:var(--bg); padding:10px 16px; border-radius:10px; font-weight:600; font-size:14px; transition:opacity .2s, transform .2s; z-index:70; max-width:calc(100% - 32px); text-align:center}
.toast.show{opacity:1; transform:translate(-50%, 0)}

/* ---------- cute theme layer ---------- */
body{
  background:
    radial-gradient(circle at 1px 1px, var(--dots) 1.2px, transparent 0) 0 0 / 22px 22px,
    var(--bg-grad);
  background-attachment:fixed;
  font-weight:500;
}
h1,h2,h3,.brand,.section-h,.score-line,.tile .v,.t-val,.end-card .big,.prompt-word,.flash .face .w,.wotd .w,.ring b{font-family:var(--display); font-weight:600}
.page-head h1,.hero h1{letter-spacing:-.01em}
.brand-mark{width:34px; height:34px; border-radius:12px; font-size:20px; background:linear-gradient(135deg, var(--hero-a), var(--hero-b)); box-shadow:0 4px 10px var(--lift)}
.nav a{border-radius:999px}
.nav a .e{margin-right:4px}
.card{border-radius:var(--radius); border-color:var(--line)}
.btn{border-radius:999px; font-weight:700}
.btn.primary{background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #b0328a)); border-color:transparent; box-shadow:0 4px 10px var(--lift)}
.btn.primary:hover{background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #b0328a)); filter:brightness(1.07)}
.chip{font-weight:700}
.opt,.choice,.mt,.slot .box{border-radius:16px}
.opt-k{border-radius:10px}
.q-text{font-weight:700}
.opt-t{font-weight:600}
.wotd{background:linear-gradient(140deg, var(--hero-a), var(--hero-b)); color:var(--hero-ink); position:relative; overflow:hidden}
.wotd::after{content:'😈'; position:absolute; right:-6px; bottom:-14px; font-size:92px; opacity:.16; transform:rotate(-12deg); pointer-events:none}
.wotd .chip{background:rgba(255,255,255,.18); color:inherit}
.hero h1 .tw{display:inline-block}
.tile .k::before{margin-right:6px}
.quick .ic,.game-card .ic{display:grid; place-items:center; width:46px; height:46px; border-radius:16px; background:var(--accent-soft); font-size:24px}
.ring{box-shadow:0 6px 16px var(--lift)}
.empty h2::before{content:'🐰 '}
.toast{border-radius:999px}
.modal{border-radius:var(--radius)}

/* floating Kuromi-vibe emoji layer (hidden while a quiz is running) */
#sky{position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden}
#sky span{position:absolute; opacity:.2; animation:bob ease-in-out infinite alternate; user-select:none}
:root[data-theme="dark"] #sky span{opacity:.16}
@keyframes bob{ from{transform:translateY(-8px) rotate(-6deg)} to{transform:translateY(8px) rotate(6deg)} }
body.focus #sky, body.reading #sky{display:none}
.topbar,main,footer{position:relative; z-index:1}
.topbar{z-index:20; position:sticky}

/* reading passages + multi-line stems */
.passage{margin:4px 0 14px; border:1px solid var(--line); border-radius:16px; background:var(--surface-2)}
.passage summary{cursor:pointer; padding:10px 14px; font-weight:800; color:var(--accent); list-style:none}
.passage summary::-webkit-details-marker{display:none}
.passage summary::after{content:' ▾'; color:var(--muted)}
.passage[open] summary::after{content:' ▴'}
.passage-body{padding:0 16px 14px; max-height:340px; overflow:auto; font-family:var(--read); font-size:16.5px; line-height:1.7}
.passage-body p{margin:0 0 10px}
.passage-body b{background:var(--brass-soft); color:var(--brass); padding:0 3px; border-radius:4px}
.q-lines{font-size:16.5px; line-height:1.75}
.q-lines b{color:var(--accent)}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms !important; transition-duration:.001ms !important}
  #sky span{animation:none}
}

/* ---------- cheat sheet ---------- */
.sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0}
.cs-actions{margin-left:auto}
.cs-toc{display:flex; flex-wrap:wrap; gap:6px; margin:0 0 12px}
.cs-search{display:block; margin:0 0 6px}
.cs-search input{width:100%; padding:11px 14px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); color:var(--ink); font:inherit}
.cs-search input:focus{border-color:var(--accent); outline:none}
.cs-sec{scroll-margin-top:calc(var(--topbar-h, 64px) + 12px)}
.cs-intro{margin:-4px 0 12px; max-width:75ch}
.cs-card h3{font-size:16px; margin:6px 0 6px}
.cs-card p{margin:0; line-height:1.55}
.cs-card .chip{margin-bottom:2px}
.cs-tip{margin-top:10px !important; padding:8px 10px; border-radius:10px; background:var(--accent-soft); font-size:14px}
.cs-table-wrap{overflow-x:auto; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface)}
.cs-table{width:100%; border-collapse:collapse; font-size:14px}
.cs-table.wide{min-width:560px}
.cs-table th,.cs-table td{padding:9px 12px; text-align:left; border-bottom:1px solid var(--line); vertical-align:top}
.cs-table thead th{background:var(--surface-2); font-size:13px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted)}
.cs-table tbody tr:last-child th,.cs-table tbody tr:last-child td{border-bottom:0}
.cs-words{display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap:8px}
.cs-word{display:flex; flex-direction:column; gap:2px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface)}
.cs-word span{color:var(--muted); font-size:14px}
.cs-list{margin:0; padding:16px 16px 16px 34px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); line-height:1.6}
.cs-list li+li{margin-top:6px}
.cs-foot{margin-top:28px}
@media print{
  .topbar,#sky,.cs-toc,.cs-search,.cs-actions,#toast{display:none !important}
  body{background:#fff; color:#000}
  .card,.cs-word,.cs-list,.cs-table-wrap{box-shadow:none; break-inside:avoid}
  .cs-table-wrap{overflow:visible}
}
