/* ==========================================================================
   A Winter Wonderland — SEO Hacker Christmas Party Games
   Palette: Midnight Blue, Royal Blue, Champagne Gold, Ice Silver, Pure White
   Performance-first: transform/opacity animations only, zero backdrop-filter blur
   ========================================================================== */

@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/Fredoka.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Baloo 2";
  src: url("assets/fonts/Baloo2.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mountains of Christmas";
  src: url("assets/fonts/MountainsOfChristmas.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy-deep: #0a1634;
  --navy-card: rgba(12, 26, 58, 0.90);
  --navy-card-hi: rgba(23, 46, 94, 0.94);
  --royal: #2e4e8f;
  --royal-bright: #4e78c8;
  --ice-blue: #9ec3f5;
  --silver: #dce6f5;
  --silver-soft: #b8cde8;
  --gold: #f5d173;
  --gold-deep: #c79227;
  --gold-pale: #fff6d6;
  --white: #ffffff;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--navy-deep);
  color: var(--white);
  font-family: "Fredoka", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button,
input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ==================== BACKGROUND STAGE & ORNAMENTS ==================== */

.bg-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.bg-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.10) 0%, rgba(15, 31, 68, 0.44) 56%, rgba(8, 18, 44, 0.80) 100%),
    linear-gradient(180deg, rgba(10, 22, 52, 0.54) 0%, rgba(15, 31, 68, 0.18) 45%, rgba(10, 22, 52, 0.72) 100%);
}

#snow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ornament {
  position: fixed;
  top: -10px;
  transform-origin: 50% 0%;
  will-change: transform;
  opacity: 0.92;
}

.orn-1 {
  left: clamp(16px, 3vw, 64px);
  animation: sway-a 5.6s ease-in-out infinite;
}

.orn-2 {
  left: clamp(82px, 8.5vw, 152px);
  animation: sway-b 4.8s ease-in-out infinite;
}

.orn-3 {
  right: clamp(16px, 3vw, 64px);
  animation: sway-b 5.9s ease-in-out infinite;
}

.orn-4 {
  right: clamp(82px, 8.5vw, 152px);
  animation: sway-a 4.5s ease-in-out infinite;
}

@keyframes sway-a {
  0%, 100% { transform: rotate(-4.5deg); }
  50% { transform: rotate(4.5deg); }
}

@keyframes sway-b {
  0%, 100% { transform: rotate(5deg); }
  50% { transform: rotate(-5deg); }
}

/* ==================== APP SHELL & VIEWS ==================== */

.app-shell {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: clamp(14px, 2vh, 26px) clamp(18px, 3vw, 48px);
  overflow-y: auto;
  overflow-x: hidden;
}

.view.active {
  display: flex;
  animation: view-pop-in 0.42s var(--spring) both;
}

@keyframes view-pop-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==================== SHARED FROST PANELS & BUTTONS ==================== */

.frost-panel {
  position: relative;
  background: linear-gradient(165deg, var(--navy-card) 0%, var(--navy-card-hi) 100%);
  border: 2px solid rgba(220, 230, 245, 0.24);
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--silver);
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(6, 14, 36, 0.52);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: clamp(14px, 1.25vw, 17px);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.22s var(--spring), background-color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.04);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.96);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  padding: 14px 32px;
  font-size: clamp(16px, 1.45vw, 20px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-xs {
  padding: 6px 13px;
  font-size: 13px;
}

.btn-gold {
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 55%, #dca534 100%);
  color: #102047;
  border-color: #fff6d6;
  box-shadow: 0 8px 20px rgba(6, 14, 36, 0.42);
}

.btn-gold:hover:not(:disabled) {
  background: linear-gradient(180deg, #fff0be 0%, #fad97e 55%, #e4b144 100%);
}

.btn-silver {
  background: linear-gradient(180deg, #f3f7ff 0%, var(--silver) 60%, #b7cde9 100%);
  color: #102047;
  border-color: var(--white);
  box-shadow: 0 8px 18px rgba(6, 14, 36, 0.35);
}

.btn-ghost {
  background: rgba(16, 33, 72, 0.78);
  color: var(--silver);
  border-color: rgba(220, 230, 245, 0.36);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(34, 62, 120, 0.90);
  color: var(--white);
  border-color: var(--gold);
}

.card-sparkle {
  position: absolute;
  pointer-events: none;
  animation: twinkle 3.2s ease-in-out infinite;
}

.card-sparkle.sp-tl {
  top: -20px;
  left: 26px;
}

.card-sparkle.sp-br {
  bottom: -20px;
  right: 26px;
  animation-delay: 1.4s;
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.92) rotate(0deg); opacity: 0.88; }
  50% { transform: scale(1.16) rotate(16deg); opacity: 1; }
}

.filigree-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.filigree-line {
  width: clamp(90px, 14vw, 220px);
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 209, 115, 0) 0%, var(--gold) 75%, var(--white) 100%);
}

