
:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --line:rgba(15,23,42,.14);
  --btn:#ffffff;
  --btnText:#0f172a;
  --primary:#2563eb;
  --danger:#dc2626;
  --shadow: 0 18px 40px rgba(2,6,23,.10);
  --radius:18px;
  --pad:14px;
}

html[data-theme="dark"]{
  --bg:#0b1220;
  --card:#0f1b2e;
  --text:#e5e7eb;
  --muted:#a5b4fc;
  --line:rgba(226,232,240,.14);
  --btn:#101f36;
  --btnText:#e5e7eb;
  --shadow: 0 20px 50px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app{ max-width: 1280px; margin: 0 auto; padding: 14px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand .site{ font-weight: 900; letter-spacing:.4px; }
.brand .title{ font-weight: 900; font-size: 18px; margin-top:2px; }
.ver{ font-weight: 900; opacity:.8; font-size: 12px; padding-left:8px; }

.top-actions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

.grid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 1000px){
  .grid{ grid-template-columns: 1fr; }
}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.card-hd{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom: 10px;
}
.card h2{ margin:0; font-size:18px; }
.muted{ color: var(--muted); font-weight: 700; }

.row{ display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.field{ flex:1; min-width: 220px; }
label{ display:block; font-weight: 900; margin: 0 0 6px; }
input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.02);
  color: var(--text);
}
html[data-theme="dark"] input{ background: rgba(255,255,255,.04); }
.hint{ margin-top:6px; color: var(--muted); font-size: 12px; font-weight:700; }
.ok{ margin-top:8px; font-weight: 900; }

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--btnText);
  font-weight: 900;
  min-height: 44px;
}
.btn:hover{ filter: brightness(0.98); }
.btn-primary{
  composes: btn;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,.35);
  background: rgba(37,99,235,.12);
  color: var(--text);
  font-weight: 900;
  min-height: 44px;
}
.btn-danger{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(220,38,38,.35);
  background: rgba(220,38,38,.12);
  color: var(--text);
  font-weight: 900;
  min-height: 44px;
}

.btn-team{
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--btn);
  color: var(--btnText);
  font-weight: 1000;
  letter-spacing: .6px;
  min-width: 88px;
  min-height: 48px;
}
.btn-team.us.active{ background:#16a34a; color:#fff; border-color:#15803d; }
.btn-team.opp.active{ background:#dc2626; color:#fff; border-color:#b91c1c; }
.btn-team:not(.active){ opacity:.92; }

.banner{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 900;
  background: rgba(0,0,0,.03);
}
html[data-theme="dark"] .banner{ background: rgba(255,255,255,.05); }

.team-row{ align-items:center; }
.mode-row .spacer{ flex:1; }

.modebtn.active, .split.active, .qbtn.active{
  border-width: 2px;
  box-shadow: 0 12px 24px rgba(0,0,0,.12);
}

.subhd{ margin-top: 10px; font-weight: 1000; letter-spacing:.4px; }
.player-grid{
  margin-top: 8px;
  display:grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 8px;
}
@media (max-width: 740px){
  .player-grid{ grid-template-columns: repeat(4, minmax(0,1fr)); }
}
.player-btn{
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.02);
  padding: 8px 8px;
  min-height: 54px;
  font-weight: 1000;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
}
html[data-theme="dark"] .player-btn{ background: rgba(255,255,255,.05); }
.player-btn.active{ outline: 3px solid rgba(37,99,235,.35); }
.player-btn .num{ font-size: 16px; line-height: 1; }
.player-btn .name{ font-size: 10px; font-weight: 900; opacity:.86; margin-top:3px; text-align:center; }

.stat-grid{
  margin-top: 8px;
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
}
@media (max-width: 740px){
  .stat-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
.stat-btn{
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.02);
  padding: 10px 10px;
  min-height: 52px;
  font-weight: 1000;
  text-align:center;
}
html[data-theme="dark"] .stat-btn{ background: rgba(255,255,255,.05); }
.stat-btn:hover{ filter: brightness(0.98); }

.loghd{ display:flex; justify-content:space-between; align-items:center; margin-top: 12px; font-weight: 1000; }
.log{
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: 220px;
  overflow:auto;
  background: rgba(0,0,0,.02);
}
html[data-theme="dark"] .log{ background: rgba(255,255,255,.04); }
.log .item{
  padding: 10px 10px;
  border-bottom: 1px dashed rgba(0,0,0,.12);
  font-weight: 800;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
html[data-theme="dark"] .log .item{ border-bottom-color: rgba(255,255,255,.12); }
.log .item:last-child{ border-bottom:none; }
.log .item .meta{ opacity:.85; font-weight:900; }

.sheet .tables{ margin-top: 12px; display:grid; grid-template-columns: 1fr; gap:12px; }
.table-wrap h3{ margin: 0 0 8px; }
.table{
  width:100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow:hidden;
}
.table th, .table td{
  padding: 10px 8px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  text-align:center;
  font-weight: 900;
}
html[data-theme="dark"] .table th, html[data-theme="dark"] .table td{ border-bottom-color: rgba(255,255,255,.10); }
.table th{
  background: rgba(0,0,0,.04);
  text-transform: uppercase;
  letter-spacing: .35px;
  font-size: 12px;
}
html[data-theme="dark"] .table th{ background: rgba(255,255,255,.06); }
.table td:first-child, .table th:first-child{ text-align:left; padding-left: 12px; }

.totals-grid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}
@media (max-width: 980px){ .totals-grid{ grid-template-columns: 1fr; } }
.tot-card{
  border:1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0,0,0,.02);
}
html[data-theme="dark"] .tot-card{ background: rgba(255,255,255,.04); }
.tot-card h4{
  margin:0 0 6px;
  font-size: 13px;
  letter-spacing:.4px;
  text-transform:uppercase;
  opacity:.9;
}
.tot-row{
  display:flex; justify-content:space-between; gap:10px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(0,0,0,.10);
}
html[data-theme="dark"] .tot-row{ border-bottom-color: rgba(255,255,255,.10); }
.tot-row:last-child{ border-bottom:none; }
.tot-row b{ font-weight: 1000; }

