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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #8e44ad 0%, #2c3e50 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 20px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 20px));
  -webkit-tap-highlight-color: transparent;
}

.container {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 36px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.5s ease;
}

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

/* ===== ANA EKRAN ===== */
.school-badge {
  text-align: center;
  margin-bottom: 8px;
}

.school-emoji {
  font-size: 3.5rem;
  display: inline-block;
  animation: schoolBounce 2s ease-in-out infinite;
}

@keyframes schoolBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.08); }
}

.game-title {
  text-align: center;
  font-size: 2.2rem;
  color: #6c3483;
  margin-bottom: 6px;
  font-weight: 800;
}

.game-subtitle {
  text-align: center;
  font-size: 1.05rem;
  color: #888;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.3s;
  -webkit-appearance: none;
}

.form-group input[type="text"]:focus {
  border-color: #8e44ad;
}

.start-btn {
  width: 100%;
  padding: 18px;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #8e44ad, #6c3483);
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.35);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.5);
}

.start-btn:active {
  transform: translateY(0);
}

/* ===== QUIZ EKRANI ===== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  min-width: 60px;
}

.score-label {
  font-size: 0.7rem;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
}

.score-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #8e44ad;
}

.score-display.score-pop .score-value {
  animation: scorePop 0.4s ease;
}

.score-display.score-lose .score-value {
  animation: scoreLose 0.4s ease;
}

@keyframes scorePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); color: #27ae60; }
  100% { transform: scale(1); }
}

@keyframes scoreLose {
  0% { transform: scale(1); }
  50% { transform: scale(0.85); color: #e74c3c; }
  100% { transform: scale(1); }
}

.score-float {
  position: absolute;
  top: -4px;
  right: -8px;
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
  animation: floatUp 0.9s ease-out forwards;
}

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

.question-counter {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  padding: 4px 12px;
  background: #f0f0f0;
  border-radius: 20px;
}

/* ===== TIMER — EFEKTLI ===== */
.timer-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.timer-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: #e8e8e8;
  stroke-width: 2.5;
}

.timer-ring-progress {
  fill: none;
  stroke: #2ecc71;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 106.81;
  stroke-dashoffset: 106.81;
  transition: stroke-dashoffset 0.3s linear, stroke 0.5s;
}

.timer-display {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 900;
  font-family: 'Courier New', Consolas, monospace;
  color: #2ecc71;
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
  transition: color 0.5s, text-shadow 0.5s;
}

.timer-display.timer-tick {
  animation: timerBounce 0.25s ease-out;
}

@keyframes timerBounce {
  0% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.timer-display.warm {
  color: #f39c12;
  text-shadow: 0 0 10px rgba(243, 156, 18, 0.35);
}

.timer-display.warm ~ .timer-ring .timer-ring-progress,
.timer-container:has(.warm) .timer-ring-progress {
  stroke: #f39c12;
}

.timer-display.hot {
  color: #e67e22;
  text-shadow: 0 0 12px rgba(230, 126, 34, 0.4);
}

.timer-container:has(.hot) .timer-ring-progress {
  stroke: #e67e22;
}

.timer-display.blazing {
  color: #e74c3c;
  text-shadow: 0 0 14px rgba(231, 76, 60, 0.5);
  animation: timerBounce 0.25s ease-out, timerGlow 0.8s ease-in-out infinite;
}

.timer-container:has(.blazing) .timer-ring-progress {
  stroke: #e74c3c;
}

@keyframes timerGlow {
  0%, 100% { text-shadow: 0 0 14px rgba(231, 76, 60, 0.5); }
  50% { text-shadow: 0 0 22px rgba(231, 76, 60, 0.8); }
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  margin-bottom: 14px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #8e44ad, #c39bd3);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ===== STREAK BADGE ===== */
.streak-badge {
  text-align: center;
  background: linear-gradient(90deg, #f39c12, #e74c3c);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 12px;
  display: inline-block;
  animation: streakPulse 1s ease-in-out infinite;
}

.streak-badge.hidden {
  display: none;
}

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

/* ===== SORU KARTI ===== */
.question-card {
  background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 18px;
  text-align: center;
  border: 2px solid rgba(142, 68, 173, 0.15);
  animation: barGlow 2s ease-in-out infinite;
}

.question-card.card-enter {
  animation: cardEnter 0.35s ease-out, barGlow 2s ease-in-out infinite 0.35s;
}

@keyframes cardEnter {
  0% { opacity: 0; transform: translateX(30px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes barGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(142, 68, 173, 0.08); border-color: rgba(142, 68, 173, 0.15); }
  50% { box-shadow: 0 0 16px rgba(142, 68, 173, 0.2); border-color: rgba(142, 68, 173, 0.35); }
}

.question-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: #333;
  line-height: 1.5;
}

/* ===== SECENEKLER ===== */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.option-btn {
  padding: 14px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid #e0e0e0;
  border-radius: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  line-height: 1.4;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.option-btn:hover {
  border-color: #8e44ad;
  background: #f8f0fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(142, 68, 173, 0.12);
}

.option-btn:active {
  transform: translateY(0);
}

.option-btn.correct {
  background: linear-gradient(135deg, #d5f5e3, #a9dfbf);
  border-color: #27ae60;
  color: #1e8449;
  animation: correctPop 0.4s ease;
}

.option-btn.wrong {
  background: linear-gradient(135deg, #fadbd8, #f5b7b1);
  border-color: #e74c3c;
  color: #c0392b;
  animation: wrongShake 0.4s ease;
}

.option-btn.show-correct {
  background: #d5f5e3;
  border-color: #27ae60;
  border-style: dashed;
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.85;
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ===== FEEDBACK ===== */
.feedback {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  min-height: 1.4em;
  padding: 8px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}

.feedback.visible {
  opacity: 1;
}

.correct-feedback {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.08);
}

.wrong-feedback {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
}

/* ===== SONUC EKRANI ===== */
.result-container {
  text-align: center;
}

.result-emoji {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: resultBounce 0.6s ease;
}

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

.result-title {
  font-size: 1.8rem;
  color: #6c3483;
  margin-bottom: 6px;
  font-weight: 800;
}

.result-player {
  font-size: 1.05rem;
  color: #666;
  margin-bottom: 24px;
}

.result-player .result-avatar {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  margin-right: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #f8f9fa;
  border-radius: 14px;
  padding: 14px 8px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #8e44ad;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
}

.stat-card-time {
  background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
}

.stat-time-value {
  color: #2ecc71 !important;
  font-family: 'Courier New', Consolas, monospace;
}

/* Sure bonus badge */
.time-bonus-badge {
  display: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: #27ae60;
  background: rgba(39, 174, 96, 0.1);
  padding: 8px 20px;
  border-radius: 20px;
  margin-bottom: 16px;
  animation: bonusPop 0.5s ease;
}

.time-bonus-badge.visible {
  display: inline-block;
}

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

.result-message {
  font-size: 1rem;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

.restart-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #8e44ad, #6c3483);
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 16px;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.45);
}

.restart-btn:active {
  transform: translateY(0);
}

/* ===== HIDDEN ===== */
.hidden {
  display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .container {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .game-title {
    font-size: 1.8rem;
  }

  .school-emoji {
    font-size: 2.8rem;
  }

  .question-text {
    font-size: 1.15rem;
  }

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

  .option-btn {
    padding: 12px 14px;
  }

  .timer-container {
    width: 54px;
    height: 54px;
  }

  .timer-display {
    font-size: 0.95rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 360px) {
  .container {
    padding: 18px 14px;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .question-text {
    font-size: 1.05rem;
  }
}
