:root {
  --bg: #05070f;
  --bg2: #0a0f1e;
  --panel: #121826;
  --panel-line: #1e2738;
  --text: #f4f7ff;
  --muted: #8a93a8;
  --muted2: #5e6678;
  --gold: #f5b301;
  --gold2: #ffd34d;
  --green: #34d27b;
  --blue: #4f9dff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 700px at 70% -10%, #0d1426 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Helvetica Neue", Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }

/* ── Display board ─────────────────────────────────────────── */
.board {
  max-width: 1900px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 56px);
}

.board-title {
  margin: 0 0 clamp(20px, 2.5vw, 44px);
  font-size: clamp(20px, 3.6vw, 56px);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 50%, var(--green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) 2.4fr 1fr;
  gap: clamp(24px, 3vw, 60px);
  align-items: start;
}

.portrait img {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  background: #1a2233;
  box-shadow: 0 0 0 3px #1c2740, 0 20px 60px rgba(0, 0, 0, 0.6);
}

.kicker {
  letter-spacing: 0.22em;
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 20px);
  font-weight: 600;
  margin-bottom: 6px;
}

.networth {
  font-size: clamp(40px, 6.8vw, 120px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.asof {
  color: var(--muted2);
  font-size: clamp(12px, 1vw, 17px);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

.goal {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-top: clamp(18px, 2.5vw, 40px);
}

.goalpct {
  color: var(--gold);
  font-size: clamp(40px, 6vw, 104px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.goallabel {
  color: var(--muted);
  letter-spacing: 0.16em;
  font-size: clamp(13px, 1.2vw, 22px);
  font-weight: 600;
}

.bar {
  margin-top: 16px;
  height: clamp(16px, 1.6vw, 26px);
  border-radius: 999px;
  background: #0e1422;
  box-shadow: inset 0 0 0 2px #1b2335;
  overflow: hidden;
}

.barfill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 45%, var(--green) 100%);
  transition: width 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.srcline {
  margin-top: 12px;
  font-size: clamp(11px, 0.85vw, 14px);
  letter-spacing: 0.08em;
  color: var(--muted2);
}
.srcline .live { color: var(--green); }
.srcline .stale { color: var(--gold); }
.srcline .down { color: #ff6b6b; }

/* Countdown */
.countdown { text-align: right; }
.cd-label {
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: clamp(12px, 1vw, 19px);
  font-weight: 600;
}
.cd-time {
  font-size: clamp(46px, 6vw, 112px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.cd-sub {
  color: var(--muted2);
  font-size: clamp(11px, 0.9vw, 16px);
  margin-top: 10px;
  letter-spacing: 0.04em;
}
.top5 { margin-top: 18px; }
.top5-head {
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: clamp(10px, 0.85vw, 14px);
  font-weight: 600;
  margin-bottom: 8px;
}
.top5-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: t5;
}
.top5-list li {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  padding: 3px 0;
  font-size: clamp(12px, 1vw, 17px);
}
.top5-list li::before {
  counter-increment: t5;
  content: counter(t5);
  color: var(--muted2);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 1.2em;
  text-align: right;
}
.top5-list .t5-name { color: var(--muted); letter-spacing: 0.03em; }
.top5-list .t5-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.top5-list .t5-empty { color: var(--muted2); justify-content: flex-end; }
.top5-list .t5-empty::before { content: ''; min-width: 0; }

/* ── Sections ──────────────────────────────────────────────── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: clamp(12px, 1vw, 19px);
  font-weight: 600;
  margin: clamp(36px, 4vw, 64px) 0 clamp(14px, 1.4vw, 22px);
}
.callpeak {
  text-align: right;
  letter-spacing: 0.02em;
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}
.callpeak a { font-size: clamp(13px, 1vw, 20px); }

/* Kalshi odds */
.odds {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1vw, 18px);
}
.odd {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: clamp(12px, 1.1vw, 20px) clamp(16px, 1.4vw, 26px);
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 150px;
}
.odd.lead { border-color: #2f6bd6; box-shadow: 0 0 0 1px #2f6bd6 inset; }
.odd .ostrike { color: var(--muted); letter-spacing: 0.06em; font-size: clamp(13px, 1.1vw, 20px); }
.odd .oprob { font-size: clamp(20px, 1.8vw, 34px); font-weight: 800; font-variant-numeric: tabular-nums; }
.odd.lead .oprob { color: var(--blue); }
.odds .empty { color: var(--muted2); font-size: 15px; }

/* Predictions */
.predictions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1vw, 16px);
}
.pred {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 14px 20px;
  min-width: 180px;
}
.pred .pamount { font-size: clamp(18px, 1.6vw, 30px); font-weight: 800; font-variant-numeric: tabular-nums; }
.pred .pname { color: var(--muted); font-size: clamp(12px, 1vw, 16px); margin-top: 4px; letter-spacing: 0.04em; }
.pred .pemail { color: var(--muted); opacity: 0.6; font-size: clamp(10px, 0.8vw, 13px); margin-top: 2px; letter-spacing: 0.02em; word-break: break-all; }
.pred.closest { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.pred .ptag { color: var(--gold); font-size: 11px; letter-spacing: 0.12em; font-weight: 700; }
.predictions .empty {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--muted);
  max-width: 340px;
}

@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; }
  .countdown { text-align: left; }
  .portrait img { max-width: 200px; }
}

/* ── /guess entry page ─────────────────────────────────────── */
.guess-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.guess-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  padding: 32px;
}
.guess-card h1 { font-size: 26px; margin: 0 0 6px; }
.guess-card .sub { color: var(--muted); margin-bottom: 22px; line-height: 1.5; }
.guess-card label { display: block; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; margin: 16px 0 6px; }
.guess-card input,
.guess-card select {
  width: 100%;
  background: #0c1220;
  border: 1px solid #232d42;
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 18px;
}
.guess-card select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.guess-card input:focus,
.guess-card select:focus { outline: none; border-color: var(--blue); }
.hint { color: var(--muted2); font-size: 12px; margin-top: 6px; }
.guess-card button {
  margin-top: 24px;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  color: #1a1300;
  border: 0;
  border-radius: 10px;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.guess-card button:disabled { opacity: 0.5; cursor: not-allowed; }
.msg { margin-top: 16px; font-size: 15px; min-height: 22px; }
.msg.ok { color: var(--green); }
.msg.err { color: #ff6b6b; }
.live-worth { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--panel-line); color: var(--muted); font-size: 14px; }
.live-worth b { color: var(--text); }

/* ── Call-the-peak modal ───────────────────────────────────── */
.callpeak-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.callpeak-btn:hover { text-decoration: underline; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.modal-card .modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  margin: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.modal-card .modal-close:hover { color: var(--text); }

/* ── Live chat ─────────────────────────────────────────────── */
.chatlog {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 14px 18px;
  height: clamp(220px, 28vh, 360px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: clamp(14px, 1.1vw, 19px);
  line-height: 1.35;
}
.chat-name { color: var(--gold); font-weight: 700; white-space: nowrap; }
.chat-body { color: var(--text); flex: 1; word-break: break-word; }
.chat-time { color: var(--muted2); font-size: 0.8em; white-space: nowrap; }
.chat-empty { color: var(--muted2); font-size: 15px; margin: auto; }

.chatform {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.chatform input {
  background: #0c1220;
  border: 1px solid #232d42;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: clamp(14px, 1vw, 17px);
}
.chatform input:focus { outline: none; border-color: var(--blue); }
.chatname { width: clamp(120px, 16vw, 200px); flex: none; }
.chatbody { flex: 1; }
.chatsend {
  flex: none;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  color: #1a1300;
  border: 0;
  border-radius: 10px;
  padding: 0 24px;
  font-size: clamp(14px, 1vw, 17px);
  font-weight: 800;
  cursor: pointer;
}
.chatsend:disabled { opacity: 0.5; cursor: not-allowed; }
.chatmsg { margin-top: 8px; font-size: 14px; min-height: 18px; }
.chatmsg.err { color: #ff6b6b; }

@media (max-width: 640px) {
  .chatform { flex-wrap: wrap; }
  .chatname { width: 100%; }
}

/* ── Admin ──────────────────────────────────────────────────── */
.admin-link {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 40;
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.admin-link:hover { color: var(--text); border-color: var(--blue); }

.modal-card .linkbtn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: auto;
  color: var(--blue);
  font: inherit;
  cursor: pointer;
}
.modal-card .linkbtn:hover { text-decoration: underline; }
.optional { color: var(--muted2); letter-spacing: 0; text-transform: none; font-size: 11px; }