/* modal */
.modal{
  position:fixed; inset:0;
  background: rgba(2,6,23,.55);
  display:flex; align-items:center; justify-content:center;
  padding: 14px;
}
.modal-card{
  width:min(860px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.modal-hd{ display:flex; justify-content:space-between; align-items:center; gap:10px; }
.modal-title{ font-weight: 1000; font-size: 16px; }
.modal-bd{ margin-top: 10px; }


/* Ensure modal is hidden unless opened */
.modal[hidden]{ display:none !important; }


/* ---- COMPACT BUTTON UPDATE (v1.2) ---- */
.btn{
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}
.btn-team{
  min-height: 42px;
  min-width: 76px;
  padding: 8px 10px;
  font-size: 13px;
}
.qbtn{
  min-height: 36px;
  min-width: 56px;
  font-size: 12px;
}
.modebtn{
  min-height: 38px;
  font-size: 13px;
}
.player-btn{
  min-height: 48px;
  padding: 6px;
}
.player-btn .num{ font-size: 14px; }
.player-btn .name{ font-size: 9px; }

.stat-grid.compact{
  grid-template-columns: repeat(3, minmax(0,1fr));
}
.stat-btn{
  min-height: 46px;
  font-size: 12px;
  padding: 8px;
}

/* tighten card spacing */
.card{ padding: 12px; }
.row{ gap: 8px; }


/* v1.4 layout tightening */
.stat-grid.compact{
  grid-template-columns: repeat(3, minmax(0,1fr));
}
.log{
  max-height: 260px;
}


/* -------- GLOBAL COMPACT BUTTON PASS (v1.5) -------- */
.btn,
.btn-primary,
.btn-danger{
  min-height: 36px !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

.btn-team{
  min-height: 38px !important;
  min-width: 68px !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
}

.qbtn{
  min-height: 32px !important;
  min-width: 48px !important;
  font-size: 11px !important;
}

.modebtn{
  min-height: 34px !important;
  font-size: 12px !important;
}

.player-btn{
  min-height: 44px !important;
  padding: 4px !important;
}
.player-btn .num{ font-size: 13px !important; }
.player-btn .name{ font-size: 8px !important; }

.stat-btn{
  min-height: 40px !important;
  font-size: 11px !important;
  padding: 6px !important;
}

/* tighten headers */
.subhd{ font-size: 13px; }


/* -------- PRINT SHEET -------- */
@media print{
  body{ background:#fff !important; }
  .topbar, .card:not(.print-only), .modal{ display:none !important; }
  .print-sheet{ display:block !important; }
  .print-sheet h1{ margin:0 0 6px; }
  .print-sheet h2{ margin:14px 0 6px; }
  .print-sheet h3{ margin:12px 0 6px; }
  .print-sheet .meta{ font-weight:900; margin-bottom:10px; }
  .print-sheet .qhdr{ margin-top: 14px; border-top:2px solid #000; padding-top:8px; }
  .print-sheet table{ width:100%; border-collapse:collapse; }
  .print-sheet th, .print-sheet td{ border:1px solid #000; padding:6px 6px; font-size:12px; }
  .print-sheet th{ background:#eee; text-transform:uppercase; letter-spacing:.3px; }
}


/* -------- v1.7: print-preview look + scroll -------- */
.modal-bd{
  max-height: 72vh;
  overflow: auto;
  padding-right: 6px;
}

.print-sheet{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #000;
}
.print-sheet h1{ font-size: 16px; }
.print-sheet h2{ font-size: 14px; }
.print-sheet h3{ font-size: 13px; }
.print-sheet .meta{ font-size: 12px; }
.print-sheet th, .print-sheet td{ font-size: 11px; padding: 4px 5px; }
.print-sheet .qhdr{ border-top: 2px solid #000; padding-top: 6px; margin-top: 10px; }

/* Even smaller controls */
.btn, .btn-primary, .btn-danger{
  min-height: 32px !important;
  padding: 5px 7px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
}
.btn-team{
  min-height: 34px !important;
  min-width: 62px !important;
  padding: 5px 7px !important;
  font-size: 11px !important;
}
.qbtn{
  min-height: 30px !important;
  min-width: 44px !important;
  font-size: 10px !important;
}
.player-btn{ min-height: 40px !important; }
.player-btn .num{ font-size: 12px !important; }
.player-btn .name{ font-size: 8px !important; }
.stat-btn{ min-height: 36px !important; font-size: 10px !important; }

/* -------- v1.8 tweaks -------- */

/* Quarter buttons: pink when active */
.qbtn.active{
  background: #ec4899 !important;   /* pink */
  border-color: #db2777 !important;
  color: #fff !important;
}

/* Left column: slightly smaller stat buttons + running log */
.stat-grid.compact{
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px;
}
.stat-btn{
  min-height: 32px !important;
  font-size: 10px !important;
  padding: 5px 6px !important;
  border-radius: 10px !important;
}

.log{
  max-height: 210px !important;
}
.log .item{
  padding: 8px 8px !important;
  font-size: 11px !important;
}
.log .item .meta{
  font-size: 10px !important;
}

/* Tiny icon button */
.icon-btn{
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--btnText);
  border-radius: 10px;
  padding: 4px 8px;
  min-height: 28px;
  font-weight: 1000;
}
.icon-btn:hover{ filter: brightness(0.98); }
/* -------- v1.9 Player Edit Mode -------- */
.btn.toggle-on{
  border-color: rgba(236,72,153,.55) !important;
  background: rgba(236,72,153,.14) !important;
}

.player-btn{ position: relative; }
.player-btn .edit-pen{
  position:absolute;
  top:6px;
  right:6px;
  min-height: 22px;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.85);
}
html[data-theme="dark"] .player-btn .edit-pen{ background: rgba(16,31,54,.88); color: var(--btnText); }
.player-btn .edit-pen:active{ transform: scale(0.98); }
/* v1.9.1: edit pen is NOT a nested button (prevents weird iOS behavior) */
.player-btn .edit-pen{
  cursor: pointer;
  user-select: none;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height: 1;
}
/* v1.9.2: ensure pencil is tappable */
.player-btn .edit-pen{ pointer-events: auto; }
/* v1.9.3: ensure pencil is above button and easy to tap */
.player-btn{ overflow: visible; }
.player-btn .edit-pen{
  z-index: 10;
  width: 26px;
  height: 26px;
}
/* v1.9.4: make pencil the top tap target */
.player-btn .edit-pen{ pointer-events: auto; }
/* v2.0: remove pencil overlay (tap-to-edit in Edit mode) */
.edit-pen{ display:none !important; }


/* v2.3: header logo placement */
.topbar .title{
  display:flex;
  align-items:center;
  gap:10px;
}
.topbar .title .logo{
  height:30px;
  width:auto;
  display:inline-block;
}

/* Southern Door cloud sync */
.status-stack{display:grid;gap:3px;justify-items:end;text-align:right}
.sync-status{font-size:11px;font-weight:900}
.sync-status.synced{color:#15803d}
.sync-status.needs{color:#b45309}
.sync-status.offline{color:#b91c1c}
.sync-status.syncing{color:#2563eb}
.cloud-game-list{display:grid;gap:8px}
.cloud-game-row{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  border:1px solid var(--line);border-radius:12px;padding:8px 10px;
}
.cloud-game-name{font-weight:1000}
.cloud-game-meta{font-size:11px;color:var(--muted);font-weight:800}
@media(max-width:740px){
  .status-stack{justify-items:start;text-align:left}
}

/* Southern Door schedule dashboard */
.dashboard-screen{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  margin-bottom:14px;
}
.dashboard-head{
  display:flex;justify-content:space-between;align-items:flex-start;
  gap:12px;margin-bottom:14px;
}
.dashboard-head h1{margin:2px 0 4px;font-size:24px}
.dashboard-actions{display:flex;gap:8px;flex-wrap:wrap}
.schedule-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.game-card{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:rgba(0,0,0,.02);
  display:grid;
  gap:8px;
}
html[data-theme="dark"] .game-card{background:rgba(255,255,255,.04)}
.game-date{font-size:12px;color:var(--muted);font-weight:900}
.game-opponent{font-size:17px;font-weight:1000}
.game-meta{font-size:12px;font-weight:800}
.game-note{font-size:11px;font-weight:900}
.game-actions{display:flex;gap:6px;flex-wrap:wrap}
.game-card.current{outline:2px solid rgba(236,72,153,.35)}
@media(max-width:900px){.schedule-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.schedule-grid{grid-template-columns:1fr}.dashboard-head{flex-direction:column}}

/* SD v1.3 — iPad numeric stat entry */
.yards-entry{
  display:grid;
  gap:10px;
}
.yards-label{
  font-size:13px;
  font-weight:900;
}
.yards-input{
  width:100%;
  font-size:28px !important;
  font-weight:1000;
  text-align:center;
  padding:10px 8px !important;
  min-height:52px;
}
.yards-actions{
  display:flex;
  justify-content:center;
  gap:7px;
  flex-wrap:wrap;
}
.yards-actions .btn,
.yards-actions .btn-primary{
  min-width:62px;
}

/* ---------- SD v1.4 compact game setup ---------- */
.setup-header{margin-bottom:6px}
.setup-title-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.setup-toggle{
  min-height:28px !important;
  padding:4px 7px !important;
  font-size:10px !important;
}
#gameSetupBody{padding-top:6px}
#gameSetupBody[hidden]{display:none !important}
.stats-top{margin-top:4px !important}

/* Selected stat category */
#mOff.active{
  background:#2563eb !important;
  border-color:#1d4ed8 !important;
  color:#fff !important;
  box-shadow:0 8px 18px rgba(37,99,235,.22) !important;
}
#mDef.active{
  background:#dc2626 !important;
  border-color:#b91c1c !important;
  color:#fff !important;
  box-shadow:0 8px 18px rgba(220,38,38,.22) !important;
}
#mST.active{
  background:#16a34a !important;
  border-color:#15803d !important;
  color:#fff !important;
  box-shadow:0 8px 18px rgba(22,163,74,.22) !important;
}
.modebtn:not(.active){opacity:.82}

/* SD v1.5 Southern Door identity */
.team-us-eagle{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  gap:5px;
}
.team-us-eagle img{
  width:28px;
  height:22px;
  object-fit:contain;
  background:#fff;
  border-radius:4px;
}
.opponent-display{
  font-size:12px;
  font-weight:1000;
  text-align:center;
  margin:3px 0 5px;
}

/* SD v1.5.1 - embedded Eagle logo */
.team-us-eagle img{
  width:38px !important;
  height:28px !important;
  object-fit:contain !important;
  display:block !important;
  flex:0 0 auto !important;
}
.team-us-eagle{
  gap:6px !important;
}

/* ---------- SD v1.6 season roster dashboard ---------- */
.season-roster-panel{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  margin-bottom:12px;
  background:rgba(0,0,0,.02);
}
html[data-theme="dark"] .season-roster-panel{background:rgba(255,255,255,.04)}
.season-roster-title{font-size:14px;font-weight:1000}
.season-roster-status{font-size:12px;font-weight:900;margin-top:2px}
.season-roster-actions{display:flex;gap:7px;flex-wrap:wrap;align-items:center}
.roster-file-label{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.roster-edit-grid{
  display:grid;
  gap:6px;
}
.roster-edit-row{
  display:grid;
  grid-template-columns:80px 1fr 1fr 90px;
  gap:6px;
  align-items:center;
}
.roster-edit-row input{
  min-width:0;
  padding:7px 8px !important;
  font-size:12px !important;
}
.roster-edit-head{
  font-size:10px;
  font-weight:1000;
  text-transform:uppercase;
  color:var(--muted);
}
@media(max-width:700px){
  .season-roster-panel{align-items:flex-start;flex-direction:column}
  .roster-edit-row{grid-template-columns:64px 1fr}
  .roster-edit-row .optional-field{display:none}
}

/* SD v1.7 test game */
.test-game-wrap{
  margin-bottom:12px;
}
.test-game-label{
  font-size:11px;
  font-weight:1000;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:5px;
}
.test-card{
  border-style:dashed;
}

/* SD v1.8 - Southern Door Eagle in US button */
#btnUS.team-us-eagle{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
}
#btnUS.team-us-eagle img{
  display:block !important;
  width:34px !important;
  height:26px !important;
  object-fit:contain !important;
  flex:0 0 auto !important;
  background:#fff !important;
  border-radius:4px !important;
}
#btnUS.team-us-eagle span{
  display:inline-block !important;
}

/* ---------- SD v1.9 visual refresh ---------- */
body{
  background:
    linear-gradient(180deg, rgba(37,99,235,.05), transparent 240px),
    var(--bg);
}

.dashboard-screen{
  background:
    linear-gradient(135deg, rgba(37,99,235,.08), rgba(236,72,153,.05)),
    var(--card);
}
.dashboard-brand-row{
  display:flex;
  align-items:center;
  gap:12px;
}
.dashboard-eagle{
  width:64px;
  height:48px;
  object-fit:contain;
  background:#fff;
  border-radius:10px;
  padding:3px;
  box-shadow:0 6px 18px rgba(15,23,42,.12);
}
.dashboard-head h1{
  font-size:26px;
  margin:0;
}

.game-card{
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.92)) !important;
  border-color:rgba(37,99,235,.14) !important;
  box-shadow:0 8px 20px rgba(15,23,42,.06);
}
html[data-theme="dark"] .game-card{
  background:linear-gradient(180deg, rgba(30,41,59,.92), rgba(15,23,42,.94)) !important;
}
.game-card:hover{
  transform:translateY(-1px);
}
.game-card-top{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
}
.site-pill{
  border-radius:999px;
  padding:3px 7px;
  font-size:10px;
  font-weight:1000;
  text-transform:uppercase;
}
.site-pill.home{
  background:rgba(22,163,74,.14);
  color:#15803d;
}
.site-pill.away{
  background:rgba(37,99,235,.14);
  color:#1d4ed8;
}
.site-pill.tbd{
  background:rgba(234,88,12,.14);
  color:#c2410c;
}
.playoff-card{
  border-color:rgba(236,72,153,.30) !important;
  background:
    linear-gradient(180deg, rgba(253,242,248,.95), rgba(255,255,255,.95)) !important;
}
.game-note{
  color:#be185d;
}

.dashboard-return{
  background:rgba(37,99,235,.12) !important;
  border-color:rgba(37,99,235,.28) !important;
  font-weight:1000 !important;
}

/* Give the stat screen some light structure */
.setup-card{
  background:
    linear-gradient(180deg, rgba(239,246,255,.72), rgba(255,255,255,.96)) !important;
}
.record-card{
  background:
    linear-gradient(180deg, rgba(240,253,244,.62), rgba(255,255,255,.96)) !important;
}
html[data-theme="dark"] .setup-card,
html[data-theme="dark"] .record-card{
  background:var(--card) !important;
}

.setup-header{
  padding-bottom:6px;
  border-bottom:1px solid rgba(37,99,235,.10);
}
.record-card .card-hd{
  padding-bottom:6px;
  border-bottom:1px solid rgba(22,163,74,.10);
}

.stat-grid.compact{
  padding:8px;
  border-radius:12px;
  background:rgba(255,255,255,.56);
  border:1px solid rgba(37,99,235,.08);
}
.log{
  background:rgba(255,255,255,.66) !important;
}
.player-grid{
  padding:8px;
  border-radius:12px;
  background:rgba(255,255,255,.55);
  border:1px solid rgba(22,163,74,.08);
}
html[data-theme="dark"] .stat-grid.compact,
html[data-theme="dark"] .player-grid,
html[data-theme="dark"] .log{
  background:rgba(255,255,255,.04) !important;
}

.team-row{
  padding:6px 0;
}
.mode-row{
  padding:6px 0;
}

/* SD v1.9.1 - Test Game belongs at bottom of dashboard */
.test-game-wrap{
  margin-top:16px !important;
  margin-bottom:0 !important;
  padding-top:12px;
  border-top:1px solid var(--line);
}

/* =========================================================
   SD v2.0 — iPad / Tablet usability pass
   ========================================================= */

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

body{
  min-height:100vh;
  min-height:100dvh;
  overscroll-behavior-y:contain;
}

button,
input,
select,
textarea,
label{
  -webkit-tap-highlight-color:transparent;
}

button{
  touch-action:manipulation;
}

/* Keep the app centered and use tablet width efficiently */
.app{
  width:min(100%, 1360px);
  margin:0 auto;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

/* Dashboard tablet layout */
.dashboard-screen{
  padding:14px !important;
}

.dashboard-head{
  align-items:center !important;
}

.dashboard-actions{
  justify-content:flex-end;
}

.schedule-grid{
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
}

.game-card{
  min-height:142px;
  padding:11px !important;
}

.game-opponent{
  font-size:16px !important;
}

.game-actions .btn,
.game-actions .btn-primary{
  min-height:38px !important;
  padding:7px 10px !important;
  font-size:11px !important;
}

/* Season roster bar */
.season-roster-panel{
  padding:9px 10px !important;
}
.season-roster-actions .btn,
.season-roster-actions .roster-file-label{
  min-height:36px !important;
  padding:6px 9px !important;
  font-size:11px !important;
}

/* Main stats screen: two balanced tablet columns */
.grid{
  grid-template-columns:minmax(330px,.82fr) minmax(500px,1.18fr) !important;
  gap:10px !important;
  align-items:start !important;
}

.card{
  padding:10px !important;
}

.card-hd{
  margin-bottom:6px !important;
}

.card h2{
  font-size:16px !important;
}

/* Top app toolbar */
.topbar{
  padding:8px 10px !important;
  gap:8px !important;
  position:sticky;
  top:max(4px, env(safe-area-inset-top));
  z-index:20;
}

.brand .title{
  font-size:16px !important;
}

.top-actions{
  gap:5px !important;
}

.top-actions .btn{
  min-height:32px !important;
  padding:5px 7px !important;
  font-size:10px !important;
}

/* Compact setup when expanded */
#gameSetupBody .field{
  min-width:170px !important;
}
#gameSetupBody input{
  padding:8px 9px !important;
  font-size:12px !important;
}

/* Team / quarter / mode controls stay in a compact row */
.team-row,
.mode-row{
  gap:5px !important;
  flex-wrap:wrap !important;
}

.btn-team{
  min-width:62px !important;
  min-height:36px !important;
  padding:5px 7px !important;
  font-size:11px !important;
}

#btnUS.team-us-eagle img{
  width:30px !important;
  height:22px !important;
}

.qbtns{
  gap:4px !important;
}
.qbtn{
  min-width:42px !important;
  min-height:32px !important;
  padding:4px 6px !important;
  font-size:10px !important;
}

.modebtn{
  min-height:33px !important;
  padding:5px 8px !important;
  font-size:11px !important;
}

#btnEditMode,
#btnUndo,
#btnViewSheet{
  min-height:33px !important;
  padding:5px 8px !important;
  font-size:10px !important;
}

