/* Wordabble web — matches the iPhone app's look: emerald / amber / slate raised tiles. */
:root {
  --correct: #1a9e6b; --correct-edge: #12744e; --correct-text: #fff;
  --present: #e5a11c; --present-edge: #b0770b; --present-text: #fff;
  --absent: #5a6374; --absent-edge: #40475a; --absent-text: #fff;
  --green: #1a9e6b; --amber: #e5a11c; --gold: #f0b323; --vowel: #b23a28; --red: #d93a2b; --orange: #ef8a17; --blue: #2f7bd8;
  --bg: #ffffff; --bg2: #f2f3f0; --card: #ffffff; --text: #1c1f24; --muted: #646a72; --line: #dfe2dc;
  --blank: #faf5e8; --blank-edge: #dbd1b8; --key: #dcdee3; --key-edge: #b3b8bf; --key-text: #111;
  --used: #15171c; --used-text: rgba(255,255,255,.4);
  --shadow: 0 8px 24px rgba(0,0,0,.12);
  --mark: none;
  --elsewhere: #8b5cf6; --elsewhere-edge: #6537c9; --elsewhere-text: #fff;
  --b2L: #2f86e0; --b3L: #f08a24; --b2W: #e8609f; --b3W: #dc3b30;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --bg2: #191c21; --card: #1f2329; --text: #eef0ec; --muted: #a3a8ae; --line: #2e333b;
    --blank: #2b2f37; --blank-edge: #1c1f24; --key: #9ea3ad; --key-edge: #737882; --shadow: 0 8px 24px rgba(0,0,0,.5);
  }
}
:root[data-contrast="high"] {
  --correct: #0072b2; --correct-edge: #004e7a; --correct-text: #fff;
  --present: #e69f00; --present-edge: #a36f00; --present-text: #000;
  --absent: #3a3a3a; --absent-edge: #1f1f1f;
  --elsewhere: #cc79a7; --elsewhere-edge: #9a4f7b; --elsewhere-text: #000;
  --mark: inline;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; flex: none; }
