:root {
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  color: #242d3d;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #242d3d;
  --muted: #8d97a7;
  --line: #e9edf3;
  --blue: #4468e8;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 760px; min-height: 100vh; }
button, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  gap: 30px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 700; letter-spacing: -1px; }
.brand-dot { color: #5876ef; }
.brand-mark { width: 23px; height: 23px; border-radius: 7px; background: #536fe8; display: grid; grid-template-columns: repeat(2, 4px); grid-template-rows: repeat(2, 4px); place-content: center; gap: 3px; transform: rotate(-7deg); }
.brand-mark i { width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.project-name { font-size: 13px; font-weight: 600; color: #5c6575; display: flex; align-items: center; gap: 9px; }
.project-indicator, .canvas-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #5fc49c; }
.saved-label { color: #a4acb9; font-size: 11px; font-weight: 400; margin-left: 3px; }
.top-actions { margin-left: auto; display: flex; gap: 9px; }
.button { height: 36px; border-radius: 7px; padding: 0 13px; border: 1px solid transparent; font-size: 12px; font-weight: 600; transition: background .15s, border-color .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: #4a68e5; color: #fff; box-shadow: 0 2px 6px #526fe329; }
.button-primary:hover { background: #3e5bd4; }
.button-primary span { font-size: 15px; margin-right: 4px; }
.button-quiet { color: #667082; background: #fff; border-color: #e7eaf0; }
.button-quiet:hover, .button-outline:hover { background: #f7f8fb; border-color: #cdd4e0; }

.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 66px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 29px 20px 17px; display: flex; flex-direction: column; min-height: calc(100vh - 66px); max-height: calc(100vh - 66px); overflow-y: auto; }
.sidebar-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 31px; }
.eyebrow { color: #9aa4b4; font-weight: 700; font-size: 9px; letter-spacing: 1.15px; margin: 0 0 8px; }
h1 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.icon-button { border: 1px solid #e8ebf1; background: #fff; color: #7d8798; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-weight: 600; }
.icon-button:hover { border-color: #cbd4e4; color: #4b67db; }
.tool-section { padding-bottom: 23px; border-bottom: 1px solid #edf0f4; margin-bottom: 21px; }
.tool-section h2 { font-size: 12px; margin: 0 0 12px; font-weight: 700; }
.component-card { height: 57px; width: 100%; margin-top: 8px; display: flex; align-items: center; border: 1px solid #e9edf3; border-radius: 8px; padding: 0 11px; background: #fff; text-align: left; }
.component-card-capacitor { height: 68px; }
.component-card:hover { border-color: #a9b8f5; background: #fbfcff; }
.component-icon { width: 34px; height: 34px; border-radius: 7px; background: #f5f6fa; position: relative; margin-right: 11px; display: grid; place-items: center; }
.led-icon::before { content: ""; position: absolute; width: 13px; height: 15px; border-radius: 8px 8px 4px 4px; background: #f27067; top: 5px; box-shadow: inset -3px -2px #dd514b; }
.led-icon::after { content: ""; position: absolute; width: 2px; height: 8px; top: 19px; left: 16px; background: #8a909a; box-shadow: 5px 2px #8a909a; transform: rotate(-3deg); }
.led-icon i { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #f8b8b2; top: 2px; }
.resistor-icon::before { content: ""; width: 22px; height: 9px; border: 1px solid #b79662; border-radius: 3px; background: linear-gradient(90deg, #ddc69b 0 22%, #a65047 22% 30%, #ddc69b 30% 52%, #333 52% 60%, #ddc69b 60% 83%, #c38332 83%); }
.resistor-icon::after { content: ""; position: absolute; width: 28px; height: 1px; background: #9299a3; }
.component-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.component-copy strong { font-size: 11px; font-weight: 600; }
.component-copy small { font-size: 10px; color: #98a1af; }
.add-symbol { width: 27px; height: 30px; flex: 0 0 27px; margin-left: auto; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #929cad; font-size: 18px; font-weight: 400; }
.add-symbol:hover { background: #eef1ff; color: #4a68e5; }
.part-value { width: 100%; max-width: 133px; padding: 0; border: 0; outline: 0; background: transparent; color: #98a1af; font-size: 10px; cursor: pointer; }
.potentiometer-icon::before { content: ""; width: 20px; height: 20px; border: 2px solid #c4a976; border-radius: 4px; background: repeating-linear-gradient(90deg,#d9c18f 0 3px,#b89459 3px 4px); }
.potentiometer-icon::after { content: "↗"; position: absolute; top: 2px; right: 3px; color: #778090; font-size: 13px; }
.button-icon::before { content: ""; width: 18px; height: 18px; border: 2px solid #95a1b3; border-radius: 50%; background: linear-gradient(145deg,#fff,#dce2eb); box-shadow: 0 2px 2px #72809655; }
.button-icon::after { content: ""; position: absolute; width: 2px; height: 7px; top: 7px; background: #929eaf; }
.capacitor-icon::before, .capacitor-icon::after { content: ""; position: absolute; width: 3px; height: 21px; top: 7px; border-radius: 2px; background: #6787bb; }
.capacitor-icon::before { left: 13px; }
.capacitor-icon::after { right: 12px; }
.capacitor-icon i { position: absolute; height: 1px; width: 26px; background: #9aa5b5; transform: rotate(90deg); }
.capacitor-values { display: flex; gap: 5px; }
.capacitor-values .part-value { width: auto; flex: 1; }
.source-icon { font-size: 19px; font-weight: 700; }
.dc-icon { color: #4787d8; background: #edf5ff; }
.ac-icon { color: #9570ce; background: #f5f0ff; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.section-title-row h2 { margin: 0; }
.esp32-features[hidden] { display: none; }
.wireless-control { width: 100%; min-height: 48px; margin-top: 7px; padding: 6px 9px; display: flex; align-items: center; gap: 9px; border: 1px solid #e8ebf1; border-radius: 8px; background: #fff; text-align: left; }
.wireless-control:hover { border-color: #b7c4f4; background: #fbfcff; }
.wireless-control.is-enabled { border-color: #b7e5ce; background: #f5fcf8; }
.wireless-symbol { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: #f1f4fa; color: #78869d; font-size: 19px; font-weight: 700; }
.wireless-control.is-enabled .wireless-symbol { background: #e4f6ed; color: #379d6c; }
.bluetooth-symbol { font-size: 17px; }
.wireless-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.wireless-copy strong { color: #445064; font-size: 10px; }
.wireless-copy small { color: #9aa3b0; font-size: 9px; }
.wireless-state { color: #969faf; font-size: 9px; font-weight: 700; }
.wireless-control.is-enabled .wireless-state { color: #319465; }
.wireless-note { margin: 8px 1px 0; color: #a0a9b5; font-size: 9px; line-height: 1.6; }
.wire-count { font-size: 10px; color: #8f99a9; border-radius: 10px; background: #f4f6f9; padding: 4px 8px; }
.section-description { color: #97a0ae; font-size: 10px; margin: 7px 0 15px; }
.field-label { display: block; color: #6f798a; font-size: 10px; margin-bottom: 7px; }
.color-picker { height: 36px; border: 1px solid #e8ebf1; border-radius: 7px; display: flex; align-items: center; padding: 0 10px; margin-bottom: 10px; }
.color-picker select { appearance: none; outline: 0; border: 0; flex: 1; background: transparent; color: #596375; font-size: 11px; cursor: pointer; }
.color-preview { width: 11px; height: 11px; border-radius: 50%; background: #f26b5b; box-shadow: 0 0 0 3px #fce9e7; }
.button-outline { width: 100%; height: 34px; background: #fff; color: #737d8c; border-color: #e8ebf1; font-size: 10px; }
.button-outline:disabled { opacity: .48; cursor: default; }
.tip-card { display: flex; gap: 10px; padding: 12px 11px; background: #f5f7ff; border: 1px solid #e9edff; border-radius: 8px; }
.tip-icon { color: #6179e5; font-size: 16px; margin-top: -1px; }
.tip-card strong { display: block; font-size: 10px; color: #4b5caa; margin-bottom: 5px; }
.tip-card p { margin: 0; color: #818ba6; font-size: 9px; line-height: 1.8; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.button-delete { width: 100%; color: #8e6870; background: #fff; border-color: #f0e5e7; font-size: 11px; }
.button-delete:hover, .button-delete.active { background: #fff5f5; color: #ca5757; border-color: #f1caca; }
.button-delete span { margin-right: 4px; }
.sidebar-bottom p { color: #a6aebb; font-size: 9px; line-height: 1.7; margin: 12px 2px 0; }

.editor { min-width: 0; display: flex; flex-direction: column; }
.editor-toolbar { height: 54px; flex: 0 0 54px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 21px; display: flex; align-items: center; justify-content: space-between; }
.canvas-title { display: flex; align-items: center; gap: 8px; color: #9aa3b0; font-size: 10px; }
.canvas-title strong { color: #4e5869; font-size: 11px; }
.canvas-title .canvas-dot { width: 6px; height: 6px; }
.toolbar-right { display: flex; align-items: center; gap: 11px; }
.model-picker { display: flex; align-items: center; gap: 7px; color: #929cab; font-size: 10px; }
.model-picker select { height: 29px; min-width: 90px; padding: 0 24px 0 9px; border: 1px solid #e8ebf1; border-radius: 6px; background: #fff; color: #596375; font: inherit; font-size: 10px; cursor: pointer; }
.model-picker select:focus-visible { outline: 2px solid #8298ff; outline-offset: 2px; }
.power-toggle { height: 29px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid #dceee6; border-radius: 6px; background: #f5fcf8; color: #528b70; font: inherit; font-size: 9px; cursor: pointer; white-space: nowrap; }
.power-toggle:hover { background: #eaf8f0; }
.power-toggle.is-off { border-color: #f0d7d7; background: #fff7f7; color: #b45b5b; }
.power-indicator { width: 7px; height: 7px; border-radius: 50%; background: #55b785; box-shadow: 0 0 5px #55b78577; }
.power-toggle.is-off .power-indicator { background: #d26464; box-shadow: 0 0 5px #d2646477; }
.zoom-label { font-size: 10px; color: #929cab; }
.grid-button { font-size: 17px; }
.canvas-scroll { flex: 1; overflow: auto; padding: 20px; }
.canvas { background-color: #fff; background-image: radial-gradient(#dce2ec 1px, transparent 1px); background-size: 19px 19px; border: 1px solid #e7ebf2; border-radius: 9px; width: 1200px; height: 760px; position: relative; overflow: hidden; box-shadow: 0 3px 12px #25385d08; }
.wire-layer { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wire-path { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; cursor: pointer; filter: drop-shadow(0 2px 2px #26334c22); }
.wire-path:hover { stroke-width: 6; }
.wire-flow { stroke-width: 4.5; }
.wire-flow-ac { stroke-dasharray: 9 6; }
.circuit-coach { position: absolute; z-index: 8; top: 16px; right: 18px; width: min(295px, calc(100% - 36px)); padding: 12px 13px; border: 1px solid #dfe7fb; border-radius: 9px; background: #ffffffed; box-shadow: 0 5px 16px #2c426118; backdrop-filter: blur(5px); }
.circuit-coach[hidden] { display: none; }
.circuit-coach.coach-suggestion { border-color: #e8dfc7; background: #fffef9ed; }
.circuit-coach.coach-warning { border-color: #f0d7b4; background: #fffaf1ed; }
.coach-kicker { margin: 0 0 5px; color: #4d68c7; font-size: 10px; font-weight: 700; }
.coach-suggestion .coach-kicker { color: #9c7430; }
.coach-warning .coach-kicker { color: #a66c20; }
.coach-message { margin: 0; color: #566174; font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.coach-actions { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.coach-actions[hidden] { display: none; }
.coach-actions button { min-height: 27px; padding: 0 10px; border-radius: 5px; font: inherit; font-size: 10px; cursor: pointer; }
.coach-yes { border: 1px solid #d9e2ff; background: #edf1ff; color: #425fca; font-weight: 600; }
.coach-yes:hover { background: #e1e8ff; }
.coach-no { border: 1px solid #e8ebf1; background: #fff; color: #838d9c; }
.coach-no:hover { background: #f7f8fb; }
.wire-preview { fill: none; stroke-width: 3; stroke-dasharray: 6 6; opacity: .65; }
.board-label { position: absolute; z-index: 1; color: #a0a9b6; font-size: 9px; font-weight: 700; letter-spacing: 1.1px; }
.board-label span { color: #c2c8d1; font-size: 8px; font-weight: 500; letter-spacing: .3px; margin-left: 5px; }
.arduino-label { top: 92px; left: 68px; }
.breadboard-label { top: 92px; left: 486px; }
.board { position: absolute; z-index: 2; }
.arduino { width: 330px; height: 430px; left: 62px; top: 122px; border-radius: 25px 25px 12px 12px; background: linear-gradient(145deg, #168b79, #087263); box-shadow: 0 8px 15px #1e665528, inset 0 1px #ffffff35; }
.arduino.model-nano { width: 260px; height: 370px; left: 97px; top: 152px; border-radius: 11px; }
.arduino.model-nano::before { border-radius: 8px; }
.model-nano .top-pins { left: 18px; }
.model-nano .bottom-pins { left: 18px; }
.model-nano .usb-port { left: 78px; }
.model-nano .power-jack { display: none; }
.model-nano .board-logo { top: 72px; left: 86px; }
.model-nano .chip { left: 86px; top: 204px; }
.arduino.model-esp32 { width: 390px; height: 380px; left: 32px; top: 147px; border-radius: 15px; background: linear-gradient(145deg,#304e76,#223a5e); }
.arduino.is-powered-off { filter: grayscale(.8); opacity: .63; }
.arduino.is-powered-off .board-led { background: #6d7378; box-shadow: none; }
.arduino.model-esp32::before { border-radius: 11px; }
.model-esp32 .arduino-pin-row { gap: 1px; }
.model-esp32 .arduino-pin-row .terminal { width: 11px; height: 11px; }
.model-esp32 .top-pins { left: 30px; }
.model-esp32 .bottom-pins { left: 115px; }
.model-esp32 .usb-port { left: 143px; }
.model-esp32 .power-jack { display: none; }
.model-esp32 .board-logo { top: 68px; left: 151px; }
.model-esp32 .chip { left: 151px; top: 190px; width: 88px; height: 70px; }
.model-esp32 .pin-group-label { color: #d7e3f4; }
.wireless-indicators { position: absolute; right: 24px; bottom: 20px; display: flex; gap: 6px; }
.wireless-indicators[hidden] { display: none; }
.wireless-indicators span { padding: 4px 6px; border: 1px solid #ffffff35; border-radius: 5px; background: #142a48a6; color: #d1d9e5; font-size: 7px; font-weight: 600; }
.wireless-indicators span.is-enabled { border-color: #8ee0bb88; background: #176e55; color: #ddfff0; box-shadow: 0 0 8px #58d5a255; }
.arduino::before { content: ""; position: absolute; inset: 8px; border: 1px solid #ffffff24; border-radius: 21px 21px 9px 9px; pointer-events: none; }
.usb-port { position: absolute; top: -12px; left: 90px; width: 104px; height: 25px; border-radius: 7px 7px 2px 2px; border: 3px solid #c6cbd0; background: linear-gradient(#747c84,#a5abb0); box-shadow: 0 2px 2px #164f47; }
.usb-port::after { content: ""; position: absolute; width: 55px; height: 7px; top: 6px; left: 21px; background: #545d65; border-radius: 2px; }
.power-jack { position: absolute; left: -14px; top: 42px; width: 53px; height: 54px; border-radius: 8px; background: #252c31; border: 3px solid #92999e; box-shadow: 0 2px 3px #06483d; }
.power-jack span { position: absolute; width: 24px; height: 24px; border-radius: 50%; top: 12px; left: 12px; background: radial-gradient(circle,#111 0 33%,#777 36% 48%,#171c20 51%); }
.board-logo { position: absolute; top: 68px; left: 110px; color: #d3eee7; text-align: center; opacity: .86; }
.board-logo b { display: block; font-size: 36px; line-height: 30px; font-family: sans-serif; }
.board-logo small { font-size: 7px; letter-spacing: 1.4px; }
.monitor-button { width: 108px; height: 75px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.monitor-button:hover { opacity: 1; }
.monitor-button:focus-visible { outline: 2px solid #d5fff1; outline-offset: 3px; border-radius: 6px; }
.monitor-button .monitor-screen { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); width: 39px; height: 22px; display: grid; place-items: center; border: 2px solid #c6d0cf; border-radius: 4px; background: linear-gradient(145deg,#28333a,#111b20); color: #75e2bd; font: 700 9px/1 monospace; box-shadow: 0 2px 3px #06483d; }
.monitor-button .monitor-screen::after { content: ""; position: absolute; width: 23px; height: 3px; bottom: -5px; left: 6px; border-radius: 0 0 2px 2px; background: #bac6c4; }
.monitor-button:hover .monitor-screen { color: #b2ffe2; box-shadow: 0 0 9px #70e9c288; }
.chip { position: absolute; left: 108px; top: 202px; width: 88px; height: 66px; background: #222b2e; border: 3px solid #aeb8b4; border-radius: 4px; display: grid; place-items: center; box-shadow: 0 2px 3px #084a3e; }
.chip::before, .chip::after { content: ""; position: absolute; height: 7px; width: 100%; left: 0; background: repeating-linear-gradient(90deg,#acb4b1 0 2px,transparent 2px 9px); }
.chip::before { top: -8px; }.chip::after { bottom: -8px; }
.chip span { font-size: 8px; line-height: 1.5; color: #aeb8b4; text-align: center; }
.arduino-pin-row { position: absolute; display: flex; gap: 3px; }
.top-pins { top: 19px; left: 43px; }
.bottom-pins { bottom: 19px; left: 39px; }
.pin-group-label { position: absolute; font-size: 6px; font-weight: 600; color: #d1e9e3; white-space: nowrap; letter-spacing: .2px; }
.top-pins .pin-group-label { top: 24px; }
.bottom-pins .pin-group-label { bottom: 24px; }
.terminal { position: relative; z-index: 6; flex: 0 0 auto; padding: 0; border-radius: 50%; border: 1px solid #252b32; background: radial-gradient(circle at 35% 33%,#161d22 0 28%,#41494f 38%,#11181d 70%); box-shadow: inset 0 1px 2px #0008, 0 0 0 1px #ffffff50; cursor: crosshair; }
.arduino .terminal { width: 13px; height: 13px; }
.arduino .board-pin::before { content: attr(data-pin-label); position: absolute; top: -10px; left: 50%; transform: translateX(-50%); color: #e2f0ec; font-size: 6px; font-weight: 600; line-height: 1; white-space: nowrap; text-shadow: 0 1px 2px #075d50; pointer-events: none; }
.bottom-pins .board-pin::before { top: auto; bottom: -10px; }
.arduino .board-pin.pin-high { background: radial-gradient(circle at 35% 33%,#fff5b4 0 25%,#ffbf3e 42%,#b86b16 76%); box-shadow: 0 0 0 2px #ffe08677, 0 0 9px #ffbd3e; }
.arduino .board-pin.pin-low { background: radial-gradient(circle at 35% 33%,#334049 0 28%,#202a30 52%,#11181d 75%); }
.terminal::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; top: 3px; left: 3px; background: #8b9395; opacity: .75; }
.terminal:hover, .terminal.selected { box-shadow: 0 0 0 3px #8298ff, inset 0 1px 2px #0008; }
.usb-label { position: absolute; bottom: 79px; right: 21px; color: #d3eee7; font-size: 8px; letter-spacing: 1px; }
.board-led { position: absolute; right: 25px; bottom: 104px; width: 6px; height: 6px; background: #e3aa42; border-radius: 50%; box-shadow: 0 0 6px #ffe092; }

.breadboard { left: 478px; top: 145px; width: 580px; height: 345px; border-radius: 9px; background: linear-gradient(145deg,#fff,#f8f9fa); border: 1px solid #e0e4e9; box-shadow: 0 5px 12px #20334b12,inset 0 1px 3px #fff; padding: 17px 19px; }
.breadboard::before { content: ""; position: absolute; inset: 7px; border: 1px solid #edf0f3; border-radius: 6px; pointer-events: none; }
.rail { height: 31px; position: relative; display: flex; align-items: center; gap: 10px; color: #ec7977; font-size: 12px; font-weight: 700; }
.rail-top { margin-bottom: 8px; }
.rail-bottom { margin-top: 8px; }
.rail span:last-child { color: #7ba4de; }
.rail-holes { flex: 1; display: grid; grid-template-columns: repeat(30,1fr); align-items: center; justify-items: center; gap: 4px; }
.rail-terminal { width: 6px; height: 6px; border: 0; background: #e3e7ea; border-radius: 50%; padding: 0; cursor: crosshair; z-index: 6; }
.rail-terminal:nth-child(5n+1) { margin-left: 4px; }
.terminal-area { display: flex; flex-direction: column; height: 211px; background: #f1f3f5; border-radius: 5px; padding: 10px 8px; position: relative; box-shadow: inset 0 1px 2px #dce1e6; }
.hole-bank { flex: 1; display: grid; grid-template-columns: repeat(30,1fr); grid-template-rows: repeat(5,1fr); justify-items: center; align-items: center; }
.breadboard .terminal { width: 6px; height: 6px; border: 0; box-shadow: inset 0 1px 2px #9099a277; background: #a9b1b8; }
.breadboard .terminal::after { display: none; }
.breadboard .terminal:hover, .breadboard .terminal.selected { box-shadow: 0 0 0 3px #8298ff; background: #526ee1; }
.center-gap { height: 25px; margin: 0 -8px; border-top: 1px solid #e3e6e9; border-bottom: 1px solid #e3e6e9; display: grid; place-items: center; }
.center-gap span { width: 96%; height: 1px; background: #fff; }
.canvas-caption { position: absolute; left: 64px; bottom: 31px; color: #bac1cb; font-size: 8px; letter-spacing: 1px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.caption-line { width: 18px; height: 1px; background: #aab4c3; }
.statusbar { height: 32px; flex: 0 0 32px; padding: 0 20px; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; color: #8c96a6; font-size: 9px; gap: 7px; }
.status-check { color: #49ae89; font-weight: 700; }
.status-shortcut { margin-left: auto; color: #a9b1bd; }

.part { position: absolute; z-index: 3; display: flex; align-items: center; justify-content: center; width: 130px; height: 72px; border: 1px solid transparent; border-radius: 8px; }
.part:hover { background: #fff; border-color: #e7ebf2; box-shadow: 0 3px 10px #25385d10; }
.part-name { position: absolute; top: 0; left: 0; max-width: 100%; color: #737e8f; font-size: 9px; white-space: nowrap; }
.part .terminal { position: absolute; width: 10px; height: 10px; }
.part .terminal-a { left: 15px; top: 42px; }
.part .terminal-b { right: 15px; top: 42px; }
.part-body { position: relative; display: grid; place-items: center; }
.led-body { width: 25px; height: 24px; background: linear-gradient(120deg,#ff9b8e,#e65455); border: 2px solid #d34b4c; border-radius: 15px 15px 7px 7px; box-shadow: inset -5px -2px #d94d4c,0 3px 7px #ed777333; }
.led-body::before { content: ""; position: absolute; width: 1px; height: 16px; bottom: -18px; left: 4px; background: #8c949d; box-shadow: 14px 0 #8c949d; }
.led-body::after { content: ""; position: absolute; top: 5px; left: 6px; width: 9px; height: 1px; background: #ffd1c9; transform: rotate(-26deg); }
.resistor-body { width: 42px; height: 14px; border: 1px solid #b99b6d; border-radius: 5px; background: linear-gradient(90deg,#dfc99e 0 19%,#a64c3c 19% 27%,#dfc99e 27% 48%,#333 48% 56%,#dfc99e 56% 77%,#c68b38 77% 86%,#dfc99e 86%); box-shadow: 0 2px 4px #60543a22; }
.resistor-body::before { content: ""; width: 74px; height: 1px; position: absolute; top: 6px; left: -17px; background: #9ca3aa; z-index: -1; }
.potentiometer-body { width: 30px; height: 27px; border: 2px solid #aa956d; border-radius: 5px; background: repeating-linear-gradient(90deg,#d9c18f 0 5px,#b89459 5px 7px); }
.potentiometer-body::before { content: "↗"; position: absolute; top: -15px; right: -13px; color: #718099; font-size: 17px; }
.part-potentiometer .terminal-a { left: 9px; top: 46px; }
.part-potentiometer .terminal-w { left: 60px; top: 46px; }
.part-potentiometer .terminal-b { right: 9px; top: 46px; }
.part-potentiometer input[type="range"] { position: absolute; left: 20px; bottom: 1px; width: 90px; height: 12px; accent-color: #5674df; }
.dc-body, .ac-body { width: 35px; height: 28px; border: 1px solid #aeb9ca; border-radius: 7px; background: linear-gradient(145deg,#fff,#edf2f8); color: #4e6d9d; font-size: 11px; font-weight: 700; }
.ac-body { border-color: #c9b9e2; color: #8b67bd; font-size: 23px; }
.button-body { width: 34px; height: 27px; border: 1px solid #8e9aab; border-radius: 6px; background: linear-gradient(#fff,#e3e8ef); color: #778396; font-size: 7px; font-weight: 700; letter-spacing: .5px; box-shadow: 0 3px 0 #aab4c2, 0 5px 7px #26334c18; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; }
.part-button.is-pressed .button-body { transform: translateY(3px); background: linear-gradient(#dbe4f3,#c6d2e5); box-shadow: 0 0 0 #aab4c2, 0 2px 4px #26334c18; color: #4a68b1; }
.button-body:focus-visible { outline: 2px solid #8298ff; outline-offset: 3px; }
.capacitor-body { width: 20px; height: 28px; border: 1px solid #b5c2d0; border-radius: 9px 9px 5px 5px; background: linear-gradient(90deg,#dbe6ef,#fff 44%,#d1dce8); color: #6d8197; font-size: 7px; font-weight: 700; box-shadow: 0 2px 4px #26334c1b; }
.part-capacitor .terminal-a { left: 15px; top: 42px; }
.part-capacitor .terminal-b { right: 15px; top: 42px; }
.delete-hint { position: absolute; z-index: 10; top: 14px; right: 14px; background: #fff7f7; border: 1px solid #f5d6d6; color: #c55d5d; font-size: 10px; padding: 7px 10px; border-radius: 6px; }
.confirm-dialog { border: 1px solid #e8ebf1; border-radius: 12px; padding: 26px; width: min(390px, calc(100% - 32px)); box-shadow: 0 16px 50px #26334c2b; color: var(--ink); }
.confirm-dialog::backdrop { background: #202b3d55; backdrop-filter: blur(2px); }
.dialog-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #4c68e4; background: #eff2ff; font-size: 20px; }
.confirm-dialog h2 { font-size: 16px; margin: 17px 0 8px; }
.confirm-dialog p { margin: 0; color: #8690a0; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.context-menu { position: fixed; z-index: 30; width: 142px; padding: 5px; border: 1px solid #e6e9ef; border-radius: 8px; background: #fff; box-shadow: 0 8px 24px #26334c26; }
.context-menu[hidden] { display: none; }
.context-menu button { width: 100%; height: 30px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: #536073; text-align: left; font: inherit; font-size: 11px; }
.context-menu button:hover, .context-menu button:focus-visible { outline: none; background: #f1f4fb; color: #405fca; }
.context-menu #context-delete { color: #bd5555; }
.context-menu #context-delete:hover, .context-menu #context-delete:focus-visible { background: #fff2f2; color: #a63e3e; }
.short-dialog { position: fixed; inset: 0; margin: auto; width: min(390px, calc(100% - 32px)); padding: 27px 28px 24px; overflow: hidden; border: 1px solid #efcdcd; border-radius: 16px; background: linear-gradient(160deg,#fff 15%,#fff8f5); color: var(--ink); text-align: center; box-shadow: 0 20px 70px #26334c45; }
.short-dialog::backdrop { background: #18223888; backdrop-filter: blur(4px); }
.short-illustration { position: relative; width: 82px; height: 76px; margin: 0 auto 8px; display: grid; place-items: center; }
.burst { width: 58px; height: 58px; display: grid; place-items: center; clip-path: polygon(50% 0%,61% 20%,82% 8%,82% 31%,100% 42%,82% 56%,92% 79%,67% 77%,54% 100%,42% 78%,18% 91%,21% 65%,0% 54%,20% 39%,9% 17%,35% 22%); background: linear-gradient(145deg,#ffda76,#ff8a62 67%,#ed5959); color: white; font-size: 24px; font-weight: 800; filter: drop-shadow(0 5px 5px #e75b4644); animation: short-pop .55s cubic-bezier(.2,.8,.2,1) both; }
.spark { position: absolute; color: #f2ad3f; font-size: 18px; animation: spark-pop .65s ease-out both; }
.spark-one { left: 2px; top: 6px; }
.spark-two { right: 3px; bottom: 4px; color: #ee7770; animation-delay: .08s; }
.short-eyebrow { margin: 0 0 5px; color: #c07852; font-size: 9px; font-weight: 700; letter-spacing: 1.4px; }
.short-dialog h2 { margin: 0 0 10px; color: #a94646; font-size: 20px; }
.short-message { margin: 0; color: #5f6876; font-size: 12px; line-height: 1.8; }
.short-disclaimer { margin: 13px 0 17px; color: #99918d; font-size: 9px; line-height: 1.7; }
.short-dismiss { min-width: 130px; background: #c95959; box-shadow: 0 2px 6px #c9595930; }
.short-dismiss:hover { background: #b84d4d; }
@keyframes short-pop { 0% { transform: scale(.25) rotate(-18deg); opacity: 0; } 70% { transform: scale(1.13) rotate(5deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes spark-pop { 0% { transform: scale(.3); opacity: 0; } 55% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: .8; } }
.studio-open { overflow: hidden; }
.code-studio { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; min-width: 360px; min-height: 320px; background: #1e1e1e; color: #d4d4d4; font-family: "DM Sans", "Noto Sans JP", sans-serif; }
.code-studio[hidden] { display: none; }
.studio-topbar { height: 48px; flex: 0 0 48px; display: flex; align-items: center; gap: 20px; padding: 0 16px; background: #252526; border-bottom: 1px solid #181818; }
.studio-brand { display: flex; align-items: center; gap: 8px; color: #e4e4e4; font-size: 12px; font-weight: 600; }
.studio-brand-mark { color: #71b7ff; font-size: 18px; }
.studio-slash { color: #727272; font-weight: 400; }
.studio-board-picker { display: flex; align-items: center; gap: 8px; margin-left: auto; color: #aaa; font-size: 11px; }
.studio-board-picker select { height: 29px; padding: 0 27px 0 9px; border: 1px solid #484848; border-radius: 4px; background: #333; color: #ddd; font: inherit; font-size: 11px; }
.studio-close { width: 30px; height: 30px; border: 0; border-radius: 4px; background: transparent; color: #bbb; font-size: 22px; }
.studio-close:hover { background: #3a3a3a; color: #fff; }
.studio-workspace { display: grid; flex: 1; min-height: 0; grid-template-columns: 48px 205px minmax(0,1fr); }
.studio-activitybar { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 15px 0; background: #333333; color: #a4a4a4; }
.activity-icon { width: 100%; padding: 2px 0; border-left: 2px solid transparent; text-align: center; font-size: 19px; }
.activity-icon.is-active { border-left-color: #fff; color: #fff; }
.activity-bottom { margin-top: auto; font-size: 14px; }
.studio-explorer { padding: 14px 0; background: #252526; border-right: 1px solid #181818; color: #ccc; font-size: 10px; }
.studio-explorer > p { margin: 0 14px 16px; font-size: 10px; font-weight: 700; }
.explorer-section { padding: 5px 10px; color: #bbb; font-size: 9px; font-weight: 700; }
.explorer-file { width: 100%; height: 26px; padding: 0 12px 0 27px; border: 0; background: transparent; color: #ddd; text-align: left; font: inherit; font-size: 10px; }
.explorer-file.is-active { background: #37373d; }
.explorer-file span, .studio-tab span { color: #e6c46a; margin-right: 7px; }
.explorer-note { margin: 16px 12px; color: #858585; font-size: 9px; line-height: 1.7; }
.studio-editor-panel { display: grid; min-width: 0; min-height: 0; grid-template-rows: 36px 29px minmax(160px,1fr) minmax(130px,32%); background: #1e1e1e; }
.studio-tabs { display: flex; align-items: stretch; background: #252526; }
.studio-tab { min-width: 138px; display: flex; align-items: center; padding: 0 10px; border-top: 1px solid #3794ff; background: #1e1e1e; color: #e0e0e0; font-size: 10px; }
.studio-tab button { margin-left: auto; border: 0; background: transparent; color: #aaa; font-size: 15px; }
.studio-breadcrumb { display: flex; align-items: center; gap: 9px; padding: 0 17px; color: #b8b8b8; font-size: 9px; }
.studio-breadcrumb span { color: #777; }
.editor-wrap { display: flex; min-height: 0; overflow: hidden; padding: 5px 0; background: #1e1e1e; }
.line-numbers, #code-editor { margin: 0; border: 0; outline: 0; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; font-weight: 400; line-height: 21px; tab-size: 2; }
.line-numbers { width: 49px; flex: 0 0 49px; overflow: hidden; padding: 0 12px 0 0; color: #858585; text-align: right; user-select: none; }
#code-editor { width: 100%; height: 100%; resize: none; overflow: auto; padding: 0 14px; background: transparent; color: #d4d4d4; caret-color: #fff; white-space: pre; }
#code-editor::selection { background: #264f78; }
.studio-console { min-height: 0; border-top: 1px solid #3b3b3b; background: #181818; }
.console-heading { height: 34px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid #303030; color: #ccc; font-size: 10px; }
.console-heading button { margin-left: auto; border: 0; background: transparent; color: #999; font: inherit; font-size: 9px; }
.console-heading button:hover { color: #fff; }
#console-output { height: calc(100% - 34px); overflow: auto; margin: 0; padding: 10px 14px; color: #b8c5b8; font: 11px/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace; white-space: pre-wrap; }
.studio-statusbar { height: 31px; flex: 0 0 31px; display: flex; align-items: center; gap: 14px; padding: 0 10px; background: #2471a8; color: #fff; font-size: 9px; }
.studio-statusbar > span:first-child { display: flex; align-items: center; gap: 6px; }
.studio-statusbar > span:first-child i { width: 7px; height: 7px; border-radius: 50%; background: #b9d8ec; }
.studio-status-spacer { flex: 1; }
.studio-statusbar button { height: 23px; padding: 0 9px; border: 1px solid #ffffff50; border-radius: 4px; background: #ffffff16; color: #fff; font: inherit; font-size: 9px; cursor: pointer; }
.studio-statusbar button:hover:not(:disabled) { background: #ffffff30; }
.studio-statusbar button:disabled { opacity: .48; cursor: default; }
.studio-statusbar .run-sketch { border-color: #b9e8ca; background: #27794e; }
.studio-statusbar .run-sketch:hover:not(:disabled) { background: #328d5c; }
@media (max-width: 680px) {
  .studio-workspace { grid-template-columns: 40px minmax(0,1fr); }
  .studio-explorer { display: none; }
  .studio-topbar { gap: 8px; padding: 0 9px; }
  .studio-brand { font-size: 10px; }
  .studio-board-picker { gap: 4px; font-size: 9px; }
  .studio-board-picker select { max-width: 120px; }
  .line-numbers { width: 37px; flex-basis: 37px; padding-right: 8px; }
  .line-numbers, #code-editor { font-size: 11px; }
  .studio-statusbar { gap: 8px; padding: 0 6px; font-size: 8px; }
}
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 245px minmax(0,1fr); }
  .sidebar { padding-left: 16px; padding-right: 16px; }
  .topbar { padding: 0 18px; }
}
@media (max-width: 760px) {
  body { min-width: 360px; }
  .topbar { height: 58px; padding: 0 12px; gap: 10px; }
  .brand { font-size: 17px; }
  .project-name { display: none; }
  .top-actions { gap: 5px; }
  .top-actions .button { padding: 0 8px; font-size: 10px; }
  .app-shell { display: flex; flex-direction: column; min-height: calc(100vh - 58px); }
  .sidebar { min-height: auto; max-height: none; padding: 16px 15px; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .sidebar-heading { grid-column: 1/-1; margin: 0; }
  .tool-section { margin: 0; padding: 0; border: 0; }
  .wire-section { grid-column: 1/-1; }
  .tip-card, .sidebar-bottom { display: none; }
  .editor { min-height: 520px; }
  .canvas-scroll { padding: 12px; }
  .editor-toolbar { padding: 0 13px; }
  .toolbar-right { gap: 7px; }
  .model-picker { gap: 4px; font-size: 0; }
  .model-picker select { min-width: 78px; }
  .power-toggle { gap: 4px; padding: 0 6px; font-size: 0; }
  .power-toggle .power-indicator { width: 8px; height: 8px; }
  .statusbar { padding: 0 13px; }
}
