/* 9/11 Memorial Stylesheet */
:root {
  --bg-core: #07080a;
  --bg-surface: #0f1217;
  --bg-card: #151921;
  --bg-card-hover: #1c222c;
  --border-subtle: #232a35;
  --border-focus: #3e4856;
  --gold: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.25);
  --gold-light: #fae19c;
  --text-primary: #f0f3f6;
  --text-secondary: #a2abb8;
  --text-muted: #6b7685;
  --accent-wtc: #4a9eff;
  --accent-responders: #ff5252;
  --accent-pentagon: #b388ff;
  --accent-flight: #ffd740;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-heading: 'Cinzel', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-height: 64px;
  --controls-height: 140px;
}

* {
  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;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 50% 25%, #131720 0%, #07080a 75%);
  position: relative;
}

/* Header */
.memorial-header {
  height: var(--header-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  z-index: 20;
}

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

.header-symbol {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
}

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

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

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

.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 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

/* Main Viewport */
.memorial-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  overflow: hidden;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 10, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 100;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(212, 175, 55, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s 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(--gold), var(--gold-light));
  transition: width 0.15s ease;
}

/* Tribute Stage */
.tribute-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  max-width: 1200px;
  width: 100%;
  position: relative;
  z-index: 5;
}

.stage-lighting {
  position: absolute;
  top: -150px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

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

.portrait-glow {
  position: absolute;
  inset: -15px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  filter: blur(20px);
  opacity: 0.6;
}

.portrait-card {
  position: relative;
  width: 340px;
  height: 410px;
  background: #0d1015;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 1px rgba(212, 175, 55, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#portraitCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  background-color: #0b0d11;
}

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

.corner-accents span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--gold);
  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; }

/* Victim Details */
.victim-details-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

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

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

.victim-badge.group-wtc {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
}
.victim-badge.group-responders {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}
.victim-badge.group-pentagon {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.3);
  background: rgba(192, 132, 252, 0.08);
}
.victim-badge.group-flight {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.08);
}

.victim-name {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
  min-height: 3.2rem;
}

.victim-role {
  font-size: 1.05rem;
  color: var(--gold-light);
  font-style: italic;
  font-family: var(--font-serif);
  margin-bottom: 14px;
  min-height: 1.5rem;
}

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

.meta-item {
  background: rgba(21, 25, 33, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

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

/* Timeline */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-scrubber {
  position: relative;
  width: 100%;
  height: 8px;
  background: #181d26;
  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, #b89128, #f0c868);
  border-radius: 4px;
  pointer-events: none;
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.timeline-scrubber:hover .timeline-thumb {
  opacity: 1;
}

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

.marker-tooltip {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c222c;
  color: #f0f3f6;
  font-size: 0.65rem;
  padding: 3px 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.82rem;
  color: var(--text-secondary);
}

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

.time-primary {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-light);
  font-family: var(--font-heading);
}

.time-divider {
  color: var(--text-muted);
}

.time-total {
  font-size: 0.88rem;
  color: var(--text-muted);
}

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

.percent-done {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.speed-indicator {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Toolbar */
.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.ctrl-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  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(--border-focus);
}

.ctrl-btn.play-btn {
  width: 48px;
  height: 48px;
  background: var(--gold);
  border-color: var(--gold-light);
  color: #0b0d11;
  box-shadow: 0 0 16px var(--gold-glow);
}

.ctrl-btn.play-btn:hover {
  background: var(--gold-light);
  transform: scale(1.05);
}

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

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

.filter-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.filter-pill.active {
  background: var(--bg-card);
  color: var(--gold-light);
  border: 1px solid var(--border-focus);
}

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

.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.8rem;
  outline: none;
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-container {
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  background: #11151c;
  border: 1px solid var(--border-focus);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9);
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-filter-bar {
  padding: 14px 24px;
  background: #151a23;
  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: #0c0e12;
  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(--gold);
}

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

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: #2e3644 #0e1117;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}
.modal-body::-webkit-scrollbar-track {
  background: #0e1117;
}
.modal-body::-webkit-scrollbar-thumb {
  background: #2e3644;
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

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

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

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

.reg-thumb {
  width: 44px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border-subtle);
}

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

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

.reg-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reg-time {
  font-size: 0.72rem;
  color: var(--gold-light);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .tribute-stage {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  .portrait-card {
    width: 240px;
    height: 290px;
  }
  .victim-details-panel {
    align-items: center;
  }
  .victim-name {
    font-size: 1.8rem;
    min-height: auto;
  }
  .victim-metadata-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .controls-center {
    display: none;
  }
}
