:root {
  color-scheme: dark;
  --bg: #020504;
  --panel: rgba(3, 14, 7, 0.84);
  --text: #7cff7c;
  --text-dim: rgba(124, 255, 124, 0.75);
  --border: rgba(124, 255, 124, 0.14);
  --line: rgba(70, 255, 120, 0.08);
  --radius: 18px;
  --font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at center, rgba(0, 255, 120, 0.03), transparent 45%),
    linear-gradient(to bottom, rgba(255,255,255,0.01), rgba(0,0,0,0.05)),
    var(--bg);
}

.background-grid,
.background-wires {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.background-grid {
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(124, 255, 124, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 255, 124, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

.background-wires svg {
  width: 100%;
  height: 100%;
}

.wire-path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  opacity: 0.12;
  transition: stroke 140ms ease, filter 140ms ease, opacity 220ms ease;
  filter: drop-shadow(0 0 3px rgba(124, 255, 124, 0.03));
}

.wire-path.active-line {
  opacity: 0.9;
  stroke: rgba(90, 255, 140, 0.18);
}

.background-wires.flash-green .wire-path {
  stroke: rgba(120, 255, 160, 0.92);
  filter:
    drop-shadow(0 0 8px rgba(120, 255, 160, 0.5))
    drop-shadow(0 0 16px rgba(120, 255, 160, 0.22));
}

.background-wires.flash-blue .wire-path {
  stroke: rgba(120, 200, 255, 0.92);
  filter:
    drop-shadow(0 0 8px rgba(120, 200, 255, 0.5))
    drop-shadow(0 0 16px rgba(120, 200, 255, 0.22));
}

.wire-path.path-highlight-green {
  stroke: rgba(120, 255, 160, 1);
  opacity: 1;
}

.wire-path.path-highlight-blue {
  stroke: rgba(120, 200, 255, 1);
  opacity: 1;
}

#wire-pulse {
  fill: rgba(160, 255, 180, 0.95);
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(160, 255, 180, 0.65));
}

#wire-pulse.blue {
  fill: rgba(150, 220, 255, 0.98);
  filter: drop-shadow(0 0 10px rgba(150, 220, 255, 0.7));
}

.ui-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 190px minmax(600px, 1fr) 220px;
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 84px 32px 48px;
  align-items: start;
}

.left-column,
.center-column,
.right-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    inset 0 0 0 1px rgba(124, 255, 124, 0.03),
    0 0 12px rgba(0, 255, 100, 0.03),
    0 0 18px rgba(0, 255, 100, 0.05);
}

.panel-title {
  font-size: 1.05rem;
  margin-bottom: 14px;
  color: var(--text);
}

.centered-title {
  text-align: center;
}

.panel-stage {
  min-height: 108px;
  padding: 16px;
  display: flex;
  justify-content: center;
  text-align: center;
}

.panel-stage.active {
  box-shadow:
    inset 0 0 0 1px rgba(124, 255, 124, 0.05),
    0 0 24px rgba(0, 255, 100, 0.06);
}

.panel-stage.completed {
  box-shadow:
    inset 0 0 0 1px rgba(124, 255, 124, 0.12),
    0 0 28px rgba(124, 255, 124, 0.18);
}

.stage-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transition: opacity 220ms ease;
}

.stage-content.visible {
  opacity: 1;
}

