/* One More Clue v2. Mobile first, tactile 3D (CSS only), cream / ink / yellow brand. */
@font-face {
  font-family: Outfit;
  src: url('assets/fonts/Outfit-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #222b34;
  --ink-2: #263440;
  --muted: #66655e;
  --soft: #6b665b;
  --paper: #fbf8f0;
  --sand: #f2eee5;
  --card: #fffdf7;
  --line: #e7e1d5;
  --green: #557f4b;
  --green-d: #3f6337;
  --amber: #dda727;
  --amber-d: #b2831a;
  --grey: #6f7276;
  --grey-d: #55585c;
  --yellow: #ffd866;
  --yellow-d: #e2b23f;
  --focus: #285fb9;
  --g1: #f2cf5b; --g1-d: #c9a43a;
  --g2: #93c47d; --g2-d: #6c9a58;
  --g3: #8db8e8; --g3-d: #6491c4;
  --g4: #b99be3; --g4-d: #9174bf;
  --gutter: 18px;
  --gap: 6px;
  --chrome: 546px;
  --key-h: 47px;
  font-family: Outfit, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--sand);
}
[data-contrast=true] {
  --green: #2f62a3; --green-d: #1f467a;
  --amber: #f0a33c; --amber-d: #b8741b;
  --grey: #5f646d; --grey-d: #464a51;
  --g1: #f5c542; --g2: #4fa3e0; --g2-d: #2f7cb5; --g3: #f08c3c; --g3-d: #b9631f; --g4: #8a6fd1;
}

