/* ═══════════════════════════════════════════════════════════════
   REFLET — Premium Dark-Mode Design System
   Mémoire Collective Interactive Art Installation
   ═══════════════════════════════════════════════════════════════ */

/* ─── Custom Properties ─────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-deep:           hsl(230, 25%, 6%);
  --bg-surface:        hsla(230, 25%, 12%, 0.6);
  --bg-surface-solid:  hsl(230, 25%, 12%);

  /* Brand Colors */
  --color-primary:     hsl(185, 100%, 55%);
  --color-accent:      hsl(270, 100%, 65%);
  --color-danger:      hsl(340, 100%, 60%);
  --color-success:     hsl(150, 80%, 50%);

  /* Text */
  --color-text:        hsl(0, 0%, 92%);
  --color-text-dim:    hsl(230, 15%, 55%);

  /* Borders */
  --color-border:      hsla(230, 30%, 40%, 0.3);

  /* Typography */
  --font-display:      "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body:         "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Effects */
  --glass-blur:        16px;
  --radius:            12px;
  --radius-lg:         20px;
  --transition:        300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --nav-height:        70px;
}


/* ─── Reset & Globals ───────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-deep);
  font-family: var(--font-body);
  color: var(--color-text);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: -12%;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at calc(50% + var(--bg-glow-x, 0px)) calc(38% + var(--bg-glow-y, 0px)),
      hsla(185, 100%, 75%, 0.08),
      hsla(185, 100%, 70%, 0.03) 18%,
      transparent 45%),
    radial-gradient(circle at 68% 72%,
      hsla(270, 100%, 80%, 0.035),
      transparent 42%);
  filter: blur(44px);
  opacity: 0.9;
}

.startup-loader {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.05), transparent 32%),
    rgba(8, 10, 18, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 420ms ease, visibility 420ms ease;
}

.startup-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.startup-loader-card {
  width: min(460px, 100%);
  padding: 28px 26px 24px;
  border-radius: 22px;
  background: rgba(18, 22, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.4);
}

.startup-loader-brand {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: hsl(0, 0%, 80%);
  letter-spacing: 0.02em;
}

.startup-loader-label {
  margin-top: 10px;
  color: rgba(236, 240, 246, 0.88);
  font-size: 0.98rem;
}

.startup-loader-slider {
  width: 100%;
  margin-top: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.startup-loader-slider:disabled {
  opacity: 1;
}

.startup-loader-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(91, 209, 234, 0.95) 0%, rgba(91, 209, 234, 0.85) var(--loader-progress, 4%), rgba(255, 255, 255, 0.08) var(--loader-progress, 4%), rgba(255, 255, 255, 0.08) 100%);
}

.startup-loader-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.startup-loader-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  border: 0;
  background: #d8f7ff;
  box-shadow: 0 0 0 4px rgba(91, 209, 234, 0.18);
}

.startup-loader-slider::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(91, 209, 234, 0.95);
}

.startup-loader-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #d8f7ff;
  box-shadow: 0 0 0 4px rgba(91, 209, 234, 0.18);
}

.startup-loader-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: rgba(223, 229, 236, 0.72);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}


/* ─── Text Display Container ────────────────────────────────── */
#text-display {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  transform-origin: 50% 50%;
  transform:
    translate3d(
      var(--time-travel-shift-x, 0px),
      calc(var(--time-travel-shift-y, 0px) + var(--time-travel-shift-burst-y, 0px)),
      0
    )
    scale(calc(var(--time-travel-zoom, 1) + var(--time-travel-zoom-burst, 0)));
  transition:
    transform 220ms ease,
    filter 220ms ease,
    left 400ms cubic-bezier(0.4, 0, 0.2, 1),
    width 400ms cubic-bezier(0.4, 0, 0.2, 1);
  filter: brightness(var(--time-travel-brightness, 1));
}

#text-display::before {
  content: "";
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--scene-glow-x, 52%) var(--scene-glow-y, 46%),
      hsla(0, 0%, 100%, 0.05),
      hsla(185, 100%, 70%, 0.025) 16%,
      transparent 42%);
  filter: blur(36px);
  opacity: 0.55;
}

