/* ==========================================================================
   CHRONOFLASH // 1969–2026 Retro & Nostalgia Time Machine Stylesheet
   Built on the rapid-flash stage architecture of september11remembered.com
   with Era-Adaptive Themes, View Transitions, and Native Dialogs.
   ========================================================================== */

:root {
  --bg-core: #07080c;
  --bg-surface: #0e1118;
  --bg-card: #141923;
  --bg-card-hover: #1c2331;
  --border-subtle: #232b3a;
  --border-focus: #3e4b63;

  /* Default Era Accent (90s Atomic Purple / Teal) */
  --era-primary: #a855f7;
  --era-secondary: #2dd4bf;
  --era-light: #e9d5ff;
  --era-glow: rgba(168, 85, 247, 0.28);

  --text-primary: #f2f5f9;
  --text-secondary: #a5b0c2;
  --text-muted: #6c778a;

  /* Category Accent Colors */
  --cat-games: #38bdf8;
  --cat-tech: #a855f7;
  --cat-movies: #fb923c;
  --cat-music: #f43f5e;
  --cat-news: #eab308;
  --cat-culture: #10b981;

  --font-display: 'Chakra Petch', 'Space Grotesk', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --header-height: 64px;
  --controls-height: 136px;
}

/* Era-Adaptive Color Palettes */
body[data-era="era-70s"] {
  --era-primary: #f59e0b;
  --era-secondary: #ef4444;
  --era-light: #fde68a;
  --era-glow: rgba(245, 158, 11, 0.28);
}

body[data-era="era-80s"] {
  --era-primary: #06b6d4;
  --era-secondary: #ec4899;
  --era-light: #a5f3fc;
  --era-glow: rgba(236, 72, 153, 0.28);
}

body[data-era="era-90s"] {
  --era-primary: #8b5cf6;
  --era-secondary: #14b8a6;
  --era-light: #ddd6fe;
  --era-glow: rgba(139, 92, 246, 0.28);
}

body[data-era="era-00s"] {
  --era-primary: #3b82f6;
  --era-secondary: #84cc16;
  --era-light: #bfdbfe;
  --era-glow: rgba(59, 130, 246, 0.28);
}

body[data-era="era-10s"] {
  --era-primary: #6366f1;
  --era-secondary: #f43f5e;
  --era-light: #c7d2fe;
  --era-glow: rgba(99, 102, 241, 0.28);
}

body[data-era="era-20s"] {
  --era-primary: #c084fc;
  --era-secondary: #10b981;
  --era-light: #f3e8ff;
  --era-glow: rgba(192, 132, 252, 0.28);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-core);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Subtle CRT / Film Grain Overlay */
.era-fx-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.16) 50%),
    radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, 0.42) 100%);
  background-size: 100% 3px, 100% 100%;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.era-fx-overlay.fx-off {
  opacity: 0;
}

/* View Transitions API Support */
#stageYearBadge {
  view-transition-name: year-badge-hero;
  width: fit-content;
}

.year-card.selected .yc-year-num {
  view-transition-name: year-badge-hero;
  width: fit-content;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background:
    radial-gradient(circle at 50% 18%, var(--era-glow) 0%, transparent 55%),
    radial-gradient(circle at 50% 30%, #131824 0%, #07080c 78%);
  position: relative;
  overflow: hidden;
  transition: background 0.5s ease;
}

/* ==========================================================================
   HEADER & AUDIO DECK
   ========================================================================== */

.memorial-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 11, 16, 0.88);
  backdrop-filter: blur(14px);
  z-index: 30;
  gap: 16px;
}

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

.brand-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.header-symbol {
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--era-primary), var(--era-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--era-glow);
}

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

.header-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 2.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.stage-nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.year-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  white-space: nowrap;
}

.stepper-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stepper-btn:hover {
  background: var(--bg-card-hover);
  color: var(--era-light);
}

.header-year-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #0d1017;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa4b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  color: var(--era-light);
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  padding: 6px 28px 6px 14px;
  min-width: 88px;
  text-align: center;
  text-align-last: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  outline: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

/* Audio Deck Pill */
.audio-deck {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #10141d;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  max-width: 290px;
  min-width: 0;
  flex-shrink: 1;
}

.audio-btn, .audio-next-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--era-light);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.audio-btn:hover, .audio-next-btn:hover {
  background: var(--era-primary);
  color: #fff;
}

.audio-track-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.audio-label {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  color: var(--era-primary);
  font-weight: 700;
  white-space: nowrap;
}

