/* ==========================================================================
   Türkiye 81 İl Harita & İpucu Öğrenme Oyunu - Mobil Uyumlu Stil Dosyası
   ========================================================================== */

:root {
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-gradient: linear-gradient(135deg, #f0f7ff 0%, #e0eefd 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --map-water: #cce4f7;
  --map-land: #ffffff;
  --map-stroke: #94a3b8;
  --map-hover: #fef08a;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text-dark);
  background: var(--bg-gradient);
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Mobile viewport height fix */
  position: relative;
}

/* ==========================================================================
   ÜST BAŞLIK & SKOR ÇUBUĞU (HEADER)
   ========================================================================== */
header.app-header {
  height: 60px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.logo-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.mode-selector {
  position: relative;
}

.mode-select-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 700;
}

.stat-score { color: #d97706; }
.stat-streak { color: #ef4444; }
.stat-solved { color: #059669; }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #f1f5f9;
  transform: scale(1.05);
}

/* ==========================================================================
   HARİTA ALANI (MAP CONTAINER)
   ========================================================================== */
#map-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #d8ecff 0%, #b8ddfb 100%);
  touch-action: none;
  cursor: grab;
}

#map-viewport:active {
  cursor: grabbing;
}

#svg-turkiye-haritasi {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG İl Katmanları */
#turkiye g[data-iladi] {
  cursor: pointer;
  transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease;
}

#turkiye g[data-iladi] path {
  fill: var(--map-land);
  stroke: var(--map-stroke);
  stroke-width: 0.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Hover & Aktif Vurgusu */
#turkiye g[data-iladi]:hover path,
#turkiye g[data-iladi].hovered path {
  fill: var(--map-hover);
  stroke: #eab308;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 3px rgba(234, 179, 8, 0.4));
}

/* Doğru Bilinen İl */
#turkiye g[data-iladi].solved path {
  fill: #a7f3d0 !important;
  stroke: #059669 !important;
  stroke-width: 1.2;
}

/* Anlık Doğru Cevap Animasyonu */
#turkiye g[data-iladi].pulse-success path {
  fill: #34d399 !important;
  stroke: #059669 !important;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 10px #10b981);
}

/* Yanlış Tıklama Animasyonu */
#turkiye g[data-iladi].pulse-wrong path {
  fill: #fecaca !important;
  stroke: #dc2626 !important;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 8px #ef4444);
}

/* Harita İpucu Vurgusu (Yanıp Sönen İpucu) */
#turkiye g[data-iladi].hint-highlight path {
  animation: hintBlink 1.2s infinite alternate;
}

@keyframes hintBlink {
  0% {
    fill: #fef08a;
    stroke: #eab308;
    stroke-width: 1.5;
  }
  100% {
    fill: #fde047;
    stroke: #ca8a04;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.7));
  }
}

/* Bölge Dışı İller (Bölge Filtresi Açıkken) */
#turkiye g[data-iladi].region-dimmed path {
  fill: #f1f5f9;
  stroke: #cbd5e1;
  opacity: 0.35;
}

/* Kıbrıs / Sınır Dekoratif */
#kuzey-kibris path {
  fill: #e2e8f0;
  stroke: #94a3b8;
  opacity: 0.6;
}

/* ==========================================================================
   HARİTA ÜZERİ KONTROLLER (ZOOM BUTONLARI & BÖLGE ETİKETİ)
   ========================================================================== */
.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.map-ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: white;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.map-ctrl-btn:active {
  transform: scale(0.92);
  background: #f1f5f9;
}

.active-region-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  display: none;
  align-items: center;
  gap: 6px;
  z-index: 20;
}

/* ==========================================================================
   İPUCU KARTI & ALT PANEL (BOTTOM SHEET)
   ========================================================================== */
.bottom-sheet {
  background: var(--card-bg);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border-top: 2px solid rgba(226, 232, 240, 0.8);
  padding: 14px 18px;
  z-index: 40;
  position: relative;
  max-height: 42vh;
  display: flex;
  flex-direction: column;
  transition: max-height 0.3s ease;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin: 0 auto 10px auto;
}

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

