/* ─── Reset ────────────────────────────────────────────── */

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

/* ─── Variables ────────────────────────────────────────── */

:root {
  --bg: #ffffff;
  --bg-adaptive: #ffffff;
  --text: #2c2c2c;
  --text-dim: rgba(44, 44, 44, 0.40);
  --text-hover: rgba(44, 44, 44, 0.70);
  --border: rgba(44, 44, 44, 0.12);
  --border-active: rgba(44, 44, 44, 0.45);
  --serif: 'Cormorant Garamond', 'Garamond', 'Georgia', serif;
  --math: 'STIX Two Text', 'Cambria Math', 'Times New Roman', serif;
}

/* ─── Base ─────────────────────────────────────────────── */

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 300;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Layout ───────────────────────────────────────── */

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 40px 60px;
}

/* ─── Header ───────────────────────────────────────────── */

.header {
  margin-bottom: 28px;
}

.header-row {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}

.title {
  font-family: var(--math);
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--text);
}

.header-eq {
  font-family: var(--math);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.header-sub {
  font-family: var(--math);
  font-size: 0.68rem;
  color: rgba(44, 44, 44, 0.28);
  letter-spacing: 0.04em;
  margin-top: 6px;
}

/* ─── Canvas ───────────────────────────────────────────── */

.canvas-wrapper {
  margin-bottom: 0;
}

.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
}

.canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#overlayCanvas {
  pointer-events: auto;
}

/* ─── Dividers ─────────────────────────────────────────── */

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ─── Navigation Rows ──────────────────────────────────── */

.nav-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.scene-nav {
  margin-bottom: 14px;
}

.fn-label {
  font-family: var(--math);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  user-select: none;
  flex-shrink: 0;
}

.nav-btn {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--math);
  font-weight: 400;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
  line-height: 1;
}

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

.nav-btn.active {
  color: var(--text);
  border-bottom-color: var(--border-active);
}

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

.controls {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

/* ─── Play / Pause Toggle ──────────────────────────────── */

.transport {
  display: flex;
  align-items: center;
  padding-top: 4px;
}

.play-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.play-toggle:hover {
  background: rgba(44, 44, 44, 0.06);
}

.play-toggle.is-playing {
  color: var(--text);
  border-color: var(--text);
  background: rgba(44, 44, 44, 0.06);
}

.play-toggle .pause-icon { display: none; }
.play-toggle.is-playing .play-icon { display: none; }
.play-toggle.is-playing .pause-icon { display: block; }

/* ─── Sliders ──────────────────────────────────────────── */

.sliders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 260px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slider-group-inline {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.slider-label {
  font-family: var(--math);
  font-style: italic;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  width: 72px;
  flex-shrink: 0;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 1px;
  background: var(--border-active);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--text);
}

.slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  border: none;
  cursor: pointer;
}

.slider::-moz-range-track {
  height: 1px;
  background: var(--border-active);
  border: none;
}

.slider-val {
  font-family: var(--math);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  width: 32px;
  text-align: right;
}

/* ─── Select ───────────────────────────────────────────── */

.styled-select {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--math);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  outline: none;
  transition: color 0.3s ease, border-color 0.3s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='rgba(44,44,44,0.25)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.styled-select:hover,
.styled-select:focus {
  color: var(--text-hover);
  border-color: var(--border-active);
}

.styled-select option {
  background: #ffffff;
  color: var(--text);
}

/* ─── Instrument buttons inline ────────────────────────── */

.inst-btn {
  font-size: 0.72rem;
  padding: 3px 0;
}

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

@media (max-width: 768px) {
  .app {
    padding: 24px 16px 44px;
  }

  .title {
    font-size: 0.95rem;
  }

  .header-eq {
    display: none;
  }

  .nav-row {
    gap: 12px;
  }

  .divider {
    margin: 16px 0;
  }

  .controls {
    flex-direction: column;
    gap: 20px;
  }
}