.filigree-line.right {
  background: linear-gradient(90deg, var(--white) 0%, var(--gold) 25%, rgba(245, 209, 115, 0) 100%);
}

/* ==================== HOME VIEW & SNOW-VEILED CARDS ==================== */

.view-home {
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2vh, 22px);
}

.home-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(2px, 1vh, 10px);
}

.home-logo {
  width: clamp(250px, 29vw, 440px);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 24px rgba(6, 14, 36, 0.56));
  animation: logo-float 4.6s ease-in-out infinite;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.home-grid {
  width: 100%;
  max-width: 1120px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 30px);
  margin: auto 0;
}

.game-btn-card {
  position: relative;
  min-height: clamp(152px, 22vh, 215px);
  border-radius: 28px;
  border: 2px solid rgba(220, 230, 245, 0.30);
  border-top: 4px solid var(--gold);
  border-bottom: 4px solid var(--silver);
  background: linear-gradient(160deg, rgba(14, 31, 68, 0.92) 0%, rgba(28, 56, 112, 0.95) 100%);
  box-shadow: 0 18px 38px rgba(6, 14, 36, 0.52);
  padding: clamp(18px, 2.4vw, 30px);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  transition: transform 0.28s var(--spring), border-color 0.22s ease;
}

.game-btn-card:hover {
  transform: translateY(-6px) scale(1.028);
  border-color: var(--gold);
}

.game-btn-card:active {
  transform: translateY(0) scale(0.975);
}

.game-card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 0.35s ease, transform 0.52s var(--spring);
}

.game-btn-card.revealed .game-card-content {
  opacity: 1;
  transform: scale(1);
}

.game-slot-pill {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 999px;
  background: rgba(245, 209, 115, 0.16);
  border: 1.5px solid rgba(245, 209, 115, 0.55);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-card-title {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(24px, 2.5vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--white);
  text-shadow: 0 4px 14px rgba(6, 14, 36, 0.58);
}

.game-enter-cue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 5px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 100%);
  color: #102047;
  font-size: 14px;
  font-weight: 700;
}

/* Frosty Snow-Cloud Veil hiding the game title before 1st click */
.snow-veil {
  position: absolute;
  inset: -4px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #eaf3ff 58%, #cbe0f8 100%);
  transition: opacity 0.45s ease;
}

.snow-cloud {
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle at 40% 35%, #ffffff 0%, #f2f7ff 58%, rgba(214, 231, 251, 0.92) 100%);
  box-shadow: 0 10px 22px rgba(46, 78, 143, 0.14);
  transition: transform 0.62s var(--smooth), opacity 0.52s ease;
  will-change: transform, opacity;
}

