/* VOICE   everyday learning: warm, cheerful, focused; friendly for teens and adults
   IDEA    a red panda's study corner: 田字格 practice squares, a red seal on mastered words, mascot Xiao Hong cheering
   PICTURE the "lembar hafalan": every HSK word as a square on one sheet, filling with rust seals as you learn
   COLOUR  sand ground, cream cards, panda rust for actions, chestnut ink, bamboo for right, berry for wrong, honey for streak
   TYPE    Nunito (if installed) / system sans for UI; Hanzi in the device's CJK face (optional Kai brush style)
   LAYOUT  laptop: sidebar + one column of cards up to 980px; phone: bottom tab bar, cards stacked, study screen thumb-first */


/* Dua tema: terang (bawaan, :root) dan gelap "Malam Teh" (:root[data-skin=gelap]). Dipilih manual lewat tombol
   bulan/matahari atau Pengaturan; app.js memasang atribut data-skin pada <html>. Kontras keduanya diuji otomatis. */
:root {
  color-scheme: light;
  --bg: #f3e6d3; --paper: #fff8ef; --ink: #2b1a14; --ink-2: #5a4136; --ink-3: #6b5247; --line: #e6d3b8; --line-2: #d8c3a8; --tz-bg: #fffdf9;
  --red: #c24e1c; --red-ink: #a8401a; --red-soft: #f2b48e; --red-tint: #fde3d3; --red-shadow: #7a3014;
  --gold: #e9a23b; --gold-soft: #fbe7c2; --ok: #4f7d2c; --ok-ink: #2f5517; --ok-soft: #e3efd3; --bad: #a3304a; --bad-ink: #7e1f35; --bad-soft: #f7e0e5;
  --btn: #c24e1c; --btn-ink: #ffffff; --grid: #d98a63;
  --t1: #c7372b; --t2: #95590a; --t3: #37701d; --t4: #2a5cab; --t5: #6b5f57;
  --shadow: 0 2px 0 var(--line);
  --hz: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  --ui: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --radius: 22px;
  --navh: 68px;
}
:root.font-kai { --hz: "KaiTi", "STKaiti", "Kaiti SC", "AR PL UKai CN", "Noto Serif SC", "Source Han Serif SC", serif; }
:root.big { font-size: 112.5%; }
:root[data-skin=gelap] {
  /* "Malam Teh": cokelat sangat gelap (bukan hitam), teks krem lembut, oranye diterangkan. Dinyalakan manual. */
  color-scheme: dark;
  --bg: #1c1512; --paper: #271d18; --ink: #f6ebdd; --ink-2: #d9c6b4; --ink-3: #b9a28e; --line: #3d2f28; --line-2: #4e3c33; --tz-bg: #2e231d;
  --red: #ee8a4f; --red-ink: #f7a877; --red-soft: #7a3f22; --red-tint: #4a2a1a; --red-shadow: #a4532a;
  --gold: #f0b04d; --gold-soft: #3b2c16; --ok: #8bc46a; --ok-ink: #b5e29a; --ok-soft: #1f3318; --bad: #e57a92; --bad-ink: #f6b3c2; --bad-soft: #3f1c24;
  --btn: #ee8a4f; --btn-ink: #24140c; --grid: #c9703f;
  --t1: #ff8f7e; --t2: #e8b455; --t3: #93d46e; --t4: #86b6ff; --t5: #c2b3a6;
}

* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--ui); overflow-x: hidden; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 6px; }
.hz { font-family: var(--hz); font-weight: 500; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- shell ---------- */
#app { min-height: 100%; display: flex; }
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--navh) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); display: flex; background: var(--paper); border-top: 1px solid var(--line); }
.nav .brand { display: none; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--red); }
.nav a.on svg { color: var(--red); }
main { flex: 1; width: 100%; padding: 16px max(16px, env(safe-area-inset-left, 0px)) calc(var(--navh) + 28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 980px; margin: 0 auto; }

@media (min-width: 900px) {
  .nav { top: 0; right: auto; bottom: 0; width: 232px; height: auto; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 20px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .nav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 15px; }
  .nav a:hover { background: var(--bg); color: var(--ink); }
  .nav a.on { background: var(--bg); }
  main { padding: 32px 40px 48px 272px; }
}

.seal { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--red); color: #fff; font-family: var(--hz); font-size: 20px; font-weight: 700; line-height: 1; }

/* ---------- common pieces ---------- */
h1 { font-size: clamp(26px, 4.2vw, 36px); line-height: 1.1; letter-spacing: -.02em; margin: 4px 0 6px; text-wrap: balance; }
h2 { font-size: 20px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 16px; border: 2px solid transparent; background: var(--btn); color: var(--btn-ink); font-weight: 800; font-size: 16px; text-decoration: none; box-shadow: 0 4px 0 var(--red-shadow); margin-bottom: 4px; transition: transform .08s ease; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-shadow); }
.btn.red { background: var(--red); color: var(--btn-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.soft { background: var(--paper); color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); flex: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--red); color: var(--btn-ink); border-color: var(--red); }
.chip.streak { border-color: transparent; background: var(--gold-soft); color: var(--ink); }
.chip.streak svg { color: var(--gold); width: 18px; height: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips > * { flex: none; }
.row > .btn, .row > .chip, .row > .icon-btn { flex: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.note { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 10px 12px; border-radius: 0 10px 10px 0; font-size: 15px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-weight: 700; font-size: 15px; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--paper); font-size: 16px; }
textarea.input { min-height: 110px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--paper); font-weight: 600; }
.seg button.on { background: var(--red); color: var(--btn-ink); border-color: var(--red); }
.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 99px; border: 0; background: var(--line-2); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch[aria-checked=true] { background: var(--ok); }
.switch[aria-checked=true]::after { transform: translateX(20px); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .txt { flex: 1; }
.setting .txt b { display: block; font-size: 16px; }
.setting .txt span { color: var(--ink-3); font-size: 14px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper output { min-width: 92px; text-align: center; font-weight: 800; font-size: 18px; white-space: nowrap; }

/* ---------- 田字格 ---------- */
.tzrow { display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.tz { --s: 120px; position: relative; width: var(--s); height: var(--s); display: grid; place-items: center; border: 2px solid var(--grid); background-color: var(--tz-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23d98a63' stroke-opacity='.6' stroke-width='1' stroke-dasharray='4 4' vector-effect='non-scaling-stroke'%3E%3Cline x1='50' y1='0' x2='50' y2='100'/%3E%3Cline x1='0' y1='50' x2='100' y2='50'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%; font-family: var(--hz); font-size: calc(var(--s) * .72); line-height: 1; color: var(--ink); }
.tzcol { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tzcol + .tzcol .tz { border-left-width: 0; }
.tzpy { font-family: var(--ui); font-weight: 800; font-size: 17px; line-height: 1.3; min-height: 22px; }
.pyoff .pytop, .pyoff rt { display: none; }
.opy { display: block; font-family: var(--ui); font-size: 13px; font-weight: 800; line-height: 1.2; margin-bottom: 2px; }
.tz.lg { --s: clamp(96px, 30vw, 150px); }
.tz.md { --s: clamp(72px, 21vw, 110px); }
.tz.sm { --s: 64px; }
.tz.xs { --s: 44px; }

/* ---------- home ---------- */
.hello { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hello p { color: var(--ink-2); margin: 0; }
.today { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.ring { position: relative; width: 120px; height: 120px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .c b { font-size: 28px; display: block; letter-spacing: -.02em; }
.ring .c span { font-size: 13px; color: var(--ink-3); }
.plan { display: flex; gap: 18px; flex-wrap: wrap; margin: 4px 0 14px; }
.plan div b { display: block; font-size: 24px; line-height: 1.1; }
.plan div span { color: var(--ink-3); font-size: 14px; }
@media (max-width: 480px) {
  .today { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .today .plan { justify-content: center; }
}
.sheet-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mosaic { display: grid; grid-template-columns: repeat(auto-fill, minmax(11px, 1fr)); gap: 3px; margin: 14px 0 12px; }
.mosaic button { border-radius: 3px; }
.mosaic button { aspect-ratio: 1; padding: 0; border: 1px solid var(--line-2); background: var(--paper); font-family: var(--hz); font-size: 0; line-height: 1; color: var(--ink-3); overflow: hidden; }
.mosaic button.l { border-color: var(--red-soft); color: var(--ink); background: var(--red-soft); }
.mosaic button.k { border-color: var(--red); background: var(--red); color: var(--btn-ink); }
.mosaic button.f { box-shadow: inset 0 0 0 2px var(--gold); }
@media (min-width: 620px) {
  .mosaic { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
  .mosaic button { font-size: 15px; border-radius: 6px; }
  .mosaic button.len3 { font-size: 11px; }
  .mosaic button.len4 { font-size: 9px; }
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line-2); }
.legend .l { background: var(--red-soft); border-color: var(--red-soft); }
.legend .k { background: var(--red); border-color: var(--red); }

/* ---------- list / dictionary ---------- */
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; color: var(--ink-3); }
.search .input { padding-left: 46px; }
.wlist { list-style: none; margin: 0; padding: 0; }
.wlist li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.wlist li:last-child { border-bottom: 0; }
.wlist .w { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 4px 0; min-height: 52px; }
.wlist .zh { font-family: var(--hz); font-size: 26px; min-width: 3.4em; line-height: 1.1; }
.wlist .meta { flex: 1; display: grid; }
.wlist .meta .py { font-weight: 600; }
.wlist .meta .ar { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid var(--line-2); }
.dot.l { background: var(--red-soft); border-color: var(--red-soft); }
.dot.k { background: var(--red); border-color: var(--red); }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.topic { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.topic.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.topic b { font-size: 15px; }
.empty { text-align: center; padding: 28px 10px; color: var(--ink-3); }

/* ---------- pinyin / sentences ---------- */
.py-word { font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.toneon .t1 { color: var(--t1); } .toneon .t2 { color: var(--t2); } .toneon .t3 { color: var(--t3); } .toneon .t4 { color: var(--t4); } .toneon .t5 { color: var(--t5); }
.sent { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.sent:first-child { border-top: 0; }
.sent .body { flex: 1; }
.sent .zh { font-family: var(--hz); font-size: 22px; line-height: 1.9; }
.sent ruby { ruby-position: over; }
.sent rt { font-family: var(--ui); font-size: 11.5px; font-weight: 600; letter-spacing: 0; }
.sent .tr { color: var(--ink-2); font-size: 15px; }
.sent .target { background: var(--red-tint); border-radius: 4px; font-weight: 700; }
.sent .pyline { font-size: 14px; color: var(--ink-2); }

/* ---------- word detail ---------- */
.wd-head { display: grid; justify-items: center; gap: 10px; text-align: center; padding-bottom: 6px; }
.wd-arti { font-size: 20px; font-weight: 700; }
.wd-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ---------- overlay: sheet & dialog ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 12, .45); display: flex; align-items: flex-end; justify-content: center; }
.panel { width: 100%; max-width: 640px; max-height: 92%; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 30px rgba(0,0,0,.18); }
.panel .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line-2); margin: -4px auto 10px; }
@media (min-width: 700px) { .overlay { align-items: center; } .panel { border-radius: 22px; max-height: 86%; } .panel .grab { display: none; } }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--navh) + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }

/* ---------- study session ---------- */
.study { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.st-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; max-width: 760px; width: 100%; margin: 0 auto; }
.st-prog { flex: 1; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.st-prog i { display: block; height: 100%; width: 0; background: #e07a3f; border-radius: 99px; transition: width .3s ease; }
.st-time { font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; min-width: 2.6em; text-align: right; font-variant-numeric: tabular-nums; }
.st-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.st-inner { max-width: 760px; margin: 0 auto; }
.st-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--paper); }
.st-foot .st-inner { display: grid; gap: 10px; }
.prompt { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 8px 0 14px; }
.prompt .ask { color: var(--ink-3); font-weight: 700; font-size: 14px; }
.prompt .arti-big { font-size: clamp(22px, 5vw, 30px); font-weight: 800; line-height: 1.2; letter-spacing: -.01em; max-width: 22ch; }
.prompt .cloze { font-family: var(--hz); font-size: clamp(24px, 6vw, 32px); line-height: 1.6; }
.prompt .cloze .gap { display: inline-block; min-width: 2.2em; border-bottom: 3px solid var(--red); margin: 0 .1em; }
.speak { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--red); color: #fff; box-shadow: 0 5px 0 var(--red-shadow); }
.speak svg { width: 52px; height: 52px; }
.speak.small { width: 56px; height: 56px; border-width: 1px; }
.speak.small svg { width: 26px; height: 26px; }
.opts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.opt { position: relative; min-height: 64px; padding: 10px 12px 10px 40px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--paper); text-align: left; font-size: 16px; font-weight: 600; line-height: 1.25; }
.opt .k { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 6px; background: var(--bg); color: var(--ink-3); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.opt.hzopt { font-family: var(--hz); font-size: 28px; font-weight: 500; text-align: center; padding-left: 12px; }
.opt.hzopt .k { left: 8px; top: 8px; transform: none; }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.dim { opacity: .5; }
.opt[disabled] { cursor: default; }
@media (hover: hover) { .opt:not([disabled]):hover { border-color: var(--ink); } }
.feedback { border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .fb-title { font-weight: 800; font-size: 17px; }
.feedback.ok .fb-title { color: var(--ok-ink); }
.feedback.bad .fb-title { color: var(--bad-ink); }
.feedback .fb-word { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feedback .fb-word .zh { font-family: var(--hz); font-size: 26px; }
.rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rate button { min-height: 56px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--paper); font-weight: 700; font-size: 14px; line-height: 1.15; }
.rate button small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.rate .r0 { border-color: var(--bad); } .rate .r3 { border-color: var(--ok); }
.newbadge { display: inline-flex; align-items: center; gap: 6px; background: var(--red); color: var(--btn-ink); font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 99px; }
.goalbar { border-radius: 14px; background: var(--gold-soft); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.summary { display: grid; gap: 16px; padding: 10px 0 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9em, 1fr)); gap: 10px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi b { display: block; font-size: 26px; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; }
.kpi span { color: var(--ink-3); font-size: 14px; }
.stamp { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 18px; background: var(--red); color: #fff; font-family: var(--hz); font-size: 46px; transform: rotate(-6deg); box-shadow: 0 6px 0 var(--red-shadow); animation: stamp .45s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes stamp { from { transform: scale(1.8) rotate(-14deg); opacity: 0; } to { transform: scale(1) rotate(-6deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } .st-prog i, .switch, .switch::after, .btn { transition: none; } }

/* ---------- progress page ---------- */
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal i { width: 14px; height: 14px; border-radius: 3px; background: var(--bg); border: 1px solid var(--line); }
.cal i.a1 { background: #f6cdb3; border-color: #f6cdb3; }
.cal i.a2 { background: #e9966a; border-color: #e9966a; }
.cal i.a3 { background: var(--red); border-color: var(--red); }
.cal i.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(8em, 11em) minmax(0, 1fr) 3.6em; gap: 10px; align-items: center; font-size: 15px; }
.hbar .bar { height: 12px; }
.hbar .v { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 150px; }
.vbars div { display: grid; gap: 4px; justify-items: center; height: 100%; align-content: end; font-size: 13px; color: var(--ink-3); }
.vbars i { width: 100%; max-width: 44px; background: var(--ink); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.vbars b { color: var(--ink); font-size: 14px; }
@media (max-width: 520px) { .hbar { grid-template-columns: minmax(0, 1fr) 3.6em; } .hbar .bar { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- onboarding ---------- */
.onb { max-width: 560px; margin: 0 auto; padding-top: 8px; }
.onb .hero { display: flex; justify-content: center; margin: 10px 0 18px; }
.steps-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.steps-dots i { width: 8px; height: 8px; border-radius: 9px; background: var(--line-2); }
.steps-dots i.on { width: 26px; background: var(--red); }
.choice { display: grid; gap: 10px; }
.choice button { text-align: left; border: 1.5px solid var(--line-2); background: var(--paper); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; }
.choice button b { font-size: 17px; }
.choice button span { color: var(--ink-3); font-size: 14px; }
.choice button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.help h3 { margin-top: 18px; }
.help ol, .help ul { padding-left: 20px; margin: 6px 0 10px; }
.help li { margin-bottom: 6px; }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg); }

/* ---------- maskot ---------- */
.mascot { display: block; }
.peek { position: absolute; right: 14px; top: -76px; width: 104px; height: 81px; }
.card.has-peek { position: relative; margin-top: 78px; }
.done-hero { position: relative; height: 170px; border-radius: var(--radius); background: var(--paper); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.done-hero .mascot { width: 150px; height: 156px; margin-right: 60px; }
.done-hero .stamp { position: absolute; right: calc(50% - 160px); top: 30px; }
.tipbox { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.tipbox .mascot { width: 60px; height: 50px; flex: none; }
.tipbox .bubble { flex: 1; background: var(--gold-soft); border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: 15px; }
.fb-row { display: flex; gap: 12px; align-items: center; }
.fb-row .mascot { width: 58px; height: 49px; flex: none; }
@media (max-width: 380px) { .fb-row .mascot { display: none; } }

/* ---------- v0.2: maskot di banyak tempat ---------- */
.hero-m { display: flex; align-items: flex-end; gap: 6px; margin: 2px 0 12px; }
.hero-m .mascot { width: 112px; height: 117px; flex: none; margin-bottom: -6px; }
.hero-m .bubble { position: relative; flex: 1; background: var(--paper); border: 1px solid var(--line); border-radius: 20px 20px 20px 6px; padding: 12px 14px; margin-bottom: 26px; font-weight: 700; font-size: 16px; line-height: 1.35; box-shadow: var(--shadow); }
.hero-m .bubble small { display: block; font-weight: 600; color: var(--ink-3); font-size: 14px; margin-top: 2px; }
@media (min-width: 720px) { .hero-m .mascot { width: 140px; height: 146px; } .hero-m .bubble { font-size: 18px; flex: 0 1 460px; } }
.ph { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ph .mascot { width: 62px; height: 52px; flex: none; }
.ph h1 { margin: 0; flex: 1; }
.cheerrow { display: flex; align-items: center; gap: 10px; }
.cheerrow .mascot { width: 52px; height: 44px; flex: none; }
.cheerrow .say { flex: 1; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.cheerrow .btn { flex: none; }
.empty .mascot { width: 84px; height: 71px; margin: 0 auto 8px; }
.nav .navm { display: none; }
@media (min-width: 900px) { .nav .navm { display: block; margin-top: auto; padding: 10px; text-align: center; color: var(--ink-3); font-size: 13px; font-weight: 700; } .nav .navm .mascot { width: 120px; height: 125px; margin: 0 auto 4px; } }
.peek, .card.has-peek { }
/* ---------- v0.2: tab, grammar, jebakan ---------- */
.tabs { display: flex; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 5px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: transparent; font-weight: 800; font-size: 15px; color: var(--ink-2); }
.tabs button.on { background: var(--red); color: var(--btn-ink); }
.gitem { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 10px; box-shadow: var(--shadow); }
.gitem > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.gitem > summary::-webkit-details-marker { display: none; }
.gitem .num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--ink-2); }
.gitem.done .num { background: var(--ok); color: #fff; }
.gitem .gt { flex: 1; display: grid; }
.gitem .gt b { font-size: 17px; line-height: 1.25; }
.gitem .gt b .hz { font-size: 19px; }
.gitem .gt span { color: var(--ink-3); font-size: 14px; }
.gitem .chev { flex: none; width: 20px; height: 20px; color: var(--ink-3); transition: transform .15s; }
.gitem[open] .chev { transform: rotate(90deg); }
.gbody { padding: 0 16px 16px; }
.pola { background: var(--red-tint); border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 16px; margin: 4px 0 6px; }
.pola .hz { font-size: 18px; }
.gbody .lbl2 { font-size: 13px; font-weight: 800; color: var(--ink-3); margin-top: 10px; }
.cmp { display: grid; gap: 8px; margin-top: 8px; }
.cmp .it { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--bg); }
.cmp .it .hd { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmp .it .hd .hz { font-size: 26px; font-weight: 700; color: var(--red-ink); }
.cmp .it .use { font-weight: 700; font-size: 15px; margin: 2px 0 4px; }
.cmp .it .sent { padding: 4px 0 0; border: 0; }
.cmp .it .sent .zh { font-size: 19px; line-height: 1.8; }
@media (min-width: 720px) { .cmp.c2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cmp.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.quizbox { margin-top: 12px; border: 2px dashed var(--line-2); border-radius: 14px; padding: 12px; }
.quizbox .q { font-family: var(--hz); font-size: 22px; line-height: 1.5; }
.quizbox .q .gap { display: inline-block; min-width: 2.4em; border-bottom: 3px solid var(--red); }
.quizbox .qo { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.quizbox .qo button { min-height: 46px; padding: 6px 16px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--paper); font-family: var(--hz); font-size: 20px; }
.quizbox .qo button.ok { border-color: var(--ok); background: var(--ok-soft); }
.quizbox .qo button.bad { border-color: var(--bad); background: var(--bad-soft); }
.quizbox .res { margin-top: 8px; font-size: 15px; }
.quizbox .res b.ok { color: var(--ok-ink); } .quizbox .res b.bad { color: var(--bad-ink); }
/* ---------- v0.2: penjelasan saat salah ---------- */
.why { margin-top: 6px; background: var(--paper); border-radius: 12px; padding: 10px 12px; font-size: 15px; line-height: 1.45; }
.why b.t { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 2px; }
.why ul { margin: 0; padding-left: 18px; }
.why li { margin: 3px 0; }
.why .hz { font-size: 18px; }
.st-foot { max-height: 72%; overflow-y: auto; }
/* ---------- v0.2: pilihan tema ---------- */
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.skins button { text-align: left; border: 2px solid var(--line-2); border-radius: 16px; padding: 8px; background: var(--paper); display: grid; gap: 6px; font-weight: 800; font-size: 14px; }
.skins button.on { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.skins .sw { display: flex; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(128,128,128,.35); }
.skins .sw i { flex: 1; }
.skins .sw i:first-child { flex: 2; }
.pybtn { font-family: var(--hz); font-weight: 700; font-size: 18px; }

.hello .row { flex-wrap: nowrap; flex: none; }
.hello h1 { font-size: clamp(22px, 6vw, 36px); }
.sent rt, .cloze rt, .quizbox rt { padding: 0 2.5px; }
.pybtn { font-family: var(--ui); font-weight: 800; font-size: 14px; }

/* ---------- v0.3: ujian, tes penempatan, tangga level ---------- */
.nav a.desk { display: none; }
@media (min-width: 900px) { .nav a.desk { display: flex; } }
.opts.one { grid-template-columns: minmax(0, 1fr); }
.opts.one .opt { min-height: 56px; }
.opt.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.exhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.exfoot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.exclock { min-width: 3.2em; }
.exclock.low { color: var(--bad-ink); }
.stamps { display: flex; gap: 10px; margin: 12px 0; }
.stamps i { width: 44px; height: 44px; border-radius: 12px; border: 2px dashed var(--line-2); display: grid; place-items: center; font-style: normal; font-weight: 800; color: var(--ink-3); }
.stamps i.on { border: 0; background: var(--red); color: var(--btn-ink); font-family: var(--hz); font-size: 24px; transform: rotate(-5deg); box-shadow: 0 3px 0 var(--red-shadow); }
.rules { margin: 8px 0 12px; padding-left: 20px; color: var(--ink-2); font-size: 15px; display: grid; gap: 4px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ladder li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ladder li.cur { border-color: var(--red); background: var(--red-tint); }
.ladder li.lock { color: var(--ink-2); }
.ladder .lv { width: 38px; height: 38px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; font-weight: 800; flex: none; }
.ladder li.done .lv { background: var(--ok-soft); color: var(--ok-ink); }
.ladder li.cur .lv { background: var(--red); color: var(--btn-ink); }
.ladder .tx { flex: 1; display: grid; min-width: 0; }
.ladder .tx span { color: var(--ink-3); font-size: 14px; }
.score-big { text-align: center; font-size: 46px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.verdict { text-align: center; font-weight: 800; font-size: 17px; }
.verdict.ok { color: var(--ok-ink); }
.verdict.bad { color: var(--bad-ink); }
.rev { list-style: none; margin: 0; padding: 0; }
.rev li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 3px; }
.rev li:last-child { border-bottom: 0; }
.rev .zh { font-family: var(--hz); font-size: 22px; line-height: 1.5; }
.rev .mine { color: var(--bad-ink); font-size: 14px; }
.rev .tag { justify-self: start; }
.choice .seg { margin: -2px 0 2px; }

/* sasaran sentuh minimal 44px (pedoman aksesibilitas Apple/Google) */
button.chip { height: 44px; padding: 0 14px; }
.switch::before { content: ""; position: absolute; inset: -6px -2px; }
.seg button { min-width: 44px; }

/* ---------- v0.4: maskot v4 & tombol tema ---------- */
svg.mascot { height: auto !important; }
.hero-m .mascot.lie { width: 150px; }
@media (min-width: 720px) { .hero-m .mascot.lie { width: 200px; } }
:root[data-skin=gelap] .hero-m .mascot:not(.lie) { background: radial-gradient(closest-side, var(--line) 0 72%, transparent 73%); border-radius: 50%; }
.skins2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.skins2 button { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink); font-weight: 800; text-align: left; }
.skins2 button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.skins2 .pv { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.skins2 .pv svg { width: 20px; height: 20px; }