.stage-label {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.stage-title {
  font-size: 1.35rem;
  margin-top: 4px;
}

.stage-subtitle {
  font-size: 1.15rem;
  margin-top: 2px;
  color: var(--text-dim);
}

.top-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.action-button,
.bit-switch,
.system-toggle {
  font: inherit;
  color: var(--text);
  background: rgba(4, 18, 9, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.action-button {
  min-height: 76px;
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.35;
}

.action-button:hover,
.bit-switch:hover,
.system-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 255, 124, 0.28);
  box-shadow: 0 0 16px rgba(124, 255, 124, 0.08);
}

.action-button:active,
.bit-switch:active,
.system-toggle:active {
  transform: translateY(0);
}

.action-button.flash,
.bit-switch.flash,
.system-toggle.flash {
  box-shadow:
    0 0 18px rgba(124, 255, 124, 0.16),
    inset 0 0 10px rgba(124, 255, 124, 0.08);
}

.console-panel {
  padding: 18px 20px 20px;
  min-height: 300px;
}

.console-split {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 18px;
}

.console-left,
.console-right {
  min-width: 0;
}

.console-stats {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 0.98rem;
  color: var(--text-dim);
}

.console-output {
  min-height: 156px;
  padding: 14px 16px;
  border: 1px solid rgba(124, 255, 124, 0.09);
  border-radius: 14px;
  background: rgba(0, 10, 4, 0.55);
  line-height: 1.5;
}

.console-output p {
  margin: 0 0 8px;
}

.system-title {
  margin-top: 12px;
  margin-bottom: 28px;
  font-size: 1.55rem;
  line-height: 1.05;
  text-align: center;
  color: #92ff92;
}

.system-status {
  display: grid;
  gap: 18px;
}

.status-block {
  padding: 14px 16px;
  border: 1px solid rgba(124, 255, 124, 0.09);
  border-radius: 14px;
  background: rgba(0, 10, 4, 0.45);
}

.status-label {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  min-height: 1em;
}

.status-value {
  font-size: 1rem;
  margin-bottom: 8px;
}

.status-subvalue {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.controls-block {
  display: grid;
  gap: 10px;
}

.system-toggle {
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
}

.system-toggle.on {
  border-color: rgba(124, 255, 124, 0.34);
  background: rgba(16, 42, 18, 0.96);
}

.system-toggle.danger {
  border-color: rgba(255, 120, 120, 0.16);
  color: rgba(255, 180, 180, 0.88);
}

.progress-section {
  padding: 8px 2px 0;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.progress-bar {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 10, 4, 0.65);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(60, 255, 110, 0.55), rgba(120, 255, 160, 0.9));
  box-shadow: 0 0 14px rgba(124, 255, 124, 0.22);
  transition: width 180ms ease;
}

.progress-note {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.45;
}

.switches-panel {
  padding: 18px 16px 18px;
  min-height: 650px;
}

.switch-help {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.bit-switch {
  min-height: 64px;
  font-size: 1.4rem;
  font-weight: bold;
}

.bit-switch.off {
  color: rgba(124, 255, 124, 0.72);
}

.bit-switch.on {
  background: rgba(20, 50, 24, 0.96);
  color: #b6ffb6;
  border-color: rgba(124, 255, 124, 0.36);
  box-shadow:
    0 0 18px rgba(124, 255, 124, 0.14),
    inset 0 0 10px rgba(124, 255, 124, 0.07);
}

/* Tablet and smaller laptop */
@media (max-width: 1100px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .ui-layout {
    grid-template-columns: 1fr;
    max-width: 860px;
    padding: 28px 16px 32px;
    gap: 18px;
  }

  .left-column,
  .center-column,
  .right-column {
    gap: 14px;
  }

  .center-column {
    order: 1;
  }

  .right-column {
    order: 2;
  }

  .left-column {
    order: 3;
  }

  .top-actions,
  .console-split {
    grid-template-columns: 1fr;
  }

  .console-panel,
  .switches-panel {
    min-height: auto;
  }
}

/* Phones */
@media (max-width: 700px) {
  .app-shell {
    min-height: 100vh;
  }

  .ui-layout {
    padding: 16px 12px 24px;
    gap: 14px;
  }

  .top-actions {
    gap: 10px;
  }

  .action-button {
    min-height: 58px;
    font-size: 0.95rem;
    padding: 12px;
  }

  .console-panel,
  .switches-panel,
  .panel-stage {
    padding: 14px;
  }

  .console-output {
    min-height: 120px;
    padding: 12px;
    font-size: 0.92rem;
  }

  .console-stats {
    font-size: 0.92rem;
    gap: 4px;
  }

  .system-title {
    margin-top: 4px;
    margin-bottom: 18px;
    font-size: 1.25rem;
  }

  .system-toggle {
    min-height: 40px;
    padding: 10px;
    font-size: 0.92rem;
  }

  .switch-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .bit-switch {
    min-height: 52px;
    font-size: 1.15rem;
  }

  .panel-stage {
    min-height: 84px;
  }

  .stage-label {
    font-size: 0.82rem;
  }

  .stage-title {
    font-size: 1.05rem;
  }

  .stage-subtitle {
    font-size: 0.92rem;
  }

  .progress-note,
  .switch-help,
  .status-label,
  .status-subvalue,
  .progress-label-row {
    font-size: 0.88rem;
  }
}