/* Session page — compact DAW channel / performer view (FL charcoal tokens) */

.daw-session {
  min-height: 100dvh;
  margin: 0;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 138, 0, 0.08), transparent 55%),
    linear-gradient(180deg, #1f1f1f 0%, var(--fl-bg, #1a1a1a) 45%, var(--fl-deep, #121212) 100%);
  color: var(--fl-text, #e0e0e0);
  font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
}

.daw-session *,
.daw-session *::before,
.daw-session *::after {
  box-sizing: border-box;
}

.daw-rack {
  width: min(420px, calc(100% - 1.25rem));
  max-width: 100%;
  margin: 0 auto;
  padding: 0.75rem 0 calc(1.25rem + env(safe-area-inset-bottom, 0));
  min-height: 100dvh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  overflow-x: hidden;
}

.daw-label {
  display: block;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fl-muted, #9a9a9a);
}

.daw-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Host tracks + waveforms (Create-style charcoal lanes) */
.daw-tracks {
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: linear-gradient(180deg, #222, #1a1a1a);
  padding: 0.45rem 0.5rem 0.5rem;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.daw-tracks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.daw-tracks-canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 160px;
  border-radius: 4px;
  background: #121212;
  /* Bitmap size must not become flex min-content width */
  min-width: 0;
}

.daw-tracks-hint {
  margin: 0;
  font-size: 0.68rem;
  color: var(--fl-muted, #9a9a9a);
  line-height: 1.35;
}

/* ——— Arm / setup ——— */
.daw-arm {
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: var(--fl-panel-grad, linear-gradient(180deg, #2c2c2c, #242424));
  box-shadow:
    inset 0 1px 0 var(--fl-bevel-hi, rgba(255, 255, 255, 0.08)),
    0 10px 28px rgba(0, 0, 0, 0.45);
  padding: 1.1rem 1rem 1.15rem;
}

.daw-arm-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--fl-border, #3a3a3a);
}

.daw-mark {
  margin: 0;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--fl-text, #e0e0e0);
}

.daw-arm-sub {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fl-orange, #ff8a00);
}

.daw-session-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm, 4px);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--fl-border, #3a3a3a);
}

.daw-session-id strong {
  font-family: var(--font-mono, monospace);
  font-size: 0.95rem;
  color: var(--fl-cyan, #00e5ff);
}

.daw-track-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm, 4px);
  background: linear-gradient(
    90deg,
    rgba(255, 138, 0, 0.14),
    rgba(0, 0, 0, 0.35)
  );
  border: 1px solid rgba(255, 138, 0, 0.45);
}

.daw-track-banner strong {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fl-orange, #ff8a00);
}

.daw-cable-meta {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm, 4px);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--fl-border, #3a3a3a);
}

