:root {
  --bg-deep: #05061a;
  --bg-mid: #0d1030;
  --ink: #f2efe9;
  --ink-dim: #b8b4d6;
  --gold: #e8c877;
  --violet: #8a6fd8;
  --nebula-pink: #e8789c;
  --nebula-teal: #5fd6c4;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --glow-gold: rgba(232, 200, 119, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -5%, rgba(138, 111, 216, 0.22), transparent 60%),
    radial-gradient(ellipse 900px 500px at 85% 8%, rgba(232, 120, 156, 0.14), transparent 60%),
    radial-gradient(ellipse at top, var(--bg-mid) 0%, var(--bg-deep) 60%);
  color: var(--ink);
  font-family: 'Georgia', 'Times New Roman', serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

::selection { background: var(--gold); color: #1a1420; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--violet), var(--nebula-pink));
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero, main, footer { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero {
  padding: 100px 24px 70px;
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  height: 400px;
  background: radial-gradient(ellipse at center, var(--glow-gold) 0%, transparent 70%);
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.sw-topline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--sw-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--sw-cyan);
  text-shadow: 0 0 12px rgba(95, 214, 196, 0.25);
  margin-bottom: 16px;
}

.sw-topline-sep { color: var(--ink-dim); opacity: 0.4; }
.sw-topline-weather { color: var(--ink); text-shadow: none; }

.eyebrow {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(3.2rem, 10vw, 6.2rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  background: linear-gradient(115deg, #fff 0%, var(--gold) 35%, var(--nebula-pink) 65%, var(--violet) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
  animation: shimmer-title 9s ease-in-out infinite;
  text-shadow: 0 0 60px rgba(232, 200, 119, 0.25);
}

@keyframes shimmer-title {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.tagline {
  font-style: italic;
  color: var(--ink-dim);
  font-size: 1.1rem;
  margin-bottom: 52px;
  letter-spacing: 0.02em;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.moon-card, .sun-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 22px 28px;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.moon-card:hover, .sun-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232, 200, 119, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(232, 200, 119, 0.12);
}

.moon-visual {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.moon-info { text-align: left; }

.moon-name {
  font-size: 1.1rem;
  color: var(--gold);
}

.moon-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 4px;
}

.sun-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  justify-content: center;
}

.sun-row {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.88rem;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sun-icon { color: var(--gold); font-size: 1rem; }
.sun-row span:last-child { color: var(--ink); font-weight: 600; margin-left: 4px; }

/* ---------- Sections ---------- */
.section-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 70px 24px;
  text-align: center;
  position: relative;
}

main > section:not(:first-child)::before {
  content: '';
  display: block;
  width: min(280px, 60%);
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.4;
}

.sw-banner::before,
.sw-zone::before {
  background: linear-gradient(90deg, transparent, var(--sw-cyan), transparent) !important;
  opacity: 0.35 !important;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.section-glyph {
  background: none;
  -webkit-text-fill-color: var(--gold);
  color: var(--gold);
  margin-right: 10px;
  display: inline-block;
  animation: glyph-pulse 3s ease-in-out infinite;
}

@keyframes glyph-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 12px var(--glow-gold); }
  50% { opacity: 0.6; text-shadow: 0 0 4px transparent; }
}

.section-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-bottom: 36px;
}

/* ---------- Tonight's Sky ---------- */
.sky-tonight {
  background: linear-gradient(180deg, transparent, rgba(138, 111, 216, 0.08), transparent);
}

.sky-blurb {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--ink);
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Zodiac wheel ---------- */
.zodiac-wheel {
  position: relative;
  width: min(480px, 90vw);
  height: min(480px, 90vw);
  margin: 0 auto 40px;
}

.zodiac-wheel::before {
  content: '';
  position: absolute;
  inset: 8%;
  border: 1px dashed rgba(232, 200, 119, 0.18);
  border-radius: 50%;
  animation: wheel-rotate 120s linear infinite;
}

.zodiac-wheel::after {
  content: '';
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(138, 111, 216, 0.15) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

@keyframes wheel-rotate {
  to { transform: rotate(360deg); }
}

.zodiac-sign {
  position: absolute;
  top: 50%; left: 50%;
  width: 68px; height: 68px;
  margin: -34px 0 0 -34px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  backdrop-filter: blur(8px);
}

.zodiac-sign:hover, .zodiac-sign.active {
  transform: scale(1.18);
  background: rgba(232, 200, 119, 0.18);
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(232, 200, 119, 0.35);
}

.zodiac-sign .sign-label {
  position: absolute;
  bottom: -22px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.horoscope-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px 36px;
  min-height: 100px;
  backdrop-filter: blur(12px);
  text-align: left;
  max-width: 640px;
  margin: 0 auto;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.horoscope-panel.lit {
  border-color: rgba(232, 200, 119, 0.35);
  box-shadow: 0 0 50px rgba(232, 200, 119, 0.1), inset 0 0 40px rgba(138, 111, 216, 0.06);
}

.horoscope-placeholder {
  text-align: center;
  color: var(--ink-dim);
  font-style: italic;
}

.horoscope-sign-name {
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 12px;
}

.horoscope-text {
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ---------- SkyWatcher module ---------- */
:root {
  --sw-amber: #ffb454;
  --sw-cyan: #5fd6c4;
  --sw-mono: 'SF Mono', 'Consolas', 'Courier New', monospace;
}

.sw-banner {
  position: relative;
  padding: 50px 24px 30px;
  text-align: center;
  overflow: hidden;
}

.sw-banner-inner { position: relative; }

.sw-wordmark {
  font-family: var(--sw-mono);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--sw-amber);
  text-shadow: 0 0 20px rgba(255, 180, 84, 0.5), 0 0 50px rgba(255, 180, 84, 0.2);
}

.sw-bracket { color: var(--sw-cyan); opacity: 0.8; }

.sw-subline {
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-top: 10px;
}

.sw-scanline {
  width: min(400px, 80%);
  height: 1px;
  margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, var(--sw-cyan), transparent);
  position: relative;
  overflow: visible;
}

.sw-scanline::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 40%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--sw-cyan), transparent);
  filter: blur(3px);
  animation: sw-sweep 4s ease-in-out infinite;
}

