/* === DYNAMIC TIME STATES === */
[data-time="witching"] {
  --bg: #020004;
  --panel: rgba(8, 2, 18, 0.82);
  --hot: #c94dff;
  --violet: #7a20cc;
  --lavender: #c88aff;
  --text: #b070dd;
  --muted: #6e3d8a;
}

[data-time="witching"] body {
  filter: saturate(0.8) brightness(0.85);
}

[data-time="sunrise"] {
  --hot: #ff7bac;
  --violet: #cc5599;
  --lavender: #ffc4dd;
  --text: #e8a0c4;
  --muted: #a06080;
}

[data-time="sunrise"] body {
  background:
    radial-gradient(circle at 50% 80%, rgba(255, 140, 180, 0.2), transparent 40rem),
    radial-gradient(circle at 80% 60%, rgba(255, 200, 140, 0.12), transparent 30rem),
    linear-gradient(180deg, #0a0008 0%, #1a0520 48%, #080010 100%);
}

[data-time="storm"] {
  --hot: #00ffcc;
  --line: rgba(0, 255, 180, 0.5);
  --line-dim: rgba(0, 200, 160, 0.24);
}

[data-time="storm"] .noise { opacity: 0.12; }
[data-time="storm"] .scanlines { opacity: 0.3; }

/* === CURSOR FOLLOWERS === */
.cursor-follower {
  position: fixed;
  pointer-events: none;
  z-index: 90;
  will-change: transform;
  transition: opacity 0.3s;
}

.follower-moth {
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, var(--hot), transparent);
  border-radius: 50%;
  opacity: 0.6;
  animation: mothFloat 2s ease-in-out infinite;
}

.follower-spirit {
  width: 6px;
  height: 6px;
  background: rgba(229, 163, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(229, 163, 255, 0.4);
}

.follower-feather {
  width: 3px;
  height: 10px;
  background: linear-gradient(var(--hot), transparent);
  border-radius: 2px;
  opacity: 0.4;
}

@keyframes mothFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.2); }
}

/* === STATUS WIDGET === */
.status-widget {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  backdrop-filter: blur(12px);
  cursor: default;
  transition: border-color 300ms, opacity 300ms;
  opacity: 0.7;
}

.status-widget:hover { opacity: 1; border-color: var(--line); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 8px var(--hot);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === WEATHER WIDGET === */
.weather-widget {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 80;
  padding: 8px 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  backdrop-filter: blur(12px);
  opacity: 0.7;
  transition: opacity 300ms, border-color 300ms;
}

.weather-widget:hover { opacity: 1; border-color: var(--line); }

.weather-icon { margin-right: 6px; color: var(--hot); }

/* === FIGHTING FOR === */
.fighting-for {
  position: fixed;
  top: 50%;
  right: -8px;
  z-index: 78;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: right center;
  font-size: 0.65rem;
  color: rgba(154, 91, 183, 0.35);
  letter-spacing: 0.18em;
  text-transform: lowercase;
  pointer-events: none;
  white-space: nowrap;
  transition: color 2s ease;
}

/* === FAKE ERROR POPUPS === */
.fake-popup {
  position: fixed;
  z-index: 200;
  width: 320px;
  background: #1a0428;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(185, 50, 255, 0.2);
  animation: popupIn 0.3s ease-out;
  font-size: 0.82rem;
}

.fake-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(164, 51, 255, 0.12);
  border-bottom: 1px solid var(--line-dim);
}

.fake-popup-header span {
  color: var(--lavender);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fake-popup-close {
  width: 20px;
  height: 20px;
  background: none;
  border: 1px solid var(--line-dim);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 200ms, color 200ms;
}

.fake-popup-close:hover { border-color: var(--hot); color: var(--hot); }

.fake-popup-body {
  padding: 16px 14px;
  color: var(--muted);
  line-height: 1.5;
}

.fake-popup-body .popup-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
  text-shadow: 0 0 12px var(--hot);
}

.fake-popup-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line-dim);
  text-align: right;
}

.fake-popup-footer button {
  padding: 6px 16px;
  background: rgba(164, 51, 255, 0.15);
  border: 1px solid var(--line-dim);
  color: var(--lavender);
  font-size: 0.72rem;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 200ms;
}

.fake-popup-footer button:hover { background: rgba(242, 77, 255, 0.25); }

