/* ── Global: prevent pull-to-refresh & overscroll on mobile ────── */
html, body {
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

/* ── Score Digits (Seven-Segment SVG) ──────────────────────────── */
.score-digit {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  padding: 4px 8px;
}
.score-digit svg {
  width: 100%;
  height: 100%;
}
#panelA .score-digit svg {
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.4));
}
#panelB .score-digit svg {
  filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.4));
}

/* ── Score Buttons ──────────────────────────────────────────────── */
.score-btn {
  border-radius: 16px;
  font-weight: 800;
  color: white;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Phone portrait: big enough to tap */
.score-btn-add {
  width: 80px;
  height: 56px;
  font-size: 1.5rem;
}
.score-btn-sub {
  width: 64px;
  height: 56px;
  font-size: 1.25rem;
}

.score-btn:active {
  transform: scale(0.90);
}

/* ── Team Panel ────────────────────────────────────────────────── */
.team-panel {
  transition: box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.team-panel.serving {
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.3),
              inset 0 0 30px rgba(250, 204, 21, 0.06);
}
.team-panel.add-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

/* ── Score flash animation ─────────────────────────────────────── */
@keyframes scoreFlash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.score-flash {
  animation: scoreFlash 0.25s ease-out;
}

/* ── Match History Table ───────────────────────────────────────── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.1rem;
}
.history-table th,
.history-table td {
  padding: 10px 14px;
  text-align: center;
}
.history-table th {
  color: #9ca3af;
  font-weight: 700;
  border-bottom: 2px solid #374151;
}
.history-table td {
  border-bottom: 1px solid #1f2937;
}
.history-table .winner {
  color: #facc15;
  font-weight: 800;
}

/* ================================================================
   RWD Breakpoints
   ================================================================ */

/* ── Tablets (>=640px) ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .score-btn-add {
    width: 110px;
    height: 70px;
    font-size: 2rem;
  }
  .score-btn-sub {
    width: 90px;
    height: 70px;
    font-size: 1.5rem;
  }
  .score-btn {
    border-radius: 20px;
  }
  .history-table {
    font-size: 1.25rem;
  }
}

/* ── Large tablets / landscape (>=1024px) ──────────────────────── */
@media (min-width: 1024px) {
  .score-btn-add {
    width: 140px;
    height: 80px;
    font-size: 2.25rem;
  }
  .score-btn-sub {
    width: 110px;
    height: 80px;
    font-size: 1.75rem;
  }
}

/* ── Fullscreen Mode ────────────────────────────────────────────── */
body.fullscreen-mode header,
body.fullscreen-mode #matchHistory {
  display: none !important;
}
body.fullscreen-mode #statusBanner {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: calc(100% - 2rem);
  max-width: 600px;
}
body.fullscreen-mode #nameA,
body.fullscreen-mode #nameB {
  font-size: 1.2rem;
}
body.fullscreen-mode #serveSideA,
body.fullscreen-mode #serveSideB {
  font-size: 0.9rem;
}
body.fullscreen-mode #mainArea {
  padding: 2px;
  gap: 2px;
}
body.fullscreen-mode .team-panel {
  gap: 2px !important;
  padding: 4px !important;
  border-radius: 12px !important;
}

/* ── Very small phones (<380px width) ──────────────────────────── */
@media (max-width: 380px) {
  .score-btn-add {
    width: 68px;
    height: 50px;
    font-size: 1.3rem;
  }
  .score-btn-sub {
    width: 56px;
    height: 50px;
    font-size: 1.1rem;
  }
}