.snow-cloud.c1 { width: 54%; height: 82%; top: -24%; left: -14%; }
.snow-cloud.c2 { width: 56%; height: 86%; top: -28%; right: -16%; }
.snow-cloud.c3 { width: 58%; height: 82%; bottom: -26%; left: -10%; }
.snow-cloud.c4 { width: 56%; height: 82%; bottom: -24%; right: -12%; }
.snow-cloud.c5 { width: 54%; height: 74%; top: 14%; left: 23%; background: radial-gradient(circle at 50% 38%, #ffffff 0%, #f4f9ff 72%, rgba(226, 238, 253, 0.92) 100%); }

.snow-veil-label {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.42s var(--smooth), opacity 0.34s ease;
}

.snow-veil-slot {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  color: #172e5e;
  letter-spacing: 0.02em;
}

.snow-veil-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(23, 46, 94, 0.10);
  border: 1.5px solid rgba(46, 78, 143, 0.28);
  color: #2e4e8f;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.snow-veil-flakes {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.65;
  transition: transform 0.58s var(--smooth), opacity 0.45s ease;
}

/* Dissipation State when clicked! */
.game-btn-card.dissipating .snow-veil,
.game-btn-card.revealed .snow-veil {
  opacity: 0;
}

.game-btn-card.dissipating .snow-cloud.c1,
.game-btn-card.revealed .snow-cloud.c1 { transform: translate(-48%, -42%) scale(1.25); opacity: 0; }
.game-btn-card.dissipating .snow-cloud.c2,
.game-btn-card.revealed .snow-cloud.c2 { transform: translate(48%, -42%) scale(1.25); opacity: 0; }
.game-btn-card.dissipating .snow-cloud.c3,
.game-btn-card.revealed .snow-cloud.c3 { transform: translate(-48%, 42%) scale(1.25); opacity: 0; }
.game-btn-card.dissipating .snow-cloud.c4,
.game-btn-card.revealed .snow-cloud.c4 { transform: translate(48%, 42%) scale(1.25); opacity: 0; }
.game-btn-card.dissipating .snow-cloud.c5,
.game-btn-card.revealed .snow-cloud.c5 { transform: scale(1.45); opacity: 0; }
.game-btn-card.dissipating .snow-veil-label,
.game-btn-card.revealed .snow-veil-label { transform: scale(1.22); opacity: 0; }
.game-btn-card.dissipating .snow-veil-flakes,
.game-btn-card.revealed .snow-veil-flakes { transform: scale(1.38) rotate(24deg); opacity: 0; }

/* Burst snowflakes spawned on snow clear */
.puff-flake {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(245, 209, 115, 0.35);
  pointer-events: none;
  z-index: 8;
  animation: puff-fly 0.65s var(--smooth) forwards;
}

@keyframes puff-fly {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0);
    opacity: 0;
  }
}

.home-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

/* ==================== SHARED GAME TOPBAR ==================== */

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto 12px;
  flex-shrink: 0;
}

