/* Shotcall — native iOS-style UI. System font, grouped lists, tab bar. */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tertiary: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --blue: #007aff;
  /* filled surfaces that carry white text need >=4.5:1; #007aff is only 4.0:1 */
  --blue-fill: #0071e3;
  --red: #ff3b30;
  --red-text: #d70015;
  --orange: #ff9500;
  --yellow: #d6a500;
  --green: #34c759;
  --gray: #8e8e93;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* spacing scale: tight binds siblings, group binds a labeled cluster,
     section separates unrelated clusters */
  --sp-tight: 8px;
  --sp-group: 12px;
  --sp-section: 24px;
  --tabbar-h: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--label);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--sp-section) + var(--safe-b));
}
/* live view: reserve room for the fixed command dock above the tab bar */
body.with-dock { padding-bottom: calc(var(--tabbar-h) + 216px + var(--safe-b)); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea {
  font: inherit; color: var(--label);
  background: var(--card); border: 0;
  border-radius: 10px; padding: 11px 14px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--tertiary); }
input:focus, textarea:focus { outline: none; }
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue-fill); outline-offset: 1px;
}
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue-fill); outline-offset: 2px;
}
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
a { color: var(--blue); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- navigation bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  min-height: 46px; padding: calc(6px + var(--safe-t)) 8px 6px;
  background: rgba(249, 249, 249, 0.93);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.nav-side { flex: 1 1 0; display: flex; }
.nav-side.r { justify-content: flex-end; }
.nav-title {
  flex: 0 1 auto; min-width: 0; font-size: 17px; font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-btn {
  color: var(--blue); font-size: 17px; padding: 6px 8px;
  display: flex; align-items: center; gap: 2px;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-back { color: var(--blue); font-size: 17px; display: flex; align-items: center; padding: 6px 8px 6px 2px; }
.nav-back::before {
  content: ""; width: 11px; height: 11px; margin-right: 3px;
  border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg); border-radius: 1px;
}
.large-title {
  font-size: 34px; font-weight: 700; letter-spacing: .01em;
  padding: 4px 20px 6px;
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  max-width: 560px; margin: 0 auto;
  display: flex;
  background: rgba(249, 249, 249, 0.93);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 7px 0 5px; color: var(--gray); font-size: 11px;
}
.tab svg { width: 26px; height: 26px; }
.tab span { line-height: 1; }
.tab.on { color: var(--blue); }

/* ---------- inset grouped lists ---------- */
.grp { margin: var(--sp-section) 16px 0; }
.grp-hdr {
  font-size: 13px; color: var(--secondary); text-transform: uppercase;
  letter-spacing: .03em; padding: 0 16px 7px;
}
.grp-ftr { font-size: 13px; color: var(--secondary); padding: 7px 16px 0; }
.list { background: var(--card); border-radius: 10px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 10px 16px; text-align: left;
  position: relative; background: var(--card);
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.row:active { background: #d1d1d6; }
/* row hosting two controls (open + delete) — the container stops being a target */
.row-split { padding: 0; gap: 0; }
.row-split .row-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 0 10px 16px; text-align: left;
}
.row-split .row-open:active { background: #d1d1d6; }
.row-split .x { padding: 10px 16px; min-height: 44px; }
.row-body { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 14px; color: var(--secondary); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-detail { font-size: 16px; color: var(--secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chev { color: var(--tertiary); font-size: 21px; font-weight: 600; line-height: 1; margin-left: -4px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--fill-2); color: var(--label);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.avatar.crit { background: #ffe5e2; color: #c0271b; }
.avatar.done { background: #e2f6e8; color: #1e7d3c; }

.badge {
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
  white-space: nowrap;
}
.badge-live { background: #ffe5e2; color: var(--red); }
.badge-warm { background: #fff1dd; color: #c77700; }
.badge-final { background: var(--fill); color: var(--secondary); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.st-crit { background: var(--red); }
.dot.st-need { background: var(--orange); }
.dot.st-star { background: var(--yellow); }
.dot.st-done { background: var(--green); }
.dot.st-warm { background: var(--blue); }
.dot.st-none { background: #c7c7cc; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; padding: 13px 18px; width: 100%;
  font-size: 17px; font-weight: 600;
  background: var(--blue-fill); color: #fff;
}
.btn:active { opacity: .75; }
.btn-tint { background: rgba(0, 122, 255, 0.13); color: var(--blue); }
.btn-red { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.btn-plain { background: none; color: var(--blue); font-weight: 400; }
.btn-sm {
  width: auto; padding: 6px 14px; border-radius: 15px; font-size: 15px;
  background: var(--fill); color: var(--blue);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 56px 32px 12px; color: var(--secondary);
}
.empty svg { width: 52px; height: 52px; color: var(--tertiary); margin-bottom: 10px; }
.empty h2 { color: var(--label); font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 15px; }

/* ---------- scoreboard card ---------- */
.scorecard {
  display: flex; align-items: center;
  background: var(--card); border-radius: 10px;
  margin: 14px 16px 0; padding: 14px 16px;
}
.sc-team { flex: 1; min-width: 0; text-align: center; }
.sc-team .t-name {
  font-size: 13px; color: var(--secondary); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-team .t-pts { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sc-mid { flex: 0 0 auto; padding: 0 10px; text-align: center; }
.sc-mid .q { font-size: 13px; font-weight: 600; color: var(--secondary); }
.sc-mid .live { color: var(--red); display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.sc-mid .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* ---------- scoreboard reminder ---------- */
.sb-banner {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 var(--sp-tight); padding: 12px 14px;
  background: var(--red); color: #fff; border-radius: 10px;
  font-size: 15px; font-weight: 600; text-align: left;
}
.sb-banner svg { width: 22px; height: 22px; flex-shrink: 0; }
.sb-banner small { display: block; font-weight: 400; font-size: 13px; opacity: .9; }

/* ---------- live: score strip (demoted scoreboard) ---------- */
.score-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: var(--sp-tight) 16px 0;
  font-size: 15px; color: var(--secondary); font-variant-numeric: tabular-nums;
}
.score-strip b { font-size: 17px; font-weight: 700; color: var(--label); }
.ss-team { font-weight: 600; max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-phase { font-size: 13px; font-weight: 600; margin-left: 4px; }
.ss-phase.live { color: var(--red); display: flex; align-items: center; gap: 5px; }
.ss-phase.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* ---------- live: NEED NOW hero ---------- */
.need-hero { padding: var(--sp-group) 16px 0; }
.need-hero .grp-hdr { padding: 0; }
.need-done.neutral { background: var(--fill-2); color: var(--label); }
.need-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--sp-tight); margin-top: 7px;
}
.need-tile {
  border-radius: 12px; padding: 12px 8px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--card); color: var(--label); min-width: 0;
}
.need-tile:active { opacity: .7; }
.need-num {
  font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.need-name {
  font-size: 13px; font-weight: 600; opacity: .8; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.need-count { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.need-tile.st-crit { background: #ffe5e2; color: #c0271b; }
.need-tile.st-need { background: #fff1dd; color: #c77700; }
.need-tile.st-star { background: #fbf0cf; color: #8a6a00; }
.need-tile.st-warm { background: #e0efff; color: #0b62c4; }
.need-tile.st-none { background: var(--fill-2); color: var(--label); }
.need-tile.st-done { background: #e2f6e8; color: #1e7d3c; }
.need-done {
  border-radius: 12px; margin-top: 7px; padding: 18px 16px; text-align: center;
  background: #e2f6e8; color: #1e7d3c; font-weight: 700; font-size: 17px;
}
.need-done small { display: block; font-weight: 600; font-size: 14px; opacity: .8; margin-top: 2px; }

/* ---------- live: command dock (fixed, thumb zone) ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 14;
  max-width: 560px; margin: 0 auto;
  background: var(--bg);
  border-top: 0.5px solid var(--sep);
  padding: var(--sp-tight) 16px var(--sp-tight);
}
.dock-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 24px; padding-top: var(--sp-tight);
}
.dock-actions .btn-sm { min-width: 64px; justify-content: center; display: flex; }
.rec-ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid #d1d1d6; padding: 3px;
  display: flex; align-items: center; justify-content: center;
}
.rec-core {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--red);
  transition: border-radius .18s ease, transform .18s ease;
}
.rec-btn.live .rec-core { border-radius: 6px; transform: scale(.62); }
.rec-btn.live .rec-ring {
  border-color: var(--red);
  animation: rec-pulse 1.6s ease-out infinite;
}
/* paused = armed while the app speaks a confirmation: red ring stays, pulse stops */
.rec-btn.paused .rec-ring { animation: none; }
.rec-btn.paused .rec-core { opacity: .55; }
.rec-btn.starting .rec-core { opacity: .35; }
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.35); }
  70% { box-shadow: 0 0 0 12px rgba(255, 59, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .rec-btn.live .rec-ring { animation: none; }
  .rec-core { transition: none; }
}
.rec-label { font-size: 13px; color: var(--secondary); text-align: center; padding-top: 4px; }
.rec-label.live { color: var(--red-text); font-weight: 600; }

/* ---------- inline warning banner (mic issues, storage) ---------- */
.warn-banner {
  display: block; width: 100%; margin: 0 0 var(--sp-tight); padding: 10px 14px;
  background: #fff1dd; color: #7a4100; border-radius: 10px;
  font-size: 14px; text-align: left;
}
.warn-banner b { font-weight: 700; }
.warn-banner small { display: block; font-size: 13px; margin-top: 1px; }

.transcript { width: 100%; text-align: center; min-height: 42px; }
.fb-heard { font-size: 13px; color: var(--secondary); }
.fb-reply { font-size: 17px; font-weight: 600; margin-top: 1px; }

/* ---------- typed command ---------- */
.cmd-row { display: flex; gap: 8px; padding-top: var(--sp-tight); }
.cmd-row input { background: var(--fill); border-radius: 10px; font-size: 16px; }
.cmd-row .btn { width: auto; padding: 8px 16px; border-radius: 10px; font-size: 16px; }
.help-btn {
  flex: 0 0 auto; width: 42px; border-radius: 10px;
  background: var(--fill); color: var(--blue-fill);
  font-size: 17px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- stats strip ---------- */
.stats3 {
  display: flex; background: var(--card); border-radius: 10px;
  margin: var(--sp-section) 16px 0;
}
.stats3 > div { flex: 1; text-align: center; padding: 10px 4px; position: relative; }
.stats3 > div + div::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%;
  border-left: 0.5px solid var(--sep);
}
.stats3 b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats3 span { font-size: 12px; color: var(--secondary); }

/* ---------- filter chips (App Store / Maps style) ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: var(--sp-section) 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 14px; border-radius: 16px; font-size: 14px; font-weight: 500;
  background: var(--fill); color: var(--label); white-space: nowrap;
}
.chip.on { background: var(--blue-fill); color: #fff; }

/* ---------- player grid ---------- */
.pl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: var(--sp-tight); padding: var(--sp-tight) 16px 0;
}
.pl-tile {
  background: var(--card); border-radius: 12px;
  padding: 10px 12px; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
}
.pl-tile:active { opacity: .7; }
.pl-top { display: flex; align-items: center; gap: 6px; }
.pl-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-star { color: var(--yellow); font-size: 12px; }
.pl-top .dot { margin-left: auto; }
.pl-name { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-count { font-size: 13px; color: var(--secondary); font-variant-numeric: tabular-nums; }

.section-pad { padding: 0 16px; }

/* ---------- forms ---------- */
.fld-list .row input[type="text"], .fld-list .row input[type="date"] {
  padding: 0; background: none; border-radius: 0; text-align: right; color: var(--label);
}
.fld-label { font-size: 17px; white-space: nowrap; }
.add-grid {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 64px; gap: 8px;
  padding: 12px; background: var(--card); border-radius: 10px; align-items: center;
}
/* 16px floor: iOS Safari force-zooms focused inputs below 16px */
.add-grid input { background: var(--fill); padding: 8px 10px; font-size: 16px; }
.add-grid .chk { grid-column: 1 / -1; }
.add-grid .btn { grid-column: 1 / -1; padding: 10px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--secondary); white-space: nowrap; }
.chk input { width: auto; }
.import-box { margin-top: 10px; background: var(--card); border-radius: 10px; padding: 12px 16px; }
.import-box summary { color: var(--blue); font-size: 16px; cursor: pointer; }
.import-box textarea { background: var(--fill); margin: 10px 0; font-size: 16px; }
.hint { font-size: 13px; color: var(--secondary); margin-top: 6px; }
.hint code { background: var(--fill); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.star { color: var(--yellow); font-style: normal; }
.late {
  font-style: normal; font-size: 11px; color: var(--blue);
  background: rgba(0, 122, 255, 0.12); border-radius: 4px; padding: 1px 6px; margin-left: 6px;
}
.x { color: var(--tertiary); font-size: 22px; padding: 2px 0 2px 10px; }

/* ---------- detail sheet ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto; max-height: 84vh; overflow-y: auto;
  background: var(--bg); border-radius: 12px 12px 0 0;
  padding: 6px 16px calc(24px + var(--safe-b));
}
.grabber {
  width: 36px; height: 5px; border-radius: 3px; background: #c7c7cc;
  margin: 6px auto 14px;
}
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-sec { margin-top: var(--sp-group); }
.sheet .grp, .sheet .stats3 { margin: var(--sp-group) 0 0; }
.act-stack { display: grid; gap: var(--sp-tight); }
.sh-ava { width: 52px; height: 52px; font-size: 22px; }
.sh-name { font-size: 20px; font-weight: 700; }
.sh-sub { font-size: 14px; color: var(--secondary); }
.sheet-head .x { margin-left: auto; }
.sh-statgrid { margin-top: 14px; }
.sh-notes { font-size: 14px; color: var(--secondary); font-style: italic; padding: 8px 16px 0; }
.ok { color: var(--green); font-weight: 600; }
.warn { color: var(--orange); font-weight: 600; }
.dim { color: var(--tertiary); font-size: 13px; }
.tag-sm { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.tag-sm.tw { background: #fff1dd; color: #c77700; }
.tag-sm.tg { background: #e2f6e8; color: #1e7d3c; }

/* ---------- report ---------- */
.rp-meta { text-align: center; font-size: 13px; color: var(--secondary); padding: 10px 16px 0; }
.side-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.side-row > span:first-child { font-size: 15px; min-width: 110px; }
.side-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.side-bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.side-row .mono { font-size: 14px; color: var(--secondary); min-width: 38px; text-align: right; }

.tbl-wrap { overflow-x: auto; background: var(--card); border-radius: 10px; padding: 6px 0; }
.rp-table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 540px; }
.rp-table th:last-child, .rp-table td:last-child { padding-right: 16px; }
.rp-table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--secondary);
  padding: 10px 8px 6px; border-bottom: 0.5px solid var(--sep);
}
.rp-table th:first-child, .rp-table td:first-child { padding-left: 16px; }
.rp-table td { padding: 9px 8px; border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
.rp-table tr:last-child td { border-bottom: 0; }
.rp-table .dot { width: 9px; height: 9px; margin-right: 6px; }

.tl-row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; position: relative; }
.tl-row + .tl-row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.tl-row .mono { color: var(--secondary); min-width: 66px; font-size: 14px; }
.tl-row span:nth-child(2) { flex: 1; font-size: 15px; }

.role-row, .burst-row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; position: relative; font-size: 15px; }
.role-row + .role-row::before, .burst-row + .burst-row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.role-row span:first-child { flex: 1; }
.burst-row .mono { color: var(--secondary); min-width: 70px; font-size: 14px; }

.empty-note { color: var(--secondary); font-size: 14px; padding: 12px 16px; }
.pad { display: block; color: var(--secondary); padding: 24px 16px; }
.app-foot { text-align: center; font-size: 12px; color: var(--tertiary); padding: 26px 0 10px; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; padding-bottom: 0; }
  .tabbar, .btn, .nav, .cmd-row, .dock { display: none !important; }
}
