/* ========================================
   8-BIT PIXEL PARTY DESIGN SYSTEM
   Kids-Friendly Light Theme - Mobile First
   ======================================== */

:root {
  /* Color Palette - Bright & Cheerful */
  --sky-blue: #87ceeb;
  --sunshine-yellow: #ffd93d;
  --bubblegum-pink: #ff6b9d;
  --mint-green: #6bcf9f;
  --coral-orange: #ff9f6d;
  --lavender: #c5a8ff;
  --white: #ffffff;
  --cream: #fff8e7;
  --soft-gray: #e8e8e8;
  --text-dark: #2c3e50;
  --shadow-color: rgba(0, 0, 0, 0.15);

  /* Typography */
  --font-pixel: "Press Start 2P", cursive;
  --font-friendly: "Fredoka", sans-serif;

  /* Spacing - Mobile First */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;

  /* Pixel Border (8-bit style) */
  --pixel-border: 4px;
  --border-radius: 12px;

  /* Shadows */
  --shadow-sm: 4px 4px 0 var(--shadow-color);
  --shadow-md: 6px 6px 0 var(--shadow-color);
  --shadow-lg: 8px 8px 0 var(--shadow-color);
  --shadow-hover: 3px 3px 0 var(--shadow-color);
}

/* ========================================
   BASE STYLES - MOBILE FIRST
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-friendly);
  background: linear-gradient(180deg, var(--sky-blue) 0%, var(--lavender) 100%);
  min-height: 100vh;
  color: var(--text-dark);
  position: relative;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Pixelated Cloud Pattern Background */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: radial-gradient(circle, var(--white) 20%, transparent 20%),
    radial-gradient(circle, var(--white) 20%, transparent 20%);
  background-size: 80px 80px;
  background-position: 0 0, 40px 40px;
  opacity: 0.3;
  animation: floatClouds 30s linear infinite;
}

@keyframes floatClouds {
  0% {
    background-position: 0 0, 40px 40px;
  }
  100% {
    background-position: 80px 80px, 120px 120px;
  }
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-md);
}

.page {
  display: none;
  min-height: 100vh;
  padding: var(--space-md) 0;
  position: relative;
}

.page.active {
  display: block;
  animation: pageAppear 0.5s ease-out;
}

@keyframes pageAppear {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

.page-header {
  text-align: center;
  margin-bottom: var(--space-xl);
  position: relative;
}

.pixel-stars {
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 40px;
  background-image: radial-gradient(
    circle,
    var(--sunshine-yellow) 3px,
    transparent 3px
  );
  background-size: 50px 50px;
  animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.page-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.25rem, 5vw, 2rem);
  text-align: center;
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  line-height: 1.4;
}

.title-emoji {
  font-size: 2.5rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

.title-text {
  background: linear-gradient(
    135deg,
    var(--bubblegum-pink) 0%,
    var(--sunshine-yellow) 50%,
    var(--mint-green) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
  animation: colorShift 3s ease-in-out infinite;
}

@keyframes colorShift {
  0%,
  100% {
    filter: hue-rotate(0deg);
  }
  50% {
    filter: hue-rotate(20deg);
  }
}

.page-subtitle {
  font-family: var(--font-pixel);
  font-size: clamp(0.75rem, 3vw, 1rem);
  text-align: center;
  color: var(--white);
  text-transform: uppercase;
  background: var(--bubblegum-pink);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--border-radius);
  display: inline-block;
  box-shadow: var(--shadow-sm);
  animation: wiggle 1.5s ease-in-out infinite;
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(2deg);
  }
}

.section-title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: var(--text-dark);
  margin-bottom: var(--space-lg);
  text-align: center;
}

/* ========================================
   FORM ELEMENTS - MOBILE OPTIMIZED
   ======================================== */

.form-group {
  background: var(--white);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.form-group:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-sm);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 700;
  color: var(--text-dark);
  font-size: clamp(0.875rem, 3.5vw, 1rem);
}

.form-group input {
  width: 100%;
  padding: var(--space-md);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-family: var(--font-friendly);
  font-weight: 600;
  background: var(--cream);
  color: var(--text-dark);
  transition: all 0.3s ease;
  /* Mobile optimizations */
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: var(--bubblegum-pink);
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.3);
  transform: scale(1.02);
}

.form-group input:active {
  transform: scale(0.98);
}