/* ── Base text slot ── */
.display-text {
  position: absolute;
  color: var(--lvl-color, rgba(238, 242, 248, 0.84));
  font-family: var(--font-display);
  font-weight: var(--reflet-font-weight, 300);
  line-height: 1.35;
  letter-spacing: 0.01em;
  opacity: 0;
  filter: brightness(0.94);
  text-shadow: 0 0 0 rgba(255, 255, 255, 0);
  transition:
    opacity 1.35s cubic-bezier(0.25, 0.1, 0.25, 1),
    filter 1.35s cubic-bezier(0.25, 0.1, 0.25, 1),
    color 1.35s cubic-bezier(0.25, 0.1, 0.25, 1),
    text-shadow 1.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
  max-width: 45vw;
  word-wrap: break-word;
  overflow-wrap: break-word;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: transform, opacity, filter, color, text-shadow;
  --depth: 1;
  --visible-opacity: 0.7;
}

#text-display[data-wrap-mode="nowrap"] .display-text {
  white-space: nowrap;
  overflow-wrap: normal;
  word-wrap: normal;
  max-width: none !important;
}

.display-text.visible {
  pointer-events: auto;
  color: var(--lvl-color, rgba(245, 248, 252, 0.98));
  filter: brightness(1);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.06);
}

.display-text.is-scrub-placeholder {
  color: transparent;
  letter-spacing: -0.04em;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(238, 244, 250, 0.32) 0 9px,
      rgba(238, 244, 250, 0.74) 9px 13px,
      rgba(238, 244, 250, 0.22) 13px 21px
    );
  background-size: 42px 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: scrubDeparturesBoard 520ms steps(8, end) infinite;
  text-shadow: none;
  white-space: nowrap;
  overflow-wrap: normal;
  word-wrap: normal;
}

.display-text.is-scrub-placeholder.visible {
  color: transparent;
  filter: brightness(1.03);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.04);
}

@keyframes scrubDeparturesBoard {
  from { background-position: 0 0; }
  to { background-position: 42px 0; }
}

.display-text.dragging {
  cursor: grab !important;
  transition: none !important;
  filter: brightness(1.16);
}

/* ── Level 0: Realtime — centered, full viewport ── */
.display-realtime {
  top: 50%;
  left: 50%;
  --depth: 0.2;
  --visible-opacity: 1;
  --peak-opacity: 1;
  text-align: center;
  max-width: 92vw;
  max-height: 88vh;
  overflow: hidden;
  transition:
    opacity 1.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    filter 1.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    color 1.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    text-shadow 1.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 10;
}

.display-realtime.visible {
  opacity: 1;
  filter: brightness(1.03);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12);
}

/* ── Level 1: Hour — large, prominent ── */
.display-level-1 {
  font-size: 4vw;
  z-index: 5;
  --depth: 1.2;
  --visible-opacity: 0.85;
  --peak-opacity: 1;
}

.display-level-1.visible {
  opacity: 0.85;
  filter: brightness(1.04);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}

/* ── Level 2: Day — medium ── */
.display-level-2 {
  font-size: 2.5vw;
  z-index: 4;
  --depth: 0.95;
  --visible-opacity: 0.55;
  --peak-opacity: 0.88;
}

.display-level-2.visible {
  opacity: 0.55;
  filter: brightness(1.01);
  text-shadow: 0 0 7px rgba(255, 255, 255, 0.05);
}

/* ── Level 3: Month — small ── */
.display-level-3 {
  font-size: 1.5vw;
  z-index: 3;
  max-width: 35vw;
  --depth: 0.7;
  --visible-opacity: 0.35;
  --peak-opacity: 0.68;
}

.display-level-3.visible {
  opacity: 0.35;
  filter: brightness(0.99);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.04);
}

/* ── Level 4: Year — whisper ── */
.display-level-4 {
  font-size: 0.95vw;
  z-index: 2;
  max-width: 30vw;
  --depth: 0.45;
  --visible-opacity: 0.2;
  --peak-opacity: 0.48;
}

.display-level-4.visible {
  opacity: 0.20;
  filter: brightness(0.98);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.03);
}

/* ── Audio text cursor hint ── */
.display-text[style*="cursor: pointer"]:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

