/* ═══════════════════════════════════════════════════════════════════════════
   Audiographer — FilmProcessor Design System
   Professional audio signal analysis and metering
   Matches Spatializer/Transcoder card pattern
   ═══════════════════════════════════════════════════════════════════════════ */

/* Import Fonts */
@font-face {
  font-family: "FilmProcessorFavorit";
  src: url("/assets/fonts/FilmProcessorFavorit-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "FilmProcessorFavorit";
  src: url("/assets/fonts/FilmProcessorFavorit-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-LatinExt.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* Design System Variables */
:root {
  --background-black: #000000;
  --heading-cyan: #00b9c7;
  --film-purple: #b40096;
  --title-white: #fffedc;
  --film-card-blue: #2563eb;
  --dcp-success: #22c55e;
  --error-red: #ef4444;
  --warning-orange: #f59e0b;
  --film-gray-900: #111111;
  --film-gray-800: #1a1a1a;
  --film-gray-700: #2a2a2a;
  --field-gray: #333333;
  --film-gray-500: #666666;
  --settings-row-height: 2.2rem;
}

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

*:focus {
  outline: none;
}

*:focus-visible {
  outline: 1px solid var(--heading-cyan);
  outline-offset: 2px;
}

select, input, button, textarea {
  border-radius: 0;
}

body {
  font-family: "FilmProcessorFavorit", "Inter", sans-serif;
  background: var(--background-black);
  color: var(--title-white);
  font-weight: 300;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ─── Container ──────────────────────────────────────────────────────────── */

.container {
  padding: 0 150px 2rem 150px;
  max-width: 100%;
  overflow-x: hidden;
}

.page-title {
  font-family: "FilmProcessorFavorit", "Inter", sans-serif;
  font-size: 3.7rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--title-white);
  margin-bottom: 1rem;
  text-align: center;
}

.page-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--heading-cyan);
  text-align: center;
  margin-bottom: 3rem;
}

/* ─── Grid Layout ─────────────────────────────────────────────────────────── */

.audiographer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  overflow: hidden;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--background-black);
  border: 1px solid var(--field-gray);
  border-radius: 0;
  padding: 0.75rem 1.5rem 1.25rem;
  transition: border-color 0.3s ease;
  min-width: 0;
  overflow: hidden;
}

.input-source-card {
  padding-bottom: 1.25rem;
}

.card:hover {
  border-color: var(--dcp-success);
}

.section-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--film-purple);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--film-purple);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.section-title-with-icon {
  justify-content: space-between;
}


/* ─── A/B Slot Labels ─────────────────────────────────────────────────────── */

.ab-slot-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--film-purple);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
}

.ab-slot-label:first-child {
  margin-top: 0;
}

/* ─── View Toggle (A / B / Diff) ──────────────────────────────────────────── */

#viewToggle {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.view-toggle-row {
  display: flex;
  gap: 0.5rem;
}

.view-toggle-row .mode-btn {
  flex: 1;
}

.mode-btn.disabled {
  color: var(--film-gray-500);
  border-color: var(--field-gray);
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

#sourceBSection {
  margin-top: 0.75rem;
}

/* ─── Add Source B Button ──────────────────────────────────────────────────── */

.add-source-b-btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--field-gray);
  color: var(--film-gray-500);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  margin-top: 0.75rem;
}

.add-source-b-btn:hover {
  border-color: var(--film-purple);
  color: var(--film-purple);
}

/* ─── Filename Box Metadata ───────────────────────────────────────────────── */

.waveform-filename-box .filename-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--film-gray-500);
  white-space: nowrap;
  flex-shrink: 0;
}


/* Dual upload zones — compact height */
#uploadZoneA,
#uploadZoneB {
  padding: 1.25rem;
  min-height: 70px;
}

#uploadZoneA.has-file,
#uploadZoneB.has-file {
  padding: 0;
}

#uploadZoneA.has-file .waveform-canvas,
#uploadZoneB.has-file .waveform-canvas {
  height: 80px;
}

/* ─── Input Controls ──────────────────────────────────────────────────────── */

.input-mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mode-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--field-gray);
  background: transparent;
  color: var(--film-gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}

.mode-btn:hover {
  border-color: var(--film-purple);
  color: var(--film-purple);
}

.mode-btn.active {
  border-color: var(--heading-cyan);
  color: var(--heading-cyan);
}

