/* BetMyAss — the Meteomatics palette, turned inside out.
   Their navy  #003652  →  our peach  #ffc9ad  (text)
   Their turquoise #40e0d0 → our blood red #bf1f2f (accent)
   Their lime  #defd83  →  our indigo #21027c  (the dark we live in) */

:root {
  --indigo: #21027c;
  --bg: #0a0420;
  --surface: #140a36;
  --surface-2: #1c0f4a;
  --border: #33207a;
  --text: #ffc9ad;
  --muted: #b3907f;
  --red: #bf1f2f;
  --red-bright: #ff5263;
  --on-red: #fff3ec;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(191, 31, 47, .22), transparent 60%),
    radial-gradient(700px 500px at -10% 10%, rgba(33, 2, 124, .7), transparent 65%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
.eyebrow { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--red-bright); font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */

label { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); }
.optional { opacity: .7; }
input, textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; width: 100%; min-width: 0;
}
input::placeholder, textarea::placeholder { color: #6f5a6b; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--red-bright); outline-offset: 2px; }
textarea { resize: vertical; }

button {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .05s;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: wait; }
.primary { background: var(--red); color: var(--on-red); }
.primary:hover { background: #d82a3c; }
.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ghost:hover { border-color: var(--text); }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 400; text-decoration: underline; }
.link:hover { color: var(--text); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.error { color: var(--red-bright); font-size: .9rem; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: .82rem; }

/* ---------- login gate ---------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 420px; display: grid; gap: 18px; }
.gate h1 { font-size: clamp(2.4rem, 9vw, 3.4rem); letter-spacing: -.02em; }
.gate h1 em { color: var(--red-bright); font-style: normal; }
.gate .tagline { color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.gate form { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.gate .fineprint { font-size: .78rem; color: var(--muted); text-align: center; }

/* ---------- shell ---------- */

header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 4, 32, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.top-inner, main { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; }
.brand em { color: var(--red-bright); font-style: normal; }
.brand small { font-family: var(--sans); font-weight: 400; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-left: 10px; }
.who { font-size: .88rem; color: var(--muted); }
.who b { color: var(--text); font-weight: 600; }

main { padding-top: 28px; padding-bottom: 80px; display: grid; gap: 36px; }

.hero h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); letter-spacing: -.02em; }
.hero p { color: var(--muted); margin-top: 8px; max-width: 56ch; }

/* ---------- new bet ---------- */

.new-bet { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: grid; gap: 14px; }
.new-bet h2 { font-size: 1.25rem; }
.new-bet .fields { display: grid; gap: 12px; grid-template-columns: 1fr 130px; }
.new-bet .fields .wide { grid-column: 1 / -1; }
.preview { font-size: .85rem; color: var(--muted); }
.preview b { color: var(--text); }
@media (max-width: 520px) { .new-bet .fields { grid-template-columns: 1fr; } }

/* ---------- sections & cards ---------- */

section.group { display: grid; gap: 14px; }
.group-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.group-head h2 { font-size: 1.35rem; }
.group-head .count { color: var(--muted); font-size: .85rem; }
.group-head .sub { color: var(--muted); font-size: .85rem; margin-left: auto; font-style: italic; font-family: var(--serif); text-align: right; }
@media (max-width: 520px) { .group-head .sub { display: none; } }

.bet { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; display: grid; gap: 14px; }
.bet-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.bet-head h3 { font-size: 1.2rem; overflow-wrap: anywhere; }
.bet-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.stake { color: var(--text); }
.stake::before { content: 'Stake: '; color: var(--muted); }

.clock { text-align: right; flex-shrink: 0; }
.clock .label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.clock .time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
@media (max-width: 520px) { .bet-head { flex-direction: column; } .clock { text-align: left; } }

/* Imminent: decided within a week. This is the one that should catch the eye. */
.bet.imminent { border-color: var(--red); background: linear-gradient(180deg, rgba(191, 31, 47, .16), var(--surface) 70%); animation: pulse 2.4s ease-in-out infinite; }
.bet.imminent .clock .time { color: var(--red-bright); font-size: 1.45rem; }
.bet.imminent .clock .label { color: var(--red-bright); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(191, 31, 47, .0); }
  50% { box-shadow: 0 0 26px 0 rgba(191, 31, 47, .45); }
}
@media (prefers-reduced-motion: reduce) { .bet.imminent { animation: none; box-shadow: 0 0 18px rgba(191, 31, 47, .4); } }

.bet.overdue { border-style: dashed; }
.bet.settled { background: transparent; }
.bet.settled h3 { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

/* ---------- predictions ---------- */

.preds { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pred { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; padding: 7px 10px; border-radius: 8px; font-size: .9rem; }
.pred:nth-child(odd) { background: rgba(255, 201, 173, .04); }
.pred .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pred .name b { font-weight: 600; }
.pred .tag { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }
.pred .date { color: var(--muted); white-space: nowrap; }
.pred .left { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 9ch; text-align: right; }
.pred.next { outline: 1px solid var(--border); background: var(--surface-2); }
.pred.busted .name, .pred.busted .date { text-decoration: line-through; opacity: .55; }
.pred.busted .left { color: var(--muted); }
.pred.winner { background: rgba(191, 31, 47, .2); outline: 1px solid var(--red); }
.pred.winner .left { color: var(--red-bright); font-weight: 700; }
.pred.me .name b { color: var(--red-bright); }
@media (max-width: 520px) { .pred { grid-template-columns: minmax(0, 1fr) auto; } .pred .date { display: none; } }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 14px; }
.challenge { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.challenge input { width: 84px; padding: 8px 10px; }
.challenge button, .actions > .row button { padding: 8px 14px; }

.verdict { border-left: 3px solid var(--red); padding: 4px 0 4px 14px; display: grid; gap: 4px; }
.verdict .who-won { font-family: var(--serif); font-size: 1.05rem; }
.verdict .who-won b { color: var(--red-bright); }
.verdict blockquote { margin: 0; color: var(--muted); font-style: italic; font-family: var(--serif); overflow-wrap: anywhere; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--border); border-radius: 14px; font-family: var(--serif); font-style: italic; }

footer.foot { text-align: center; color: var(--muted); font-size: .78rem; }

/* ---------- dialog ---------- */

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--red); border-radius: 14px; padding: 24px; width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 2, 16, .8); backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 14px; }
dialog h2 { font-size: 1.5rem; }
.dialog-bet { font-family: var(--serif); font-style: italic; color: var(--muted); overflow-wrap: anywhere; }
