/* The lighting console: a colour studio beside the room. Non-modal, so the room stays
   visible on a wide screen; on a narrow one it takes the whole screen and stacks. */
.console {
  position: fixed;
  z-index: 8;
  inset: 16px 16px 16px auto;
  width: min(1080px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  max-height: none;
  margin: 0;
  padding: 18px 22px 20px;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sheen), var(--sheet-lift);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.console[open] { display: flex; flex-direction: column; animation: console-in var(--slow) var(--ease); }

@keyframes console-in { from { opacity: 0; transform: translateX(16px); } }

/* Shared by every window's title row */
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.2rem; }

.console > .sheet-head { flex: none; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.console > .sheet-head h2 { overflow: hidden; font-size: 1.25rem; font-weight: 640; letter-spacing: -0.02em; white-space: nowrap; text-overflow: ellipsis; }
.console > .sheet-head .chip { flex: none; }
.console > .sheet-head .chip[aria-pressed="false"] { color: var(--muted); }

/* The live preview of what the strips are doing */
.console > .led-preview-panel { flex: none; margin: 14px 0 0; }
.console .led-preview { height: 64px; margin-top: 8px; }
.console .led-preview-panel { padding: 10px 12px; }
.console .led-preview-panel > .row { flex-wrap: nowrap; align-items: end; }
.console .led-preview-panel strong { flex: 1 1 auto; align-self: center; }
.console .led-preview-panel .field { flex: 0 1 220px; }

.console-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  margin-top: 14px;
}

.console-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 20px 4px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.console-col:first-child { padding-left: 0; }
.console-col:last-child { padding-right: 0; }
.console-col + .console-col { border-left: 1px solid var(--line); }
.console-col h3 { margin: 20px 0 8px; }
.console-col h3:first-child { margin-top: 2px; }
.console-col .browser { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.console-col .browser-list { flex: 1; max-height: none; min-height: 160px; }

/* Colour: the wheel, the two slots, exact numbers */
.wheel {
  align-self: center;
  flex: none;
  width: min(240px, 100%);
  aspect-ratio: 1;
  margin-top: 4px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--edge-strong), 0 0 0 6px var(--well), 0 18px 36px -14px rgba(0, 0, 0, 0.8);
  cursor: crosshair;
  touch-action: none;
}

.console-col > .row.center { gap: 12px; margin-top: 18px; }

.slot {
  width: 48px;
  height: 48px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 650;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  background: var(--slot, var(--ink));
  border: 0;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 14px -6px rgba(0, 0, 0, 0.8);
  transition: transform var(--fast) var(--ease), box-shadow var(--med);
}

.slot:hover { transform: translateY(-2px); }
.slot:active { transform: scale(0.96); }
.slot[aria-pressed="true"] { box-shadow: var(--ring), 0 6px 14px -6px rgba(0, 0, 0, 0.8); }

.exact { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); align-items: end; gap: 6px; margin-top: 16px; }
.exact input { min-height: 36px; padding: 0 6px; font-size: 0.82rem; font-variant-numeric: tabular-nums; text-align: center; }
.exact .mono { letter-spacing: 0.02em; }
.channel { display: grid; gap: 4px; min-width: 0; }
.channel span { color: var(--faint); font-size: 0.7rem; font-weight: 600; text-align: center; }
.channel input { -moz-appearance: textfield; }
.channel input::-webkit-inner-spin-button, .channel input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }

.console-col > .swatches { gap: 8px; }

@media (max-width: 1240px) and (min-width: 981px) {
  .console-body { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(0, 1fr); }
  .console-col { padding-inline: 14px; }
}

@media (max-width: 980px) {
  .console { inset: 0; width: 100%; height: 100%; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; }
  .console > .sheet-head h2 { font-size: 1.1rem; }
  .console .led-preview-panel > .row { flex-wrap: wrap; }
  .console .led-preview-panel strong { flex-basis: 100%; }
  .console .led-preview-panel .field { flex: 1 1 140px; }
  .console[open] { overflow-y: auto; overscroll-behavior: contain; }
  .console-body { display: block; flex: none; }
  .console-col { overflow: visible; margin-bottom: 8px; padding: 0 0 16px; }
  .console-col + .console-col { padding-top: 4px; border-top: 1px solid var(--line); border-left: 0; }
  .console-col .browser-list { max-height: 40vh; }
  .wheel { width: min(260px, 72vw); }
  .exact input { min-height: 40px; }
}

@media (prefers-reduced-transparency: reduce) {
  .console { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .console[open] { animation: none; }
  .slot:hover, .slot:active { transform: none; }
}
