:root {
  --bg: #16122e; --bg2: #221c46; --card: rgba(255,255,255,.055); --card2: rgba(255,255,255,.09);
  --line: rgba(255,255,255,.12); --text: #eeeafc; --muted: #a7a0cc; --gold: #f5c46b; --gold2: #ffdf9e;
  --good: #6fdca7; --bad: #ff7d7d; --violet: #a993ff; --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(169,147,255,.22), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(245,196,107,.10), transparent 60%),
    linear-gradient(180deg, #1b1640 0%, #16122e 50%, #120f26 100%); }
.sky::after { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(1px 1px at 10% 20%, #fff8, transparent), radial-gradient(1px 1px at 30% 80%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, #fff9, transparent), radial-gradient(1px 1px at 85% 70%, #fff5, transparent),
    radial-gradient(1px 1px at 50% 50%, #fff6, transparent), radial-gradient(1.5px 1.5px at 20% 60%, #fff7, transparent);
  background-size: 420px 420px; }
a { color: var(--gold2); }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; margin: 0 0 .4em; }
h2 { font-size: 1.55rem; } h3 { font-size: 1.1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.gold { color: var(--gold); } .good { color: var(--good); } .bad { color: var(--bad); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); }
.brand b { font-family: var(--serif); font-size: 1.15rem; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: .75rem; }
.wallet { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .85rem; white-space: nowrap; }
.chip b { color: var(--gold2); font-weight: 600; }

.tabs { display: flex; gap: 4px; max-width: 1180px; margin: 0 auto; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 9px 14px; border-radius: 10px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--card2); color: var(--text); }
main { max-width: 1180px; margin: 0 auto; padding: 14px; }
.tab { display: none; } .tab.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } }
.col-side { display: grid; gap: 16px; }

/* steps */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 12px; }
.steps li { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 8px 4px; border-radius: 12px; color: var(--muted); font-size: .85rem; background: var(--card); border: 1px solid transparent; transition: .2s; }
.steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--card2); }
.steps li.on { color: var(--text); border-color: rgba(245,196,107,.5); background: rgba(245,196,107,.10); }
.steps li.on span { background: var(--gold); color: #2a2040; font-weight: 700; }
.steps li.done { color: var(--text); } .steps li.done span { background: var(--violet); color: #1a1530; }
@media (max-width: 480px) { .steps li { font-size: .74rem; gap: 5px; } }

/* stage */
.stage, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(6px); }
.stage { padding: 20px; min-height: 380px; position: relative; overflow: hidden; }
.panel { padding: 16px; }
.panel h3 { display: flex; justify-content: space-between; align-items: baseline; }
.loading { color: var(--muted); text-align: center; padding: 80px 0; }
.stage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; color: var(--muted); margin-bottom: 2px; }
.timer { text-align: right; flex-shrink: 0; }
.timer .t { font-family: var(--serif); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.timer .t.hot { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.bar { height: 4px; background: var(--card2); border-radius: 4px; overflow: hidden; margin: 6px 0 0; width: 120px; margin-left: auto; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); transition: width .25s linear; }

/* auction */
.bidbox { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, rgba(245,196,107,.12), rgba(169,147,255,.08)); border: 1px solid rgba(245,196,107,.25); }
@media (max-width: 560px) { .bidbox { grid-template-columns: 1fr; } }
.topbid .amt { font-family: var(--serif); font-size: 2.4rem; color: var(--gold2); line-height: 1.05; font-variant-numeric: tabular-nums; }
.topbid .amt small { font-size: 1rem; color: var(--muted); }
.bidform { display: grid; gap: 8px; min-width: 240px; }
.row { display: flex; gap: 8px; align-items: center; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
input[type=text], input[type=number], textarea { width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; transition: border .15s; }
input:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 70px; font-family: var(--serif); font-size: 1.15rem; }
.btn { background: var(--gold); color: #2a2040; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 650; cursor: pointer; transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); } .btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--card2); color: var(--text); font-weight: 500; }
.btn.small { padding: 6px 10px; font-size: .82rem; }
.bids { margin-top: 14px; display: grid; gap: 4px; max-height: 210px; overflow: auto; }
.bids div { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.03); font-size: .9rem; }
.bids div:first-child { background: rgba(245,196,107,.10); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; background: var(--card2); color: var(--muted); }
.badge.hot { background: rgba(255,125,125,.15); color: var(--bad); }
.badge.ok { background: rgba(111,220,167,.15); color: var(--good); }
.note { margin-top: 14px; font-size: .88rem; color: var(--muted); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .cards { gap: 8px; } }
.card { position: relative; aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; background: #2a2452; border: 2px solid transparent; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; padding: 0; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.card.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,196,107,.3), 0 10px 30px rgba(0,0,0,.4); }
.card.answer { border-color: var(--good); box-shadow: 0 0 0 3px rgba(111,220,167,.35); }
.card .tag { position: absolute; left: 8px; top: 8px; background: rgba(10,8,25,.75); padding: 2px 8px; border-radius: 999px; font-size: .72rem; }
.card .zoom { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(10,8,25,.65); display: grid; place-items: center; font-size: .9rem; }
.card .votes { position: absolute; inset: auto 0 0 0; padding: 22px 8px 7px; background: linear-gradient(transparent, rgba(10,8,25,.92)); font-size: .78rem; display: grid; gap: 3px; }
.vbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.vbar i { display: block; height: 100%; background: var(--violet); }
.vbar.h i { background: var(--gold); }
.back { aspect-ratio: 2/3; border-radius: 12px; background:
  repeating-linear-gradient(45deg, rgba(245,196,107,.08) 0 8px, transparent 8px 16px), linear-gradient(160deg, #3a3270, #221c46);
  border: 1px solid rgba(245,196,107,.3); display: grid; place-items: center; animation: float 3s ease-in-out infinite; }
.back:nth-child(2n) { animation-delay: .4s; } .back:nth-child(3n) { animation-delay: .8s; }
.back svg { opacity: .55; }
@keyframes float { 50% { transform: translateY(-4px); } }

.clue { font-family: var(--serif); font-size: 1.7rem; line-height: 1.25; text-align: center; padding: 10px 6px 18px; }
.clue::before, .clue::after { color: var(--gold); opacity: .8; }
.clue::before { content: "“"; } .clue::after { content: "”"; }
.sealed { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 4px 0 14px; color: var(--muted); font-size: .9rem; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; max-width: 260px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); transition: .3s; }
.dots i.on { background: var(--violet); border-color: var(--violet); box-shadow: 0 0 8px rgba(169,147,255,.7); }
.counter { text-align: right; font-size: .78rem; color: var(--muted); }
.counter.over { color: var(--bad); }

/* results */
.outcome { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; margin-bottom: 14px; }
.outcome.paid { background: rgba(111,220,167,.10); border: 1px solid rgba(111,220,167,.35); }
.outcome.burned, .outcome.void { background: rgba(255,125,125,.08); border: 1px solid rgba(255,125,125,.3); }
.outcome .big { font-size: 1.9rem; }
.meter { position: relative; height: 34px; margin: 18px 0 8px; }
.meter .track { position: absolute; left: 0; right: 0; top: 13px; height: 8px; border-radius: 4px; background: rgba(255,125,125,.25); }
.meter .band { position: absolute; top: 13px; height: 8px; background: rgba(111,220,167,.55); }
.meter .mark { position: absolute; top: 0; width: 2px; height: 34px; background: var(--gold2); transform: translateX(-1px); transition: left .8s cubic-bezier(.2,.8,.2,1); }
.meter .mark b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: .8rem; color: var(--gold2); white-space: nowrap; }
.meter .lbl { position: absolute; top: 24px; font-size: .7rem; color: var(--muted); transform: translateX(-50%); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.stat { background: rgba(255,255,255,.04); border-radius: 12px; padding: 10px 12px; }
.stat .v { font-family: var(--serif); font-size: 1.3rem; color: var(--gold2); }
.stat .k { font-size: .75rem; color: var(--muted); }
.picks { display: grid; gap: 6px; margin-top: 10px; }
.pick { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.03); font-size: .88rem; }
.pick .ok { color: var(--good); } .pick .no { color: var(--bad); }
.pick .why { color: var(--muted); font-size: .82rem; }
details summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin: 6px 0; }