/* ── Media slots (image / audio) ── */
.display-text.display-image {
  width: 13vw;
  height: 13vw;
  max-width: 13vw;
  overflow: hidden;
  border-radius: 6px;
}
.display-realtime.display-image { width: 22vw; height: 22vw; max-width: 22vw; }
.display-level-1.display-image  { width: 12vw; height: 12vw; max-width: 12vw; }
.display-level-2.display-image  { width: 10vw; height: 10vw; max-width: 10vw; }
.display-level-3.display-image  { width: 8vw;  height: 8vw;  max-width: 8vw; }
.display-level-4.display-image  { width: 6vw;  height: 6vw;  max-width: 6vw; }
#text-display[data-wrap-mode="nowrap"] .display-text.display-image {
  max-width: 13vw !important;
}
.display-image .slot-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.display-text.display-audio-wave {
  width: 14vw;
  height: 4vw;
  max-width: 14vw;
  cursor: pointer;
}
.display-realtime.display-audio-wave { width: 22vw; height: 6vw;  max-width: 22vw; }
.display-level-1.display-audio-wave  { width: 13vw; height: 3.6vw; max-width: 13vw; }
.display-level-2.display-audio-wave  { width: 11vw; height: 3.2vw; max-width: 11vw; }
.display-level-3.display-audio-wave  { width: 9vw;  height: 2.8vw; max-width: 9vw; }
.display-level-4.display-audio-wave  { width: 7vw;  height: 2.4vw; max-width: 7vw; }
#text-display[data-wrap-mode="nowrap"] .display-text.display-audio-wave {
  max-width: 14vw !important;
}
.display-audio-wave .slot-waveform {
  width: 100%;
  height: 100%;
  display: block;
}
/* Video slots: same footprint as images, looping muted ambient preview. */
.display-text.display-video {
  width: 13vw;
  height: 13vw;
  max-width: 13vw;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}
.display-realtime.display-video { width: 22vw; height: 22vw; max-width: 22vw; }
.display-level-1.display-video  { width: 12vw; height: 12vw; max-width: 12vw; }
.display-level-2.display-video  { width: 10vw; height: 10vw; max-width: 10vw; }
.display-level-3.display-video  { width: 8vw;  height: 8vw;  max-width: 8vw; }
.display-level-4.display-video  { width: 6vw;  height: 6vw;  max-width: 6vw; }
#text-display[data-wrap-mode="nowrap"] .display-text.display-video {
  max-width: 13vw !important;
}
.display-video {
  position: relative;
}
.display-video .slot-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
/* Playback/scrub position bar shown on a video slot while scrubbing. */
.slot-scrub-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  display: none;
  background: var(--color-primary);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--color-primary);
  pointer-events: none;
}

/* ─── Navigation ────────────────────────────────────────────── */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--color-border);
  transition: transform 360ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 320ms ease;
  will-change: transform;
}

/* Auto-hide : barre rétractée hors écran, révélée au bord haut (cf. js/app.js setupAutoHideNav) */
#main-nav.nav-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* ── Brand ── */
.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#nav-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(0, 0%, 72%);
  line-height: 1.2;
}

.nav-subtitle {
  font-size: 0.6rem;
  color: var(--color-text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 400;
}

/* ── Tabs ── */
.nav-tabs {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 20px;
  color: var(--color-text-dim);
  cursor: pointer;
  transition: color var(--transition),
              border-bottom-color var(--transition);
}

.nav-tab:hover {
  color: var(--color-text);
}

.nav-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  text-shadow: 0 0 20px hsla(185, 100%, 55%, 0.35);
}

.tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}


/* ─── Panels ────────────────────────────────────────────────── */
.panel {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
  background: transparent;
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition),
              transform var(--transition);
}

.panel.hidden {
  display: none;
}

#panel-archive {
  background: var(--bg-deep);
}

.panel-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 24px;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  line-height: 1.3;
}

.panel-description {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 32px;
}


