:root {
  --bg: #101613;
  --surface: #19211d;
  --surface-2: #212b25;
  --surface-3: #283730;
  --border: #2c3a32;
  --text: #edf2ee;
  --text-dim: #93a69a;
  --text-faint: #5f7268;
  --accent: #cf9f3c;
  --accent-text: #16110a;
  --value: #4fb0a0;
  --bluff: #d1704f;
  --draw: #9b8ac0;
  --pip-red: #e5262a;
  --pip-yellow: #f2c200;
  --radius: 10px;
  --font-display: Bahnschrift, "DIN Alternate", "Segoe UI Semibold", "Segoe UI", sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1ec; --surface: #ffffff; --surface-2: #e8ece5; --surface-3: #dde4da;
    --border: #cfd8cd; --text: #16211c; --text-dim: #5c6e63; --text-faint: #8b998f;
    --accent: #93690f; --accent-text: #fffaf0;
    --value: #276b60; --bluff: #a3492b; --draw: #5f4d87;
    --pip-red: #d21f22; --pip-yellow: #d6a800;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 460px; margin: 0 auto; padding: 20px 16px 64px; min-height: 100vh; }

.masthead { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
h1.doc-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  letter-spacing: 0.01em; margin: 0 0 18px; text-wrap: balance;
}
h1.doc-title:empty { display: none; margin: 0; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px; gap: 3px; margin-bottom: 20px;
}
.tab {
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; text-align: center; padding: 10px 4px; border-radius: 7px;
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  text-decoration: none; display: block;
}
.tab.active { background: var(--accent); color: var(--accent-text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.section-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint); margin: 0 0 10px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
label { font-size: 13px; font-weight: 600; color: var(--text); }
.hint { font-size: 11px; color: var(--text-faint); font-weight: 400; }

input[type="text"], input[type="number"], input[type="datetime-local"], input[type="time"], select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: var(--font-body); font-size: 15px; padding: 11px 12px;
}
input.mono-input { font-family: var(--font-mono); }

.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }
.btn-ghost {
  flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--font-body); font-size: 13px; font-weight: 600; border-radius: 8px;
  padding: 0 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary {
  width: 100%; background: var(--accent); color: var(--accent-text); font-family: var(--font-display);
  font-size: 15px; font-weight: 700; letter-spacing: 0.01em; border: none; border-radius: 9px;
  padding: 14px; cursor: pointer; text-decoration: none; display: block; text-align: center;
}
.btn-end {
  background: none; border: 1px dashed var(--border); color: var(--text-faint); font-size: 11px;
  border-radius: 7px; padding: 7px 10px; cursor: pointer; text-align: center; line-height: 1.3;
  text-decoration: none; display: inline-block;
}

.error-banner {
  background: color-mix(in srgb, var(--bluff) 16%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--bluff) 45%, var(--border));
  color: var(--bluff); font-size: 13px; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px;
}

.success-banner {
  background: color-mix(in srgb, var(--value) 16%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--value) 45%, var(--border));
  color: var(--value); font-size: 13px; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px;
}

.chip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 4px; cursor: pointer; color: var(--text-dim);
}
.chip .code { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text); }
.chip .label { font-size: 9.5px; letter-spacing: 0.02em; text-transform: uppercase; }
input:checked + .chip, .chip.checked {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
}
input:checked + .chip .code, .chip.checked .code { color: var(--accent); }

.role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }

.session-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 18px;
}
.session-strip .meta { font-size: 13px; line-height: 1.5; }
.session-strip .cat { font-family: var(--font-mono); color: var(--accent); font-weight: 700; margin-right: 6px; }
.session-strip .sub { color: var(--text-faint); font-size: 12px; }