.source-select {
  width: 100%;
  max-width: 100%;
  background: #000000;
  border: 1px solid var(--film-purple);
  border-radius: 0;
  padding: 8px 12px;
  padding-right: 28px;
  color: var(--title-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23b40096' viewBox='0 0 16 16'%3e%3cpath d='m7.247 4.86-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 12px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.source-select:focus {
  border-color: var(--heading-cyan);
  box-shadow: 0 0 0 1px var(--heading-cyan);
}

.source-select option {
  background: #000000;
  color: var(--title-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.2;
}

.source-select-pink {
  width: 100%;
  max-width: 100%;
  background: #000000;
  border: 1px solid var(--heading-cyan);
  border-radius: 0;
  padding: 8px 12px;
  padding-right: 28px;
  color: var(--title-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%2300b9c7' viewBox='0 0 16 16'%3e%3cpath d='m7.247 4.86-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 12px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.source-select-pink:focus {
  border-color: var(--heading-cyan);
  box-shadow: 0 0 0 1px var(--heading-cyan);
}

.source-select-pink option {
  background: #000000;
  color: var(--title-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.2;
}

/* Upload zone */
.upload-zone {
  border: 1px dashed var(--heading-cyan);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  background: rgba(17, 17, 17, 0.3);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.upload-zone:not(.has-file) {
  margin-bottom: 0.3rem;
}

.upload-zone:hover {
  border-color: var(--heading-cyan);
  background: rgba(0, 185, 199, 0.05);
}

.upload-zone.dragover {
  border-color: var(--film-purple);
  background: rgba(180, 0, 150, 0.1);
}

.upload-zone.has-file {
  border-color: var(--heading-cyan);
  border-style: solid;
  padding: 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.upload-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--film-gray-500);
}

.file-input {
  display: none;
}

.file-info {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--heading-cyan);
  padding: 0.5rem;
}

/* Waveform canvas in upload zone */
.waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #000000;
  max-width: 100%;
}

.upload-zone.has-file .waveform-canvas {
  height: 100px;
  display: block;
  cursor: crosshair;
}

.upload-zone.has-file .waveform-canvas.scrubbing {
  cursor: col-resize;
}

/* Waveform playhead */
.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--title-white);
  pointer-events: none;
  z-index: 10;
  display: none;
  box-shadow: 0 0 4px rgba(255, 254, 220, 0.5);
}

.waveform-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -3px;
  width: 7px;
  height: 7px;
  background: var(--title-white);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.waveform-filename-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--heading-cyan);
  background: #000;
  padding: 0.4rem 0.6rem;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  margin-top: 0.75rem;
}

.waveform-filename-box .filename-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--title-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.waveform-filename-box .filename-close {
  background: none;
  border: none;
  color: var(--film-purple);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.waveform-filename-box .filename-close:hover {
  color: var(--title-white);
}

/* Transport controls */
.transport-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 20px;
  padding: 0.24rem 0 0.12rem;
  margin-top: 0.75rem;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.control-icon {
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  border: none;
  color: var(--film-purple);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  padding: 0;
}

.control-icon:hover {
  color: var(--heading-cyan);
}

.play-icon::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}

.play-icon.playing::before {
  border-width: 0;
  width: 6px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.stop-icon::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: currentColor;
}

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 10px;
  cursor: pointer;
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: visible;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 254, 220, 0.6);
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
}

.progress-handle {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--title-white);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
}

.timecode-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  text-align: right;
}

/* ─── Device Info ──────────────────────────────────────────────────────────── */

.device-info {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: var(--film-gray-500);
  margin-top: 0.35rem;
  line-height: 1.6;
}

.device-info span {
  color: var(--heading-cyan);
}

/* ─── Spectrogram Container ───────────────────────────────────────────────── */

.spectrogram-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  border: 1px solid var(--field-gray);
  overflow: hidden;
  background: var(--background-black);
}

.spectrogram-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.spectrogram-freq-axis {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 30px;
  width: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 4px 6px;
  pointer-events: none;
}

.spectrogram-freq-axis span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: rgba(255, 254, 220, 0.4);
  line-height: 1;
}

.spectrogram-time-axis {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 60px;
  height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 4px 4px;
  pointer-events: none;
}

.spectrogram-time-axis span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: rgba(255, 254, 220, 0.4);
  transform: rotate(-45deg);
  transform-origin: bottom right;
}

/* Fullscreen toggle */
.fullscreen-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--film-purple);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.fullscreen-toggle:hover {
  color: var(--heading-cyan);
}

.compatibility-atlas-link {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--film-purple);
  text-decoration: none;
  transition: color 0.2s ease;
  transform: translateX(3px);
}

.compatibility-atlas-link:hover {
  color: var(--heading-cyan);
}

