/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  background: #1a1a2e;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(255,215,0,0.5); }
  50% { box-shadow: 0 0 25px rgba(255,215,0,0.8), 0 0 50px rgba(255,215,0,0.3); }
}

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

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

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

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

@keyframes goalPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.animate-slide-up { animation: slideUp 0.5s ease-out; }
.animate-bounce-in { animation: bounceIn 0.5s ease-out; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-pulse { animation: pulse 1s ease-in-out infinite; }
.animate-goal-pop { animation: goalPop 0.4s ease-out; }

/* ===== MENU SCREEN ===== */
#screen-menu {
  background: linear-gradient(135deg, #1a0533, #2d1b69, #4a1942);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.menu-container {
  width: 100%;
  max-width: 700px;
}

.title-block {
  text-align: center;
  margin-bottom: 40px;
}

.title-main {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.title-sub {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(90deg, #22d3ee, #3b82f6, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,0.7);
  margin-top: 16px;
}

.section-title {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 16px;
}

.sport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 500px) {
  .sport-grid { grid-template-columns: 1fr; }
}

.sport-card {
  position: relative;
  padding: 24px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(22,163,74,0.3));
  color: white;
  text-align: center;
}

.sport-card:hover {
  transform: scale(1.05);
}

.sport-card[data-sport="hockey"] {
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(37,99,235,0.3));
}

.sport-card.selected-sport {
  background: linear-gradient(135deg, #22c55e, #15803d);
  box-shadow: 0 0 0 4px #fbbf24, 0 10px 30px rgba(34,197,94,0.4);
}

.sport-card[data-sport="hockey"].selected-sport {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 0 0 4px #fbbf24, 0 10px 30px rgba(59,130,246,0.4);
}

.sport-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.sport-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.sport-desc {
  font-size: 0.875rem;
  opacity: 0.7;
}

.sport-check {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.5rem;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

@media (max-width: 500px) {
  .difficulty-grid { grid-template-columns: 1fr; }
}

.diff-card {
  padding: 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.1);
  color: white;
  text-align: center;
}

.diff-card:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.2);
}

.diff-card.selected-diff {
  background: linear-gradient(135deg, #eab308, #ea580c);
  box-shadow: 0 0 0 4px #fde047, 0 10px 30px rgba(234,179,8,0.4);
}

.diff-stars { font-size: 1.5rem; margin-bottom: 4px; }
.diff-name { font-size: 1.1rem; font-weight: 700; }
.diff-info { font-size: 0.75rem; opacity: 0.7; }
.diff-range { font-size: 0.7rem; opacity: 0.5; margin-top: 4px; }

.start-btn {
  display: inline-block;
  padding: 16px 40px;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  color: black;
  font-weight: 900;
  font-size: 1.25rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulseGlow 2s ease-in-out infinite;
}

.start-btn:hover {
  transform: scale(1.1);
}

.footer-info {
  margin-top: 40px;
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.875rem;
}

.footer-info p { margin-bottom: 4px; }

/* ===== GAME SCREEN ===== */
#screen-game {
  flex-direction: column;
  padding: 12px;
}

#screen-game.sport-football {
  background: linear-gradient(135deg, #064e3b, #065f46, #064e3b);
}

#screen-game.sport-hockey {
  background: linear-gradient(135deg, #1e3a5f, #1e1b4b, #1e3a5f);
}

.game-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Header */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-sport-icon { font-size: 1.5rem; }

.header-sport-name {
  color: white;
  font-weight: 700;
  font-size: clamp(0.8rem, 2vw, 1rem);
}

