/* ==========================================================================
   Wireless Mic — faceplate design system
   Palette and type are modelled on portable broadcast recorders: a slate
   chassis with silkscreened labels and semantic signal colours.
   ========================================================================== */

:root {
  --chassis: #1b2027;
  --panel: #262d36;
  --panel-hi: #2f3742;
  --rule: #333c47;
  --silk: #c9d1d9;
  --silk-dim: #7a8593;
  --signal: #3fbf7f;
  --live: #f2a93b;
  --clip: #e2574c;

  --label: "Oswald", "Roboto Condensed", "Arial Narrow", "Helvetica Neue",
    sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--chassis);
  color: var(--silk);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 0;
  -webkit-text-size-adjust: 100%;
}

/* Silkscreened panel labels — the core type gesture. */
.label {
  font-family: var(--label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--silk-dim);
}

.faceplate {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--label);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--silk);
  margin: 0;
}

.role-tag {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule);
  flex: none;
  transition: background 180ms linear, box-shadow 180ms linear;
}

.lamp[data-state="ready"] {
  background: var(--signal);
  box-shadow: 0 0 7px rgba(63, 191, 127, 0.65);
}

.lamp[data-state="live"] {
  background: var(--live);
  box-shadow: 0 0 8px rgba(242, 169, 59, 0.7);
  animation: breathe 2.4s ease-in-out infinite;
}

.lamp[data-state="fault"] {
  background: var(--clip);
  box-shadow: 0 0 7px rgba(226, 87, 76, 0.65);
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.42;
  }
}

/* ---------- Signal chain (signature element) ---------- */

.chain {
  display: flex;
  align-items: center;
  padding: 20px 18px;
  border-bottom: 1px solid var(--rule);
  gap: 4px;
}

.node {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk-dim);
  padding: 5px 9px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  white-space: nowrap;
  transition: color 200ms linear, border-color 200ms linear;
}

.node[data-on="1"] {
  color: var(--silk);
  border-color: var(--silk-dim);
}

.link {
  flex: 1;
  height: 2px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
}

.link[data-on="1"] {
  background: var(--signal);
}

.link[data-on="pending"]::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 34%;
  background: var(--live);
  animation: crawl 1.3s linear infinite;
}

@keyframes crawl {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

/* ---------- Sections ---------- */

.section {
  padding: 20px 18px;
  border-bottom: 1px solid var(--rule);
}

.section > .label:first-child {
  display: block;
  margin-bottom: 12px;
}

.status-line {
  margin: 0;
  font-size: 15px;
  color: var(--silk);
}

.status-line.dim {
  color: var(--silk-dim);
}

.status-line.fault {
  color: var(--clip);
}

/* ---------- Room code ---------- */

.code-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.code {
  font-family: var(--data);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--live);
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 10px 14px;
  margin: 0;
}

.code-entry {
  font-family: var(--data);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
  max-width: 220px;
  color: var(--live);
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 10px 6px;
}

.code-entry:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* ---------- Meter (signature element) ---------- */

.meter {
  display: flex;
  gap: 2px;
  height: 26px;
  align-items: stretch;
}

.seg {
  flex: 1;
  background: var(--chassis);
  border-radius: 1px;
  border: 1px solid #2b333d;
}

.seg[data-lit="1"] {
  background: var(--signal);
  border-color: var(--signal);
}

.seg[data-lit="1"][data-zone="hot"] {
  background: var(--live);
  border-color: var(--live);
}

.seg[data-lit="1"][data-zone="clip"] {
  background: var(--clip);
  border-color: var(--clip);
}

.meter-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 8px;
}

.readout {
  font-family: var(--data);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--silk);
}

/* ---------- Controls ---------- */

.btn {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--chassis);
  background: var(--silk);
  border: 1px solid var(--silk);
  border-radius: 2px;
  padding: 14px 20px;
  width: 100%;
  cursor: pointer;
  transition: background 140ms linear, border-color 140ms linear;
}

.btn:hover:not(:disabled) {
  background: #fff;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--signal);
  border-color: var(--signal);
}

.btn.primary:hover:not(:disabled) {
  background: #4fd490;
}