/* ========================================
   PLAYERS SECTION - MOBILE OPTIMIZED
   ======================================== */

.players-section {
  background: var(--white);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-lg);
}

.players-grid {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.player-card {
  background: var(--cream);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

.player-card::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 10%;
  right: 10%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--sunshine-yellow),
    var(--bubblegum-pink),
    var(--mint-green)
  );
  border-radius: 2px;
}

.player-card:active {
  transform: scale(0.98);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.player-number {
  font-family: var(--font-pixel);
  font-weight: bold;
  color: var(--bubblegum-pink);
  font-size: clamp(0.75rem, 3.5vw, 1rem);
}

.player-header-actions {
  display: flex;
  gap: var(--space-xs);
}

.move-up-btn,
.move-down-btn {
  background: var(--sunshine-yellow);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-dark);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  transition: all 0.2s ease;
  min-width: 40px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.move-up-btn:active,
.move-down-btn:active {
  transform: scale(0.9);
  background: var(--mint-green);
}

.move-up-btn:disabled,
.move-down-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.remove-player-btn {
  background: var(--coral-orange);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: 6px;
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--white);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-player-btn:active {
  transform: scale(0.9);
  background: #ff6b6b;
}

.player-name {
  width: 100%;
  padding: var(--space-md);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 4vw, 1.125rem);
  font-family: var(--font-friendly);
  font-weight: 700;
  background: var(--white);
  color: var(--text-dark);
  margin-bottom: var(--space-md);
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.player-name:focus {
  outline: none;
  border-color: var(--mint-green);
  box-shadow: 0 0 0 4px rgba(107, 207, 159, 0.3);
}

.player-image-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
}

.image-preview {
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  border: var(--pixel-border) dashed var(--text-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.image-preview:active {
  transform: scale(0.95);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  font-size: 3rem;
}

.image-buttons {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  width: 100%;
}

.upload-btn,
.camera-btn {
  flex: 1;
  padding: var(--space-md);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  font-weight: 700;
  font-family: var(--font-friendly);
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  min-height: 50px; /* Touch target */
}

.upload-btn {
  background: var(--mint-green);
  color: var(--text-dark);
}

.upload-btn:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

.camera-btn {
  background: var(--lavender);
  color: var(--text-dark);
}

.camera-btn:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

.add-player-btn {
  width: 100%;
  padding: var(--space-lg);
  background: var(--sunshine-yellow);
  color: var(--text-dark);
  border: var(--pixel-border) dashed var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 4vw, 1.125rem);
  font-weight: 700;
  font-family: var(--font-pixel);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  min-height: 60px; /* Touch target */
}

.add-player-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-hover);
  background: var(--coral-orange);
}

.start-btn {
  width: 100%;
  padding: var(--space-xl);
  background: linear-gradient(
    135deg,
    var(--bubblegum-pink) 0%,
    var(--coral-orange) 100%
  );
  color: var(--white);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 800;
  font-family: var(--font-pixel);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  min-height: 70px; /* Touch target */
  animation: pulse 2s ease-in-out infinite;
}

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

.start-btn:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: var(--shadow-hover);
}

/* ========================================
   GAMEPLAY PAGE - MOBILE OPTIMIZED
   ======================================== */

.game-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.gameplay-title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 4.5vw, 2rem);
  color: var(--text-dark);
  margin-bottom: var(--space-lg);
}

.cycle-info {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  background: var(--white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-md);
}

.cycle-label {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: clamp(0.625rem, 2.5vw, 0.75rem);
  color: var(--text-dark);
}

.cycle-numbers {
  font-family: var(--font-pixel);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.current-cycle {
  color: var(--bubblegum-pink);
}

.cycle-separator {
  color: var(--soft-gray);
}

.end-game-btn {
  /* margin-top: var(--space-lg); */
  padding: var(--space-md) var(--space-lg);
  background: var(--coral-orange);
  color: var(--white);
  border: var(--pixel-border) solid var(--text-dark);
  /* border-radius: var(--border-radius); */
  font-size: clamp(0.875rem, 3.5vw, 1rem);
  font-weight: 700;
  font-family: var(--font-pixel);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  /* min-height: 50px; */

  position: absolute;
  margin-right: -10rem;
  top: 4rem;
  min-width: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  width: 20px;
  height: 20px;
}

.end-game-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-hover);
  background: #ff6b6b;
}

.game-header-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.game-header-actions div,
.game-header-actions button {
  max-width: 200px;
}

