/* Fish On app styles. Everything visual lives here: the CSP forbids inline style. */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

a { color: var(--accent); }
img, svg { max-width: 100%; }

/* ---- type ---- */
.display { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--muted); }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.note { margin: 0; font-size: 14px; color: var(--muted); }
.note-alert { color: var(--alert); font-weight: 600; }
.money-up { color: var(--money-up); }
.money-down { color: var(--money-down); }

/* ---- shell: page plus bottom tab bar ---- */
.main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gutter)
           calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}
.page-head { padding: 8px 0 16px; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.tab-icon { display: inline-flex; }
.tab[aria-current="page"] { color: var(--accent); }

/* ---- sign in, invite, offline: no tab bar, one column ---- */
.auth-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 48px) var(--gutter) calc(env(safe-area-inset-bottom) + 32px);
}
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.mark { border-radius: 16px; }

/* ---- cards and forms ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.button:active { background: var(--accent-press); }
.button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.button:disabled { opacity: 0.45; cursor: default; }
.button-quiet { background: var(--card-raised); color: var(--text); }
.button-quiet:active { background: var(--line); }
[hidden] { display: none !important; }

/* ---- setup: one question per screen (app.js shows one fieldset at a time; without it all show) ---- */
.setup-page {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) calc(env(safe-area-inset-bottom) + 16px);
}
.setup { display: flex; flex-direction: column; gap: 32px; min-height: calc(100vh - 32px); }
.setup.js-steps { gap: 0; min-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.setup-alert { margin: 4px 0 8px; }
.step { margin: 0; padding: 0; border: 0; min-width: 0; }
.step .head { float: left; width: 100%; padding: 0; margin: 0 0 6px; }
.step .head + * { clear: both; }
.stepn {
  display: block;
  margin: 6px 0 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dots { display: flex; gap: 4px; margin-bottom: 18px; }
.dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.dots i.on { background: var(--accent); }
.q { display: block; font-size: 24px; font-weight: 700; line-height: 1.2; }
.help { margin: 0 0 16px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.help.small { margin-top: 14px; font-size: 13px; text-align: center; }

.big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin: 12px 0 14px;
  padding: 14px 0;
  border-bottom: 2px solid var(--accent);
  font-size: 44px;
  font-weight: 800;
}
.big-sign { color: var(--muted); }
.big-input {
  width: 5ch;
  padding: 0 0 0 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.big-input:focus { outline: none; }
.big:focus-within { border-bottom-color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.chip:active { background: var(--card-raised); }

.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--accent); }
.opt > input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-text b { font-size: 17px; }
.opt-text > span { font-size: 13px; color: var(--muted); }
.custom-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 16px; }
.opt-text > .custom-row { color: var(--text); }
.custom-input {
  width: 7em;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.custom-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.book {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 108px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
  font-weight: 700;
  opacity: 0.45;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.book img { width: 52px; height: 52px; border-radius: 12px; }
.book input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.book:has(input:checked) { border-color: var(--accent); opacity: 1; }
.book:has(input:checked)::after {
  content: "\2713";
  position: absolute;
  top: 7px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
}
.book:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }

.sport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.sport-soon { opacity: 0.5; cursor: default; }
.soon { font-size: 12px; font-weight: 400; color: var(--muted); }
.tog {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 14px;
  background: #3a404a;
  cursor: pointer;
  transition: background 0.15s;
}
.tog::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.tog:checked { background: var(--accent); }
.tog:checked::after { transform: translateX(20px); }
.tog:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.install-note { margin-top: 8px; }
.setup-nav { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.setup-nav .button { flex: 1; }
.setup-nav [data-back] { flex: 0 0 34%; }

/* ---- board and pick ---- */
.alerts-banner { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; border-color: var(--accent); }
.alerts-text { margin: 0; font-weight: 600; }
.empty { margin: 0; color: var(--muted); }
.asof { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.list { margin: 0; padding: 0; list-style: none; }
.card.list { padding: 0; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 12px 16px; }
.row-link { color: var(--text); text-decoration: none; }
.row-link:active { background: var(--card-raised); }
.row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-meta { font-size: 13px; color: var(--muted); }
.edge-price, .fig b { font-family: var(--font-num); }
.edge-pct { color: var(--money-up); }
.chevron { flex: none; color: var(--muted); }
.grade {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 8px; background: var(--card-raised); font-weight: 800;
}
.grade-a { background: var(--accent); color: var(--on-accent); }
.display .grade { vertical-align: middle; margin-right: 6px; }
.sport-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--card-raised);
  color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; text-decoration: none; }
.page-head .lede { margin-top: 8px; }
.gone-banner { margin-bottom: 16px; border-color: var(--alert); }
.gone-banner p { margin: 0; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.fig { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fig b { font-size: 22px; }
.fig-label { font-size: 12px; color: var(--muted); }
.block { margin-top: 24px; }
.section-label { margin: 0 0 8px; letter-spacing: 0.06em; }
.factor-row { justify-content: space-between; }
.factor { font-weight: 700; }
.factor-pass { color: var(--money-up); }
.factor-fail { color: var(--money-down); }
.block .lede { margin-bottom: 12px; }
.sheet {
  width: 100%; max-width: 640px; margin: auto auto 0;
  padding: 20px var(--gutter) calc(env(safe-area-inset-bottom) + 20px);
  border: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet[open]:not(:modal) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-close { text-decoration: none; }

/* ---- bets ---- */
.bet-row { flex-direction: column; align-items: stretch; }
.bet-row > .row-text { color: var(--text); text-decoration: none; }
.row-more summary { min-height: var(--tap); display: flex; align-items: center; color: var(--accent); cursor: pointer; }
.bet-actions { display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.bet-actions .label { margin: 0 0 8px; }
.form select { width: 100%; min-height: var(--tap); }

/* ---- record ---- */
.record-figs .fig b { font-size: 16px; overflow-wrap: anywhere; }
.fig-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.paused { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px;
  border-color: var(--alert); }
.paused .row-title { margin: 0; }
.paused form { flex: 0 0 auto; }
.table-wrap { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.record-table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.record-table th, .record-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.record-table th[scope="row"], .record-table thead th:first-child { text-align: left; position: sticky; left: 0;
  background: var(--card); }
.record-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); }
.record-table tbody tr:last-child th, .record-table tbody tr:last-child td { border-bottom: 0; }
.record-foot { margin-top: 12px; font-size: 14px; }
.block > .button { margin-top: 12px; text-decoration: none; }

/* ---- settings ---- */
.said { color: var(--text); font-weight: 600; }
.setting-row { display: flex; align-items: center; gap: 12px; }
.setting-row .button { flex: 0 0 auto; width: auto; text-decoration: none; }
.settings-form fieldset { border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.settings-form legend { padding: 0; }
.settings-save { margin-top: 20px; }
.alerts-card { display: flex; flex-direction: column; gap: 12px; }
.alerts-card .row-title, .alerts-card .note { margin: 0; }
.alerts-card .row { padding: 8px 0; }
.button-small { min-height: 36px; width: auto; padding: 0 12px; font-size: 14px; }
.password-form { margin-top: 12px; }
.password-form .label { margin: 0; }
.account-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.account-actions .button { text-decoration: none; }
.legal { margin: 24px 0 8px; text-align: center; font-size: 13px; }

/* Live line under an open bet: score or player stat while the game is on. */
.live { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.live-won, .live-ahead { color: var(--money-up); }
.live-dead { color: var(--money-down); }
