/* ==========================================================================
   PRIVATE RETREAT — retrowave design tokens
   ========================================================================== */
:root {
  --bg-void: #140a26;
  --bg-deep: #1a0b2e;
  --bg-mid: #2d1145;
  --bg-panel: #241239;
  --grid-cyan: #00f0ff;
  --hot-pink: #ff2fa0;
  --soft-pink: #ff8fd6;
  --sunset-orange: #ff9a3c;
  --sun-yellow: #ffe580;
  --lilac: #b892ff;
  --text-hi: #fdf3ff;
  --text-lo: #c9b6e8;
  --shadow-glow: 0 0 24px rgba(255, 47, 160, 0.35);
  --radius-window: 18px;
  --font-display: "Press Start 2P", monospace;
  --font-body: "Space Grotesk", "Poppins", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-hi);
  background: var(--bg-void);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

a { color: inherit; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

/* Scanline / CRT overlay — signature atmosphere layer */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0px,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}
.crt-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 499;
  box-shadow: inset 0 0 18vw rgba(0, 0, 0, 0.65);
}

/* ==========================================================================
   HERO — animated retrowave horizon
   ========================================================================== */
.hero {
  position: relative;
  height: min(58vh, 460px);
  min-height: 320px;
  overflow: hidden;
  background: linear-gradient(
    to bottom,
    var(--bg-deep) 0%,
    #4a1568 45%,
    #d6336c 72%,
    var(--sunset-orange) 100%
  );
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hero .stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 25% 30%, #fff, transparent),
    radial-gradient(1px 1px at 40% 10%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 20%, #fff, transparent),
    radial-gradient(1px 1px at 75% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 25%, #fff, transparent),
    radial-gradient(1px 1px at 15% 45%, #fff, transparent),
    radial-gradient(1px 1px at 85% 40%, #fff, transparent);
  opacity: 0.8;
}

.hero .sun {
  position: absolute;
  left: 50%;
  top: 34%;
  width: min(34vw, 260px);
  height: min(34vw, 260px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: repeating-linear-gradient(
    to bottom,
    var(--sun-yellow) 0px,
    var(--sun-yellow) 8%,
    transparent 8%,
    transparent 13%
  ), linear-gradient(to bottom, var(--sun-yellow), var(--hot-pink) 70%);
  box-shadow: 0 0 60px 10px rgba(255, 95, 158, 0.55);
  animation: sun-rise 8s ease-in-out infinite alternate;
}

@keyframes sun-rise {
  from { transform: translate(-50%, -50%) translateY(0); }
  to   { transform: translate(-50%, -50%) translateY(-10px); }
}

.hero .horizon-grid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 46%;
  background-image:
    linear-gradient(to top, var(--grid-cyan) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-cyan) 1px, transparent 1px);
  background-size: 100% 12%, 8% 100%;
  background-position: 0 0, center 0;
  opacity: 0.75;
  transform: perspective(220px) rotateX(45deg);
  transform-origin: bottom;
  animation: grid-scroll 3.5s linear infinite;
}

@keyframes grid-scroll {
  from { background-position: 0 0, center 0; }
  to   { background-position: 0 12%, center 0; }
}

.hero .palm {
  position: absolute;
  bottom: 0;
  width: 90px;
  height: 220px;
  opacity: 0.95;
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.4));
}
.hero .palm.left { left: 2%; }
.hero .palm.right { right: 2%; transform: scaleX(-1); }

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-bottom: 28px;
  width: 100%;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4vw, 2.1rem);
  letter-spacing: 2px;
  margin: 0;
  color: var(--text-hi);
  text-shadow:
    0 0 6px var(--hot-pink),
    3px 3px 0 var(--grid-cyan),
    -1px -1px 0 rgba(0,0,0,0.4);
}

.hero-tagline {
  margin: 14px 0 0;
  color: var(--text-hi);
  font-size: 0.95rem;
  opacity: 0.9;
}

.hero-clock {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--sun-yellow);
  letter-spacing: 1px;
}

.install-btn {
  margin-top: 18px;
  background: var(--hot-pink);
  border: 2px solid var(--sun-yellow);
  color: var(--text-hi);
  font-family: var(--font-display);
  font-size: 0.65rem;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-glow);
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: auto;
}
.install-btn.visible { display: inline-flex; }
.install-btn:hover { background: #ff56b3; }

/* ==========================================================================
   DESKTOP — grid of app icons
   ========================================================================== */
.desktop {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: -40px auto 0;
  padding: 0 20px 60px;
}

.desktop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
}

.app-icon {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-mid));
  border: 2px solid rgba(184, 146, 255, 0.35);
  border-radius: var(--radius-window);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  color: var(--text-hi);
}

.app-icon:hover, .app-icon:focus-visible {
  transform: translateY(-4px);
  border-color: var(--grid-cyan);
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.25);
  outline: none;
}

.app-icon .glyph {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--icon-bg, linear-gradient(135deg, var(--hot-pink), var(--lilac)));
  box-shadow: 0 0 16px rgba(255, 47, 160, 0.4);
}

.app-icon .label {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
}

.app-icon .sublabel {
  font-size: 0.65rem;
  color: var(--text-lo);
}

/* ==========================================================================
   WINDOW MANAGER — floating retro-OS windows
   ========================================================================== */
.window-layer {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 4, 20, 0.72);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.window-layer.open { display: flex; }

.app-window {
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  background: var(--bg-panel);
  border: 2px solid var(--lilac);
  border-radius: var(--radius-window);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: window-pop 0.18s ease-out;
}

