/**
 * Photo Hunt - Core Game Stylesheet
 * Pudgy Huddle Theme: Light "toon/toy/sticker" aesthetic
 * Colors: blizzard white bg, oxford blue text, crayola blue CTAs
 */

/* =====================================================================
 * CSS CUSTOM PROPERTIES — PUDGY HUDDLE DESIGN TOKENS
 * ===================================================================== */
:root {
  --pp-crayola-blue:  #477dfd;   /* Primary CTA / button blue            */
  --pp-oxford-blue:   #00142d;   /* Deep navy — borders, text             */
  --pp-pengu-blue:    #81abff;   /* Periwinkle accent                     */
  --pp-azure:         #e7f5f9;   /* Icy sky tint — card/mode bg           */
  --pp-blizzard:      #f3fbff;   /* Icy white — page background           */
  --pp-creamy:        #f9f5e9;   /* Warm cream                            */
  --pp-jasmine:       #f9de90;   /* Warm yellow — hint / accent           */
  --pp-mint:          #a7fb97;   /* Mint green — success / bonus          */
  --pp-blush:         #ff8080;   /* Soft red — penalty / warning          */
  --pp-gold:          #fbbf24;   /* Gold — rank #1                        */

  /* Toon box-shadow system */
  --toon-shadow:   inset 0 0 0 2px var(--pp-oxford-blue),
                   inset -7px -7px 0 rgba(0,0,0,0.12),
                   2.6px 3px 0 rgba(9,50,78,0.22);
  --toon-shadow-hover: inset 0 0 0 2px var(--pp-oxford-blue);

  --toon-card-shadow: 0 4px 0 rgba(9,50,78,0.18), 0 8px 24px rgba(0,20,45,0.10);
}

/* =====================================================================
 * CSS RESET & BASE
 * ===================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', 'Arial', sans-serif;
  color: var(--pp-oxford-blue);
  background-color: var(--pp-blizzard);
  user-select: none;
  -webkit-user-select: none;
}

/* =====================================================================
 * APP CONTAINER & SCENE MANAGER
 * ===================================================================== */
#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Confetti Celebration Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 95;
  display: none;
}

#confetti-canvas.active {
  display: block;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 5;
}

.scene.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* =====================================================================
 * SHARED BUTTON BASE — PUDGY TOON PILL BUTTON
 * ===================================================================== */
.btn-primary,
.btn-secondary,
.btn-hint,
.btn-next-stage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  outline: none;
  position: relative;
  text-transform: uppercase;
}

/* PRIMARY — Crayola Blue */
.btn-primary {
  background: var(--pp-crayola-blue);
  color: #fff;
  padding: 0.85rem 2.25rem;
  font-size: 1.05rem;
  box-shadow: var(--toon-shadow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--toon-shadow-hover);
  transform: translateY(2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(3px);
}

/* SECONDARY — White / Oxford outline */
.btn-secondary {
  background: #fff;
  color: var(--pp-oxford-blue);
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  box-shadow: var(--toon-shadow);
}

.btn-secondary:hover:not(:disabled) {
  box-shadow: var(--toon-shadow-hover);
  transform: translateY(2px);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(3px);
}

/* =====================================================================
 * 1. LANDING SCENE
 * ===================================================================== */
#scene-landing {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: transparent;
}

.landing-card {
  max-width: 920px;
  width: 100%;
  background: #fff;
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 32px;
  padding: 2.25rem 2rem;
  box-shadow: var(--toon-card-shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInScale 0.4s ease-out;
}

.landing-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.landing-logo {
  max-height: 165px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(71,125,253,0.25));
}

.landing-title {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--pp-oxford-blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.landing-subtitle {
  color: #5a7395;
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  max-width: 580px;
}

/* Mode Selection Cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-top: 0.25rem;
}

.mode-card {
  background: var(--pp-azure);
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 24px;
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 3px 4px 0 rgba(0,20,45,0.14);
}

.mode-card:hover, .mode-card:focus-visible {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 3px 8px 0 rgba(0,20,45,0.18);
}

.mode-card.selected {
  background: var(--pp-pengu-blue);
  border-color: var(--pp-crayola-blue);
  box-shadow: 3px 6px 0 rgba(71,125,253,0.3);
}

.mode-badge {
  font-family: 'Londrina Solid', 'Arial Black', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  border: 2px solid var(--pp-oxford-blue);
}

.badge-regular {
  background: var(--pp-mint);
  color: var(--pp-oxford-blue);
}

.badge-ranking {
  background: var(--pp-jasmine);
  color: var(--pp-oxford-blue);
}

.badge-competition {
  background: var(--pp-blush);
  color: #fff;
}

.mode-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.mode-title {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pp-oxford-blue);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.mode-desc {
  font-size: 0.875rem;
  color: #3d5a7a;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.mode-rules {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--pp-oxford-blue);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: rgba(255,255,255,0.55);
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0,20,45,0.12);
  width: 100%;
}

/* Landing Action Buttons */
.landing-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

/* =====================================================================
 * 2. GAME SCENE (PLAYING SCREEN)
 * ===================================================================== */
#scene-game {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: transparent;
}

