:root {
  --bg: #0a0e0c;
  --panel: #121815;
  --panel-2: #182019;
  --line: #233029;
  --ink: #e8efe9;
  --sub: #93a49c;
  --teal: #00e5b8;
  --teal-ink: #001410;
  --amber: #e2ab52;
  --red: #e08a7c;
  --radius: 10px;
  --mono: "Consolas", "SFMono-Regular", Menlo, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.brand {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 18px;
}
.brand .iq { color: var(--teal); }

/* Views */
.view { padding: 16px; flex: 1; display: none; flex-direction: column; gap: 14px; }
.view.active { display: flex; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 0; }
.card h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--sub); }

/* Buttons */
button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 12px 16px;
  cursor: pointer;
}
button.primary { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: transparent; }
button.block { width: 100%; }
button.small { padding: 8px 12px; font-size: 13px; }

/* Inputs */
input, select {
  font-family: inherit;
  font-size: 15px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  width: 100%;
}
label { font-size: 12.5px; color: var(--sub); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

/* Pool type pills */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pill {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.type-pill.selected { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }
.type-pill .name { font-weight: 700; font-size: 14px; }
.type-pill .desc { font-size: 11.5px; color: var(--sub); }
.type-pill.static { cursor: default; }

/* Landing hero (signed-out view) */
.hero { padding: 8px 4px 4px; text-align: center; }
.hero h1 {
  font-size: 28px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em;
}
.hero .lead { font-size: 14.5px; color: var(--sub); max-width: 34ch; margin: 0 auto; }

.footer-links { text-align: center; font-size: 12px; color: var(--sub); margin: 4px 0 20px; }
.footer-links a { color: var(--sub); text-decoration: underline; }

/* Game row (pick'em / ATS / confidence) */
.game-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; gap: 10px;
}
.game-row.locked { opacity: 0.55; }
.team-btn {
  flex: 1; padding: 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-weight: 700; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.team-btn .spread { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--sub); }
.team-btn.picked { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
.team-btn.picked .spread { color: var(--teal-ink); opacity: 0.7; }
.conf-input { width: 52px; flex: none; text-align: center; }

/* Squares grid */
.squares-wrap { overflow-x: auto; }
.squares-grid { display: grid; grid-template-columns: repeat(11, 32px); gap: 2px; font-size: 10px; }
.sq-cell {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border-radius: 4px; font-family: var(--mono);
}
.sq-cell.head { background: transparent; color: var(--sub); font-weight: 700; }
.sq-cell.mine { background: var(--teal); color: var(--teal-ink); font-weight: 700; }
.sq-cell.taken { background: var(--line); }

/* Leaderboard */
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.lb-rank { font-family: var(--mono); color: var(--sub); width: 22px; text-align: right; }
.lb-name { flex: 1; font-weight: 600; }
.lb-name .you { color: var(--teal); }
.lb-score { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lb-row.eliminated { opacity: 0.4; text-decoration: line-through; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 800; padding: 2px 7px; border-radius: 20px; }
.badge.free { background: var(--panel-2); color: var(--sub); }
.badge.pass { background: var(--teal); color: var(--teal-ink); }
.badge.owe { background: var(--amber); color: #241a05; }
.badge.paid { background: var(--panel-2); color: var(--sub); }

/* Bottom nav */
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--bg);
  position: sticky; bottom: 0; padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; border: none; padding: 10px 4px 12px; color: var(--sub);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tab.active { color: var(--teal); }
.tab .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.tab.active .dot { background: var(--teal); }

.empty { text-align: center; color: var(--sub); padding: 40px 20px; font-size: 14px; }
.muted { color: var(--sub); font-size: 13px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
