/* Page layout: title bar, remixing studio (deck | console | deck), studio tabs,
   studio panels and status bar. */

.chassis {
  position: relative;
  overflow-x: clip; /* a rotated platter's box can poke out of the page; never scroll sideways */
  max-width: 1480px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2a3045 0%, var(--chassis) 30%, #1d2132 100%);
  border-left: 1px solid var(--chassis-hi);
  border-right: 1px solid var(--chassis-lo);
}

/* ---------------------------------------------------------------- titlebar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #353d57, #262c40);
  border-bottom: 2px solid var(--chassis-lo);
  box-shadow: inset 0 1px 0 var(--chassis-hi);
}

.logo {
  display: flex;
  align-items: baseline;
  font-family: "Arial Black", "Arial Bold", Impact, var(--font-ui);
  font-weight: 900;
  font-style: italic;
  font-size: 20px;
  letter-spacing: -0.02em;
  user-select: none;
  white-space: nowrap;
}

.logo-img {
  display: block;
  height: 40px;
  width: auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.logo-mix {
  color: var(--accent);
  text-shadow: 1px 1px 0 #7a3a00, 0 0 10px rgba(255, 138, 0, 0.35);
}

.logo-man {
  color: #f2f4fa;
  text-shadow: 1px 1px 0 #000;
}

.logo-sub {
  margin-left: 6px;
  font-family: var(--font-lcd);
  font-style: normal;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--lcd-fg);
}

.menubar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.plate-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.plate-label {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.12em;
  color: var(--accent-hi);
}

.plate-picker .select-dark {
  max-width: 220px;
  min-height: 24px;
}

.project-name-wrap {
  flex: 1;
  min-width: 120px;
}

.project-name {
  width: 100%;
  max-width: 340px;
  padding: 3px 6px;
  background: var(--lcd-bg);
  color: var(--lcd-fg);
  font-family: var(--font-lcd);
  font-size: 12px;
  border: 2px solid;
  border-color: var(--chassis-lo) var(--chassis-hi) var(--chassis-hi) var(--chassis-lo);
}

.power-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4b1010;
  box-shadow: inset 0 0 2px #000;
  flex: none;
}

[data-audio="running"] .power-led {
  background: radial-gradient(circle at 35% 35%, #c9ffb0, var(--play));
  box-shadow: 0 0 8px var(--play);
}

[data-audio="suspended"] .power-led {
  background: var(--lcd-amber);
}

/* ---------------------------------------------------------- remix studio */
.remix-studio {
  display: grid;
  grid-template-columns: 1fr minmax(290px, 360px) 1fr;
  grid-template-areas: "deckL console deckR";
  gap: 10px;
  padding: 12px 10px;
  align-items: start;
}

.deck-left {
  grid-area: deckL;
}

.deck-right {
  grid-area: deckR;
}

.console {
  grid-area: console;
}

.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* --------------------------------------------------------------- studios */
.studio-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 2px solid var(--panel-lo);
}

.studio-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.studios-toggle {
  flex: none;
  margin-bottom: 4px;
  white-space: nowrap;
}

/* Studios closed: the turntables are the stars and use the room. */
.chassis.studios-closed {
  --tt: min(36vw, calc(100vh - 215px), 620px);
}

.chassis.studios-closed .remix-studio {
  flex: 1;
  align-items: center;
}

.chassis.studios-closed .tab[aria-selected="true"] {
  background: linear-gradient(180deg, #3d4562, #2b3147);
  border-color: #6b7493 #151926 transparent #6b7493;
  color: var(--text-dim);
}

.studio-panels {
  flex: 1;
  margin: 0 10px 8px;
  min-height: 230px;
  background: var(--panel);
  color: var(--panel-text);
  border: 2px solid;
  border-color: var(--panel-hi) var(--panel-lo) var(--panel-lo) var(--panel-hi);
  border-top: 0;
}

.studio-panel {
  padding: 10px;
  overflow-x: auto;
}

.studio-panel[hidden] {
  display: none;
}

/* ------------------------------------------------------------- statusbar */
.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: #151927;
  border-top: 1px solid var(--chassis-hi);
  font-size: 11px;
}