.topbar-logo {
  width: clamp(140px, 14vw, 200px);
  height: auto;
  display: block;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-logo-sm {
  width: clamp(92px, 9vw, 134px);
  height: auto;
  display: block;
  flex-shrink: 0;
}

.topbar-title {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(20px, 2.2vw, 32px);
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 4px 14px rgba(6, 14, 36, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==================== GAME 1: CALAMANSI RELAY ==================== */

.game1-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.hero-halo-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hero-halo {
  width: clamp(340px, 48vh, 520px);
  height: clamp(340px, 48vh, 520px);
  animation: slow-spin 36s linear infinite;
}

@keyframes slow-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.game1-card {
  padding: clamp(40px, 7vh, 78px) clamp(44px, 7vw, 110px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  max-width: 92vw;
  animation: hero-bounce 0.68s var(--spring) both;
}

@keyframes hero-bounce {
  0% { opacity: 0; transform: translateY(34px) scale(0.78); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.game1-title {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(48px, 7vw, 108px);
  font-weight: 700;
  line-height: 1.08;
  color: var(--white);
  text-shadow: 0 6px 24px rgba(6, 14, 36, 0.68), 0 0 34px rgba(245, 209, 115, 0.22);
}

/* ==================== GAME 2: MIRROR STRAW-IN-A-BOTTLE RELAY ==================== */

.game2-stage {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.9fr) minmax(0, 1.15fr);
  gap: clamp(16px, 2.2vw, 30px);
  align-items: stretch;
  padding: clamp(6px, 1.5vh, 18px) 0;
}

.score-card {
  position: relative;
  border-radius: 32px;
  background: linear-gradient(165deg, rgba(14, 32, 72, 0.92) 0%, rgba(25, 52, 108, 0.95) 100%);
  border: 3px solid rgba(220, 230, 245, 0.34);
  box-shadow: 0 22px 44px rgba(6, 14, 36, 0.54);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vh, 20px);
  padding: clamp(20px, 3vh, 36px) 22px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--spring), border-color 0.2s ease;
}

.score-card.team-a {
  border-top: 6px solid var(--ice-blue);
  border-bottom: 6px solid var(--silver);
}

.score-card.team-b {
  border-top: 6px solid var(--gold);
  border-bottom: 6px solid var(--gold-pale);
}

.score-card:hover {
  transform: translateY(-5px) scale(1.015);
}

.score-card.team-a:hover { border-color: var(--ice-blue); }
.score-card.team-b:hover { border-color: var(--gold); }

.score-card.bump-up {
  animation: score-bump-up 0.28s var(--spring);
}

.score-card.bump-down {
  animation: score-bump-down 0.24s ease;
}

.score-card.leading {
  box-shadow: 0 0 0 4px var(--gold), 0 22px 44px rgba(6, 14, 36, 0.56);
}

@keyframes score-bump-up {
  0% { transform: scale(1); }
  45% { transform: scale(1.055); }
  100% { transform: scale(1); }
}

@keyframes score-bump-down {
  0% { transform: scale(1); }
  45% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.score-team-badge {
  padding: 8px 28px;
  border-radius: 999px;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.score-card.team-a .score-team-badge {
  background: rgba(158, 195, 245, 0.20);
  border: 2px solid var(--ice-blue);
  color: var(--white);
}

.score-card.team-b .score-team-badge {
  background: rgba(245, 209, 115, 0.20);
  border: 2px solid var(--gold);
  color: var(--gold-pale);
}

.score-subtag {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--silver-soft);
  margin-top: -6px;
}

.score-number {
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-size: clamp(96px, 14vw, 188px);
  font-weight: 800;
  line-height: 0.95;
  color: var(--white);
  text-shadow: 0 8px 26px rgba(6, 14, 36, 0.65);
}

.score-card.team-b .score-number {
  color: var(--gold);
}

.score-hint {
  font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 600;
  color: var(--silver-soft);
  opacity: 0.88;
}

.score-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.score-delta-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  font-family: "Baloo 2", sans-serif;
  font-size: 46px;
  font-weight: 800;
  color: var(--gold-pale);
  text-shadow: 0 4px 14px rgba(6, 14, 36, 0.72);
  pointer-events: none;
  animation: delta-rise 0.6s var(--smooth) forwards;
}

.score-delta-pop.minus {
  color: var(--silver);
  animation-name: delta-drop;
}

@keyframes delta-rise {
  0% { transform: translate(-50%, 0) scale(0.7); opacity: 1; }
  100% { transform: translate(-50%, -74px) scale(1.25); opacity: 0; }
}

@keyframes delta-drop {
  0% { transform: translate(-50%, 0) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, 54px) scale(0.95); opacity: 0; }
}

/* Timer Ring & Panel */
.g2-timer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vh, 20px);
  padding: clamp(18px, 2.6vh, 30px) 20px;
}

.timer-ring-wrap {
  position: relative;
  width: clamp(176px, 22vh, 232px);
  height: clamp(176px, 22vh, 232px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring-lg {
  width: clamp(200px, 28vh, 270px);
  height: clamp(200px, 28vh, 270px);
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(220, 230, 245, 0.16);
  stroke-width: 12;
}

.ring-progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 603.19;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.18s linear, stroke 0.25s ease;
}

.ring-progress.urgent {
  stroke: #ffffff;
}

.timer-readout {
  position: absolute;
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-size: clamp(32px, 3.2vw, 46px);
  font-weight: 800;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 16px rgba(6, 14, 36, 0.68);
}

.timer-readout-xl {
  font-size: clamp(64px, 7.6vw, 106px);
  color: var(--gold);
}

.timer-readout.urgent {
  color: var(--gold-pale);
  animation: pulse-urgent 0.55s ease-in-out infinite;
}

@keyframes pulse-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.g2-ot-label {
  padding: 6px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 100%);
  color: #102047;
  border: 2px solid var(--white);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: pulse-urgent 0.9s ease-in-out infinite;
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timer-subcontrols {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== GAME 3: SORT YOURSELVES ==================== */

.g3-scoreboard {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  flex-shrink: 0;
}

.g3-sb-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(12, 26, 58, 0.90) 0%, rgba(23, 46, 94, 0.94) 100%);
  border: 2px solid rgba(220, 230, 245, 0.25);
}