/* ─── Contribution Form ─────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}

textarea,
input[type="text"],
select {
  background: hsla(230, 25%, 15%, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color var(--transition),
              box-shadow var(--transition);
}

textarea:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px hsla(185, 100%, 55%, 0.15);
  outline: none;
}

textarea::placeholder,
input[type="text"]::placeholder {
  color: var(--color-text-dim);
  opacity: 0.6;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.char-counter {
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: 6px;
}

.form-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* ── Select (custom arrow) ── */
select {
  appearance: none;
  -webkit-appearance: none;
  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='%237a7f9a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

select option {
  background: var(--bg-surface-solid);
  color: var(--color-text);
}


/* ─── Audio Recorder ────────────────────────────────────────── */
.audio-recorder {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background: hsla(230, 25%, 10%, 0.7);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.btn-mic {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: hsla(185, 100%, 55%, 0.15);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition),
              transform var(--transition),
              border-color var(--transition),
              color var(--transition),
              box-shadow var(--transition);
}

.btn-mic:hover {
  background: hsla(185, 100%, 55%, 0.25);
  transform: scale(1.05);
}

.btn-mic.recording {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: hsla(340, 100%, 60%, 0.15);
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0%   { box-shadow: 0 0 0 0 hsla(340, 100%, 60%, 0.4); }
  70%  { box-shadow: 0 0 0 15px hsla(340, 100%, 60%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(340, 100%, 60%, 0); }
}

.mic-icon {
  width: 24px;
  height: 24px;
}

.recording-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.status-text {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}

.recording-timer {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  transition: color var(--transition);
}

.btn-mic.recording ~ .recording-status .recording-timer {
  color: var(--color-danger);
}

/* ── Audio Visualizer ── */
.audio-visualizer {
  display: flex;
  flex-direction: row;
  gap: 3px;
  height: 32px;
  align-items: center;
}

.wave-bar {
  width: 4px;
  background: var(--color-primary);
  border-radius: 2px;
  height: 8px;
  transition: height 150ms ease;
}

.audio-visualizer.active .wave-bar {
  animation: wave-bar 600ms ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * 0.1s);
}

@keyframes wave-bar {
  0%   { height: 8px; }
  50%  { height: 28px; }
  100% { height: 12px; }
}


/* ─── Audio Preview ─────────────────────────────────────────── */
.audio-preview {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.audio-preview audio {
  flex: 1;
  height: 36px;
  accent-color: var(--color-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition),
              border-color var(--transition),
              color var(--transition);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-icon:hover {
  border-color: var(--color-text-dim);
  color: var(--color-text);
}

.btn-danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: hsla(340, 100%, 60%, 0.15);
  border-color: var(--color-danger);
  color: var(--color-danger);
}


/* ─── Submit Button ─────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition),
              opacity var(--transition);
  margin-top: 8px;
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.btn-primary:hover .btn-glow {
  opacity: 0.1;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:disabled:active {
  transform: none;
}


/* ─── Submit Feedback ───────────────────────────────────────── */
.submit-feedback {
  text-align: center;
  padding: 40px;
}

.feedback-icon {
  font-size: 3rem;
  color: var(--color-primary);
  animation: float 3s ease-in-out infinite;
  margin-bottom: 16px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.submit-feedback p {
  color: var(--color-text-dim);
  font-size: 1rem;
  line-height: 1.6;
}


/* ─── Archive Panel ─────────────────────────────────────────── */

/* ── Search & Filters ── */
.archive-controls {
  margin-bottom: 24px;
}

.search-bar {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--color-text-dim);
  pointer-events: none;
}

#search-keyword {
  width: 100%;
  padding-left: 48px;
}

.filter-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.filter-select {
  flex: 1;
  min-width: 140px;
}


/* ── Results Grid ── */
.archive-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.archive-card {
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 6px 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--color-text);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  transition: color var(--transition);
  text-align: left;
}

.archive-card:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--color-primary);
}

.archive-card .card-time {
  color: var(--color-text-dim);
  font-weight: 500;
  flex-shrink: 0;
}

.archive-card .card-body {
  word-break: break-word;
}

.archive-card.has-image {
  align-items: flex-start;
}

.archive-image-thumb,
.archive-video-thumb {
  width: 72px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-right: 10px;
  vertical-align: top;
}
.archive-video-thumb {
  cursor: pointer;
}

.btn-play-inline {
  background: none;
  border: none;
  color: var(--color-primary);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: color var(--transition);
}

.btn-play-inline:hover {
  color: var(--color-accent);
}

.archive-card-share {
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--color-text-dim);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition);
}

.archive-card-share svg {
  width: 15px;
  height: 15px;
}

.archive-card:hover .archive-card-share {
  opacity: 0.8;
}

.archive-card-share:hover {
  opacity: 1;
  color: var(--color-primary);
  border-color: rgba(255, 255, 255, 0.18);
}


/* ── Archive Empty ── */
.archive-empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 3rem;
  color: var(--color-text-dim);
  margin-bottom: 16px;
}

.archive-empty p {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
}


/* ── Pagination ── */
.archive-pagination {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 16px 0;
}

.archive-load-more {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  padding: 10px 16px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.archive-load-more:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.09);
}

.archive-load-more[disabled] {
  cursor: wait;
  opacity: 0.55;
}

.archive-load-status {
  margin: 0;
  color: var(--color-text-dim);
  font-size: 0.78rem;
  text-align: center;
}

.btn-page {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--color-text-dim);
  cursor: pointer;
  transition: border-color var(--transition),
              color var(--transition);
}

.btn-page svg {
  width: 16px;
  height: 16px;
}

.btn-page:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-page:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.page-info {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}


/* ─── Board Controls (overlay) ────────────────────────────── */
#board-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 820;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.config-panel {
  position: fixed;
  inset: 0;
  z-index: 220;
}