.status-msg {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.status-msg[data-level="error"] {
  color: #ff8a8a;
}

.status-msg[data-level="warn"] {
  color: var(--lcd-amber);
}

.status-msg[data-level="ok"] {
  color: var(--lcd-fg);
}

.status-flags {
  display: flex;
  gap: 6px;
}

.flag {
  padding: 0 5px;
  border: 1px solid var(--chassis-hi);
  font-family: var(--font-lcd);
  font-size: 10px;
  color: var(--text-dim);
}

.flag.on {
  color: var(--lcd-fg);
  border-color: var(--lcd-dim);
}

/* ---------------------------------------------------------- power screen */
.power-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 8, 14, 0.82);
  backdrop-filter: blur(2px);
}

[data-audio="running"] .power-overlay,
[data-audio="suspended"] .power-overlay {
  display: none;
}

.power-box {
  max-width: 460px;
  padding: 22px 26px;
  text-align: center;
  background: linear-gradient(180deg, #2f3650, #1f2436);
}

.logo-big {
  justify-content: center;
  margin-bottom: 10px;
}

.logo-big .logo-img {
  height: 100px;
}

.power-note {
  font-size: 11px;
  color: var(--text-dim);
}

/* --------------------------------------------------------------- dialogs */
.dialog {
  max-width: min(520px, calc(100vw - 32px));
  padding: 14px 16px;
  background: linear-gradient(180deg, #2f3650, #23283a);
  color: var(--text);
}

.dialog-wide {
  max-width: min(900px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-title {
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--chassis-hi);
  color: var(--accent-hi);
}

.progress {
  height: 10px;
  min-width: min(380px, 70vw);
  margin-top: 8px;
  border-radius: 5px;
  background: #0b0d14;
  box-shadow: inset 0 1px 3px #000;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.15s linear;
}

.progress-text {
  white-space: pre-line;
  max-height: 40vh;
  overflow: auto;
}

.dialog.is-done .progress {
  display: none;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.help-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-height: 65vh;
  overflow-y: auto;
}

.help-body ul {
  margin: 0;
  padding-left: 18px;
}

.help-body li {
  margin-bottom: 5px;
}

.keys-table {
  border-collapse: collapse;
  width: 100%;
}

.keys-table th,
.keys-table td {
  padding: 3px 4px;
  border-bottom: 1px solid #343b55;
  text-align: left;
  vertical-align: top;
  font-weight: normal;
}

.keys-table th {
  color: var(--text-dim);
}

/* ------------------------------------------------------- pattern memories */
.pattern-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 10px;
  background: linear-gradient(180deg, #2c3248, #232839);
  border-bottom: 1px solid var(--chassis-lo);
}

.pat-title {
  margin-right: 6px;
  font-family: var(--font-lcd);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.pat-btn {
  position: relative;
  min-width: 30px;
  min-height: 24px;
  padding: 0 4px;
  overflow: hidden;
  touch-action: none;
  font-family: var(--font-lcd);
  font-size: 13px;
}

.pat-btn::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #333;
  box-shadow: inset 0 0 1px #000;
}

.pat-btn.has-pattern::before {
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent);
}

.pat-btn.is-active {
  background: linear-gradient(180deg, #ffa53a, #d86c00);
  color: #1c0d00;
}

.pat-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--lcd-fg);
  transform: scaleX(0);
  transform-origin: left center;
}

.pat-btn.is-holding::after {
  animation: pat-fill 3s linear forwards;
}

.pat-btn.just-stored {
  box-shadow: 0 0 0 2px var(--lcd-fg), 0 0 12px var(--lcd-fg);
}

@keyframes pat-fill {
  to {
    transform: scaleX(1);
  }
}
