/* Temel reset kuralları, renk değişkenleri, arka plan tuvali, ateş böcekleri, giriş ekranı ve orta widget stilleri */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --outer-bg-dark: #0a0f1a;
  --glass-bg: rgba(20, 25, 44, 0.52);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --star-gold: #ffe484;
  --star-glow: rgba(255, 224, 116, 0.85);
  --apple-blue: #0a84ff;
  --apple-green: #30d158;
  --apple-red: #ff453a;
  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(235, 235, 245, 0.68);
  --text-tertiary: rgba(235, 235, 245, 0.44);
  --spring-easing: cubic-bezier(0.22, 1.15, 0.36, 1);
  --smooth-easing: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sayfa gövdesi ve derin gece mavisi dış arka plan */
html, body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--outer-bg-dark);
  background-image:
    radial-gradient(circle at 50% 15%, #131d36 0%, #0a0f1a 60%, #060911 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* Gizli katmanların ve buton ikonlarının tıklamaları engellemesini önler */
.login-overlay.fade-out,
.login-overlay.fade-out *,
.feature-panel.hidden,
.feature-panel.hidden *,
.cat-room-overlay.hidden,
.cat-room-overlay.hidden *,
.card-overlay.hidden,
.card-overlay.hidden *,
.memory-lightbox.hidden,
.memory-lightbox.hidden * {
  pointer-events: none !important;
}

.dock-action-btn svg,
.stage-play-btn svg,
.cat-mode-btn svg,
.close-btn svg,
.cat-room-close-btn svg,
.feature-panel-close svg,
.memory-lightbox-close svg,
.dev-toggle-btn svg {
  pointer-events: none;
}

/* Tam ekran şifre giriş katmanı */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: radial-gradient(circle at 50% 25%, #141f3d 0%, #090d18 65%, #05070d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.55s var(--smooth-easing);
}

.login-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 390px;
  padding: 42px 34px 36px;
  border-radius: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-star-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 228, 132, 0.14);
  border: 1px solid rgba(255, 228, 132, 0.38);
  color: var(--star-gold);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 0 24px rgba(255, 224, 116, 0.28);
}