.config-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.config-dialog {
  position: absolute;
  top: 84px;
  right: 24px;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 22px;
  border-radius: 20px;
  background: rgba(14, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.config-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: hsl(0, 0%, 86%);
}

.config-header p {
  margin-top: 6px;
  color: var(--color-text-dim);
  font-size: 0.95rem;
}

.btn-config-close {
  flex: 0 0 auto;
}

.config-auth,
.config-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.config-auth {
  margin-bottom: 18px;
}

.config-auth label,
.config-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--color-text);
  font-size: 0.92rem;
}

.config-auth input,
.config-grid input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  padding: 10px 12px;
  font: inherit;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.config-toggle {
  justify-content: space-between;
  min-height: 92px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.config-toggle input {
  width: 22px;
  height: 22px;
  align-self: flex-start;
}

.config-actions {
  justify-content: space-between;
  margin-top: 22px;
}

.config-status {
  color: var(--color-text-dim);
  min-height: 22px;
}

.config-save-btn,
.config-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.config-save-btn:hover,
.config-admin-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-control {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition),
              color var(--transition),
              background var(--transition);
}

.btn-control svg {
  width: 20px;
  height: 20px;
}

.control-symbol {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.btn-control:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-control[data-active="true"] {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: hsla(185, 100%, 55%, 0.15);
}

/* Speaker hover volume slider. The control cluster is anchored to the screen's
   right edge, so the horizontal slider unfurls to the LEFT of the speaker
   (into the viewport) on hover/focus. */
.ambiance-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ambiance-volume {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scaleX(0.6);
  transform-origin: right center;
  width: 120px;
  height: 6px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  -webkit-appearance: none;
  appearance: none;
  background: hsla(230, 25%, 60%, 0.35);
  border-radius: 3px;
  accent-color: var(--color-primary);
}
.ambiance-wrap:hover .ambiance-volume,
.ambiance-wrap:focus-within .ambiance-volume {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scaleX(1);
}
.ambiance-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.ambiance-volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
}

.control-badge {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: hsla(185, 100%, 55%, 0.15);
  color: var(--color-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid hsla(185, 100%, 55%, 0.25);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.control-badge:hover {
  border-color: var(--color-primary);
  background: hsla(185, 100%, 55%, 0.22);
  transform: translateY(-1px);
}

.stats-panel {
  position: fixed;
  inset: 0;
  z-index: 910;
}

.stats-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.54);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stats-dialog {
  position: absolute;
  right: 88px;
  bottom: 24px;
  width: min(280px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(14, 18, 28, 0.94);
  color: var(--color-text);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: var(--font-display);
}

.stats-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  cursor: pointer;
  font-size: 1.15rem;
}

.stats-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--color-primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stats-dialog h2 {
  margin: 0 34px 8px 0;
  font-size: 1.12rem;
}

.stats-reference {
  margin: 0 0 16px;
  color: var(--color-text-dim);
  font-size: 0.78rem;
}

.stats-levels {
  display: grid;
  gap: 8px;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.055);
}

.stats-row-name {
  color: rgba(238, 242, 247, 0.78);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.stats-row-count {
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 700;
}

.project-panel {
  position: fixed;
  inset: 0;
  z-index: 230;
}

.project-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.project-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(680px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 28px;
  border-radius: 18px;
  background: rgba(12, 16, 25, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 28px 88px rgba(0, 0, 0, 0.44);
}

.project-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  cursor: pointer;
  font-size: 1.15rem;
}

.project-dialog h2 {
  margin: 0 40px 16px 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.project-dialog h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--color-text);
}

.project-copy,
.project-rules,
.project-credits {
  color: rgba(238, 242, 247, 0.78);
  font-size: 0.94rem;
  line-height: 1.65;
  white-space: pre-line;
}

