/* SWARM · Solana Lab: quiet white chrome, ink type, Solana purple as the one
   accent, the board as the bright thing. Solana's purple→green only appears in
   its logomark, the player's own gates and the jackpot stripe. */
:root {
  --bg: #f6f6f9;
  --card: #ffffff;
  --ink: #14121a;
  --muted: #6b6878;
  --faint: #a5a2b3;
  --line: #e7e5ee;
  --hair: #f1f0f5;
  --accent: #9945ff;
  --accent-ink: #7a2ee6;
  --accent-soft: #f6f1ff;
  --mint: #14f195;
  --crowd: #cdc4e8;
  --win: #0f9d63;
  --lose: #d6453d;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body.play { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; }
b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ---- header ---- */
header { display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font: 800 17px/1 Unbounded, Geist, sans-serif; letter-spacing: -0.02em; text-decoration: none; }
.logo img { display: block; }
.sep { width: 1px; height: 20px; background: var(--line); }
.solmark { width: 16px; height: 13px; flex: none; }
.built { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 13px; }
.built b { color: var(--ink); }
.built:hover b { color: var(--accent-ink); }
.net { display: inline-flex; align-items: center; gap: 6px; font: 400 12px "Geist Mono", monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.net i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(20, 241, 149, 0.2); }
.net.main i { background: var(--accent); box-shadow: 0 0 0 3px rgba(153, 69, 255, 0.2); }
.price { display: flex; align-items: center; gap: 8px; margin-left: 4px; }
.coin { width: 24px; height: 24px; border-radius: 50%; background: #000; display: grid; place-items: center; flex: none; }
.coin svg { width: 13px; height: 11px; }
.price #price { font: 500 18px "Geist Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.price small { font: 400 11px "Geist Mono", monospace; color: var(--faint); }
nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.link { color: var(--muted); text-decoration: none; padding: 8px 10px; font-weight: 500; border-radius: 8px; }
.link:hover { color: var(--ink); background: var(--bg); }

.btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: background 0.15s, transform 0.08s var(--ease);
}
.btn:hover { background: #2a2733; }
.btn:active { transform: translateY(1px); }
.btn.ghost, .btn.quiet { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover, .btn.quiet:hover { background: var(--bg); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-ink); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn img { width: 18px; height: 18px; border-radius: 4px; }

/* ---- board + side panel ---- */
.wrap { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 12px 16px 16px; }
main { flex: 1; min-width: 0; position: relative; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#hint { position: absolute; left: 14px; bottom: 14px; max-width: calc(100% - 28px); pointer-events: none; color: var(--muted);
  background: rgba(255, 255, 255, 0.95); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 13px; }
#hint:empty { display: none; }
#hint b { color: var(--ink); }
#toast { position: absolute; left: 50%; top: 48px; transform: translate(-50%, -6px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s var(--ease);
  background: var(--ink); color: var(--mint); font: 600 15px Geist, sans-serif; padding: 8px 16px; border-radius: 10px; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.quiet { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; font-size: 14px; }
.share-pill { position: absolute; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--accent); background: var(--card); color: var(--accent-ink); font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: 0 4px 14px rgba(20, 18, 26, 0.08); animation: pill-in 0.45s var(--ease); }
.share-pill:hover { background: var(--accent-soft); }
.share-pill[hidden] { display: none; }
main:has(#shareWin:not([hidden])) #hint { display: none; }
.share-pill .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pill-in { from { opacity: 0; transform: translateY(8px) scale(0.92); } to { opacity: 1; transform: none; } }
.sheet-body .share-card { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
#toast.bad { background: var(--lose); color: #fff; font-weight: 500; font-size: 14px; }

aside { width: 288px; flex: none; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pair { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card small { display: block; font-size: 12px; color: var(--muted); }
.jack { position: relative; overflow: hidden; background: var(--ink); border-color: var(--ink); color: #fff; padding-bottom: 18px; }
.jack small { color: #bdb6d6; }
.jack b { display: block; font: 500 30px/1.15 "Geist Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.8px; margin-top: 2px; }
.jack em { display: block; font: 400 12px Geist, sans-serif; font-style: normal; color: #bdb6d6; margin-top: 6px; }
.jack .wm { position: absolute; right: 16px; top: 18px; width: 52px; height: 41px; }
.jack .stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, #9945ff, #14f195); }
.jack.rush small { color: var(--mint); }
.jack.pop b { animation: pop 0.45s var(--ease); }
.you { display: flex; flex-wrap: wrap; }
.you .rank { flex: 0 0 100%; margin-bottom: 12px; }
.you .row { flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.you .row + .row { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--hair); }
.you .row.best { flex: 0 0 auto; }
.you .row small { font-size: 12px; white-space: nowrap; }
.you .row b { font: 500 17px "Geist Mono", monospace; font-variant-numeric: tabular-nums; }
.you .row span { display: inline-flex; align-items: center; gap: 8px; }
.win b { color: var(--win); }
.win.ready { cursor: pointer; }
.win.ready small { color: var(--accent-ink); font-weight: 600; }
.win.ready small::after { content: " ›"; }
.win.pop b { display: inline-block; animation: pop 0.45s var(--ease); }
@keyframes pop { 40% { transform: scale(1.1); } }
.mini { display: none; font: 600 12px Geist, sans-serif; color: var(--accent-ink); background: var(--accent-soft); border: 0; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.mini:hover { background: #ece2ff; }
.stake small { margin-bottom: 8px; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 0; font: 500 13px "Geist Mono", monospace; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.chip:hover { border-color: var(--faint); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.icon { padding: 7px 9px; display: inline-flex; align-items: center; }
.btn.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.icon .spk { fill: currentColor; }
.btn.icon .off, .btn.icon.muted .on { display: none; }
.btn.icon.muted .off { display: inline; }
.btn.icon.muted { color: var(--faint); }
.rank { padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.rank-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rank-top b { font: 600 14px Geist, sans-serif; }
.rank-top small { font: 400 11px "Geist Mono", monospace; color: var(--muted); white-space: nowrap; }
.rank .bar { height: 5px; margin-top: 8px; border-radius: 3px; background: var(--hair); overflow: hidden; }
.rank .bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--mint)); transition: width 0.8s var(--ease); }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 7px; height: 12px; border-radius: 2px; background: var(--hair); transition: background 0.3s, transform 0.3s var(--ease); }
.pips i.on { background: linear-gradient(180deg, #ffc531, #ff7a1a); transform: scaleY(1.1); }
.credits { margin-top: auto; display: grid; gap: 8px; padding: 4px 4px 0; font-size: 12px; color: var(--muted); }
.credits a { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.credits a:hover span { color: var(--ink); }
.credits b { color: var(--ink); font-weight: 600; }
.credits .solmark, .ico { width: 14px; height: 14px; flex: none; }
.ico { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---- first visit: the welcome card on the board ---- */
.welcome { position: absolute; left: 16px; bottom: 16px; width: min(380px, calc(100% - 32px)); background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 12px 40px rgba(20, 18, 26, 0.1); display: grid; gap: 10px; }
.welcome[hidden] { display: none; }
.welcome:not([hidden]) ~ #hint { display: none; }
.welcome h2 { margin: 0; font: 600 19px/1.2 Geist, sans-serif; letter-spacing: -0.3px; }
.welcome p { margin: 0; color: var(--muted); font-size: 13px; }
.welcome .cta { display: flex; gap: 8px; margin-top: 2px; }
.welcome .cta .btn { flex: 1; padding: 10px 14px; }
.welcome .fine { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); }
.skip { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 0; text-decoration: underline; text-underline-offset: 3px; }
.skip:hover { color: var(--ink); }

/* ---- the results feed ---- */
aside > * { flex: none; }
/* the feed is the one card that gives up rows when the window is short */
.feed { padding: 14px 16px; min-height: 0; overflow: hidden; flex: 0 1 auto; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.feed-head a { font-size: 12px; color: var(--accent-ink); text-decoration: none; }
.feed-head a:hover { text-decoration: underline; }
.feed ol { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--hair); font-size: 12px; color: var(--muted); white-space: nowrap; }
.feed li:first-child { border-top: 0; }
.feed li.empty { display: block; color: var(--faint); }
.feed li.cut { display: none; }
.feed li .id { font: 400 11px "Geist Mono", monospace; color: var(--faint); }
.feed li .paid { font: 500 12px "Geist Mono", monospace; color: var(--win); }
.feed li .paid.none { color: var(--faint); }
.feed li.new { animation: slidein 0.5s var(--ease); }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); background: var(--accent-soft); } }
.chips .key { display: none; }
@media (hover: hover) and (min-width: 761px) { .chip { position: relative; } .chip .key { display: block; position: absolute; top: 2px; right: 4px; font: 400 9px "Geist Mono", monospace; color: var(--faint); } .chip.on .key { color: rgba(255, 255, 255, 0.7); } }

/* ---- sheet ---- */
dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; background: var(--card); color: var(--ink); box-shadow: 0 24px 64px rgba(20, 18, 26, 0.18); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20, 18, 26, 0.32); }
.sheet-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.sheet-body h2 { margin: 0 32px 0 0; font: 600 22px/1.2 Geist, sans-serif; letter-spacing: -0.4px; }
.sheet-body p { margin: 0; color: var(--muted); }
.sheet-body ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.sheet-body ol b { color: var(--ink); }
.sheet-body .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sheet-body .row .btn { flex: 1; }
.sheet-body .note { font-size: 12px; color: var(--muted); }
.sheet-body .mono { font: 400 12px "Geist Mono", monospace; color: var(--muted); word-break: break-all; }
.sheet-body .list { display: grid; gap: 8px; }
.sheet-body .close { position: absolute; right: 14px; top: 14px; border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.sheet-body .close:hover { background: var(--bg); color: var(--ink); }
.sheet-body .powered { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--hair); }

/* ---- phones ---- */
@media (max-width: 760px) {
  header { gap: 8px; padding: 10px 12px; }
  .logo { font-size: 15px; gap: 6px; }
  .logo img { width: 26px; height: 26px; }
  .sep, .built, #how, .link, .price small { display: none; }
  .price { margin-left: auto; }
  .price #price { font-size: 15px; }
  nav { margin-left: auto; }
  .btn { padding: 7px 11px; font-size: 13px; }
  .who-kind, .price { display: none; }
  #who { max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .price .coin { display: none; }
  nav { min-width: 0; }
  .wrap { flex-direction: column; padding: 8px 8px 10px; gap: 8px; }
  main { flex: 1; min-height: 0; border-radius: 14px; }
  #hint { left: 10px; bottom: 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* the phone keeps it basic: the board, one row of four numbers, the stakes */
  aside { width: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .pair, .you { display: contents; }
  .you .rank, .you .row .pips, .jack .wm, .jack em, .mini { display: none; }
  .you .row, .jack { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-width: 0; min-height: 0;
    padding: 8px 10px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .you .row + .row { margin: 0; padding: 8px 10px; border-left: 1px solid var(--line); }
  .you .row small, .jack small { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .you .row b, .jack b { font: 500 14px/1.25 "Geist Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; margin: 0; }
  .you .row span { gap: 0; }
  .jack { order: 4; background: var(--ink); border-color: var(--ink); padding-bottom: 10px; }
  .jack .stripe { height: 3px; }
  .stake { order: 5; grid-column: 1 / -1; padding: 0; border: 0; background: none; }
  .stake small { display: none; }
  .chip { padding: 12px 0; font-size: 15px; }
  .credits, .feed { display: none; }
  .welcome { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 14px; }
  .welcome h2 { font-size: 17px; }
}