.login-hint-title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 22px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input {
  width: 100%;
  padding: 15px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  text-align: center;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.login-input::placeholder {
  color: var(--text-tertiary);
}

.login-input:focus {
  border-color: var(--star-gold);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 0 0 4px rgba(255, 228, 132, 0.15);
}

.login-error-msg {
  font-size: 13px;
  font-weight: 500;
  color: var(--apple-red);
  margin: -2px 0 2px;
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.login-card.shake {
  animation: shakeCard 0.4s ease;
}

/* Havada asılı ana cam tuval */
.floating-canvas {
  position: relative;
  width: 95%;
  max-width: 1400px;
  height: 90vh;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
}

.floating-canvas.admin-canvas {
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.floating-canvas.admin-canvas::-webkit-scrollbar {
  display: none;
}

/* Yıldızlı Gece arka plan katmanları */
.sky-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.admin-canvas .sky-backdrop {
  position: fixed;
  width: 95%;
  max-width: 1400px;
  height: 90vh;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 30px;
}

.painting-layer {
  position: absolute;
  inset: 0;
  background-image:
    url("../assets/starry-night.jpg"),
    url("https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg/1920px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg");
  background-size: cover;
  background-position: center;
  filter: saturate(1.12) contrast(1.05) brightness(0.84);
  transform: scale(1.02);
  pointer-events: none;
  transition: filter 1.2s var(--smooth-easing), transform 1.8s var(--smooth-easing);
}

body.stage-mode .painting-layer {
  filter: saturate(1.26) contrast(1.06) brightness(0.96);
  transform: scale(1);
}

.canvas-glass-tint {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(10, 15, 26, 0.16) 0%, rgba(8, 12, 24, 0.5) 100%),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: opacity 1s var(--smooth-easing);
}

body.stage-mode .canvas-glass-tint {
  opacity: 0.2;
}

/* Gökyüzü ateş böcekleri */
.stars-container {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.firefly {
  --drift-x: 15px;
  --drift-y: -15px;
  --drift-x-alt: -12px;
  --drift-y-alt: 14px;
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: none;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  will-change: transform, opacity;
  transition:
    filter 0.35s ease,
    box-shadow 0.35s ease;
}

.firefly.locked {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  animation: none !important;
}

.firefly.unlocked {
  display: block;
  position: absolute;
  z-index: 20;
  pointer-events: auto;
  background: radial-gradient(circle, #fffef8 0%, #ffe66d 50%, #ffae00 100%);
  box-shadow:
    0 0 12px 4px rgba(255, 232, 120, 0.95),
    0 0 28px 9px rgba(255, 204, 51, 0.6),
    0 0 46px 14px rgba(255, 180, 30, 0.32);
  animation-name: float, glow;
  animation-timing-function: ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite;
  animation-direction: alternate, alternate;
}

.firefly.unlocked.current-day-star {
  width: 9px;
  height: 9px;
  box-shadow:
    0 0 16px 6px #fff6b3,
    0 0 38px 12px rgba(255, 224, 102, 0.85),
    0 0 60px 18px rgba(255, 196, 46, 0.45);
}

.firefly::after {
  content: attr(data-label);
  position: absolute;
  bottom: 200%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 19, 34, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.firefly.unlocked:hover {
  filter: brightness(1.3);
  box-shadow:
    0 0 20px 7px #fff8c4,
    0 0 44px 14px rgba(255, 214, 92, 0.85);
}

.firefly.unlocked:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes glow {
  0% {
    opacity: 0.32;
    box-shadow:
      0 0 6px 2px rgba(255, 232, 120, 0.45),
      0 0 14px 4px rgba(255, 204, 51, 0.22);
  }
  50% {
    opacity: 0.78;
    box-shadow:
      0 0 12px 4px rgba(255, 232, 120, 0.85),
      0 0 26px 8px rgba(255, 204, 51, 0.5);
  }
  100% {
    opacity: 1;
    box-shadow:
      0 0 16px 5px rgba(255, 240, 150, 1),
      0 0 34px 12px rgba(255, 204, 51, 0.72),
      0 0 52px 16px rgba(255, 180, 30, 0.38);
  }
}

@keyframes float {
  0% {
    transform: translate3d(-50%, -50%, 0) translate3d(0px, 0px, 0) scale(0.92);
  }
  33% {
    transform: translate3d(-50%, -50%, 0) translate3d(var(--drift-x), var(--drift-y), 0) scale(1.08);
  }
  66% {
    transform: translate3d(-50%, -50%, 0) translate3d(var(--drift-x-alt), var(--drift-y), 0) scale(0.96);
  }
  100% {
    transform: translate3d(-50%, -50%, 0) translate3d(var(--drift-x-alt), var(--drift-y-alt), 0) scale(1.1);
  }
}

/* Ortak Apple Frosted Glass yardımcıları */
.glass-card {
  background: rgba(16, 22, 42, 0.8);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(20, 25, 44, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: all 0.35s var(--smooth-easing);
}

.star-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--star-gold);
  box-shadow: 0 0 10px var(--star-gold);
}

/* Ana ekran orta sayac widget'ı */
.main-stage {
  position: relative;
  z-index: 10;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 108px 24px 12px;
  pointer-events: none;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: opacity, transform;
  transition:
    opacity 0.65s var(--smooth-easing),
    transform 0.65s var(--smooth-easing);
}

.hero-widget {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 430px;
  padding: 44px 38px 38px;
  border-radius: 34px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.widget-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.day-title {
  font-size: 66px;
  font-weight: 200;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.day-status-text {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 300px;
  margin-bottom: 28px;
}

.countdown-wrapper {
  width: 100%;
  padding: 16px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 26px;
}

.countdown-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.countdown-timer {
  font-size: 28px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.apple-primary-btn {
  position: relative;
  z-index: 9999;
  pointer-events: auto;
  width: 100%;
  padding: 16px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 242, 250, 0.88) 100%);
  color: #0b1021;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.35s var(--spring-easing), box-shadow 0.35s ease, opacity 0.25s ease;
}

.apple-primary-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.apple-primary-btn:hover:not(:disabled) {
  transform: scale(1.025);
  box-shadow: 0 16px 34px rgba(255, 228, 132, 0.24);
}

.apple-primary-btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Sahne modu gizleme geçişleri */
body.stage-mode {
  cursor: pointer;
}

body.stage-mode #main-ui,
body.stage-mode #timeline-bar,
body.stage-mode #dev-control-panel,
body.stage-mode #admin-control-panel,
body.stage-mode #memories-panel {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate3d(0, 16px, 0) scale(0.97);
}

/* Temel düzen mobil uyumluluğu */
@media (max-width: 768px) {
  html, body {
    padding: 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .floating-canvas {
    width: 100%;
    max-width: 100%;
    height: calc(100dvh - 8px);
    border-radius: 20px;
  }

  .firefly {
    width: 5px;
    height: 5px;
  }

  .firefly.unlocked {
    box-shadow:
      0 0 8px 2px rgba(255, 232, 120, 0.9),
      0 0 18px 6px rgba(255, 204, 51, 0.55);
  }

  .firefly.unlocked.current-day-star {
    width: 7px;
    height: 7px;
  }

  .main-stage {
    padding: 136px 16px 12px;
  }

  .hero-widget {
    max-width: 100%;
    padding: 32px 22px 28px;
    border-radius: 28px;
  }

  .day-title {
    font-size: 50px;
  }

  .day-status-text {
    font-size: 14px;
    margin-bottom: 22px;
  }

  .countdown-wrapper {
    padding: 14px 16px;
    margin-bottom: 22px;
  }

  .countdown-timer {
    font-size: 24px;
  }
}