@keyframes sw-sweep {
  0% { left: -40%; }
  100% { left: 100%; }
}

.sw-zone {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(95, 214, 196, 0.025) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(95, 214, 196, 0.025) 40px);
}

.sw-h2 {
  font-family: var(--sw-mono);
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sw-amber);
  text-shadow: 0 0 16px rgba(255, 180, 84, 0.3);
  margin-bottom: 8px;
}

.sw-h2::before { content: '// '; color: var(--sw-cyan); opacity: 0.7; }

.sw-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink-dim);
  font-size: 0.88rem;
  margin-bottom: 36px;
}

.sw-frame {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px;
}

.sw-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--sw-cyan);
  opacity: 0.7;
  z-index: 3;
}

.sw-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.sw-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.sw-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.sw-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; }

.record-panel-label {
  font-family: var(--sw-mono);
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  color: var(--sw-cyan);
  opacity: 0.8;
  margin-bottom: 10px;
}

.sw-zone .record-btn:hover:not(:disabled) {
  border-color: var(--sw-cyan);
  box-shadow: 0 0 16px rgba(95, 214, 196, 0.3);
}

.sw-zone .filter-pill:hover { border-color: var(--sw-cyan); }

.sw-zone .filter-pill.active {
  background: linear-gradient(135deg, rgba(95, 214, 196, 0.22), rgba(255, 180, 84, 0.14));
  border-color: var(--sw-cyan);
  box-shadow: 0 0 18px rgba(95, 214, 196, 0.2);
}

.sw-zone .gallery-item:hover {
  border-color: rgba(95, 214, 196, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(95, 214, 196, 0.12);
}

.sw-zone .capture-date { font-family: var(--sw-mono); font-size: 0.8rem; }

/* ---------- SkyWatcher hero readout ---------- */
.sw-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 560px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .sw-hero-grid { grid-template-columns: 1fr; max-width: 320px; }
}