/* side panels */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: .9rem; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.lead { display: grid; gap: 4px; font-size: .9rem; }
.lead div { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 8px; }
.lead div:nth-child(odd) { background: rgba(255,255,255,.03); }
.lead em { font-style: normal; color: var(--muted); font-size: .78rem; }
.status { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.status i.on { background: var(--good); box-shadow: 0 0 6px var(--good); }

/* join */
.join { max-width: 420px; margin: 10px auto; text-align: center; display: grid; gap: 10px; }

/* history */
.hist { display: grid; gap: 12px; }
.hrow { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.hrow .head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.thumbs img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: zoom-in; }
.thumbs img.answer { border-color: var(--good); }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }

/* prose */
.prose { max-width: 760px; }
.prose ol, .prose ul { padding-left: 1.2em; } .prose li { margin: 6px 0; }
.prose pre { background: rgba(0,0,0,.35); padding: 12px; border-radius: 10px; overflow: auto; font-size: .8rem; white-space: pre-wrap; }
.keybox { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.3); padding: 10px; border-radius: 10px; word-break: break-all; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(8,6,20,.92); z-index: 50; display: grid; place-items: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(560px, 94vw); max-height: 78vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lb-close { position: absolute; top: 12px; right: 14px; background: var(--card2); border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }
.lb-actions { margin-top: 14px; display: flex; gap: 8px; justify-content: center; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(30px); opacity: 0; background: #2d2560; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; transition: .25s; z-index: 60; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: rgba(255,125,125,.6); }
.admin { margin-top: 30px; border-top: 1px dashed var(--line); padding-top: 16px; }
.admin .row { flex-wrap: wrap; margin: 6px 0; }
.admin input { width: 90px; }
@media (max-width: 560px) {
  .top { flex-wrap: wrap; padding: 12px 14px 6px; }
  .brand small { display: none; }
  .wallet { width: 100%; justify-content: flex-start; gap: 6px; }
  .chip { padding: 4px 9px; font-size: .8rem; }
  .stage { padding: 16px 14px; }
  .clue { font-size: 1.45rem; }
  .timer .t { font-size: 1.7rem; }
}

.endnow { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.panelist { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: -4px 0 14px; }
.pchip { font-size: .75rem; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); transition: .3s; }
.pchip.on { color: var(--text); border-color: rgba(169,147,255,.6); background: rgba(169,147,255,.15); }
.pchip.friend { border-style: dashed; }
.pchip em { font-style: normal; opacity: .7; }
