/* LINE 7: SWITCHBOARD — 1974 Parisian Metro Industrial Art-Direction */
:root {
  --bg-tile: #0d161b;
  --steel-dark: #151a1e;
  --steel-mid: #1f262c;
  --steel-rim: #353f47;
  --brass-bright: #e7c07b;
  --brass-mid: #b8883c;
  --brass-dark: #6b4b1c;
  --amber-glow: #ffae3b;
  --crimson: #c9382e;
  --phosphor: #6bff95;
  --cream-paper: #efe4c8;
  --note-yellow: #f3e09c;
  --ink: #221c14;
  --text-light: #e8e0cf;
  --text-dim: #9aa3a8;
  --metro-green: #1f6b53;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 174, 59, 0.08), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 32px),
    var(--bg-tile);
  color: var(--text-light);
  font-family: "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  transition: background 2.4s ease;
}

body.dawn-mode {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 214, 130, 0.34), transparent 65%),
    linear-gradient(180deg, #3c2b1d 0%, #1c1816 100%);
}

.hidden { display: none !important; }

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 13, 0.88);
  backdrop-filter: blur(8px);
  padding: 20px;
}
.overlay.visible { display: flex; }

.intro-card {
  max-width: 680px;
  width: 100%;
  background: linear-gradient(180deg, #1b2227 0%, #11161a 100%);
  border: 2px solid var(--brass-mid);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.78), inset 0 0 0 1px rgba(231, 192, 123, 0.18);
  border-radius: 6px;
  padding: 36px 40px;
  text-align: center;
}

.ratp-badge {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--brass-mid);
  color: var(--brass-bright);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 2.2px;
  background: rgba(184, 136, 60, 0.1);
  margin-bottom: 16px;
}

.intro-title {
  font-size: 38px;
  letter-spacing: 3px;
  color: #f6ebd4;
  text-shadow: 0 2px 18px rgba(255, 174, 59, 0.25);
  margin-bottom: 14px;
}

.intro-sub {
  font-size: 16px;
  line-height: 1.65;
  color: #cfc6b4;
  margin-bottom: 24px;
}

.intro-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid #2b343b;
  padding: 16px 18px;
  border-radius: 4px;
  margin-bottom: 26px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13.5px;
  color: #d8d1c2;
}