#spectrogramCard:fullscreen,
#spectrogramCard:-webkit-full-screen {
  background: var(--background-black);
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
}

#spectrogramCard:fullscreen .section-title,
#spectrogramCard:-webkit-full-screen .section-title {
  display: none;
}

#spectrogramCard:fullscreen:hover,
#spectrogramCard:-webkit-full-screen:hover {
  border-color: transparent;
}

#spectrogramCard:fullscreen .spectrogram-container,
#spectrogramCard:-webkit-full-screen .spectrogram-container {
  flex: 1;
  aspect-ratio: unset;
}

#spectrogramCard:fullscreen .fullscreen-toggle .fs-expand,
#spectrogramCard:-webkit-full-screen .fullscreen-toggle .fs-expand {
  display: none;
}

#spectrogramCard:fullscreen .fullscreen-toggle .fs-compress,
#spectrogramCard:-webkit-full-screen .fullscreen-toggle .fs-compress {
  display: block !important;
}

html.spectrogram-mobile-fullscreen-active,
body.spectrogram-mobile-fullscreen-active {
  overflow: hidden;
}

#spectrogramCard.spectrogram-mobile-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--background-black);
  padding: 0.75rem;
  border: none;
  display: flex;
  flex-direction: column;
}

#spectrogramCard.spectrogram-mobile-fullscreen .spectrogram-container {
  flex: 1;
  aspect-ratio: unset;
  min-height: 0;
}

#spectrogramCard.spectrogram-mobile-fullscreen .fullscreen-toggle .fs-expand {
  display: none !important;
}

#spectrogramCard.spectrogram-mobile-fullscreen .fullscreen-toggle .fs-compress {
  display: block !important;
}

.spectrogram-controls {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ─── Loudness Panel ──────────────────────────────────────────────────────── */

.loudness-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.loudness-value {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--field-gray);
  text-align: center;
}

.loudness-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: var(--film-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.15rem;
}

.loudness-number {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-cyan);
  display: block;
  line-height: 1.2;
}

.loudness-unit {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: var(--film-gray-500);
  margin-left: 0.2rem;
}

.loudness-number.warning {
  color: var(--warning-orange);
}

.loudness-number.danger {
  color: var(--error-red);
}

/* Loudness history graph */
.loudness-history {
  width: 100%;
  min-height: 80px;
  flex: 1;
  border: 1px solid var(--field-gray);
  background: var(--background-black);
  margin-top: 0.5rem;
}

.loudness-history canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Level Meters ────────────────────────────────────────────────────────── */

.meters-container {
  display: flex;
  gap: 0;
  align-items: stretch;
  justify-content: space-between;
  padding: 0;
  min-width: 0;
  overflow-x: auto;
  flex: 1;
}

.meter-channel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  max-width: 24px;
}

.meter-track {
  width: 6px;
  min-height: 60px;
  flex: 1;
  background: var(--field-gray);
  position: relative;
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--heading-cyan);
  transition: height 0.05s linear;
}

.meter-fill.hot {
  background: var(--warning-orange);
}

.meter-fill.clip {
  background: var(--error-red);
}

.meter-rms {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 185, 199, 0.4);
  transition: height 0.05s linear;
}

.meter-peak-hold {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--title-white);
  transition: bottom 0.05s linear;
}

.meter-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: var(--film-gray-500);
  text-transform: uppercase;
}

.meter-db {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.45rem;
  color: var(--film-gray-500);
  min-width: 28px;
  text-align: center;
}

/* ─── True Peak Grid ──────────────────────────────────────────────────────── */

.true-peak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.3rem;
}

/* ─── Phase / Goniometer ──────────────────────────────────────────────────── */

.phase-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.phase-bar-container {
  flex: 1;
  height: 6px;
  background: var(--field-gray);
  position: relative;
}

.phase-bar-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--film-gray-500);
}

.phase-indicator {
  position: absolute;
  top: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--heading-cyan);
  transform: translateX(-50%);
  transition: left 0.05s linear;
}

.phase-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: var(--film-gray-500);
  min-width: 16px;
  text-align: center;
}

.phase-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--heading-cyan);
  min-width: 40px;
  text-align: right;
}

.goniometer-container {
  position: relative;
  width: 100%;
  min-height: 200px;
  flex: 1;
  border: 1px solid var(--field-gray);
  background: var(--background-black);
}

