:root {
  color-scheme: dark;
  --bg: #17130f;
  --bg-2: #211a14;
  --panel: rgba(35, 28, 20, 0.86);
  --panel-2: rgba(50, 39, 28, 0.78);
  --line: rgba(239, 216, 176, 0.16);
  --line-strong: rgba(239, 216, 176, 0.28);
  --text: #f6eddc;
  --muted: #bba98c;
  --copper: #d0924d;
  --gold: #f0c36c;
  --teal: #21b6a8;
  --red: #cf5d47;
  --shadow: rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --font-display: "Aptos Display", "Trebuchet MS", sans-serif;
  --font-body: "Aptos", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  overflow-x: hidden;
}

.textile {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(208, 146, 77, 0.10), transparent 38%, rgba(33, 182, 168, 0.08) 72%, transparent),
    repeating-linear-gradient(45deg, rgba(240, 195, 108, 0.06) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(135deg, rgba(33, 182, 168, 0.05) 0 1px, transparent 1px 22px),
    var(--bg);
  opacity: 0.9;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.topbar,
.player-panel,
.queue-panel,
.rules-band,
.render-band {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(25, 20, 16, 0.86));
  box-shadow: 0 22px 70px var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240, 195, 108, 0.44);
  background: linear-gradient(145deg, rgba(208, 146, 77, 0.28), rgba(33, 182, 168, 0.16));
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  font-size: 19px;
  line-height: 1.05;
}

.brand p,
#mixMeta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(207, 93, 71, 0.12);
}

.status-dot.ready {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(33, 182, 168, 0.14);
}

code {
  font-family: var(--font-mono);
  color: var(--gold);
  border: 1px solid var(--line);
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(640px, 1.2fr);
  gap: 16px;
  margin-top: 16px;
}

.player-panel,
.queue-panel {
  border-radius: var(--radius);
  min-height: 680px;
}

.player-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 18px;
}

.cover-wrap {
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 480px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
}

.cover-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cover-meter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--copper));
}

.section-label {
  color: var(--copper);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.player-copy h2,
.queue-head h2,
.render-band h2 {
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.04;
}

.transport {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}

.icon-button,
.action-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button:hover,
.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 195, 108, 0.6);
}

.icon-button {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.icon-button.primary {
  background: linear-gradient(145deg, var(--copper), #8e562a);
  color: #130f0c;
}

svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button svg {
  fill: currentColor;
  stroke: none;
  margin-left: 2px;
}

.time-stack {
  min-width: 0;
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.waveform {
  min-height: 94px;
  display: grid;
  grid-template-columns: repeat(96, 1fr);
  gap: 3px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.bar {
  height: calc(var(--h) * 1%);
  min-height: 8px;
  background: rgba(246, 237, 220, 0.22);
  border-radius: 3px;
  transition: background 120ms ease, transform 120ms ease;
}

.bar.active {
  background: linear-gradient(180deg, var(--gold), var(--copper));
}

.bar.fx {
  background: linear-gradient(180deg, var(--teal), var(--gold));
}

.control-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.volume {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.action-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}

.action-button.secondary {
  color: var(--gold);
}

.queue-panel {
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  min-width: 0;
}

.queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.queue-stats {
  text-align: right;
  color: var(--muted);
}

.queue-stats strong {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.tab.active {
  color: #12100d;
  background: var(--gold);
  border-color: var(--gold);
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.14);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 9px 7px;
  border-bottom: 1px solid rgba(239, 216, 176, 0.09);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(30, 24, 18, 0.98);
  color: var(--copper);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

td {
  color: #eadcc5;
}

.track-title {
  max-width: 300px;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted-cell {
  color: var(--muted);
  font-family: var(--font-mono);
}

.fx-cell {
  color: var(--teal);
  font-weight: 800;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
  margin-top: 16px;
}

.rules-band,
.render-band {
  border-radius: var(--radius);
  padding: 16px;
}

.rules-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rule-card {
  min-height: 102px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.rule-card strong {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 20px;
  margin-bottom: 10px;
}

.rule-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.render-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.render-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(88px, auto));
  gap: 8px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-width: 88px;
}

.metric b {
  display: block;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 1100px) {
  .studio-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .player-panel,
  .queue-panel {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 18px, 1480px);
    padding-top: 9px;
  }

  .topbar,
  .queue-head,
  .render-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-line {
    width: 100%;
    overflow-x: auto;
  }

  .control-row,
  .rules-band {
    grid-template-columns: 1fr;
  }

  .transport {
    grid-template-columns: 48px 1fr;
  }

  .icon-button {
    width: 48px;
    height: 48px;
  }
}
