:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface2: #1f242e;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --accent: #ffb020;
  --accent2: #4da3ff;
  --good: #3ddc84;
  --danger: #ff6b6b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  background: var(--bg) url('/covers/coins-bg.webp') no-repeat center top;
  background-size: cover;
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: rgba(15,17,21,.82);
  pointer-events: none;
}
/* Hero banner for the home page */
.hero-banner {
  margin: 0 -16px 16px; padding: 48px 20px 36px;
  background: url('/covers/hero-bg.webp') no-repeat center;
  background-size: cover; border-radius: 0 0 var(--radius) var(--radius);
  position: relative; overflow: hidden;
}
.hero-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(15,17,21,.25), rgba(15,17,21,.88));
  pointer-events: none;
}
.hero-banner > * { position: relative; z-index: 1; }
.hero-banner h1 { margin: 0 0 6px; font-size: 2rem; text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.hero-banner p { margin: 0; color: #d7dce4; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
/* Arcade section backdrop */
.arcade-banner {
  margin: 0 -16px 16px; padding: 40px 20px 30px;
  background: url('/covers/arcade-bg.webp') no-repeat center;
  background-size: cover; border-radius: 0 0 var(--radius) var(--radius);
  position: relative; overflow: hidden;
}
.arcade-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(15,17,21,.2), rgba(15,17,21,.85));
  pointer-events: none;
}
.arcade-banner > * { position: relative; z-index: 1; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 80px; }

/* Nav */
nav.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,17,21,.95); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--surface2);
}
nav.top .inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.25rem; color: var(--accent); margin-right: auto; }
.brand:hover { text-decoration: none; }
.navlinks { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.pill {
  background: var(--surface2); border-radius: 999px; padding: 4px 12px;
  font-size: .9rem; white-space: nowrap;
}
.coin { color: var(--accent); font-weight: 700; }
.badge-unread {
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: .75rem; padding: 1px 8px; margin-left: 4px; font-weight: 700;
}

/* Cards & lists */
.card {
  background: var(--surface); border: 1px solid var(--surface2);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
.series-card { display: flex; gap: 14px; align-items: center; }
.series-card img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.series-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
h1 { font-size: 1.6rem; margin: 20px 0 8px; }
h2 { font-size: 1.25rem; margin: 24px 0 8px; }

/* Episode rows */
.ep { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--surface2); }
.ep:last-child { border-bottom: none; }
.ep-num {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent);
}
.ep-title { font-weight: 600; }
.ep a.title { color: var(--text); }

/* Player */
audio { width: 100%; margin: 12px 0; }
.player-card { text-align: center; }
.player-card img.cover { width: 100%; max-width: 320px; border-radius: 16px; margin: 8px auto; display: block; }

