:root {
  --primary-blue: #2575fc;
  --primary-pink: #ff416c;
  --primary-red: #ff4b2b;
  --primary-purple: #6a11cb;
  --bg-gradient: linear-gradient(135deg, #f0f8ff 0%, #d1e9ff 100%);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --correct-green: #4caf50;
  --wrong-red: #f44336;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  user-select: none;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: #333;
}

.app-container {
  width: 98vw;
  height: 95vh;
  max-width: 1400px;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  box-shadow: 0 15px 35px var(--shadow-color);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  opacity: 0;
}

.screen.active {
  pointer-events: all;
  opacity: 1;
}

/* Home Screen */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 30px;
}

.sub-headline {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 40px;
  color: #333;
  padding: 10px 40px;
  background: white;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  border: 4px solid rgba(37, 117, 252, 0.1);
  display: block;
  width: fit-content;
}

.game-card {
  background: white;
  border-radius: 30px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  border: 5px solid transparent;
}

/* Oyun Temaları */
.game-tug {
  border-color: rgba(37, 117, 252, 0.3);
}

.game-tug:hover {
  transform: translateY(-10px);
  border-color: #2575fc;
  box-shadow: 0 20px 40px rgba(37, 117, 252, 0.2);
}

.game-tug h3 {
  color: #2575fc;
}

.game-climb {
  border-color: rgba(255, 82, 82, 0.3);
}

.game-climb:hover {
  transform: translateY(-10px);
  border-color: #ff5252;
  box-shadow: 0 20px 40px rgba(255, 82, 82, 0.2);
}

.game-climb h3 {
  color: #ff5252;
}

.game-race {
  border-color: rgba(76, 175, 80, 0.3);
}

.game-race:hover {
  transform: translateY(-10px);
  border-color: #4caf50;
  box-shadow: 0 20px 40px rgba(76, 175, 80, 0.2);
}

.game-race h3 {
  color: #4caf50;
}

.game-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 20px;
  margin-bottom: 15px;
}

.game-card h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.game-card p {
  color: #888;
  font-size: 0.9rem;
}

/* Operation / Level Selection */
.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 30px;
}

.btn-option {
  padding: 15px 35px;
  font-size: 1.3rem;
  font-weight: 600;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  background: white;
  color: #555;
  transition: all 0.2s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.btn-option:hover {
  background: var(--primary-blue);
  color: white;
  transform: scale(1.05);
}

/* Game Layout - Split screens */
.game-layout {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 20px;
  padding: 10px;
}

.player-panel {
  width: 320px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  z-index: 10;
  align-self: flex-end;
  /* Move to bottom for accessibility on TVs */
  margin-bottom: 20px;
}

.center-track {
  flex: 1;
  background-image: url('assets/race-bg.png');
  background-size: cover;
  background-position: center;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.math-question {
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  margin: 15px 0;
  color: #333;
}

.answer-box {
  background: #f8f9fa;
  border-radius: 20px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  border: 4px solid transparent;
  transition: all 0.2s ease;
}

.answer-box.correct {
  border-color: var(--correct-green);
  background: #e8f5e9;
}

.answer-box.wrong {
  border-color: var(--wrong-red);
  background: #ffebee;
}

/* Calculator UI */
.num-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.btn-num {
  padding: 18px;
  font-size: 1.3rem;
  font-weight: bold;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  background: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.1s;
}

.btn-num:active {
  transform: scale(0.95);
  opacity: 0.8;
}

.btn-num.clear {
  background: #fdfdfd;
  color: #ff5252;
}

.btn-num.go {
  background: linear-gradient(135deg, #2575fc, #6a11cb);
  color: white;
}

/* Sprites & Tracks */
.race-path {
  position: absolute;
  width: 25%;
  /* To reach the narrow lanes in bird's-eye view */
  height: 100%;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 80px;
}

.path-left {
  left: 32%;
}

/* Moved closer to center */
.path-right {
  right: 32%;
}

.sprite {
  width: 64px;
  height: 64px;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 50;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

/* Mode Specific Adjustments */
.mode-climb .sprite {
  width: 120px;
  /* Nearly double the original 64px */
  height: 120px;
}

.mode-tug .sprite {
  width: 140px;
  /* Large character like Street Fighter */
  height: 140px;
}

.mode-tug .path-left {
  left: 20%;
  justify-content: center;
  /* Center horizontally for tug-of-war */
}

.mode-tug .path-right {
  right: 20%;
  justify-content: center;
}

/* Ensure they move horizontally in Tug mode */
.mode-tug .race-path {
  padding-bottom: 30px;
  /* Slight offset from bottom */
  height: 100%;
  display: flex;
  align-items: flex-end;
  /* Moved to bottom for Tug mode */
}

#tug-group {
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  align-items: flex-end !important;
  padding-bottom: 130px;
}

.mode-climb .path-left {
  left: 24%;
}

.mode-climb .path-right {
  right: 24%;
}

.mode-race .sprite {
  width: 64px;
  height: 64px;
}

.mode-race .path-left {
  left: 32%;
}

.mode-race .path-right {
  right: 32%;
}

.finish-line {
  position: absolute;
  top: 40px;
  width: 100%;
  height: 60px;
  background: repeating-linear-gradient(45deg,
      #000,
      #000 15px,
      #fff 15px,
      #fff 30px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 1.5rem;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
  display: none;
  z-index: 10;
  border-top: 4px solid #fff;
  border-bottom: 4px solid #fff;
}

/* Tug of War UI */
#tug-rope {
  position: absolute;
  top: 50%;
  width: 100%;
  height: 12px;
  background: #795548;
  display: none;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.colorful-title {
  background: linear-gradient(135deg, #2575fc, #6a11cb, #ff5252, #fbc2eb);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.15));
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.countdown-number {
  font-size: 12rem;
  font-weight: 900;
  color: var(--primary-blue);
}

.countdown-number.hit {
  animation: bounceScale 0.6s ease-out;
}

@keyframes bounceScale {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}