
:root {
  --bg-color: #050508;
  --text-color: #ffffff;
  --accent-blue: #00f2ff;
  --accent-pink: #ff00ff;
  --accent-red: #ff3333;
  --container-border: rgba(0, 242, 255, 0.3);
  --container-shadow: 0 0 50px rgba(0, 242, 255, 0.2);
  --overlay-bg: rgba(5, 5, 8, 0.9);
  --rink-line: rgba(255, 255, 255, 0.2);
  --timer-color: #00f2ff;
  --button-hover-bg: #ffffff;
}

body.light-mode {
  --bg-color: #f5f7fa;
  --text-color: #2d3436;
  --accent-blue: #0984e3;
  --accent-pink: #e84393;
  --accent-red: #d63031;
  --container-border: rgba(0, 0, 0, 0.1);
  --container-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --overlay-bg: rgba(255, 255, 255, 0.9);
  --rink-line: rgba(0, 0, 0, 0.1);
  --timer-color: #2d3436;
  --button-hover-bg: #2d3436;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

header {
  background: var(--bg-color);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--rink-line);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(45deg, var(--accent-blue), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.8;
  transition: all 0.3s;
}

nav a:hover {
  opacity: 1;
  color: var(--accent-blue);
}

#theme-toggle, #sound-toggle, #language-toggle {
  padding: 6px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  border: 2px solid var(--text-color);
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

#theme-toggle:hover, #sound-toggle:hover, #language-toggle:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

#game-section {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  margin-bottom: 5rem;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  flex: 1 1 900px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--container-border);
  border-radius: 16px;
  box-shadow: var(--container-shadow);
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 2px 2px, var(--rink-line) 1px, transparent 0);
  background-size: 40px 40px;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.scoreboard {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 16px;
  backdrop-filter: blur(5px);
  border: 1px solid var(--rink-line);
  pointer-events: none;
  z-index: 5;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent-pink);
  font-size: 0.8rem;
  font-weight: 800;
}

#level-number {
  font-family: 'Monaco', monospace;
}

.score-ball {
  font-size: 1.25rem;
  line-height: 1;
}

#player-score, #ai-score {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: 'Monaco', monospace;
}

#player-score {
  color: var(--accent-blue);
  text-shadow: 0 0 15px var(--accent-blue);
}

#ai-score {
  color: #ff3b30;
  text-shadow: 0 0 15px rgba(255, 59, 48, 0.8);
}

#turn-display {
  position: absolute;
  top: 25px;
  right: 30px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Monaco', monospace;
  color: var(--timer-color);
  background: rgba(0, 0, 0, 0.2);
  padding: 5px 15px;
  border-radius: 10px;
  pointer-events: none;
}

#turn-display.ai-turn {
  color: #ff3b30;
}

.overlay {
  position: absolute;
  inset: 0;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: all 0.5s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay h1 {
  font-size: 4.5rem;
  font-weight: 900;
  margin-bottom: 2.5rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 30px var(--accent-blue);
}

#start-button, #restart-button {
  padding: 1.2rem 3.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: 100px;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#start-button {
  background: var(--accent-blue);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

#start-button:hover {
  transform: scale(1.05) translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 255, 255, 0.6);
}

#restart-button {
  background: var(--accent-pink);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

#restart-button:hover {
  transform: scale(1.05) translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 0, 255, 0.6);
}

#countdown-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 50px var(--accent-blue);
  z-index: 60;
  pointer-events: none;
  opacity: 0.8;
  animation: countdown-pulse 1s ease-in-out infinite;
}

@keyframes countdown-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
}

#goal-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 6rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px var(--accent-red);
  z-index: 50;
  pointer-events: none;
  animation: goal-bounce 1.5s ease-out forwards;
}

@keyframes goal-bounce {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.content-section {
  margin-bottom: 6rem;
}

.content-section h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 15px;
}

.content-section h2::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--rink-line);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
}

.content-card {
  background: rgba(128, 128, 128, 0.05);
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid var(--rink-line);
  transition: transform 0.3s ease;
}

.content-card:hover {
  transform: translateY(-5px);
}

.content-card h3 {
  margin-bottom: 1rem;
  color: var(--accent-blue);
  font-size: 1.3rem;
}

footer {
  padding: 4rem 2rem;
  border-top: 1px solid var(--rink-line);
  opacity: 0.7;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  h1 { font-size: 1.4rem; }
  .header-container { flex-direction: column; gap: 0.75rem; }
  nav { gap: 0.6rem; flex-wrap: wrap; }
  #theme-toggle, #sound-toggle, #language-toggle { padding: 6px 10px; }
  .overlay h1 { font-size: 2.5rem; }
  #goal-notification { font-size: 3rem; }
  #game-section { gap: 12px; }
  .scoreboard { gap: 6px; padding: 8px; }
  .score-row { gap: 5px; }
  .score-ball { font-size: 1rem; }
  #player-score, #ai-score { font-size: 1.4rem; }
}
