:root {
  --bg: #120b1f;
  --panel: #1d1330;
  --panel-2: #26193d;
  --border: #3a2a57;
  --text: #f3eaff;
  --muted: #a898c4;
  --pink: #ff4fa3;
  --orange: #ffa24c;
  --teal: #2de2d1;
  --green: #4ade80;
  --red: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1em; margin: 0; font-size: 13px; }

/* Header */
.hero {
  background:
    linear-gradient(180deg, rgba(18, 11, 31, 0) 40%, var(--bg) 100%),
    linear-gradient(160deg, #3b1a6b 0%, #c2306f 55%, #ff9a3c 100%);
  padding: 20px 0 48px;
  margin-bottom: 8px;
}
.hero-top { display: flex; justify-content: flex-end; font-size: 13px; }
.hero h1 {
  margin-top: 28px;
  font-size: clamp(32px, 7vw, 56px);
  font-weight: 900;
  letter-spacing: -1px;
  text-transform: uppercase;
}
.hero h1 span {
  background: linear-gradient(90deg, var(--teal), #8cf5ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.countdown { margin: 8px 0 0; font-size: 16px; font-weight: 600; opacity: 0.9; }

/* Generic controls */
.btn, .tabs button, select, input, textarea {
  font: inherit;
  color: var(--text);
  border-radius: 8px;
}
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--panel-2);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { border-color: var(--pink); }
.btn.primary { background: linear-gradient(90deg, var(--pink), var(--orange)); border: 0; color: #1a0b14; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.link { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.link.danger { color: var(--red); }

input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--pink); outline-offset: -1px; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 16px; margin-bottom: 12px; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.add-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* Leaderboard */
.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px; }
.board td { padding: 6px 8px; border-top: 1px solid var(--border); }
.board td.num, .board th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .row { flex: 1; max-width: 360px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--panel-2); color: var(--text); }

/* Prediction cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 14px;
}
.card.status-true { border-left-color: var(--green); }
.card.status-busted { border-left-color: var(--red); }
.card.status-pending { border-left-color: var(--orange); }

.vote { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.vote button {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 32px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.vote button.on.up { background: var(--teal); border-color: var(--teal); color: #052a27; }
.vote button.on.down { background: var(--red); border-color: var(--red); color: #2a0505; }
.vote .score { font-weight: 800; font-variant-numeric: tabular-nums; }

.card-body { min-width: 0; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted);
}
.badge.s-true { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.badge.s-busted { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.badge.s-pending { background: rgba(255, 162, 76, 0.15); color: var(--orange); }
.badge.c-lock { color: var(--pink); }

.card h3 { font-size: 18px; overflow-wrap: anywhere; }
.card .desc { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #ddd0f2; }
.meta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.status-buttons { display: inline-flex; gap: 4px; }
.status-buttons button {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 2px 8px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.status-buttons button.on { color: var(--text); border-color: var(--pink); }

.extras { grid-column: 2; margin-top: 10px; }
.extras > summary { cursor: pointer; color: var(--teal); font-size: 13px; font-weight: 600; }
.extras h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.clip { margin-bottom: 10px; }
.clip .embed { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.clip .embed iframe, .clip .embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.clip-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }

.comment { padding: 8px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: 0; }
.comment .who { font-size: 12px; color: var(--muted); }
.comment .who strong { color: var(--text); }
.comment p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.inline-form { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.inline-form input, .inline-form textarea { flex: 1; min-width: 160px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Dialogs */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(10, 5, 20, 0.85);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay[hidden] { display: none; }
.dialog {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px;
}
.dialog p { margin: 0; }

@media (max-width: 520px) {
  .card { grid-template-columns: 36px 1fr; gap: 4px 10px; padding: 12px; }
  .extras { grid-column: 1 / -1; }
  .toolbar .row { max-width: none; }
}
