/* Footrace - one stylesheet for all pages. Dark only, on purpose: the board
   gets screenshotted into group chats and dark with big numbers reads best
   in a WhatsApp bubble. */
:root {
  --bg: #0d0e11;
  --surface: #16181d;
  --surface-2: #1f2229;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f2ee;
  --muted: #8b90a0;
  --accent: #c8ff3d;
  --accent-ink: #101400;
  --accent-soft: rgba(200, 255, 61, 0.12);
  --danger: #ff6b6b;
  --gold: #ffd166;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100dvh;
}
a { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.num { font-variant-numeric: tabular-nums; }

.wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }

/* wordmark */
.brand {
  font-weight: 900;
  letter-spacing: -0.04em;
  font-size: 22px;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
}
.brand small { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 13px; margin-left: 8px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

/* inputs & buttons */
input[type="text"], input[type="date"], input[type="number"], input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  font: inherit; font-size: 17px; font-weight: 700;
  padding: 14px 18px;
  border-radius: 14px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.sm { width: auto; font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.row { display: flex; gap: 10px; align-items: center; }

/* board */
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.board-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.gold { background: rgba(255, 209, 102, 0.14); color: var(--gold); }
.board { position: relative; }
.board-rows { display: flex; flex-direction: column; gap: 6px; }
.brow {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  padding: 12px 12px; border-radius: 12px; background: var(--surface-2);
}
.brow.me { outline: 2px solid var(--accent); outline-offset: -2px; }
.brow .rank { font-weight: 800; color: var(--muted); font-size: 15px; text-align: center; }
.brow.r1 .rank { color: var(--gold); }
.brow .name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.brow .total { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-align: right; }
.brow .today { font-size: 12px; color: var(--muted); text-align: right; }
.gate {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 20px;
  background: rgba(13, 14, 17, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 14px;
}
.gate strong { font-size: 17px; }
.board.gated .board-rows { filter: blur(6px); pointer-events: none; user-select: none; }
/* The gate overlay needs room for its title, one line of text and a button;
   with one or two rows the board would be shorter than that and the overlay
   would spill over the card header, so give a gated board a floor. */
.board.gated { min-height: 230px; }
.gate .btn { width: auto; min-width: 200px; }
.winner { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; }
.winner .who { font-weight: 800; }
.gap { font-size: 13px; color: var(--muted); margin-top: 8px; }
.gap b { color: var(--text); }

/* sync */
.sync .status { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; }
.sync .status.warn { color: var(--gold); }
.setup ol { padding-left: 20px; margin: 8px 0 12px; }
.setup li { margin-bottom: 8px; }
.token {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 30px; font-weight: 700; letter-spacing: 0.18em; text-align: center;
  padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line);
  margin: 8px 0;
}
.note { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 10px; margin-top: 10px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); text-decoration: none; }
.chip.active { color: var(--accent); border-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-weight: 700; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); max-width: 90vw; text-align: center; z-index: 10;
}
.toast.bad { background: var(--danger); color: #fff; }

.err { color: var(--danger); font-size: 14px; margin-top: 8px; }
.hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; }

@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,255,61,0.6); } 50% { box-shadow: 0 0 0 12px rgba(200,255,61,0); } }
.btn.pulse { animation: pulse 1.2s ease-out 4; }

/* language flag, top-right corner */
.lang { font-size: 18px; line-height: 1; text-decoration: none; opacity: 0.85; padding: 4px; -webkit-tap-highlight-color: transparent; }
.lang:active { opacity: 0.5; }

/* fun content inside the board card */
.xline { font-size: 15px; margin-top: 8px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.reacts { margin-top: 4px; font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.react { background: var(--surface); border-radius: 999px; padding: 1px 7px; }
.react.mine { outline: 1px solid var(--accent); }
.brow { cursor: pointer; }
.brow.me { cursor: default; }
.crown { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.crown-title { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.crown-days { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.cday { background: var(--surface-2); border-radius: 8px; padding: 6px 2px; text-align: center; min-width: 0; }
.cday.today { outline: 1px solid var(--accent); }
.cday.future { opacity: 0.35; }
.cd { font-size: 10px; color: var(--muted); white-space: nowrap; }
.cw { font-size: 11px; font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.02em; }
.cday { padding: 6px 1px; }
.podium { margin-top: 12px; }
.pod { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; margin-bottom: 6px; font-size: 17px; }
.pod-name { font-weight: 800; flex: 1; }
.pod-total { font-weight: 800; }
.picker { position: fixed; left: 16px; right: 16px; bottom: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 20; }
.picker .emojis { display: flex; justify-content: space-between; margin-top: 8px; }
.picker .emoji { font: inherit; font-size: 28px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; width: 52px; height: 52px; cursor: pointer; }
.picker .emoji.mine { outline: 2px solid var(--accent); }

/* tabs under the board */
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.tab { flex: 1; font: inherit; font-size: 14px; font-weight: 700; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--surface-2); color: var(--text); }
.tabpane .xline:first-child { margin-top: 0; }
.crown-list { display: flex; flex-direction: column; gap: 4px; }
.crow { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.crow.today { outline: 1px solid var(--accent); }
.crow.future { opacity: 0.4; }
.crow .cd { color: var(--muted); font-size: 12px; }
.progress { margin-top: 12px; }
.progress .bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.progress .small { margin-top: 6px; }
.tenk { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.trow { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.trow .nm { font-weight: 700; }
.brow .name { display: flex; align-items: center; gap: 6px; }
.brow .name .nm { overflow: hidden; text-overflow: ellipsis; }
.brow .badge { margin-left: 0; }
/* sticky action bar */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(13,14,17,0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 15; max-width: 480px; margin: 0 auto; }
.actionbar .btn { flex: 1; padding: 12px; font-size: 16px; }
.wrap { padding-bottom: 96px; }
.picker { bottom: 84px; }

/* tab panes: sections of label/number rows */
.sec { padding: 4px 0 10px; }
.sec + .sec { border-top: 1px solid var(--line); padding-top: 14px; }
.sec-title { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.krow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; }
.krow + .krow { border-top: 1px solid var(--line); }
.krow .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.krow .nm { font-weight: 700; }
.big { font-size: 22px; letter-spacing: -0.02em; margin: 2px 0 10px; }
.progress .bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: visible; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.progress .tick { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text); opacity: 0.6; transform: translateX(-1px); }
.barlabels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.dots { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.dot.on { background: var(--accent); border-color: var(--accent); }
.dots .small { margin-left: 6px; }
