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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 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.2);
  animation: fadeIn 0.5s ease;
}

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

/* ===== ANA EKRAN ===== */
.game-title {
  text-align: center;
  font-size: 2.5rem;
  color: #4a3f8a;
  margin-bottom: 8px;
  font-weight: 800;
}

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

.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; /* iOS zoom engelleme: 16px minimum */
  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: #667eea;
}

.difficulty-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.difficulty-btn {
  flex: 1;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border: 3px solid #ddd;
  border-radius: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  min-height: 44px;
}

.difficulty-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.difficulty-btn.selected {
  border-color: var(--grade-color, #667eea);
  background: #f0f4ff;
  color: var(--grade-color, #667eea);
}

.grade-emoji {
  font-size: 1.4rem;
  line-height: 1;
}

.start-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.3s;
  min-height: 52px;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

/* ===== SORU EKRANI ===== */
#quiz-screen {
  position: relative;
}

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

/* .score-display → shared/shared.css */

.question-counter {
  font-size: 0.95rem;
  font-weight: 600;
  color: #888;
  white-space: nowrap;
}

.timer {
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  background: #e8f8f0;
  color: #27ae60;
  transition: all 0.3s;
  white-space: nowrap;
}

.timer.warning {
  background: #fff3e0;
  color: #f39c12;
}

.timer.danger {
  background: #fde8e8;
  color: #e74c3c;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #e8e5f0;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ===== STREAK BADGE ===== */
.streak-badge {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #e67e22;
  background: #fef5e7;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 12px;
  display: inline-block;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  animation: streakPop 0.4s ease;
}

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

@keyframes streakPop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.question-card {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border-radius: 18px;
  padding: 28px 20px;
  margin-bottom: 20px;
  text-align: center;
}

.question-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}

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

.option-btn {
  padding: 16px 14px;
  font-size: 1.15rem;
  font-weight: 600;
  border: 3px solid #e0e0e0;
  border-radius: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
  color: #333;
  min-height: 52px;
}

.option-btn:hover:not(.disabled) {
  border-color: #667eea;
  background: #f0edff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.option-btn.correct {
  border-color: #27ae60;
  background: #e8f8f0;
  color: #27ae60;
  animation: correctAnim 0.5s ease;
}

.option-btn.wrong {
  border-color: #e74c3c;
  background: #fde8e8;
  color: #e74c3c;
  animation: wrongAnim 0.5s ease;
}

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

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

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

@keyframes wrongAnim {
  0% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

.feedback {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 16px;
  min-height: 36px;
  opacity: 0;
  transition: opacity 0.3s;
}

.feedback.visible {
  opacity: 1;
}

.feedback.correct-feedback {
  color: #27ae60;
}

.feedback.wrong-feedback {
  color: #e74c3c;
}

/* ===== JOKE OVERLAY ===== */
.joke-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 24px;
  z-index: 10;
  animation: jokeFadeIn 0.4s ease;
}

.joke-overlay.hidden {
  display: none !important;
}

@keyframes jokeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.joke-content {
  text-align: center;
  padding: 28px;
  max-width: 90%;
}

.joke-emoji {
  font-size: 3rem;
  margin-bottom: 16px;
}

.joke-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: #4a3f8a;
  line-height: 1.6;
}

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

.result-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.result-title {
  font-size: 2rem;
  font-weight: 800;
  color: #4a3f8a;
  margin-bottom: 8px;
}

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

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

.stat-card {
  background: #f5f3ff;
  border-radius: 16px;
  padding: 18px 10px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #4a3f8a;
}

.stat-label {
  font-size: 0.85rem;
  color: #888;
  margin-top: 4px;
}

.result-message {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 24px;
  line-height: 1.6;
}

.restart-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s;
  min-height: 52px;
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

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

/* ===== TABLET (768px) ===== */
@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .container {
    padding: 30px 24px;
  }

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

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

/* ===== TELEFON (500px) ===== */
@media (max-width: 500px) {
  body {
    padding: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 8px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 8px));
  }

  .container {
    padding: 22px 16px;
    border-radius: 18px;
  }

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

  .game-subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
  }

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

  .difficulty-btn {
    font-size: 0.9rem;
    padding: 12px 8px;
  }

  .start-btn {
    font-size: 1.15rem;
  }

  .quiz-header {
    flex-wrap: wrap;
    justify-content: center;
  }

  .timer {
    font-size: 0.9rem;
    padding: 6px 12px;
  }

  .question-counter {
    font-size: 0.85rem;
  }

  .question-card {
    padding: 20px 14px;
    margin-bottom: 16px;
  }

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

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

  .option-btn {
    padding: 14px 12px;
    font-size: 1.05rem;
  }

  .feedback {
    font-size: 1.05rem;
  }

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

  .stat-card {
    padding: 12px 6px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .result-title {
    font-size: 1.6rem;
  }

  .result-message {
    font-size: 1rem;
  }

  .joke-text {
    font-size: 1rem;
  }
}

/* ===== COK KUCUK TELEFON (360px) ===== */
@media (max-width: 360px) {
  .container {
    padding: 18px 12px;
  }

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

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

  .option-btn {
    padding: 12px 10px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }
}

/* ===== LANDSCAPE TELEFON ===== */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 12px 20px;
    align-items: flex-start;
  }

  .container {
    padding: 20px 24px;
  }

  .game-title {
    font-size: 1.6rem;
    margin-bottom: 4px;
  }

  .game-subtitle {
    margin-bottom: 16px;
    font-size: 0.95rem;
  }

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

  .difficulty-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .difficulty-btn {
    padding: 10px 6px;
    font-size: 0.8rem;
  }

  .question-card {
    padding: 16px;
    margin-bottom: 12px;
  }

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

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

  .option-btn {
    padding: 10px;
    font-size: 1rem;
    min-height: 44px;
  }

  .feedback {
    margin-top: 8px;
    min-height: 28px;
    font-size: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }

  .result-emoji {
    font-size: 2.5rem;
    margin-bottom: 8px;
  }

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