/* TOP STATUS BAR */
.status-bar {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-bottom: 2px solid var(--pp-oxford-blue);
  padding: 0.4rem 1rem 0.5rem;
  z-index: 30;
  flex-shrink: 0;
  gap: 0.35rem;
  box-shadow: 0 2px 0 rgba(0,20,45,0.08);
}

.status-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Stage Pill */
.stage-pill {
  background: var(--pp-crayola-blue);
  color: #fff;
  padding: 0.22rem 0.85rem;
  border-radius: 999px;
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 2px solid var(--pp-oxford-blue);
  box-shadow: 1.5px 2px 0 rgba(0,20,45,0.2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Differences Tracker */
.diff-tracker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pp-oxford-blue);
  background: var(--pp-azure);
  padding: 0.22rem 0.75rem;
  border-radius: 999px;
  border: 2px solid var(--pp-oxford-blue);
  box-shadow: 1.5px 2px 0 rgba(0,20,45,0.14);
}

.diff-count-highlight {
  color: var(--pp-crayola-blue);
  font-weight: 800;
  font-size: 1rem;
}

/* Timer Section */
.timer-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.timer-digits {
  font-family: 'Fredoka', ui-monospace, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pp-crayola-blue);
  min-width: 45px;
  text-align: right;
  transition: color 0.3s ease;
}

.timer-warning {
  color: #d94040 !important;
  animation: timer-pulse-warning 0.8s infinite alternate ease-in-out;
}

/* Floating penalty / bonus indicators */
.floating-indicator {
  position: absolute;
  top: -15px;
  right: 0;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  pointer-events: none;
  animation: floatUpFade 1.2s forwards ease-out;
  z-index: 50;
}

.floating-penalty {
  color: #d94040;
}

.floating-bonus {
  color: #2a9a30;
}

/* Hint Button */
.btn-hint {
  background: var(--pp-jasmine);
  border: 2px solid var(--pp-oxford-blue);
  color: var(--pp-oxford-blue);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 1.5px 2px 0 rgba(0,20,45,0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  text-transform: uppercase;
}

.btn-hint:hover:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0.5px 1px 0 rgba(0,20,45,0.18);
}

.btn-hint:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-hint:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #e0e0e0;
  border-color: #aaa;
  color: #888;
  box-shadow: none;
}

.hint-badge {
  background: var(--pp-oxford-blue);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.42rem;
}

/* Shrinking Timer Progress Bar */
.timer-bar-wrapper {
  width: 100%;
  height: 8px;
  background: var(--pp-azure);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1.5px solid rgba(0,20,45,0.12);
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--pp-crayola-blue);
  border-radius: 999px;
  transition: width 0.25s linear, background-color 0.4s ease;
}

.timer-bar-fill.warning-blink {
  animation: barBlinkRed 0.6s infinite alternate ease-in-out;
}

/* =====================================================================
 * CENTER GAME PLAY AREA (DUAL IMAGES)
 * ===================================================================== */
.game-play-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  gap: 1rem;
  width: 100%;
  height: calc(100% - 60px);
  position: relative;
  overflow: hidden;
  background: transparent;
}

.photo-panels-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  height: 100%;
  max-width: 1600px;
}

.photo-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 50%;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.photo-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid var(--pp-oxford-blue);
  box-shadow: 3px 4px 0 rgba(0,20,45,0.18), 0 8px 20px rgba(0,20,45,0.08);
  background: var(--pp-azure);
  user-select: none;
  -webkit-user-select: none;
}

.photo-frame:hover {
  border-color: var(--pp-crayola-blue);
  box-shadow: 3px 4px 0 rgba(71,125,253,0.3), 0 8px 20px rgba(71,125,253,0.1);
}

.photo-img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
}

/* Click Overlay Layer */
.marker-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

/* Correct Difference Marker (Green Circle) */
.marker-circle-green {
  position: absolute;
  border: 3.5px solid #22c55e;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 0 10px rgba(34,197,94,0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: circleAppear 0.2s ease-out forwards;
}

/* Hint Revealed Difference Marker (Yellow Circle) */
.marker-circle-yellow {
  position: absolute;
  border: 3.5px solid #d97706;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.28);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 0 10px rgba(217,119,6,0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: circleAppear 0.2s ease-out forwards;
}