@keyframes window-pop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--hot-pink), var(--lilac));
}

.window-titlebar .title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 1px;
}

.window-dots { display: flex; gap: 7px; }
.window-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  display: inline-block;
}

.window-close {
  background: rgba(0,0,0,0.25);
  border: none;
  color: var(--text-hi);
  font-family: var(--font-display);
  font-size: 0.7rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.window-close:hover { background: rgba(0,0,0,0.45); }

.window-body {
  padding: 20px;
  overflow-y: auto;
  color: var(--text-hi);
}

.window-body h3 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--sun-yellow);
}

.window-body p {
  color: var(--text-lo);
  line-height: 1.5;
  font-size: 0.9rem;
}

/* ==========================================================================
   Shared widget bits
   ========================================================================== */
.pill-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.pill-tabs button {
  flex: 1;
  background: var(--bg-mid);
  border: 1px solid rgba(184,146,255,0.4);
  color: var(--text-lo);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-tabs button.active {
  background: var(--hot-pink);
  color: var(--text-hi);
  border-color: var(--hot-pink);
}

.note-box {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-lo);
  line-height: 1.45;
  margin-bottom: 14px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-mid);
  border: 1px solid rgba(184,146,255,0.3);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.link-card:hover { border-color: var(--grid-cyan); transform: translateX(3px); }
.link-card .emoji { font-size: 1.4rem; }
.link-card .meta strong { display: block; font-size: 0.85rem; }
.link-card .meta span { font-size: 0.72rem; color: var(--text-lo); }

/* Music player */
.music-stream-box {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(184,146,255,0.3);
}
#yt-embed-wrap iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 10px;
}
.rp-player {
  display: flex;
  align-items: center;
  gap: 14px;
}
.rp-play-btn {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 2px solid var(--sun-yellow);
  background: linear-gradient(135deg, var(--hot-pink), var(--lilac));
  color: var(--text-hi);
  font-size: 1.2rem;
  flex-shrink: 0;
}
.rp-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  flex: 1;
}
.rp-bars span {
  width: 4px;
  background: var(--grid-cyan);
  border-radius: 2px;
  animation: bar-bounce 0.9s ease-in-out infinite;
  height: 20%;
}
.rp-bars span:nth-child(1){ animation-delay: 0s; }
.rp-bars span:nth-child(2){ animation-delay: .1s; }
.rp-bars span:nth-child(3){ animation-delay: .2s; }
.rp-bars span:nth-child(4){ animation-delay: .3s; }
.rp-bars span:nth-child(5){ animation-delay: .4s; }
.rp-bars span:nth-child(6){ animation-delay: .5s; }
.rp-bars span:nth-child(7){ animation-delay: .6s; }
.rp-bars.paused span { animation-play-state: paused; height: 15%; }

@keyframes bar-bounce {
  0%, 100% { height: 15%; }
  50% { height: 90%; }
}

.rp-meta { font-size: 0.72rem; color: var(--text-lo); margin-top: 8px; }
.mini-player-dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  background: var(--bg-panel);
  border: 1px solid var(--grid-cyan);
  border-radius: 999px;
  padding: 8px 16px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.mini-player-dock.visible { display: flex; }
.mini-player-dock button {
  background: none; border: none; color: var(--text-hi); font-size: 0.9rem;
}

/* Arcade Breaker */
.arcade-wrap { text-align: center; }
#breaker-canvas {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 3/4;
  background: #0d0518;
  border: 2px solid var(--grid-cyan);
  border-radius: 10px;
  box-shadow: inset 0 0 30px rgba(0,240,255,0.15);
}
.arcade-hud {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.hud-stat span {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: var(--text-lo);
  letter-spacing: 0.5px;
}
.hud-stat strong {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--sun-yellow);
}
.arcade-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
#ab-mute { padding: 8px 12px; }
.retro-btn {
  background: var(--hot-pink);
  border: 2px solid var(--sun-yellow);
  color: var(--text-hi);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 0.65rem;
}
.retro-btn.secondary {
  background: var(--bg-mid);
  border-color: var(--lilac);
}
.arcade-hint {
  font-size: 0.7rem;
  color: var(--text-lo);
  margin-top: 6px;
}

/* Mood wheel */
.mood-wheel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.mood-opt {
  background: var(--bg-mid);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px 4px;
  font-size: 1.6rem;
  text-align: center;
}
.mood-opt.selected {
  border-color: var(--grid-cyan);
  background: rgba(0,240,255,0.12);
}
.mood-opt small {
  display: block;
  font-size: 0.6rem;
  color: var(--text-lo);
  margin-top: 4px;
}
.mood-history {
  font-size: 0.75rem;
  color: var(--text-lo);
  border-top: 1px dashed rgba(184,146,255,0.3);
  padding-top: 12px;
  margin-top: 6px;
}
.mood-history .streak {
  color: var(--sun-yellow);
  font-weight: 700;
}
.mood-log-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Fact of the day */
.fact-box {
  background: linear-gradient(160deg, var(--bg-mid), var(--bg-panel));
  border: 1px solid var(--sun-yellow);
  border-radius: 14px;
  padding: 18px;
  font-size: 0.95rem;
  line-height: 1.55;
}
.fact-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: var(--bg-deep);
  background: var(--sun-yellow);
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

footer.app-footer {
  text-align: center;
  color: var(--text-lo);
  font-size: 0.7rem;
  padding: 20px;
}

@media (max-width: 480px) {
  .app-window { max-height: 92vh; }
  .desktop { margin-top: -28px; }
}