.sw-hero-card {
  --accent: var(--sw-cyan);
  --accent-rgb: 95, 214, 196;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 22px;
  min-width: 168px;
  text-align: left;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.sw-hero-card[data-accent="idle"] { --accent: #8a86a8; --accent-rgb: 138, 134, 168; }
.sw-hero-card[data-accent="live"] { --accent: #ff6b6b; --accent-rgb: 255, 107, 107; }
.sw-hero-card[data-accent="amber"] { --accent: var(--sw-amber); --accent-rgb: 255, 180, 84; }
.sw-hero-card[data-accent="cyan"] { --accent: var(--sw-cyan); --accent-rgb: 95, 214, 196; }
.sw-hero-card[data-accent="violet"] { --accent: var(--violet); --accent-rgb: 138, 111, 216; }

.sw-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}

.sw-hero-card::after {
  content: '';
  position: absolute;
  top: -30%; right: -20%;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.16), transparent 70%);
  pointer-events: none;
}

.sw-hero-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(var(--accent-rgb), 0.18);
}

.sw-hero-card[data-accent="live"] { animation: sw-live-pulse 2.6s ease-in-out infinite; }
@keyframes sw-live-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 107, 107, 0); }
  50% { box-shadow: 0 0 26px rgba(255, 107, 107, 0.28); }
}

.sw-hero-label {
  font-family: var(--sw-mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 9px;
  position: relative;
  z-index: 1;
}

.sw-hero-label::before { content: '// '; color: var(--sw-cyan); opacity: 0.65; }

.sw-hero-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.sw-hero-value {
  font-family: var(--sw-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
  position: relative;
  z-index: 1;
}

.sw-hero-value-sm { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.03em; }

.sw-hero-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.74rem;
  color: var(--ink-dim);
  margin-top: 6px;
  line-height: 1.35;
  position: relative;
  z-index: 1;
}

.sw-hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-dim);
  flex-shrink: 0;
}

.sw-hero-dot.is-idle { background: var(--ink-dim); }
.sw-hero-dot.is-watching { background: var(--sw-cyan); box-shadow: 0 0 8px var(--sw-cyan); }
.sw-hero-dot.is-recording {
  background: #ff6b6b;
  box-shadow: 0 0 8px #ff6b6b;
  animation: record-pulse 1.4s ease-in-out infinite;
}

/* ---------- Maintenance mode ---------- */
/* Toggled from the RECORDING CONTROL panel (btn-maintenance) -- state
   persists server-side (maintenance_state.json). When active, the cam-wrap
   plays an ffmpeg-generated slate video (scrolling text baked into the
   video itself, not a DOM overlay) instead of the live HLS stream -- see
   maintenance_slate.mp4 + skywatcher.js's initCam(). */
.record-btn.is-active-maintenance {
  background: rgba(255, 180, 84, 0.22);
  border-color: var(--sw-amber);
  color: var(--sw-amber);
}

/* ---------- Live cam ---------- */
.cam-wrap {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: #000;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.cam-wrap.is-live {
  border-color: rgba(232, 90, 90, 0.5);
  box-shadow: 0 0 50px rgba(232, 90, 90, 0.18), 0 12px 40px rgba(0, 0, 0, 0.4);
}

.live-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(232, 90, 90, 0.5);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ff8f8f;
}

.cam-wrap.is-live .live-badge { display: flex; }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e85a5a;
  box-shadow: 0 0 8px #e85a5a;
  animation: record-pulse 1.4s ease-in-out infinite;
}

#cam-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.cam-offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, var(--bg-mid), var(--bg-deep));
}

.cam-offline-icon { font-size: 2.6rem; margin-bottom: 12px; }
.cam-offline-text { font-size: 1.1rem; color: var(--ink); }
.cam-offline-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 6px;
}