.step-pill { display: flex; align-items: center; gap: 12px; }
.step-pill span {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brass-mid);
  color: #111;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brass-cta {
  cursor: pointer;
  background: linear-gradient(180deg, #e5be76 0%, #b58235 100%);
  color: #16110a;
  border: 1px solid #f7dfa7;
  padding: 14px 32px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 1.8px;
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(231, 192, 123, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.brass-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.brass-cta:active { transform: translateY(1px); }
.brass-cta.secondary {
  background: transparent;
  color: var(--brass-bright);
  border-color: var(--brass-mid);
  box-shadow: none;
}

.intro-credit {
  margin-top: 20px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  color: #7c858b;
  letter-spacing: 0.4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.stat-cell {
  background: rgba(0,0,0,0.35);
  border: 1px solid #2d373f;
  padding: 12px 8px;
  border-radius: 4px;
}
.stat-cell .k { font-size: 10px; font-family: ui-monospace, monospace; color: var(--text-dim); letter-spacing: 1px; }
.stat-cell .v { font-size: 22px; color: var(--amber-glow); margin-top: 4px; font-family: ui-monospace, monospace; font-weight: 700; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Main Console Layout */
.console-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 12px 16px 14px;
  gap: 12px;
}

/* Top Brass Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(180deg, #222930 0%, #151a1f 100%);
  border: 1px solid var(--steel-rim);
  border-top-color: #495660;
  border-radius: 6px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.brand-plate {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #2c2419, #1d170f);
  border: 1px solid var(--brass-mid);
  padding: 6px 14px;
  border-radius: 4px;
}
.rivet {
  width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f5d89e, #6b4b1c);
}
.brand-main {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--brass-bright);
}
.brand-sub {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  color: #bfb196;
  margin-top: 1px;
}

.instruments { display: flex; align-items: center; gap: 14px; }

.meter-box {
  background: #0d1114;
  border: 1px solid #2b343c;
  border-radius: 4px;
  padding: 5px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.meter-label {
  font-family: ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: #7d8991;
}
.nixie {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 20px;
  font-weight: 800;
  color: #ff9f2e;
  text-shadow: 0 0 10px rgba(255, 159, 46, 0.72);
  letter-spacing: 2px;
}
.nixie.small { font-size: 17px; color: var(--phosphor); text-shadow: 0 0 8px rgba(107, 255, 149, 0.55); }

.voltage-box { min-width: 170px; }
.volt-row { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 3px; }
.volt-track {
  flex: 1; height: 9px; background: #1a2026; border-radius: 2px; overflow: hidden; border: 1px solid #2f3a43;
}
.volt-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #d94632 0%, #f0a830 45%, #55e285 100%);
  transition: width 0.25s ease;
}
.volt-num {
  font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700; color: var(--brass-bright); min-width: 40px;
}

.icon-btn {
  cursor: pointer;
  background: #1b2228;
  border: 1px solid #3c4852;
  color: #d9d1c2;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
}
.icon-btn:hover { border-color: var(--brass-mid); color: var(--brass-bright); }

/* 3-Column Switchboard Grid */
.board-grid {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 310px minmax(420px, 1fr) 365px;
  gap: 14px;
}

#cord-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

/* Hazard Tape (Night 4 Severed Wire) */
.hazard-layer {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 14, 0.56);
  backdrop-filter: blur(2px);
}
.hazard-strip {
  cursor: pointer;
  width: 105%;
  padding: 22px 24px;
  transform: rotate(-6deg);
  background: repeating-linear-gradient(
    -45deg,
    #d96b1f,
    #d96b1f 22px,
    #181818 22px,
    #181818 44px
  );
  border: 2px solid #ffb35c;
  box-shadow: 0 18px 50px rgba(0,0,0,0.85);
  transition: transform 0.18s ease, filter 0.18s ease;
}
.hazard-strip span {
  display: inline-block;
  background: #111;
  color: #ffbe66;
  padding: 8px 20px;
  font-family: ui-monospace, monospace;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 2px;
  border: 1px solid #d96b1f;
}
.hazard-strip:hover { transform: rotate(-4.5deg) scale(1.02); filter: brightness(1.1); }

/* Panel Chrome */
.panel {
  background: linear-gradient(180deg, #1b2228 0%, #13181d 100%);
  border: 1px solid #303a43;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  min-height: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 28px rgba(0,0,0,0.42);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #28323a;
}
.panel-header h2 {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 1.8px;
  color: var(--brass-bright);
}
.panel-hint {
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10.5px;
  color: #7f8b94;
}
.enamel-dot { width: 8px; height: 8px; border-radius: 50%; }
.enamel-dot.amber { background: var(--amber-glow); box-shadow: 0 0 8px var(--amber-glow); }
.enamel-dot.green { background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.enamel-dot.blue { background: #5cb8ff; box-shadow: 0 0 8px #5cb8ff; }

.status-chip {
  margin-left: auto;
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 3px;
  background: #0d1216;
  border: 1px solid #2e3a42;
  color: var(--amber-glow);
}

/* Jack Columns */
.jack-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

/* Caller Card */
.caller-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #212930 0%, #181f24 100%);
  border: 1px solid #323e48;
  border-radius: 5px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.16s, transform 0.12s, box-shadow 0.2s;
}
.caller-card:hover { border-color: var(--brass-mid); }
.caller-card.active {
  border-color: var(--amber-glow);
  box-shadow: 0 0 0 1px rgba(255, 174, 59, 0.35), 0 0 22px rgba(255, 174, 59, 0.14);
}
.caller-card.patched {
  border-color: #2f7d58;
  background: linear-gradient(180deg, #162621 0%, #121d1a 100%);
  opacity: 0.92;
}
.caller-card.urgent {
  animation: urgentPulse 1.1s infinite;
}
@keyframes urgentPulse {
  0%, 100% { border-color: #c9382e; box-shadow: 0 0 14px rgba(201,56,46,0.35); }
  50% { border-color: #ff8b5c; box-shadow: 0 0 24px rgba(255,139,92,0.55); }
}

.lamp {
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  background: #35291a;
  border: 2px solid #594426;
  transition: all 0.2s;
}
.lamp.ringing {
  background: radial-gradient(circle at 35% 35%, #fff0b8, #ff991f 65%, #a84208);
  box-shadow: 0 0 12px #ff9e24;
  animation: bulbBlink 1.3s ease-in-out infinite;
}
.lamp.locked {
  background: radial-gradient(circle at 35% 35%, #e2ffe9, #44e67b 65%, #167a3a);
  box-shadow: 0 0 12px #44e67b;
  animation: none;
}
@keyframes bulbBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

.caller-meta { flex: 1; min-width: 0; }
.caller-id {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--brass-bright);
}
.caller-sub {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11.5px;
  color: #a9b2b8;
  margin-top: 2px;
}
.caller-clue-mini {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--phosphor);
  margin-top: 4px;
}

/* Brass 1/4" Phone Socket */
.brass-jack {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 32% 32%, #f5d899 0%, #b78539 52%, #593e15 100%);
  border: 2px solid #3c2a10;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.6), inset 0 1px 1px rgba(255,255,255,0.45);
  cursor: grab;
  transition: transform 0.12s;
}
.brass-jack:hover { transform: scale(1.1); }
.brass-jack::after {
  content: "";
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle, #060708 55%, #2b241a 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.95);
}
.brass-jack.plugged::after {
  background: radial-gradient(circle at 35% 35%, #ffdf9a, #b85b22 65%, #3d1c09);
  box-shadow: 0 0 8px rgba(255, 174, 59, 0.7);
}

/* Station Card (Paris Metro Plaque + Yellow Notebook Note) */
.station-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #1a2127;
  border: 1px solid #313d47;
  border-radius: 5px;
  padding: 10px 11px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
}
.station-card:hover { border-color: var(--brass-mid); background: #202930; }
.station-card.drop-ready {
  border-color: var(--amber-glow);
  box-shadow: 0 0 16px rgba(255, 174, 59, 0.25);
}
.station-card.matched {
  border-color: #2f8b5d;
  background: #14241e;
}

.station-body { flex: 1; min-width: 0; }
.metro-sign {
  display: inline-block;
  background: var(--metro-green);
  border: 1.5px solid #e7e2d3;
  color: #f7f4eb;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1.1px;
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 6px;
}
.yellow-note {
  background: linear-gradient(180deg, #f5e5a8 0%, #e9d387 100%);
  color: var(--ink);
  padding: 7px 9px;
  border-radius: 2px;
  font-size: 12.2px;
  line-height: 1.38;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  border-left: 3px solid #c49b39;
}
.station-card.matched .yellow-note {
  background: #d7e8d8;
  border-left-color: #2c7a51;
}
.stamped-tag {
  margin-top: 4px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  color: #1f6b43;
  letter-spacing: 1px;
}

/* Center CRT Oscilloscope & Tuner */
.crt-bezel {
  position: relative;
  background: #060d09;
  border: 4px solid #2b343b;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 34px rgba(0,0,0,0.92), 0 4px 12px rgba(0,0,0,0.5);
  height: 158px;
}
#crt-canvas { width: 100%; height: 100%; display: block; }
.crt-scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0 1px, transparent 1px 3px);
}
.crt-hud {
  position: absolute; left: 12px; right: 12px; top: 8px;
  display: flex; justify-content: space-between;
  font-family: ui-monospace, monospace; font-size: 11.5px; font-weight: 700;
  color: var(--phosphor);
  text-shadow: 0 0 8px rgba(107, 255, 149, 0.7);
  pointer-events: none;
}

.signal-strip {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 12px;
  background: #101519;
  border: 1px solid #28323a;
  padding: 6px 10px;
  border-radius: 4px;
}
.strip-label {
  font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 1.2px; color: #8b969e;
}
.led-row { display: flex; gap: 5px; flex: 1; }
.led {
  flex: 1; height: 9px; border-radius: 2px; background: #1e262c; border: 1px solid #2b363e;
  transition: background 0.1s, box-shadow 0.1s;
}
.led.on-low { background: #c94632; box-shadow: 0 0 6px #c94632; }
.led.on-mid { background: #f2a93b; box-shadow: 0 0 6px #f2a93b; }
.led.on-high { background: #5ef28d; box-shadow: 0 0 8px #5ef28d; }

/* Controls Row */
.controls-row {
  display: grid;
  grid-template-columns: 128px 1fr 128px;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.control-block {
  background: #12171c;
  border: 1px solid #28323a;
  border-radius: 5px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ctrl-title {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: #849099;
  text-align: center;
  margin-bottom: 6px;
}

.band-switches { display: flex; flex-direction: column; gap: 5px; }
.band-btn {
  cursor: pointer;
  padding: 6px 0;
  background: #1d242a;
  border: 1px solid #35414b;
  color: #a9b3ba;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  border-radius: 3px;
  transition: all 0.12s;
}
.band-btn:hover { border-color: var(--brass-mid); color: #efe3c8; }
.band-btn.active {
  background: linear-gradient(180deg, #dfae58, #9c6a22);
  color: #161008;
  border-color: #f6d999;
  box-shadow: 0 0 12px rgba(223, 174, 88, 0.35);
}

.dial-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.brass-dial {
  position: relative;
  width: 74px; height: 74px; border-radius: 50%;
  cursor: ew-resize;
  background:
    repeating-conic-gradient(from 0deg, #7c5822 0deg 4deg, #caa057 4deg 8deg),
    radial-gradient(circle, #332717, #16110a);
  border: 3px solid #2b2114;
  box-shadow: 0 6px 18px rgba(0,0,0,0.7), inset 0 0 0 4px rgba(18,14,10,0.8);
  display: flex; align-items: center; justify-content: center;
  outline: none;
}
.brass-dial:focus { box-shadow: 0 0 0 2px var(--amber-glow), 0 6px 18px rgba(0,0,0,0.7); }
.dial-cap {
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #443828, #19140e 75%);
  border: 1px solid #96723b;
  display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, monospace; font-size: 10px; color: var(--brass-bright);
  pointer-events: none;
}
.dial-notch {
  position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 14px; border-radius: 2px;
  background: #ffcf6e;
  box-shadow: 0 0 8px #ffae3b;
  pointer-events: none;
}

.freq-slider {
  width: 100%;
  accent-color: #dfa94e;
  cursor: pointer;
}

.action-block { gap: 6px; }
.toggle-btn {
  cursor: pointer;
  padding: 9px 6px;
  background: #232c33;
  border: 1px solid var(--brass-mid);
  color: var(--brass-bright);
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  transition: all 0.12s;
}
.toggle-btn:hover:not(:disabled) { background: #2e3840; }
.toggle-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.toggle-btn.ghost { border-color: #3a4650; color: #9ea9b2; }

/* Teleprinter Paper Tape */
.tape-housing {
  flex: 1;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  background: #0e1317;
  border: 1px solid #2b3640;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.tape-slot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 10px;
  background: #171e24;
  border-bottom: 1px solid #27313a;
  font-family: ui-monospace, monospace; font-size: 10px;
}
.tape-label { color: #8c98a1; letter-spacing: 1.2px; }
.tape-speaker { color: var(--amber-glow); font-weight: 700; }

.transcript-paper {
  flex: 1;
  background: linear-gradient(180deg, #f3e9cf 0%, #e8d9b4 100%);
  color: #1f1912;
  padding: 12px 14px;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 600;
  overflow-y: auto;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.18);
}

.status-banner {
  padding: 8px 12px;
  border-radius: 4px;
  background: #10161b;
  border: 1px solid #2c3842;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12.5px;
  color: #d6cebe;
  text-align: center;
}
.status-banner.ok { border-color: #2f9e5f; color: #86f7b0; background: #10261b; }
.status-banner.err { border-color: #c94134; color: #ff9c94; background: #291312; }

@media (max-width: 1080px) {
  html, body { overflow: auto; }
  .console-shell { height: auto; }
  .board-grid { grid-template-columns: 1fr; }
}