.g3-sb-team.team-a { border-left: 5px solid var(--ice-blue); }
.g3-sb-team.team-b { border-right: 5px solid var(--gold); }

.g3-sb-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.g3-sb-identity.right {
  align-items: flex-end;
}

.g3-sb-name {
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
}

.g3-sb-team.team-b .g3-sb-name {
  color: var(--gold);
}

.round-pips {
  display: flex;
  gap: 8px;
}

.round-pips .pip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(220, 230, 245, 0.5);
  background: rgba(10, 22, 52, 0.7);
  transition: transform 0.35s var(--spring), background-color 0.25s ease, border-color 0.25s ease;
}

.round-pips .pip.won {
  background: var(--gold);
  border-color: var(--white);
  transform: scale(1.18);
}

.g3-sb-rounds-txt {
  font-size: 13px;
  font-weight: 600;
  color: var(--silver-soft);
}

.g3-sb-total-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 16px;
  border-radius: 14px;
  background: rgba(10, 22, 52, 0.76);
  border: 1.5px solid rgba(220, 230, 245, 0.26);
  min-width: 96px;
}

.g3-sb-total-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--silver-soft);
}

.g3-sb-total-val {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(24px, 2.3vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--gold-pale);
}

.g3-sb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.g3-round-pill {
  padding: 7px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(28, 56, 114, 0.94) 0%, rgba(16, 34, 76, 0.96) 100%);
  border: 2px solid var(--gold);
  color: var(--gold-pale);
  font-size: clamp(14px, 1.3vw, 18px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.g3-round-pill.tiebreaker {
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 100%);
  color: #102047;
  border-color: var(--white);
  animation: pulse-urgent 0.9s ease-in-out infinite;
}

.game3-stage {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 0;
}

/* Docked Criterion Banner (shrinks smoothly from Big Title Card, stays very legible) */
.g3-docked-criterion {
  width: 100%;
  max-width: 1120px;
  padding: 12px 28px;
  text-align: center;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: dock-shrink 0.45s var(--spring) both;
}

@keyframes dock-shrink {
  0% { opacity: 0; transform: translateY(28px) scale(1.16); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.g3-docked-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
}

.g3-docked-title {
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 700;
  color: var(--white);
  line-height: 1.15;
}

.g3-docked-detail {
  font-size: clamp(14px, 1.35vw, 19px);
  font-weight: 600;
  color: var(--gold-pale);
  line-height: 1.28;
}

.g3-phase {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.g3-phase.active {
  display: flex;
  animation: view-pop-in 0.36s var(--spring) both;
}

/* Phase 1: Roulette Wheel */
.g3-wheel-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 4vw, 54px);
  flex-wrap: wrap;
  width: 100%;
}

.wheel-container {
  position: relative;
  width: clamp(300px, 45vh, 450px);
  height: clamp(300px, 45vh, 450px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#g3-wheel-canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 18px 34px rgba(6, 14, 36, 0.62));
}

.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  transform-origin: 50% 10px;
  transition: transform 0.08s ease;
}

.wheel-pointer.tick {
  transform: translateX(-50%) rotate(-18deg);
}