/* ---------- Recording panel ---------- */
.record-panel {
  max-width: 720px;
  margin: 18px auto 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 20px;
  backdrop-filter: blur(12px);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.record-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-bottom: 12px;
}

.record-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-dim);
  flex-shrink: 0;
}

.record-status.is-recording .record-status-dot {
  background: #e85a5a;
  box-shadow: 0 0 8px #e85a5a;
  animation: record-pulse 1.4s ease-in-out infinite;
}

@keyframes record-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.record-status.is-watching .record-status-dot {
  background: var(--sw-cyan);
  box-shadow: 0 0 8px var(--sw-cyan);
}
.record-status.is-alert .record-status-dot {
  background: #e85a5a;
  box-shadow: 0 0 8px #e85a5a;
  animation: record-pulse 1.4s ease-in-out infinite;
}
.record-status.is-offline .record-status-dot { background: var(--ink-dim); }
.skywatch-status-block { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--card-border); }

.record-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.record-btn {
  flex: 1 1 auto;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.record-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(232, 200, 119, 0.25);
  transform: translateY(-1px);
}

.record-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.record-btn-stop {
  background: rgba(232, 90, 90, 0.15);
  border-color: rgba(232, 90, 90, 0.4);
}

.record-btn-stop:hover:not(:disabled) {
  background: rgba(232, 90, 90, 0.28);
  border-color: #e85a5a;
}