.daw-cable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.daw-cable-row strong {
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  color: var(--fl-text, #e0e0e0);
}

.daw-cable-row strong.is-receiving {
  color: var(--fl-lime, #a6ff00);
}

.daw-hint--record {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.6rem;
  border-left: 2px solid var(--fl-orange, #ff8a00);
  color: var(--fl-muted, #9a9a9a);
  font-size: 0.8rem;
  line-height: 1.4;
}

.daw-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.daw-field select {
  width: 100%;
  min-height: var(--touch, 44px);
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--fl-border, #3a3a3a);
  background: #1a1a1a;
  color: var(--fl-text, #e0e0e0);
  font: inherit;
  padding: 0.55rem 0.65rem;
}

.daw-arm-btn {
  width: 100%;
  min-height: var(--touch, 44px);
  border: 1px solid rgba(255, 138, 0, 0.55);
  border-radius: var(--radius-sm, 4px);
  background: linear-gradient(180deg, #ff9a22 0%, var(--fl-orange, #ff8a00) 100%);
  color: #121212;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 18px var(--fl-glow-orange, rgba(255, 138, 0, 0.35));
}

.daw-arm-btn:active {
  transform: translateY(1px);
}

.daw-hint {
  margin: 0.75rem 0 0;
  color: var(--fl-muted, #9a9a9a);
  font-size: 0.82rem;
  line-height: 1.4;
}

.daw-gate-panel {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.8rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid rgba(255, 138, 0, 0.5);
  background: rgba(255, 138, 0, 0.08);
}

.daw-gate-panel .daw-gate-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fl-orange, #ff8a00);
}

.daw-gate-panel .daw-gate-body {
  margin: 0 0 0.55rem;
  color: var(--fl-muted, #9a9a9a);
  font-size: 0.8rem;
  line-height: 1.4;
}

.daw-gate-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
}

.daw-gate-status strong {
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  color: var(--fl-orange, #ff8a00);
}

.daw-gate-status strong.is-live {
  color: var(--fl-lime, #a6ff00);
}

.daw-arm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.4);
}

.daw-hint--foot {
  text-align: center;
  margin-top: 0.35rem;
}

/* ——— Live transport ——— */
.daw-live {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.daw-transport {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: var(--fl-panel-grad, linear-gradient(180deg, #2c2c2c, #242424));
  box-shadow: inset 0 1px 0 var(--fl-bevel-hi, rgba(255, 255, 255, 0.08));
}

.daw-live-badge,
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--fl-border, #3a3a3a);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.daw-live-badge .label,
.status .label {
  color: inherit;
}

.daw-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.daw-live-badge.live,
.status.live {
  border-color: rgba(166, 255, 0, 0.45);
  color: var(--fl-lime, #a6ff00);
}

.daw-live-badge.live .daw-led,
.status.live .daw-led,
.status.live .dot {
  background: var(--fl-lime, #a6ff00);
  box-shadow: 0 0 8px var(--fl-glow-lime, rgba(166, 255, 0, 0.45));
  animation: dawLivePulse 1.6s ease-in-out infinite;
}

.daw-live-badge.wait,
.status.wait {
  border-color: rgba(255, 138, 0, 0.4);
  color: var(--fl-orange, #ff8a00);
}

.daw-live-badge.wait .daw-led,
.status.wait .daw-led,
.status.wait .dot {
  background: var(--fl-orange, #ff8a00);
}

.daw-live-badge.off,
.status.off {
  color: var(--fl-muted, #9a9a9a);
}

.daw-transport-mid {
  min-width: 0;
}

.daw-transport-mid strong {
  display: block;
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daw-clock-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  min-width: 0;
}

.daw-host-xport {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.daw-xport {
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0.22rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--fl-border, #3a3a3a);
  color: var(--fl-muted, #9a9a9a);
  background: #141414;
}

.daw-xport.is-stop {
  color: var(--fl-muted, #9a9a9a);
}

.daw-xport.is-play {
  color: var(--fl-cyan, #00e5ff);
  border-color: rgba(0, 229, 255, 0.45);
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.18);
}

.daw-xport.is-rec-off {
  opacity: 0.45;
}

.daw-xport.is-rec {
  color: #ff8a94;
  border-color: rgba(255, 59, 74, 0.55);
  background: rgba(255, 59, 74, 0.14);
  box-shadow: 0 0 8px rgba(255, 59, 74, 0.22);
  opacity: 1;
  animation: dawRecPulse 1.2s ease-in-out infinite;
}

@keyframes dawRecPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.daw-timer {
  font-family: var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fl-cyan, #00e5ff);
  letter-spacing: 0.04em;
}

.daw-msg {
  margin: 0;
  min-height: 2.4em;
  color: var(--fl-muted, #9a9a9a);
  font-size: 0.9rem;
  line-height: 1.35;
}

/* ——— Scope + meter ——— */
.daw-io {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 0.55rem;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}

.daw-scope {
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: #141414;
  padding: 0.45rem 0.5rem 0.55rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  min-width: 0;
  overflow: hidden;
}

.daw-scope-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.daw-scope-tag {
  color: var(--fl-cyan, #00e5ff);
}

.wave-wrap {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.wave-scope,
.wave-history {
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
  display: block;
  border-radius: 3px;
  border: 1px solid #2a2a2a;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 7px,
      rgba(255, 255, 255, 0.02) 7px,
      rgba(255, 255, 255, 0.02) 8px
    ),
    #0e0e0e;
}

.wave-scope {
  height: 120px;
}

.wave-history {
  height: 48px;
}

.daw-meter {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.25rem;
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: var(--fl-panel-grad-inset, linear-gradient(180deg, #242424, #1e1e1e));
}

.daw-meter-track {
  position: relative;
  width: 18px;
  height: 100%;
  min-height: 140px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  background: #0a0a0a;
}

.daw-meter-fill,
.daw-meter-track > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  width: 100%;
  background: linear-gradient(
    0deg,
    var(--fl-lime, #a6ff00) 0%,
    var(--fl-cyan, #00e5ff) 55%,
    var(--fl-orange, #ff8a00) 82%,
    #ff3b4a 100%
  );
  transition: height 50ms linear;
  box-shadow: 0 0 10px rgba(166, 255, 0, 0.25);
}

.daw-meter-peak,
.daw-meter-track > i {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: 0%;
  background: #fff;
  opacity: 0.9;
  transition: bottom 40ms linear;
  pointer-events: none;
}

.daw-meter-scale {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  height: 100%;
  position: absolute;
  width: 1px;
  opacity: 0;
}

/* ——— Rack LEDs ——— */
.daw-rack-leds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.daw-led-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-sm, 4px);
  background: rgba(0, 0, 0, 0.28);
}

.daw-led-cell .daw-led {
  grid-row: 1 / span 2;
}

.daw-led-cell strong {
  font-size: 0.85rem;
  font-weight: 600;
}

.daw-led-cell.ok {
  border-color: rgba(166, 255, 0, 0.4);
}

.daw-led-cell.ok .daw-led {
  background: var(--fl-lime, #a6ff00);
  box-shadow: 0 0 8px var(--fl-glow-lime, rgba(166, 255, 0, 0.4));
}

.daw-led-cell.warn {
  border-color: rgba(255, 138, 0, 0.4);
}

.daw-led-cell.warn .daw-led {
  background: var(--fl-orange, #ff8a00);
}

/* ——— Channel strip ——— */
.daw-strip {
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-md, 6px);
  background: var(--fl-panel-grad, linear-gradient(180deg, #2c2c2c, #242424));
  padding: 0.7rem 0.65rem 0.75rem;
  display: grid;
  gap: 0.65rem;
}

.daw-strip-group {
  display: grid;
  gap: 0.35rem;
}

.daw-strip-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 380px) {
  .daw-strip-toggles {
    grid-template-columns: 1fr;
  }
}

.daw-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--fl-border, #3a3a3a);
  border-radius: var(--radius-sm, 4px);
  overflow: hidden;
  background: #141414;
}

.daw-seg--2 {
  grid-template-columns: repeat(2, 1fr);
}

.daw-hint--toggle {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--fl-muted, #9a9a9a);
  letter-spacing: 0.01em;
}

.daw-seg-btn {
  min-height: 44px;
  padding: 0.35rem 0.2rem;
  border: 0;
  border-right: 1px solid var(--fl-border, #3a3a3a);
  background: transparent;
  color: var(--fl-muted, #9a9a9a);
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
  white-space: normal;
  hyphens: auto;
}

@media (min-width: 420px) {
  .daw-seg-btn {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
  }
}

.daw-seg-btn:last-child {
  border-right: 0;
}

.daw-seg-btn.is-on,
.daw-seg-btn.good {
  background: rgba(0, 229, 255, 0.12);
  color: var(--fl-cyan, #00e5ff);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.35);
}

.daw-strip-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.5rem;
}

.daw-ch-btn,
.daw-stop-btn {
  min-height: 44px;
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.daw-ch-btn {
  border: 1px solid var(--fl-border, #3a3a3a);
  background: #1a1a1a;
  color: var(--fl-text, #e0e0e0);
}

.daw-ch-btn.is-muted {
  border-color: rgba(255, 59, 74, 0.55);
  background: rgba(255, 59, 74, 0.12);
  color: #ff8a94;
}

.daw-stop-btn {
  border: 1px solid rgba(255, 59, 74, 0.45);
  background: linear-gradient(180deg, #3a2226 0%, #2a1518 100%);
  color: #ff8a94;
}

.daw-stop-btn:active,
.daw-ch-btn:active,
.daw-seg-btn:active {
  transform: translateY(1px);
}

/* live pulse — meter glow + badge only */
.daw-live.live-glow .daw-meter-fill {
  animation: dawMeterGlow 2.2s ease-in-out infinite;
}

.mic-session.live-glow,
.daw-live.live-glow {
  /* class retained for mic.js */
}

@keyframes dawLivePulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes dawMeterGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

/* Compat: older class names still used by mic.js toggles */
.mic-pill.ok {
  border-color: rgba(166, 255, 0, 0.4);
}

.mic-pill.warn {
  border-color: rgba(255, 138, 0, 0.4);
}

.hidden {
  display: none !important;
}

@media (max-width: 360px) {
  .daw-io {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .daw-meter-track {
    width: 14px;
  }

  .daw-tracks-canvas {
    height: 132px;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .daw-rack {
    justify-content: flex-start;
    min-height: auto;
    padding-top: 0.5rem;
  }

  .daw-tracks-canvas {
    height: 112px;
  }

  .wave-scope {
    height: 72px;
  }
}