/* Player grid: more players on screen, still large enough to tap */
.player-grid{
  grid-template-columns:repeat(7,minmax(0,1fr)) !important;
  gap:5px !important;
  padding:6px !important;
}

.player-btn{
  min-height:42px !important;
  padding:4px 3px !important;
  border-radius:10px !important;
}

.player-btn .num{
  font-size:13px !important;
}

.player-btn .name{
  font-size:8px !important;
  line-height:1.05 !important;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Stat buttons: compact but dependable touch targets */
.stat-grid.compact{
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:5px !important;
  padding:6px !important;
}

.stat-btn{
  min-height:34px !important;
  padding:5px 5px !important;
  font-size:9.5px !important;
  line-height:1.1 !important;
  border-radius:9px !important;
}

/* Running stats should not dominate the left column */
.log{
  max-height:170px !important;
  overflow:auto !important;
  -webkit-overflow-scrolling:touch;
}

.log .item{
  padding:6px !important;
  font-size:10px !important;
  line-height:1.2 !important;
}

.log .item .meta{
  font-size:9px !important;
}

.icon-btn{
  min-height:24px !important;
  padding:2px 6px !important;
  font-size:10px !important;
}

/* Modals: fit inside an iPad screen and always scroll */
.modal{
  padding:
    max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left)) !important;
}

.modal-card{
  width:min(920px, 96vw) !important;
  max-height:92dvh !important;
  overflow:hidden !important;
  display:flex !important;
  flex-direction:column !important;
}

.modal-bd{
  max-height:none !important;
  flex:1 1 auto;
  overflow:auto !important;
  -webkit-overflow-scrolling:touch;
}

.modal-hd{
  flex:0 0 auto;
}

/* Numeric yardage entry is centered and keypad friendly */
.yards-input{
  font-size:24px !important;
  min-height:46px !important;
}

.yards-actions .btn,
.yards-actions .btn-primary{
  min-height:36px !important;
  padding:6px 10px !important;
}

/* Printable preview stays readable and scrollable */
.print-sheet{
  min-width:0 !important;
}
.print-sheet table{
  font-size:10px !important;
}
.print-sheet th,
.print-sheet td{
  padding:3px 4px !important;
}

/* iPad portrait */
@media (min-width:700px) and (max-width:900px){
  .schedule-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .grid{
    grid-template-columns:1fr !important;
  }

  .player-grid{
    grid-template-columns:repeat(8,minmax(0,1fr)) !important;
  }

  .stat-grid.compact{
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  }

  .topbar{
    position:static;
  }
}