/* Wrong Click Marker (Red X) */
.marker-wrong-x {
  position: absolute;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #dc2626;
  animation: wrongXAppear 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), wrongShake 0.4s ease-in-out;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.marker-wrong-x.fade-out {
  opacity: 0;
}

/* =====================================================================
 * 3. STAGE COMPLETED MODAL / OVERLAY
 * ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 45, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #fff;
  border: 2.5px solid var(--pp-oxford-blue);
  border-radius: 32px;
  width: 100%;
  max-width: 760px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 5px 7px 0 rgba(0,20,45,0.18), 0 20px 50px rgba(0,20,45,0.14);
  animation: modalSlideUp 0.35s ease-out;
}

.modal-header {
  padding: 1rem 1.5rem;
  background: var(--pp-azure);
  border-bottom: 2px solid var(--pp-oxford-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pp-oxford-blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stage-rewards-badge {
  background: var(--pp-mint);
  color: var(--pp-oxford-blue);
  border: 2px solid var(--pp-oxford-blue);
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #fff;
}

/* Modal Photo Container & Badge Overlays */
.modal-photo-container {
  position: relative;
  width: 100%;
  background: var(--pp-azure);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--pp-oxford-blue);
  aspect-ratio: 4 / 3;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-base-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Corner Badge Overlays */
.photo-corner-badge {
  position: absolute;
  width: 80px;
  height: 80px;
  z-index: 10;
  filter: drop-shadow(0 3px 6px rgba(0,20,45,0.4));
  pointer-events: none;
}

.photo-corner-badge.badge-top-left    { top: 12px;    left: 12px;  }
.photo-corner-badge.badge-top-right   { top: 12px;    right: 12px; }
.photo-corner-badge.badge-bottom-left { bottom: 12px; left: 12px;  }
.photo-corner-badge.badge-bottom-right{ bottom: 12px; right: 12px; }

/* Two-Column Photo Info */
.photo-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--pp-azure);
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 16px;
  padding: 1rem 1.25rem;
}

.info-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-row {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-family: 'Londrina Solid', 'Arial Black', sans-serif;
  font-size: 0.72rem;
  color: #5a7395;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 400;
}

.info-val {
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--pp-oxford-blue);
  font-weight: 700;
}

.info-val a {
  color: var(--pp-crayola-blue);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.info-val a:hover {
  text-decoration: underline;
  color: var(--pp-oxford-blue);
}

.penguin-id-tag {
  display: inline-block;
  background: var(--pp-crayola-blue);
  color: #fff;
  border: 1.5px solid var(--pp-oxford-blue);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 8px;
  margin-right: 0.3rem;
  margin-top: 0.2rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--pp-azure);
  border-top: 2px solid var(--pp-oxford-blue);
  display: flex;
  justify-content: flex-end;
}

.btn-next-stage {
  width: 100%;
  justify-content: center;
  font-size: 1.15rem;
  padding: 0.9rem;
}

/* =====================================================================
 * 4. GAME OVER SCENE
 * ===================================================================== */
#scene-game-over {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: transparent;
}

.game-over-card {
  max-width: 650px;
  width: 100%;
  background: #fff;
  border: 2.5px solid var(--pp-oxford-blue);
  border-radius: 32px;
  padding: 2rem;
  box-shadow: var(--toon-card-shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInScale 0.35s ease-out;
}

.game-over-title {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--pp-oxford-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0.5rem 0;
}

.stat-box {
  background: var(--pp-azure);
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 16px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 2px 3px 0 rgba(0,20,45,0.14);
}

.stat-number {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--pp-crayola-blue);
}

.stat-label {
  font-family: 'Londrina Solid', 'Arial Black', sans-serif;
  font-size: 0.72rem;
  color: #5a7395;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Name submission input for leaderboards */
.submit-score-group {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.input-player-name {
  flex: 1;
  background: var(--pp-azure);
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  color: var(--pp-oxford-blue);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  box-shadow: inset 1px 2px 4px rgba(0,20,45,0.08);
}

.input-player-name::placeholder {
  color: #8ca8c4;
}

.input-player-name:focus {
  border-color: var(--pp-crayola-blue);
  box-shadow: 0 0 0 3px rgba(71,125,253,0.18), inset 1px 2px 4px rgba(0,20,45,0.08);
}

.game-over-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =====================================================================
 * 5. LEADERBOARDS & HOW TO PLAY MODALS
 * ===================================================================== */
.leaderboard-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.leaderboard-tab {
  background: var(--pp-azure);
  color: var(--pp-oxford-blue);
  border: 2px solid var(--pp-oxford-blue);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: 2px 3px 0 rgba(0, 20, 45, 0.16);
}

.leaderboard-tab:hover {
  transform: translateY(-1px);
}

.leaderboard-tab.active {
  background: var(--pp-crayola-blue);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--pp-oxford-blue), 2px 3px 0 rgba(0, 20, 45, 0.22);
}

.leaderboard-table-container {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 16px;
  border: 2px solid var(--pp-oxford-blue);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.leaderboard-table th {
  background: var(--pp-azure);
  padding: 0.75rem 1rem;
  color: var(--pp-oxford-blue);
  font-family: 'Londrina Solid', 'Arial Black', sans-serif;
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 2px solid var(--pp-oxford-blue);
}

.leaderboard-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,20,45,0.08);
  color: var(--pp-oxford-blue);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
}