.game-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.player-turn {
  text-align: center;
  order: 1;
  flex: 1;
  display: flex;
  justify-items: center;
  flex-direction: column;
}

.current-player-name {
  font-family: var(--font-pixel);
  font-size: clamp(1.25rem, 5vw, 2rem);
  color: var(--text-dark);
  margin-bottom: var(--space-md);
  background: var(--sunshine-yellow);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-md);
  display: inline-block;
}

.player-button-container {
  margin-bottom: var(--space-xl);
  margin-top: var(--space-sm);
  display: flex;
  justify-content: center;
}

.player-action-btn {
  width: min(350px, 90vw);
  height: min(350px, 90vw);
  border: 6px solid var(--text-dark);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: manipulation;
  overflow: hidden;
}

.btn-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--sunshine-yellow) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.3;
  }
  50% {
    transform: scale(1);
    opacity: 0.6;
  }
}

.player-action-btn:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-sm);
}

.player-action-btn.success {
  background: var(--mint-green);
  animation: successPop 0.6s ease-out;
}

@keyframes successPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.player-action-btn.failed {
  background: var(--coral-orange);
  animation: failShake 0.5s ease-out;
}

@keyframes failShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-15px);
  }
  40%,
  80% {
    transform: translateX(15px);
  }
}

.player-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bubblegum-pink);
  z-index: 1;
}

.player-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-image .image-placeholder {
  font-size: 6rem;
  opacity: 0.3;
}

.countdown-display {
  position: relative;
  z-index: 10;
  font-family: var(--font-pixel);
  font-size: clamp(5rem, 20vw, 8rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  background: transparent;
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--border-radius);
  /* border: 6px solid var(--text-dark); */
  /* box-shadow: var(--shadow-lg); */
  min-width: 150px;
  text-align: center;
}

.countdown-display.warning {
  background: var(--coral-orange);
  animation: warningBounce 0.5s ease-in-out infinite;
}

@keyframes warningBounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1) rotate(-5deg);
  }
}

.next-btn {
  padding: var(--space-lg) var(--space-xl);
  background: var(--sunshine-yellow);
  color: var(--text-dark);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  font-family: var(--font-pixel);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  min-height: 60px;
}

.next-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-hover);
}

/* ========================================
   SCORE SUMMARY - MOBILE OPTIMIZED
   ======================================== */

.score-summary {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-md);
  max-height: 150px;
  overflow-y: auto;
  order: 2;
  position: absolute;
  bottom: 15px;
  width: 90%;
  left: 0;
  right: 0;
  margin: 0 auto;
}

.score-summary h3 {
  font-family: var(--font-pixel);
  font-size: clamp(0.75rem, 3vw, 1rem);
  margin-bottom: var(--space-sm);
  color: var(--text-dark);
  text-align: center;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid var(--soft-gray);
}

.score-item:last-child {
  border-bottom: none;
}

.score-item .player-info {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.score-item .player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bubblegum-pink);
  background: var(--cream);
}

