/* Biyoloji Tabusu - Modern & Mobil Uyumlu Stil ve Tema Sistemi */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Varsayılan Tema: Zümrüt Doğa (Emerald) */
  --theme-primary: #10b981;
  --theme-primary-light: #34d399;
  --theme-secondary: #06b6d4;
  --theme-bg-base: #061014;
  --theme-grad1: rgba(16, 185, 129, 0.16);
  --theme-grad2: rgba(6, 182, 212, 0.13);
  --theme-border: rgba(52, 211, 153, 0.25);
  --theme-glow: rgba(16, 185, 129, 0.15);
  --theme-badge-bg: rgba(16, 185, 129, 0.2);
  --theme-badge-text: #6ee7b7;
}

/* =========================================================================
   TEMA PALETLERİ
   ========================================================================= */

/* 1. Zümrüt Biyoloji (Yeşil & Turkuaz) */
body.theme-emerald,
[data-theme="emerald"],
html[data-theme="emerald"],
body[data-theme="emerald"] {
  --theme-primary: #10b981;
  --theme-primary-light: #34d399;
  --theme-secondary: #06b6d4;
  --theme-bg-base: #061014;
  --theme-grad1: rgba(16, 185, 129, 0.16);
  --theme-grad2: rgba(6, 182, 212, 0.13);
  --theme-border: rgba(52, 211, 153, 0.25);
  --theme-glow: rgba(16, 185, 129, 0.15);
  --theme-badge-bg: rgba(16, 185, 129, 0.2);
  --theme-badge-text: #6ee7b7;
}

/* 2. Derin Okyanus (Mavi & Safir) */
body.theme-ocean,
[data-theme="ocean"],
html[data-theme="ocean"],
body[data-theme="ocean"] {
  --theme-primary: #0ea5e9;
  --theme-primary-light: #38bdf8;
  --theme-secondary: #3b82f6;
  --theme-bg-base: #030d1a;
  --theme-grad1: rgba(14, 165, 233, 0.18);
  --theme-grad2: rgba(59, 130, 246, 0.14);
  --theme-border: rgba(56, 189, 248, 0.28);
  --theme-glow: rgba(14, 165, 233, 0.18);
  --theme-badge-bg: rgba(14, 165, 233, 0.22);
  --theme-badge-text: #7dd3fc;
}

/* 3. Siber Genetik (Mor & Pembe) */
body.theme-cyber,
[data-theme="cyber"],
html[data-theme="cyber"],
body[data-theme="cyber"] {
  --theme-primary: #a855f7;
  --theme-primary-light: #c084fc;
  --theme-secondary: #ec4899;
  --theme-bg-base: #0f071c;
  --theme-grad1: rgba(168, 85, 247, 0.18);
  --theme-grad2: rgba(236, 72, 153, 0.13);
  --theme-border: rgba(192, 132, 252, 0.28);
  --theme-glow: rgba(168, 85, 247, 0.18);
  --theme-badge-bg: rgba(168, 85, 247, 0.22);
  --theme-badge-text: #d8b4fe;
}

/* 4. Hücre Çekirdeği (Amber & Sıcak Ateş) */
body.theme-sunset,
[data-theme="sunset"],
html[data-theme="sunset"],
body[data-theme="sunset"] {
  --theme-primary: #f97316;
  --theme-primary-light: #fb923c;
  --theme-secondary: #ef4444;
  --theme-bg-base: #140803;
  --theme-grad1: rgba(249, 115, 22, 0.18);
  --theme-grad2: rgba(239, 68, 68, 0.14);
  --theme-border: rgba(251, 146, 60, 0.28);
  --theme-glow: rgba(249, 115, 22, 0.18);
  --theme-badge-bg: rgba(249, 115, 22, 0.22);
  --theme-badge-text: #fdba74;
}