.header-question-num {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-stat { text-align: center; }

.stat-value {
  font-weight: 900;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.stat-label {
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
}

.text-yellow { color: #fbbf24; }
.text-green { color: #4ade80; }
.text-red { color: #f87171; }
.text-orange { color: #fb923c; }

.streak-badge {
  background: rgba(249,115,22,0.3);
  padding: 4px 12px;
  border-radius: 20px;
  animation: pulse 1s ease-in-out infinite;
}

.streak-badge span {
  color: #fdba74;
  font-weight: 700;
  font-size: 0.875rem;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

/* Timer */
.timer-block {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.timer {
  padding: 4px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.1rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  transition: all 0.3s;
}

.timer.timer-warning {
  background: rgba(239,68,68,0.3);
  color: #fca5a5;
  animation: pulse 0.5s ease-in-out infinite;
}

/* Field */
.field-wrapper {
  margin-bottom: 16px;
}

.field {
  position: relative;
  width: 100%;
  min-height: 250px;
  border-radius: 16px;
  overflow: hidden;
}

@media (min-width: 768px) {
  .field { min-height: 350px; }
}

/* Football field */
.football-field {
  background: linear-gradient(180deg, #15803d, #16a34a, #15803d);
  border: 4px solid rgba(255,255,255,0.3);
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,0.04) 40px,
    rgba(255,255,255,0.04) 80px
  );
}

.field-center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50%;
}

.field-line-h {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.25);
}

.field-line-top { top: 0; }
.field-line-bottom { bottom: 0; }

.field-line-v {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,0.25);
}

.goal-post {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 80px;
  border: 2px solid rgba(255,255,255,0.5);
}

.goal-left {
  left: 8px;
  border-right: none;
  border-radius: 4px 0 0 4px;
}

.goal-right {
  right: 8px;
  border-left: none;
  border-radius: 0 4px 4px 0;
}

/* Hockey rink */
.hockey-rink {
  background: linear-gradient(180deg, #dbeafe, #ffffff, #dbeafe);
  border: 4px solid #93c5fd;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(255,255,255,0.3) 0%, transparent 50%);
}

.rink-line {
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  background: rgba(239,68,68,0.35);
}

.rink-line-left { left: 33%; }
.rink-line-right { left: 66%; }

.rink-line-h {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(239,68,68,0.5);
}

.rink-center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 2px solid rgba(239,68,68,0.35);
  border-radius: 50%;
}

.faceoff-circle {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 50%;
}

.fo-tl { top: 20%; left: 20%; }
.fo-tr { top: 20%; right: 20%; }
.fo-bl { bottom: 20%; left: 20%; }
.fo-br { bottom: 20%; right: 20%; }

.hockey-goal {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 64px;
  border: 2px solid rgba(220,38,38,0.5);
  border-radius: 8px;
  background: rgba(254,242,242,0.3);
}

.hockey-goal-left {
  left: 12px;
  border-right: none;
  border-radius: 8px 0 0 8px;
}

.hockey-goal-right {
  right: 12px;
  border-left: none;
  border-radius: 0 8px 8px 0;
}

/* Center icon */
.field-center-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(3rem, 8vw, 4rem);
  animation: float 3s ease-in-out infinite;
  z-index: 5;
}

/* Goal animation */
.goal-animation {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  animation: goalPop 0.4s ease-out;
}

.goal-text {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(255,215,0,0.8), 0 0 40px rgba(255,215,0,0.4);
}

.goal-points {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: white;
  font-weight: 700;
  animation: pulse 0.8s ease-in-out infinite;
}

/* Miss animation */
.miss-animation {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  animation: shake 0.5s ease-in-out;
}

.miss-emoji { font-size: clamp(2.5rem, 7vw, 3.5rem); }
.miss-text { color: #fca5a5; font-weight: 700; font-size: 1.2rem; margin-top: 8px; }

/* Confetti */
.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  font-size: 1.2rem;
  animation: confettiFall 2.5s linear forwards;
}

/* Question block */
.question-block {
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.1);
}

.question-label {
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.question-text {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  color: white;
  margin-bottom: 20px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-btn {
  padding: 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: white;
  font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  cursor: pointer;
  transition: all 0.3s ease;
}

.option-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  background: rgba(34,197,94,0.4);
  border-color: #4ade80;
  box-shadow: 0 0 0 2px #4ade80;
  color: #dcfce7;
}

.option-btn.wrong {
  background: rgba(239,68,68,0.4);
  border-color: #f87171;
  box-shadow: 0 0 0 2px #f87171;
  color: #fecaca;
  animation: shake 0.5s ease-in-out;
}

.option-btn.dimmed {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.3);
}

/* Message */
.message-block {
  text-align: center;
  margin-bottom: 12px;
  animation: bounceIn 0.4s ease-out;
}

.message-text {
  display: inline-block;
  padding: 8px 24px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  border-radius: 50px;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Game stats */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
}

.game-stats strong {
  color: rgba(255,255,255,0.8);
}

/* ===== RESULT SCREEN ===== */
#screen-result {
  background: linear-gradient(135deg, #1a0533, #2d1b69, #4a1942);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.result-container {
  width: 100%;
  max-width: 500px;
}

.result-grade {
  text-align: center;
  margin-bottom: 32px;
}

.grade-emoji {
  font-size: clamp(4rem, 12vw, 6rem);
  margin-bottom: 16px;
}

.grade-title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 900;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-card {
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.result-stat {
  text-align: center;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
}

.result-stat-value {
  font-size: 1.8rem;
  font-weight: 900;
}

.result-stat-label {
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
}

.accuracy-block {
  text-align: center;
  margin-bottom: 20px;
}

.accuracy-label {
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.accuracy-bar {
  width: 100%;
  height: 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.accuracy-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 1s ease;
  background: linear-gradient(90deg, #4ade80, #16a34a);
}

.accuracy-fill.medium {
  background: linear-gradient(90deg, #fbbf24, #f97316);
}

.accuracy-fill.low {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.accuracy-value {
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  margin-top: 8px;
}

.stars-block {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.star {
  font-size: 1.8rem;
  opacity: 0.2;
  transition: all 0.3s;
}

.star.active {
  opacity: 1;
  animation: bounceIn 0.4s ease-out;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 500px) {
  .result-buttons { flex-direction: row; }
}

.btn-restart, .btn-menu {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
}

.btn-restart {
  background: linear-gradient(90deg, #22c55e, #059669);
  box-shadow: 0 4px 15px rgba(34,197,94,0.3);
}

.btn-menu {
  background: linear-gradient(90deg, #a855f7, #4f46e5);
  box-shadow: 0 4px 15px rgba(168,85,247,0.3);
}

.btn-restart:hover, .btn-menu:hover {
  transform: scale(1.05);
}
