:root {
  --bg: #0a0a0f;
  --panel: #121219;
  --panel-2: #181822;
  --line: #24242f;
  --text: #f4f2ea;
  --muted: #8f8d9c;
  --volt: #ffc93c;
  --volt-2: #ff8a1f;
  --good: #4fe3a1;
  --bad: #ff5d5d;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 22px;
  color-scheme: dark;
}

/* The six looks a payer can pick: background, accent, text, glow */
[data-color="volt"]   { --b-bg: #0f0d06; --b-bg2: #1d1708; --b-acc: #ffc93c; --b-fg: #fff8e6; --b-glow: #ffc93c55; }
[data-color="ember"]  { --b-bg: #140604; --b-bg2: #2a0d06; --b-acc: #ff6a3d; --b-fg: #fff0ea; --b-glow: #ff6a3d55; }
[data-color="matrix"] { --b-bg: #020a05; --b-bg2: #06170d; --b-acc: #39ff88; --b-fg: #dcffe9; --b-glow: #39ff8844; }
[data-color="ice"]    { --b-bg: #040d14; --b-bg2: #08202f; --b-acc: #5cd6ff; --b-fg: #ebf9ff; --b-glow: #5cd6ff44; }
[data-color="rose"]   { --b-bg: #12050b; --b-bg2: #2a0a19; --b-acc: #ff5fa2; --b-fg: #ffeaf3; --b-glow: #ff5fa244; }
[data-color="paper"]  { --b-bg: #f4efe2; --b-bg2: #e9e1cc; --b-acc: #111111; --b-fg: #111111; --b-glow: #00000022; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--display);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---- ticker ---- */
.ticker {
  border-bottom: 1px solid var(--line);
  background: #07070b;
  overflow: hidden;
  white-space: nowrap;
  font: 600 12px var(--mono);
  letter-spacing: .04em;
  color: var(--muted);
  height: 34px;
  display: flex;
  align-items: center;
}
.ticker-track { display: inline-flex; animation: tick var(--tick-s, 60s) linear infinite; }
.ticker-track span { padding-right: 48px; }
.ticker-track span b { color: var(--volt); font-weight: 700; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---- header ---- */
.top { max-width: 1200px; margin: 0 auto; padding: 18px 20px 14px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.bolt { width: 22px; height: 22px; fill: var(--volt); filter: drop-shadow(0 0 10px #ffc93c88); }
.live { display: flex; align-items: center; gap: 8px; font: 500 13px var(--mono); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #4fe3a1aa; } 70% { box-shadow: 0 0 0 9px #4fe3a100; } 100% { box-shadow: 0 0 0 0 #4fe3a100; } }

main { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- the billboard ---- */
.board {
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
  min-height: min(64vh, 620px);
  padding: clamp(22px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(120% 90% at 0% 0%, var(--b-bg2), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, var(--b-bg2), transparent 55%),
    var(--b-bg);
  color: var(--b-fg);
  border: 1px solid color-mix(in srgb, var(--b-acc) 35%, transparent);
  box-shadow: 0 40px 120px -40px var(--b-glow), inset 0 1px 0 #ffffff10;
  transition: background .6s, color .6s, border-color .6s, box-shadow .6s;
}
.board::before { /* LED grain */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 1px 1px, #ffffff0c 1px, transparent 1.2px) 0 0 / 5px 5px;
  mix-blend-mode: overlay;
}
.board::after { /* slow sweep of light */
  content: "";
  position: absolute;
  inset: -50%;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 45%, #ffffff0a 50%, transparent 55%);
  animation: sweep 9s ease-in-out infinite;
}
@keyframes sweep { 0% { transform: translateX(-40%); } 60%, 100% { transform: translateX(40%); } }
[data-color="paper"].board::before { mix-blend-mode: multiply; background-image: radial-gradient(circle at 1px 1px, #0000000d 1px, transparent 1.2px); }

.board-top, .board-bottom { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.board-bottom { justify-content: space-between; align-items: flex-end; gap: 18px 32px; }
.chip {
  font: 700 12px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 7px 11px;
  border-radius: 99px;
  background: var(--b-acc);
  color: var(--b-bg);
}
.chip.ghost { background: transparent; color: var(--b-acc); border: 1px solid color-mix(in srgb, var(--b-acc) 50%, transparent); }
.chip.ghost:empty { display: none; }

.message {
  position: relative;
  z-index: 1;
  margin: 28px 0;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1;
  font-size: var(--fs, 72px);
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-shadow: 0 0 40px var(--b-glow);
}
.message.enter { animation: enter .7s cubic-bezier(.2, .9, .2, 1); }
@keyframes enter { 0% { opacity: 0; transform: translateY(24px) scale(.98); filter: blur(10px); } 100% { opacity: 1; transform: none; filter: none; } }

.owner { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.by { font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: .65; }
.name { font-weight: 800; font-size: clamp(24px, 3.2vw, 36px); letter-spacing: -.02em; color: var(--b-acc); overflow-wrap: anywhere; }
.facts { display: flex; gap: 28px; }
.facts > div { display: flex; flex-direction: column; }
.facts .k { font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.facts .v { font: 700 20px var(--mono); font-variant-numeric: tabular-nums; }

/* lightning strike on takeover */
.strike { position: absolute; z-index: 2; left: 50%; top: 0; width: 26%; height: 100%; transform: translateX(-50%); fill: var(--b-acc); opacity: 0; pointer-events: none; filter: drop-shadow(0 0 30px var(--b-acc)); }
.board.hit .strike { animation: strike .9s ease-out; }
.board.hit { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes strike { 0% { opacity: 0; } 8% { opacity: 1; } 16% { opacity: .2; } 24% { opacity: .9; } 100% { opacity: 0; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }

/* ---- bid bar ---- */
.bid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 22px;
}
.bid-price { display: flex; flex-direction: column; }
.k { font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.price { font-weight: 800; font-size: 52px; line-height: 1; letter-spacing: -.04em; color: var(--volt); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px #ffc93c44; }
.price small { font-size: 18px; color: var(--text); margin-left: 6px; letter-spacing: 0; text-shadow: none; }
.price.bump { animation: bump .6s ease-out; }
@keyframes bump { 30% { transform: scale(1.12); color: #fff; } }
.drop { font: 500 12px var(--mono); color: var(--muted); margin-top: 6px; }
.drop b { color: var(--good); font-weight: 600; }
.spark { width: 100%; height: 48px; overflow: visible; }
.spark path.line { fill: none; stroke: var(--volt); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark path.area { fill: url(#sparkfill); }
.spark circle { fill: var(--volt); }

.cta {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.01em;
  padding: 18px 26px;
  border-radius: 16px;
  color: #1a1203;
  background: linear-gradient(180deg, #ffd65e, var(--volt) 40%, var(--volt-2));
  box-shadow: 0 12px 40px -10px #ffb02eaa, inset 0 1px 0 #ffffff80;
  transition: transform .12s, filter .12s;
  white-space: nowrap;
}
.cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: .6; cursor: progress; transform: none; }
.cta.wide { width: 100%; }

/* ---- stats ---- */
.stats { margin-top: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .v { font: 700 26px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .k { text-transform: none; letter-spacing: 0; font: 500 13px var(--display); }

/* ---- panels ---- */
.cols { margin-top: 16px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; min-width: 0; }
.panel h2 { margin: 0 0 14px; font: 600 12px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.reigns, .fame, .rules { list-style: none; margin: 0; padding: 0; }
.reigns li { display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: baseline; }
.reigns li:first-child { border-top: 0; }
.reigns li.fresh { animation: fresh 1.4s ease-out; }
@keyframes fresh { from { background: #ffc93c1c; } to { background: transparent; } }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--b-acc); align-self: center; }
.reigns .who { font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.reigns .who small { font: 500 12px var(--mono); color: var(--muted); }
.reigns .sats { font: 700 14px var(--mono); color: var(--volt); }
.reigns .msg { grid-column: 2 / -1; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reigns a.msg { text-decoration: none; }
.reigns a.msg:hover { color: var(--text); }
.bot { font: 600 10px var(--mono); padding: 2px 6px; border-radius: 6px; background: #5cd6ff1f; color: #8fe3ff; letter-spacing: .06em; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button { cursor: pointer; background: transparent; border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--muted); }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.fame { counter-reset: n; }
.fame li { counter-increment: n; display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.fame li:first-child { border-top: 0; }
.fame li::before { content: counter(n); width: 22px; font: 600 13px var(--mono); color: var(--muted); }
.fame li:nth-child(1)::before { content: "🥇"; }
.fame li:nth-child(2)::before { content: "🥈"; }
.fame li:nth-child(3)::before { content: "🥉"; }
.fame .n { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fame .v { font: 600 14px var(--mono); color: var(--volt); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

.how { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.rules li { padding: 7px 0; color: var(--muted); }
.rules b { color: var(--text); font-weight: 600; }
.how a { color: var(--volt); }
.code { font: 12.5px/1.6 var(--mono); background: #07070b; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; color: #d6d3c4; margin: 12px 0 0; white-space: pre; }

.foot { max-width: 1200px; margin: 0 auto; padding: 36px 20px 120px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- the take-over sheet ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: #000000b8; backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; padding: 26px; animation: rise .3s cubic-bezier(.2, .9, .2, 1); }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.sheet h3 { margin: 0 0 16px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 20px; line-height: 1; color: var(--muted); }
.close:hover { color: var(--text); }

.preview {
  border-radius: 16px; padding: 18px; min-height: 120px; margin-bottom: 16px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  background: radial-gradient(120% 90% at 0% 0%, var(--b-bg2), transparent 60%), var(--b-bg);
  color: var(--b-fg); border: 1px solid color-mix(in srgb, var(--b-acc) 35%, transparent);
  transition: background .3s, color .3s;
}
.preview-msg { font-weight: 800; font-size: 24px; line-height: 1.05; letter-spacing: -.02em; overflow-wrap: anywhere; }
.preview-by { font: 700 13px var(--mono); color: var(--b-acc); }

.field { display: block; position: relative; margin-bottom: 12px; }
.field > span:first-child { display: block; font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea { width: 100%; font: 500 16px var(--display); color: var(--text); background: #07070b; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: none; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px #ffc93c22; }
.count { position: absolute; right: 12px; bottom: 10px; font: 500 11px var(--mono); color: var(--muted); }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 38px; height: 38px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; background: linear-gradient(135deg, var(--b-bg) 50%, var(--b-acc) 50%); outline: 1px solid var(--line); }
.swatches button.on { border-color: var(--text); transform: scale(1.08); }
.fine { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

.hl { color: var(--volt); }
.qr { display: block; width: fit-content; margin: 16px auto; padding: 14px; background: #fff; border-radius: 16px; }
.qr img, .qr canvas { display: block; width: 248px; height: 248px; }
.inv-row { display: flex; gap: 8px; }
.inv-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); padding: 10px 12px; border-radius: 10px; background: #07070b; border: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--muted); }
.btn.x { background: var(--text); color: var(--bg); border-color: var(--text); }
.waiting { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.spin { width: 15px; height: 15px; border: 2px solid #ffffff2a; border-top-color: var(--volt); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.local { margin-top: 14px; font-size: 12px; color: var(--muted); }
.local .code { white-space: pre-wrap; word-break: break-all; font-size: 11px; }
.crown { font-size: 64px; line-height: 1; margin: 6px 0 10px; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.share { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

/* ---- toast & dethroned ---- */
.toast { position: fixed; z-index: 40; left: 50%; top: 46px; transform: translate(-50%, -24px); opacity: 0; pointer-events: none; background: var(--volt); color: #1a1203; font-weight: 700; padding: 12px 20px; border-radius: 99px; box-shadow: 0 12px 40px #ffc93c55; transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .2s; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.dethroned { position: fixed; inset: 0; z-index: 35; background: #000000c8; backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .25s; }
.dethroned-card { max-width: 420px; text-align: center; background: var(--panel); border: 1px solid #ff5d5d55; border-radius: 26px; padding: 28px; box-shadow: 0 30px 100px -30px #ff5d5d66; }
.dethroned-card h3 { margin: 6px 0 8px; font-size: 26px; font-weight: 800; }
.dethroned-card p { color: var(--muted); margin: 0; }
.dethroned-card .share { flex-direction: column; align-items: stretch; margin-top: 20px; }
.dethroned-card .share .btn { padding: 12px; }
.skull { font-size: 56px; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .cols, .how { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bid { grid-template-columns: 1fr auto; }
  .spark { display: none; }
}
@media (max-width: 560px) {
  .top { padding: 14px 16px 10px; }
  main { padding: 0 16px; }
  .board { min-height: 58vh; }
  .facts { gap: 20px; }
  .facts .v { font-size: 17px; }
  /* the buy button follows you down the page */
  .bid { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; z-index: 20; grid-template-columns: 1fr auto; padding: 12px 14px; gap: 12px; box-shadow: 0 20px 60px #000c; background: #121219f2; backdrop-filter: blur(10px); }
  .price { font-size: 34px; }
  .drop { display: none; }
  .cta { padding: 15px 18px; font-size: 16px; }
  .stat .v { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