a { color: var(--green); }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); margin: 4px 0; }
.fine.bad, .bad { color: var(--red); }
.center-text { text-align: center; }
.error { color: var(--red); text-align: center; margin: 8px 0; }
.ok { color: var(--green); text-align: center; margin: 8px 0; }
.warn-text { color: var(--orange); font-size: 13px; }
.rounded { font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--green); color: #fff; }
.btn.amber { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.btn.outline { background: var(--card); border: 1.5px solid var(--line); }
.btn.plain { background: none; color: var(--green); padding: 8px; min-height: 0; }
.btn.danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 10px; width: 100%; }
.btn-row > * { flex: 1; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--text); display: inline-flex; }
.icon-btn:hover { background: var(--bg2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Simple screens ---------- */
.center-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 20px; }
.center-screen.narrow > * { max-width: 380px; }
.title { font: 800 30px/1.15 ui-rounded, -apple-system, system-ui, sans-serif; margin: 0; text-align: center; }
.lead { color: var(--muted); font-weight: 600; text-align: center; font-size: 18px; margin: 0; }
.big-label { font-size: 20px; font-weight: 700; }
.year-select { font-size: 22px; font-weight: 700; padding: 12px 20px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg2); min-width: 200px; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 380px; align-items: center; }
.g { color: #4285f4; font-weight: 900; font-size: 20px; }
.big-icon { color: var(--green); }
.big-icon svg { width: 52px; height: 52px; }
.username-row { display: flex; gap: 8px; width: 100%; max-width: 380px; background: var(--bg2); border-radius: 12px; padding: 6px 6px 6px 14px; }
.username-row input { flex: 1; border: 0; background: none; font-size: 20px; font-weight: 600; outline: none; min-width: 0; }
.suggest-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 380px;
  box-sizing: border-box; padding: 16px 12px 16px 20px; border-radius: 16px; background: var(--bg2);
  border: 2px solid var(--green, #1A9E6B); }
.suggest-name { font-size: 26px; font-weight: 800; letter-spacing: .2px; overflow-wrap: anywhere; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 0.9s linear infinite; }
.spinner.small { width: 22px; height: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { color: var(--green); }

/* ---------- Logo + tiles ---------- */
.logo { display: flex; gap: 3px; }
.logo .tile { width: var(--s); height: var(--s); font-size: calc(var(--s) * .6); border-radius: calc(var(--s) * .2); margin-bottom: 2px; box-shadow: 0 2px 0 var(--edge); }
.tile {
  --edge: var(--blank-edge);
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 9px;
  font: 800 28px/1 ui-rounded, -apple-system, system-ui, sans-serif; text-transform: uppercase;
  background: var(--blank); color: var(--text); box-shadow: 0 3px 0 var(--edge); margin-bottom: 3px;
  border: 1.5px solid color-mix(in srgb, var(--muted) 35%, transparent);
}
.tile small { position: absolute; right: 5px; bottom: 3px; font-size: 10px; font-weight: 700; opacity: .85; font-family: inherit; }
.tile.empty { background: color-mix(in srgb, var(--blank) 50%, transparent); box-shadow: none; }
.tile.elsewhere { background-color: var(--elsewhere); color: var(--elsewhere-text); --edge: var(--elsewhere-edge); border-color: transparent; }
.tile.correct, .tile.present, .tile.absent { border-color: transparent; background-image: linear-gradient(to bottom, rgba(255,255,255,.18), rgba(255,255,255,0) 50%); }
.tile.correct { background-color: var(--correct); color: var(--correct-text); --edge: var(--correct-edge); }
.tile.present { background-color: var(--present); color: var(--present-text); --edge: var(--present-edge); }
.tile.absent { background-color: var(--absent); color: var(--absent-text); --edge: var(--absent-edge); }
.mk { display: var(--mark); position: absolute; left: 5px; top: 3px; font-size: 10px; font-style: normal; font-weight: 900; line-height: 1; }

/* ---------- Home ---------- */
.home { padding: 16px 18px 28px; display: flex; flex-direction: column; gap: 16px; background: var(--bg2); min-height: 100dvh; }
.home-head { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 12px; }
.hello { font-size: 20px; font-weight: 800; display: flex; gap: 8px; align-items: center; }
.streak { color: var(--orange); background: color-mix(in srgb, var(--orange) 15%, transparent); border-radius: 99px; padding: 2px 10px; font-size: 15px; }
.card { background: var(--card); border: 0; border-radius: 18px; padding: 16px; text-align: left; display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; box-shadow: 0 1px 0 var(--line); }
.daily-card { border: 0; border-radius: 22px; padding: 20px; text-align: left; color: #fff; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(135deg, var(--green), #0e7a52); box-shadow: 0 8px 20px color-mix(in srgb, var(--green) 35%, transparent); }
:root[data-contrast="high"] .daily-card { background: linear-gradient(135deg, #0072b2, #004e7a); }
.dc-top { display: flex; justify-content: space-between; font-weight: 700; opacity: .95; }
.dc-headline { font: 800 24px/1.2 ui-rounded, -apple-system, system-ui, sans-serif; }
.dc-detail { opacity: .92; font-size: 15px; }
.dc-bottom { display: flex; justify-content: space-between; align-items: center; }
.pill { background: #fff; color: var(--green); font-weight: 800; border-radius: 99px; padding: 9px 20px; }
:root[data-contrast="high"] .pill { color: #0072b2; }
.seal svg { width: 30px; height: 30px; }
.pc-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--amber); color: #fff; display: grid; place-items: center; flex: none; }
.pc-icon.app { background: var(--text); color: var(--bg); }
.pc-icon svg { width: 26px; height: 26px; }
.pc-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.chev { color: var(--muted); font-size: 26px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.home-tile { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 112px; }
.ht-icon svg { width: 26px; height: 26px; }
.ht-icon.blue { color: var(--blue); } .ht-icon.gold { color: var(--gold); } .ht-icon.green { color: var(--green); } .ht-icon.gray { color: var(--muted); }
.countdown { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; margin: 4px 0; }
.foot { display: flex; justify-content: center; gap: 18px; font-size: 14px; }

/* ---------- Game ---------- */
.game { display: flex; flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0; }
.topbar h1 { flex: 1; font: 800 20px/1 ui-rounded, -apple-system, system-ui, sans-serif; margin: 0; }
.tb-right { display: flex; }
.game-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px; }
.sub { font-weight: 600; color: var(--muted); font-size: 14px; }
.clock { font-variant-numeric: tabular-nums; font-size: 15px; }
.board { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 6px; align-items: center; min-height: 0; }
.row { display: grid; grid-template-columns: repeat(var(--len), minmax(0, 1fr)) 28px; gap: 6px; width: 100%; max-width: calc(var(--len) * 62px + 34px); }
.row .tile { width: 100%; align-self: start; }
.row-cost { align-self: center; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-cost.live { color: var(--gold); }
.row-cost.live.bad { color: var(--red); }
.row.revealing .tile { animation: flip 600ms ease both; }
@keyframes flip {
  0% { transform: rotateX(0); background: var(--blank); color: var(--text); box-shadow: 0 3px 0 var(--blank-edge); }
  50% { transform: rotateX(90deg); background: var(--blank); color: var(--text); }
  51% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}
.row.revealing .tile .mk { animation: hide-early 600ms both; animation-delay: inherit; }
@keyframes hide-early { 0%, 50% { opacity: 0; } 51%, 100% { opacity: 1; } }
.shake-a { animation: shake-a .4s; } .shake-b { animation: shake-b .4s; }
@keyframes shake-a { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes shake-b { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.budget { padding: 4px 18px 8px; }
.figs { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.figs b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.figs span { font-size: 11px; color: var(--muted); }
.figs .amber { color: var(--amber); } .figs .red { color: var(--red); } .figs .green { color: var(--green); }
.meter { height: 8px; border-radius: 99px; overflow: hidden; display: flex; background: color-mix(in srgb, var(--green) 35%, transparent); margin: 6px 0 2px; }
.meter i { display: block; height: 100%; transition: width .2s; }
.meter .spent { background: var(--absent); }
.meter .pending { background: var(--amber); }
.meter .pending.bad { background: var(--red); }
.budget .fine { text-align: center; }

.keyboard { padding: 4px 4px max(8px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; user-select: none; }
.krow { display: flex; gap: 5px; }
.krow.pad { padding: 0 4.5%; }
.key {
  --edge: var(--key-edge);
  flex: 1; min-width: 0; height: 54px; border: 0; border-radius: 8px; position: relative;
  background: var(--key); color: var(--key-text); box-shadow: 0 2px 0 var(--edge);
  font: 800 19px/1 ui-rounded, -apple-system, system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.key small { font-size: 10px; font-weight: 700; opacity: .85; }
.key.vowel { color: var(--vowel); }
.key.wide { flex: 1.5; font-size: 13px; background: color-mix(in srgb, var(--key) 80%, var(--muted)); }
.key.correct { background: var(--correct); color: var(--correct-text); --edge: var(--correct-edge); }
.key.present { background: var(--present); color: var(--present-text); --edge: var(--present-edge); }
.key.used { background: var(--used); color: var(--used-text); --edge: #000; outline: 1px solid rgba(255,255,255,.12); outline-offset: -1px; }
.key .mk { font-size: 8px; left: 3px; top: 3px; }
.key:active { transform: translateY(2px); box-shadow: none; }

.finished { padding: 8px 24px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.finished h2 { font-size: 18px; margin: 4px 0; text-align: center; }
.btn-row.three .btn { padding: 10px 8px; }
.note { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0; width: 100%; }
.note svg { color: var(--orange); }

/* ---------- Practice setup ---------- */
.practice-setup { display: flex; flex-direction: column; gap: 14px; padding-bottom: 28px; }
.practice-setup > *:not(.topbar) { margin: 0 18px; }
.intro { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.intro h2 { margin: 0; font: 800 26px/1.2 ui-rounded, -apple-system, system-ui, sans-serif; }
.section-label { font-size: 13px; letter-spacing: .02em; margin: 14px 0 6px; }
.segmented { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 8px; font-weight: 600; }
.segmented button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { background: var(--bg2); border: 2px solid transparent; }
.option.selected { border-color: var(--green); }
.opt-ic { width: 30px; color: var(--green); display: grid; place-items: center; font-size: 22px; }
.opt-ic svg { width: 26px; height: 26px; }
.opt-check { color: var(--green); }
.resume { background: color-mix(in srgb, var(--amber) 15%, transparent); }
.resume .opt-ic { color: var(--amber); }
.stats-link { background: var(--bg2); }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; animation: fade .15s; }
.sheet { position: fixed; z-index: 11; left: 50%; transform: translateX(-50%); bottom: 0; width: min(560px, 100%); max-height: 92dvh;
  background: var(--bg); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: up .2s ease; }
@media (min-width: 700px) { .sheet { top: 50%; bottom: auto; transform: translate(-50%, -50%); border-radius: 18px; max-height: 88dvh; animation: fade .15s; } }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 18px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-scroll { overflow-y: auto; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.sheet-body { padding: 0 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.sheet-body.center { align-items: center; }
.dialog { position: fixed; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px));
  background: var(--bg); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); text-align: center; }
.dialog h2 { margin: 0 0 6px; font-size: 18px; }
.toast { position: fixed; z-index: 20; top: 72px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-weight: 700; animation: fade .15s; max-width: calc(100% - 32px); text-align: center; }

.lead-left { font-size: 18px; font-weight: 600; margin: 0; }
.bullets { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.bullets li { display: flex; gap: 12px; }
.b-ic svg { width: 22px; height: 22px; }
.b-ic.gold { color: var(--gold); } .b-ic.green { color: var(--green); } .b-ic.red { color: var(--red); } .b-ic.orange { color: var(--orange); } .b-ic.blue { color: var(--blue); } .b-ic.gray { color: var(--muted); }
.example p { margin: 4px 0 8px; }
.ex-row { display: flex; gap: 4px; align-items: center; }
.ex-row .tile, .answer .tile, .row-item .tile { width: 42px; font-size: 22px; }
.price-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.price-grid div { background: var(--bg2); border-radius: 6px; text-align: center; padding: 4px 0; display: flex; flex-direction: column; }
.price-grid b { font-size: 16px; } .price-grid span { font-size: 12px; }
.price-grid .vowel { color: var(--vowel); }
@media (prefers-color-scheme: dark) { .price-grid .vowel, .key.vowel:not(.correct):not(.present):not(.used) { color: #8a1f12; } }

.who { text-align: center; font-weight: 700; margin: 0; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; width: 100%; }
.nums b { display: block; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nums span { font-size: 12px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.drow { display: flex; gap: 6px; align-items: center; }
.drow > span { width: 24px; font-variant-numeric: tabular-nums; }
.drow i { display: block; height: 22px; background: var(--absent); color: #fff; font-style: normal; font-weight: 700; text-align: right; padding-right: 6px; line-height: 22px; font-size: 14px; }
.drow i.hl { background: var(--correct); }
.records { margin: 0; width: 100%; }
.records div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.records dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cat { width: 100%; border-collapse: collapse; font-size: 14px; }
.cat th, .cat td { padding: 6px 4px; text-align: right; font-variant-numeric: tabular-nums; }
.cat th:first-child, .cat tbody th { text-align: left; font-weight: 500; }
.cat thead th { color: var(--muted); font-size: 12px; font-weight: 600; }

.board-list { list-style: none; padding: 0; margin: 0; }
.board-list li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.board-list li.me { background: color-mix(in srgb, var(--green) 14%, transparent); border-radius: 8px; }
.rk { width: 28px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rk.gold { color: var(--gold); }
.nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.li.me .nm { font-weight: 800; }
.saved { color: var(--orange); }
.coins { font-weight: 700; font-variant-numeric: tabular-nums; }
.tm { width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp { width: 38px; color: var(--muted); }
.empty-state { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; }
.empty-state svg { width: 40px; height: 40px; color: var(--muted); }
.empty-state h3 { margin: 10px 0 4px; }
.center-pad { display: grid; place-items: center; padding: 40px; }
.answer { display: flex; gap: 5px; }
.badge { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); border-radius: 99px; padding: 6px 12px; font-weight: 600; margin: 0; }
.share-preview { background: var(--bg2); border-radius: 12px; padding: 12px; width: 100%; white-space: pre-wrap; font-size: 13px; margin: 0; user-select: all; }

.group { background: var(--bg2); border-radius: 12px; overflow: hidden; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.row-item:last-child { border-bottom: 0; }
.row-item.link { color: var(--green); justify-content: flex-start; }
.danger-text { color: var(--red) !important; }
.row-item .tile { flex: none; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.form input { padding: 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); font-size: 16px; }

@media (max-width: 380px) {
  .tile { font-size: 24px; }
  .key { height: 50px; font-size: 17px; }
  .figs b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .row.revealing .tile, .shake-a, .shake-b, .sheet { animation-duration: 1ms !important; }
}
.app-promo { width: 100%; max-width: 440px; box-sizing: border-box; border: 2px solid color-mix(in srgb, #8b5cf6 55%, transparent);
  background: color-mix(in srgb, #8b5cf6 10%, var(--card)); margin: 4px 0; }
.app-promo .promo-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #8b5cf6; color: #fff; }
.app-promo .promo-ic svg { width: 24px; height: 24px; }
.app-promo .pc-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.app-promo .pc-text .muted { font-size: 14px; line-height: 1.35; }
.app-promo .promo-go { flex: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: #8b5cf6; white-space: nowrap; }
.app-promo .promo-go svg { width: 16px; height: 16px; }
@media (max-width: 420px) { .app-promo .promo-go { display: none; } }
.home .app-promo { max-width: none; margin: 0; }

/* ---------- Crossword board ---------- */
.grid-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 12px; overflow: auto; }
.xgrid { --sz: min(52px, calc((100vw - 32px) / var(--cols) - 5px), calc((100dvh - 470px) / var(--rows) - 5px));
  --sz: max(34px, min(52px, calc((100vw - 32px) / var(--cols) - 5px), calc((100dvh - 470px) / var(--rows) - 5px)));
  display: grid; grid-template-rows: repeat(var(--rows), var(--sz)); grid-template-columns: repeat(var(--cols), var(--sz)); gap: 5px; }
.sq { --edge: var(--blank-edge); --bc: transparent;
  position: relative; display: grid; place-items: center; padding: 0; border-radius: 8px;
  font: 800 calc(var(--sz, 48px) * .5)/1 ui-rounded, -apple-system, system-ui, sans-serif; text-transform: uppercase;
  background: var(--blank); color: var(--text); box-shadow: 0 3px 0 var(--edge);
  border: 1.5px solid color-mix(in srgb, var(--muted) 35%, transparent); transition: transform .12s; }
.sq small { position: absolute; right: 3px; bottom: 2px; font-size: 9px; font-weight: 700; opacity: .85; }
.sq .bl { font-style: normal; font-size: calc(var(--sz, 48px) * .3); font-weight: 900; color: #fff; letter-spacing: .02em; }
.sq .btag { position: absolute; left: 50%; top: -7px; transform: translateX(-50%); font-size: 8px; line-height: 1; font-weight: 900;
  padding: 2px 3px; border-radius: 4px; background: var(--bc); color: #fff; }
.sq.b2L { --bc: var(--b2L); } .sq.b3L { --bc: var(--b3L); } .sq.b2W { --bc: var(--b2W); } .sq.b3W { --bc: var(--b3W); }
/* Empty bonus squares are filled with their color, like a Scrabble board. */
.sq[class*=" b"]:not(.typed):not(.correct):not(.present):not(.elsewhere):not(.absent):not(.missed) { background: var(--bc); border-color: transparent;
  --edge: color-mix(in srgb, var(--bc) 70%, #000); }
.sq[class*=" b"].typed, .sq[class*=" b"].correct, .sq[class*=" b"].present, .sq[class*=" b"].elsewhere, .sq[class*=" b"].absent, .sq[class*=" b"].missed { border: 2px solid var(--bc); }
.sq.correct, .sq.present, .sq.elsewhere, .sq.absent { background-image: linear-gradient(to bottom, rgba(255,255,255,.18), rgba(255,255,255,0) 50%); }
.sq.correct { background-color: var(--correct); color: var(--correct-text); --edge: var(--correct-edge); }
.sq.present { background-color: var(--present); color: var(--present-text); --edge: var(--present-edge); }
.sq.elsewhere { background-color: var(--elsewhere); color: var(--elsewhere-text); --edge: var(--elsewhere-edge); }
.sq.absent { background-color: var(--absent); color: var(--absent-text); --edge: var(--absent-edge); }
.sq.faded { opacity: .55; }
.sq.ghost { opacity: .6; }
.sq.missed { background: color-mix(in srgb, var(--absent) 25%, var(--blank)); color: var(--muted); }
.sq.in-word { outline: 3px solid var(--blue); outline-offset: 1px; z-index: 1; }
.sq.in-word:not(.correct) { transform: translateY(-2px); }
.sq.cursor { box-shadow: 0 3px 0 var(--edge), inset 0 -4px 0 var(--blue); }
.sq.cursor:not([class*=" b"]) { background: color-mix(in srgb, var(--blue) 12%, var(--blank)); }
.sq.flip { animation: flip 600ms ease both; animation-delay: var(--d, 0ms); }
.sq.flip .mk { animation: hide-early 600ms both; animation-delay: var(--d, 0ms); }
.sq .mk { left: 3px; top: 2px; font-size: 9px; }
.sq.demo { --sz: 38px; width: 38px; height: 38px; flex: none; }
.xgrid.shake-a, .xgrid.shake-b { will-change: transform; }
.grid-wrap.mini { padding: 10px 0 4px; }
.grid-wrap.mini .xgrid { --sz: 30px; }
.miss-word { color: var(--red); text-decoration: line-through; }
.word-bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 2px 12px 0; font-size: 14px; min-height: 26px; }
.chip { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; color: #fff; }
.chip.b2L { background: var(--b2L); } .chip.b3L { background: var(--b3L); } .chip.b2W { background: var(--b2W); } .chip.b3W { background: var(--b3W); }
.legend { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.legend-row { display: flex; align-items: center; gap: 12px; font-size: 14px; }
@media (min-width: 700px) { .game { max-width: 640px; margin: 0 auto; } }
/* Cursor square and the other word through it (tap again to switch). */
.sq.cursor { outline: 3px solid var(--blue); outline-offset: 1px; box-shadow: 0 3px 0 var(--edge), 0 0 0 6px color-mix(in srgb, var(--blue) 30%, transparent); z-index: 2; }
.sq.in-word:not(.cursor) { outline: 2px solid color-mix(in srgb, var(--blue) 75%, transparent); }
.sq.cross-word { outline: 2px dashed color-mix(in srgb, var(--muted) 70%, transparent); outline-offset: 1px; }
.switch-hint { flex-basis: 100%; text-align: center; font-size: 12px; color: var(--muted); }
.sq.cursor:not(.typed):not([class*=" b"]) { background: color-mix(in srgb, var(--blue) 22%, var(--blank)); }
.sq.cursor { outline-width: 4px; }
/* Keyboard: purple letters, and keys split into 2–3 colors when a letter has several. */
.key.elsewhere { background: var(--elsewhere); color: var(--elsewhere-text); --edge: var(--elsewhere-edge); }
.key.split { color: #fff; --edge: #3d3f46; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
/* Which word a yellow crossing square refers to: ↔ across, ↕ down, ↔↕ both. */
.sq .dir { position: absolute; right: 2px; top: 2px; font-style: normal; font-size: 10px; font-weight: 900; line-height: 1;
  padding: 1px 2px; border-radius: 4px; background: rgba(0,0,0,.4); color: #fff; letter-spacing: -1px; }
.sq.ghost .dir, .sq.faded .dir { opacity: 1; }
/* Guess history */
.head-btns { display: flex; gap: 8px; }
.head-btns svg { margin-right: 2px; }
.hist-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; width: 100%; text-align: center; }
.hist-nav .icon-btn:disabled { opacity: .3; }
.flip-x svg { transform: scaleX(-1); }
.hist-word { justify-content: center; margin: 4px 0; }
.hist-word .tile { width: 44px; font-size: 22px; }
.hist-grid .xgrid { --sz: 40px; }
.hist-grid .sq { font-size: 20px; }
.sq.hist-now { outline: 3px solid var(--blue); outline-offset: 1px; }
.hist-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hist-chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.hist-chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
/* Purple letters that are used up (every copy found) turn gray, like letters not in the puzzle. */
.sq.spent { background-color: var(--absent); color: var(--absent-text); --edge: var(--absent-edge); border-color: transparent;
  background-image: linear-gradient(to bottom, rgba(255,255,255,.18), rgba(255,255,255,0) 50%); }
:root { --spent: #0b0c0f; }
.key.spent { background: #0b0c0f; color: rgba(255,255,255,.4); }

/* ---------- Double / triple letter squares (one-word puzzles) ---------- */
.tile.bonus { position: relative; }
.tile.bonus.b2L { --bc: var(--b2L); } .tile.bonus.b3L { --bc: var(--b3L); }
.tile.bonus.empty { background: var(--bc); border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--bc) 70%, #000); }
.tile.bonus:not(.empty) { border: 2.5px solid var(--bc); }
.tile .bl { font-style: normal; font-size: 15px; font-weight: 900; color: #fff; }
.tile .btag { position: absolute; left: 50%; top: -8px; transform: translateX(-50%); font-size: 9px; line-height: 1; font-weight: 900;
  padding: 2px 4px; border-radius: 4px; background: var(--bc); color: #fff; font-family: -apple-system, system-ui, sans-serif; }
.bonus-chips { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.nums.three { grid-template-columns: repeat(3, 1fr); }

/* ---------- Coin Shop looks (equipped themes; the color-blind palette always wins for tiles) ---------- */
:root[data-tiles="ocean"]:not([data-contrast="high"]) { --correct: #0f8b8d; --correct-edge: #0a6365; --present: #e9b44c; --present-edge: #b8862a; --absent: #4a5568; --absent-edge: #323a48; }
:root[data-tiles="sunset"]:not([data-contrast="high"]) { --correct: #c2185b; --correct-edge: #8c1142; --present: #ff9f1c; --present-edge: #c77700; --absent: #5b5068; --absent-edge: #40384a; }
:root[data-tiles="grape"]:not([data-contrast="high"]) { --correct: #6a4c93; --correct-edge: #4a3468; --present: #f4a259; --present-edge: #c07a36; --absent: #55606e; --absent-edge: #3b4450; }
:root[data-tiles="midnight"]:not([data-contrast="high"]) { --correct: #00b894; --correct-edge: #00876c; --present: #fdcb6e; --present-edge: #c99a3e; --present-text: #000; --absent: #2d3436; --absent-edge: #16191a; }
:root[data-tiles="goldrush"]:not([data-contrast="high"]) { --correct: #c9a227; --correct-edge: #8e7019; --present: #9c6ade; --present-edge: #6e46a6; --absent: #4b4b55; --absent-edge: #2e2e36; }
:root[data-keys="slate"] { --key: #3b4252; --key-edge: #262b36; --key-text: #fff; --vowel: #ff8a7a; --used: #111318; --used-text: rgba(255,255,255,.35); }
:root[data-keys="paper"] { --key: #f5ecd7; --key-edge: #cdbf9e; --key-text: #3b2f1e; --vowel: #a63a22; --used: #5e5240; --used-text: rgba(255,255,255,.45); }
:root[data-keys="mint"] { --key: #bfebd8; --key-edge: #8ccbae; --key-text: #12553c; --vowel: #b23a28; --used: #1e3a30; --used-text: rgba(255,255,255,.45); }
:root[data-keys="gold"] { --key: #f3d27a; --key-edge: #c9a23e; --key-text: #5a4100; --vowel: #a3301c; --used: #3a2e10; --used-text: rgba(255,255,255,.45); }
:root[data-keys]:not([data-keys="classic"]) .key:not(.correct):not(.present):not(.used):not(.wide) { color: var(--key-text); }
:root[data-keys]:not([data-keys="classic"]) .key.vowel:not(.correct):not(.present):not(.used) { color: var(--vowel); }
:root[data-bonus="jewel"] { --b2L: #2747b8; --b3L: #c2185b; }
:root[data-bonus="pastel"] { --b2L: #5b9bd5; --b3L: #e57a9a; }
:root[data-bonus="neon"] { --b2L: #00a6f0; --b3L: #ff2e93; }
:root[data-bonus="royal"] { --b2L: #6a3fb5; --b3L: #c9930a; }

/* ---------- Coin bank, shop, flair ---------- */
.bank-chip { border: 0; border-radius: 99px; padding: 3px 10px; font: inherit; font-size: 15px; font-weight: 800; color: #b07d0c;
  background: color-mix(in srgb, var(--gold) 18%, transparent); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.bank-chip svg, .bank-amt svg, .deposit-line svg, .st svg { width: 16px; height: 16px; vertical-align: -3px; }
.ht-icon.teal { color: #0f9b9b; }
.helps { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 0 16px; flex-wrap: wrap; }
.helps .bank-amt { margin-right: auto; font-weight: 800; color: #b07d0c; font-size: 14px; }
.btn.outline.gold { color: #9a6c08; border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.btn:disabled { opacity: .45; cursor: default; }
.tile.hint { box-shadow: inset 0 0 0 2.5px var(--correct); }
.tile.hint::after { content: attr(data-hint); color: var(--correct); opacity: .7; }
.tile.bonus.hint::after { color: #fff; opacity: .8; }
.tile.hint .bl { display: none; }
.deposit-banner { position: fixed; z-index: 21; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(92vw, 420px);
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--card); color: var(--text);
  border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); box-shadow: var(--shadow); animation: fade .2s; }
.deposit-banner > svg { width: 30px; height: 30px; color: var(--gold); flex: none; }
.deposit-banner div { display: flex; flex-direction: column; }
.deposit-banner .fine { margin: 0; }
.deposit-line { background: color-mix(in srgb, var(--gold) 14%, transparent); border-radius: 12px; padding: 8px 12px; color: #9a6c08; }
.deposit-line .fine { margin: 2px 0 0; }
canvas.celebration { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 30; }
.shop .bank-head { text-align: center; padding: 6px 0 4px; }
.bank-big { font-size: 40px; font-weight: 900; display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.bank-big svg { width: 34px; height: 34px; color: var(--gold); }
.bank-title { font-weight: 800; margin-top: 6px; }
.meter.gold { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.meter.gold i { background: var(--gold); }
.meter.green { background: color-mix(in srgb, var(--green) 22%, transparent); }
.meter.green i { background: var(--green); }
.group.pad { padding: 12px 14px; }
.goal-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.goal-top svg, .row-item strong svg { width: 16px; height: 16px; vertical-align: -3px; }
.shop-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.shop-item { flex: none; width: 124px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 14px; border: 2px solid transparent; background: var(--bg2); color: var(--text); font: inherit; cursor: pointer; }
.shop-item.on { border-color: var(--green); }
.shop-item strong { font-size: 13px; }
.shop-item .st { font-size: 12px; font-weight: 800; }
.shop-item .st.ok { color: var(--green); } .shop-item .st.link { color: var(--blue); }
.pv { display: flex; gap: 4px; height: 44px; align-items: center; }
.pv-tile, .pv-key { font-style: normal; font-weight: 900; display: grid; place-items: center; color: #fff; }
.pv-tile { width: 30px; height: 30px; border-radius: 6px; font-size: 16px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.pv-tile.big { width: 38px; height: 38px; font-size: 14px; }
.pv-key { width: 26px; height: 36px; border-radius: 6px; font-size: 15px; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.pv.emoji { font-size: 34px; }
.title-row .tr-ic { width: 22px; display: inline-flex; justify-content: center; }
.title-row .tr-ic.dim { opacity: .35; }
.title-row .pc-text { flex: 1; display: flex; flex-direction: column; }
.title-row:disabled { color: var(--muted); }
.title-row .ok-ic svg { width: 18px; height: 18px; color: var(--green); }
.flair { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 11px; font-weight: 900; color: #fff; vertical-align: -2px; }
.flair.t2 { background: #b87333; } .flair.t3 { background: #9ea7b3; } .flair.t4, .flair.t5 { background: var(--gold); }
.flair.crown { color: var(--gold); width: 18px; } .flair.crown svg { width: 16px; height: 16px; }
.framed { border: 1.5px solid var(--gold); border-radius: 99px; padding: 1px 7px; }