/* iPad landscape */
@media (min-width:901px) and (max-width:1190px){
  .schedule-grid{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }

  .grid{
    grid-template-columns:minmax(300px,.78fr) minmax(500px,1.22fr) !important;
  }

  .player-grid{
    grid-template-columns:repeat(7,minmax(0,1fr)) !important;
  }
}

/* Smaller tablets / phones still remain usable */
@media (max-width:699px){
  .app{
    padding:8px !important;
  }

  .grid{
    grid-template-columns:1fr !important;
  }

  .schedule-grid{
    grid-template-columns:1fr !important;
  }

  .dashboard-head,
  .season-roster-panel{
    flex-direction:column !important;
    align-items:stretch !important;
  }

  .dashboard-actions,
  .season-roster-actions{
    justify-content:flex-start !important;
  }

  .player-grid{
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
  }

  .stat-grid.compact{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}

/* SD v2.1 — screen readability only; stat sheet/print view unchanged */
body{font-weight:400;line-height:1.35}
.dashboard-head h1,.card h2,.subhd{font-weight:700!important}
.muted,.hint{font-weight:400!important}
.season-roster-title{font-weight:700!important}
.season-roster-status,.game-meta{font-weight:500!important}
.game-date{font-weight:500!important}
.game-opponent{font-weight:700!important}
.game-note{font-weight:600!important}
.site-pill{font-weight:700!important}
.field label{font-weight:600!important}
.status-stack,.sync-status{font-weight:500!important}

.btn,button.btn{font-weight:500!important}
.btn-primary,.btn-team{font-weight:600!important}
.qbtn,.modebtn{font-weight:500!important}
.qbtn.active,.modebtn.active{font-weight:700!important}

.player-btn{font-weight:400!important}
.player-btn .num{font-weight:700!important}
.player-btn .name{font-weight:400!important}

.stat-btn{font-weight:500!important;letter-spacing:0!important}
.team-banner{font-weight:600!important}
.opponent-display{font-weight:500!important}

.log .item,.log .item .meta{font-weight:400!important}
.log .item .meta{opacity:.78}
.log strong,.log b{font-weight:600!important}

.setup-toggle,.dashboard-return{font-weight:600!important}
.modal-hd{font-weight:700!important}
.modal-bd{font-weight:400!important}
.roster-edit-head{font-weight:600!important}
input,select,textarea{font-weight:400!important}

/* SD v2.4 cloud game protection prompt */
#loadProtectedCloudGame,
#cancelProtectedCloudGame{
  min-height:36px !important;
}

/* SD v2.5 — offline sync safety warning */
.offline-sync-warning{
  display:grid;
  gap:10px;
}
.offline-sync-title{
  font-size:16px;
  font-weight:700;
}
.offline-sync-copy{
  font-size:12px;
  line-height:1.45;
}
.offline-sync-important{
  font-size:12px;
  line-height:1.45;
  padding:10px;
  border:1px solid rgba(234,88,12,.25);
  background:rgba(234,88,12,.08);
  border-radius:10px;
}

/* SD v2.6 — cloud game ownership/load-first protection */
.sync-owner-warning{
  display:grid;
  gap:10px;
}
.sync-owner-title{
  font-size:16px;
  font-weight:700;
}
.sync-owner-important{
  padding:10px;
  border-radius:10px;
  border:1px solid rgba(37,99,235,.24);
  background:rgba(37,99,235,.08);
  line-height:1.45;
  font-size:12px;
}

/* SD v2.7 — Quick Players */
.recent-player-wrap{
  margin-top:8px;
  margin-bottom:6px;
}
.recent-player-label{
  font-size:10px;
  font-weight:600;
  color:var(--muted);
  margin-bottom:4px;
}
.recent-player-row{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:5px;
}
.recent-player-btn{
  min-height:32px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.72);
  color:var(--text);
  border-radius:9px;
  padding:4px 5px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  font-size:10px;
  font-weight:500;
  overflow:hidden;
}
.recent-player-btn .quick-num{
  font-weight:700;
  font-size:12px;
}
.recent-player-btn .quick-name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:8px;
}
.recent-player-btn.active{
  outline:2px solid rgba(37,99,235,.28);
  background:rgba(37,99,235,.08);
}
html[data-theme="dark"] .recent-player-btn{
  background:rgba(255,255,255,.05);
}
.recent-player-empty{
  min-height:32px;
  border:1px dashed var(--line);
  border-radius:9px;
}

/* SD v2.8 — Edit Last Stat */
.edit-last-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.edit-last-grid .full{
  grid-column:1 / -1;
}
.edit-last-grid select,
.edit-last-grid input{
  width:100%;
  min-height:38px;
  padding:7px 8px;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--card);
  color:var(--text);
  font-size:12px;
}
@media(max-width:650px){
  .edit-last-grid{grid-template-columns:1fr}
  .edit-last-grid .full{grid-column:auto}
}

/* SD v2.11 penalty picker */
.penalty-picker{display:grid;gap:10px}
.penalty-title{font-size:14px;font-weight:700}
.penalty-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}
.penalty-choice{
  min-height:38px !important;
  text-align:left;
  white-space:normal;
  line-height:1.2;
}
@media(max-width:650px){
  .penalty-grid{grid-template-columns:1fr}
}

/* SD v2.13 — Play by Play editing */
.play-edit-btn{
  background:rgba(37,99,235,.08) !important;
  border-color:rgba(37,99,235,.18) !important;
}

/* SD v2.14 — CSV + Hudl XLSX roster import */
.season-roster-actions .roster-file-label{
  min-width:88px;
}

/* SD v2.17 — Southern Door Sideline Stats home logo */
.home-brand-logo{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100%;
  margin:2px auto 10px;
}
.home-brand-logo img{
  display:block;
  width:min(100%, 430px);
  max-height:145px;
  object-fit:cover;
  object-position:center;
  border-radius:14px;
}
@media(max-width:700px){
  .home-brand-logo{
    margin-bottom:8px;
  }
  .home-brand-logo img{
    width:min(100%, 360px);
    max-height:120px;
  }
}

/* =========================================================
   SD v2.18 — Two-iPad Split Stat Mode
   ========================================================= */
.stat-role-panel{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  margin-bottom:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(37,99,235,.05);
}
.stat-role-title{font-size:14px;font-weight:700}
.stat-role-buttons{display:flex;gap:6px;flex-wrap:wrap}
.role-btn.active{
  color:#fff !important;
  border-color:transparent !important;
}
#roleFull.active{background:#475569 !important}
#roleOffense.active{background:#2563eb !important}
#roleDefense.active{background:#dc2626 !important}
.device-role-badge{
  margin-top:3px;
  font-size:10px;
  font-weight:700;
  text-align:right;
  color:var(--muted);
}
.device-role-badge.offense{color:#1d4ed8}
.device-role-badge.defense{color:#b91c1c}
.modebtn.role-hidden{display:none !important}
.split-sync-note{
  padding:9px 10px;
  border-radius:10px;
  background:rgba(22,163,74,.08);
  border:1px solid rgba(22,163,74,.18);
  font-size:12px;
  line-height:1.4;
}
@media(max-width:700px){
  .stat-role-panel{flex-direction:column;align-items:stretch}
  .stat-role-buttons{justify-content:flex-start}
}

/* SD v2.19 — Stat role buttons inside each game card */
.game-role-actions{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:5px;
  margin-top:2px;
}
.role-game-btn{
  min-height:34px !important;
  padding:5px 6px !important;
  font-size:10px !important;
  font-weight:600 !important;
  border-width:1px !important;
}
.role-game-btn.role-full{
  background:rgba(71,85,105,.09);
  border-color:rgba(71,85,105,.20);
}
.role-game-btn.role-offense{
  background:rgba(37,99,235,.09);
  border-color:rgba(37,99,235,.22);
  color:#1d4ed8;
}
.role-game-btn.role-defense{
  background:rgba(220,38,38,.08);
  border-color:rgba(220,38,38,.20);
  color:#b91c1c;
}
.role-game-btn:active{
  transform:translateY(1px);
}
.test-role-actions{
  margin-top:4px;
}
@media(max-width:700px){
  .game-role-actions{
    grid-template-columns:1fr;
  }
}

/* SD v2.20 — automatic local game saving */
#saveStatus{
  font-weight:600 !important;
}

/* SD v2.21 — bundled 2026 roster */
.season-roster-status{
  color:#15803d;
}

/* SD v2.23 — iPad yard-entry modal */
.modal.yards-modal-open{
  align-items:flex-start !important;
  justify-content:center !important;
  padding-top:max(16px, env(safe-area-inset-top)) !important;
}
.modal.yards-modal-open .modal-card{
  margin-top:4px !important;
  max-height:48dvh !important;
  width:min(520px, 94vw) !important;
}
.modal.yards-modal-open .modal-bd{
  overflow:visible !important;
}
.modal.yards-modal-open .yards-entry{
  gap:8px !important;
}
.modal.yards-modal-open .yards-input{
  font-size:30px !important;
  min-height:54px !important;
  padding:8px !important;
}
.modal.yards-modal-open .yards-actions{
  margin-top:2px !important;
}
@media (min-width:700px) and (max-width:1190px){
  .modal.yards-modal-open{
    padding-top:max(8px, env(safe-area-inset-top)) !important;
  }
  .modal.yards-modal-open .modal-card{
    margin-top:0 !important;
    max-height:44dvh !important;
  }
}

/* SD v2.28 UI cleanup only — storage/sync logic unchanged from v2.26 */
#btnSyncNow{font-weight:800;}

/* SD v2.29 linked QB completion -> receiver */
.receiver-prompt{
  font-weight:800;
  font-size:18px;
  margin-bottom:10px;
}
.receiver-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(135px,1fr));
  gap:8px;
  max-height:52vh;
  overflow:auto;
  padding:2px;
}
.receiver-btn{
  min-height:52px;
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:flex-start;
  text-align:left;
}
.receiver-btn b{
  min-width:34px;
  font-size:17px;
}
.receiver-btn span{
  font-size:15px;
}
.receiver-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}
@media (max-width:700px){
  .receiver-grid{grid-template-columns:repeat(2,minmax(0,1fr)); max-height:48vh;}
  .receiver-btn{min-height:48px; padding:8px;}
}