.project-rules {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.project-credits {
  margin-top: 18px;
  color: rgba(238, 242, 247, 0.58);
  font-size: 0.84rem;
}


.temporal-navigator {
  position: fixed;
  inset: 0 0 0 auto;
  width: 252px;
  z-index: 810;
  pointer-events: none;
}

.temporal-navigator-panel {
  position: absolute;
  right: 18px;
  top: 50%;
  display: grid;
  gap: 16px;
  width: min(220px, calc(100vw - 28px));
  padding: 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(18, 22, 34, 0.84);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translate(18px, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.temporal-navigator:hover .temporal-navigator-panel,
body.time-travel-active .temporal-navigator-panel,
body.time-travel-scrubbing .temporal-navigator-panel,
body.time-travel-dragging .temporal-navigator-panel {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

body.temporal-navigation-disabled .temporal-navigator {
  display: none;
}

.temporal-slider-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 48px 72px 1fr;
  align-items: center;
  min-height: 236px;
}

.temporal-year-slider {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 72px;
  height: 220px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  direction: rtl;
  writing-mode: vertical-lr;
  z-index: 2;
}

.temporal-year-slider::-webkit-slider-runnable-track {
  width: 0;
  height: 220px;
  background: transparent;
}

.temporal-year-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 64px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 0 5px rgba(85, 230, 255, 0.12), 0 0 18px rgba(85, 230, 255, 0.38);
}

.temporal-year-slider::-moz-range-track {
  width: 0;
  background: transparent;
}

.temporal-year-slider::-moz-range-thumb {
  width: 64px;
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 0 5px rgba(85, 230, 255, 0.12), 0 0 18px rgba(85, 230, 255, 0.38);
}

.temporal-graduations {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  position: relative;
  display: flex;
  height: 220px;
  width: 64px;
  flex-direction: column;
  justify-content: space-between;
  padding: 7px 0;
  pointer-events: none;
}

.temporal-graduations::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, rgba(238, 242, 247, 0.46), rgba(238, 242, 247, 0.16));
  transform: translateX(-50%);
}

.temporal-graduations span {
  width: 28px;
  height: 1px;
  background: rgba(238, 242, 247, 0.34);
  align-self: center;
}

.temporal-graduations span:nth-child(4n + 1) {
  width: 48px;
  background: rgba(238, 242, 247, 0.58);
}

.temporal-mark {
  position: absolute;
  left: 0;
  color: rgba(238, 242, 247, 0.62);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.temporal-mark-now {
  bottom: 4px;
}

.temporal-mark-year {
  top: 4px;
}

/* ─── Interaction Hint ──────────────────────────────────────── */
#interaction-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--bg-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 10px 24px;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-dim);
  animation: fadeInUp 600ms var(--transition) both;
  white-space: nowrap;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}


/* ─── Utility: Hidden ───────────────────────────────────────── */
.hidden {
  display: none !important;
}


/* ─── Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsla(185, 100%, 55%, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}



/* ─── Retractable Contribute Bar (bottom) ───────────────────── */
#contribute-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 44px;
  overflow: hidden;
  border-radius: 22px;
  background: hsla(230, 25%, 12%, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  box-shadow: none;
  z-index: 900;
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1),
              height 400ms cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 400ms cubic-bezier(0.4, 0, 0.2, 1),
              padding 400ms cubic-bezier(0.4, 0, 0.2, 1),
              bottom 400ms cubic-bezier(0.4, 0, 0.2, 1),
              background-color 300ms ease;
}

#contribute-bar:hover {
  background-color: hsla(230, 25%, 15%, 0.85);
}

#contribute-bar.expanded {
  width: 90%;
  max-width: 960px;
  height: auto;
  min-height: 240px;
  border-radius: var(--radius-lg);
  padding: 24px;
  bottom: 24px;
  background: hsla(230, 25%, 8%, 0.96);
  border: none;
  box-shadow: none;
}

/* ── Bar Handle ── */
.bar-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin-top: -1px; /* Align border */
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
}

#contribute-bar.expanded .bar-handle {
  height: 36px;
  margin-top: -12px;
  margin-bottom: 20px;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
  cursor: default;
}

.bar-handle-icon {
  color: var(--color-primary);
  animation: pulse-glow 2s infinite alternate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bar-handle-icon svg {
  width: 42px;
  height: 18px;
  overflow: visible;
}

.bar-chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-dim);
  transition: transform 300ms ease;
}

#contribute-bar.expanded .bar-chevron {
  transform: rotate(180deg);
  cursor: pointer;
}

/* ── Bar Body (Form Container) ── */
.bar-body {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  transition: opacity 200ms ease;
}

#contribute-bar.expanded .bar-body {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  height: auto;
  overflow: visible;
  transition: opacity 400ms ease 150ms;
}

/* ── Form Layout ── */
.bar-layout {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: stretch;
}

/* Stacked contribute layout: text field on top, tool icons (with captions)
   below it, then previews, then submit. */
.bar-layout-stacked {
  flex-direction: column;
  gap: 12px;
}
.bar-layout-stacked .bar-col-text { flex: none; }
.bar-layout-stacked .bar-col-submit { flex: none; }