/* Forms */
form.stack > * { margin: 8px 0; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--surface2);
  background: var(--surface2); color: var(--text); font-size: 1rem;
}
textarea { min-height: 90px; resize: vertical; }
button, .btn {
  display: inline-block; padding: 12px 20px; border-radius: 10px; border: none;
  background: var(--accent); color: #1a1200; font-weight: 700; font-size: 1rem;
  cursor: pointer; text-align: center;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.inline-form { display: inline; }

/* Leaderboard */
.board-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface2); }
.rank { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.rank.r1 { background: var(--accent); color: #1a1200; }
.rank.r2 { background: #c0c7d1; color: #222; }
.rank.r3 { background: #b07a3f; color: #fff; }
.badge {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 10px;
  border-radius: 999px; background: var(--accent); color: #1a1200; margin-left: 8px;
}
.badge.test { background: var(--danger); color: #fff; }
.badge.cash { background: var(--good); color: #06281a; }

/* Test-mode banner */
.test-banner {
  background: #3a1414; border: 1px solid var(--danger); color: #ffd7d7;
  border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; font-size: .95rem;
}
.test-banner strong { color: #fff; }

/* Notifications */
.notif { padding: 12px 0; border-bottom: 1px solid var(--surface2); }
.notif.unread { border-left: 3px solid var(--accent); padding-left: 10px; }

/* Tables */
table.ledger { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.ledger th, table.ledger td { padding: 10px 8px; border-bottom: 1px solid var(--surface2); text-align: left; }
table.ledger th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; }

.status { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.status.pending { background: #3a2f10; color: var(--accent); }
.status.paid_test { background: #123a2a; color: var(--good); }
.status.failed { background: #3a1414; color: var(--danger); }

.flash { border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.flash.ok { background: #123a2a; border: 1px solid var(--good); }
.flash.err { background: #3a1414; border: 1px solid var(--danger); }

footer.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 32px 0 16px; }
.tip-list { margin: 8px 0 0; padding: 0; list-style: none; }
.tip-list li { padding: 8px 0; border-bottom: 1px dashed var(--surface2); font-size: .95rem; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--surface2); border-radius: var(--radius); padding: 12px 16px; flex: 1; min-width: 120px; }
.stat .n { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat .l { font-size: .82rem; color: var(--muted); }

/* Phase 2: social layer */
#thread { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; padding: 4px 0; }
.msg { background: var(--surface2); border-radius: 12px; padding: 8px 12px; max-width: 85%; align-self: flex-start; }
.msg.mine { background: #1d2b4a; align-self: flex-end; }
.msg-meta { font-size: .78rem; margin-bottom: 2px; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; }
button.liked { color: #ff6b8a !important; border-color: #ff6b8a !important; }
/* ---- Phase 3: live tip rooms ---- */
.live-badge { background: #e5484d; color: #fff; font-size: .72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .04em; vertical-align: middle; }
.tip-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.tip-item:last-child { border-bottom: none; }

/* ---- Phase 5: character fighter ---- */
.fighter-card { cursor: default; transition: transform .12s, box-shadow .12s; }
.fighter-card.picked { box-shadow: 0 0 0 2px var(--accent); transform: translateY(-2px); }
.fighter-card.locked { opacity: .75; }
.fighter-swatch { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 8px; }
.stat-bar { display: flex; align-items: center; gap: 8px; font-size: .8rem; margin: 3px 0; }
.stat-bar span { width: 32px; color: var(--muted); font-weight: 700; }
.stat-bar .bar { flex: 1; height: 8px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.stat-bar .bar div { height: 100%; background: var(--accent); border-radius: 6px; }
.stat-bar b { width: 18px; text-align: right; }

/* ---- Coloring book ---- */
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  cursor: pointer; padding: 0; transition: transform .1s; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); transform: scale(1.12); }
.color-canvas { background: #fdfdfd; border-radius: 12px; padding: 8px; max-width: 560px; margin: 0 auto; }
.color-canvas svg [data-region] { cursor: pointer; }
.color-canvas svg [data-region]:hover { opacity: .85; }
.color-thumb { max-width: 220px; margin: 8px auto 0; background: #fdfdfd; border-radius: 10px; padding: 6px; }
.color-thumb svg { width: 100%; height: auto; display: block; }
.color-card { text-align: center; }
.coloring-thumb { max-width: 340px; margin: 8px 0; background: #fdfdfd; border-radius: 10px; padding: 6px; }
.color-entry { max-width: 320px; background: #fdfdfd; border-radius: 10px; padding: 6px; }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; margin: 8px 0; background: #000; }
.video-wrap iframe, .video-wrap video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
/* Arcade */
.memory-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 480px; margin: 0 auto; }
.mem-card { aspect-ratio: 1; font-size: 2rem; border-radius: 12px; border: 1px solid #2a2f3a;
  background: #1a1e27; color: #888; cursor: pointer; transition: all .2s; }
.mem-card.open { background: #2a3040; color: #fff; border-color: #3e63dd; }
.mem-card.done { background: #1d3a24; color: #fff; border-color: #46a758; cursor: default; }

/* ---- Music maker ---- */
.seq-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.seq-grid { display: grid; grid-template-columns: 64px repeat(16, 1fr); gap: 4px; align-items: center; }
.seq-row-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-align: right; padding-right: 4px; }
.seq-cell { aspect-ratio: 1; min-height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface2); cursor: pointer; padding: 0; transition: background .08s; }
.seq-cell.beat { border-left: 2px solid var(--accent); }
.seq-cell.mel { background: #232733; }
.seq-cell:hover { border-color: var(--accent); }
.seq-cell.on { background: var(--accent); border-color: var(--accent); }
.seq-cell.now { box-shadow: inset 0 0 0 2px #fff; }
@media (max-width: 720px) {
  .seq-grid { grid-template-columns: 48px repeat(16, 1fr); gap: 2px; }
  .seq-row-label { font-size: .6rem; }
}
