*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #0d0d0d;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Join screen ─────────────────────────────────────────────────────────── */
#join-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 6px;
}

.setup-logo { font-size: 3rem; margin-bottom: 2px; }

.setup-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
}

.setup-sub {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 12px;
  text-align: center;
  line-height: 1.4;
}

.setup-card {
  width: 100%;
  max-width: 360px;
  background: #1a1a1a;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #222;
}

.setup-card label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid #2a2a2a;
  background: #111;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s;
}
.code-input:focus { border-color: #f4c842; }

.join-error { color: #f87171; font-size: 0.82rem; font-weight: 600; text-align: center; }
.join-error.hidden { display: none; }

.btn-start {
  width: 100%; padding: 14px; border-radius: 12px; border: none;
  background: #f4c842; color: #111; font-size: 1rem; font-weight: 800; cursor: pointer;
  transition: background 0.15s;
}
.btn-start:active { background: #e5b830; }

.solo-divider { text-align: center; color: #444; font-size: 0.78rem; }

.btn-solo {
  width: 100%; padding: 12px; border-radius: 12px; border: 1.5px solid #2a2a2a;
  background: transparent; color: #888; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-solo:active { background: #1e1e1e; color: #fff; }

/* ── Lobby ───────────────────────────────────────────────────────────────── */
#lobby-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
  padding: 24px;
}

.lobby-parent-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}

.lobby-game-badge {
  font-size: 1.1rem; font-weight: 800; color: #fff;
  background: #1a1a1a; padding: 10px 24px; border-radius: 50px; border: 1.5px solid #2a2a2a;
}

.lobby-status { display: flex; align-items: center; gap: 8px; color: #666; font-size: 0.9rem; }

.lobby-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #f4c842;
  animation: pulse 1.5s ease-in-out infinite; flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.lobby-your-name { font-size: 0.85rem; color: #555; }

/* ── Active scorer screen ────────────────────────────────────────────────── */
#scorer-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: #0d0d0d;
  overflow: hidden;
}

/* Header */
.sc-header {
  flex-shrink: 0;
  padding: 10px 16px 8px;
  background: #111;
  border-bottom: 1px solid #1e1e1e;
}

.sc-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.live-badge {
  display: flex; align-items: center; gap: 6px;
  background: #1e1e1e; border-radius: 50px; padding: 4px 10px 4px 8px;
  font-size: 0.75rem; font-weight: 800; color: #ccc; letter-spacing: 0.05em;
}

.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #ef4444;
  animation: pulse 1.2s ease-in-out infinite;
}

.sc-title {
  font-size: 0.78rem; color: #555; font-weight: 600; text-align: center;
  flex: 1; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sc-live-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sc-score-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.sc-score-block-right { align-items: flex-start; }

.sc-score-name {
  font-size: 0.6rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sc-score-val {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
}

.sc-score-us   { color: #f4c842; }
.sc-score-them { color: #f87171; }
.sc-score-dash { font-size: 0.9rem; color: #333; }

/* Clock */
.sc-clock-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px 8px;
  background: #0d0d0d;
  border-bottom: 1px solid #1a1a1a;
  gap: 2px;
}

.sc-clock {
  font-size: 3.6rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}

.sc-clock-info {
  font-size: 0.68rem; color: #555; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
}

.btn-clock {
  margin-top: 6px; padding: 7px 28px; border-radius: 50px;
  border: 1.5px solid #2a2a2a; background: #1a1a1a; color: #ccc;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: background 0.12s, color 0.12s; -webkit-tap-highlight-color: transparent;
}
.btn-clock:active { background: #2a2a2a; color: #fff; }

/* Team label bars */
.team-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px;
  background: #131313;
  border-top: 1px solid #1e1e1e;
  border-bottom: 1px solid #1e1e1e;
}

.us-bar  { border-top: 1px solid #1e1e1e; }
.opp-bar { margin-top: 0; }

.team-bar-name {
  font-size: 0.62rem;
  font-weight: 900;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.team-bar-score {
  font-size: 0.68rem;
  font-weight: 700;
  color: #555;
}

/* Score button rows */
.score-row {
  flex: 1.4;
  display: flex;
  flex-direction: row;
  min-height: 0;
}

.opp-row { flex: 1; }

/* Score buttons */
.score-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  gap: 1px;
  min-height: 0;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: filter 0.08s, transform 0.06s;
}

.score-btn:active { filter: brightness(1.2); transform: scale(0.975); }

/* Vertical divider between paired buttons */
.score-row .score-btn + .score-btn { border-left: 1px solid rgba(0,0,0,0.25); }

.goal-btn       { background: linear-gradient(160deg, #14532d, #16a34a); }
.behind-btn     { background: linear-gradient(160deg, #7c2d12, #ea580c); }
.opp-goal-btn   { background: linear-gradient(160deg, #4a0505, #b91c1c); }
.opp-behind-btn { background: linear-gradient(160deg, #1e293b, #475569); }

.score-btn-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
}

.score-btn-count {
  font-size: 4rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 3px 12px rgba(0,0,0,0.35);
}

.opp-row .score-btn-count { font-size: 2.6rem; }
.opp-row .score-btn-label { font-size: 0.7rem; }

.score-btn-pts {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}

/* Footer */
.sc-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #0d0d0d;
  border-top: 1px solid #1a1a1a;
}

.btn-undo-sc {
  padding: 9px 16px; border-radius: 10px; border: 1.5px solid #252525;
  background: transparent; color: #666; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0; -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, background 0.12s;
}
.btn-undo-sc:disabled { opacity: 0.3; pointer-events: none; }
.btn-undo-sc:not(:disabled):active { background: #1a1a1a; color: #fff; }

.btn-next-q {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: none;
  background: #f4c842; color: #111; font-size: 0.88rem; font-weight: 800;
  cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.btn-next-q:active { background: #e5b830; }

/* ── Quarter / full-time notification ───────────────────────────────────── */
.sc-qtr-notif {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85); z-index: 200; padding: 32px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: notif-in 0.2s ease; text-align: center;
}
.sc-qtr-notif.hidden { display: none; }

@keyframes notif-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.sc-notif-title  { font-size: 1.8rem; font-weight: 900; color: #fff; margin-bottom: 8px; }
.sc-notif-score  { font-size: 1.2rem; font-weight: 800; color: #f4c842; letter-spacing: 0.02em; }
.sc-notif-final  { font-size: 1.8rem; font-weight: 900; margin-bottom: 12px; }
.sc-notif-result { font-size: 1rem; font-weight: 800; margin-top: 8px; padding: 6px 20px; border-radius: 50px; }
.sc-notif-win    { background: rgba(22,163,74,0.3); color: #4ade80; }
.sc-notif-loss   { background: rgba(185,28,28,0.3); color: #f87171; }
.sc-notif-tap    { font-size: 0.78rem; color: #555; margin-top: 20px; }
