:root {
  --bg: #efeee9;
  --paper: #f6f5f1;
  --ink: #171815;
  --muted: #8a8a84;
  --line: #c9c8c1;
  --line-dark: #9e9e98;
  --power: #d9ff57;
  --power-soft: rgba(217, 255, 87, .25);
  --dead: #deddd7;
  --mono: 'Courier New', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}
body.dragging-plug { cursor: grabbing; }
button, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
.svg-defs { position: absolute; }

.page-shell { min-height: 100vh; }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(239, 238, 233, .92);
  backdrop-filter: blur(14px);
}
.brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 17px;
  height: 17px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.brand-mark::before,
.brand-mark::after {
  content: '';
  position: absolute;
  top: 3px;
  width: 2px;
  height: 6px;
  background: currentColor;
}
.brand-mark::before { left: 4px; }
.brand-mark::after { right: 4px; }
.system-state {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 400 11px/1 var(--mono);
  color: #5f605b;
  letter-spacing: .04em;
}
.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--power);
  box-shadow: 0 0 0 4px var(--power-soft);
}

.hero {
  min-height: 620px;
  padding: 8vw 4vw 5vw;
  display: grid;
  grid-template-columns: 1.45fr .55fr;
  gap: 5vw;
  align-items: end;
}
.eyebrow {
  margin: 0 0 24px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .14em;
  color: #666761;
}
.hero h1 {
  margin: 0;
  max-width: 950px;
  font-size: clamp(58px, 8.3vw, 142px);
  line-height: .84;
  letter-spacing: -.07em;
  font-weight: 600;
}
.hero h1 span {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
}
.hero-note {
  max-width: 500px;
  margin: 40px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: #666761;
}
.power-station {
  border: 1px solid var(--line-dark);
  background: #e8e7e1;
  padding: 18px;
  align-self: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.16);
  position: relative;
}
.power-station::after {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(23,24,21,.08);
  pointer-events: none;
}
.station-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font: 400 9px/1 var(--mono);
  letter-spacing: .08em;
  color: #666761;
}
.outlets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 20px 10px 12px;
}
.outlet {
  min-height: 128px;
  border: 1px solid #8e8e89;
  background: #f1f0eb;
  border-radius: 10px;
  position: relative;
  cursor: default;
  transition: .2s ease;
  box-shadow: inset 0 0 0 4px #deddd7, 0 2px 4px rgba(0,0,0,.04);
}
.outlet.drag-over {
  border-color: var(--ink);
  transform: scale(1.025);
  box-shadow: inset 0 0 0 4px var(--power-soft), 0 0 0 6px var(--power-soft);
}
.outlet.occupied {
  background: #dbff64;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.34), 0 0 24px rgba(217,255,87,.45);
}
.socket-holes {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 17px;
}
.socket-holes i {
  display: block;
  width: 8px;
  height: 30px;
  background: #282925;
  border-radius: 6px;
}
.outlet small {
  position: absolute;
  bottom: 9px;
  left: 0;
  right: 0;
  text-align: center;
  font: 400 8px/1 var(--mono);
  color: #777872;
}
.station-hint {
  margin: 0;
  text-align: center;
  font: 500 10px/1 var(--mono);
  letter-spacing: .1em;
}

