/* ==========================================================================
   2. Sınıf Oyun Dünyası - Ana Stil Dosyası
   ========================================================================== */

:root {
  --font-main: 'Comic Neue', 'Fredoka', 'Quicksand', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --game-scale: 1;
  --stage-w: 1100px;
  --stage-h: 680px;
  
  --color-primary: #3b82f6;
  --color-primary-dark: #1d4ed8;
  --color-secondary: #ec4899;
  --color-accent: #f59e0b;
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-bg: #f0fdf4;
  
  --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #fef3c7 50%, #fce7f3 100%);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Üst Başlık */
.app-header {
  height: 65px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-container:hover {
  transform: scale(1.03);
}

.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.logo-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, #2563eb, #ec4899, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.logo-text p {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

/* Versiyon Rozeti (KURAL 1) */
.version-badge {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #38bdf8;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.version-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
  transform: translateY(-2px);
  background: #f8fafc;
  box-shadow: var(--shadow-md);
}

/* Ana Görünüm Alanı */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.game-stage-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameStage {
  width: var(--stage-w);
  height: var(--stage-h);
  background: #ffffff;
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  border: 4px solid #ffffff;
}

/* Ana Menü Ekranı */
.menu-view {
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-banner {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  border-radius: 26px;
  padding: 26px 36px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 1.05rem;
  opacity: 0.95;
  max-width: 680px;
  line-height: 1.45;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.subject-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 22px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-md);
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subject-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: rgba(59, 130, 246, 0.4);
}

.subject-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: var(--shadow-sm);
}

.subject-info h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.subject-info p {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.35;
}

.subject-badge {
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
}

/* Konu ve Oyun Seçim Ekranı */
.topic-view {
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topic-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 14px 22px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: none;
  padding: 9px 16px;
  border-radius: 14px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-back:hover {
  background: #e2e8f0;
  transform: translateX(-3px);
}

.games-category-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-left: 6px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.game-item-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  border: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 14px;
}

.game-item-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: var(--shadow-md);
}

.game-item-icon {
  width: 50px;
  height: 50px;
  background: #f0fdf4;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.game-item-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}

.game-item-info p {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.3;
}

/* ==========================================================================
   OYUN AYARLARI MODALI & HIZLI AYAR TOGGLE BUTONU
   ========================================================================== */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.settings-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 30px 36px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.settings-label h4 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
}

.settings-label p {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: #10b981;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Oyun Üst Çubuğundaki Hızlı Ayar Butonu */
.btn-auto-next-toggle {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}

.btn-auto-next-toggle.active {
  background: #ecfdf5;
  border-color: #10b981;
  color: #059669;
}

/* Otomatik Geçiş Bildirim Banner'ı */
.auto-next-toast {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: popIn 0.3s ease;
}

#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

@media (max-width: 768px) {
  .app-header { padding: 0 14px; }
  .logo-text p, .version-badge span.long-text { display: none; }
  .hero-banner { padding: 20px; }
  .hero-title { font-size: 1.5rem; }
}