.timelapse-options {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.timelapse-options label {
  font-size: 0.78rem;
  color: var(--ink-dim);
  flex-shrink: 0;
}

.timelapse-options select {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 7px 8px;
}

.timelapse-options select:disabled {
  opacity: 0.4;
}

.skywatch-hint {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  color: var(--ink-dim);
  opacity: 0.75;
  margin-top: 10px;
  font-style: italic;
}

/* ---------- Sessions panel ---------- */
.sessions-panel {
  max-width: 720px;
  margin: 14px auto 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 20px;
  backdrop-filter: blur(12px);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.sessions-empty {
  font-size: 0.8rem;
  color: var(--ink-dim);
  font-style: italic;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--card-border);
}

.session-row:last-child { border-bottom: none; }

.session-kind {
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.session-kind.kind-recorder { background: rgba(232, 200, 119, 0.25); color: var(--gold); }
.session-kind.kind-live-hls { background: rgba(232, 90, 90, 0.25); color: #ffb3b3; }
.session-kind.kind-24h { background: rgba(232, 200, 119, 0.25); color: var(--gold); }
.session-kind.kind-manual { background: rgba(232, 90, 90, 0.25); color: #ffb3b3; }
.session-kind.kind-timelapse { background: rgba(95, 214, 196, 0.25); color: var(--sw-cyan); }
.session-kind.kind-skywatch { background: rgba(95, 180, 255, 0.25); color: #a8d4ff; }
.session-kind.kind-unknown { background: rgba(138, 111, 216, 0.25); color: #c9bcf5; }

.session-detail {
  flex: 1;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.session-detail .sd-pid { font-family: var(--sw-mono); opacity: 0.6; margin-left: 6px; }

.session-stop-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(232, 90, 90, 0.4);
  background: rgba(232, 90, 90, 0.12);
  color: #ffb3b3;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.session-stop-btn:hover { background: rgba(232, 90, 90, 0.28); border-color: #e85a5a; }
.session-stop-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.session-locked {
  font-size: 0.68rem;
  color: var(--ink-dim);
  opacity: 0.6;
  font-style: italic;
}

/* ---------- Gallery ---------- */
.filter-pill {
  display: block;
  width: 100%;
  text-align: left;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(232, 200, 119, 0.22), rgba(232, 120, 156, 0.14));
  border-color: rgba(232, 200, 119, 0.4);
  color: var(--ink);
}

/* standalone pill still used outside dropdown panels (Select toggle) */
.select-toggle {
  display: inline-block;
  width: auto;
  border-radius: 999px;
  border-color: var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  padding: 10px 20px;
}
.select-toggle:hover { border-color: rgba(95, 214, 196, 0.4); }
.select-toggle.active {
  background: linear-gradient(135deg, rgba(95, 214, 196, 0.25), rgba(95, 180, 255, 0.16));
  border-color: var(--sw-cyan);
  box-shadow: 0 0 18px rgba(95, 214, 196, 0.2);
}

/* ---------- Mission Log toolbar (dropdown filters + sort) ---------- */
.log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 26px;
}

.log-dd-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.log-dd { position: relative; }

.log-dd-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.log-dd-btn:hover { border-color: rgba(95, 214, 196, 0.4); }

.log-dd.open .log-dd-btn,
.log-dd-row .log-dd:has(.filter-pill.active:not([data-value="all"])) .log-dd-btn {
  border-color: var(--sw-cyan);
  box-shadow: 0 0 14px rgba(95, 214, 196, 0.2);
}

.log-dd.open .log-dd-btn { background: rgba(95, 214, 196, 0.1); }

.ldd-label {
  font-family: var(--sw-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.ldd-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ldd-chev {
  font-size: 0.7rem;
  color: var(--sw-cyan);
  transition: transform 0.2s ease;
}

.log-dd.open .ldd-chev { transform: rotate(180deg); }

.log-dd-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 210px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(95, 214, 196, 0.3);
  background: rgba(10, 10, 26, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(95, 214, 196, 0.12);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.log-dd.open .log-dd-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.log-dd-sort .log-dd-panel { left: auto; right: 0; transform: translateY(-6px); }
.log-dd-sort.open .log-dd-panel { transform: translateY(0); }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: -14px auto 26px;
  padding: 12px 18px;
  max-width: 640px;
  border-radius: 12px;
  background: rgba(95, 214, 196, 0.08);
  border: 1px solid rgba(95, 214, 196, 0.3);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.bulk-count {
  font-family: var(--sw-mono);
  font-size: 0.78rem;
  color: var(--sw-cyan);
  margin-right: auto;
}

.bulk-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bulk-btn:hover { border-color: var(--sw-cyan); }

.bulk-btn-danger {
  background: rgba(232, 90, 90, 0.15);
  border-color: rgba(232, 90, 90, 0.4);
  color: #ffb3b3;
}

.bulk-btn-danger:hover:not(:disabled) {
  background: rgba(232, 90, 90, 0.3);
  border-color: #e85a5a;
}

.bulk-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gallery-item.select-mode .capture-thumb-wrap { cursor: default; }

.capture-select-box {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: transparent;
  cursor: pointer;
}

.gallery-item.select-mode .capture-select-box { display: flex; }

.gallery-item.is-selected {
  outline: 2px solid var(--sw-cyan);
  outline-offset: 2px;
}

.gallery-item.is-selected .capture-select-box {
  background: var(--sw-cyan);
  border-color: var(--sw-cyan);
  color: #06231d;
}

.capture-action-btn.action-danger {
  color: #ffb3b3;
}

.capture-action-btn.action-danger:hover {
  color: #fff;
  border-color: #e85a5a;
  background: rgba(232, 90, 90, 0.2);
  box-shadow: 0 0 12px rgba(232, 90, 90, 0.3);
}

.capture-action-btn.action-post { color: var(--sw-cyan); }
.capture-action-btn.action-post:hover {
  color: #fff;
  border-color: var(--sw-cyan);
  background: rgba(95, 214, 196, 0.18);
  box-shadow: 0 0 12px rgba(95, 214, 196, 0.3);
}
.capture-action-btn.action-post:disabled { opacity: 0.5; cursor: wait; }

.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 36px;
  text-align: left;
}

.capture-date-group.is-hidden { display: none; }

.capture-date-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.capture-date-header .cdh-label {
  font-family: var(--sw-mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--sw-cyan);
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(95, 214, 196, 0.3);
}

.capture-date-header .cdh-count {
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  color: var(--ink-dim);
  opacity: 0.7;
  white-space: nowrap;
}

.capture-date-header .cdh-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(95, 214, 196, 0.4), transparent);
}

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

.gallery-item.is-hidden { display: none; }

.gallery-empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--ink-dim);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  border: 1px dashed var(--card-border);
  border-radius: 20px;
}

.gallery-coming-soon {
  padding: 60px 20px;
  border: 1px dashed var(--card-border);
  border-radius: 20px;
  background: var(--card-bg);
  text-align: center;
}

.coming-soon-icon { font-size: 2.4rem; margin-bottom: 10px; }
.coming-soon-text { font-size: 1.05rem; }
.coming-soon-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 6px;
}

.gallery-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-6px);
  border-color: rgba(232, 200, 119, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(232, 200, 119, 0.1);
}

.capture-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #000;
  cursor: pointer;
}

