:root {
  --navy: #14213d;
  --navy-2: #1d2f57;
  --orange: #f28c28;
  --white: #ffffff;
  --muted: #a9b4cc;
  --good: #2e9e5b;
  --bad: #c0392b;
  --card: #1b2a4b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--navy); color: var(--white); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
h1 { font-size: 1.5rem; margin: 6px 0 14px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; color: var(--orange); }
button { font: inherit; color: var(--white); border: 0; border-radius: 12px; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(0.97); }
.btn { display: block; width: 100%; min-height: 56px; padding: 12px; background: var(--navy-2); font-weight: 700; }
.btn.primary { background: var(--orange); color: var(--navy); font-size: 1.15rem; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; border: 2px solid var(--muted); }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin: 10px 0; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
label { display: block; margin: 12px 0 4px; color: var(--muted); font-size: 0.9rem; }
input { width: 100%; min-height: 48px; border-radius: 10px; border: 2px solid var(--navy-2); background: var(--navy); color: var(--white); padding: 8px 12px; font-size: 1.05rem; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.summary .v { font-size: 1.5rem; font-weight: 800; }
.summary .k { font-size: 0.75rem; color: var(--muted); }
.game { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 56px; padding: 10px 14px; margin: 8px 0; background: var(--card); text-align: left; }
.game .l { font-size: 0.85rem; color: var(--muted); }
.banner { background: var(--orange); color: var(--navy); border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-weight: 700; }
.banner button { margin-top: 8px; background: var(--navy); }

/* Live screen */
.head { display: flex; justify-content: space-between; align-items: baseline; }
.head .opp { font-size: 1.2rem; font-weight: 800; }
.quarters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.quarters button { min-height: 48px; background: var(--navy-2); font-weight: 700; }
.quarters button.on { background: var(--orange); color: var(--navy); }
.score { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 6px; text-align: center; background: var(--card); border-radius: 14px; padding: 10px 6px; }
.score .v { font-size: 1.35rem; font-weight: 800; }
.score .big { font-size: 2.2rem; color: var(--orange); }
.score .k { font-size: 0.7rem; color: var(--muted); }
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.pad button { min-height: 64px; font-size: 1.15rem; font-weight: 800; background: var(--navy-2); position: relative; }
.pad .make { background: var(--good); }
.pad .miss { background: var(--bad); }
.pad .stat { background: var(--navy-2); border: 2px solid var(--muted); }
.pad .n { position: absolute; top: 4px; right: 8px; font-size: 0.75rem; font-weight: 600; opacity: 0.85; }
.flash { animation: flash 0.25s; }
@keyframes flash { from { filter: brightness(1.8); } to { filter: none; } }
.line { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.line b { color: var(--orange); }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 6px 4px; text-align: right; }
td:first-child, th:first-child { text-align: left; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal[hidden] { display: none; }
.modal .box { background: var(--card); border-radius: 16px; padding: 18px; width: 100%; max-width: 380px; }
.modal .box p { margin-top: 0; }
.modal .box .btn { margin-top: 8px; }

/* Live screen fit (issue #5): the whole live view fits the viewport, no scroll.
   Only the Live view renders .pad, so :has(.pad) scopes this to that screen. */
#app:has(.pad) { height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); display: flex; flex-direction: column; padding: 10px 12px 12px; overflow: hidden; }
#app:has(.pad) .head .opp { font-size: 1.1rem; }
#app:has(.pad) .quarters { margin: 8px 0; flex: none; }
#app:has(.pad) .quarters button { min-height: 38px; }
#app:has(.pad) .score { padding: 6px; flex: none; }
#app:has(.pad) .score .v { font-size: 1.2rem; }
#app:has(.pad) .score .big { font-size: 1.9rem; }
#app:has(.pad) .pad { flex: 1; min-height: 0; margin: 8px 0; grid-template-rows: repeat(6, 1fr); }
#app:has(.pad) .pad button { min-height: 0; font-size: 1.1rem; }
#app:has(.pad) .row { flex: none; }
#app:has(.pad) .btn { min-height: 44px; padding: 8px; }
#app:has(.pad) > .btn { flex: none; }