@keyframes popupIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === BACKGROUND CAT EYES === */
.bg-eyes {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-eye-pair {
  position: absolute;
  display: flex;
  gap: 6px;
}

.bg-eye {
  width: 4px;
  height: 6px;
  background: rgba(242, 77, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(242, 77, 255, 0.4);
  animation: eyeBlink 4s ease-in-out infinite;
}

@keyframes eyeBlink {
  0%, 85%, 100% { transform: scaleY(1); opacity: 1; }
  88% { transform: scaleY(0.1); opacity: 0.5; }
  91% { transform: scaleY(1); opacity: 1; }
}

/* === POSSESSION EVENT === */
.possessed {
  animation: possession 0.5s ease-in-out;
}

@keyframes possession {
  0% { filter: none; }
  20% { filter: hue-rotate(180deg) saturate(2); }
  40% { filter: invert(0.1) hue-rotate(90deg); }
  60% { filter: hue-rotate(270deg) brightness(1.2); }
  80% { filter: saturate(0.5) hue-rotate(45deg); }
  100% { filter: none; }
}

.glitch-text {
  animation: glitchText 0.3s steps(2) infinite;
}

@keyframes glitchText {
  0% { text-shadow: 2px 0 var(--hot), -2px 0 cyan; clip-path: inset(20% 0 40% 0); }
  50% { text-shadow: -2px 0 var(--hot), 2px 0 cyan; clip-path: inset(60% 0 10% 0); }
  100% { text-shadow: 1px 0 var(--hot), -1px 0 cyan; clip-path: inset(40% 0 20% 0); }
}

/* === DESKTOP MODE BUTTON === */
.desktop-trigger {
  position: fixed;
  top: 50%;
  left: 16px;
  z-index: 80;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-strong);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 300ms, border-color 300ms, color 300ms;
}

.desktop-trigger:hover {
  opacity: 1;
  border-color: var(--line);
  color: var(--hot);
}

/* === ENHANCED HOVER STATES === */
.panel {
  --mx: 50%;
  --my: 50%;
}

/* === IDLE ANIMATIONS === */
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes subtlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes tailFlick {
  0%, 80%, 100% { transform: rotate(0deg); }
  85% { transform: rotate(8deg); }
  90% { transform: rotate(-5deg); }
  95% { transform: rotate(3deg); }
}

.doodle-cat { animation: tailFlick 5s ease-in-out infinite; }
.obsession-icon { animation: gentleFloat 4s ease-in-out infinite; }
.footer-icon { animation: subtlePulse 3s ease-in-out infinite; }

/* === SURVIVOR BANNER === */
.survivor-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 85;
  padding: 8px 24px;
  background: rgba(255, 123, 172, 0.1);
  border: 1px solid rgba(255, 123, 172, 0.3);
  border-radius: var(--radius);
  color: #ffc4dd;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  backdrop-filter: blur(8px);
  animation: fadeUp 1s ease-out;
  pointer-events: none;
}

/* === NAV ENHANCEMENTS === */
.nav-link {
  position: relative;
}

.nav-link:hover {
  text-shadow: 0 0 8px var(--hot);
}

/* === CAT CHAT BUBBLE === */
.cat-chat {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 180;
  max-width: 240px;
  padding: 12px 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--lavender);
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: popupIn 0.3s ease-out;
  cursor: pointer;
}

.cat-chat::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: var(--panel-strong);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.cat-chat-name {
  display: block;
  color: var(--hot);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

/* === HIDDEN CAT COLLECTIBLE === */
.hidden-cat {
  position: absolute;
  font-size: 0.9rem;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.5s;
  z-index: 75;
}

.hidden-cat:hover { opacity: 1 !important; }
.hidden-cat.found { opacity: 0.6; color: var(--hot); text-shadow: 0 0 8px var(--hot); }

/* === STORM EFFECTS === */
[data-time="storm"] .hero-image img {
  animation: stormFlicker 0.1s steps(1) infinite;
}

@keyframes stormFlicker {
  0%, 95% { filter: none; }
  96% { filter: brightness(1.8) contrast(1.2); }
  97% { filter: brightness(0.6); }
  98% { filter: brightness(1.4) hue-rotate(10deg); }
  100% { filter: none; }
}

/* === GUESTBOOK LINK === */
.nav-extras {
  display: none;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-dim);
  flex-wrap: wrap;
  width: 100%;
}

.nav-extras a {
  padding: 4px 10px;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color 200ms, border-color 200ms;
}

.nav-extras a:hover { color: var(--hot); border-color: var(--line); }

@media (max-width: 768px) {
  .nav-extras { display: flex; }

  /* Hide desktop-only trigger on mobile */
  .desktop-trigger { display: none; }

  /* Stack fixed widgets so they don't overlap */
  .status-widget {
    bottom: 8px; left: 8px;
    padding: 6px 10px; font-size: 0.65rem;
  }
  .weather-widget {
    bottom: 8px; right: 8px;
    padding: 6px 10px; font-size: 0.65rem;
  }
  .fighting-for { display: none; }
  .cat-chat {
    bottom: 48px; right: 8px; left: 8px;
    max-width: none; font-size: 0.75rem;
  }
  .fake-popup {
    width: calc(100vw - 32px) !important;
    left: 16px !important;
    top: auto !important;
    bottom: 48px;
    max-width: 320px;
  }
  .survivor-banner { top: 56px; font-size: 0.68rem; padding: 6px 16px; }
  .bg-eye { animation-duration: 6s; }
}