.workspace {
  position: relative;
  margin: 0 4vw 4vw;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  overflow: visible;
}
.wire-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.wire-path {
  fill: none;
  stroke: #7f807a;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.wire-path.powered {
  stroke: #23241f;
  filter: drop-shadow(0 0 4px rgba(217,255,87,.5));
}
.module {
  min-height: 390px;
  padding: 22px;
  background: var(--paper);
  position: relative;
  transition: background .3s ease, box-shadow .3s ease;
  overflow: visible;
}
.module::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(0,0,0,.025));
  pointer-events: none;
}
.module.powered {
  background: #fafaf5;
  box-shadow: inset 0 0 0 2px var(--power), inset 0 0 46px var(--power-soft);
  z-index: 2;
}
.module-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font: 400 9px/1 var(--mono);
  letter-spacing: .09em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.module.powered .module-head { color: var(--ink); border-color: #b7cb77; }
.status { transition: color .2s ease; }
.module.powered .status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--power);
  box-shadow: 0 0 0 3px var(--power-soft);
  vertical-align: 1px;
}
.module-body {
  height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-right: 80px;
}
.module-kicker {
  margin: 0 0 10px;
  font: 400 9px/1 var(--mono);
  color: #8c8d87;
  letter-spacing: .1em;
}
.module h2 {
  margin: 0 0 8px;
  font-size: clamp(38px, 4vw, 70px);
  line-height: .95;
  letter-spacing: -.055em;
  color: #a5a59f;
  transition: .25s ease;
}
.module.powered h2 { color: var(--ink); }
.module-body > p:not(.module-kicker):not(.ca-value) {
  margin: 0 0 22px;
  max-width: 420px;
  color: #9a9b95;
  font-size: 13px;
  line-height: 1.5;
}
.module.powered .module-body > p:not(.module-kicker):not(.ca-value) { color: #5f605b; }
.action-button {
  width: fit-content;
  min-width: 210px;
  min-height: 50px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .07em;
  cursor: pointer;
  transition: .18s ease;
}
.action-button:not(.disabled):hover {
  background: var(--power);
  color: var(--ink);
  box-shadow: 0 0 0 5px var(--power-soft);
  transform: translateY(-2px);
}
.action-button.disabled {
  background: var(--dead);
  border-color: #c7c7c1;
  color: #9e9e98;
  cursor: not-allowed;
  pointer-events: none;
}
.ca-value {
  margin: 0 0 22px;
  max-width: 100%;
  font: 400 11px/1.4 var(--mono);
  color: #a2a39d;
  word-break: break-all;
  transition: .2s ease;
}
.module.powered .ca-value { color: var(--ink); }

.plug {
  position: absolute;
  width: 68px;
  height: 94px;
  right: 22px;
  bottom: 22px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: grab;
  z-index: 5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  transition: transform .18s ease, opacity .2s ease, filter .18s ease;
  will-change: transform;
}
.plug:hover { transform: rotate(-3deg) translateY(-2px); }
.plug:active { cursor: grabbing; }
.plug.dragging {
  transition: none;
  z-index: 30;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,.18));
}
.plug.connected { opacity: .16; pointer-events: auto; }
.plug.connected:hover { opacity: .42; }
.plug-body {
  position: relative;
  width: 46px;
  height: 54px;
  margin: 0 auto 6px;
  display: block;
  pointer-events: none;
  background: #dadad4;
  border: 1px solid #8d8e88;
  border-radius: 7px 7px 12px 12px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), 0 2px 3px rgba(0,0,0,.08);
}
.plug-body::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 5px;
  height: 17px;
  transform: translateX(-50%);
  background: #565752;
  border-radius: 0 0 3px 3px;
}
.plug-body i {
  position: absolute;
  top: -19px;
  width: 5px;
  height: 23px;
  background: #5d5e59;
  border-radius: 2px 2px 0 0;
}
.plug-body i:first-child { left: 10px; }
.plug-body i:last-child { right: 10px; }
.plug-label {
  display: block;
  pointer-events: none;
  text-align: center;
  font: 500 8px/1 var(--mono);
  letter-spacing: .08em;
  color: #73746e;
}
.module.powered .plug-body {
  background: var(--power);
  border-color: #697635;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(217,255,87,.4);
}

.manifesto {
  margin: 0 4vw;
  padding: 8vw 0 10vw;
  border-top: 1px solid var(--line);
}
.manifesto-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 8vw;
  align-items: end;
}
.manifesto h2 {
  margin: 0;
  font-size: clamp(44px, 6.5vw, 112px);
  line-height: .88;
  letter-spacing: -.06em;
  font-weight: 500;
}
.manifesto-grid > div { max-width: 450px; justify-self: end; }
.manifesto-grid p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: #5f605b;
}
.manifesto .tiny {
  margin-top: 50px;
  font: 400 9px/1.5 var(--mono);
  color: #888983;
  letter-spacing: .08em;
}
footer {
  min-height: 72px;
  padding: 0 4vw;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  font: 400 9px/1 var(--mono);
  letter-spacing: .08em;
  color: #777872;
}
footer span:nth-child(2) { text-align: center; }
footer span:nth-child(3) { text-align: right; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: white;
  padding: 13px 18px;
  font: 500 9px/1 var(--mono);
  letter-spacing: .08em;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 90px;
    min-height: auto;
  }
  .power-station { max-width: 480px; width: 100%; margin-top: 20px; }
  .workspace { grid-template-columns: 1fr; }
  .manifesto-grid { grid-template-columns: 1fr; }
  .manifesto-grid > div { justify-self: start; max-width: 560px; }
}

@media (max-width: 600px) {
  .topbar { height: 64px; padding: 0 18px; }
  .system-state { display: none; }
  .hero { padding: 72px 18px 48px; }
  .hero h1 { font-size: clamp(52px, 16vw, 86px); }
  .hero-note { margin-top: 28px; }
  .workspace { margin: 0 18px 40px; }
  .module { min-height: 355px; padding: 18px; }
  .module-body { height: 272px; padding-right: 66px; }
  .plug { right: 12px; bottom: 18px; transform: scale(.88); }
  .manifesto { margin: 0 18px; padding: 90px 0; }
  .outlets { gap: 11px; padding-left: 0; padding-right: 0; }
  .outlet { min-height: 112px; }
  footer { padding: 0 18px; grid-template-columns: 1fr auto; }
  footer span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
