:root {
  --bg: #0c0d0b; --panel: #151713; --line: #2a2d26; --ink: #eef3e4; --mute: #a3ab96;
  --lime: #c3ff5c; --lav: #b9a3ff; --coral: #ff7a63; --well: #1d201b;
  --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(195,255,92,.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, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; }
.fine { color: var(--mute); font-size: .82rem; margin: 8px 0 0; }
.mono { font-family: var(--mono); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px 0 14px; width: 100%; max-width: 960px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mark { width: 28px; height: 28px; transform: rotate(-6deg); }
h1 { margin: 0; font-size: 1.3rem; letter-spacing: -.03em; font-weight: 800; white-space: nowrap; }
h1 span { color: var(--lime); }
.no { font: 600 .78rem var(--mono); color: var(--mute); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.no:empty { display: none; }
.tools { display: flex; gap: 0; }
.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); }
.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); }

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

/* The reveal */
.game { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.frame { position: relative; width: min(100%, 420px, 52dvh); aspect-ratio: 1; border-radius: 18px; padding: 10px; background: #10120e;
  box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(195,255,92,.10); }
#art { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 8px; }
.soon { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 20px; }
.soon p { margin: 0; font-weight: 800; }
.soon time { font: 800 2.2rem var(--mono); color: var(--lime); }
.frame.win { animation: win .5s cubic-bezier(.2, 1.6, .4, 1); box-shadow: 0 0 0 3px var(--lime), 0 10px 40px rgba(195,255,92,.25); }
.frame.shake { animation: shake .42s both; box-shadow: 0 0 0 3px var(--coral); }
@keyframes win { 40% { transform: scale(1.04); } }
@keyframes shake { 15%, 55% { transform: translateX(-9px); } 35%, 75% { transform: translateX(9px); } 90% { transform: translateX(-3px); } }
.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.burst i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; animation: fly .8s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) rotate(90deg) scale(.3); opacity: 0; } }

