:root {
  --bg: #0c0d0b; --panel: #151713; --line: #2a2d26; --ink: #eef3e4; --mute: #a3ab96;
  --lime: #c6ff4d; --lav: #b9a3ff; --coral: #ff7a63; --miss: #1d201b;
  --r: 14px; --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font);
  display: flex; flex-direction: column; overflow-x: hidden;
  background-image: radial-gradient(circle at 50% -20%, rgba(198,255,77,.10), transparent 55%),
    radial-gradient(circle at 110% 30%, rgba(185,163,255,.07), transparent 40%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.defs { position: absolute; }
svg { width: 1em; height: 1em; flex: none; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px 0; width: 100%; max-width: 560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mark { width: 30px; height: 30px; transform: rotate(-6deg); }
h1 { margin: 0; font-size: 1.45rem; letter-spacing: -.03em; font-weight: 800; }
h1 span { color: var(--lime); }
.no { font: 600 .8rem var(--mono); color: var(--mute); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
.tools { display: flex; gap: 4px; }
.icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; font-size: 22px; color: var(--ink); }
.icon:hover { background: var(--panel); }

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 14px 12px; flex: 1; display: flex; flex-direction: column; }

/* One round: dots, hint, shadow, four choices. */
.play { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dots { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.dots li { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 15px; }
.dots li.now { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(198,255,77,.18); }
.dots li.right { background: var(--lime); border-color: transparent; color: #10110e; }
.dots li.wrong { background: var(--coral); border-color: transparent; color: #1a0d0a; }
.hint { margin: 0; font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; text-align: center; min-height: 1.5em; }
.stage { position: relative; width: min(58vw, 250px, 30dvh); aspect-ratio: 1; border-radius: 22px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #e9ffc0, #c6ff4d 70%); box-shadow: 0 10px 40px rgba(198,255,77,.18); transition: background .3s; }
.stage.right { background: radial-gradient(circle at 50% 45%, #2b3a16, #1a2410 70%); box-shadow: 0 0 0 3px var(--lime); }
.stage.wrong { background: radial-gradient(circle at 50% 45%, #3a1d16, #21110d 70%); box-shadow: 0 0 0 3px var(--coral); }
.shadow, .reveal { width: 84%; height: 84%; }
.shadow { background: #0b0c09; -webkit-mask: var(--art) center / contain no-repeat; mask: var(--art) center / contain no-repeat; animation: pop .35s both; }
.reveal { image-rendering: pixelated; animation: pop .4s both; }
@keyframes pop { from { transform: scale(.82); opacity: 0; } }
.choices { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices button { position: relative; width: 100%; aspect-ratio: 1; max-height: 21dvh; padding: 10px; border-radius: 18px; border: 2px solid var(--line); background: #141612; display: grid; place-items: center; transition: transform .12s, border-color .2s, opacity .3s; }
.choices button:hover { border-color: #4a5141; }
.choices button:active { transform: scale(.97); }
.choices button { overflow: hidden; grid-template-rows: minmax(0, 1fr); }
.choices img { width: 100%; height: 100%; min-height: 0; object-fit: contain; image-rendering: pixelated; }
.choices button.right { border-color: var(--lime); background: #1e2416; box-shadow: 0 0 0 3px rgba(198,255,77,.3); }
.choices button.wrong { border-color: var(--coral); background: #24130f; }
.choices button.dim { opacity: .35; }
.choices button[aria-disabled="true"] { cursor: default; }
.badge { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; animation: pop .3s both; }
.right > .badge { background: var(--lime); color: #10110e; }
.wrong > .badge { background: var(--coral); color: #1a0d0a; }

/* End of the set */
.end { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 14px; border-radius: 22px; background: linear-gradient(160deg, #1a1d15, #131511); border: 1px solid var(--line); text-align: center; }
.end.fresh { animation: pop .45s both; }
.score { margin: 0; font: 800 3.4rem/1 var(--mono); color: var(--lime); letter-spacing: -.04em; }
.squares { margin: 0; font: 700 1.5rem/1 var(--mono); letter-spacing: .08em; color: var(--ink); }
.strip { list-style: none; margin: 4px 0 0; padding: 0; display: flex; gap: 6px; justify-content: center; }
.strip a { position: relative; display: block; width: 56px; height: 56px; border-radius: 12px; background: #0f100e; border: 2px solid var(--line); }
.strip li.right a { border-color: var(--lime); }
.strip li.wrong a { border-color: var(--coral); }
.strip img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.strip .badge { top: -6px; right: -6px; width: 20px; height: 20px; font-size: 12px; }
.strip li.right .badge { background: var(--lime); color: #10110e; }
.strip li.wrong .badge { background: var(--coral); color: #1a0d0a; }
.streak { margin: 0; font-weight: 800; font-size: 1.05rem; }
.end-actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-weight: 800; text-decoration: none; }
.btn svg { font-size: 18px; }
.btn.primary { background: var(--lime); color: #10110e; border-color: transparent; font-size: 1.05rem; }
.btn.wide { width: 100%; justify-content: center; margin-top: 12px; }
.next { margin: 0; color: var(--mute); font-size: .88rem; }
.next time { font-family: var(--mono); color: var(--ink); }

.foot { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px 16px; color: var(--mute); font-size: .85rem; }
.foot .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.foot .maker { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--lime); text-underline-offset: 3px; display: inline-block; padding: 12px 2px; margin: -12px 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #10110e; font-weight: 700; padding: 10px 16px; border-radius: 99px; transition: .25s; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; background: #151713; color: var(--ink); width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(5,6,4,.72); }
.sheet { padding: 16px 18px 18px; overflow-y: auto; max-height: calc(100dvh - 26px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -8px 6px 0; }
.sheet h2 { margin: 0; font-size: 1.2rem; }
.fine { color: var(--mute); font-size: .82rem; margin: 8px 0 0; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 16px; text-align: center; }
.nums div { background: var(--miss); border-radius: 12px; padding: 8px 2px; }
.nums dt { font-size: .7rem; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.nums dd { margin: 0; font: 800 1.4rem var(--mono); }
.dist { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.dist li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font: 700 .85rem var(--mono); }
.dist i { display: block; min-width: 26px; padding: 3px 7px; border-radius: 6px; background: var(--miss); font-style: normal; text-align: right; }
.dist li.now i { background: var(--lime); color: #10110e; }
.lost { justify-content: center; align-items: center; text-align: center; }

/* Holder perks */
.icon.me.on { padding: 0; }
.icon.me img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 9px; background: #0d0e0c; box-shadow: 0 0 0 2px var(--lime); }
.post { display: grid; gap: 2px; justify-items: center; }
.btn.holder { background: #1e2416; border-color: rgba(198,255,77,.5); padding-left: 8px; }
.btn.holder img { width: 30px; height: 30px; image-rendering: pixelated; border-radius: 8px; background: #0d0e0c; }
.btn.holder:disabled { opacity: 1; color: var(--lime); cursor: default; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .85rem; }
.board-sec { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.board-sec h3, .pick-title { margin: 0 0 8px; font-size: .95rem; }
.board, .board-you { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.board li, .board-you li { display: grid; grid-template-columns: 22px 32px 1fr auto; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 10px; background: var(--miss); list-style: none; }
.board li.you, .board-you li { background: #1e2416; box-shadow: inset 0 0 0 1px rgba(198,255,77,.5); }
.board-you { margin-top: 6px; }
.board img, .board-you img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 7px; background: #0d0e0c; }
.board .rank, .board-you .rank { font: 700 .8rem var(--mono); color: var(--mute); text-align: center; }
.board .addr, .board-you .addr { font: 600 .82rem var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .streak, .board-you .streak { font: 800 1rem var(--mono); color: var(--lime); }
.sheet .lead { margin: 0 0 12px; font-weight: 600; }
.sheet .msg { margin: 10px 0 0; min-height: 1.2em; color: var(--coral); font-size: .9rem; text-align: center; }
.wallets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wallet { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--miss); font-weight: 700; text-align: left; }
.wallet:hover { border-color: var(--lime); }
.wallet img, .wallet svg { width: 32px; height: 32px; border-radius: 8px; font-size: 32px; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px; font: 700 .95rem var(--mono); }
.mine { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mine button { position: relative; width: 100%; aspect-ratio: 1; padding: 4px; border-radius: 12px; border: 2px solid var(--line); background: #11130f; }
.mine button img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.mine button span { position: absolute; left: 0; right: 0; bottom: 0; font: 700 .66rem var(--mono); color: var(--mute); text-align: center; }
.mine button[aria-pressed="true"] { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(198,255,77,.25); }

@media (min-width: 600px) { .choices { grid-template-columns: repeat(4, 1fr); } .choices button { max-height: none; } .stage { width: min(280px, 40dvh); } }
/* Short portrait screens: choices in one row so the round fits without scrolling. */
@media (orientation: portrait) and (max-height: 600px) { .choices { grid-template-columns: repeat(4, 1fr); gap: 6px; } .choices button { padding: 6px; border-radius: 14px; max-height: none; } }
/* Phone landscape and short screens: shadow on the left, choices on the right. */
@media (orientation: landscape) and (max-height: 560px) {
  main { max-width: 900px; }
  .top { max-width: 900px; padding-top: 4px; }
  .play { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; column-gap: 18px; row-gap: 6px; align-items: center; }
  .dots { grid-column: 1; justify-self: center; }
  .hint { grid-column: 2; grid-row: 1; justify-self: start; text-align: left; }
  .stage { grid-column: 1; grid-row: 2 / span 2; width: min(46dvh, 240px); }
  .choices { grid-column: 2; grid-row: 2 / span 2; grid-template-columns: repeat(4, 1fr); margin: 0; }
  .choices button { max-height: none; }
  .end { display: grid; grid-template-columns: auto 1fr; text-align: left; justify-items: start; column-gap: 20px; }
  .score, .squares, .streak { grid-column: 1; justify-self: center; }
  .strip, .end-actions, .post, .next { grid-column: 2; }
  .foot { padding: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
