body {
  margin: 0;
}

.menu-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
  color: white;
  background: url("../media/bk.jpg") no-repeat;
  background-size: cover;
  background-position: 50% 50%;
  animation: backgroundScroll 60s ease-in-out 1s infinite;
  position: relative;
  overflow: hidden;
}

.menu-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* dark overlay */
  z-index: 0;
}

.menu-page > * {
  position: relative;
  z-index: 1;
}

.app-title {
  font-size: 64px;
  font-weight: 800;
}

.app-subtitle {
  margin-top: -80px;
  font-size: 40px;
  font-weight: 700;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

.menu-btn {
  text-decoration: none;
  padding: 20px 40px;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 600;
  border: 2px solid white;
  color: white;
  transition: all 0.2s ease;
  background-color: rgba(0, 0, 0, 0.4);
}

.menu-btn:hover {
  background: white;
  color: black;
}

@keyframes backgroundScroll {
0% { background-position: 50% 50%; }
33% { background-position: 1% 50%; }
40% { background-position: 1% 50%; }
66% { background-position: 99% 50%; }
75% { background-position: 99% 50%; }
100% { background-position: 50% 50%; }}
/* added pauses to each edge of the image */

/* ================= SCOREBOARD STYLES ================= */

/* =======================================================
   ROOT VARIABLES
======================================================= */

:root {
  --teamAcolour: #ffff00;
  --teamBcolour: #00ffff;
  --bg: #000;
  --white: #ffffff;
}

/* =======================================================
   GLOBAL RESET
======================================================= */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =======================================================
   LAYOUT
======================================================= */

.app {
  padding-bottom: 40px;
}

.scoreboard {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
  position: relative;
}

/* =======================================================
   TEAM CARD
======================================================= */

.team {
  width: 45%;
  min-width: 320px;
  padding: 0px 30px 0;
  border-radius: 22px;
  position: relative;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  align-items: center;

  container-type: inline-size;
}

/* Team Variants */
.team-a {
  border: 6px solid var(--teamAcolour);
  color: var(--teamAcolour);
}

.team-b {
  border: 6px solid var(--teamBcolour);
  color: var(--teamBcolour);
}

/* =======================================================
   TEAM NAME
======================================================= */

.team-name {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  padding: 6px 14px;
  border-radius: 10px;

  overflow: hidden;

  z-index: 10;
}

.team-name .name-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 36px;
  font-weight: 700;

  transform-origin: center center;
  transition: transform 0.15s ease;
}

.team-name:hover {
  background: rgba(255,255,255,0.25);
}

.team-name-input {
  width: 100%;
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  background: transparent;
  border: 2px solid currentColor;
  border-radius: 10px;
  padding: 4px 8px;
  color: inherit;
  outline: none;
}

/* =======================================================
   META (SETS & GAMES)
======================================================= */

.meta {
  width: 100%;
}

.row {
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 36px;
}

.row span:first-child {
  font-weight: 300;
  color: var(--white);
}

.row span:last-child {
  font-weight: 700;
  font-size: 50px;
  color: inherit;
}

/* =======================================================
   SET & GAME DOTS
======================================================= */

#setsA,
#setsB,
#gamesA,
#gamesB {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  color: var(--white);
}

.set-dot,
.game-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--white);
  opacity: 0.1;
}

.set-dot.filled,
.game-dot.filled {
  opacity: 1;
  background: currentColor;
}

/* Hide empty set dots initially */
.set-dot {
  opacity: 0;
}

/* =======================================================
   POINTS DISPLAY
======================================================= */

.points-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.points {
  font-size: clamp(120px, 12vw, 200px);
  font-weight: 800;
  text-align: center;
  color: inherit;
}

/* Indicator Triangle */
.indicator {
  position: absolute;
  bottom:3%;
  right:3%;
  height: 24px;
  width: 24px;
  border-radius: 50%;
  border: 4px solid var(--white);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  background-color: transparent;
}

/* =======================================================
   CONTROLS
======================================================= */

.referee-controls {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Keep zones below team name editing */
.ref-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  border: none;
  background: transparent;
  pointer-events: auto;
  z-index: 1;
}

.zone-a {
  left: 0;
}

.zone-b {
  right: 0;
}

/* Subtle visual feedback on press */
.zone-a:active {
  background: rgba(255, 255, 0, 0.15);
}

.zone-b:active {
  background: rgba(0, 255, 255, 0.15);
}

/* ================= FLOATING BUTTONS ================= */

.floating-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 40px;
  pointer-events: auto;
  z-index: 20;
}

.floating-btn {
  padding: 10px 20px; /* slightly bigger */
  min-width: 80px;
  border-radius: 20px;
  border-style: solid;
  border-width: 2px;
  background: rgba(0,0,0,0.75);
  color: rgba(255, 255, 255, 1);
  font-weight: 600;
  font-size: 20px;
  backdrop-filter: blur(6px);
  opacity: 0.5;
}

.floating-btn.pressed {
  transform: scale(1.75);
}

.floating-btn.holding::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left;
}

@keyframes holdFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

#undoBtn {
    transition: transform var(--hold-duration, 0.5s) linear;
}

#resetBtn {
    transition: transform var(--hold-duration, 1s) linear;
}

#resetBtn,
#undoBtn {
  position: relative;
  overflow: hidden;
}

#undoBtn.holding::after {
  animation: holdFill 0.5s linear forwards;
	background: rgb(255, 255, 255); 
  
}

#resetBtn.holding::after {
  animation: holdFill 1s linear forwards;
  background: rgba(255, 0, 0, 0.25);
}

/* =======================================================
   SCORE ANIMATION
======================================================= */

.team.score-animate {
  animation: team-pop 0.6s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.team.score-animate::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: currentColor;
  opacity: 0.25;
  animation: burst 0.6s ease-out forwards;
}

@keyframes team-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes burst {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* =======================================================
   COOLDOWN
======================================================= */

.cooldown {
  display: flex;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  margin: 20px auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cooldown.active {
  opacity: 1;
}

/* =======================================================
   RESET MODAL
======================================================= */

.reset-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 9999;
}

.reset-modal.hidden {
  display: none;
}

.reset-box {
  background: #600000;
  padding: 24px;
  border-radius: 14px;
  text-align: center;
  min-width: 400px;
}

.reset-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.reset-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

/* =======================================================
   MOBILE OPTIMIZATION
======================================================= */

@media (max-width: 900px) {

  .scoreboard {
    flex-direction: column;
    align-items: center;
  }

  .team {
    width: 95%;
  }

  .row {
    font-size: 28px;
  }

  .row span:last-child {
    font-size: 40px;
  }

  .points {
    font-size: clamp(100px, 20vw, 160px);
  }

  .floating-controls {
    bottom: 14px;
  }

  .floating-btn {
    padding: 10px 16px;
  }
}

/* ================= UNDO ANIMATION ================= */

.points.undo-flash {
  animation: undo-flash 0.4s ease;
}

@keyframes undo-flash {
  0% { opacity: 1; }
  25% { opacity: 0.25; }
  50% { opacity: 0.75; }
  75% { opacity: 0.5; }
  100% { opacity: 1; }  
}