/* SD v2.30 2-point linked passing entry */


/* Dashboard version label */
.dashboard-version{
  text-align:right;
  padding:6px 10px 0;
  font-size:12px;
  font-weight:700;
  opacity:.65;
  letter-spacing:.02em;
}


/* SD-2.40 Stat Sheet readability refresh */
.print-sheet{
  background:#ffffff;
}
.print-sheet h1{
  background:#1f2937;
  color:#ffffff;
  padding:10px 12px;
  border-radius:8px;
  margin-bottom:6px;
}
.print-sheet .meta{
  background:#f3f4f6;
  border:1px solid #d1d5db;
  padding:7px 10px;
  border-radius:6px;
  margin-bottom:10px;
}
.print-sheet .qhdr{
  border:1px solid #d1d5db;
  border-radius:8px;
  padding:8px;
  margin:10px 0;
  background:#fafafa;
  break-inside:avoid;
}
.print-sheet .qhdr > h2{
  background:#e5e7eb;
  color:#111827;
  padding:7px 10px;
  border-radius:6px;
  margin:0 0 8px;
}
.print-sheet h3{
  padding:5px 8px;
  border-radius:5px;
  margin:8px 0 4px;
}
.print-sheet h3.section-offense{
  background:#dbeafe;
  color:#1e3a8a;
  border-left:5px solid #2563eb;
}
.print-sheet h3.section-defense{
  background:#fee2e2;
  color:#7f1d1d;
  border-left:5px solid #dc2626;
}
.print-sheet h3.section-special{
  background:#dcfce7;
  color:#14532d;
  border-left:5px solid #16a34a;
}
.print-sheet table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  margin-bottom:8px;
}
.print-sheet th{
  background:#374151;
  color:#fff;
  font-weight:800;
  padding:5px 6px;
  border:1px solid #9ca3af;
}
.print-sheet td{
  padding:5px 6px;
  border:1px solid #d1d5db;
}
.print-sheet tbody tr:nth-child(even) td{
  background:#f9fafb;
}
.print-sheet tbody tr:hover td{
  background:#eef2ff;
}

@media print{
  .print-sheet{
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  .print-sheet .qhdr{
    background:#fafafa !important;
  }
}


/* SD-2.43 */
.modal.modal-top{
  align-items:flex-start !important;
  padding-top:max(18px, calc(env(safe-area-inset-top) + 12px)) !important;
  overflow-y:auto;
}
.modal.modal-top .modal-card{
  margin-top:0 !important;
  max-height:78dvh;
  overflow-y:auto;
}
.print-sheet td.stat-nonzero{
  font-weight:900;
  color:#111827;
}
.print-sheet td.stat-zero{
  font-weight:400;
  color:#b6bdc8;
}
@media print{
  .print-sheet td.stat-nonzero{
    font-weight:900 !important;
    color:#111827 !important;
  }
  .print-sheet td.stat-zero{
    font-weight:400 !important;
    color:#b6bdc8 !important;
  }
}


/* SD-2.45 — all dialogs open at the top and remain readable on iPad */
.modal{
  align-items:flex-start !important;
  justify-content:center !important;
  padding:
    max(8px, env(safe-area-inset-top))
    10px
    max(8px, env(safe-area-inset-bottom)) !important;
  overflow-y:auto !important;
  overscroll-behavior:contain;
}

.modal .modal-card{
  margin:0 auto !important;
  width:min(860px, 100%) !important;
  max-height:calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
  overflow:hidden !important;
  display:flex !important;
  flex-direction:column !important;
}

.modal .modal-hd{
  flex:0 0 auto;
}

.modal .modal-bd{
  flex:1 1 auto;
  min-height:0;
  max-height:none !important;
  overflow:auto !important;
  -webkit-overflow-scrolling:touch;
  padding-right:4px;
}

/* Yard entry stays compact at the very top, above the iPad keyboard */
.modal.yards-modal-open{
  align-items:flex-start !important;
  padding-top:max(6px, env(safe-area-inset-top)) !important;
}
.modal.yards-modal-open .modal-card{
  width:min(520px, 96vw) !important;
  max-height:46dvh !important;
  overflow:hidden !important;
}
.modal.yards-modal-open .modal-bd{
  overflow:visible !important;
}

/* Printable Stat Sheet gets nearly the full screen height */
.modal:has(.print-sheet) .modal-card{
  max-height:calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))) !important;
}
.modal:has(.print-sheet) .modal-bd{
  overflow:auto !important;
}


.modal.stat-sheet-modal .modal-card{
  max-height:calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))) !important;
}
.modal.stat-sheet-modal .modal-bd{
  overflow:auto !important;
}


/* SD-2.46 — iPad/Safari modal visibility hard fix
   Every dialog is attached to BODY by JS and pinned to the visual viewport. */
#modal.modal{
  position:fixed !important;
  inset:0 !important;
  top:0 !important;
  left:0 !important;
  right:0 !important;
  bottom:0 !important;
  width:100vw !important;
  height:100dvh !important;
  min-height:100svh !important;
  margin:0 !important;
  padding:
    max(6px, env(safe-area-inset-top))
    8px
    max(6px, env(safe-area-inset-bottom)) !important;
  display:flex !important;
  align-items:flex-start !important;
  justify-content:center !important;
  overflow:hidden !important;
  z-index:2147483000 !important;
  transform:none !important;
  box-sizing:border-box !important;
}

#modal.modal[hidden]{
  display:none !important;
}

#modal .modal-card{
  position:relative !important;
  top:0 !important;
  left:auto !important;
  right:auto !important;
  bottom:auto !important;
  transform:none !important;
  margin:0 auto !important;
  width:min(900px, 100%) !important;
  max-width:100% !important;
  height:auto !important;
  max-height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  display:flex !important;
  flex-direction:column !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}

#modal .modal-hd{
  flex:0 0 auto !important;
  position:sticky !important;
  top:0 !important;
  z-index:2 !important;
  background:var(--card) !important;
}

#modal .modal-bd{
  flex:1 1 auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow:auto !important;
  -webkit-overflow-scrolling:touch !important;
  overscroll-behavior:contain !important;
}

/* Printable Stat Sheet gets a true full-height reading window. */
#modal.stat-sheet-modal .modal-card{
  width:min(1100px, 100%) !important;
  height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  max-height:none !important;
}
#modal.stat-sheet-modal .modal-bd{
  height:100% !important;
  overflow:auto !important;
}

/* Yard entry stays at the absolute top and compact above the software keyboard. */
#modal.yards-modal-open{
  align-items:flex-start !important;
}
#modal.yards-modal-open .modal-card{
  width:min(520px, 96vw) !important;
  height:auto !important;
  max-height:42dvh !important;
}
#modal.yards-modal-open .modal-bd{
  overflow:visible !important;
}

/* Small-screen fallback */
@media (max-width:700px){
  #modal.modal{
    padding:
      max(4px, env(safe-area-inset-top))
      4px
      max(4px, env(safe-area-inset-bottom)) !important;
  }
  #modal .modal-card{
    border-radius:10px !important;
  }
}


/* SD-2.47 — reliable Stat Sheet scrolling on all iPad/Safari viewport modes */
#modal.stat-sheet-modal .modal-card{
  position:fixed !important;
  top:max(4px, env(safe-area-inset-top)) !important;
  left:4px !important;
  right:4px !important;
  bottom:max(4px, env(safe-area-inset-bottom)) !important;
  width:auto !important;
  height:auto !important;
  max-height:none !important;
  margin:0 !important;
}

#modal.stat-sheet-modal .modal-bd{
  position:absolute !important;
  top:48px !important;
  left:8px !important;
  right:8px !important;
  bottom:8px !important;
  display:block !important;
  overflow-y:scroll !important;
  overflow-x:auto !important;
  -webkit-overflow-scrolling:touch !important;
  touch-action:pan-y pan-x !important;
  overscroll-behavior:auto !important;
}

#modal.stat-sheet-modal .stat-sheet-scroll-content{
  display:block !important;
  min-height:max-content !important;
  padding-bottom:40px !important;
}