/* 5. Kozmik Altın (Altın & Sarı) */
body.theme-gold,
[data-theme="gold"],
html[data-theme="gold"],
body[data-theme="gold"] {
  --theme-primary: #eab308;
  --theme-primary-light: #facc15;
  --theme-secondary: #f59e0b;
  --theme-bg-base: #120e03;
  --theme-grad1: rgba(234, 179, 8, 0.18);
  --theme-grad2: rgba(245, 158, 11, 0.14);
  --theme-border: rgba(250, 204, 21, 0.28);
  --theme-glow: rgba(234, 179, 8, 0.18);
  --theme-badge-bg: rgba(234, 179, 8, 0.22);
  --theme-badge-text: #fde047;
}

/* =========================================================================
   GENEL VE TEMA UYUMLULUK SELEKTÖRLERİ
   ========================================================================= */

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background-color: var(--theme-bg-base);
  color: #f0fdf4;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  touch-action: manipulation;
  transition: background-color 0.3s ease;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* Canlı Tema Arka Planı */
.bio-bg {
  background-color: var(--theme-bg-base);
  background-image:
    radial-gradient(circle at 15% 15%, var(--theme-grad1) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, var(--theme-grad2) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 65%);
  transition: background 0.4s ease;
}

/* Cam efekti (Glassmorphism) */
.glass-panel {
  background: rgba(15, 25, 32, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.glass-card {
  background: linear-gradient(165deg, rgba(18, 30, 38, 0.94) 0%, rgba(10, 18, 24, 0.98) 100%);
  border: 1px solid var(--theme-border);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.65), 0 0 25px -5px var(--theme-glow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* =========================================================================
   TEMA UYUMLU ANA BUTONLAR (PRIMARY ACTION BUTTONS)
   ========================================================================= */

.btn-theme-primary {
  background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary) 50%, var(--theme-secondary) 100%) !important;
  color: #020617 !important;
  box-shadow: 0 10px 25px -5px var(--theme-glow), 0 8px 10px -6px var(--theme-glow) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-theme-primary:hover {
  filter: brightness(1.1) !important;
  box-shadow: 0 15px 30px -5px var(--theme-glow), 0 10px 15px -5px var(--theme-glow) !important;
}

.btn-theme-primary:active {
  transform: scale(0.98) !important;
}

/* Oyunu Başlat, Hazırım Turu Başlat ve Rövanş Butonları - Her Zaman Temaya Bağlıdır */
#btn-start-match:not(:disabled),
#btn-begin-turn,
#btn-rematch,
#btn-done-theme-modal {
  background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary) 50%, var(--theme-secondary) 100%) !important;
  color: #020617 !important;
  box-shadow: 0 10px 25px -5px var(--theme-glow), 0 8px 10px -6px var(--theme-glow) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#btn-start-match:not(:disabled):hover,
#btn-begin-turn:hover,
#btn-rematch:hover,
#btn-done-theme-modal:hover {
  filter: brightness(1.1) !important;
  box-shadow: 0 15px 30px -5px var(--theme-glow), 0 10px 15px -5px var(--theme-glow) !important;
}

/* Temaya Göre Dinamik Renk Override'ları (Emerald -> Seçilen Tema) */
body:not(.theme-emerald) .bg-emerald-500 {
  background-color: var(--theme-primary) !important;
}

body:not(.theme-emerald) .hover\:bg-emerald-400:hover {
  background-color: var(--theme-primary-light) !important;
}

body:not(.theme-emerald) .text-emerald-300,
body:not(.theme-emerald) .text-emerald-400 {
  color: var(--theme-primary-light) !important;
}

body:not(.theme-emerald) .bg-emerald-500\/20,
body:not(.theme-emerald) .bg-emerald-500\/10 {
  background-color: var(--theme-badge-bg) !important;
}

body:not(.theme-emerald) .border-emerald-500\/30,
body:not(.theme-emerald) .border-emerald-400\/30,
body:not(.theme-emerald) .border-emerald-500\/40,
body:not(.theme-emerald) .hover\:border-emerald-400\/40:hover {
  border-color: var(--theme-border) !important;
}