.score-item .player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.score-item .player-avatar .placeholder {
  width: 100%;
  height: 100%;
  background: var(--soft-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.score-item span {
  font-weight: 600;
  color: var(--text-dark);
  font-size: clamp(0.875rem, 3.5vw, 1rem);
}

.score-icons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 120px;
  justify-content: flex-end;
}

.score-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid var(--text-dark);
  animation: scorePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scorePopIn {
  0% {
    transform: scale(0) rotate(0deg);
  }
  50% {
    transform: scale(1.2) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

.score-icon.success {
  background: var(--mint-green);
}

.score-icon.failed {
  background: var(--coral-orange);
}

/* ========================================
   RESULTS PAGE - MOBILE OPTIMIZED
   ======================================== */

.results-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.results-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.25rem, 5vw, 2.5rem);
  color: var(--text-dark);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  justify-content: center;
}

.trophy-icon {
  font-size: clamp(3rem, 12vw, 5rem);
  display: block;
  animation: trophySpin 2s ease-in-out infinite;
}

@keyframes trophySpin {
  0%,
  100% {
    transform: rotate(-10deg) scale(1);
  }
  50% {
    transform: rotate(10deg) scale(1.1);
  }
}

.title-text {
  background: linear-gradient(
    135deg,
    var(--sunshine-yellow) 0%,
    var(--bubblegum-pink) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.winner-announcement {
  background: var(--sunshine-yellow);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 700;
  font-family: var(--font-pixel);
  color: var(--text-dark);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-lg);
  animation: wiggle 1s ease-in-out infinite;
}

.final-scores {
  background: var(--white);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-md);
}

.final-scores h2 {
  font-family: var(--font-pixel);
  text-align: center;
  margin-bottom: var(--space-lg);
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: var(--text-dark);
}

.final-score-item {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--border-radius);
  background: var(--cream);
  border: var(--pixel-border) solid var(--text-dark);
  box-shadow: var(--shadow-sm);
  animation: slideInUp 0.5s ease-out backwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

.final-score-item:nth-child(1) {
  animation-delay: 0.1s;
}

.final-score-item:nth-child(2) {
  animation-delay: 0.2s;
}

.final-score-item:nth-child(3) {
  animation-delay: 0.3s;
}

.final-score-item:nth-child(4) {
  animation-delay: 0.4s;
}

.final-score-item.winner {
  background: linear-gradient(
    135deg,
    var(--sunshine-yellow) 0%,
    var(--mint-green) 100%
  );
  border-color: var(--text-dark);
  box-shadow: var(--shadow-lg);
  animation: winnerGlow 1s ease-in-out infinite;
}

@keyframes winnerGlow {
  0%,
  100% {
    box-shadow: var(--shadow-lg);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 211, 61, 0.8);
  }
}

.final-score-item .player-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.final-score-item .player-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: var(--pixel-border) solid var(--text-dark);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.final-score-item.winner .player-avatar {
  border-color: var(--bubblegum-pink);
}

.final-score-item .player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.final-score-item .player-avatar .placeholder {
  width: 100%;
  height: 100%;
  background: var(--soft-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.final-score-item .player-details {
  flex: 1;
}

.final-score-item .player-name {
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  font-family: var(--font-pixel);
  color: var(--text-dark);
  margin-bottom: var(--space-xs);
}

.final-score-item.winner .player-name {
  color: var(--bubblegum-pink);
}

.final-score-item .score-breakdown {
  display: flex;
  gap: var(--space-sm);
  font-size: clamp(0.75rem, 3vw, 0.875rem);
  font-weight: 600;
}

.final-score-item .score-breakdown span {
  color: var(--text-dark);
}

.final-score-item .total-score {
  font-family: var(--font-pixel);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  color: var(--bubblegum-pink);
  text-align: center;
  min-width: 60px;
}

.final-score-item.winner .total-score {
  color: var(--text-dark);
  animation: scoreJump 0.6s ease-in-out infinite;
}

@keyframes scoreJump {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.play-again-btn {
  width: 100%;
  padding: var(--space-xl);
  background: linear-gradient(
    135deg,
    var(--mint-green) 0%,
    var(--sky-blue) 100%
  );
  color: var(--text-dark);
  border: var(--pixel-border) solid var(--text-dark);
  border-radius: var(--border-radius);
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 800;
  font-family: var(--font-pixel);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  min-height: 70px;
}

.play-again-btn:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-hover);
}

/* ========================================
   TABLET RESPONSIVE (min-width: 768px)
   ======================================== */

@media (min-width: 768px) {
  .container {
    max-width: 768px;
    padding: var(--space-xl);
  }

  .players-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .player-turn {
    order: initial;
  }

  .score-summary {
    order: initial;
  }

  .player-action-btn {
    width: 320px;
    height: 320px;
  }

  .player-image {
    width: 100%;
    height: 100%;
  }

  .player-image-section {
    flex-direction: row;
  }

  .image-buttons {
    flex-direction: column;
  }
}

/* ========================================
   DESKTOP RESPONSIVE (min-width: 1024px)
   ======================================== */

@media (min-width: 1024px) {
  .container {
    max-width: 900px;
  }

  .players-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--bubblegum-pink);
  border-radius: 10px;
  border: 2px solid var(--cream);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--coral-orange);
}

/* ========================================
   ACCESSIBILITY & TOUCH IMPROVEMENTS
   ======================================== */

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

/* Ensure all interactive elements have sufficient touch targets */
button,
input[type="button"],
input[type="submit"] {
  min-height: 44px;
  min-width: 44px;
}

/* Improve focus visibility for keyboard navigation */
*:focus-visible {
  outline: 4px solid var(--bubblegum-pink);
  outline-offset: 2px;
}