/* Keep the modal title/Close button fixed while the sheet itself scrolls. */
#modal.stat-sheet-modal .modal-hd{
  position:absolute !important;
  top:0 !important;
  left:8px !important;
  right:8px !important;
  height:44px !important;
  z-index:10 !important;
}


/* SD-2.48 scoring summary */
.sheet-tab.active{
  background:#1f2937 !important;
  color:#fff !important;
  border-color:#1f2937 !important;
}
.score-clock-input{
  letter-spacing:.06em;
}
.score-summary-total{
  display:flex;
  justify-content:center;
  gap:28px;
  flex-wrap:wrap;
  margin:10px 0 14px;
  padding:10px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#f3f4f6;
  font-size:18px;
}
.score-summary-total b{
  font-size:24px;
  margin-left:6px;
}
.scoring-table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.scoring-table{
  min-width:700px;
}
.scoring-table .scoring-play{
  text-align:left !important;
  min-width:250px;
}

/* Make the stat sheet's internal viewport unmistakably scrollable. */
#modal.stat-sheet-modal .modal-bd{
  overflow-y:auto !important;
  overflow-x:hidden !important;
  touch-action:pan-y !important;
}
#modal.stat-sheet-modal .stat-sheet-scroll-content{
  overflow:visible !important;
  min-height:0 !important;
  height:auto !important;
  padding-bottom:70px !important;
}


/* SD-2.49 Team Stats tab */
.team-stats-sheet{
  max-width:900px;
  margin:0 auto;
}
.team-stats-head{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:12px;
  align-items:center;
  padding:12px 4px 14px;
  border-bottom:1px solid #d1d5db;
}
.team-stats-head b:first-child{ text-align:left; }
.team-stats-head b:last-child{ text-align:right; }
.team-stats-head span{
  font-weight:900;
  font-size:12px;
  letter-spacing:.04em;
}
.team-stat-row{
  padding:12px 0 10px;
  border-bottom:1px solid #e5e7eb;
}
.team-stat-values{
  display:grid;
  grid-template-columns:80px 1fr 80px;
  align-items:center;
  gap:10px;
}
.team-stat-values b:first-child{ text-align:left; }
.team-stat-values b:last-child{ text-align:right; }
.team-stat-values span{
  text-align:center;
  font-weight:700;
}
.team-stat-bars{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:4px;
  margin-top:8px;
}
.team-stat-bar{
  height:4px;
  background:#e5e7eb;
  overflow:hidden;
}
.team-stat-bar.left{
  display:flex;
  justify-content:flex-end;
}
.team-stat-bar i{
  display:block;
  height:100%;
  background:#64748b;
}
.team-stat-bar.right i{
  background:#94a3b8;
}
.team-stats-note{
  margin-top:14px;
  padding:10px 12px;
  border-radius:8px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  font-size:11px;
  color:#64748b;
  line-height:1.35;
}
@media(max-width:700px){
  .team-stat-values{
    grid-template-columns:54px 1fr 54px;
    gap:6px;
    font-size:12px;
  }
  .team-stats-head{
    font-size:12px;
  }
}


/* SD-2.50 clean Player Stats tab */
.player-stats-sheet{
  background:#fff;
  color:#111827;
  max-width:980px;
  margin:0 auto;
  padding:0 4px 32px;
}
.player-stats-team-title{
  text-align:center;
  font-weight:800;
  font-size:15px;
  padding:8px 0 12px;
  border-bottom:2px solid #111827;
  margin-bottom:18px;
}
.player-stat-section{
  margin:0 0 28px;
}
.player-stat-section h3{
  margin:0 0 10px;
  font-size:15px;
  font-weight:700;
  color:#111827;
  background:none !important;
  padding:0 !important;
  border:0 !important;
}
.player-stat-table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.player-stat-table{
  width:100%;
  min-width:620px;
  border-collapse:collapse;
  background:#fff;
}
.player-stat-table th{
  font-size:12px;
  font-weight:500;
  color:#4b5563;
  text-align:right;
  padding:8px 7px;
  border-bottom:1px solid #cfd4da;
  background:#fff !important;
}
.player-stat-table th:first-child{
  text-align:left;
  min-width:260px;
}
.player-stat-table td{
  font-size:13px;
  font-weight:500;
  text-align:right;
  padding:10px 7px;
  border-bottom:1px solid #eceff2;
  color:#111827;
}
.player-stat-table td:first-child{
  text-align:left;
  font-weight:500;
}
.player-stat-table tr:last-child td{
  border-bottom:none;
}
@media(max-width:700px){
  .player-stats-sheet{ padding:0 0 26px; }
  .player-stat-table{ min-width:560px; }
  .player-stat-table th:first-child{ min-width:205px; }
  .player-stat-table th,
  .player-stat-table td{ font-size:11px; padding:8px 5px; }
  .player-stat-section{ margin-bottom:24px; }
}


/* SD-2.51 quick first-down / other-side prompts */
.quick-question{
  padding:8px 2px 4px;
}
.quick-question-text{
  font-size:20px;
  font-weight:850;
  line-height:1.25;
  margin-bottom:16px;
}
.quick-question-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.quick-question-actions .btn,
.quick-question-actions .btn-primary{
  min-height:52px !important;
  font-size:15px !important;
}
@media(max-width:700px){
  .quick-question-actions{ grid-template-columns:1fr; }
}


/* SD-2.52 Drive tracking */
.drive-start-btn{
  font-weight:900 !important;
}
.drive-status{
  margin-top:8px;
  padding:7px 10px;
  border-radius:9px;
  background:#f1f5f9;
  border:1px solid #dbe3ec;
  font-size:12px;
  color:#64748b;
}
.drive-status.active{
  background:#ecfdf5;
  border-color:#a7f3d0;
  color:#166534;
}
.drive-start-form{
  display:grid;
  gap:10px;
}
.drive-field-label{
  font-weight:900;
  font-size:14px;
  margin-top:2px;
}
.hint-inline{
  font-weight:500;
  opacity:.65;
}
.drive-choice-row{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.drive-team-choice.active,
.drive-side-choice.active{
  background:#1f2937 !important;
  color:white !important;
  border-color:#1f2937 !important;
}
.drive-yard-input,
.drive-clock-input{
  width:100%;
  box-sizing:border-box;
}
.drive-start-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:4px;
}

.drives-sheet{
  max-width:980px;
  margin:0 auto;
  padding-bottom:50px;
}
.drives-heading{
  font-size:20px;
  font-weight:900;
  margin-bottom:4px;
}
.drives-subheading{
  font-size:12px;
  color:#64748b;
  margin-bottom:14px;
}
.drive-card{
  border:1px solid #dbe2e8;
  border-radius:10px;
  margin-bottom:10px;
  background:#fff;
  overflow:hidden;
}
.drive-card summary{
  cursor:pointer;
  list-style:none;
  padding:12px;
  background:#f8fafc;
}
.drive-card summary::-webkit-details-marker{ display:none; }
.drive-summary-main{
  display:grid;
  grid-template-columns:70px minmax(110px,1.5fr) 90px 70px 70px 85px 80px;
  gap:8px;
  align-items:center;
  font-size:12px;
}
.drive-summary-main strong{
  text-align:right;
}
.drive-expanded{
  padding:12px;
  border-top:1px solid #e5e7eb;
}
.drive-mini-stats{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:7px;
  margin-bottom:14px;
}
.drive-mini-stats > div{
  border:1px solid #e5e7eb;
  border-radius:8px;
  padding:8px;
  text-align:center;
}
.drive-mini-stats span{
  display:block;
  font-size:10px;
  color:#64748b;
  margin-bottom:3px;
}
.drive-mini-stats b{
  font-size:13px;
}
.drive-play-list h4{
  margin:0 0 7px;
  font-size:13px;
}
.drive-play-row{
  display:grid;
  grid-template-columns:75px 80px 1fr;
  gap:8px;
  padding:8px 4px;
  border-bottom:1px solid #eef2f6;
  font-size:12px;
}
.drive-play-time{
  font-weight:800;
}
.drive-play-team{
  color:#64748b;
  font-size:10px;
  font-weight:800;
}
.drive-play-desc{
  min-width:0;
}