.bar-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  background: hsla(230, 25%, 5%, 0.6);
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.bar-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
/* Hide a tool (icon + caption) when its variant/capability is off. */
.bar-tool:has(> .btn-mic-bar.hidden) { display: none; }
.bar-tool-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  font-size: 0.72rem;
  color: var(--color-text-dim);
}
.bar-tool-label small {
  font-size: 0.62rem;
  opacity: 0.7;
}
.bar-tool-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  align-self: center;
}

.bar-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-col-text {
  flex: 2;
  min-width: 0;
}

.bar-col-options {
  flex: 1.3;
}

.bar-col-submit {
  flex: 0.9;
  justify-content: flex-end;
}

/* ── Form Controls overrides ── */
textarea#input-text {
  width: 100%;
  height: 100%;
  min-height: 132px;
  font-size: 0.95rem;
  line-height: 1.5;
  background: hsla(230, 25%, 5%, 0.6);
  border: 1px solid var(--color-border);
}

.bar-char {
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: -6px;
}

.bar-audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  background: hsla(230, 25%, 5%, 0.6);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.btn-mic-bar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: hsla(185, 100%, 55%, 0.1);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
}

.btn-mic-bar:hover {
  background: hsla(185, 100%, 55%, 0.25);
  transform: scale(1.05);
}

.btn-mic-bar.recording {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: hsla(340, 100%, 60%, 0.15);
  animation: pulse-glow 1.5s infinite;
}

.mic-icon-sm {
  width: 18px;
  height: 18px;
}

.bar-status {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-timer {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  font-weight: 500;
}

.bar-preview {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: hsla(230, 25%, 5%, 0.6);
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-top: 10px;
}

.bar-preview audio {
  flex: 1;
  height: 32px;
  accent-color: var(--color-primary);
}

.image-preview {
  align-items: flex-start;
}

.image-preview img {
  width: 112px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.03);
}

.video-preview {
  align-items: center;
}
.video-preview video {
  width: 112px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.4);
}
.video-preview-label {
  flex: 1;
  font-size: 0.82rem;
  color: var(--color-text-soft, rgba(235, 240, 250, 0.7));
}

/* ── Video trim modal (QuickTime-style start/end selection) ── */
.video-trim-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 14, 0.72);
  backdrop-filter: blur(4px);
}
.video-trim-overlay.hidden { display: none; }
.video-trim-modal {
  width: min(560px, 92vw);
  background: hsla(230, 28%, 8%, 0.98);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 16px 18px 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.video-trim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.video-trim-title {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: rgba(240, 244, 252, 0.92);
}
.video-trim-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 244, 252, 0.8);
  cursor: pointer;
}
.video-trim-close:hover { background: rgba(255, 255, 255, 0.14); }
.video-trim-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-trim-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.video-trim-track {
  position: relative;
  height: 38px;
  margin: 14px 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--color-border);
  touch-action: none;
}
.video-trim-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: hsla(var(--hue-primary, 210), 90%, 60%, 0.28);
  border-left: 2px solid var(--color-primary);
  border-right: 2px solid var(--color-primary);
  pointer-events: none;
}
.video-trim-handle {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 46px;
  margin-left: -8px;
  border-radius: 5px;
  background: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: ew-resize;
  touch-action: none;
}
.video-trim-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 18px;
  margin: -9px 0 0 -1px;
  background: rgba(8, 10, 16, 0.7);
  border-radius: 2px;
}
.video-trim-playhead {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.video-trim-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.video-trim-readout {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: rgba(235, 240, 250, 0.82);
}
.video-trim-actions {
  display: flex;
  gap: 8px;
}
.video-trim-btn-secondary,
.video-trim-btn-primary {
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--color-border);
}
.video-trim-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 244, 252, 0.85);
}
.video-trim-btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }
.video-trim-btn-primary {
  background: var(--color-primary);
  color: #07101e;
  border-color: transparent;
  font-weight: 600;
}
.video-trim-btn-primary:disabled { opacity: 0.5; cursor: default; }
.video-trim-hint {
  margin: 10px 2px 0;
  font-size: 0.78rem;
  color: rgba(220, 226, 238, 0.55);
}

.btn-del-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: hsla(340, 100%, 60%, 0.1);
  color: var(--color-danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 200ms ease;
}

.btn-del-sm:hover {
  background: hsla(340, 100%, 60%, 0.25);
  transform: scale(1.1);
}

/* ── Submit Button ── */
.bar-submit-btn {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 250ms ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bar-submit-btn:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px hsla(185, 100%, 55%, 0.25);
}

.bar-submit-btn:active {
  transform: translateY(0);
}