.leaderboard-table tr:nth-child(even) {
  background: rgba(231,245,249,0.5);
}

.leaderboard-table tr:hover {
  background: var(--pp-azure);
}

.rank-badge {
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 2px solid var(--pp-oxford-blue);
}

.rank-1 { background: var(--pp-gold);    color: var(--pp-oxford-blue); }
.rank-2 { background: var(--pp-azure);   color: var(--pp-oxford-blue); }
.rank-3 { background: var(--pp-jasmine); color: var(--pp-oxford-blue); }

.modal-close-btn {
  background: transparent;
  border: 2px solid var(--pp-oxford-blue);
  color: var(--pp-oxford-blue);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  line-height: 1;
  transition: background 0.15s ease;
  font-weight: 700;
}

.modal-close-btn:hover {
  background: var(--pp-oxford-blue);
  color: #fff;
}

/* =====================================================================
 * 6. MOBILE LANDSCAPE ENFORCER OVERLAY
 * ===================================================================== */
#orientation-overlay {
  position: fixed;
  inset: 0;
  background: var(--pp-blizzard);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--pp-oxford-blue);
}

@media screen and (max-width: 900px) and (orientation: portrait) {
  #orientation-overlay {
    display: flex !important;
  }
}

.phone-rotate-icon {
  width: 70px;
  height: 110px;
  border: 4px solid var(--pp-crayola-blue);
  border-radius: 16px;
  position: relative;
  margin-bottom: 2rem;
  animation: rotatePhone 2.2s infinite ease-in-out;
}

.phone-rotate-icon::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pp-crayola-blue);
}

.rotate-title {
  font-family: 'Fredoka', 'Arial Black', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pp-crayola-blue);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.rotate-desc {
  color: #5a7395;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  max-width: 320px;
  line-height: 1.5;
}

/* =====================================================================
 * 7. KEYFRAME ANIMATIONS
 * ===================================================================== */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes circleAppear {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

@keyframes wrongXAppear {
  0%   { transform: translate(-50%, -50%) scale(0.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  20%       { transform: translate(calc(-50% - 6px), -50%) rotate(-8deg); }
  40%       { transform: translate(calc(-50% + 6px), -50%) rotate(8deg); }
  60%       { transform: translate(calc(-50% - 4px), -50%) rotate(-4deg); }
  80%       { transform: translate(calc(-50% + 4px), -50%) rotate(4deg); }
}

@keyframes floatUpFade {
  0%   { transform: translateY(0);     opacity: 1; }
  100% { transform: translateY(-35px); opacity: 0; }
}

@keyframes timer-pulse-warning {
  0%   { transform: scale(1);   }
  100% { transform: scale(1.1); }
}

@keyframes barBlinkRed {
  0%   { background-color: #ef4444; opacity: 1;    }
  100% { background-color: #991b1b; opacity: 0.35; }
}

@keyframes rotatePhone {
  0%, 15%   { transform: rotate(0deg);  }
  50%, 75%  { transform: rotate(90deg); }
  100%      { transform: rotate(0deg);  }
}

/* =====================================================================
 * 8. RESPONSIVE BREAKPOINTS (MOBILE LANDSCAPE OPTIMIZATIONS)
 * ===================================================================== */
@media (max-height: 520px) {
  .status-bar {
    padding: 0.2rem 0.75rem 0.25rem;
    gap: 0.2rem;
  }
  .stage-pill {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
  }
  .timer-digits {
    font-size: 1.1rem;
  }
  .timer-bar-wrapper {
    height: 5px;
  }
  .btn-hint {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
  }
  .game-play-area {
    padding: 0.25rem;
    gap: 0.5rem;
  }
  .photo-panels-wrapper {
    gap: 0.5rem;
  }
  .modal-photo-container {
    max-height: 180px;
  }
  .modal-card {
    max-height: 98vh;
  }
  .photo-corner-badge {
    width: 50px;
    height: 50px;
  }
}