.audio-track-title {
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--era-primary);
}

.header-btn.accent-outline {
  border-color: rgba(168, 85, 247, 0.4);
  color: var(--era-light);
}

.header-btn.icon-only {
  padding: 7px 10px;
}

.header-btn.icon-only.active {
  border-color: var(--era-primary);
  background: rgba(168, 85, 247, 0.14);
}

.badge-pill {
  background: var(--era-primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ==========================================================================
   VIEW 1: 1969–2026 TIME MACHINE / DECADE GRID
   ========================================================================== */

.time-machine-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 32px 0 32px;
}

.tm-hero {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto 16px auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-hero-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--era-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.tm-hero-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
  outline: none;
}

.tm-hero-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.45;
}

.tm-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.decade-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #10141d;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.decade-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.decade-tab:hover {
  color: #fff;
}

.decade-tab.active {
  background: var(--era-primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--era-glow);
}

.tm-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tm-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.tm-search-box svg {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
}

.tm-search-input {
  background: #10141d;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 14px 8px 34px;
  border-radius: 8px;
  font-size: 0.84rem;
  width: 280px;
  outline: none;
  transition: border-color 0.2s ease;
}

.tm-search-input:focus {
  border-color: var(--era-primary);
}

.tm-action-btn {
  background: linear-gradient(135deg, var(--era-primary), var(--era-secondary));
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--era-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tm-action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.tm-grid-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 36px;
  scrollbar-width: thin;
  scrollbar-color: #2e3848 #090b10;
}

.year-cards-grid {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 14px;
}

.year-card {
  position: relative;
  background: #111621;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 215px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
  color: inherit;
}

.year-card:hover {
  transform: translateY(-4px);
  border-color: var(--era-primary);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 18px var(--era-glow);
}

.yc-backdrop {
  position: relative;
  height: 105px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  background: #090c12;
}

.yc-backdrop img {
  width: 100%;
  height: 105px;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.05);
  transition: transform 0.35s ease;
}

.year-card:hover .yc-backdrop img {
  transform: scale(1.07);
}

.yc-backdrop-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17, 22, 33, 0.15) 0%, rgba(17, 22, 33, 0.96) 100%);
}

.yc-top-row {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.yc-decade-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(10, 13, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  backdrop-filter: blur(4px);
}

.yc-count-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.85);
  color: #fff;
  font-weight: 600;
}

.yc-content {
  padding: 8px 14px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  justify-content: space-between;
}

.yc-year-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: -26px;
  position: relative;
  z-index: 2;
}

.yc-year-num {
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.5px;
}

.yc-play-hint {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--era-light);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s ease;
}

.year-card:hover .yc-play-hint {
  opacity: 1;
  transform: translateX(0);
}

.yc-headline {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yc-cat-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* ==========================================================================
   VIEW 2: MAIN FLASH STAGE & CANVAS
   ========================================================================== */

.memorial-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  overflow: hidden;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 12, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  transition: opacity 0.35s ease;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--era-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-bar-container {
  width: 320px;
  height: 6px;
  background: #1c222c;
  border-radius: 3px;
  overflow: hidden;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--era-primary), var(--era-secondary));
  transition: width 0.12s ease;
}

.tribute-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 44px;
  max-width: 1260px;
  width: 100%;
  position: relative;
  z-index: 5;
}

.stage-lighting {
  position: absolute;
  top: -140px;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, var(--era-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* Central Artifact Canvas Card */
.portrait-stage-container {
  position: relative;
  flex-shrink: 0;
}

.portrait-glow {
  position: absolute;
  inset: -16px;
  background: radial-gradient(circle, var(--era-glow) 0%, transparent 72%);
  filter: blur(22px);
  opacity: 0.75;
}

.portrait-card {
  position: relative;
  width: 370px;
  height: 425px;
  background: #0b0e15;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.88), 0 0 1px var(--era-primary);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.portrait-card:hover {
  border-color: var(--era-primary);
  transform: scale(1.01);
}

#artifactCanvas {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: block;
  background-color: #090b10;
}

.frame-border {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  pointer-events: none;
}

.corner-accents span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--era-primary);
  border-style: solid;
  pointer-events: none;
}
.corner-accents .c-tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.corner-accents .c-tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.corner-accents .c-bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.corner-accents .c-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.card-hover-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 18, 0.88);
  border: 1px solid var(--era-primary);
  color: var(--era-light);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.portrait-card:hover .card-hover-hint {
  opacity: 1;
}