.goniometer-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.goniometer-labels {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.goniometer-labels span {
  position: absolute;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.5rem;
  color: var(--film-gray-500);
}

.goniometer-labels .label-l { top: 2px; left: 2px; }
.goniometer-labels .label-r { top: 2px; right: 2px; }
.goniometer-labels .label-m { bottom: 2px; left: 50%; transform: translateX(-50%); }
.goniometer-labels .label-s { top: 50%; right: 2px; transform: translateY(-50%); }

/* ─── RTA ──────────────────────────────────────────────────────────────────── */

.rta-container {
  width: 100%;
  min-height: 200px;
  flex: 1;
  border: 1px solid var(--field-gray);
  background: var(--background-black);
  position: relative;
}

.metering-col {
  border-right: 1px solid var(--field-gray);
  padding-right: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.metering-col:last-child {
  border-right: none;
  padding-right: 0;
}

.rta-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Controls Row ─────────────────────────────────────────────────────────── */

.control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.control-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: var(--film-gray-500);
  min-width: 50px;
  flex-shrink: 0;
}

.control-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: var(--heading-cyan);
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--field-gray);
  background: transparent;
  color: var(--film-gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
}

.btn:hover {
  border-color: var(--error-red);
  color: var(--error-red);
  background: transparent;
}

.btn.capturing {
  border-color: var(--error-red);
  color: var(--error-red);
  animation: capture-pulse 2s ease-in-out infinite;
}

@keyframes capture-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Target Lines ─────────────────────────────────────────────────────────── */

.target-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
}

.target-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.target-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  color: var(--film-gray-500);
  flex: 1;
}

.target-value-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  color: var(--heading-cyan);
}

/* ─── Channel Config ───────────────────────────────────────────────────────── */

.channel-config {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.channel-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--field-gray);
  color: var(--film-gray-500);
  text-align: center;
}

.channel-tag.active {
  border-color: var(--heading-cyan);
  color: var(--heading-cyan);
}

/* ─── Settings Columns ─────────────────────────────────────────────────────── */

.settings-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
}

.settings-column {
  min-width: 0;
}

.settings-section-title {
  margin-bottom: 0.75rem;
}

.settings-controls-stack,
.settings-metadata-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.settings-controls-stack .source-select {
  margin-bottom: 0;
}

/* ─── Settings Row ─────────────────────────────────────────────────────────── */

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--settings-row-height);
  padding: 0;
  border-bottom: 1px solid var(--field-gray);
}

.settings-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--title-white);
}

.settings-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: var(--heading-cyan);
}

/* ─── Privacy Notice ───────────────────────────────────────────────────────── */

.privacy-notice {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  color: var(--film-gray-500);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--field-gray);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* ─── Scrollbars ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #96007d; border-radius: 2px; }
* { scrollbar-width: thin; scrollbar-color: #96007d transparent; }

/* ─── Sub-Grids ────────────────────────────────────────────────────────────── */

.meters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Metering 4-column grid */
.metering-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 1.5rem;
}

.metering-col-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--heading-cyan);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

.analysis-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 1.5rem;
}

.analysis-row .source-select {
  margin-bottom: 0;
  border-color: var(--heading-cyan);
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1600px) {
  .metering-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metering-col,
  .metering-col:last-child {
    border-right: none;
    padding-right: 0;
    border: 1px solid var(--field-gray);
    padding: 0.75rem;
  }

  .goniometer-container,
  .rta-container {
    min-height: 180px;
    max-height: none;
    flex: 1;
  }

  .meters-container {
    flex: none;
    min-height: 120px;
    max-height: 250px;
  }

  .meter-track {
    min-height: 60px;
  }

  .loudness-history {
    flex: none;
    min-height: 60px;
    max-height: 120px;
  }

}

@media (max-width: 1200px) {
  .controls-row {
    grid-template-columns: 1fr 1fr;
  }

  .analysis-row {
    grid-template-columns: 1fr 1fr;
  }

  .settings-columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .meters-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 2rem 2rem 2rem;
  }

  .controls-row {
    grid-template-columns: 1fr;
  }

  .loudness-grid {
    grid-template-columns: 1fr 1fr;
  }

  .spectrogram-container {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 600px) {
  .analysis-row {
    grid-template-columns: 1fr;
  }

  .metering-grid {
    grid-template-columns: 1fr;
  }

  .goniometer-container,
  .rta-container {
    min-height: 150px;
    max-height: 250px;
  }

  .meters-container {
    min-height: 100px;
    max-height: 200px;
  }
}

/* ─── Touch devices — revert to default cursors ──────────────────────────── */

@media (pointer: coarse) {
  .upload-zone.has-file .waveform-canvas,
  .upload-zone.has-file .waveform-canvas.scrubbing {
    cursor: default;
  }
}