.btn.stop {
  background: var(--clip);
  border-color: var(--clip);
  color: #fff;
}

.btn.stop:hover:not(:disabled) {
  background: #ec6a60;
}

.btn.ghost {
  background: transparent;
  color: var(--silk);
  border-color: var(--rule);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--panel-hi);
  border-color: var(--silk-dim);
}

.btn:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

/* ---------- Toggle group ---------- */

.toggle {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.toggle button {
  flex: 1;
  font-family: var(--label);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk-dim);
  background: transparent;
  border: 0;
  padding: 11px 8px;
  cursor: pointer;
  transition: background 140ms linear, color 140ms linear;
}

.toggle button[aria-pressed="true"] {
  background: var(--panel-hi);
  color: var(--silk);
}

.toggle button:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: -2px;
}

.hint {
  font-size: 13px;
  color: var(--silk-dim);
  margin: 10px 0 0;
}

.select {
  width: 100%;
  font-family: var(--body);
  font-size: 14px;
  color: var(--silk);
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 11px 10px;
}

.select:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}

/* ---------- Stats strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--rule);
}

.stat {
  padding: 12px 10px;
  text-align: center;
  border-right: 1px solid var(--rule);
}

.stat:last-child {
  border-right: 0;
}

.stat-val {
  font-family: var(--data);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--silk);
  display: block;
}

.stat .label {
  font-size: 9px;
  margin-top: 3px;
  display: block;
}

/* ---------- Virtual cable setup ---------- */

.cable-card {
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 14px;
  margin: 12px 0;
}

.cable-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cable-head strong {
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pill {
  font-family: var(--label);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--silk-dim);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.steps {
  margin: 14px 0 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--silk-dim);
}

.steps li {
  margin-bottom: 7px;
}

.steps li::marker {
  color: var(--live);
  font-family: var(--data);
  font-size: 12px;
}

.recipe {
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  border-radius: 2px;
  padding: 12px 14px;
  margin-top: 14px;
}

.recipe .label {
  display: block;
  margin-bottom: 8px;
}

.chip {
  font-family: var(--data);
  font-size: 13px;
  color: var(--silk);
  background: var(--panel-hi);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 7px 10px;
  margin: 0;
  display: block;
  word-break: break-word;
}

.chip.mono {
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 6px;
}

/* ---------- Footer / version ---------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
}

.version {
  font-family: var(--data);
  font-size: 12px;
  color: var(--silk-dim);
  font-variant-numeric: tabular-nums;
}

.link-btn {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk-dim);
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--silk);
}

.link-btn:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}

/* ---------- Role picker (index) ---------- */

.pick {
  display: grid;
  gap: 10px;
}

.pick a {
  display: block;
  text-decoration: none;
  color: var(--silk);
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 18px;
  transition: border-color 140ms linear, background 140ms linear;
}

.pick a:hover {
  border-color: var(--silk-dim);
  background: var(--panel-hi);
}

.pick a:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}

.pick strong {
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
}

.pick span {
  font-size: 14px;
  color: var(--silk-dim);
}

/* ---------- About dialogue ---------- */

dialog {
  background: var(--panel);
  color: var(--silk);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 0;
}

dialog::backdrop {
  background: rgba(12, 15, 19, 0.76);
}

.dlg-body {
  padding: 18px;
}

.dlg-body h2 {
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.spec {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}

.spec:last-of-type {
  border-bottom: 0;
}

.spec span:last-child {
  font-family: var(--data);
  font-size: 13px;
  color: var(--silk-dim);
  text-align: right;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  background: var(--chassis);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--live);
  border-radius: 2px;
  padding: 11px 15px;
  font-size: 14px;
  max-width: min(460px, calc(100% - 32px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms linear, transform 180ms linear;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.page-foot {
  max-width: 560px;
  width: 100%;
  padding: 14px 4px 24px;
  font-size: 12px;
  color: var(--silk-dim);
}

.page-foot a {
  color: var(--silk-dim);
}

.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 420px) {
  .code {
    font-size: 32px;
  }
  .node {
    font-size: 9px;
    padding: 5px 6px;
    letter-spacing: 0.08em;
  }
}