.side { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.meter { display: grid; gap: 8px; }
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--well); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--lav), var(--lime)); border-radius: 99px; transition: width .8s; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; text-align: center; }
.nums div { background: var(--well); border-radius: 12px; padding: 7px 2px; }
.nums dt { font-size: .72rem; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.nums dd { margin: 0; font: 800 1.2rem var(--mono); font-variant-numeric: tabular-nums; }
.status { margin: 0; font-weight: 700; text-align: center; min-height: 2.8em; }
.act { display: grid; gap: 10px; justify-items: stretch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-weight: 800; text-decoration: none; }
.btn svg { font-size: 18px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--lime); color: #10110e; border-color: transparent; }
.btn.buzz { min-height: 58px; font-size: 1.15rem; animation: glow 2.6s ease-in-out infinite; }
.btn.buzz b { font: 800 .9rem var(--mono); background: rgba(16,17,14,.14); padding: 3px 8px; border-radius: 8px; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(195,255,92,.16); } }
.btn.holder-cta { border-style: dashed; border-color: #4a5141; color: var(--ink); }
.btn.holder-cta:hover { border-color: var(--lime); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .85rem; }

.result { display: grid; justify-items: center; gap: 6px; padding: 14px; border-radius: 18px; background: linear-gradient(160deg, #1a1d15, #131511); border: 1px solid var(--line); text-align: center; animation: pop .4s both; }
.result.right { border-color: rgba(195,255,92,.5); }
.result.wrong { border-color: rgba(255,122,99,.5); }
.result .as { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 99px; background: #1e2416; font: 700 .85rem var(--mono); color: var(--lime); }
.result .as img { width: 28px; height: 28px; image-rendering: pixelated; border-radius: 50%; background: #0d0e0c; }
.result .big { margin: 0; font: 800 2.8rem/1 var(--mono); color: var(--lime); letter-spacing: -.03em; }
.result.wrong .big { color: var(--coral); }
.result .sub { margin: 0; color: var(--ink); font-weight: 600; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.answer { display: grid; gap: 8px; }
.answer-card { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; border-radius: 14px; background: #1e2416; box-shadow: inset 0 0 0 1px rgba(195,255,92,.5); text-decoration: none; }
.answer-name { font-weight: 800; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-id { font: 700 .95rem var(--mono); color: var(--lime); }
.proof { border-radius: 14px; background: var(--well); }
.proof summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; cursor: pointer; font-weight: 700; list-style: none; }
.proof summary::-webkit-details-marker { display: none; }
.proof dl { margin: 0; padding: 0 14px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: .82rem; }
.proof dt { color: var(--mute); margin-top: 6px; }
.proof dd { margin: 0; overflow-wrap: anywhere; }
.proof dd.ok, .proof dd.bad { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.proof dd.ok { color: var(--lime); } .proof dd.bad { color: var(--coral); }
.commit { text-align: center; margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

.yday { width: 100%; max-width: 420px; margin: 0 auto; }
.yday h2 { margin: 0 0 6px; font-size: .85rem; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.yday-card { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; }
.yday-card canvas { width: 56px; height: 56px; image-rendering: pixelated; border-radius: 10px; background: #080907; flex: none; }
.yday-card > span { flex: 1; min-width: 0; display: grid; }
.yday-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yday-card span span { color: var(--mute); font-size: .82rem; }

.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 a { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 12px 2px; margin: -12px 0; }
.foot .maker { text-decoration-color: var(--lime); }
.foot .sib { text-decoration-color: var(--lav); }

.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; max-width: calc(100vw - 32px); text-align: center; }
.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(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
dialog::backdrop { background: rgba(5,6,4,.72); }
.sheet { padding: 14px 16px 16px; overflow-y: auto; max-height: calc(100dvh - 26px); overscroll-behavior: contain; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 6px 0; }
.sheet h2 { margin: 0; font-size: 1.2rem; }
.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; }
.pick-title { margin: 14px 0 8px; font-size: .95rem; }

/* Picker */
.pick-sheet { display: flex; flex-direction: column; padding-bottom: 0; }
.pick-tools { display: grid; grid-template-columns: 1fr auto; gap: 6px; position: sticky; top: -14px; background: #151713; padding: 4px 0 2px; z-index: 2; }
.search { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--well); }
.search:focus-within { border-color: var(--lav); }
.search svg { color: var(--mute); font-size: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; }
select { min-height: 48px; max-width: 9.5em; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--well); font-size: 15px; }
.grid { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.grid button { width: 100%; display: grid; justify-items: center; gap: 1px; padding: 6px 4px 6px; border-radius: 12px; border: 2px solid var(--line); background: #11130f; min-height: 44px; }
.grid button:hover { border-color: #4a5141; }
.grid img { width: 100%; aspect-ratio: 1; height: auto; image-rendering: pixelated; }
.grid b { font: 700 .78rem var(--mono); }
.grid span { font-size: .72rem; color: var(--mute); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm { position: sticky; bottom: 0; margin: 10px -16px 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: #1a1d16; border-top: 1px solid rgba(195,255,92,.4);
  display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "back img text" "go go go"; align-items: center; gap: 8px 10px; z-index: 3; }
.confirm #confirm-back { grid-area: back; }
.confirm img { grid-area: img; width: 56px; height: 56px; image-rendering: pixelated; border-radius: 10px; background: #0d0e0c; }
.confirm-text { grid-area: text; display: grid; min-width: 0; }
.confirm-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-text span { color: var(--mute); font-size: .82rem; }
.confirm #confirm-go { grid-area: go; }
#pick-msg:empty { display: none; }
#pick-msg { position: sticky; bottom: 0; background: #151713; padding: 6px 0 12px; margin: 0; }
.confirm:not([hidden]) + #pick-msg { bottom: auto; }
#more { margin-bottom: 14px; }

/* Boards */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--well); margin-bottom: 10px; }
.tabs button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 800; color: var(--mute); }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--lime); box-shadow: inset 0 0 0 1px var(--line); }
.rows, .you { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rows li, .you li { display: grid; grid-template-columns: 24px 32px 1fr auto; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--well); list-style: none; }
.rows li.you, .you li { background: #1e2416; box-shadow: inset 0 0 0 1px rgba(195,255,92,.5); }
.rows li.out .val { color: var(--coral); }
.you { margin-top: 6px; }
.rows img, .you img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 7px; background: #0d0e0c; }
.rank { font: 700 .8rem var(--mono); color: var(--mute); text-align: center; }
.rows .who, .you .who { display: grid; min-width: 0; line-height: 1.2; }
.rows .who b, .you .who b { font: 700 .88rem var(--mono); }
.rows .who span, .you .who span { font-size: .75rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val { font: 800 1rem var(--mono); color: var(--lime); }

/* Holders */
.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(--well); 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; 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 4px 14px; border-radius: 12px; border: 2px solid var(--line); background: #11130f; }
.mine button img { width: 100%; height: 100%; image-rendering: pixelated; display: block; object-fit: contain; }
.mine button span { position: absolute; left: 0; right: 0; bottom: 1px; font: 700 .72rem var(--mono); color: var(--mute); text-align: center; }
.mine button[aria-pressed="true"] { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(195,255,92,.25); }
.rules { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }

/* Desktop and tablets: art left, controls right. */
@media (min-width: 760px) {
  .game { flex-direction: row; align-items: flex-start; justify-content: center; gap: 28px; padding-top: 12px; }
  .frame { width: min(480px, 70dvh); }
  .side { padding-top: 6px; }
  .status { text-align: left; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  dialog#pick { width: min(560px, calc(100vw - 24px)); }
}
/* Phone landscape and short screens: art left, controls right, everything visible. */
@media (orientation: landscape) and (max-height: 560px) {
  .top { padding-top: 2px; }
  main { padding-top: 4px; }
  .game { flex-direction: row; align-items: flex-start; justify-content: center; gap: 18px; }
  .frame { width: min(calc(100dvh - 90px), 340px); padding: 6px; flex: none; }
  .side { gap: 8px; }
  .status { min-height: 0; text-align: left; font-size: .92rem; }
  .nums dd { font-size: 1.05rem; }
  .foot { padding: 4px 14px 8px; }
}
@media (orientation: portrait) and (max-height: 600px) {
  .frame { width: min(100%, 44dvh); padding: 6px; }
  .status { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
