:root {
  --ground: #e8eaed;
  --panel: #202225;
  --panel-2: #2b2e33;
  --ink: #131416;
  --muted: #6e7378;
  --line: #c9cdd2;
  --card: #f4f5f7;
  --red: #ff2d2d;
  --amber: #ffa31a;
  --green: #22dd55;
  --blue: #2e7cff;
  --magenta: #ff3bd4;
  --off: #3a3d42;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 64px;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

header, main {
  max-width: 680px;
  margin: 0 auto;
}
body:has(#view-slots:not([hidden])) header,
body:has(#view-slots:not([hidden])) main { max-width: 1040px; }
.two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0 40px; align-items: start; }
.two .col:first-child { position: sticky; top: 16px; }
.two h2 { margin-top: 0; }
@media (max-width: 760px) {
  .two { grid-template-columns: 1fr; }
  .two .col:first-child { position: static; }
  .two .col + .col h2 { margin-top: 36px; }
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

h1 {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

p { margin: 0 0 12px; max-width: 60ch; }
ol { margin: 0; padding-left: 20px; }
li { margin: 2px 0; }
a { color: inherit; }

/* Lights. The module has two RGB LEDs; every slot is named by a pair. */
.led {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--off);
  vertical-align: middle;
  flex: none;
}
.led + .led { margin-left: 5px; }
.led.red     { background: var(--red);     box-shadow: 0 0 8px 1px color-mix(in srgb, var(--red) 55%, transparent); }
.led.amber   { background: var(--amber);   box-shadow: 0 0 8px 1px color-mix(in srgb, var(--amber) 55%, transparent); }
.led.green   { background: var(--green);   box-shadow: 0 0 8px 1px color-mix(in srgb, var(--green) 55%, transparent); }
.led.blue    { background: var(--blue);    box-shadow: 0 0 8px 1px color-mix(in srgb, var(--blue) 55%, transparent); }
.led.magenta { background: var(--magenta); box-shadow: 0 0 8px 1px color-mix(in srgb, var(--magenta) 55%, transparent); }
.led.off     { background: var(--off); }

.lamps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  background: var(--panel);
  color: #d9dce0;
  font-size: 13px;
  font-weight: 500;
}
.lamps span:last-child { margin-left: 6px; }

/* Buttons */
button {
  font: inherit;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--panel);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}
button:hover { background: var(--card); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
button.primary { background: var(--panel); color: #fff; }
button.primary:hover { background: var(--panel-2); }
button.big { font-size: 18px; padding: 16px 28px; width: 100%; max-width: 360px; }
button.quiet { border-color: var(--line); background: transparent; color: var(--muted); }
button.quiet:hover { color: var(--ink); background: var(--card); }
button.small { padding: 5px 10px; font-size: 13px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.lead { font-size: 18px; font-weight: 500; }
.warn { color: #b3261e; font-weight: 500; }
.status { color: var(--muted); min-height: 1.5em; }

.note {
  background: var(--panel);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: none;
}
.note[hidden] { display: none; }
.note .led { margin: 0 2px; }

progress {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 8px;
  margin: 12px 0;
  accent-color: var(--ink);
}

/* Help under Connect */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px 32px;
  margin-bottom: 28px;
}
.help-grid ol { font-size: 14px; }
svg.back { display: block; width: 104px; height: auto; float: right; margin: 0 0 8px 12px; }
svg.back .lbl.small { font-size: 9px; letter-spacing: .02em; }
svg.back .lbl { font: 600 16px "Instrument Sans", system-ui, sans-serif; fill: #fff; }

/* The slot list: the module's 25 light pairs, in knob order. */
.panel {
  background: var(--panel);
  border-radius: 14px;
  padding: 8px 16px;
  color: #d9dce0;
}
.slots { display: flex; flex-direction: column; }
.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
  padding: 4px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.3;
}
.tile + .tile { border-top-color: #33363b; border-radius: 0; }
.tile.filled { cursor: pointer; }
.tile.filled:hover, .tile.open { background: var(--panel-2); border-color: transparent; }
.tile.bad .name { color: var(--red); }
.tile .pair { display: flex; gap: 5px; flex: none; }
.tile .pair .led { width: 12px; height: 12px; margin: 0; }
.tile.none { color: #a4a9af; }
.tile .name { flex: 1; min-width: 0; font-weight: 500; color: #fff; }
.tile .boot { font-size: 12px; color: #a4a9af; flex: none; }
.tile progress { display: block; margin: 4px 0 0; height: 4px; max-width: 200px; accent-color: #fff; }
.tile.busy .pair .led { animation: blink 0.5s steps(1) infinite; }
@keyframes blink { 50% { opacity: .15; box-shadow: none; } }
.tile .acts { display: none; gap: 4px; flex-wrap: wrap; flex: none; }
.tile.open .acts { display: flex; }
.tile .acts button { padding: 3px 8px; font-size: 12px; border-radius: 6px; border-color: #5a5e64; background: transparent; color: #fff; }
.tile .acts button:hover { background: #3a3d42; }

/* Firmware menu */
.menu { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.menu li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.menu .fw { flex: 1; min-width: 0; }
.menu .fw b { font-weight: 600; }
.menu .fw span { display: block; color: var(--muted); font-size: 13px; }
.menu .fw a { color: var(--muted); font-size: 13px; margin-left: 10px; }
.menu .where { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 13px; }
.menu .where .led { width: 11px; height: 11px; margin: 0; }

details.log-wrap { margin-top: 40px; color: var(--muted); font-size: 13px; }
details.log-wrap summary { cursor: pointer; }
#log {
  background: var(--panel);
  color: #c9cdd2;
  padding: 10px 12px;
  border-radius: 8px;
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
  .tile.busy .pair .led { animation: none; opacity: .5; }
}

@media (max-width: 480px) {
  h1 { font-size: 28px; }
  .tile { gap: 10px; font-size: 13px; }
  .tile.open { flex-wrap: wrap; }
  .help-grid { grid-template-columns: 1fr; }
}