* { box-sizing: border-box; }
body {
  margin: 0; min-width: 300px; overscroll-behavior-y: none;
  background: radial-gradient(ellipse at 15% 10%, #fbf5e2 0, transparent 55%), radial-gradient(ellipse at 90% 90%, #efe7d4 0, transparent 50%), var(--sand);
}
button, a, input { -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
svg { fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; width: 22px; height: 22px; flex-shrink: 0; }
[hidden] { display: none !important; }
.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 20; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ shell */
.app-shell { width: min(100%, 520px); margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; background: var(--paper); position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px var(--gutter) 8px; min-height: 58px; }
.wordmark { text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -1px; white-space: nowrap; text-shadow: 0 1px 0 #fff, 0 2px 0 #e9e1cf; }
.wordmark span { color: #c39420; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 3px 10px 3px 4px; border-radius: 99px;
  border: 1px solid #e4dccb; background: var(--card); box-shadow: 0 2px 0 #e2d8c4; font-weight: 700; font-size: 14px;
}
.chip:active { transform: translateY(1px); box-shadow: 0 1px 0 #e2d8c4; }
.level-ring { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #fff;
  background: conic-gradient(var(--green) calc(var(--xp, 0) * 1%), #d9d2c2 0); position: relative; }
.level-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--ink-2); }
.level-ring b { position: relative; }
.coin-ico, .coin-mini { width: 20px; height: 20px; border-radius: 50%; display: inline-block; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #ffcf3d 40%, #e0950f 100%); box-shadow: inset 0 0 0 2px #f7c33b, inset 0 0 0 3px #b8700a, 0 1px 0 #9a5d06; }
.coin-mini { width: 16px; height: 16px; vertical-align: -3px; }
.zmini { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 900; color: #8a4700; font-style: normal;
  background: radial-gradient(circle at 35% 30%, #fff4b0, #ffd23f 45%, #ec930f); box-shadow: inset 0 0 0 1.5px #a35a06; vertical-align: -3px; }
#app { flex: 1; min-width: 0; outline: none; padding-bottom: 8px; }
.boot { padding: 40px 26px; text-align: center; color: var(--soft); }
.boot h1 { font-size: 22px; color: var(--ink); }
.boot-links { font-size: 14px; line-height: 2; }

.bottom-nav { display: flex; justify-content: space-around; position: sticky; bottom: 0; z-index: 5; background: #fbf8f0f2; border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); }
.bottom-nav button { background: none; border: 0; min-width: 70px; min-height: 48px; display: grid; justify-items: center; align-content: center; gap: 3px;
  font-size: 12px; color: #6a6d70; position: relative; border-radius: 12px; padding: 4px 8px; }
.bottom-nav button svg { width: 22px; height: 22px; stroke-width: 2.2; }
.bottom-nav button[aria-current] { color: var(--ink); font-weight: 700; }
.bottom-nav button[aria-current]::after { content: ''; position: absolute; bottom: 0; width: 34px; height: 3px; border-radius: 3px; background: #d6a02b; }

/* ------------------------------------------------------------------ 3D buttons and cards */
.btn3d {
  --face: var(--yellow); --edge: var(--yellow-d); --text: #252d36;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 20px;
  border: 0; border-radius: 16px; background: linear-gradient(180deg, color-mix(in srgb, var(--face) 80%, #fff), var(--face));
  color: var(--text); font-weight: 750; font-size: 17px; letter-spacing: -.2px; text-decoration: none;
  box-shadow: inset 0 1px 0 #ffffff80, 0 5px 0 var(--edge), 0 9px 16px #4a3a1426; transform: translateY(0);
  transition: transform .07s ease, box-shadow .07s ease, filter .1s ease;
}
.btn3d:hover:not(:disabled) { filter: brightness(1.03); }
.btn3d:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 1px 0 #ffffff80, 0 1px 0 var(--edge), 0 3px 8px #4a3a1420; }
.btn3d:disabled { filter: grayscale(.6) opacity(.65); }
.btn3d.ink { --face: #2b3a47; --edge: #131c25; --text: #fff; }
.btn3d.green { --face: #64945a; --edge: #3d6434; --text: #fff; }
.btn3d.white { --face: #fffdf6; --edge: #ddd3c0; --text: var(--ink); }
.btn3d.small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; box-shadow: inset 0 1px 0 #ffffff80, 0 4px 0 var(--edge), 0 6px 10px #4a3a1420; }
.btn3d.wide { width: 100%; }
.btn3d svg { width: 20px; height: 20px; }
.text-btn { border: 0; background: none; padding: 8px 4px; font-size: 14px; color: #5e5642; text-decoration: underline; text-underline-offset: 4px; }

.card3d { background: var(--card); border: 1px solid #ebe3d2; border-radius: 20px; box-shadow: 0 2px 0 #e6dcc8, 0 10px 24px #5c48200f; }

/* ------------------------------------------------------------------ home */
.home { padding: 4px var(--gutter) 18px; display: grid; gap: 14px; }
.hero { padding: 18px; display: grid; gap: 12px; position: relative; overflow: hidden; text-align: left;
  background: linear-gradient(135deg, #2b3a47, #1c2731); color: #fff; border: 0; box-shadow: 0 5px 0 #121a22, 0 14px 30px #1c273140; }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 40px; transform: rotate(25deg);
  background: repeating-linear-gradient(90deg, #ffffff10 0 34px, transparent 34px 40px); pointer-events: none; }
.hero .eyebrow { color: #f3d27a; }
.hero h2 { margin: 0; font-size: 26px; letter-spacing: -.6px; }
.hero p { margin: 0; color: #cfd6dc; font-size: 14px; }
.hero .progress { height: 10px; border-radius: 10px; background: #ffffff1f; overflow: hidden; }
.hero .progress i { display: block; height: 100%; background: linear-gradient(90deg, #ffd866, #f3b93a); border-radius: 10px; }
.eyebrow { font-size: 11px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; color: #6c6963; margin: 0; }
.daily-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.daily-card { padding: 14px; display: grid; gap: 8px; text-align: left; border: 1px solid #ebe3d2; position: relative; min-height: 150px; align-content: start; }
.daily-card:active { transform: translateY(2px); box-shadow: 0 0 0 #e6dcc8, 0 4px 12px #5c48200f; }
.daily-card h3 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.daily-card .status { font-size: 13px; color: var(--muted); }
.daily-card .done { color: var(--green-d); font-weight: 700; }
.mini-tiles { display: flex; gap: 4px; }
.mini-tiles i { width: 20px; height: 20px; border-radius: 5px; background: #e9e2d2; box-shadow: 0 2px 0 #d3c9b4; }
.mini-tiles i.g { background: var(--green); box-shadow: 0 2px 0 var(--green-d); }
.mini-tiles i.a { background: var(--amber); box-shadow: 0 2px 0 var(--amber-d); }
.mini-grid { display: grid; grid-template-columns: repeat(4, 12px); gap: 3px; }
.mini-grid i { width: 12px; height: 12px; border-radius: 3px; }
.mini-grid i:nth-child(-n+4) { background: var(--g1); } .mini-grid i:nth-child(n+5):nth-child(-n+8) { background: var(--g2); }
.mini-grid i:nth-child(n+9):nth-child(-n+12) { background: var(--g3); } .mini-grid i:nth-child(n+13) { background: var(--g4); }
.chest-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; width: 100%; text-align: left; border: 1px solid #ebe3d2; }
.chest-card.open { background: linear-gradient(120deg, #fff6d6, #fffdf7); border-color: #f1d98a; }
.chest-ico { width: 46px; height: 40px; position: relative; flex-shrink: 0; }
.chest-ico::before { content: ''; position: absolute; inset: 12px 0 0; border-radius: 6px; background: linear-gradient(#b8742e, #8f5420); box-shadow: inset 0 0 0 3px #e7b34c, 0 3px 0 #6b3d15; }
.chest-ico::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 18px; border-radius: 10px 10px 4px 4px; background: linear-gradient(#c98a3c, #a2622a); box-shadow: inset 0 0 0 3px #e7b34c; }
.chest-card.open .chest-ico { animation: chest-wiggle 1.6s ease-in-out infinite; }
.chest-card b { display: block; font-size: 15px; }
.chest-card small { color: var(--muted); font-size: 13px; }
.promo { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 14px; text-align: left; width: 100%; border: 1px solid #d8e6f5; background: linear-gradient(120deg, #eef6ff, #fffdf7); }
.promo img { width: 84px; height: auto; }
.promo b { display: block; font-size: 15px; }
.promo small { color: #4c5a68; font-size: 13px; line-height: 1.4; }
.countdown { text-align: center; font-size: 13px; color: var(--muted); }
.links-row { display: flex; justify-content: center; gap: 8px 18px; flex-wrap: wrap; font-size: 14px; }

/* ------------------------------------------------------------------ game screens */
.game { padding: 0 var(--gutter) 6px; --extra: 0px;
  --tile: clamp(34px, min(calc((100svh - var(--chrome) - var(--extra)) / 6), calc((100vw - 2 * var(--gutter) - 4 * var(--gap)) / 5)), 58px); }
.game[data-clues="1"] { --extra: 50px; }
.game[data-clues="2"] { --extra: 100px; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 8px; }
.back { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; box-shadow: 0 2px 0 #e2d8c4; padding: 0; }
.game-title { text-align: center; flex: 1; }
.game-title h1 { margin: 0; font-size: 13px; letter-spacing: 1.8px; text-transform: uppercase; color: #5f615f; font-weight: 750; }
.game-title p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.head-side { min-width: 38px; display: flex; justify-content: flex-end; }

.clue-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 15px; margin-bottom: 8px; }
.clue-bulb svg { width: 28px; height: 28px; fill: #ffd467; stroke-width: 1.7; stroke: #664f1e; margin-top: 2px; }
.clue-body { flex: 1; min-width: 0; }
.first-clue { font-size: 16px; line-height: 1.4; font-weight: 550; margin: 2px 0 0; }
.extra-clue { border-top: 1px dashed #e3d9c3; padding-top: 7px; margin-top: 8px; outline: none; }
.extra-clue h3 { font-size: 11px; letter-spacing: 1px; font-weight: 750; color: #6f5a32; margin: 0; text-transform: uppercase; }
.extra-clue p { font-size: 14px; line-height: 1.45; margin: 2px 0 0; }
.extra-clue.unused { opacity: .75; }
.just-revealed { animation: clue-in .35s cubic-bezier(.2, 1.4, .4, 1); }

.status-line { min-height: 26px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.status-line .stars { color: #d8a22b; letter-spacing: 1px; font-size: 15px; }
.status-line .stars span { color: #ddd5c2; }

/* the word board: a slightly tilted 3D table */
.board-stage { perspective: 900px; display: flex; justify-content: center; margin: 2px 0 12px; }
.board { display: grid; gap: var(--gap); transform: rotateX(7deg); transform-style: preserve-3d; padding-bottom: 6px; }
.board-row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: var(--gap); position: relative; transform-style: preserve-3d; }
.tile {
  width: var(--tile); height: var(--tile); display: grid; place-items: center; position: relative; user-select: none; -webkit-user-select: none;
  border-radius: 10px; font-size: calc(var(--tile) * .56); font-weight: 750; line-height: 1;
  background: linear-gradient(180deg, #fffdf8, #f6f1e5); border: 2px solid #ddd6c8; box-shadow: 0 4px 0 #d8d0bf, 0 6px 10px #4a3a140f;
}
.tile.filled { border-color: #2a3440; box-shadow: 0 4px 0 #2a3440, 0 7px 12px #2a344020; animation: tile-pop .12s ease-out; }
.tile.correct { background: linear-gradient(180deg, color-mix(in srgb, var(--green) 85%, #fff), var(--green)); border-color: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d), 0 7px 12px #2a344024; }
.tile.present { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 80%, #fff), var(--amber)); border-color: var(--amber); color: #1f252c; box-shadow: 0 4px 0 var(--amber-d), 0 7px 12px #2a344024; }
.tile.absent { background: linear-gradient(180deg, color-mix(in srgb, var(--grey) 85%, #fff), var(--grey)); border-color: var(--grey); color: #fff; box-shadow: 0 4px 0 var(--grey-d), 0 7px 12px #2a344024; }
.tile.hinted { border-style: dashed; border-color: var(--green); color: var(--green-d); }
.tile-symbol { display: none; position: absolute; right: 4px; top: 3px; font-size: max(10px, calc(var(--tile) * .26)); font-weight: 800; }
[data-contrast=true] .tile-symbol { display: block; }
[data-contrast=true] .tile.present { border-style: dashed; border-color: #6b4500; }
.flip { animation: tile-flip .5s ease-in-out both; }
.row-win .tile { animation: tile-bounce .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.row-win .tile:nth-child(3) { animation-delay: .07s; } .row-win .tile:nth-child(4) { animation-delay: .14s; }
.row-win .tile:nth-child(5) { animation-delay: .21s; } .row-win .tile:nth-child(6) { animation-delay: .28s; }
.invalid { animation: shake .4s ease; }
.invalid .tile { border-color: #c0532b; }

.tools { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.clue-btn { flex: 1; min-height: 50px; position: relative; padding-right: 64px; }
.clue-btn .count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #fff5c9; border-radius: 99px; font-size: 12px; padding: 4px 9px; font-weight: 650; }
.booster { min-width: 78px; flex-direction: column; gap: 0; padding: 6px 10px; font-size: 12px; line-height: 1.15; }
.booster b { font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }

/* keyboard: chunky 3D keys, no Enter (a full row checks itself) */
.keyboard { display: grid; gap: 7px; margin: 0 -6px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.key-row { display: flex; justify-content: center; gap: 5px; }
.key-row.mid { padding: 0 4.5%; }
.key {
  flex: 1; max-width: 46px; min-width: 0; height: var(--key-h); border: 0; border-radius: 9px; padding: 0; display: grid; place-items: center;
  font-size: 18px; font-weight: 650; color: var(--ink); background: linear-gradient(180deg, #fffcf4, #efe8da);
  box-shadow: inset 0 1px 0 #fff, 0 4px 0 #cfc5b2, 0 6px 8px #4a3a1414; transition: transform .05s ease, box-shadow .05s ease;
}
.key:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #cfc5b2; }
.key.wide { flex: 1.7; max-width: 76px; }
.key.correct { background: linear-gradient(180deg, color-mix(in srgb, var(--green) 85%, #fff), var(--green)); color: #fff; box-shadow: 0 4px 0 var(--green-d); }
.key.present { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 80%, #fff), var(--amber)); color: #1f252c; box-shadow: 0 4px 0 var(--amber-d); }
.key.absent { background: linear-gradient(180deg, #8c8f93, var(--grey)); color: #fff; box-shadow: 0 4px 0 var(--grey-d); opacity: .85; }
.key:disabled { cursor: default; }
.key svg { width: 24px; height: 24px; }

.after-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

/* ------------------------------------------------------------------ groups */
.groups-wrap { padding: 0 var(--gutter) 10px; }
.mistakes { display: flex; justify-content: center; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-height: 28px; }
.mistakes i { width: 13px; height: 13px; border-radius: 50%; background: #2b3a47; box-shadow: 0 2px 0 #131c25; }
.mistakes i.used { background: #dcd4c3; box-shadow: none; }
.group-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; perspective: 900px; margin: 6px 0 12px; }
.solved-bar { grid-column: 1 / -1; border-radius: 14px; padding: 10px 8px; text-align: center; min-height: 64px; display: grid; align-content: center; gap: 2px;
  box-shadow: 0 4px 0 var(--edge), 0 8px 14px #4a3a141a; animation: bar-in .45s cubic-bezier(.2, 1.3, .4, 1) both; color: #1f252c; }
.solved-bar b { font-size: 14px; letter-spacing: .6px; text-transform: uppercase; }
.solved-bar span { font-size: 13px; }
.lv1 { background: var(--g1); --edge: var(--g1-d); } .lv2 { background: var(--g2); --edge: var(--g2-d); }
.lv3 { background: var(--g3); --edge: var(--g3-d); } .lv4 { background: var(--g4); --edge: var(--g4-d); }
.word-tile {
  min-height: clamp(60px, calc((100svh - 420px) / 4 - 8px), 86px); border: 0; border-radius: 12px; padding: 4px 3px; display: grid; place-items: center; text-align: center;
  font-weight: 750; font-size: clamp(11px, 3.4vw, 15px); letter-spacing: .2px; color: var(--ink); overflow-wrap: anywhere; hyphens: auto; line-height: 1.05; min-width: 0;
  background: linear-gradient(180deg, #fffcf4, #efe7d6); box-shadow: inset 0 1px 0 #fff, 0 4px 0 #cfc5b2, 0 7px 10px #4a3a1414;
  transition: transform .08s ease, background .12s ease, box-shadow .08s ease;
}
.word-tile[aria-pressed=true] { background: linear-gradient(180deg, #3a4b59, #263440); color: #fff; box-shadow: 0 2px 0 #111a22; transform: translateY(2px); }
.word-tile.hint { outline: 2px dashed var(--amber); outline-offset: -4px; }
.word-tile.wrong { animation: shake .4s ease; }
.word-tile.lift { animation: lift .3s ease; }
.group-tools { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ------------------------------------------------------------------ journey map */
.journey { padding: 0 var(--gutter) 20px; }
.journey-top { padding: 16px; display: grid; gap: 10px; margin-bottom: 8px; }
.journey-top h2 { margin: 0; font-size: 22px; }
.xpbar { height: 12px; border-radius: 12px; background: #ebe3d2; overflow: hidden; box-shadow: inset 0 2px 3px #0000000d; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #74a868, var(--green)); border-radius: 12px; }
.map { display: grid; position: relative; }
.chapter-head { text-align: center; margin: 14px 0 4px; }
.chapter-head b { display: inline-block; background: #2b3a47; color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 13px; letter-spacing: .5px; box-shadow: 0 3px 0 #131c25; }
.node-row { display: flex; height: 76px; align-items: center; }
.node { width: 60px; height: 60px; border-radius: 50%; border: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; position: relative; padding: 0;
  background: radial-gradient(circle at 35% 30%, #fffdf7, #ece4d2); color: #a59c86; box-shadow: 0 5px 0 #cdc2ab, 0 9px 14px #4a3a141c; }
.node.done { background: radial-gradient(circle at 35% 30%, #a6d295, var(--green)); color: #fff; box-shadow: 0 5px 0 var(--green-d), 0 9px 14px #4a3a141c; }
.node.current { background: radial-gradient(circle at 35% 30%, #fff1b3, var(--yellow)); color: var(--ink); box-shadow: 0 5px 0 var(--yellow-d), 0 0 0 6px #ffd86655, 0 9px 14px #4a3a1426; animation: node-pulse 1.8s ease-in-out infinite; }
.node.groups::after { content: ''; position: absolute; right: -2px; top: -2px; width: 18px; height: 18px; border-radius: 5px;
  background: conic-gradient(var(--g1) 0 25%, var(--g2) 0 50%, var(--g3) 0 75%, var(--g4) 0); box-shadow: 0 2px 0 #0000002a; }
.node.finale { width: 72px; height: 72px; }
.node .badge { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 99px; font-size: 11px; padding: 2px 7px; box-shadow: 0 2px 0 #ddd3c0; color: var(--ink); white-space: nowrap; display: inline-flex; gap: 3px; align-items: center; }

/* ------------------------------------------------------------------ ranks and me */
.page { padding: 4px var(--gutter) 20px; display: grid; gap: 14px; }
.page h1 { font-size: 26px; letter-spacing: -.8px; margin: 6px 0 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: #ece5d6; border-radius: 14px; }
.tabs button { border: 0; border-radius: 10px; min-height: 40px; background: none; font-weight: 650; }
.tabs button[aria-selected=true] { background: var(--card); box-shadow: 0 2px 0 #d8cdb7; }
.board-list { list-style: none; margin: 0; padding: 6px; }
.board-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; font-size: 15px; }
.board-list li:nth-child(odd) { background: #f7f2e7; }
.board-list li.you { background: #fff2c4; font-weight: 700; }
.board-list .rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e5dcc8; font-weight: 800; font-size: 13px; }
.board-list li:nth-child(1) .rank { background: linear-gradient(#ffe27a, #e3ad2b); }
.board-list li:nth-child(2) .rank { background: linear-gradient(#eef1f4, #bfc6cd); }
.board-list li:nth-child(3) .rank { background: linear-gradient(#f2c49b, #c78349); }
.board-list small { color: var(--muted); }
.empty, .board-list li.empty { display: block; text-align: center; color: var(--muted); padding: 22px; font-size: 14px; background: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.stat-grid div { display: flex; flex-direction: column-reverse; align-items: center; background: #f2ecdf; border-radius: 14px; padding: 12px 4px; }
.stat-grid dd { margin: 0; font-size: 24px; font-weight: 700; }
.stat-grid dt { font-size: 11px; color: #5f5e57; text-align: center; }
.profile-card { padding: 16px; display: grid; gap: 12px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-weight: 800; font-size: 26px; color: #fff;
  background: linear-gradient(135deg, #3b4d5c, #222f3b); box-shadow: 0 4px 0 #131c25; flex-shrink: 0; }
.profile-head h2 { margin: 0; font-size: 20px; }
.profile-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.section-title { font-size: 17px; margin: 4px 0 0; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting:last-child { border-bottom: 0; }
.setting small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting input { appearance: none; -webkit-appearance: none; position: relative; width: 48px; height: 28px; margin: 0; flex-shrink: 0; border-radius: 999px; background: #d9d1c0; box-shadow: inset 0 2px 3px rgba(0,0,0,.18); cursor: pointer; transition: background .18s; }
.setting input::before { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.15); transition: transform .18s; }
.setting input:checked { background: var(--green, #557f4b); }
.setting input:checked::before { transform: translateX(20px); }
.setting input:focus-visible { outline: 3px solid #446685; outline-offset: 2px; }
.fineprint { font-size: 12px; line-height: 1.55; color: var(--muted); margin: 0; }
.wallet-line { font-size: 13px; color: var(--muted); word-break: break-all; }
.payout-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.payout-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; background: #f7f2e7; border-radius: 10px; }
.games-list { display: grid; gap: 10px; }
.game-link { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding: 12px; text-decoration: none; }
.game-link img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; background: #f3eee2; }
.game-link b { display: block; font-size: 16px; }
.game-link small { color: var(--muted); font-size: 13px; line-height: 1.4; }

/* ------------------------------------------------------------------ dialogs */
dialog { border: 0; padding: 0; background: transparent; width: min(440px, calc(100% - 22px)); max-height: calc(100svh - 22px); overflow: visible; }
dialog::backdrop { background: #1d242ea6; backdrop-filter: blur(3px); }
.sheet { background: var(--paper); border-radius: 26px; box-shadow: 0 6px 0 #d9cfbb, 0 26px 70px #0e131a59; max-height: calc(100svh - 40px); overflow-y: auto; overscroll-behavior: contain;
  position: relative; padding: 36px 22px 22px; margin-top: 16px; }
.sheet-wrap { position: relative; animation: card-in .45s cubic-bezier(.2, 1.25, .4, 1) both; transform-origin: 50% 0; }
.ribbon { position: absolute; left: 50%; top: 0; transform: translateX(-50%); background: linear-gradient(#3a4b59, #263440); color: #fff;
  padding: 8px 22px; border-radius: 12px; font-weight: 800; font-size: 15px; letter-spacing: .4px; white-space: nowrap; box-shadow: 0 4px 0 #121a22; z-index: 3; }
.ribbon.gold { background: linear-gradient(#ffe27a, #e7ae2b); color: #4d3606; box-shadow: 0 4px 0 #a97b16; }
.ribbon.green { background: linear-gradient(#77a96b, #4f7f45); box-shadow: 0 4px 0 #34572d; }
.sheet-close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; z-index: 2; padding: 0; }
.sheet h2 { margin: 6px 0 10px; font-size: 26px; letter-spacing: -.6px; text-align: center; }
.sheet p { line-height: 1.55; color: #4f5458; font-size: 15px; }
.sheet .center { text-align: center; }
.sheet .actions { display: grid; gap: 10px; margin-top: 14px; }
.notice { background: #e7efdd; color: #334b29; border: 1px solid #cddcbf; padding: 10px 12px; border-radius: 12px; font-size: 13px; margin: 0 0 12px; }
.result-stars { display: flex; justify-content: center; gap: 8px; font-size: 48px; line-height: 1; margin: 6px 0; color: #e2dac8; }
.result-stars .on { color: #e2a92b; text-shadow: 0 3px 0 #b07d12; }
.celebrate .on { animation: star-pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.celebrate .on:nth-child(2) { animation-delay: .12s; } .celebrate .on:nth-child(3) { animation-delay: .24s; }
.answer-word { display: flex; justify-content: center; gap: 6px; margin: 12px 0; perspective: 600px; }
.answer-word span { width: 46px; height: 52px; display: grid; place-items: center; border-radius: 11px; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #7aa66e, var(--green)); box-shadow: 0 5px 0 var(--green-d); animation: tile-flip .5s ease both; }
.answer-word.missed span { background: linear-gradient(180deg, #3a4b59, #263440); box-shadow: 0 5px 0 #121a22; }
.answer-word span:nth-child(2) { animation-delay: .08s; } .answer-word span:nth-child(3) { animation-delay: .16s; }
.answer-word span:nth-child(4) { animation-delay: .24s; } .answer-word span:nth-child(5) { animation-delay: .32s; }
blockquote { margin: 10px 0; padding: 12px 16px; background: #efeade; border-radius: 14px; text-align: center; color: #4d4e41; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.chips span { padding: 6px 12px; background: #eee8dc; border-radius: 99px; font-size: 13px; color: #55534c; display: inline-flex; align-items: center; gap: 5px; }
.gains { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.gain { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 #e2d8c4; font-weight: 800; font-size: 17px; }
.gain.xp { color: #3f6337; }
.levelup { text-align: center; background: linear-gradient(120deg, #fff1b3, #ffe27a); border-radius: 14px; padding: 10px; font-weight: 800; box-shadow: 0 3px 0 #d7ab38; margin: 10px 0; }
.solution { display: grid; gap: 6px; margin: 10px 0; }
.solution div { border-radius: 12px; padding: 8px; text-align: center; box-shadow: 0 3px 0 var(--edge); color: #1f252c; }
.solution b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.solution span { font-size: 13px; }
.share-text { width: 100%; min-height: 150px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; font-size: 16px; background: #fffdf6; resize: vertical; }
.disclaimer { font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* lessons */
.lesson-art { display: grid; place-items: center; min-height: 118px; margin: 4px 0; perspective: 700px; }
.lesson-row { display: flex; gap: 6px; }
.lesson-row .tile, .legend .tile { --tile: 44px; flex-shrink: 0; }
.dots { display: flex; justify-content: center; gap: 7px; margin: 12px 0 4px; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: #d9d1c0; transition: width .2s ease; }
.dots i.on { width: 22px; background: var(--ink-2); }
.legend { display: grid; gap: 10px; text-align: left; }
.legend div { display: flex; gap: 12px; align-items: center; font-size: 15px; }

/* the 3D ZNHB coin (from Crush It) */
.coin-stage { height: 200px; display: grid; place-items: center; perspective: 700px; }
.zcoin { position: relative; width: 140px; height: 140px; transform-style: preserve-3d;
  animation: zdrop .7s cubic-bezier(.2, 1.5, .4, 1) both, zspin 2.6s .7s cubic-bezier(.45, 0, .55, 1) infinite, zbob 1.3s .7s ease-in-out infinite alternate; }
.zcoin i { position: absolute; inset: 0; border-radius: 50%; }
.zcoin .edge { background: linear-gradient(90deg, #8a5a06, #d99a1c 50%, #8a5a06); transform: translateZ(var(--z)); }
.zcoin .face { display: grid; place-items: center; backface-visibility: hidden;
  background: radial-gradient(circle at 35% 30%, #fff6c4, #ffd23f 30%, #f0a417 62%, #b8700a 100%);
  box-shadow: inset 0 0 0 7px #f7c33b, inset 0 0 0 10px #b8700a, inset 0 0 26px #783c0099; }
.zcoin .front { transform: translateZ(7px); }
.zcoin .back { transform: rotateY(180deg) translateZ(7px); }
.zcoin .face b { font-size: 80px; font-weight: 900; color: #fff3b0; text-shadow: 0 2px 0 #b8700a, 0 4px 0 #8a5a06; }
.zshadow { width: 112px; height: 14px; margin-top: -6px; border-radius: 50%; background: radial-gradient(#0000008c, transparent 70%); animation: zshad 1.3s .7s ease-in-out infinite alternate; }

.toast { position: fixed; top: 12px; left: 50%; z-index: 60; transform: translate(-50%, -30px); opacity: 0; pointer-events: none;
  background: #263440; color: #fff; box-shadow: 0 5px 0 #121a22, 0 12px 24px #1c27313d; font-size: 15px; font-weight: 600;
  max-width: calc(100% - 28px); width: max-content; padding: 11px 18px; border-radius: 14px; text-align: center; transition: transform .2s ease, opacity .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }
.nhb-layer { position: fixed; inset: 0; z-index: 50; background: #1d242ecc; display: grid; place-items: center; padding: 12px; }
.nhb-layer .frame-box { width: min(440px, 100%); height: min(680px, calc(100svh - 24px)); background: #fff; border-radius: 22px; overflow: hidden; position: relative; box-shadow: 0 20px 60px #0008; }
.nhb-layer iframe { width: 100%; height: 100%; border: 0; }
.loading-dots { display: flex; justify-content: center; gap: 6px; padding: 40px; }
.loading-dots i { width: 10px; height: 10px; border-radius: 50%; background: #c9bfa9; animation: dot 1s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: .15s; } .loading-dots i:nth-child(3) { animation-delay: .3s; }
.offline { padding: 40px 24px; text-align: center; display: grid; gap: 12px; }

/* ------------------------------------------------------------------ motion */
@keyframes tile-pop { from { transform: scale(.88); } to { transform: scale(1); } }
@keyframes tile-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
@keyframes tile-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 70% { transform: translateY(2px); } }
@keyframes shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } }
@keyframes clue-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: perspective(1200px) rotateX(-28deg) translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes star-pop { 0% { transform: scale(.4) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bar-in { from { transform: rotateX(70deg) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lift { 50% { transform: translateY(-10px); } }
@keyframes node-pulse { 50% { box-shadow: 0 5px 0 var(--yellow-d), 0 0 0 12px #ffd86622, 0 9px 14px #4a3a1426; } }
@keyframes chest-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
@keyframes zdrop { from { transform: translateY(-240px) scale(.4) rotateY(-540deg); opacity: 0; } }
@keyframes zspin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
@keyframes zbob { to { translate: 0 -10px; } }
@keyframes zshad { to { transform: scale(.8); opacity: .6; } }
@keyframes dot { 50% { transform: translateY(-6px); background: #a89c82; } }
[data-motion=reduce] *, [data-motion=reduce] *::before, [data-motion=reduce] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ sizes */
@media (min-width: 650px) {
  :root { --gutter: 28px; --chrome: 610px; }
  .app-shell { margin: 14px auto; min-height: calc(100svh - 28px); border: 1px solid #e4ded0; border-radius: 30px; box-shadow: 0 20px 70px #5144260f; overflow: clip; }
  .bottom-nav { position: relative; border-radius: 0 0 29px 29px; }
  .keyboard { margin: 0; }
}
@media (max-width: 370px) {
  :root { --gutter: 12px; --gap: 5px; --key-h: 46px; }
  .wordmark { font-size: 18px; }
  .chip { min-height: 32px; font-size: 13px; }
  .key { font-size: 16px; border-radius: 7px; }
  .key-row { gap: 4px; }
  .daily-card { min-height: 140px; padding: 12px; }
  .daily-card h3 { font-size: 16px; }
  .hero h2 { font-size: 22px; }
  .word-tile { min-height: clamp(54px, calc((100svh - 400px) / 4 - 8px), 80px); }
  .stat-grid dd { font-size: 20px; }
}
@media (max-height: 720px) and (max-width: 649px) {
  :root { --key-h: 43px; --chrome: 530px; }
  .topbar { min-height: 50px; padding-top: 8px; padding-bottom: 4px; }
  .clue-card { padding-top: 9px; padding-bottom: 9px; }
  .bottom-nav button { min-height: 42px; }
}
@media (max-height: 620px) and (max-width: 649px) {
  :root { --chrome: 440px; --key-h: 40px; }
  .bottom-nav { position: static; }
}
