/* DAFC phone surface: black and white, big targets, nothing decorative. */
:root {
  --bg: #0e0f11;
  --panel: #18191c;
  --panel-2: #222327;
  --line: #2e3035;
  --text: #f4f4f2;
  --text-2: #b9bbbf;
  --muted: #85888e;
  --white: #f4f4f2;
  --live: #d63b2f;
  --amber: #e2a72e;
  --ok: #3fae6a;
  --r: 10px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 var(--font); }
body { min-height: 100vh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; }
.conn { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--muted); }
.conn.ok::before { background: var(--ok); }
.conn.bad { color: var(--amber); }
.conn.bad::before { background: var(--amber); }

main { padding: 14px 14px 24px; display: grid; gap: 14px; max-width: 560px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; }
.panel h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.note { color: var(--muted); font-size: 14px; margin: 0; }

.btn {
  appearance: none; border: 0; border-radius: 8px; background: var(--panel-2); color: var(--text);
  min-height: 48px; padding: 0 16px; font-weight: 600; font-size: 16px; cursor: pointer;
}
.btn:active { filter: brightness(1.25); }
.btn:disabled { opacity: .35; }
.btn.white { background: var(--white); color: #111; }
.btn.live { background: var(--live); color: #fff; }
.btn.quiet { background: transparent; color: var(--text-2); }
.btn.big { min-height: 60px; font-size: 18px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* score */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { background: var(--panel); border-radius: var(--r); padding: 14px 12px; display: grid; gap: 10px; justify-items: center; text-align: center; }
.team img { width: 56px; height: 56px; object-fit: contain; }
.team .name { font-weight: 700; font-size: 15px; min-height: 20px; }
.team .score { font-size: 64px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.team .adj { display: grid; grid-template-columns: 52px 1fr; gap: 8px; width: 100%; }

/* clock */
.clock { display: flex; align-items: baseline; gap: 12px; }
.clock .time { font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.clock .time.stopped { color: var(--amber); }
.clock .period { color: var(--text-2); font-size: 15px; }
.added { display: grid; grid-template-columns: 52px 1fr 52px 1fr; gap: 8px; align-items: center; }
.added .n { text-align: center; font-size: 26px; font-weight: 800; }

/* segmented switch */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--panel-2); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 6px; min-height: 42px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: var(--white); color: #111; }

/* player lists */
.list { display: grid; gap: 6px; }
.pl {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; text-align: left;
  min-height: 52px; padding: 6px 12px; border: 0; border-radius: 8px; background: var(--panel-2); width: 100%;
}
.pl .no { font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; color: var(--text-2); }
.pl .nm { font-weight: 600; }
.pl .ps { color: var(--muted); font-size: 13px; }
.pl.on { background: var(--white); color: #111; }
.pl.on .no, .pl.on .ps { color: #444; }
.pl.out { opacity: .45; }
.group { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }
.made { display: grid; gap: 4px; font-size: 15px; }
.made .arrow-on { color: var(--ok); font-weight: 700; }
.made .arrow-off { color: var(--live); font-weight: 700; }

/* sheet editor */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; }
.sheet {
  background: var(--panel); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; max-height: 88vh; overflow: auto;
}
.sheet h3 { margin: 0; font-size: 18px; }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
  font: inherit; font-size: 17px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; min-height: 48px; padding: 0 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--white); outline-offset: -1px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; background: none; min-height: 60px; font-weight: 600; font-size: 15px; color: var(--muted); }
.tabs button.on { color: var(--text); box-shadow: inset 0 3px 0 var(--white); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--white); color: #111; border-radius: 8px; padding: 12px 14px; font-weight: 600; text-align: center;
}
.toast.bad { background: var(--amber); }
.center { text-align: center; }

/* today's teams */
.team-pick { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
input[type=color] { padding: 4px; height: 48px; }
.note.warn { color: var(--amber); }

/* ---- app shell: fixed header and tab bar, only the content scrolls ---- */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  min-height: 0; padding: 0; display: grid; grid-template-rows: auto 1fr auto;
  height: 100dvh; position: fixed; inset: 0;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.top { position: static; }
main {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  width: 100%; max-width: none; margin: 0; padding: 14px max(14px, calc((100vw - 560px) / 2)) 24px;
  align-content: start;
}
.tabs { position: static; }
.tabs[hidden] { display: none; }
input, select, textarea { -webkit-user-select: text; user-select: text; font-size: 17px; }
button, .btn, .pl, .seg button, .tabs button { touch-action: manipulation; }
.toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
.btn { line-height: 1.2; padding-top: 8px; padding-bottom: 8px; }

/* add to home screen (iPhone) */
.a2hs-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 16px; line-height: 1.4; }
.a2hs-share { display: inline-flex; vertical-align: -3px; color: #3d8bfd; }