.target-province-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #93c5fd;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.12);
  flex: 1;
  min-width: 220px;
}

.target-badge {
  background: #2563eb;
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.target-title-group {
  display: flex;
  flex-direction: column;
}

.target-subtext {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.target-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.target-name-wrap strong {
  font-size: 1.25rem;
  font-weight: 900;
  color: #1e3a8a;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.target-plate-pill {
  background: #1e293b;
  color: white;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
}

.btn-speak {
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  background: white;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  flex-shrink: 0;
}

.btn-speak:hover {
  background: #dbeafe;
}

.clue-header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-toggle-group {
  display: flex;
  gap: 4px;
}

.stars-badge {
  background: #fef3c7;
  color: #b45309;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #fde68a;
}

/* İpucu İçerik Alanı */
.clue-body {
  overflow-y: auto;
  max-height: 180px;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clue-card {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #334155;
}

.clue-card.level-1 {
  border-left-color: #3b82f6;
  background: #eff6ff;
}

.clue-card.level-2 {
  border-left-color: #8b5cf6;
  background: #f5f3ff;
}

.clue-card.level-3 {
  border-left-color: #ec4899;
  background: #fdf2f8;
}

.clue-card.taktik-card {
  border-left-color: #f59e0b;
  background: #fffbeb;
  font-weight: 600;
}

.clue-card-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.clue-card.level-1 .clue-card-label { color: #2563eb; }
.clue-card.level-2 .clue-card-label { color: #7c3aed; }
.clue-card.level-3 .clue-card-label { color: #db2777; }
.clue-card.taktik-card .clue-card-label { color: #d97706; }

/* Geri Bildirim Mesajı */
.feedback-banner {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  animation: slideInUp 0.25s ease;
}

.feedback-banner.success {
  display: flex;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.feedback-banner.wrong {
  display: flex;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

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

/* Aksiyon Butonları */
.action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.86rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #cbd5e1;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   KEŞİF MODU KARTI (EXPLORE CARD)
   ========================================================================== */
.explore-modal {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.18);
  border: 2px solid #e2e8f0;
  padding: 16px;
  z-index: 60;
  display: none;
  animation: slideInUp 0.25s ease;
}

.explore-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.explore-title-wrap h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.explore-title-wrap p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.explore-close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.explore-content {
  font-size: 0.88rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.explore-item {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.explore-item strong {
  color: #1e293b;
}

/* ==========================================================================
   MODAL PENCERELER (BÖLGE SEÇİMİ, YARDIM, TEBRİKLER)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes modalScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
}

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

.region-btn {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.region-btn:hover, .region-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary-dark);
}

.region-btn span.count {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   CONFETTI CANVAS
   ========================================================================== */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* ==========================================================================
   MOBİL İYİLEŞTİRMELERİ & YATAY EKRAN
   ========================================================================== */
@media (max-width: 480px) {
  header.app-header {
    padding: 6px 10px;
    height: 54px;
  }

  .logo-badge {
    font-size: 0.8rem;
    padding: 4px 9px;
  }

  .stat-pill {
    padding: 3px 8px;
    font-size: 0.76rem;
  }

  .bottom-sheet {
    padding: 10px 14px;
    max-height: 48vh;
  }

  .clue-title {
    font-size: 0.96rem;
  }

  .clue-card {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

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

/* Yatay Ekran (Landscape) Modunda Ergonomi */
@media (orientation: landscape) and (max-height: 520px) {
  #app-container {
    flex-direction: row;
  }

  header.app-header {
    display: none; /* Mobilde yatay çevirince haritaya maksimum alan bırakılır */
  }

  #map-viewport {
    flex: 1.4;
  }

  .bottom-sheet {
    flex: 1;
    max-height: 100vh;
    border-radius: 0;
    border-left: 2px solid #e2e8f0;
    overflow-y: auto;
  }

  .sheet-handle {
    display: none;
  }
}