.type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  border: 1.5px solid;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: badge-in 0.4s ease;
}

@keyframes badge-in {
  from { opacity: 0; transform: scale(0.7) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.type-badge.type-auto {
  background: rgba(138, 111, 216, 0.85);
  border-color: #a893e8;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(138, 111, 216, 0.55);
}

.type-badge.type-manual {
  background: rgba(232, 90, 90, 0.85);
  border-color: #ff9d9d;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(232, 90, 90, 0.55);
}

.type-badge.type-timelapse {
  background: rgba(95, 214, 196, 0.85);
  border-color: #a8f0e3;
  color: #06231d;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(95, 214, 196, 0.55);
}

.type-badge.type-24h {
  background: rgba(232, 200, 119, 0.9);
  border-color: #ffe3a3;
  color: #2b2007;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(232, 200, 119, 0.55);
}

.type-badge.type-trigger {
  background: rgba(95, 180, 255, 0.9);
  border-color: #c2e2ff;
  color: #001830;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(95, 180, 255, 0.55);
}

.type-badge.badge-morning {
  background: rgba(255, 180, 84, 0.9);
  border-color: #ffe3a3;
  color: #2b1a00;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(255, 180, 84, 0.55);
}

.type-badge.badge-afternoon {
  background: rgba(95, 180, 255, 0.9);
  border-color: #c2e2ff;
  color: #001830;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(95, 180, 255, 0.55);
}

.type-badge.badge-evening {
  background: rgba(232, 120, 156, 0.9);
  border-color: #ffc2d9;
  color: #300012;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(232, 120, 156, 0.55);
}

.type-badge.badge-nightly {
  background: rgba(138, 111, 216, 0.9);
  border-color: #d3c6ff;
  color: #17092e;
  text-shadow: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 16px rgba(138, 111, 216, 0.55);
}

.gallery-item img,
.capture-thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border: none;
}

.capture-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--ink);
  background: radial-gradient(circle, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0) 65%);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  transition: opacity 0.2s ease;
}

.capture-thumb-wrap:hover .capture-play-icon {
  opacity: 0.7;
}