.tally-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.tally-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 12px; }
.tally-card.full-width { grid-column: 1 / -1; }
.tally-card .tname { font-size: 11.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 2px; }
.tally-card .tval {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600;
  color: var(--text); margin-bottom: 8px;
}
.tally-pm-controls { display: flex; gap: 6px; }
.btn-pm {
  flex: 1; background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-mono); font-size: 19px; font-weight: 700; line-height: 1; border-radius: 7px;
  padding: 11px 0; cursor: pointer;
}
.btn-pm:hover { border-color: var(--accent); color: var(--accent); }
.btn-pm-multi {
  flex: 1; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; line-height: 1; border-radius: 7px;
  padding: 11px 0; cursor: pointer;
}
.btn-pm-multi:hover { border-color: var(--accent); color: var(--accent); }
.stepper {
  display: flex; align-items: center; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px;
}
.stepper form { display: flex; }
.stepper-btn {
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-mono); font-size: 15px; font-weight: 700; line-height: 1;
  border-radius: 6px; width: 28px; height: 28px; padding: 0; cursor: pointer;
}
.stepper-btn:hover { border-color: var(--accent); color: var(--accent); }
.stepper-val {
  flex: 1; text-align: center; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.tally-controls { display: flex; gap: 6px; }
.tally-controls input { width: 92px; text-align: center; font-family: var(--font-mono); }
.btn-add {
  flex: 1; background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  font-size: 12px; font-weight: 700; border-radius: 7px; cursor: pointer;
}

.street-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.street-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.street-head .sname { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.action-group, .qualifier-group, .outcome-group { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.qualifier-group { grid-template-columns: repeat(3, 1fr); }
.outcome-group { grid-template-columns: repeat(2, 1fr); margin-bottom: 0; }
.outcome-group.invalid .code-chip, .qualifier-group.invalid .code-chip { border-color: var(--bluff); color: var(--bluff); }
.code-chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 2px;
  text-align: center; cursor: pointer; color: var(--text-dim); display: block;
}
.code-chip .k { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.code-chip .w { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.02em; margin-top: 1px; }
input:checked + .code-chip { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); color: var(--accent); }
input:disabled + .code-chip { opacity: 0.3; cursor: not-allowed; }

/* ── Reports page (redesigned 2026-09-12) ────────────────────────── */
/* A-/A+ scales everything below via --report-scale (set inline on
   #reports-scale by adjustSize() in reports.html) rather than
   document.body.style.fontSize — nearly every element here has its own
   explicit font-size, so a body-level font-size change had no visible
   effect (the bug reported on iPhone: the buttons appeared to do nothing
   anywhere, not just on iOS). calc(Npx * var(--report-scale)) keeps the
   original px values legible in this file while still scaling. */
#reports-scale { --report-scale: 1; }

.game-header { margin-bottom: 4px; }
.game-label { font-family: var(--font-display); font-size: calc(13px * var(--report-scale)); font-weight: 700; line-height: 1.25; }
.game-cat { text-transform: uppercase; color: var(--accent); }
.scope-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.scope-btn {
  font-family: var(--font-body); font-size: calc(12px * var(--report-scale)); font-weight: 600; padding: 5px 12px;
  border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-dim); text-decoration: none;
}
.scope-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.count-strip {
  display: flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 14px 0; overflow: hidden;
}
.count-cell { flex: 1; padding: 10px 14px; }
.count-cell + .count-cell { border-left: 1px solid var(--border); }
.count-label { font-size: calc(10px * var(--report-scale)); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 4px; }
.count-line { display: flex; align-items: baseline; gap: 5px; }
.count-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: calc(16px * var(--report-scale)); font-weight: 700; }
.count-unit { font-size: calc(10.5px * var(--report-scale)); color: var(--text-faint); }

.controls-row { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-bottom: 16px; font-size: calc(12px * var(--report-scale)); color: var(--text-dim); }
.toggle-wrap { display: flex; align-items: center; gap: 6px; }
.toggle-switch { width: 34px; height: 19px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; position: relative; cursor: pointer; }
.toggle-switch.on { background: var(--accent); border-color: var(--accent); }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); transition: left .15s; }
.toggle-switch.on .toggle-thumb { left: 17px; background: var(--accent-text); }
.size-controls { display: flex; gap: 5px; }
.size-btn {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}

.section-header { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 8px; }
.section-name { font-family: var(--font-mono); font-size: calc(11px * var(--report-scale)); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-faint); }
.section-scope { font-size: calc(11.5px * var(--report-scale)); color: var(--text-faint); }

.report-card { padding: 0; margin-bottom: 10px; overflow: hidden; }
.subsection-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--font-mono); font-size: calc(10.5px * var(--report-scale)); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: var(--text-faint); padding: 9px 14px 6px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.info-btn {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-3);
  color: var(--text-faint); font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 1;
  text-transform: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}
.info-btn:hover { border-color: var(--accent); color: var(--accent); }

