:root {
  color-scheme: dark;
  --ink: #10252f;
  --panel: #132d39;
  --line: #3a6670;
  --mint: #a6f1b5;
  --gold: #ffcf76;
  --coral: #ff9b83;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(circle at 50% 0, #26434b, #101d26 60%); overflow-x: auto; }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.shell { max-width: 1560px; min-width: 820px; min-height: 100vh; margin: auto; padding: 18px; display: grid; grid-template-columns: minmax(340px, 430px) minmax(570px, 1fr); gap: 16px; }
.game-side, .graph-side { min-width: 0; border-radius: 22px; border: 1px solid #4a6871; box-shadow: 0 20px 60px #0007, inset 0 1px #ffffff20; }
.game-side { align-self: stretch; padding: 13px; display: flex; flex-direction: column; gap: 13px; background: #0a1b25; }
.game-bezel { position: relative; width: 100%; aspect-ratio: 480 / 540; max-height: calc(100vh - 112px); overflow: hidden; border: 5px solid #314e53; border-radius: 14px; box-shadow: inset 0 0 0 2px #c9e9ca, 0 0 0 1px #000; background: #72c6d0; }
#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.score { position: absolute; z-index: 3; top: 17px; left: 0; right: 0; color: white; text-align: center; font-size: clamp(36px, 5vw, 56px); font-weight: 1000; line-height: 1; text-shadow: 3px 3px #534e43, -2px -2px #534e43, 2px -2px #534e43, -2px 2px #534e43, 0 5px #534e43; pointer-events: none; }
.flag { position: absolute; z-index: 5; top: 44%; left: 5%; width: 90%; padding: 18px 10px; border: 4px solid #5b392b; border-radius: 10px; text-align: center; color: #4a3827; background: #fff3bf; box-shadow: 0 8px 0 #6a4f38, 0 20px 35px #0007; font-size: clamp(14px, 2vw, 23px); font-weight: 900; overflow-wrap: anywhere; }
.game-state { position: absolute; z-index: 4; width: 24px; height: 24px; right: 17px; top: 20px; border-radius: 50%; background: #fff7; box-shadow: 0 0 0 5px #fff4; opacity: 0; transition: opacity .2s; }
.game-state.active { opacity: 1; background: #ffe879; }
.game-state.crash { opacity: 1; background: #ff796c; }
.game-state.win { opacity: 1; background: #8dffbd; }
.game-controls { display: flex; align-items: center; gap: 10px; padding: 0 3px 2px; min-height: 66px; }
.control { width: 64px; height: 58px; display: grid; place-items: center; border-radius: 14px; border: 2px solid #57808a; box-shadow: inset 0 2px #ffffff45, 0 5px 0 #071419; color: #fff; background: #254653; font-size: 22px; font-weight: 1000; }
.control:hover { transform: translateY(-2px); box-shadow: inset 0 2px #ffffff45, 0 7px 0 #071419; }
.control:active { transform: translateY(3px); box-shadow: inset 0 2px #ffffff45, 0 2px 0 #071419; }
.control:disabled { opacity: .55; cursor: wait; }
.control svg, .add-node svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.control.primary { color: #31524c; border-color: #b9f7c1; background: #9ae6aa; }
.control.primary svg { fill: currentColor; stroke: none; }
.control.submit { color: #5a4432; border-color: #ffe19d; background: #ffc969; }
.control.speed { font-size: 18px; }
.server-indicator { margin-left: auto; display: flex; gap: 4px; align-items: center; padding-right: 8px; }
.server-indicator small { margin-right: 6px; color: #82aaa8; font-size: 9px; font-weight: 700; white-space: nowrap; }
.server-indicator span { display: block; width: 5px; height: 5px; border-radius: 50%; background: #80b8aa; opacity: .4; }
.server-indicator.busy span { animation: blink .6s infinite alternate; }
.server-indicator.busy span:nth-child(2) { animation-delay: .2s; }
.server-indicator.busy span:nth-child(3) { animation-delay: .4s; }
.server-indicator.success span { opacity: 1; background: #9ae6aa; }
.server-indicator.failure span { opacity: 1; background: #ff9b83; }
@keyframes blink { to { opacity: 1; transform: scale(1.4); } }
.graph-side { display: flex; flex-direction: column; background: #142e39; overflow: hidden; }
.graph-toolbar { height: 66px; min-height: 66px; padding: 11px 17px 10px 23px; display: flex; align-items: center; justify-content: space-between; background: #173642; border-bottom: 1px solid #42646d; }
.toolbar-orbit { position: relative; width: 58px; height: 30px; }
.toolbar-orbit span { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px #a6f1b522; }
.toolbar-orbit span:nth-child(1) { left: 1px; top: 10px; }
.toolbar-orbit span:nth-child(2) { left: 24px; top: 0; background: var(--gold); }
.toolbar-orbit span:nth-child(3) { left: 47px; top: 18px; background: var(--coral); }
.toolbar-orbit::before, .toolbar-orbit::after { content: ''; position: absolute; height: 1px; width: 27px; background: #7da2a4; transform-origin: left; }
.toolbar-orbit::before { left: 10px; top: 14px; transform: rotate(-24deg); }
.toolbar-orbit::after { left: 31px; top: 9px; transform: rotate(38deg); }
.add-node { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid #b9f7c1; border-radius: 12px; color: #25483d; background: #a6f1b5; box-shadow: 0 4px 0 #0b292b; }
.add-node:hover { transform: translateY(-2px); }
.graph { flex: 1; position: relative; min-height: 635px; overflow: hidden; background-color: #193a46; background-image: radial-gradient(#4f7b815e 1px, transparent 1px), radial-gradient(circle at 47% 50%, #23525b 0, transparent 48%); background-size: 22px 22px, auto; touch-action: none; }
.graph::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 65px #0c222b8a; }
.nodes { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.wires { position: absolute; inset: 0; z-index: 1; overflow: visible; pointer-events: none; }
.wire { fill: none; stroke: #b4e5ba; stroke-width: 3; filter: drop-shadow(0 0 4px #a6f1b55a); }
.wire.negative { stroke: #f3a68c; filter: drop-shadow(0 0 4px #ff9b8363); }
.wire.active { stroke-width: 4.5; }
.wire.preview { stroke: #fff3b1; stroke-dasharray: 8 8; }
.wire-hit { fill: none; stroke: transparent; stroke-width: 22; pointer-events: stroke; cursor: pointer; }
.wire-weight { fill: #fff4c9; font-size: 12px; font-weight: 900; text-anchor: middle; paint-order: stroke; stroke: #193a46; stroke-width: 5px; pointer-events: none; }
.neuron { --node-color: var(--gold); position: absolute; width: 76px; height: 76px; border: 3px solid var(--node-color); border-radius: 50%; background: #14323d; box-shadow: 0 0 0 6px #173c46, 0 5px 0 #071c24, 0 0 22px color-mix(in srgb, var(--node-color) 30%, transparent); color: var(--node-color); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; user-select: none; pointer-events: auto; touch-action: none; cursor: grab; }
.neuron:active { cursor: grabbing; }
.neuron.input { --node-color: var(--mint); width: 66px; height: 66px; cursor: default; }
.neuron.output { --node-color: var(--coral); width: 80px; height: 80px; cursor: default; }
.neuron.selected { box-shadow: 0 0 0 7px #fff6d38a, 0 0 34px var(--node-color); }
.neuron .glyph { font-size: 29px; line-height: 1; font-weight: 900; }
.neuron.input .glyph { font-size: 23px; }
.neuron .node-label { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); width: 110px; color: #d8e9dc; font-size: 10px; line-height: 11px; font-weight: 700; text-align: center; white-space: nowrap; text-shadow: 0 2px 3px #0d2631; pointer-events: none; }
.neuron .live-value { color: #f9f6d8; font-size: 10px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.port { position: absolute; top: calc(50% - 8px); width: 16px; height: 16px; border: 3px solid #17333d; border-radius: 50%; background: var(--node-color); box-shadow: 0 0 0 2px var(--node-color); cursor: crosshair; touch-action: none; }
.port.in { left: -10px; }
.port.out { right: -10px; }
.port:hover { transform: scale(1.4); background: white; }
.graph-bottom { height: 42px; min-height: 42px; background: #173642; border-top: 1px solid #42646d; display: flex; align-items: center; justify-content: space-between; padding: 0 23px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px var(--mint); }
.graph-motif { display: flex; align-items: center; gap: 5px; }
.graph-motif i { width: 5px; height: 9px; border-radius: 2px; background: #72a5a1; }
.graph-motif i:nth-child(2), .graph-motif i:nth-child(4) { height: 16px; }
.graph-motif i:nth-child(3) { height: 23px; background: var(--gold); }
.inspector { position: absolute; z-index: 10; min-width: 215px; max-width: 255px; padding: 12px; border: 2px solid #a5d1bf; border-radius: 16px; background: #0d2833f2; color: #f6f4d9; box-shadow: 0 16px 35px #0009, inset 0 1px #ffffff2a; backdrop-filter: blur(8px); touch-action: auto; }
.inspect-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 12px; border-bottom: 1px solid #4e7277; }
.inspect-head .glyph { font-size: 25px; color: var(--gold); }
.inspect-name { max-width: 75px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 800; }
.inspect-value-group { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.inspect-head output { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tiny-label { color: #a4c5bd; font-size: 9px; font-weight: 800; letter-spacing: .07em; }
.section-label { display: block; margin: 11px 0 0; }
.inspect-hint { margin: 9px 2px 0; color: #c1d6cb; font-size: 10px; line-height: 1.35; }
.icon-button { border: 0; background: transparent; color: #e1ecd9; font-size: 22px; line-height: 1; padding: 0; }
.inspect-head .icon-button { margin-left: 4px; }
.activation-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 6px 0 12px; }
.activation-button { height: 43px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 1px solid #57838a; border-radius: 7px; background: #1c4650; color: #c9e4d6; }
.activation-button.selected { border-color: var(--gold); background: #61563b; color: var(--gold); }
.activation-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.activation-name { font-size: 8px; line-height: 1; }
.activation-hint { color: #a4c5bd; font-size: 9px; line-height: 1.2; text-align: center; margin: -5px 0 8px; }
.setting-row { display: flex; align-items: center; gap: 9px; min-height: 35px; padding: 3px 0; }
.setting-row .glyph { width: 32px; color: var(--mint); font-size: 20px; text-align: center; }
.setting-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c1d6cb; font-size: 10px; }
.setting-row input { width: 85px; margin-left: auto; border: 1px solid #69959a; border-radius: 7px; background: #0b1c27; color: #fff1ba; padding: 5px 7px; text-align: right; font-size: 13px; font-weight: 800; }
.setting-row input::-webkit-inner-spin-button { opacity: 1; }
.inspect-actions { margin-top: 12px; display: flex; justify-content: flex-end; border-top: 1px solid #4e7277; padding-top: 10px; }
.delete-button { color: #ff9b83; }
.error-flash { animation: error-flash .5s 2; }
@keyframes error-flash { 50% { box-shadow: inset 0 0 70px #ff584c9a; } }
@media (max-width: 1000px) { .shell { min-width: 0; grid-template-columns: 1fr; max-width: 800px; } .game-side { max-width: 520px; width: 100%; margin: auto; } .game-bezel { max-height: none; } .graph-side { min-width: 0; } .graph { min-height: 610px; } }
@media (max-width: 600px) { .shell { padding: 8px; gap: 8px; } .game-side { padding: 7px; border-radius: 14px; } .graph-side { border-radius: 14px; } .graph { min-height: 590px; } .neuron.input { width: 53px; height: 53px; } .neuron { width: 64px; height: 64px; } .neuron.output { width: 66px; height: 66px; } .neuron .glyph { font-size: 22px; } .neuron.input .glyph { font-size: 19px; } .neuron .node-label { font-size: 9px; line-height: 10px; } .inspector { max-width: 225px; } }