.wheel-hub {
  position: absolute;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2e4e8f 0%, #102047 100%);
  border: 4px solid var(--gold);
  box-shadow: 0 6px 18px rgba(6, 14, 36, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.g3-wheel-controls {
  padding: clamp(22px, 3vh, 34px) clamp(24px, 3vw, 38px);
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.g3-pool-badge {
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(158, 195, 245, 0.16);
  border: 1.5px solid rgba(158, 195, 245, 0.45);
  color: var(--silver);
  font-size: 14px;
  font-weight: 700;
}

.g3-shuffle-preview {
  min-height: 82px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(10, 22, 52, 0.72);
  border: 1.5px solid rgba(245, 209, 115, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(17px, 1.7vw, 23px);
  font-weight: 700;
  color: var(--gold-pale);
  line-height: 1.25;
}

.g3-wheel-btns {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

/* Phase 2: Big Criterion Title Card Reveal */
.g3-big-reveal {
  padding: clamp(32px, 5vh, 56px) clamp(32px, 5vw, 76px);
  max-width: 1060px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  animation: hero-bounce 0.56s var(--spring) both;
}

.g3-reveal-kicker {
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.g3-reveal-title {
  font-size: clamp(38px, 5vw, 72px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--white);
  text-shadow: 0 6px 22px rgba(6, 14, 36, 0.65);
}

.g3-reveal-detail {
  font-size: clamp(20px, 2.2vw, 32px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--gold);
  max-width: 880px;
}

.g3-reveal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Phase 3: 10-Second Countdown */
.g3-timer-card {
  padding: clamp(22px, 3.4vh, 36px) clamp(32px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: min(560px, 92vw);
}

.g3-timer-label {
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-pale);
}

.g3-timer-label.freeze {
  color: var(--white);
  transform: scale(1.18);
  transition: transform 0.25s var(--spring);
}

/* Phase 4: Round Scoring */
.g3-score-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.9fr) minmax(0, 1.15fr);
  gap: clamp(16px, 2.2vw, 28px);
  align-items: stretch;
}

.score-card-g3 {
  min-height: clamp(250px, 38vh, 380px);
}

.score-card-g3 .score-number {
  font-size: clamp(82px, 11vw, 152px);
}

.g3-endround-box {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.g3-endround-info {
  font-size: 16px;
  font-weight: 600;
  color: var(--silver);
  line-height: 1.38;
}

.g3-tie-resolve {
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: rgba(245, 209, 115, 0.14);
  border: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g3-tie-resolve-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-pale);
}

.g3-tie-resolve-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==================== GAME 4: JAPANESE WALK ==================== */

.game4-stage {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.5vh, 26px);
}

.g4-timer-panel {
  padding: clamp(20px, 3vh, 32px) clamp(32px, 6vw, 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: min(520px, 92vw);
}

.g4-timer-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.g4-timer-display {
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-size: clamp(64px, 8.5vw, 118px);
  font-weight: 800;
  line-height: 0.98;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 22px rgba(6, 14, 36, 0.65);
}

.g4-winner-prompt {
  font-size: clamp(17px, 1.7vw, 24px);
  font-weight: 700;
  color: var(--gold-pale);
  text-shadow: 0 3px 12px rgba(6, 14, 36, 0.7);
}

.g4-teams-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.8vw, 34px);
}

.g4-team-card {
  position: relative;
  padding: clamp(24px, 3.6vh, 42px) 24px;
  border-radius: 30px;
  background: linear-gradient(165deg, rgba(14, 32, 72, 0.92) 0%, rgba(25, 52, 108, 0.95) 100%);
  border: 3px solid rgba(220, 230, 245, 0.34);
  box-shadow: 0 18px 40px rgba(6, 14, 36, 0.52);
  color: var(--white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  transition: transform 0.25s var(--spring), border-color 0.2s ease;
}

.g4-team-card.team-a { border-top: 6px solid var(--ice-blue); }
.g4-team-card.team-b { border-top: 6px solid var(--gold); }

.g4-team-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--gold);
}

.g4-team-card:active {
  transform: scale(0.97);
}

.g4-team-label {
  font-size: clamp(32px, 3.8vw, 54px);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.g4-team-card.team-b .g4-team-label {
  color: var(--gold);
}

.g4-team-sub {
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 500;
  color: var(--silver-soft);
  line-height: 1.45;
  max-width: 440px;
}

.g4-pick-cta {
  margin-top: 4px;
  padding: 8px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 100%);
  color: #102047;
  font-size: 15px;
  font-weight: 700;
}

/* ==================== BONUS: EXCHANGE GIFT CARDS ==================== */

.exchange-stage {
  flex: 1;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.ex-deck-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ex-ghost-card {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(20, 42, 92, 0.84) 0%, rgba(12, 26, 58, 0.90) 100%);
  border: 2px solid rgba(245, 209, 115, 0.34);
  pointer-events: none;
  z-index: 1;
  transition: transform 0.25s var(--smooth), opacity 0.25s ease;
}

.ex-ghost-card.left {
  transform: translate(-10px, 8px) rotate(-1.8deg);
  opacity: 0.55;
}

.ex-ghost-card.right {
  transform: translate(10px, 8px) rotate(1.8deg);
  opacity: 0.55;
}

.ex-card-display {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: clamp(270px, 44vh, 390px);
  padding: clamp(32px, 5vh, 56px) clamp(32px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  will-change: transform, opacity;
}

/* Short snappy card-shuffle animation (GPU transform-only, super light) */
.ex-deck-wrap.shuffling .ex-ghost-card.left {
  animation: riffle-left 0.22s ease-in-out infinite alternate;
  opacity: 0.9;
}

.ex-deck-wrap.shuffling .ex-ghost-card.right {
  animation: riffle-right 0.22s ease-in-out infinite alternate;
  opacity: 0.9;
}

.ex-deck-wrap.shuffling .ex-card-display {
  animation: riffle-center 0.18s ease-in-out infinite alternate;
}

@keyframes riffle-left {
  0% { transform: translate(-12px, 6px) rotate(-2deg); }
  100% { transform: translate(-44px, -8px) rotate(-5.5deg) scale(0.97); }
}

@keyframes riffle-right {
  0% { transform: translate(12px, 6px) rotate(2deg); }
  100% { transform: translate(44px, -8px) rotate(5.5deg) scale(0.97); }
}

@keyframes riffle-center {
  0% { transform: translateY(0) scale(0.985) rotate(-0.8deg); }
  100% { transform: translateY(-6px) scale(1.01) rotate(0.8deg); }
}

.ex-card-display.flip-pop {
  animation: card-flip-pop 0.46s var(--spring);
}

@keyframes card-flip-pop {
  0% { transform: scale(0.86) translateY(10px); opacity: 0.55; }
  65% { transform: scale(1.035) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.ex-card-number {
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ex-card-text {
  font-size: clamp(26px, 3.2vw, 46px);
  font-weight: 700;
  line-height: 1.24;
  color: var(--white);
  text-shadow: 0 4px 16px rgba(6, 14, 36, 0.65);
}

.ex-history-list {
  list-style-position: inside;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
}

.ex-history-list li {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(10, 22, 52, 0.72);
  border: 1.5px solid rgba(220, 230, 245, 0.20);
  color: var(--silver);
  font-size: 16px;
  line-height: 1.35;
}

/* ==================== MODALS (TEAMS & CRITERIA EDITOR) ==================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 11, 28, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.2s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  padding: clamp(20px, 3vh, 30px) clamp(20px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  animation: modal-bounce 0.34s var(--spring) both;
}

@keyframes modal-bounce {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.modal-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

.modal-title {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 700;
  color: var(--white);
}

.btn-icon-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(220, 230, 245, 0.35);
  background: rgba(10, 22, 52, 0.76);
  color: var(--white);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--spring), border-color 0.2s ease;
}

.btn-icon-close:hover {
  transform: scale(1.1);
  border-color: var(--gold);
  color: var(--gold);
}

.facilitators-bar {
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(245, 209, 115, 0.12);
  border: 1.5px solid rgba(245, 209, 115, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fac-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.fac-names {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.facilitators-edit {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.edit-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}

.teams-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.team-roster-col {
  border-radius: 20px;
  padding: 16px;
  background: rgba(10, 22, 52, 0.72);
  border: 2px solid rgba(220, 230, 245, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-roster-col.team-a { border-top: 4px solid var(--ice-blue); }
.team-roster-col.team-b { border-top: 4px solid var(--gold); }

.roster-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.roster-col-head h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.team-roster-col.team-b .roster-col-head h3 {
  color: var(--gold);
}

.roster-count {
  padding: 2px 11px;
  border-radius: 999px;
  background: rgba(220, 230, 245, 0.14);
  color: var(--silver);
  font-size: 13px;
  font-weight: 700;
}

.roster-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(25, 50, 102, 0.72);
  border: 1.5px solid rgba(220, 230, 245, 0.18);
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 600;
  color: var(--white);
}

.roster-item.pop {
  animation: item-pop 0.34s var(--spring) both;
}

@keyframes item-pop {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

.roster-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.roster-mini-btn {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1.5px solid rgba(220, 230, 245, 0.35);
  background: rgba(10, 22, 52, 0.8);
  color: var(--gold-pale);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.roster-mini-btn:hover {
  border-color: var(--gold);
  background: rgba(46, 78, 143, 0.9);
}

.roster-add-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.frost-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(220, 230, 245, 0.30);
  background: rgba(10, 22, 52, 0.86);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  user-select: text;
}

.frost-input:focus {
  border-color: var(--gold);
}

.frost-input-sm {
  padding: 7px 11px;
  font-size: 14px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1.5px solid rgba(220, 230, 245, 0.16);
}

.modal-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Criteria Editor Modal */
.criteria-add-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 10px;
}

.criteria-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 46vh;
  padding-right: 6px;
}

.crit-edit-row {
  display: grid;
  grid-template-columns: auto 1fr 1.3fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 22, 52, 0.72);
  border: 1.5px solid rgba(220, 230, 245, 0.20);
}

.crit-edit-row.used {
  opacity: 0.62;
  border-style: dashed;
}

.crit-used-toggle {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(220, 230, 245, 0.35);
  background: rgba(28, 56, 112, 0.85);
  color: var(--gold-pale);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-width: 68px;
}

.crit-edit-row.used .crit-used-toggle {
  background: rgba(10, 22, 52, 0.9);
  color: var(--silver-soft);
}

/* ==================== TIE BREAKER & WINNER OVERLAYS ==================== */

.overlay-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 14, 36, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.22s ease both;
}

.tiebreaker-burst {
  padding: clamp(36px, 6vh, 64px) clamp(36px, 6vw, 84px);
  border-radius: 36px;
  background: linear-gradient(150deg, #172e5e 0%, #0c1a3a 55%, #234385 100%);
  border: 4px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(245, 209, 115, 0.22), 0 28px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  animation: tiebreaker-slam 0.6s var(--spring) both;
}

@keyframes tiebreaker-slam {
  0% { transform: scale(0.45) rotate(-4deg); opacity: 0; }
  65% { transform: scale(1.06) rotate(1.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.tiebreaker-score-tag {
  padding: 7px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7a1 0%, var(--gold) 100%);
  color: #102047;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.tiebreaker-title {
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-size: clamp(42px, 6.2vw, 88px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--white);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 32px rgba(245, 209, 115, 0.45);
  animation: pulse-urgent 0.9s ease-in-out infinite;
}

.tiebreaker-sub {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 600;
  color: var(--silver);
  margin-bottom: 8px;
}

.winner-card {
  padding: clamp(32px, 5vh, 56px) clamp(32px, 5vw, 76px);
  max-width: 780px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  border: 4px solid var(--gold);
  animation: tiebreaker-slam 0.56s var(--spring) both;
}

.winner-star {
  animation: twinkle 2.4s ease-in-out infinite;
}

.winner-kicker {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--silver);
  text-transform: uppercase;
}

.winner-heading {
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-size: clamp(44px, 6vw, 84px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--gold);
  text-shadow: 0 6px 24px rgba(6, 14, 36, 0.65);
}

.winner-stats {
  font-size: clamp(18px, 1.9vw, 25px);
  font-weight: 600;
  color: var(--white);
  margin-bottom: 10px;
}

.winner-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== RESPONSIVE FOR SMALLER LAPTOP SCREENS ==================== */

@media (max-width: 920px) {
  .orn-2, .orn-4 { display: none; }
  .home-grid,
  .game2-stage,
  .g3-score-layout,
  .g4-teams-row,
  .teams-columns,
  .criteria-add-form {
    grid-template-columns: 1fr;
  }
  .g3-scoreboard {
    grid-template-columns: 1fr;
  }
  .crit-edit-row {
    grid-template-columns: auto 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
