:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #2b2b3a;
  --muted: #6b6b80;
  --line: #f0e6da;
  --brand: #ff7a59;
  --brand-2: #ffb347;
  --ok: #2ecc71;
  --bad: #ff5c5c;
  --blue: #4fc3f7;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(0,0,0,.08), 0 10px 30px rgba(255,122,89,.10);
  --font-cn: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-ui: "Fredoka", "Noto Sans SC", system-ui, sans-serif;
  --font-brush: "Ma Shan Zheng", "Noto Sans SC", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 17px; line-height: 1.4; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
button:disabled { opacity: .5; cursor: default; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.cn { font-family: var(--font-cn); }
.brush { font-family: var(--font-brush); }
.muted { color: var(--muted); }
.pinyin { color: var(--muted); font-size: .85em; letter-spacing: .02em; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: rgba(255,248,240,.92); backdrop-filter: blur(10px); border-bottom: 2px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 18px; }
.brand-text small { font-family: var(--font-cn); color: var(--muted); font-size: 12px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-btn { width: 42px; height: 42px; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.08); font-size: 22px; display: grid; place-items: center; }
.tb-btn:active { transform: translateY(2px); box-shadow: none; }
.stars-pill { background: #fff3c4; color: #8a5a00; padding: 6px 12px; border-radius: 999px; font-weight: 600; box-shadow: 0 3px 0 rgba(0,0,0,.06); }

.view { max-width: 980px; margin: 0 auto; padding: 16px 14px 90px; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.page-title .big { font-size: 44px; }

/* Hero / hub */
.hero { background: linear-gradient(135deg, #ff7a59 0%, #ffb347 100%); color: #fff; border-radius: 28px; padding: 22px 22px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; margin-bottom: 18px; }
.hero h1 { font-size: 28px; }
.hero p { margin: 4px 0 12px; opacity: .95; }
.hero .deco { position: absolute; right: -10px; top: -10px; font-size: 110px; opacity: .25; transform: rotate(12deg); pointer-events: none; }
.hero-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: rgba(255,255,255,.22); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.chip.solid { background: #fff; color: var(--brand); }
.name-input { display: flex; gap: 8px; margin-top: 8px; }
.name-input input { flex: 1; border: 0; border-radius: 14px; padding: 10px 14px; font-size: 17px; font-family: var(--font-ui); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 10px; }
.section-head h2 { font-size: 20px; }
.section-head a, .section-head button { color: var(--brand); font-weight: 600; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 3px solid transparent; transition: transform .12s, box-shadow .12s; position: relative; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.97); }
.card .ico { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.card .ttl { font-weight: 700; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.done { border-color: var(--ok); }
.card .badge { position: absolute; top: 10px; right: 10px; font-size: 13px; background: #fff3c4; color: #8a5a00; border-radius: 999px; padding: 3px 8px; font-weight: 700; }
.card .progress { height: 8px; border-radius: 999px; background: var(--line); margin-top: 10px; overflow: hidden; }
.card .progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #7ee2a8); border-radius: 999px; }
.week-card { border-top: 8px solid var(--wc, var(--brand)); }
.week-card .wk { font-size: 12px; font-weight: 700; color: var(--wc, var(--brand)); letter-spacing: .06em; text-transform: uppercase; }
.week-card .ico { font-size: 46px; }

.act-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.act-card .ico { font-size: 34px; margin: 0; width: 46px; text-align: center; flex: none; }
.act-card .stars { margin-left: auto; font-size: 14px; color: #f5b301; white-space: nowrap; flex: none; }
.act-card .type-tag { display: inline-block; font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.06); font-weight: 600; }
.tab.on { background: var(--ink); color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 16px; background: var(--brand); color: #fff; font-weight: 700; font-size: 17px; box-shadow: 0 5px 0 #d6553a; transition: transform .08s; min-height: 48px; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d6553a; }
.btn.alt { background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(0,0,0,.1); }
.btn.alt:active { box-shadow: 0 2px 0 rgba(0,0,0,.1); }
.btn.ok { background: var(--ok); box-shadow: 0 5px 0 #1f9f55; }
.btn.blue { background: var(--blue); box-shadow: 0 5px 0 #2a9ac9; }
.btn.big { font-size: 20px; padding: 14px 26px; }
.btn.sm { font-size: 14px; padding: 8px 14px; min-height: 36px; border-radius: 12px; }
.btn.round { width: 54px; height: 54px; padding: 0; border-radius: 50%; font-size: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.center { justify-content: center; }
.spacer { flex: 1; }

/* Activity frame */
.act-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.act-head h2 { font-size: 20px; margin: 0; }
.act-head .type { font-size: 13px; color: var(--muted); }
.act-prog { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
.act-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s; }
.stage { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); min-height: 320px; }
.prompt { font-size: 20px; text-align: center; margin: 4px 0 16px; }
.prompt .pinyin { display: block; }
.prompt .speak-btn { margin-top: 8px; }
.prompt .big { display: block; font-size: 64px; line-height: 1.1; margin: 6px 0; }
.prompt .huge { display: block; font-size: 96px; line-height: 1.05; margin: 4px 0; }
.instr { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 16px 10px; text-align: center; font-size: 30px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 4px 0 rgba(0,0,0,.05); transition: transform .08s; }
.choice small { font-size: 14px; color: var(--muted); }
.choice:active { transform: scale(.96); }
.choice.right { border-color: var(--ok); background: #eafff1; animation: pop .35s; }
.choice.wrong { border-color: var(--bad); background: #fff0f0; animation: shake .35s; }
.choice.dim { opacity: .45; }
.choice.emoji { font-size: 44px; }
.choice.pre { white-space: pre-line; line-height: 1.1; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.feedback { text-align: center; font-weight: 700; min-height: 30px; margin-top: 12px; font-size: 18px; }
.feedback.good { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.speak-btn { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 28px; box-shadow: 0 5px 0 #2a9ac9; }
.speak-btn.sm { width: 40px; height: 40px; font-size: 18px; box-shadow: 0 3px 0 #2a9ac9; }
.speak-btn:active { transform: translateY(3px); box-shadow: none; }

/* Result */
.result { text-align: center; padding: 20px 10px; }
.result .big { font-size: 80px; }
.result h2 { font-size: 26px; }
.result .stars-big { font-size: 44px; letter-spacing: 4px; margin: 6px 0; }
.result .stars-big .off { opacity: .2; }

/* Flashcards */
.flash { perspective: 1200px; max-width: 420px; margin: 0 auto; }
.flash-inner { position: relative; width: 100%; height: 300px; transform-style: preserve-3d; transition: transform .5s; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; border-radius: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow); border: 3px solid var(--line); background: #fff; }
.flash-face.back { transform: rotateY(180deg); background: #fff8e6; }
.flash-face .h { font-size: 110px; line-height: 1; font-family: var(--font-cn); }
.flash-face .i { font-size: 80px; }
.flash-face .p { font-size: 26px; color: var(--brand); }
.flash-face .e { font-size: 20px; color: var(--muted); }
.flash-nav { display: flex; justify-content: center; gap: 12px; margin-top: 16px; align-items: center; }

/* Memory */
.mem-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); max-width: 520px; margin: 0 auto; }
.mem-grid.c5 { grid-template-columns: repeat(5, 1fr); }
.mem { aspect-ratio: 1; border-radius: 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; font-size: clamp(22px, 6vw, 40px); color: transparent; box-shadow: 0 4px 0 rgba(0,0,0,.08); transition: transform .2s; user-select: none; }
.mem.up { background: #fff; color: var(--ink); border: 3px solid var(--line); }
.mem.matched { background: #eafff1; color: var(--ink); border: 3px solid var(--ok); transform: scale(.94); }
.mem .p2 { font-size: .5em; color: var(--brand); }

/* Drag & drop */
.dz-wrap { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.dz { min-height: 110px; border: 3px dashed var(--line); border-radius: 20px; padding: 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fffdf9; transition: background .15s; }
.dz.over { background: #fff3e6; border-color: var(--brand); }
.dz.right { border-color: var(--ok); border-style: solid; background: #eafff1; }
.dz.wrong { border-color: var(--bad); border-style: solid; background: #fff0f0; }
.dz .lbl { font-size: 34px; }
.dz .lbl small { display: block; font-size: 13px; color: var(--muted); }
.tokens { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0; min-height: 60px; }
.token { background: #fff; border: 3px solid var(--brand); color: var(--ink); border-radius: 14px; padding: 8px 16px; font-size: 26px; font-family: var(--font-cn); cursor: grab; box-shadow: 0 4px 0 rgba(0,0,0,.08); user-select: none; touch-action: none; }
.token.sel { background: var(--brand); color: #fff; }
.token.small { font-size: 20px; padding: 6px 12px; }
.token.placed { border-color: var(--line); cursor: default; }
.token.dragging { opacity: .4; }
.token.ghost { position: fixed; pointer-events: none; z-index: 100; transform: translate(-50%, -50%) scale(1.1); opacity: .95; }
.blank { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; height: 48px; border-bottom: 4px solid var(--brand); margin: 0 4px; vertical-align: middle; font-size: 26px; font-family: var(--font-cn); border-radius: 8px 8px 0 0; background: #fff8e6; }
.blank.filled { border-color: var(--ink); }
.blank.right { background: #eafff1; border-color: var(--ok); }
.blank.wrong { background: #fff0f0; border-color: var(--bad); }
.sentence-line { text-align: center; font-size: 28px; font-family: var(--font-cn); line-height: 1.9; }
input.fill { font-size: 22px; border: 3px solid var(--line); border-radius: 12px; padding: 8px 10px; width: 120px; text-align: center; font-family: var(--font-ui); }
input.fill.right { border-color: var(--ok); background: #eafff1; }
input.fill.wrong { border-color: var(--bad); background: #fff0f0; }

/* Sequencing */
.seq { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.seq .token { font-size: 22px; }
.seq-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; min-height: 60px; }
.slot { min-width: 56px; height: 56px; border: 3px dashed var(--line); border-radius: 14px; display: grid; place-items: center; font-family: var(--font-cn); font-size: 22px; background: #fffdf9; padding: 0 8px; }
.slot.filled { border-style: solid; border-color: var(--brand); background: #fff; }
.slot.right { border-color: var(--ok); background: #eafff1; }
.slot.wrong { border-color: var(--bad); background: #fff0f0; }

/* Sorting */
.sort-cols { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.sort-col { border: 3px dashed var(--line); border-radius: 20px; padding: 10px; min-height: 140px; text-align: center; background: #fffdf9; }
.sort-col h3 { font-size: 16px; margin-bottom: 8px; }
.sort-col.over { border-color: var(--brand); background: #fff3e6; }
.sort-col .tokens { justify-content: center; min-height: 40px; margin: 0; }
.pool { margin: 12px 0; }

/* Mark words */
.words { text-align: center; font-family: var(--font-cn); font-size: 28px; line-height: 2; }
.word { display: inline-block; padding: 2px 6px; border-radius: 10px; margin: 2px; cursor: pointer; border: 3px solid transparent; }
.word.sel { background: #fff3c4; border-color: var(--brand-2); }
.word.right { background: #eafff1; border-color: var(--ok); }
.word.wrong { background: #fff0f0; border-color: var(--bad); }
.word.missed { border-color: var(--brand-2); border-style: dashed; }

/* Hotspot figure */
.figure-wrap { display: flex; justify-content: center; }
.figure-wrap svg { max-width: 320px; width: 100%; height: auto; }
.hs { cursor: pointer; transition: fill .15s; }
.hs:hover { opacity: .85; }
.hs.right { fill: #7ee2a8 !important; }
.hs.wrong { fill: #ffb3b3 !important; }
.scene { position: relative; background: linear-gradient(#bfe6ff 0 55%, #9ccc65 55% 100%); border-radius: 22px; height: 300px; overflow: hidden; border: 3px solid var(--line); }
.scene .spot { position: absolute; font-size: 44px; cursor: pointer; transform: translate(-50%, -50%); transition: transform .15s; user-select: none; }
.scene .spot.right { transform: translate(-50%, -50%) scale(1.3); filter: drop-shadow(0 0 8px #2ecc71); }
.scene .spot.wrong { animation: shake .35s; }

/* Position game */
.pos-scene { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 300px; height: 300px; margin: 0 auto; background: #fffdf9; border-radius: 22px; border: 3px solid var(--line); }
.pos-cell { display: grid; place-items: center; font-size: 56px; }
.pos-cell .box { font-size: 80px; }
.pos-cell .cat.inside { position: absolute; font-size: 40px; }

/* Clock */
.clock { width: 240px; height: 240px; border-radius: 50%; background: #fff; border: 8px solid var(--ink); margin: 0 auto; position: relative; box-shadow: var(--shadow); }
.clock .num { position: absolute; width: 30px; height: 30px; display: grid; place-items: center; font-weight: 700; font-size: 18px; transform: translate(-50%, -50%); }
.clock .hand { position: absolute; left: 50%; top: 50%; transform-origin: 50% 100%; background: var(--ink); border-radius: 6px; }
.clock .hand.h { width: 8px; height: 62px; margin-left: -4px; margin-top: -62px; }
.clock .hand.m { width: 5px; height: 90px; margin-left: -2.5px; margin-top: -90px; background: var(--brand); }
.clock .dot { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }

/* Stroke order */
.writer-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.writer-box { touch-action: none; user-select: none; -webkit-user-select: none; width: 260px; height: 260px; border: 3px solid var(--line); border-radius: 20px; background-color: #fff; background-image: linear-gradient(to right, transparent 49.5%, #f3d9c4 49.5%, #f3d9c4 50.5%, transparent 50.5%), linear-gradient(to bottom, transparent 49.5%, #f3d9c4 49.5%, #f3d9c4 50.5%, transparent 50.5%); position: relative; }
.writer-box .fallback { pointer-events: none; position: absolute; inset: 0; display: grid; place-items: center; font-size: 180px; font-family: var(--font-cn); color: #ddd; }
.char-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.char-tabs .tab { font-family: var(--font-cn); font-size: 20px; padding: 6px 12px; }
.char-tabs .tab.ok { background: var(--ok); color: #fff; }

/* Story */
.story-page { text-align: center; }
.story-page .pic { font-size: 120px; line-height: 1.2; }
.story-page .txt { font-size: 28px; font-family: var(--font-cn); margin: 8px 0 4px; }
.story-page .en { color: var(--muted); }
.dots { display: flex; justify-content: center; gap: 6px; margin: 12px 0; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--brand); }

/* Dialogue */
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 20px; margin: 8px 0; font-family: var(--font-cn); font-size: 22px; line-height: 1.4; position: relative; }
.bubble.q { background: #e8f4ff; border-bottom-left-radius: 6px; margin-right: auto; }
.bubble.a { background: #fff3e6; border-bottom-right-radius: 6px; margin-left: auto; text-align: right; }
.bubble small { display: block; font-family: var(--font-ui); font-size: 14px; color: var(--muted); }
.chat { display: flex; flex-direction: column; }

/* Sound board */
.sb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.sb { background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 10px 6px; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.05); }
.sb b { display: block; font-size: 30px; color: var(--brand); }
.sb small { display: block; font-family: var(--font-cn); color: var(--muted); font-size: 14px; }
.sb:active { transform: scale(.95); }
.sb.playing { border-color: var(--blue); }

/* Word search */
.ws-grid { display: grid; gap: 4px; margin: 0 auto; max-width: 420px; }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); border-radius: 10px; font-family: var(--font-cn); font-size: clamp(18px, 5vw, 30px); user-select: none; cursor: pointer; }
.ws-cell.sel { background: #fff3c4; border-color: var(--brand-2); }
.ws-cell.found { background: #eafff1; border-color: var(--ok); }
.ws-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.ws-list span { padding: 4px 10px; border-radius: 999px; background: #fff; border: 2px solid var(--line); font-family: var(--font-cn); }
.ws-list span.found { text-decoration: line-through; opacity: .5; }

/* Whack */
.whack-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); max-width: 420px; margin: 0 auto; }
.hole { aspect-ratio: 1; border-radius: 20px; background: #eee3d5; display: grid; place-items: center; font-size: clamp(30px, 9vw, 54px); font-family: var(--font-cn); cursor: pointer; overflow: hidden; }
.hole span { transform: translateY(120%); transition: transform .18s; }
.hole.up span { transform: translateY(0); }
.hole.hit { background: #eafff1; }
.hole.miss { background: #fff0f0; }
.hud { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 10px; }

/* Speaking */
.mic { width: 96px; height: 96px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 44px; display: grid; place-items: center; margin: 12px auto; box-shadow: 0 6px 0 #c23c3c; }
.mic.on { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.heard { text-align: center; font-family: var(--font-cn); font-size: 24px; min-height: 36px; }

/* Wheel */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wheel { width: 280px; height: 280px; border-radius: 50%; position: relative; border: 8px solid #fff; box-shadow: var(--shadow); transition: transform 4s cubic-bezier(.17,.67,.12,1); overflow: hidden; }
.wheel .seg { position: absolute; left: 50%; top: 50%; width: 50%; height: 50%; transform-origin: 0 0; display: flex; align-items: flex-start; justify-content: flex-end; padding: 8px 12px; font-family: var(--font-cn); font-size: 22px; color: #fff; font-weight: 700; }
.pointer { width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--ink); margin-bottom: -10px; z-index: 2; }

/* Bingo / printables */
.bingo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 420px; margin: 0 auto; }
.bingo .cell { aspect-ratio: 1; display: grid; place-items: center; background: #fff; border: 2px solid var(--ink); font-family: var(--font-cn); font-size: clamp(22px, 6vw, 36px); cursor: pointer; border-radius: 8px; }
.bingo .cell.on { background: #fff3c4; }
.trace-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.trace-cell { aspect-ratio: 1; border: 1px solid #999; display: grid; place-items: center; font-family: var(--font-cn); font-size: clamp(24px, 6vw, 44px); color: #cfcfcf; background-image: linear-gradient(to right, transparent 49.5%, #eee 49.5%, #eee 50.5%, transparent 50.5%), linear-gradient(to bottom, transparent 49.5%, #eee 49.5%, #eee 50.5%, transparent 50.5%); }
.trace-cell.solid { color: #333; }
.trace-row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.trace-row .lead { text-align: center; }
.trace-row .lead b { font-family: var(--font-cn); font-size: 30px; display: block; }
.print-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.print-card { border: 2px dashed #999; border-radius: 12px; padding: 18px; text-align: center; }
.print-card .h { font-family: var(--font-cn); font-size: 64px; }
.print-card .i { font-size: 40px; }

/* Settings modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 24px; padding: 20px; width: min(460px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 12px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting select, .setting input[type=range] { font-size: 16px; }
.switch { width: 52px; height: 30px; border-radius: 999px; background: #ddd; position: relative; }
.switch.on { background: var(--ok); }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on i { left: 25px; }

/* Toast + confetti */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 12px; height: 12px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .7; } }

.sticker-shelf { display: flex; flex-wrap: wrap; gap: 8px; }
.sticker { width: 58px; height: 58px; border-radius: 16px; background: #fff; display: grid; place-items: center; font-size: 32px; box-shadow: 0 3px 0 rgba(0,0,0,.06); }
.sticker.locked { filter: grayscale(1); opacity: .35; }

.empty { text-align: center; color: var(--muted); padding: 30px; }
.kbd-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.vocab-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vocab-item { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 8px 10px; box-shadow: 0 3px 0 rgba(0,0,0,.05); cursor: pointer; }
.vocab-item .i { font-size: 28px; }
.vocab-item .h { font-family: var(--font-cn); font-size: 24px; font-weight: 500; }
.vocab-item .p { font-size: 13px; color: var(--brand); }
.vocab-item .e { font-size: 12px; color: var(--muted); }

@media (min-width: 700px) {
  .view { padding: 24px 20px 90px; }
  .hero h1 { font-size: 36px; }
  .stage { padding: 26px; }
  .mem-grid { max-width: 600px; }
}
@media print {
  .topbar, .btn, .no-print, .act-head, .act-prog { display: none !important; }
  body { background: #fff; }
  .stage { box-shadow: none; border: 0; }
  .view { padding: 0; max-width: none; }
}

.writer-box svg { display: block; touch-action: none; }
