:root {
  color-scheme: dark;
  --bg: #050507;
  --panel: rgba(255, 255, 255, 0.045);
  --panel2: rgba(255, 255, 255, 0.075);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --stroke: rgba(255, 255, 255, 0.11);
  --accent: #d1132f;
  --accent2: #6b0011;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  position: relative;
}

/* Slow, calming animated red “ink” */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 540px at 18% 14%, rgba(209, 19, 47, 0.22), transparent 64%),
    radial-gradient(820px 560px at 84% 18%, rgba(107, 0, 17, 0.22), transparent 62%),
    radial-gradient(920px 620px at 52% 110%, rgba(209, 19, 47, 0.12), transparent 62%),
    radial-gradient(760px 520px at 72% 76%, rgba(209, 19, 47, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  filter: blur(10px) saturate(1.05);
  opacity: 0.95;
  transform: translate3d(0, 0, 0);
  animation: inkDrift 60s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(700px 380px at 40% 40%, rgba(255, 255, 255, 0.03), transparent 70%),
    radial-gradient(800px 460px at 70% 50%, rgba(0, 0, 0, 0.45), transparent 65%);
  mix-blend-mode: overlay;
  opacity: 0.55;
}

@keyframes inkDrift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1.02);
  }
  50% {
    transform: translate3d(2%, 1.5%, 0) scale(1.05);
  }
  100% {
    transform: translate3d(-1%, 2%, 0) scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.95em;
}

.app {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px 18px 40px;
  padding-left: calc(18px + env(safe-area-inset-left, 0px));
  padding-right: calc(18px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.hero {
  padding: 14px 0 2px;
}

.hero-left {
  max-width: 840px;
}

.hero-right {
  align-self: flex-start;
}

.hero-note {
  padding-top: 10px;
  text-align: right;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 10px;
}

.kicker::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(209, 19, 47, 0.9);
  box-shadow: 0 0 0 6px rgba(209, 19, 47, 0.12);
}

.title {
  font-size: clamp(26px, 5.6vw, 34px);
  line-height: 1.15;
  margin: 0;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 56ch;
  font-size: clamp(13px, 3.7vw, 15px);
}

.transport {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status {
  min-width: 160px;
  text-align: right;
  color: var(--muted);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:not(:disabled) {
  border-color: rgba(209, 19, 47, 0.62);
  background: linear-gradient(180deg, rgba(209, 19, 47, 0.32), rgba(209, 19, 47, 0.12));
}

.btn-link:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.btn:hover:not(:disabled) {
  border-color: rgba(209, 19, 47, 0.35);
}

.panel {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.fineprint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
}

/* Reverb slider: extra touch-friendly on phones */
.reverb {
  display: grid;
  gap: 6px;
  min-width: min(52vw, 320px);
}

.reverb-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.reverb-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.reverb-value {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.reverb-slider::-webkit-slider-runnable-track {
  height: 8px;
}

.reverb-slider::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -10px; /* centers thumb on 8px track */
}

.reverb-slider::-moz-range-track {
  height: 8px;
}

.reverb-slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.panel-meta {
  text-align: right;
  max-width: 28ch;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.row {
  display: grid;
  grid-template-columns: 160px 1fr 70px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* Touch-friendly range styling (keeps WebAudio faders usable on mobile) */
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(209, 19, 47, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  margin-top: -7px; /* centers thumb on 6px track */
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(209, 19, 47, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.faders {
  /* Compact "channel strip" row (mynoise-like density) */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  margin-top: 12px;
}

.fader-col {
  /* No cards: keep channels tight and close */
  width: 48px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  justify-items: center;
  gap: 4px;
  padding: 2px 0;
}

.fader-name {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.fader-slider {
  /* Vertical slider (Chromium/WebKit) */
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 22px;
  height: clamp(150px, 34vh, 220px);
  /* Vertical slider (Firefox) */
  writing-mode: vertical-rl;
  direction: rtl;
  background: transparent;
  /* Let iOS interact with the control naturally */
  touch-action: manipulation;
}

.fader-slider:focus-visible {
  outline: 2px solid rgba(209, 19, 47, 0.5);
  outline-offset: 4px;
}

.footer {
  margin-top: 16px;
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.mixer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.knob-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.knob-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.knob {
  --size: 46px;
  --angle: 0deg;
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(0, 0, 0, 0.55), transparent 60%),
    conic-gradient(
      from 225deg,
      rgba(209, 19, 47, 0.9) 0deg,
      rgba(209, 19, 47, 0.32) 110deg,
      rgba(255, 255, 255, 0.09) 110deg,
      rgba(255, 255, 255, 0.09) 270deg,
      rgba(0, 0, 0, 0.35) 270deg
    );
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.knob:active {
  cursor: grabbing;
}

.knob:focus-visible {
  outline: 2px solid rgba(209, 19, 47, 0.5);
  outline-offset: 4px;
}

.knob::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.55));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.knob-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 2px;
  transform-origin: 50% calc(100% - 1px);
  transform: translate(-50%, -100%) rotate(var(--angle));
  z-index: 1;
  box-shadow: 0 0 10px rgba(209, 19, 47, 0.35);
}

.knob-meta {
  display: grid;
  gap: 2px;
}

.knob-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.knob-value {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.footer-line {
  text-align: center;
  padding: 8px 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 12px;
}

.embeds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.embed {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.embed-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.2px;
}

.embed iframe {
  display: block;
  width: 100%;
  height: clamp(220px, 44vw, 352px);
  border: 0;
  background: rgba(0, 0, 0, 0.25);
}

@media (max-width: 720px) {
  .app {
    padding: 18px 12px 28px;
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .panel {
    padding: 14px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  }

  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-note {
    text-align: left;
    padding-top: 0;
  }

  .mixer-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .transport {
    justify-content: space-between;
    width: 100%;
  }

  .reverb {
    min-width: 0;
    width: min(56vw, 340px);
  }

  .status {
    text-align: left;
    min-width: 0;
  }

  .faders {
    /* Mobile: keep channels tight and allow more than 5 via horizontal scroll */
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 6px 0 10px;
  }

  .fader-col {
    width: 50px;
    flex: 0 0 auto;
    scroll-snap-align: center;
  }

  .fader-slider {
    width: 26px;
    height: clamp(150px, 40vh, 240px);
  }

  .panel-meta {
    text-align: left;
  }

  .embeds {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn {
    padding: 10px 12px;
  }

  .status {
    font-size: 13px;
  }

  .fader-col {
    width: 48px;
  }

  .fader-slider {
    width: 24px;
  }

  .knob {
    --size: 44px;
  }
}

@media (max-width: 360px) {
  .fader-col {
    width: 44px;
  }

  .fader-slider {
    width: 22px;
    height: clamp(140px, 38vh, 220px);
  }
}