.capture-meta {
  padding: 12px 14px 14px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.capture-date {
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 600;
}

.capture-time {
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin-top: 2px;
}

.capture-size {
  font-size: 0.72rem;
  color: var(--ink-dim);
  opacity: 0.7;
  margin-top: 4px;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}

.capture-action-btn {
  flex: 1 1 calc(33.333% - 6px);
  min-width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.68rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.capture-action-btn:hover {
  color: var(--ink);
  border-color: var(--sw-cyan);
  background: rgba(95, 214, 196, 0.12);
  box-shadow: 0 0 12px rgba(95, 214, 196, 0.2);
  transform: translateY(-1px);
}

.capture-action-btn .cab-icon { font-size: 0.85rem; }

.capture-action-btn.copied {
  color: #06231d;
  background: var(--sw-cyan);
  border-color: var(--sw-cyan);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 40px 24px 60px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

/* ---------- Fade-in ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Dark/light awareness ---------- */
@media (prefers-color-scheme: light) {
  /* Deliberately stays dark/cosmic regardless of system theme — a night-sky
     site reading as a bright white page would undercut the whole concept. */
}

/* ---------- Cross-page site nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(5, 6, 26, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.nav-link {
  font-family: var(--sw-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); border-color: var(--card-border); }
.nav-link.active {
  color: var(--sw-cyan);
  background: rgba(95, 214, 196, 0.1);
  border-color: rgba(95, 214, 196, 0.35);
}

/* ---------- Simple page header (Gallery) ---------- */
.page-header {
  text-align: center;
  padding: 40px 24px 20px;
}
.page-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--gold), var(--sw-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-header .tagline { color: var(--ink-dim); margin-top: 6px; }

/* ---------- Gallery search + tag chips ---------- */
.gallery-search-wrap { max-width: 480px; margin: 0 auto 18px; position: relative; }
.gallery-search {
  width: 100%;
  padding: 11px 16px 11px 38px;
  border-radius: 24px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.gallery-search:focus { border-color: var(--sw-cyan); }
.gallery-search::placeholder { color: var(--ink-dim); }
.gallery-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  opacity: 0.6; pointer-events: none; font-size: 0.9rem;
}
.tag-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-chip {
  font-family: var(--sw-mono);
  font-size: 0.66rem;
  color: var(--sw-cyan);
  background: rgba(95, 214, 196, 0.08);
  border: 1px solid rgba(95, 214, 196, 0.22);
  border-radius: 12px;
  padding: 2px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tag-chip:hover { background: rgba(95, 214, 196, 0.2); border-color: var(--sw-cyan); }
.gallery-results-count {
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.78rem;
  margin-bottom: 14px;
  font-family: var(--sw-mono);
}

/* ---------- Hero CTA link (index page → gallery) ---------- */
.hero-gallery-cta {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--sw-mono);
  font-size: 0.78rem;
  color: var(--sw-cyan);
  text-decoration: none;
  border: 1px solid rgba(95, 214, 196, 0.35);
  border-radius: 20px;
  padding: 8px 18px;
  transition: all 0.2s ease;
}
.hero-gallery-cta:hover { background: rgba(95, 214, 196, 0.12); }
.hero-gallery-cta.sightings-cta {
  border-color: rgba(232, 200, 119, 0.4);
  color: var(--gold);
  margin-left: 8px;
}
.hero-gallery-cta.sightings-cta:hover { background: rgba(232, 200, 119, 0.12); }

/* ---------- Sightings page ---------- */
.review-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.review-badge.status-detected { background: rgba(232, 200, 119, 0.18); color: var(--gold); }
.review-badge.status-clear { background: rgba(255, 255, 255, 0.06); color: var(--ink-dim); }
.review-badge.status-unreviewed { background: rgba(95, 214, 196, 0.12); color: var(--sw-cyan); }

.ai-summary {
  font-size: 0.78rem;
  color: var(--ink);
  line-height: 1.4;
  margin: 4px 0 6px;
}

.ai-event-ts {
  display: inline-block;
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  color: var(--sw-cyan);
  background: rgba(95, 214, 196, 0.1);
  border: 1px solid rgba(95, 214, 196, 0.3);
  border-radius: 10px;
  padding: 3px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.ai-event-ts:hover { background: rgba(95, 214, 196, 0.22); }

.ai-tag-chip {
  font-family: var(--sw-mono);
  font-size: 0.66rem;
  color: var(--gold);
  background: rgba(232, 200, 119, 0.1);
  border: 1px solid rgba(232, 200, 119, 0.3);
  border-radius: 12px;
  padding: 2px 9px;
}

.log-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.log-stats .sw-hero-card {
  min-width: 118px;
  padding: 12px 16px;
  text-align: center;
}
.log-stats .sw-hero-label { text-align: center; }
.log-stats .sw-hero-value { font-size: 1.35rem; }
.log-stats .sw-hero-card[data-accent="blue"] { --accent: #5fb4ff; --accent-rgb: 95, 180, 255; }
.log-stats .sw-hero-card[data-accent="pink"] { --accent: #e8789c; --accent-rgb: 232, 120, 156; }

.gallery-item.is-analyzing { opacity: 0.55; pointer-events: none; }

.gallery-item.has-detection {
  border-color: rgba(232, 200, 119, 0.32);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 22px rgba(232, 200, 119, 0.14);
}
.gallery-item.has-detection:hover {
  border-color: rgba(232, 200, 119, 0.6);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(232, 200, 119, 0.28);
}

.gallery-grid.is-flat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

/* ---------- System services panel (recorder / live stream toggles) ---------- */
.services-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 20px;
}
.service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}
.service-row:last-of-type { border-bottom: none; }
.service-label { font-size: 0.88rem; color: var(--ink); font-weight: 600; }
.service-status-text { font-size: 0.78rem; color: var(--ink-dim); flex: 1; }

.service-meta {
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  opacity: 0.65;
  margin: -4px 0 9px 18px;
}

.services-storage {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

.services-storage-item {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.76rem;
  color: var(--ink-dim);
}

.services-storage-item b {
  font-family: var(--sw-mono);
  color: var(--sw-cyan);
  font-weight: 700;
}
.service-btn {
  font-family: var(--sw-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--sw-cyan);
  background: transparent;
  color: var(--sw-cyan);
  cursor: pointer;
  transition: all 0.15s ease;
}
.service-btn:hover:not(:disabled) { background: rgba(95, 214, 196, 0.14); }
.service-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.service-btn.is-stop { border-color: #e85a5a; color: #ffb3b3; }
.service-btn.is-stop:hover:not(:disabled) { background: rgba(232, 90, 90, 0.14); }
.record-status-dot.is-up { background: #4caf50; box-shadow: 0 0 8px rgba(76, 175, 80, 0.6); }
.record-status-dot.is-down { background: var(--ink-dim); }

/* ---------- Daily stats panel ---------- */
.stats-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 20px;
}
.stats-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 4px 0 16px;
}
.stats-nav-btn {
  font-family: var(--sw-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
}
.stats-nav-btn:hover:not(:disabled) { border-color: var(--sw-cyan); color: var(--sw-cyan); }
.stats-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.stats-date-label { font-family: var(--sw-mono); font-size: 0.85rem; color: var(--gold); min-width: 110px; text-align: center; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stat-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-tile .n { color: var(--gold); font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.stat-tile .l { color: var(--ink-dim); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }
.stat-tile .d { color: var(--ink-dim); font-size: 0.72rem; margin-top: 5px; line-height: 1.3; }
.stat-tile-muted .n { color: var(--ink-dim); }
.stats-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-dim); font-size: 0.85rem; padding: 20px 0; }

/* ---------- Capture lightbox (video + full details modal) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox.open { display: flex; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 26, 0.9);
  backdrop-filter: blur(10px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  max-height: 94vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(15, 18, 50, 0.98), rgba(6, 7, 28, 0.98));
  border: 1px solid rgba(95, 214, 196, 0.3);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 60px rgba(95, 214, 196, 0.12);
  animation: lightbox-in 0.22s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}

.lightbox-close:hover { border-color: var(--sw-cyan); color: var(--sw-cyan); box-shadow: 0 0 14px rgba(95, 214, 196, 0.3); }

.lightbox-video-wrap {
  position: relative;
  background: #000;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
}

.lightbox-video-wrap video {
  width: 100%;
  max-height: 62vh;
  display: block;
  background: #000;
}

.lightbox-details {
  padding: 20px 22px 26px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  text-align: left;
}

.lightbox-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.lightbox-datetime {
  font-family: var(--sw-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.lightbox-details .type-badge {
  position: static;
  animation: none;
}

.lightbox-details .capture-time,
.lightbox-details .capture-size {
  font-size: 0.85rem;
}

.lightbox-details .tag-chips { margin-top: 12px; margin-bottom: 4px; }
.lightbox-details .capture-actions { border-top: 1px solid var(--card-border); margin-top: 16px; padding-top: 16px; }

@media (max-width: 520px) {
  .lightbox { padding: 0; }
  .lightbox-panel { max-width: 100%; max-height: 100vh; border-radius: 0; height: 100%; }
  .lightbox-video-wrap { border-radius: 0; }
}