.bar-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.bar-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-primary);
  text-align: center;
}

/* ── Language Switcher in Navbar ── */


/* ─── Responsive: Mobile (≤600px) ───────────────────────────── */
@media (max-width: 600px) {
  .nav-tabs span {
    display: none;
  }

  .nav-tab {
    padding: 10px 14px;
  }

  .form-row {
    flex-direction: column;
  }

  .panel-inner {
    padding: 24px 16px;
  }

  .archive-results {
    grid-template-columns: 1fr;
  }

  #board-controls {
    bottom: 16px;
    right: 16px;
  }

  .panel-header h2 {
    font-size: 1.5rem;
  }

  .audio-recorder {
    flex-wrap: wrap;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-select {
    min-width: 100%;
  }

  /* Mobile Contribute Bar overrides */
  #contribute-bar.expanded {
    width: 95%;
    padding: 16px;
    bottom: 12px;
    min-height: auto;
  }

  .bar-layout {
    flex-direction: column;
    gap: 14px;
  }

  .bar-col-submit {
    height: 46px;
  }

  textarea#input-text {
    min-height: 80px;
  }
}

/* ─── Archive Split Sidebar Layout ─── */
body.archive-active #panel-archive {
  display: block !important;
  position: fixed;
  left: 0;
  width: 25vw;
  top: var(--nav-height);
  bottom: 0;
  border-right: 1px solid var(--color-border);
  background: hsla(230, 25%, 8%, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(0);
}

body.archive-active #text-display {
  left: 25vw;
  width: 75vw;
}

/* Sidebar responsive content adjustments */
body.archive-active .panel-inner {
  max-width: 100%;
  padding: 24px 16px;
  margin: 0;
}

body.archive-active .panel-header h2 {
  font-size: 1.35rem;
}

body.archive-active .panel-description {
  font-size: 0.8rem;
  margin-bottom: 16px;
}

/* ─── Time Travel Banner ─── */
#time-travel-banner {
  width: 100%;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--color-text);
  padding: 12px 12px 14px;
  border-radius: 14px;
  display: grid;
  gap: 8px;
  justify-items: start;
  font-size: 0.85rem;
  font-family: var(--font-display);
  animation: fadeIn 300ms ease;
}

.time-travel-icon {
  font-size: 1rem;
  opacity: 0.8;
}

.time-travel-caption {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-dim);
}

.time-travel-date {
  display: block;
  font-size: 0.98rem;
  line-height: 1.35;
  color: rgba(245, 248, 252, 0.98);
}

.time-travel-date-input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 248, 252, 0.98);
  padding: 8px 9px;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.25;
  color-scheme: dark;
}

.time-travel-date-input:focus {
  border-color: rgba(91, 209, 234, 0.48);
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 209, 234, 0.12);
}

.time-travel-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(1);
  opacity: 0.74;
}

.time-travel-speed {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.7);
}

.btn-time-travel-exit {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: opacity var(--transition);
}

.btn-time-travel-exit:hover {
  opacity: 0.9;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Clickable Timestamps ─── */
.card-time.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: color var(--transition);
}

.card-time.clickable:hover {
  color: var(--color-primary);
}

body.time-travel-active #time-travel-banner {
  border-color: rgba(91, 209, 234, 0.28);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.42);
}

body.time-travel-active #text-display::before {
  opacity: 0.72;
}

body.time-travel-scrubbing #text-display {
  transition-duration: 90ms, 90ms, 220ms, 220ms;
}

body.time-travel-scrubbing #time-travel-banner {
  border-color: rgba(216, 247, 255, 0.42);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.48);
}

body.time-travel-dragging {
  cursor: ns-resize;
}

@media (max-width: 820px) {
  .temporal-navigator {
    inset: auto 0 92px auto;
    width: 224px;
    height: 360px;
  }

  .temporal-navigator-panel {
    right: 12px;
    top: auto;
    bottom: 0;
    width: min(210px, calc(100vw - 24px));
    transform: translateX(18px);
  }

  .temporal-navigator:hover .temporal-navigator-panel,
  body.time-travel-active .temporal-navigator-panel,
  body.time-travel-scrubbing .temporal-navigator-panel,
  body.time-travel-dragging .temporal-navigator-panel {
    transform: translateX(0);
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ─── Mobile Sidebar Override ─── */
@media (max-width: 768px) {
  body.archive-active #panel-archive {
    width: 100vw;
    border-right: none;
  }
  body.archive-active #text-display {
    left: 0;
    width: 100vw;
  }
}