.info-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.info-overlay.hidden { display: none; }
.info-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 360px; max-height: 80vh; overflow-y: auto; padding: 16px;
}
.info-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.info-modal-head span { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.info-close {
  background: none; border: none; color: var(--text-faint); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0 2px;
}
.info-body { font-size: 13px; line-height: 1.55; color: var(--text-dim); }
.info-body p { margin: 0 0 10px; }
.info-body p:last-child { margin-bottom: 0; }
.info-body code {
  font-family: var(--font-mono); font-size: 12px; background: var(--surface-2);
  padding: 1px 4px; border-radius: 4px; color: var(--text);
}
.goal-line { font-size: calc(11px * var(--report-scale)); color: var(--text-faint); padding: 5px 14px 8px; border-bottom: 1px solid var(--border); }

.report-card .stat-row {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 9px 14px; border-bottom: 1px solid var(--border); gap: 2px;
}
.report-card .stat-row:last-child { border-bottom: none; }
.report-card .stat-label { font-size: calc(10.5px * var(--report-scale)); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.report-card .stat-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: calc(19px * var(--report-scale)); font-weight: 700;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.report-card .stat-value.win-good { color: var(--value); }
.report-card .stat-value.win-danger { color: var(--bluff); }
.stat-raw { font-size: calc(11px * var(--report-scale)); font-weight: 400; color: var(--text-faint); }
.stat-raw.hidden { display: none; }

.goal-pip { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pip-good { background: var(--value); }
.pip-high { background: var(--pip-yellow); }
.pip-low  { background: var(--pip-red); }

.divider { height: 1px; background: var(--border); margin: 4px 0 14px; }

.feed-item {
  display: grid; grid-template-columns: 20px 34px 1fr auto 16px 22px auto 44px;
  align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: calc(12px * var(--report-scale));
}
.feed-item:last-child { border-bottom: none; }
.feed-role { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.feed-pos { font-family: var(--font-mono); color: var(--text-faint); }
.feed-hand { font-family: var(--font-mono); font-weight: 700; }
.feed-actions { font-family: var(--font-mono); color: var(--text-dim); font-size: calc(11px * var(--report-scale)); }
.feed-actions.all-in { color: var(--accent); font-weight: 700; }
.feed-outcome { font-weight: 700; text-align: center; }
.feed-outcome.won { color: var(--value); }
.feed-outcome.lost { color: var(--bluff); }
.feed-bp {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 8px; color: var(--text-faint);
  cursor: pointer; user-select: none;
}
.feed-bp.marked { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.feed-level { font-family: var(--font-mono); color: var(--text-faint); font-size: calc(11px * var(--report-scale)); text-align: right; }
.feed-time { font-family: var(--font-mono); color: var(--text-faint); font-size: calc(11px * var(--report-scale)); text-align: right; }
.feed-note-label { font-size: calc(11px * var(--report-scale)); color: var(--text-faint); margin-bottom: 6px; }
.feed-empty { font-size: calc(12px * var(--report-scale)); color: var(--text-faint); padding: 14px 12px; text-align: center; }

/* Tournament Reports page (reports_tournament.html) */
.vitals-strip { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.vital { display: flex; flex-direction: column; gap: 2px; min-width: 52px; }
.vital-label { font-size: calc(10px * var(--report-scale)); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.vital-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: calc(18px * var(--report-scale)); color: var(--text); }
.vital-sub { font-size: calc(10px * var(--report-scale)); color: var(--text-faint); font-weight: 400; margin-left: 3px; }

.depth-row {
  display: grid; grid-template-columns: 1fr 46px 76px 62px; gap: 8px; align-items: center;
  padding: 7px 14px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: calc(11.5px * var(--report-scale));
}
.depth-row:last-child { border-bottom: none; }
.depth-head {
  color: var(--text-faint); font-size: calc(9.5px * var(--report-scale)); text-transform: uppercase;
  letter-spacing: 0.05em; background: var(--surface-2);
}

/* Blind Profiles viewer (blind_profiles.html) */
.level-row {
  display: grid; grid-template-columns: 48px 1fr 64px 64px; gap: 8px; align-items: center;
  padding: 7px 14px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: calc(11.5px * var(--report-scale));
}
.level-row:last-child { border-bottom: none; }

.feed-item-tourney { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: calc(12px * var(--report-scale)); }
.feed-item-tourney:last-child { border-bottom: none; }
.feed-tourney-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-tourney-bottom {
  display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap;
  font-family: var(--font-mono); color: var(--text-faint); font-size: calc(11px * var(--report-scale));
}