@media(max-width:760px){
  .drive-choice-row{
    grid-template-columns:1fr 1fr 1fr;
  }
  .drive-summary-main{
    grid-template-columns:55px 1fr 72px;
  }
  .drive-summary-main span:nth-of-type(3),
  .drive-summary-main span:nth-of-type(4),
  .drive-summary-main span:nth-of-type(5){
    display:none;
  }
  .drive-summary-main strong{
    text-align:right;
  }
  .drive-mini-stats{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .drive-play-row{
    grid-template-columns:62px 1fr;
  }
  .drive-play-team{
    display:none;
  }
}


/* SD-2.53 simpler Drive Analysis list */
.drive-summary-main.simple{
  display:grid;
  grid-template-columns:70px minmax(100px,1.2fr) minmax(95px,1fr) 70px 110px;
  gap:8px;
  align-items:center;
}
.drive-toggle-label{
  text-align:right;
  font-size:11px;
  font-weight:900;
  white-space:nowrap;
}
.drive-card .when-open{ display:none; }
.drive-card[open] .when-open{ display:inline; }
.drive-card[open] .when-closed{ display:none; }
.drive-card summary{
  min-height:44px;
}
.drive-card[open] summary{
  border-bottom:1px solid #e5e7eb;
}
@media(max-width:760px){
  .drive-summary-main.simple{
    grid-template-columns:55px minmax(90px,1fr) 70px 92px;
  }
  .drive-summary-main.simple .drive-start-pos{
    display:none;
  }
  .drive-toggle-label{
    font-size:10px;
  }
}

/* SD-2.54 separate minute/second entry */
.clock-box-row{display:grid;grid-template-columns:minmax(90px,1fr) 20px minmax(90px,1fr);gap:7px;align-items:end;width:100%}
.clock-box-row label span{display:block;text-align:center;font-size:11px;font-weight:900;margin-bottom:4px}
.clock-part-input{text-align:center!important;font-size:24px!important;font-weight:900!important}
.clock-colon{font-size:28px;font-weight:900;text-align:center;padding-bottom:9px}
.drive-mini-stats{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(min-width:900px){.drive-mini-stats{grid-template-columns:repeat(9,minmax(0,1fr))}}


/* SD-2.55 compact dashboard schedule + season stats */
.dashboard-main-panels{
  display:grid;
  grid-template-columns:minmax(0,1.7fr) minmax(240px,.8fr);
  gap:14px;
  margin-top:14px;
  align-items:start;
}
.schedule-compact-panel{
  background:var(--card,#fff);
  border:1px solid rgba(120,130,145,.22);
  border-radius:14px;
  padding:14px;
}
.dashboard-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.dashboard-section-title{
  font-size:18px;
  font-weight:950;
}
.schedule-picker{
  width:100%;
  min-height:48px;
  border:1px solid #cfd7df;
  border-radius:10px;
  background:#fff;
  font:800 15px system-ui,-apple-system,sans-serif;
  padding:0 12px;
  color:#111827;
}
.selected-game-panel{
  margin-top:10px;
  border-top:1px solid #e5e7eb;
  padding-top:12px;
}
.selected-game-date{
  font-size:12px;
  color:#64748b;
  font-weight:800;
}
.selected-game-opponent{
  font-size:24px;
  line-height:1.05;
  font-weight:950;
  margin:3px 0 7px;
}
.selected-game-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  font-size:11px;
  font-weight:750;
  color:#475569;
}
.selected-game-meta span{
  background:#f1f5f9;
  border-radius:999px;
  padding:4px 8px;
}
.selected-game-meta .saved-pill{
  background:#ecfdf5;
  color:#166534;
}
.selected-game-role-label{
  margin-top:12px;
  font-size:11px;
  font-weight:900;
  color:#64748b;
}
.selected-game-actions{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:6px;
}
.season-stats-card{
  width:100%;
  min-height:112px;
  display:grid;
  grid-template-columns:48px 1fr 24px;
  align-items:center;
  gap:10px;
  padding:16px;
  text-align:left;
  border:1px solid #d9e1e8;
  border-radius:14px;
  background:#fff;
  color:#111827;
  cursor:pointer;
}
.season-stats-card:hover{ transform:translateY(-1px); }
.season-stats-icon{
  width:46px;height:46px;border-radius:12px;
  display:grid;place-items:center;
  font-size:25px;font-weight:950;
  background:#eef2f7;
}
.season-stats-title{font-size:18px;font-weight:950}
.season-stats-sub{font-size:11px;color:#64748b;margin-top:3px}
.season-stats-arrow{font-size:28px;color:#64748b;text-align:right}
.season-stats-sheet{max-width:980px;margin:0 auto;padding-bottom:45px}
.season-summary-title{font-size:20px;font-weight:950;margin-bottom:12px}
.season-summary-grid{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:7px;
  margin-bottom:16px;
}
.season-summary-grid>div{
  border:1px solid #e2e8f0;border-radius:9px;padding:9px;text-align:center;background:#fff
}
.season-summary-grid span{display:block;font-size:10px;color:#64748b}
.season-summary-grid b{display:block;font-size:18px;margin-top:2px}
.season-table-block{margin-top:16px}
.season-table-block h3{margin:0 0 6px;font-size:15px}
.season-table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.season-table th,.season-table td{white-space:nowrap}
.season-source-note{margin-top:14px}
@media(max-width:800px){
  .dashboard-main-panels{grid-template-columns:1fr}
  .selected-game-actions{grid-template-columns:1fr}
  .season-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* SD-2.56 drive control directly above player roster */
.drive-control-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  align-items:stretch;
  margin-top:8px;
  margin-bottom:8px;
}
.drive-control-row .drive-status{
  margin-top:0;
  display:flex;
  align-items:center;
  min-height:42px;
  box-sizing:border-box;
}
.drive-control-row .drive-start-btn{
  min-height:42px;
  padding-left:16px;
  padding-right:16px;
  white-space:nowrap;
}
@media(max-width:560px){
  .drive-control-row{
    grid-template-columns:1fr auto;
  }
  .drive-control-row .drive-start-btn{
    padding-left:10px;
    padding-right:10px;
    font-size:12px;
  }
}


/* SD-2.57 dashboard: simple expandable schedule, single-device workflow */
.dashboard-simple{
  max-width:900px;
  margin:16px auto 0;
}
.dashboard-section-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:9px;
}
.dashboard-section-title{
  font-size:18px;
  font-weight:950;
}
.season-stats-link{
  border:0;
  background:transparent;
  padding:6px 2px;
  font:900 14px system-ui,-apple-system,sans-serif;
  color:inherit;
  cursor:pointer;
}
.schedule-list{
  display:grid;
  gap:7px;
}
.schedule-row{
  border:1px solid rgba(120,130,145,.24);
  border-radius:10px;
  background:#fff;
  overflow:hidden;
}
.schedule-row summary{
  list-style:none;
  display:grid;
  grid-template-columns:145px minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  min-height:48px;
  padding:0 12px;
  cursor:pointer;
}
.schedule-row summary::-webkit-details-marker{display:none}
.schedule-date-short{
  font-size:12px;
  font-weight:800;
  color:#64748b;
}
.schedule-matchup{
  font-size:15px;
  font-weight:950;
}
.schedule-summary-right{
  display:flex;
  align-items:center;
  gap:8px;
}
.schedule-status{
  font-size:10px;
  font-weight:900;
  padding:3px 7px;
  border-radius:999px;
  background:#ecfdf5;
  color:#166534;
}
.schedule-chevron{
  font-size:22px;
  line-height:1;
  transform:rotate(0deg);
  transition:transform .15s ease;
}
.schedule-row[open] .schedule-chevron{transform:rotate(90deg)}
.schedule-expand{
  border-top:1px solid #edf0f3;
  padding:10px 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.schedule-info-line{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}
.schedule-info-line span{
  font-size:11px;
  font-weight:750;
  background:#f1f5f9;
  border-radius:999px;
  padding:4px 8px;
}
.schedule-continue-btn{
  min-height:36px !important;
  padding:7px 13px !important;
  font-size:12px !important;
  white-space:nowrap;
}
.compact-actions .btn{
  min-height:34px;
  padding:6px 10px;
  font-size:12px;
}
.test-game-wrap{
  max-width:900px;
  margin-left:auto;
  margin-right:auto;
}
.test-game-wrap .game-card{
  padding:10px 12px;
}
.test-game-wrap .game-opponent{
  font-size:16px;
}
.top-actions #btnSyncNow,
.top-actions #btnCloudGames{
  white-space:nowrap;
}
@media(max-width:650px){
  .schedule-row summary{
    grid-template-columns:100px minmax(0,1fr) auto;
    padding:0 9px;
  }
  .schedule-date-short{font-size:10px}
  .schedule-matchup{font-size:13px}
  .schedule-status{display:none}
  .schedule-expand{
    align-items:stretch;
    flex-direction:column;
  }
  .schedule-continue-btn{width:100%}
}

/* SD-2.58 next game + inline season stats */
.next-game-strip{display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;gap:9px;align-items:center;min-height:38px;padding:7px 10px;margin-bottom:12px;border-radius:9px;border:1px solid #dbe3ea;background:#f8fafc}
.next-game-label{font-size:9px;font-weight:950;letter-spacing:.08em;color:#64748b}
.next-game-date{font-size:11px;font-weight:950}
.next-game-matchup{font-size:14px;font-weight:950}
.next-game-time{font-size:11px;font-weight:850;color:#475569}
.season-stats-inline{margin:0 0 12px;padding:12px;border:1px solid #dbe3ea;border-radius:10px;background:#fff;max-height:68vh;overflow:auto;-webkit-overflow-scrolling:touch}
.season-stats-inline[hidden]{display:none!important}
.season-stats-inline .season-summary-title{font-size:17px}
.season-stats-inline .season-summary-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.season-stats-error{padding:12px;border-radius:8px;background:#fff7ed;border:1px solid #fed7aa;font-weight:800;font-size:12px}
@media(max-width:650px){
  .next-game-strip{grid-template-columns:auto 1fr auto}
  .next-game-label{grid-column:1/-1;margin-bottom:-3px}
  .next-game-matchup{font-size:13px}
  .season-stats-inline .season-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* SD-2.63 cloud/local safety backup */
.local-backup-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  margin-bottom:10px;
  border:1px solid #bbf7d0;
  background:#f0fdf4;
  border-radius:10px;
}

/* SD-2.64 Player Stats quarter breakdown */
.player-quarter-tabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin:0 0 12px 0;
  position:sticky;
  top:0;
  z-index:2;
  padding:6px 0;
  background:inherit;
}
.player-quarter-tab{
  min-width:52px;
  padding:7px 11px;
}
.player-quarter-tab.active{
  font-weight:700;
}

/* SD-2.68 Player Stats penalty notes */
.player-penalty-notes{
  margin-top:16px;
  padding-top:10px;
  border-top:1px solid rgba(0,0,0,.14);
}
.player-penalty-notes h3{ margin:0 0 8px; }
.player-penalty-note{ padding:5px 0; font-size:.92rem; }

/* SD-2.69 recording-team screen color */
body.recording-us{
  background:#eef6ff !important;
}
body.recording-opp{
  background:#fff0ed !important;
}
#statsApp.recording-us{
  background:#eef6ff;
  box-shadow:0 0 0 100vmax #eef6ff;
  clip-path:inset(0 -100vmax);
}
#statsApp.recording-opp{
  background:#fff0ed;
  box-shadow:0 0 0 100vmax #fff0ed;
  clip-path:inset(0 -100vmax);
}
#statsApp.recording-us .record-card{
  border-color:rgba(45,105,180,.28);
}
#statsApp.recording-opp .record-card{
  border-color:rgba(185,75,55,.30);
}
.receiver-number-section{
  margin-top:10px;
}
.receiver-number-title{
  font-weight:700;
  margin:0 0 7px;
}
.receiver-number-grid{
  display:grid;
  grid-template-columns:repeat(10,minmax(38px,1fr));
  gap:5px;
  max-height:300px;
  overflow:auto;
  padding:2px;
}
.receiver-number-btn{
  min-width:0;
  min-height:40px;
  padding:6px 2px;
  font-weight:700;
  font-size:.95rem;
}
@media (max-width:700px){
  .receiver-number-grid{
    grid-template-columns:repeat(5,minmax(48px,1fr));
  }
}

/* SD-2.70 stronger iPad/fullscreen team cue */
body.recording-us::before,
body.recording-opp::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:99990;
  pointer-events:none;
  border:10px solid transparent;
  box-sizing:border-box;
}
body.recording-us::before{
  border-color:rgba(45,105,180,.55);
}
body.recording-opp::before{
  border-color:rgba(190,70,55,.58);
}

.recording-team-cue{
  position:sticky;
  top:0;
  z-index:99980;
  width:100%;
  text-align:center;
  font-weight:800;
  letter-spacing:.06em;
  font-size:.92rem;
  padding:7px 10px;
  box-sizing:border-box;
  border-bottom:1px solid rgba(0,0,0,.10);
}
.recording-team-cue.cue-us{
  background:rgba(210,230,250,.96);
  color:#173b63;
}
.recording-team-cue.cue-opp{
  background:rgba(253,220,214,.97);
  color:#6d261b;
}

#statsApp.recording-us .topbar{
  background:rgba(230,241,253,.96);
}
#statsApp.recording-opp .topbar{
  background:rgba(255,232,227,.97);
}
#statsApp.recording-us .record-card{
  box-shadow:0 0 0 3px rgba(45,105,180,.22);
}
#statsApp.recording-opp .record-card{
  box-shadow:0 0 0 3px rgba(190,70,55,.24);
}