body:not(.theme-emerald) [class*="from-emerald-400"],
body:not(.theme-emerald) [class*="from-emerald-500"] {
  background-image: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary) 50%, var(--theme-secondary) 100%) !important;
}

body:not(.theme-emerald) .shadow-emerald-500\/25,
body:not(.theme-emerald) .shadow-emerald-500\/30,
body:not(.theme-emerald) .shadow-emerald-500\/20 {
  box-shadow: 0 10px 25px -5px var(--theme-glow) !important;
}


/* =========================================================================
   ANİMASYONLAR VE EFEKTLER
   ========================================================================= */

@keyframes cardPopIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flashCorrect {
  0% {
    box-shadow: 0 0 0 0 var(--theme-primary);
    border-color: var(--theme-primary-light);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.65);
    border-color: var(--theme-border);
    transform: scale(1);
  }
}

@keyframes shakeTabu {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-1.2deg); border-color: rgba(244, 63, 94, 0.95); }
  40% { transform: translateX(10px) rotate(1.2deg); }
  60% { transform: translateX(-7px) rotate(-0.6deg); }
  80% { transform: translateX(7px) rotate(0.6deg); }
}

@keyframes swipePass {
  0% {
    opacity: 0.4;
    transform: translateX(18px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes pulseUrgent {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 20px 4px rgba(244, 63, 94, 0.45);
  }
}

@keyframes modalFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.anim-modal-in {
  animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-card-enter {
  animation: cardPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-card-correct {
  animation: flashCorrect 0.36s ease-out forwards;
}

.anim-card-tabu {
  animation: shakeTabu 0.38s ease-in-out forwards;
}

.anim-card-pass {
  animation: swipePass 0.24s ease-out forwards;
}

.timer-urgent {
  animation: pulseUrgent 0.8s infinite ease-in-out;
}

/* Özel Kaydırma Çubuğu */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--theme-border);
  border-radius: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--theme-primary-light);
}

/* Aktif Buton Dokunma Hissi */
.btn-press {
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn-press:active:not(:disabled) {
  transform: scale(0.96);
}

/* Konfeti Parçacıkları */
@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: 60;
  pointer-events: none;
  animation: confettiFall linear forwards;
}

/* =========================================================================
   ÖZEL OYUN MODLARI & BİYOLOJİ UNVANLARI ANİMASYONLARI
   ========================================================================= */

/* Enzim Kombo Canlı Parıltı */
@keyframes enzymeGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), inset 0 0 10px rgba(245, 158, 11, 0.2);
    border-color: rgba(251, 191, 36, 0.6);
  }
  50% {
    box-shadow: 0 0 28px rgba(249, 115, 22, 0.7), inset 0 0 18px rgba(249, 115, 22, 0.35);
    border-color: rgba(249, 115, 22, 0.9);
  }
}

.enzyme-active-glow {
  animation: enzymeGlow 1.2s infinite ease-in-out;
}

@keyframes comboBounce {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.anim-combo-bounce {
  animation: comboBounce 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Mutasyon Çarkı Dönüş Animasyonu */
@keyframes wheelSpin {
  0% { transform: rotate(0deg) scale(0.95); }
  50% { transform: rotate(540deg) scale(1.08); }
  100% { transform: rotate(1080deg) scale(1); }
}

.anim-wheel-spin {
  animation: wheelSpin 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Biyoloji Unvan Kartı Işıltı */
@keyframes titleShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.badge-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.22) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: titleShimmer 2.4s infinite;
}



/* Mobil Safe Zone (iPhone Dynamic Island, Çentik & Android Navigation) */
.safe-area-container {
  padding-top: max(env(safe-area-inset-top, 0px), 52px) !important;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 24px) !important;
  padding-left: max(env(safe-area-inset-left, 0px), 12px) !important;
  padding-right: max(env(safe-area-inset-right, 0px), 12px) !important;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .safe-area-container {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

.safe-bottom-padding {
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 28px) !important;
}

