:root {
  --paper: #f4eee2;
  --paper-2: #ebe3d2;
  --card: #fffdf8;
  --ink: #23211d;
  --ink-2: #5d574c;
  --ink-3: #8f877a;
  --line: #e2d8c4;
  --teal: #1f5f5b;
  --teal-2: #2b7d77;
  --gold: #d49a2a;
  --gold-soft: #f6e3b6;
  --green: #2f9e5b;
  --green-soft: #dff3e6;
  --red: #cf4a3c;
  --red-soft: #fbe3df;
  --blue: #3b7dd8;
  --light-sq: #efe0c3;
  --dark-sq: #b38a5f;
  --accent: var(--teal);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 45, 20, .06), 0 6px 24px rgba(60, 45, 20, .08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; background-image: radial-gradient(circle at 15% 0%, #faf6ee 0, transparent 45%), radial-gradient(circle at 100% 30%, #efe6d4 0, transparent 40%); }
a { color: var(--teal); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: rgba(244, 238, 226, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45 45'%3E%3Cpath d='M14 36 C13.8 29 16.5 25.5 18.6 21.4 C16.8 22.8 15.2 23.4 13.9 23.7 L11.6 24.9 C10 25.6 8.4 24 9.1 22.3 L11.3 17 C13 13.6 15 11.2 17.1 9.6 L18.6 6 L20.2 8.7 C23.6 8.2 27 10.2 29 13.5 C31.6 17.8 32.6 24.6 32.4 36 Z' fill='%23f6efe1'/%3E%3C/svg%3E") center/80% no-repeat; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.brand-text { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.brand-text em { font-style: italic; font-weight: 400; color: var(--teal); }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.nav a:hover { background: var(--paper-2); }
.nav a.on { background: var(--ink); color: #fff; }
.stats { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14px; white-space: nowrap; }
.pill .ic { font-size: 15px; }
.pill.streak.cold { opacity: .55; filter: grayscale(1); }
.lvl { display: flex; align-items: center; gap: 8px; }
.lvl-badge { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; }
.lvl-info { display: flex; flex-direction: column; min-width: 120px; }
.lvl-info b { font-size: 13px; line-height: 1.1; }
.bar { height: 7px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: 3px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e8b84b); border-radius: inherit; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
#view { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- path / home ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-main { padding: 26px 28px; position: relative; overflow: hidden; }
.hero-main h1 { font-size: 32px; line-height: 1.15; margin-bottom: 8px; }
.hero-main p { color: var(--ink-2); margin: 0 0 18px; max-width: 46ch; }
.hero-main .deco { position: absolute; right: -20px; bottom: -30px; width: 190px; opacity: .1; pointer-events: none; }
.hero-side { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.goal { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--paper-2) 0); flex: none; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.principle { text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--paper); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.principle b { display: block; font-family: var(--serif); font-size: 20px; color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 22px; font-weight: 800; font-size: 15px; letter-spacing: .01em; background: var(--teal); color: #fff; box-shadow: 0 3px 0 #123c39; transition: transform .08s, filter .15s; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #123c39; }
.btn.gold { background: var(--gold); box-shadow: 0 3px 0 #9a6c12; }
.btn.green { background: var(--green); box-shadow: 0 3px 0 #1d6b3c; }
.btn.red { background: var(--red); box-shadow: 0 3px 0 #8e2d23; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--paper); }
.btn.sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

.chapter { margin: 0 0 34px; }
.ch-head { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--radius); color: #fff; background: var(--c); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.ch-head::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,255,255,.12), transparent 55%); pointer-events: none; }
.ch-icon { width: 54px; height: 54px; border-radius: 14px; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 30px; flex: none; }
.ch-icon svg { width: 42px; height: 42px; }
.ch-head h2 { font-size: 22px; }
.ch-head .kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .85; font-weight: 700; }
.ch-head .tag { opacity: .9; font-size: 14px; }
.ch-prog { margin-left: auto; text-align: right; font-weight: 800; font-size: 14px; }
.ch-prog .bar { width: 120px; background: rgba(255,255,255,.25); }
.ch-prog .bar > i { background: #fff; }
.ch-head.locked { filter: grayscale(.85); opacity: .7; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; }
.lesson { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 14px; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; color: var(--ink); }
.lesson:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 2px 3px rgba(60,45,20,.06), 0 12px 30px rgba(60,45,20,.12); }
.lesson:disabled { opacity: .5; cursor: not-allowed; }
.node { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; background: var(--paper-2); color: var(--ink-2); border: 3px solid transparent; font-size: 15px; }
.lesson.next .node { background: var(--c); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); animation: pulse 2s infinite; }
.lesson.done .node { background: var(--c); color: #fff; }
.lesson.boss .node { border-radius: 12px; }
.lesson h3 { font-size: 16px; font-family: var(--sans); font-weight: 750; margin-bottom: 2px; }
.lesson p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.lesson .meta { margin-top: 6px; font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 14px; }
.stars .off { color: #d9cfbd; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c) 8%, transparent); } }
.missing { padding: 16px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--ink-3); font-size: 14px; margin-top: 14px; }

/* ---------- lesson player ---------- */
.player { display: grid; grid-template-columns: minmax(300px, 600px) minmax(320px, 1fr); gap: 26px; align-items: start; }
.player-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper-2); font-size: 20px; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.x:hover { background: var(--line); }
.progress { flex: 1; height: 14px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff)); border-radius: inherit; transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.combo { font-weight: 800; color: var(--gold); min-width: 90px; text-align: right; font-size: 15px; transition: transform .2s; }
.combo.bump { transform: scale(1.25); }
.board-col { position: sticky; top: 76px; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; box-shadow: 0 0 0 6px #6b4f33, 0 0 0 7px #4d3823, 0 14px 40px rgba(50, 30, 10, .28); user-select: none; -webkit-user-select: none; touch-action: none; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; border-radius: 4px; overflow: hidden; }
.sq { position: relative; }
.sq.light { background: var(--light-sq); }
.sq.dark { background: var(--dark-sq); }
.sq .pc { position: absolute; inset: 4%; width: 92%; height: 92%; z-index: 2; cursor: grab; filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, .28)); }
.sq .co { position: absolute; font-size: 11px; font-weight: 800; z-index: 1; opacity: .75; pointer-events: none; }
.sq.light .co { color: var(--dark-sq); }
.sq.dark .co { color: var(--light-sq); }
.co-r { left: 3px; top: 2px; }
.co-f { right: 4px; bottom: 1px; }
.sq.last::before, .sq.sel::before, .sq.check::before, .sq[class*="mk-"]::before, .sq.picked::before, .sq.ok::before, .sq.bad::before, .sq.miss::before { content: ""; position: absolute; inset: 0; z-index: 0; }
.sq.last::before { background: rgba(232, 196, 64, .42); }
.sq.sel::before { background: rgba(31, 95, 91, .5); }
.sq.check::before { background: radial-gradient(circle, rgba(230, 40, 30, .9) 0, rgba(230, 40, 30, .45) 45%, transparent 72%); }
.sq.mk-green::before { background: rgba(47, 158, 91, .55); }
.sq.mk-red::before { background: rgba(214, 69, 69, .55); }
.sq.mk-yellow::before { background: rgba(240, 190, 40, .6); }
.sq.mk-blue::before { background: rgba(59, 125, 216, .5); }
.sq.picked::before { background: rgba(59, 125, 216, .6); box-shadow: inset 0 0 0 3px rgba(255,255,255,.7); }
.sq.ok::before { background: rgba(47, 158, 91, .7); }
.sq.bad::before { background: rgba(214, 69, 69, .7); }
.sq.miss::before { background: rgba(240, 190, 40, .75); animation: blink .5s 3; }
.sq.tgt::after { content: ""; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 50, 45, .32); z-index: 3; pointer-events: none; }
.sq.tgt-cap::after { content: ""; position: absolute; inset: 3%; border-radius: 50%; border: 5px solid rgba(20, 50, 45, .32); z-index: 3; pointer-events: none; }
@keyframes blink { 50% { opacity: .3; } }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.promo { position: absolute; inset: 30% 10%; z-index: 20; background: var(--card); border-radius: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.promo button { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; }
.promo button:hover { background: var(--gold-soft); }
.board-wrap.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.board-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--ink-2); gap: 10px; flex-wrap: wrap; }
.turn-dot { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.turn-dot i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; }
.turn-dot i.w { background: #fff; }
.turn-dot i.b { background: var(--ink); }

.panel { display: flex; flex-direction: column; gap: 14px; min-height: 420px; }
.step-card { padding: 24px 26px; display: flex; flex-direction: column; gap: 14px; animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.step-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.step-kind .skill { color: var(--ink-3); letter-spacing: .06em; }
.step-card h2 { font-size: 25px; line-height: 1.2; }
.step-card .prompt { font-size: 18px; line-height: 1.5; font-weight: 600; }
.step-card .text { font-size: 16.5px; line-height: 1.6; color: var(--ink); }
.step-card .text b { color: var(--teal); }
.book-ref { font-size: 12px; color: var(--ink-3); font-style: italic; }
.options { display: grid; gap: 10px; }
.opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 600; display: flex; gap: 12px; align-items: center; transition: border-color .12s, background .12s; color: var(--ink); }
.opt:hover:not(:disabled) { border-color: var(--teal-2); background: #f7fbfa; }
.opt .k { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--paper-2); font-size: 13px; font-weight: 800; flex: none; color: var(--ink-2); }
.opt.on { border-color: var(--blue); background: #eef4fd; }
.opt.on .k { background: var(--blue); color: #fff; }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.count-row { display: flex; gap: 10px; align-items: center; }
.count-row input { width: 120px; font: 800 26px var(--sans); padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-align: center; }
.count-row input:focus { outline: none; border-color: var(--teal-2); }
.stepper { width: 46px; height: 50px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 22px; font-weight: 800; color: var(--ink-2); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.actions .spacer { flex: 1; }
.feedback { border-radius: 14px; padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; animation: rise .3s; font-size: 15.5px; line-height: 1.5; }
.feedback .fi { font-size: 22px; line-height: 1; }
.feedback b.t { display: block; font-size: 17px; margin-bottom: 2px; }
.feedback.good { background: var(--green-soft); color: #174d2e; }
.feedback.bad { background: var(--red-soft); color: #7a241b; }
.feedback.info { background: var(--gold-soft); color: #6b4a0b; }
.feedback.neutral { background: var(--paper); color: var(--ink-2); }
.movelist { font: 600 14px/1.8 ui-monospace, "SF Mono", Menlo, monospace; background: var(--paper); border-radius: 12px; padding: 10px 14px; max-height: 150px; overflow: auto; color: var(--ink-2); }
.movelist .cur { background: var(--ink); color: #fff; border-radius: 5px; padding: 1px 5px; }
.movelist .num { color: var(--ink-3); margin-left: 4px; }
.demo-nav { display: flex; gap: 8px; align-items: center; }
.note { background: var(--paper); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 15px; color: var(--ink); min-height: 44px; }
.goal-box { display: flex; gap: 14px; align-items: center; background: var(--paper); border-radius: 12px; padding: 12px 16px; font-weight: 700; }
.goal-box .big { font: 800 26px var(--sans); color: var(--accent); }
.xp-float { position: fixed; z-index: 50; font-weight: 900; color: var(--gold); font-size: 22px; pointer-events: none; animation: floatup 1.1s ease-out forwards; text-shadow: 0 2px 0 #fff; }
@keyframes floatup { to { transform: translateY(-60px); opacity: 0; } }

/* ---------- results ---------- */
.result { max-width: 560px; margin: 30px auto; padding: 36px 34px; text-align: center; }
.result h1 { font-size: 34px; margin: 10px 0 6px; }
.result .big-stars { font-size: 54px; letter-spacing: 8px; color: var(--gold); }
.result .big-stars span { display: inline-block; animation: pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.result .big-stars span.off { color: #ddd3c1; }
.result .big-stars span:nth-child(2) { animation-delay: .18s; }
.result .big-stars span:nth-child(3) { animation-delay: .36s; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.result-grid div { background: var(--paper); border-radius: 12px; padding: 12px 6px; font-size: 12px; color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.result-grid b { display: block; font: 800 24px var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0; }
.takeaway { text-align: left; background: var(--paper); border-radius: 12px; padding: 14px 16px; font-size: 15px; margin-bottom: 20px; }
.badge-new { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--gold-soft); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; animation: rise .4s .6s both; }

/* ---------- profile / practice / arena ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.section-title { font-size: 24px; margin: 0 0 14px; }
.pad { padding: 22px 24px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { padding: 14px 10px; border-radius: 14px; background: var(--paper); text-align: center; border: 1px solid var(--line); }
.badge .bi { font-size: 30px; display: block; }
.badge b { display: block; font-size: 13px; margin-top: 4px; }
.badge small { color: var(--ink-3); font-size: 11.5px; line-height: 1.3; display: block; margin-top: 2px; }
.badge.locked { opacity: .45; filter: grayscale(1); }
.radar text { font: 700 11px var(--sans); fill: var(--ink-2); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; font-size: 15px; }
.kv b { text-align: right; }
.practice-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.mode .mi { font-size: 34px; }
.mode h3 { font-size: 20px; }
.mode p { margin: 0 0 8px; color: var(--ink-2); font-size: 14.5px; flex: 1; }
.arena { display: grid; grid-template-columns: minmax(300px, 600px) minmax(300px, 1fr); gap: 26px; align-items: start; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.levels button { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 4px; font-weight: 700; font-size: 12px; color: var(--ink-2); }
.levels button svg { width: 34px; height: 34px; display: block; margin: 0 auto 2px; }
.levels button.on { border-color: var(--teal); background: #eef7f6; color: var(--ink); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 7px 14px; font-weight: 700; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.meters { display: grid; gap: 12px; }
.meter { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.meter .dual { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--paper-2); position: relative; }
.meter .dual i { display: block; height: 100%; }
.meter .dual .w { background: #f3efe6; box-shadow: inset 0 0 0 1px #cfc5b3; border-radius: 99px 0 0 99px; transition: width .4s; }
.meter .dual::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--gold); }
.meter .dual .b { background: #3a3842; border-radius: 0 99px 99px 0; transition: width .4s; }
.meter .vals { grid-column: 2; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: -6px; }
.checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; }
.checklist li::before { content: "◆"; color: var(--gold); font-size: 10px; margin-top: 5px; }
.coach { font-size: 15px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--teal); }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; animation: rise .35s; max-width: 340px; }
.toast .ti { font-size: 26px; }
.toast small { display: block; opacity: .75; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; width: 100%; height: 100%; }
.modal-bg { position: fixed; inset: 0; background: rgba(30, 25, 15, .45); z-index: 80; display: grid; place-items: center; animation: fade .2s; padding: 20px; }
.modal { max-width: 440px; width: 100%; padding: 26px; }
@keyframes fade { from { opacity: 0; } }
kbd { font: 700 11px var(--sans); background: var(--paper-2); border-radius: 5px; padding: 1px 6px; border: 1px solid var(--line); }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding: 8px 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .lvl-info { display: none; }
  #view { padding: 18px 14px 70px; }
  .hero, .grid2, .practice-modes { grid-template-columns: 1fr; }
  .player, .arena { grid-template-columns: 1fr; gap: 16px; }
  .board-col { position: static; max-width: 520px; margin: 0 auto; width: 100%; }
  .step-card { padding: 18px; }
  .ch-prog .bar { width: 70px; }
}
@media (min-width: 901px) {
  .board-col .board-wrap { max-width: max(320px, calc(100vh - 170px)); margin: 0 auto; }
  .board-col .board-foot { max-width: max(320px, calc(100vh - 170px)); margin-left: auto; margin-right: auto; }
}
