:root {
  --bg: #F7F5EF; --surface: #FFFFFF; --tile: #EDEBE3; --tile-hover: #E4E1D7;
  --ink: #17181C; --ink-2: #4A4C55; --muted: #7A7D88; --line: #DDDAD0;
  --brand: #17181C; --brand-ink: #F7F5EF;
  --g1: #F3D24B; --g1-ink: #3A3000; --g2: #8FCB74; --g2-ink: #10300A;
  --g3: #86B7EA; --g3-ink: #0B2748; --g4: #BC93E4; --g4-ink: #2E0F4E;
  --g5: #F4A3B5; --g5-ink: #4A0F1E; --g6: #F6B26B; --g6-ink: #4A2400;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(23,24,28,.06), 0 10px 30px -18px rgba(23,24,28,.3);
  --radius: 10px;
  --f: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-num: "Segoe UI", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131417; --surface: #1B1C21; --tile: #26282F; --tile-hover: #2F323A;
    --ink: #EEEDE8; --ink-2: #C2C3CB; --muted: #8B8E9A; --line: #2E3038;
    --brand: #EEEDE8; --brand-ink: #131417;
    --g1: #D9B93A; --g1-ink: #1F1900; --g2: #7DB865; --g2-ink: #0A1F06;
    --g3: #6FA3DA; --g3-ink: #061A33; --g4: #A87FD3; --g4-ink: #1E0A36;
    --g5: #DE8A9E; --g5-ink: #33091A; --g6: #DE9A55; --g6-ink: #331800;
    --danger: #F28B82;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  --bg: #131417; --surface: #1B1C21; --tile: #26282F; --tile-hover: #2F323A;
  --ink: #EEEDE8; --ink-2: #C2C3CB; --muted: #8B8E9A; --line: #2E3038;
  --brand: #EEEDE8; --brand-ink: #131417;
  --g1: #D9B93A; --g1-ink: #1F1900; --g2: #7DB865; --g2-ink: #0A1F06;
  --g3: #6FA3DA; --g3-ink: #061A33; --g4: #A87FD3; --g4-ink: #1E0A36;
  --g5: #DE8A9E; --g5-ink: #33091A; --g6: #DE9A55; --g6-ink: #331800;
  --danger: #F28B82;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; padding: 0 16px 80px; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 560px; margin: 0 auto; }
.prose { max-width: 62ch; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; }
.brand .mark i { display: block; border-radius: 2px; }
.brand .mark i:nth-child(1) { background: var(--g1); } .brand .mark i:nth-child(2) { background: var(--g2); }
.brand .mark i:nth-child(3) { background: var(--g3); } .brand .mark i:nth-child(4) { background: var(--g4); }
.brand b { font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; letter-spacing: .02em; margin-top: -2px; }
.icons { display: flex; gap: 4px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.iconbtn:hover { background: var(--tile); color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.gamehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.gamehead h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
.gamehead .n { color: var(--muted); font-weight: 600; font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.themebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.themebar .theme { font-size: 1.05rem; font-weight: 700; color: var(--ink-2); }
.themebar .theme b { color: var(--ink); }
.themebar .meta { display: flex; gap: 12px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); font-size: .95rem; }
.themebar .meta span::before { content: attr(data-l); color: var(--muted); font-weight: 500; margin-right: 4px; }

.grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
}
.cell {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px;
  font-weight: 700; font-size: clamp(.78rem, 4.2vw, 1.15rem); line-height: 1; text-transform: uppercase;
  transition: background .12s ease, color .12s ease; cursor: pointer;
}
.cell.sel { background: var(--ink); color: var(--bg); }
.cell.no { background: var(--danger); color: #fff; }
.cell.f1 { background: var(--g1); color: var(--g1-ink); } .cell.f2 { background: var(--g2); color: var(--g2-ink); }
.cell.f3 { background: var(--g3); color: var(--g3-ink); } .cell.f4 { background: var(--g4); color: var(--g4-ink); }
.cell.f5 { background: var(--g5); color: var(--g5-ink); } .cell.f6 { background: var(--g6); color: var(--g6-ink); }
.cell.rev { box-shadow: inset 0 0 0 2px var(--muted); color: var(--muted); }
.cell.hint { animation: pulse 1s ease 3; box-shadow: inset 0 0 0 2px var(--ink); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.words { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .88rem; font-weight: 600; color: var(--ink-2); background: var(--surface); transition: all .2s ease; }
.chip.found { text-decoration: line-through; color: var(--muted); border-color: transparent; }
.chip.found.c1 { background: var(--g1); color: var(--g1-ink); } .chip.found.c2 { background: var(--g2); color: var(--g2-ink); }
.chip.found.c3 { background: var(--g3); color: var(--g3-ink); } .chip.found.c4 { background: var(--g4); color: var(--g4-ink); }
.chip.found.c5 { background: var(--g5); color: var(--g5-ink); } .chip.found.c6 { background: var(--g6); color: var(--g6-ink); }
.chip.missed { border-style: dashed; color: var(--muted); }

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn { border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: .95rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); transition: background .15s ease, color .15s ease, opacity .15s ease; }
.btn:hover:not(:disabled) { background: var(--tile); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover:not(:disabled) { opacity: .9; }
.btn:disabled { opacity: .35; cursor: default; border-color: var(--muted); }

.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(-10px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: .95rem; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal.open { display: flex; }
.card { background: var(--surface); color: var(--ink); border-radius: 16px; max-width: 460px; width: 100%; padding: 24px 22px 22px; box-shadow: var(--shadow); position: relative; max-height: calc(100vh - 32px); overflow: auto; animation: pop .25s ease; }
@keyframes pop { 0% { transform: scale(.94); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
.card h2 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.card p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.card .stack { display: flex; flex-direction: column; gap: 12px; }
.card .close { position: absolute; top: 10px; right: 10px; }
.card ul { margin: 0; padding-left: 1.1em; color: var(--ink-2); font-size: .95rem; display: flex; flex-direction: column; gap: 6px; }
.demo { display: grid; grid-template-columns: repeat(5, 30px); gap: 3px; justify-content: center; }
.demo i { width: 30px; height: 30px; display: grid; place-items: center; font-style: normal; font-weight: 700; border-radius: 5px; background: var(--tile); font-size: .9rem; }
.demo i.on { background: var(--g2); color: var(--g2-ink); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; margin: 6px 0 4px; }
.stats b { display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.result { text-align: center; }
.result .emoji { font-size: 1.25rem; line-height: 1.3; letter-spacing: .04em; margin: 6px 0 2px; font-family: var(--f-num); }
.result .next { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.result .next b { color: var(--ink); font-variant-numeric: tabular-nums; }
.share { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

.content { margin-top: 56px; display: flex; flex-direction: column; gap: 32px; }
.content h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.content p, .content li { color: var(--ink-2); font-size: .95rem; }
.content ul, .content ol { margin: 0; padding-left: 1.2em; }
.archive { display: flex; flex-wrap: wrap; gap: 8px; }
.archive a { text-decoration: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 11px; font-size: .88rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.archive a:hover { border-color: var(--ink); color: var(--ink); }
.archive a.done { border-color: var(--g2); }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; color: var(--ink); font-size: .95rem; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: 6px; }
footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer a { color: var(--muted); }
.ad-slot { min-height: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
