@font-face { font-family: 'Open Sans'; src: url('/fonts/OpenSans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
:root { color-scheme: light; --ink: #173e38; --teal: #176454; --paper: #faf8ef; --muted: #526b60; --line: #d9e0d4; --yellow: #ffdc69; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Open Sans', system-ui, sans-serif; line-height: 1.55; }
button, select { font: inherit; color: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select, summary, .part-body, .port, .wire { touch-action: manipulation; }
button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px; background: #fffdf7; cursor: pointer; font-size: 13px; font-weight: 700; }
button:hover { background: #e8f1e7; border-color: #8ba896; }
button:disabled { opacity: .42; cursor: default; }
button[aria-pressed="true"], .primary { background: var(--ink); color: #fffdf7; border-color: var(--ink); }
:focus-visible { outline: 3px solid #b36500; outline-offset: 4px; }
[hidden] { display: none !important; }
a { color: var(--ink); }
.skip-link { position: absolute; left: 12px; top: -90px; background: white; padding: 12px; z-index: 10; }
.skip-link:focus { top: 8px; }
.site-header { min-height: 72px; padding: 12px max(24px, calc((100vw - 1352px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.home-link { text-decoration: none; font-weight: 700; font-size: 14px; }
.header-note { font-size: 12px; color: var(--muted); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
main { max-width: 1400px; margin: auto; padding: 0 24px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 0 26px; }
.eyebrow { font-size: 10px; letter-spacing: 2px; font-weight: 700; margin: 0 0 8px; color: var(--teal); }
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -2px; line-height: 1.1; margin: 0; }
h1 span { color: #ac6800; font-size: 35px; padding-left: 8px; }
.intro > p { margin: 0; font-size: 16px; font-weight: 700; }
.intro > p span { font-size: 13px; font-weight: 400; color: var(--muted); }
.lab { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.tray { border: 1px solid var(--line); background: #fffdf6; border-radius: 18px; overflow: hidden; }
.challenge { padding: 20px; background: #eef0dc; border-bottom: 1px solid var(--line); }
.challenge label { display: block; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.challenge-picker { display: flex; gap: 6px; }
.challenge-picker select { width: 100%; min-width: 0; min-height: 44px; font-size: 12px; border: 1px solid #adbca5; border-radius: 8px; background: #fffdf6; padding: 8px; }
.challenge-picker button { background: var(--ink); color: white; }
#lesson-text { font-size: 13px; margin: 15px 0 10px; }
.challenge-tip { font-size: 12px; border-left: 3px solid #a77800; padding-left: 10px; color: #465634; margin: 10px 0 0; }
.parts-section { padding: 20px; }
.parts-section { border: 0; margin: 0; }
.parts-section summary { font-size: 20px; letter-spacing: -.5px; min-height: 44px; margin: 0 0 16px; }
.parts-section:not([open]) summary { margin-bottom: 0; }
.parts-section summary .small { display: block; font-weight: 400; letter-spacing: 0; margin: 5px 0 0; }
h2 { font-size: 20px; letter-spacing: -.5px; margin: 0 0 8px; }
.small { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.parts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.part-button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 10px; min-height: 73px; font-size: 12px; }
.part-icon { display: block; width: 44px; height: 25px; color: var(--teal); overflow: visible; }
.part-button[data-type="led"] .part-icon { color: #986600; }
.part-button[data-type="resistor"] .part-icon { color: #805135; }
.part-button[aria-pressed="true"] .part-icon { color: var(--yellow); }
.tray-footer { display: flex; gap: 8px; align-items: start; border-top: 1px solid var(--line); padding: 14px 20px; color: var(--muted); font-size: 10px; }
.tiny-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); margin-top: 5px; flex-shrink: 0; }
.workspace { min-width: 0; border: 1px solid #c9d4c8; border-radius: 18px; overflow: hidden; background: #fffdf6; box-shadow: 0 8px 28px #173e3808; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.toolbar button { font-size: 18px; padding: 7px 11px; }
.toolbar button span { font-size: 12px; vertical-align: middle; }
.tool-divider { width: 1px; height: 24px; background: var(--line); margin: 0 3px; }
.board-guide { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 12px; min-height: 46px; gap: 8px; }
.board-guide button { min-height: 44px; font-size: 12px; padding: 8px 12px; }
.board-scroll { overflow: auto; background: #164e47; scrollbar-color: #86a396 #164e47; }
#board { display: block; width: 100%; min-width: 720px; height: auto; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#board:focus-visible { outline-offset: -4px; outline-color: var(--yellow); }
.part-body { cursor: pointer; }
.is-pushbutton { touch-action: none; }
.motor-rotor { transform-box: fill-box; transform-origin: center; }
@keyframes spin-motor { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) { .motor-rotor.is-on { animation: spin-motor 1s linear infinite; } }
.part-card { fill: #fff8e6; stroke: #d4dfc9; stroke-width: 2; filter: drop-shadow(0 5px 3px #092d2b60); }
.selected .part-card { stroke: #ffdc69; stroke-width: 4; }
.part-body:focus-visible { outline: none; }
.part-body:focus-visible .part-card { stroke: #fff; stroke-width: 5; }
.part-name { fill: #173e38; font-size: 15px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.part-state { fill: #526356; font-size: 11px; text-anchor: middle; font-weight: 700; pointer-events: none; }
.symbol { stroke: #245849; stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.symbol-text { fill: #245849; font-size: 21px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.port { cursor: crosshair; }
.port .port-target { fill: transparent; }
.port .port-dot { fill: #fff8e6; stroke: #86bcb0; stroke-width: 3; }
.port.is-on .port-dot { fill: #ffdc69; stroke: #ffdc69; }
.port.is-pending .port-dot, .port:hover .port-dot { stroke: #fff; stroke-width: 5; }
.port:focus-visible { outline: none; }
.port:focus-visible .port-dot { stroke: #fff; stroke-width: 6; }
.port-label { fill: #d3e8dc; font-size: 10px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.wire { cursor: pointer; }
.wire-line { fill: none; stroke: #9bb5ad; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.wire.is-on .wire-line { stroke: #ffdc69; stroke-width: 5; }
.wire-hit { fill: none; stroke: transparent; stroke-width: 24; }
.wire:hover .wire-line, .wire:focus-visible .wire-line { stroke: #fff; }
.wire:focus-visible { outline: none; }
#placement-cursor rect { fill: #ffdc6920; stroke: #ffdc69; stroke-width: 3; stroke-dasharray: 6 6; }
#placement-cursor path { stroke: #ffdc69; stroke-width: 3; }
#empty-label { fill: #d2e6dc; font-size: 18px; }
.board-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 10px; color: var(--muted); flex-wrap: wrap; }
.legend { display: flex; gap: 14px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 15px; height: 4px; border-radius: 2px; background: #7b9187; }
.legend i.live-line { background: #d69b00; }
.scroll-tip { display: none; }
.feedback { padding: 13px 16px 0; font-size: 14px; font-weight: 700; min-height: 38px; }
.feedback.error { color: #9e391e; }
.inspector { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 16px 14px; }
.inspector p { color: var(--muted); font-size: 12px; margin: 0; }
.inspector button { white-space: nowrap; min-height: 44px; font-size: 12px; }
.board-actions { display: flex; gap: 8px; padding: 12px 14px; background: #f0f2e8; border-top: 1px solid var(--line); flex-wrap: wrap; }
.board-actions span { flex: 1; }
.board-actions button { font-size: 11px; }
.learn { padding: 40px 0 28px; }
.learn > h2 { font-size: 27px; margin-bottom: 20px; }
.learn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.learn h3 { font-size: 16px; margin: 0 0 8px; }
.learn p { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
details { border-block: 1px solid var(--line); margin: 20px 0 16px; padding: 16px 0 4px; }
summary { cursor: pointer; min-height: 44px; font-weight: 700; font-size: 13px; }
.keyboard-help { font-size: 11px !important; }
.site-footer { border-top: 1px solid var(--line); max-width: 1352px; margin: auto; padding: 20px 24px; display: flex; justify-content: space-between; gap: 20px; font-size: 11px; color: var(--muted); }
.site-footer a { font-weight: 700; text-decoration: none; }
.notice { background: #eef0dc; border-radius: 10px; padding: 14px; font-size: 13px; }
dialog { width: min(540px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--paper); max-height: 90vh; max-height: 90dvh; overflow: auto; }
dialog::backdrop { background: #092d2bcc; }
dialog h2 { font-size: 27px; }
dialog li { padding-left: 3px; margin-bottom: 13px; font-size: 14px; }
dialog ol { padding-left: 20px; }
dialog p { font-size: 12px; }
.dialog-close { float: right; font-size: 24px; width: 44px; padding: 0; }
@media (min-width: 1000px) { .board-scroll { max-height: 590px; } }
@media (min-width: 1001px) and (max-width: 1200px) {
  .lab { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
  .challenge, .parts-section { padding: 14px; }
}
@media (max-width: 1000px) {
  .lab { grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
  .challenge, .parts-section { padding: 16px; }
  .header-note { display: none; }
  .intro > p { font-size: 14px; }
  .intro > p span { font-size: 11px; }
  .scroll-tip { display: inline; }
}
@media (max-width: 1000px) {
  main { padding: 0 14px; }
  .site-header { min-height: 62px; padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .site-header button { font-size: 11px; }
  .intro { align-items: start; flex-direction: column; padding: 18px 0; gap: 10px; }
  .intro > p { font-size: 12px; }
  .intro > p br { display: none; }
  .intro > p span { display: block; font-size: 11px; }
  .lab { grid-template-columns: 1fr; }
  .tray { display: grid; grid-template-columns: 1fr; }
  .challenge { padding: 14px 16px; }
  .challenge .eyebrow { display: none; }
  .challenge label { font-size: 13px; margin-bottom: 6px; }
  .challenge-picker select { font-size: 16px; }
  #lesson-text { margin: 9px 0 5px; font-size: 12px; }
  .challenge-tip { font-size: 11px; }
  .parts-section { padding: 12px 16px; }
  .parts-section summary { font-size: 15px; margin-bottom: 0; }
  .parts-section summary .small { display: inline; margin-left: 8px; font-size: 10px; }
  .parts-grid { margin-top: 10px; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .part-button { min-height: 54px; align-items: center; padding: 6px; gap: 0; font-size: 10px; }
  .part-icon { font-size: 19px; height: 22px; }
  .tray-footer { padding: 7px 16px; }
  .toolbar { padding: 8px; gap: 4px; }
  .toolbar button { flex: 1; padding: 6px; min-width: 44px; }
  .toolbar button span { font-size: 10px; display: block; }
  .tool-divider { margin: 0; }
  .board-guide { padding-inline: 12px; font-size: 11px; }
  .board-footer { padding: 8px 12px; font-size: 9px; }
  .feedback { font-size: 13px; }
  .inspector { flex-wrap: wrap; gap: 8px; }
  .inspector p { font-size: 11px; }
  .learn { padding-top: 30px; }
  .learn-grid { grid-template-columns: 1fr; gap: 8px; }
  .site-footer { flex-direction: column; gap: 6px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .intro { flex-direction: row; align-items: center; }
  .parts-grid { grid-template-columns: repeat(5, 1fr); }
  .part-button { min-height: 64px; font-size: 12px; }
  .toolbar button span { display: inline; font-size: 12px; }
  .learn-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (prefers-reduced-motion: no-preference) { .part-button { transition: background .12s; } }