/* Right Panel: Artifact Details */
.victim-details-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.victim-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.year-pill-badge {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 11px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--era-primary), var(--era-secondary));
  color: #ffffff;
}

.victim-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.victim-badge.cat-games {
  color: var(--cat-games);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}
.victim-badge.cat-tech {
  color: var(--cat-tech);
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.1);
}
.victim-badge.cat-movies_tv {
  color: var(--cat-movies);
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.1);
}
.victim-badge.cat-cartoons_anime {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.4);
  background: rgba(244, 114, 182, 0.12);
}
.victim-badge.cat-music {
  color: var(--cat-music);
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.1);
}
.victim-badge.cat-news {
  color: var(--cat-news);
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.1);
}
.victim-badge.cat-culture {
  color: var(--cat-culture);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.victim-badge.badge-anchor {
  color: #fde047;
  border-color: rgba(253, 224, 71, 0.45);
  background: rgba(253, 224, 71, 0.12);
}

.victim-name {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.12;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
}

.victim-role {
  font-size: 1.02rem;
  color: var(--era-light);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.victim-metadata-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.meta-item {
  background: rgba(20, 25, 35, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 9px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.meta-value {
  font-size: 0.86rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.stage-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--era-primary), var(--era-secondary));
  border: none;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--era-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.stage-primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.stage-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stage-secondary-btn:hover,
.stage-secondary-btn.saved {
  border-color: #facc15;
  color: #fde047;
  background: rgba(250, 204, 21, 0.1);
}

/* ==========================================================================
   REACTION-TIME FILMSTRIP (Last 8 Frames)
   ========================================================================== */

.reaction-filmstrip-box {
  margin-top: 6px;
  background: rgba(14, 18, 26, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.reaction-filmstrip-box.paused-highlight {
  border-color: var(--era-primary);
  box-shadow: 0 0 20px var(--era-glow);
}

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

.filmstrip-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--era-light);
  letter-spacing: 0.8px;
}

.filmstrip-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.reaction-filmstrip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}

.filmstrip-card {
  position: relative;
  background: #0b0e14;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.filmstrip-card:hover {
  transform: translateY(-2px);
  border-color: var(--era-light);
}

.filmstrip-card.current-frame {
  border-color: var(--era-primary);
  box-shadow: 0 0 8px var(--era-glow);
}

.filmstrip-thumb {
  width: 100%;
  height: 48px;
  object-fit: cover;
  background: #07090d;
  display: block;
}

.filmstrip-offset {
  position: absolute;
  top: 3px;
  left: 3px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  padding: 1px 4px;
  border-radius: 3px;
}

.filmstrip-label {
  font-size: 0.62rem;
  color: var(--text-secondary);
  padding: 3px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ==========================================================================
   BOTTOM CONTROLS & TIMELINE SCRUBBER
   ========================================================================== */

.memorial-controls {
  height: var(--controls-height);
  padding: 10px 32px 14px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  background: rgba(9, 11, 16, 0.95);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.timeline-scrubber {
  position: relative;
  width: 100%;
  height: 8px;
  background: #181e29;
  border-radius: 4px;
  cursor: pointer;
  transition: height 0.15s ease;
}

.timeline-scrubber:hover {
  height: 12px;
}

.timeline-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--era-primary), var(--era-secondary));
  border-radius: 4px;
  pointer-events: none;
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid var(--era-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--era-glow);
  pointer-events: none;
}

.timeline-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.25);
}

.marker-tooltip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c222c;
  color: #f0f3f6;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid var(--border-focus);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.timeline-marker:hover .marker-tooltip {
  opacity: 1;
}

.timeline-time-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.time-elapsed-wrapper {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.time-primary {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--era-light);
  font-family: var(--font-mono);
}

.time-divider, .time-total, .percent-done, .speed-indicator {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.victim-counter-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.ctrl-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--era-primary);
}

.ctrl-btn.play-btn {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--era-primary), var(--era-secondary));
  border-color: var(--era-light);
  color: #ffffff;
  box-shadow: 0 0 18px var(--era-glow);
}

.ctrl-btn.play-btn:hover {
  transform: scale(1.06);
}

.controls-center {
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.quick-group-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #11151f;
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.filter-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 14px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.filter-pill:hover {
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--bg-card);
  color: var(--era-light);
  border-color: var(--era-primary);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-control-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.speed-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   NATIVE <dialog> MODALS (Light-Dismiss + Top Layer)
   ========================================================================== */

.chrono-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-focus);
  border-radius: 12px;
  background: #10141d;
  color: var(--text-primary);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.92);
  max-width: 920px;
  width: calc(100vw - 48px);
  max-height: 86vh;
  overflow: hidden;
}