#statsApp.recording-us #teamBanner{
  background:rgba(210,230,250,.95);
  border:1px solid rgba(45,105,180,.35);
}
#statsApp.recording-opp #teamBanner{
  background:rgba(253,220,214,.96);
  border:1px solid rgba(190,70,55,.38);
}

@media (display-mode: standalone), (min-width: 768px){
  body.recording-us::before,
  body.recording-opp::before{
    border-width:12px;
  }
  .recording-team-cue{
    font-size:1rem;
    padding:8px 12px;
  }
}

/* SD-2.71 iPad Player Stats quarter tabs visibility fix */
.player-quarter-tabs{
  display:grid !important;
  grid-template-columns:repeat(5,minmax(0,1fr)) !important;
  gap:6px !important;
  width:100% !important;
  margin:0 0 12px 0 !important;
  padding:6px !important;
  position:relative !important;
  top:auto !important;
  z-index:4 !important;
  box-sizing:border-box !important;
  background:rgba(255,255,255,.98) !important;
  border:1px solid rgba(0,0,0,.12) !important;
  border-radius:10px !important;
  overflow:visible !important;
}
.player-quarter-tab{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  min-width:0 !important;
  width:100% !important;
  min-height:42px !important;
  padding:8px 4px !important;
  margin:0 !important;
  font-size:14px !important;
  line-height:1.1 !important;
  white-space:nowrap !important;
  color:#111 !important;
  background:#f5f5f5 !important;
  border:1px solid rgba(0,0,0,.16) !important;
}
.player-quarter-tab.active{
  font-weight:800 !important;
  background:#dbeafe !important;
  border-color:#6b9bd1 !important;
  color:#102a43 !important;
}

/* Make sure the tabs stay above the stat tables on iPad Safari/PWA. */
.stat-sheet-scroll-content{
  overflow:visible;
}
@supports (-webkit-touch-callout: none){
  .player-quarter-tabs{
    position:relative !important;
    -webkit-transform:translateZ(0);
    transform:translateZ(0);
  }
}

/* Portrait/smaller iPad widths: still keep all five visible on one row. */
@media (max-width:900px){
  .player-quarter-tabs{
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    gap:4px !important;
    padding:5px !important;
  }
  .player-quarter-tab{
    min-height:40px !important;
    padding:7px 2px !important;
    font-size:13px !important;
  }
}

/* SD-2.74 tackle -> normal/TFL/sack flow */
.tackle-result-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:12px 0;
}
.tackle-result-btn{
  min-height:58px;
  font-weight:800;
  font-size:1rem;
}
@media(max-width:700px){
  .tackle-result-grid{
    grid-template-columns:1fr;
  }
  .tackle-result-btn{
    min-height:52px;
  }
}

/* SD-2.75 compact dashboard branding */
.home-brand-logo{display:none !important;}
.dashboard-head-compact{
  min-height:0 !important;
  margin:0 0 10px 0 !important;
  padding:0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:10px !important;
}
.dashboard-brand-compact{
  display:flex !important;
  align-items:center !important;
  gap:9px !important;
  min-width:0;
}
.dashboard-brand-compact .dashboard-eagle{
  width:42px !important;
  height:34px !important;
  padding:2px !important;
  border-radius:8px !important;
  flex:0 0 auto;
}
.dashboard-title-compact{
  font-size:18px;
  line-height:1.1;
  white-space:nowrap;
}
.dashboard-title-compact strong{
  font-size:20px;
  margin-left:4px;
}
.dashboard-head-compact .dashboard-actions{
  margin-left:auto;
  flex-wrap:nowrap;
}
@media(max-width:700px){
  .dashboard-head-compact{
    flex-direction:row !important;
    align-items:center !important;
  }
  .dashboard-title-compact{
    font-size:15px;
  }
  .dashboard-title-compact strong{
    font-size:17px;
  }
  .dashboard-brand-compact .dashboard-eagle{
    width:38px !important;
    height:31px !important;
  }
}

/* SD-2.76 restore dashboard branding image without wasting space */
.home-brand-logo-restored{
  display:flex !important;
  justify-content:center !important;
  align-items:center !important;
  width:100% !important;
  margin:0 0 8px 0 !important;
}
.home-brand-logo-restored img{
  display:block !important;
  width:min(100%, 420px) !important;
  height:auto !important;
  max-height:88px !important;
  object-fit:contain !important;
  object-position:center !important;
  border-radius:10px !important;
}
@media(max-width:700px){
  .home-brand-logo-restored{
    margin-bottom:6px !important;
  }
  .home-brand-logo-restored img{
    width:min(100%, 360px) !important;
    max-height:76px !important;
  }
}

/* SD-2.77 linked kickoff/punt outcome flow */
.st-outcome-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:9px;
  margin:12px 0;
}
.st-outcome-grid.two{grid-template-columns:repeat(2,minmax(0,1fr));}
.st-outcome-btn{
  min-height:54px;
  font-weight:800;
}
@media(max-width:700px){
  .st-outcome-grid{grid-template-columns:1fr;}
  .st-outcome-grid.two{grid-template-columns:1fr 1fr;}
}

/* SD-2.79 remove duplicate/broken dashboard branding row.
   Keep the real centered Southern Door Sideline Stats image above. */
.dashboard-brand-compact,
.dashboard-title-compact{
  display:none !important;
}
.dashboard-head-compact{
  justify-content:flex-end !important;
  min-height:0 !important;
  margin:0 0 8px 0 !important;
}
.dashboard-head-compact .dashboard-actions{
  margin-left:auto !important;
}

/* SD-2.80 app-style kick/punt return touchdown choice */
.st-return-result-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:12px 0;
}
.st-return-result-btn{
  min-height:58px;
  font-weight:800;
  font-size:1rem;
}
@media(max-width:700px){
  .st-return-result-btn{
    min-height:52px;
  }
}
