/* getraun.hvernig.is — "midnight pitch": a refined dark UI carried by typography,
   depth, and detail. Self-hosted fonts; no build step. */

/* ---- fonts (self-hosted woff2) ---- */
@font-face { font-family: "Bricolage"; src: url("/static/fonts/bricolage-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("/static/fonts/bricolage-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JBMono"; src: url("/static/fonts/jetbrains-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0a0b0f;
  --surface: #13151c;
  --surface-2: #181b23;
  --line: #232733;
  --line-2: #2f3441;
  --fg: #e9ebf1;
  --fg-dim: #aeb6c4;
  --muted: #6f7889;
  --accent: #4f8cff;
  --accent-bright: #6ea0ff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --good: #37d39a;
  --bad: #ff6b6b;
  --gold: #f4c95b;

  --display: "Bricolage", Georgia, serif;
  --body: "Hanken", system-ui, -apple-system, sans-serif;
  --mono: "JBMono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  --maxw: 940px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 15.5px/1.55 var(--body);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* footer sticks to the bottom on short pages */
}
/* Atmosphere: a soft accent glow + faint grain, fixed behind everything. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(820px 520px at 12% -6%, rgba(79, 140, 255, 0.18), transparent 60%),
    radial-gradient(760px 560px at 92% 4%, rgba(56, 211, 154, 0.12), transparent 55%),
    radial-gradient(900px 720px at 72% 110%, rgba(244, 201, 91, 0.06), transparent 60%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent-soft); }

/* ---- typography ---- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: #fff; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.7vw, 2.3rem); margin: 0 0 0.2em; }
h2 { font-size: 1.3rem; font-weight: 600; margin: 0 0 0.6rem; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 0.5rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-bright); }
.muted { color: var(--muted); }
.code, code { font-family: var(--mono); font-size: 0.86em; color: var(--fg-dim); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.25rem 1rem;
  padding: 0.7rem 1.25rem;
  background: rgba(10, 11, 15, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.03em;
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: linear-gradient(92deg, #fff 8%, var(--accent-bright) 58%, #46d6bb 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.brand::before {
  content: ""; width: 0.62rem; height: 0.62rem; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 14px rgba(79, 140, 255, 0.7);
}
.topbar nav { display: flex; align-items: center; gap: 1.1rem; }
.topbar nav a { color: var(--fg-dim); font-weight: 500; font-size: 0.94rem; }
.topbar nav a:hover { color: var(--fg); }
.me { color: var(--muted); font-size: 0.9rem; }

/* ---- layout ---- */
main { width: 100%; max-width: var(--maxw); margin: 0 auto; flex: 1 0 auto; padding: 2.2rem 1.25rem 4rem; animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
section { margin: 1.9rem 0; }
section > h2 { padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); margin-bottom: 0.9rem; }
footer { text-align: center; color: var(--muted); padding: 2.5rem 1rem; font-size: 0.85rem; }

/* ---- cards / surfaces ---- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; max-width: 420px; box-shadow: var(--shadow);
}
.card h1 { font-size: 1.6rem; }
.hero h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.52rem 0.95rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--fg); font: 600 0.92rem var(--body); cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; background: #20242e; border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(79, 140, 255, 0.28); }
.btn.primary:hover { background: var(--accent-bright); }
.btn.google { background: #fff; color: #1a1a1a; border-color: #fff; }
.btn.github { background: #1c2128; color: #fff; border-color: #30363d; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: rgba(255, 107, 107, 0.08); border-color: rgba(255, 107, 107, 0.5); color: var(--bad); }
button { font-family: var(--body); }

/* ---- forms ---- */
form label { display: block; margin: 0.85rem 0 0.3rem; color: var(--fg-dim); font-size: 0.9rem; font-weight: 500; }
form input, form select, form textarea {
  width: 100%; padding: 0.6rem 0.7rem; font: 400 0.95rem var(--body);
  background: var(--bg); color: var(--fg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input::placeholder, form textarea::placeholder { color: var(--muted); }
form input:focus, form select:focus, form textarea:focus,
button:focus-visible, a:focus-visible, .rx:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
form textarea { font: 0.84rem/1.5 var(--mono); resize: vertical; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row input { width: auto; flex: 1; min-width: 8em; }

/* ---- tables (leaderboard / fixtures / scoring) ---- */
table.lb, table.fixtures, table.scoring {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
table.lb th, table.fixtures th, table.scoring th {
  text-align: left; padding: 0.6rem 0.8rem; font: 600 0.72rem var(--body);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.lb td, table.fixtures td, table.scoring td { padding: 0.62rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.lb tbody tr:last-child td, table.fixtures tbody tr:last-child td, table.scoring tbody tr:last-child td { border-bottom: 0; }
table.lb tbody tr, table.fixtures tbody tr, table.scoring tbody tr { transition: background 0.12s ease; }
table.lb tbody tr:hover, table.fixtures tbody tr:hover, table.scoring tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
/* scoring rules: point columns in mono, first column the sport name */
table.scoring td:not(:first-child) { font-family: var(--mono); text-align: center; }
table.scoring th:not(:first-child) { text-align: center; }
/* global board: highlight the signed-in player's own row */
table.board tbody tr.me-row { background: rgba(79, 140, 255, 0.12); }
table.board tbody tr.me-row td { font-weight: 600; }
table.board tbody tr.me-row:hover { background: rgba(79, 140, 255, 0.16); }

/* pagination control */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* avatars (img or generated initials) */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; line-height: 1; }
.avatar-24 { width: 24px; height: 24px; font-size: 11px; }
.avatar-48 { width: 48px; height: 48px; font-size: 20px; }
.avatar-96 { width: 96px; height: 96px; font-size: 38px; }
.avatar-edit { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 0.5rem; }
.profile-head { display: flex; align-items: center; gap: 0.6rem; }
a.me { display: inline-flex; align-items: center; gap: 0.35rem; }

/* userchip: avatar + name (+ crown for Pro), used wherever a player is listed */
.userchip { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.userchip .uc-name { overflow: hidden; text-overflow: ellipsis; }
.crown { font-size: 0.85em; }
a .userchip .uc-name { text-decoration: underline; }

/* billing / tiers */
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1rem 0 1.4rem; }
.plan-now { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.plan-name { font-family: var(--display); font-size: 1.4rem; font-weight: 700; }
.note { margin-top: 1.5rem; }
.checkout { max-width: 30rem; }
.checkout-line { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.testmode { background: rgba(245, 196, 90, 0.12); border: 1px solid rgba(245, 196, 90, 0.35); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 1rem 0; font-size: 0.92rem; }
.upgrade-link { color: var(--gold) !important; }
.pro-link { color: var(--gold) !important; font-weight: 600; }

/* language switcher in the header nav */
.langsw { font-size: 0.82rem; letter-spacing: 0.03em; opacity: 0.85; }
.langsw strong { color: var(--text); }
.langsw a { color: var(--muted); }

/* stats hub */
ul.statfix { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.4rem; }
ul.statfix li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
ul.statfix li a { display: inline-flex; align-items: center; gap: 0.4rem; }
.pct-tag { font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 640px) { .stat-cols { grid-template-columns: 1fr; } }

/* player profile summary cards */
.profile-summary { display: flex; flex-wrap: wrap; gap: 1rem; }
.stat-card {
  flex: 1 1 8rem; padding: 0.9rem 1.1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-card .stat-num { font-family: var(--display); font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }

/* bulk predict */
.bulk-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; position: sticky; top: 0.5rem; z-index: 2; }
table.fixtures.bulk td.home { text-align: right; }
table.fixtures.bulk td.away { text-align: left; }
table.fixtures.bulk td.pick { text-align: center; white-space: nowrap; }
table.fixtures.bulk td.lock-cell { font-size: 0.85rem; white-space: nowrap; }
.countdown { font-family: var(--mono); }

/* ---- rules / scoring explainer ---- */
.rules { max-width: 46rem; }
.rules h2 { margin-top: 1.6rem; }
.rules ul.bands { list-style: none; padding: 0; margin: 0.6rem 0; display: grid; gap: 0.45rem; }
.rules ul.bands li { padding: 0.5rem 0.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.rules code { font-family: var(--mono); background: var(--surface-2); padding: 0.04rem 0.32rem; border-radius: 5px; }
/* leaderboard only (.board): rank + numeric columns in mono; leader gets a spark */
table.board td:first-child { font-family: var(--mono); color: var(--muted); width: 2.5rem; }
table.board td:nth-child(n+3) { font-family: var(--mono); }
/* podium medals draw the eye to the standings */
table.board tbody tr:nth-child(1) td:first-child { color: var(--gold); font-weight: 600; }
table.board tbody tr:nth-child(2) td:first-child { color: #cbd2dc; }
table.board tbody tr:nth-child(3) td:first-child { color: #d29a67; }

/* ---- predictions / pick form ---- */
.pick { display: inline-flex; gap: 0.3rem; align-items: center; }
.pick input { width: 3em; text-align: center; font-family: var(--mono); padding: 0.4rem 0.3rem; }
.pick span { color: var(--muted); }
.locked { font-weight: 600; color: var(--muted); font-family: var(--mono); }
.pts { color: var(--good); background: rgba(55, 211, 154, 0.12); border-radius: 6px; padding: 0.04rem 0.36rem; font-family: var(--mono); font-weight: 500; margin-left: 0.3rem; }
.result-big { font-family: var(--display); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.2rem 0 0.7rem; }
.result-big .muted { font-family: var(--body); font-size: 0.95rem; font-weight: 500; }
img.badge { height: 1.15em; width: auto; vertical-align: -0.18em; margin-right: 0.25rem; border-radius: 3px; }

/* ---- inline feedback / banners ---- */
.saved { color: var(--good); margin-left: 0.5rem; font-size: 0.82rem; font-weight: 500; animation: pop 0.3s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } }
.feedback { display: inline-block; min-width: 4em; }
.ok, .bad { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.92rem; border: 1px solid; }
.ok { color: var(--good); background: rgba(55, 211, 154, 0.08); border-color: rgba(55, 211, 154, 0.25); }
.bad { color: var(--bad); background: rgba(255, 107, 107, 0.08); border-color: rgba(255, 107, 107, 0.25); }

/* ---- odds chip ---- */
.odds { white-space: nowrap; }
.odds-chip {
  font-family: var(--mono); font-size: 0.74rem; color: var(--fg-dim);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.16rem 0.55rem;
}

/* ---- news ---- */
ul.news { list-style: none; padding: 0; margin: 0; }
ul.news li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
ul.news li:last-child { border-bottom: 0; }
ul.news a { font-weight: 600; }
.news-sum { font-size: 0.86rem; margin-top: 0.2rem; line-height: 1.45; }

/* ---- prizes ---- */
ul.prizes { list-style: none; padding: 0; margin: 0; }
ul.prizes li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
ul.prizes li:last-child { border-bottom: 0; }
ul.prizes strong { color: var(--gold); }
.prize-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.55rem; }
.prize-admin { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.prize-admin select { width: auto; min-width: 9.5em; padding: 0.45rem 0.55rem; }
.prize-admin .btn { padding: 0.45rem 0.8rem; font-size: 0.86rem; }

/* ---- dashboard lists ---- */
ul.leagues, ul.tlist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.55rem; }
ul.leagues li, ul.tlist li {
  padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, transform 0.08s ease;
}
ul.leagues li:hover, ul.tlist li:hover { border-color: var(--line-2); transform: translateX(2px); }
ul.leagues a { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
ul.leagues .code { margin-left: 0.5rem; letter-spacing: 0.05em; }

/* ---- chat ---- */
ul.chat {
  list-style: none; padding: 0.4rem 0; margin: 0 0 0.75rem; max-height: 52vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
ul.chat li { padding: 0.45rem 0.85rem; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
ul.chat li:last-child { border-bottom: 0; }
ul.chat li.muted { color: var(--muted); }
.msg-meta { font-size: 0.82rem; }
.msg-meta strong { color: var(--accent-bright); font-weight: 600; }
.chat-form { display: flex; gap: 0.5rem; align-items: center; }
.chat-form input { flex: 1; }

/* ---- member predictions + reactions ---- */
ul.preds { list-style: none; padding: 0; margin: 0; }
ul.preds li { display: flex; gap: 0.6rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
ul.preds li:last-child { border-bottom: 0; }
.pred-score { font-family: var(--mono); font-weight: 500; color: var(--fg); }
.reactions { margin-left: auto; display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.rx {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.12rem 0.55rem;
  cursor: pointer; font: 0.85rem var(--body); color: var(--fg); transition: border-color 0.12s ease, background 0.12s ease;
}
.rx:hover { background: #20242e; }
.rx-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-bright); }

/* ---- admin ---- */
.admin-t { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin: 1.1rem 0; }
.admin-t h2 { margin-top: 0; border: 0; padding: 0; }
.admin-t .round { margin: 1rem 0 0.5rem; padding-top: 0.85rem; border-top: 1px dashed var(--line-2); }
.admin-t .round h3 { margin: 0 0 0.5rem; font-size: 1rem; }
details.import, details.feeds { margin: 0.6rem 0 1rem; }
details.import summary, details.feeds summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details.import summary:hover, details.feeds summary:hover { color: var(--fg-dim); }
.feed-row { margin: 0.4rem 0; justify-content: space-between; }
.feed-row span { flex: 1; }

/* ---- mobile ---- */
@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar nav { gap: 0.9rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .card { padding: 1.4rem; }
  table.fixtures { font-size: 0.9rem; }
  .pick input { width: 2.6em; }
  table.lb th, table.fixtures th, table.lb td, table.fixtures td { padding: 0.5rem 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