.chrono-dialog::backdrop {
  background-color: rgba(4, 6, 10, 0.82);
  backdrop-filter: blur(8px);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 86vh;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: #0c1017;
}

.dd-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-subtitle {
  font-size: 0.84rem;
  color: var(--era-light);
  margin-top: 2px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.7rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #ffffff;
}

/* Deep-Dive Modal Body */
.dd-body {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 32px;
  padding: 24px 28px;
  overflow-y: auto;
}

.dd-media-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dd-image-frame {
  width: 100%;
  height: 300px;
  background: #080a0f;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dd-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dd-step-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.dd-step-controls .header-btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  font-size: 0.78rem;
  padding: 9px 10px;
}

#ddPrevBtn {
  order: 1;
}

#ddNextBtn {
  order: 2;
}

#ddBookmarkBtn {
  order: 3;
  grid-column: 1 / -1;
}

.dd-info-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.dd-section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dd-extract-text {
  font-size: 0.94rem;
  line-height: 1.62;
  color: #dbe2ee;
  background: rgba(20, 25, 35, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 16px;
  max-height: 220px;
  overflow-y: auto;
}

.dd-audio-box {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dd-audio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fda4af;
}

.dd-audio-element {
  width: 100%;
  height: 36px;
}

.dd-links-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dd-ext-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.dd-ext-link:hover {
  border-color: var(--era-primary);
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

/* Registry / Directory Modal */
.modal-filter-bar {
  padding: 12px 24px;
  background: #141923;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: #0b0e14;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px 8px 36px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--era-primary);
}

.registry-stats {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  max-height: 62vh;
}

.registry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.registry-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #151a24;
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.registry-card:hover {
  background: #1e2533;
  border-color: var(--era-primary);
  transform: translateY(-1px);
}

.reg-thumb {
  width: 46px;
  height: 54px;
  border-radius: 4px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.reg-info {
  flex: 1;
  min-width: 0;
}

.reg-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reg-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.reg-time {
  font-size: 0.68rem;
  color: var(--era-light);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ==========================================================================
   MOBILE & NARROW WINDOW PLAYER RECONSTRUCTION (<= 900px)
   Desktop (> 900px) and Time Machine Grid remain untouched.
   ========================================================================== */

/* Intermediate breakpoint so top bar never crowds on smaller laptop windows */
@media (max-width: 1180px) {
  .header-subtitle {
    display: none;
  }

  .memorial-header:has(#stageNavControls:not(.hidden)) .header-title-group {
    display: none;
  }

  .audio-deck {
    max-width: 210px;
  }
}

@media (max-width: 900px) {
  /* 1. Compact Header so Audio, Vault, Year & Search never collide or overlap */
  .memorial-header {
    height: 54px;
    padding: 0 10px;
    gap: 6px;
  }

  .header-left {
    gap: 6px;
    min-width: 0;
    flex-shrink: 0;
  }

  .header-symbol {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .stage-nav-controls {
    padding-left: 6px;
    gap: 5px;
  }

  #backToGridBtn {
    padding: 5px 8px;
    font-size: 0.72rem;
    gap: 5px;
  }

  .stepper-btn {
    padding: 5px 6px;
    font-size: 0.7rem;
  }

  .header-year-select {
    padding: 5px 20px 5px 8px;
    background-position: right 6px center;
    background-size: 10px 10px;
    min-width: 68px;
    font-size: 0.8rem;
  }

  .header-right {
    gap: 5px;
    flex-shrink: 0;
  }

  /* Turn Audio Deck into compact icon controls on mobile */
  .audio-deck {
    padding: 2px 4px;
    gap: 4px;
    max-width: none;
    flex-shrink: 0;
  }

  .audio-btn, .audio-next-btn {
    width: 26px;
    height: 26px;
  }

  .audio-track-info {
    display: none;
  }

  .vault-btn-label,
  #searchBtnLabel {
    display: none;
  }

  #searchBtn {
    padding: 6px 8px;
  }

  #savedVaultBtn {
    padding: 5px 8px;
    font-size: 0.74rem;
    gap: 4px;
  }

  #fxToggleBtn,
  #fullscreenBtn {
    display: none;
  }

  /* On extra-narrow screens (<= 430px), make 'All Years' icon-only so it never crowds */
  @media (max-width: 430px) {
    #backToGridBtn span {
      display: none;
    }
    #backToGridBtn {
      padding: 6px 8px;
    }
  }

  /* 2. Reconstruct Stage into a Clean Vertical Mobile Stack */
  .memorial-viewport {
    padding: 8px 14px;
    align-items: center;
  }

  .tribute-stage {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    height: 100%;
    max-width: 520px;
    margin: 0 auto;
  }

  /* Artwork Card: Centered, responsive to viewport height so nothing overflows */
  .portrait-stage-container {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .portrait-card {
    width: min(70vw, 30dvh);
    height: min(74vw, 32dvh);
    padding: 8px;
    border-radius: 9px;
  }

  .card-hover-hint {
    opacity: 1;
    bottom: 10px;
    font-size: 0.64rem;
    padding: 3px 9px;
    background: rgba(10, 12, 18, 0.82);
  }

  /* Details Panel: Full width, centered, zero horizontal clipping */
  .victim-details-panel {
    width: 100%;
    flex: 0 0 auto;
    gap: 6px;
    align-items: center;
    text-align: center;
  }

  .victim-badge-wrapper {
    justify-content: center;
    gap: 6px;
  }

  .year-pill-badge {
    font-size: 0.74rem;
    padding: 2px 8px;
  }

  .victim-badge {
    font-size: 0.66rem;
    padding: 3px 8px;
  }

  .victim-name {
    font-size: 1.45rem;
    width: 100%;
    text-align: center;
  }

  .victim-sub-details {
    width: 100%;
  }

  .victim-role {
    font-size: 0.84rem;
    margin-bottom: 6px;
    text-align: center;
  }

  /* Hide redundant 3-box metadata grid on mobile (already shown in badges) */
  .victim-metadata-grid {
    display: none;
  }

  /* Compact side-by-side Action Buttons */
  .stage-action-row {
    margin-top: 4px;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }

  .stage-primary-btn {
    padding: 7px 14px;
    font-size: 0.78rem;
    flex: 1;
    max-width: 220px;
    justify-content: center;
    white-space: nowrap;
  }

  .stage-secondary-btn {
    padding: 7px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* 3. Full-Width Single-Row Reaction Filmstrip */
  .reaction-filmstrip-box {
    width: 100%;
    margin-top: 2px;
    padding: 7px 9px;
  }

  .filmstrip-header {
    margin-bottom: 5px;
    justify-content: center;
  }

  .filmstrip-title {
    font-size: 0.64rem;
  }

  /* Hide long explanatory sentence that caused multi-line wrapping */
  .filmstrip-hint {
    display: none;
  }

  .reaction-filmstrip {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  /* Show the 5 most recent frames cleanly in one row on mobile */
  .reaction-filmstrip .filmstrip-card:nth-child(n+6) {
    display: none;
  }

  .filmstrip-thumb {
    height: 40px;
  }

  .filmstrip-label {
    font-size: 0.58rem;
    padding: 2px 3px;
  }

  /* 4. Reconstructed 3-Tier Mobile Footer Dock */
  .memorial-controls {
    height: auto;
    padding: 8px 14px 10px 14px;
    gap: 8px;
  }

  .timeline-container {
    gap: 4px;
  }

  .timeline-time-display {
    font-size: 0.72rem;
  }

  .time-primary {
    font-size: 0.92rem;
  }

  .speed-indicator {
    display: none;
  }

  .controls-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Category Filter Pills become a full-width swipeable top row in the dock */
  .controls-center {
    order: -1;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .controls-center::-webkit-scrollbar {
    display: none;
  }

  .quick-group-nav {
    width: max-content;
    min-width: 100%;
    justify-content: flex-start;
  }

  .filter-pill {
    padding: 4px 10px;
    font-size: 0.7rem;
  }

  .controls-left {
    gap: 8px;
  }

  .ctrl-btn {
    width: 34px;
    height: 34px;
  }

  .ctrl-btn.play-btn {
    width: 40px;
    height: 40px;
  }

  .speed-control-wrapper label {
    display: none;
  }

  .speed-select {
    padding: 5px 8px;
    font-size: 0.74rem;
    max-width: 175px;
  }

  /* 5. Mobile Modals */
  .chrono-dialog {
    width: calc(100vw - 20px);
    max-height: 90vh;
  }

  .dd-body {
    grid-template-columns: 1fr;
    padding: 14px 16px;
    gap: 14px;
  }

  .dd-image-frame {
    height: 210px;
  }
}
