/* Pi 5 Workshop — components that the Flipper/ESP32 sheets don't have. */
:root { --pi: #c51a4a; --pi-d: #a8143d; --pi-t: #fbe9ef; --leaf: #3d9a52; --ink: #1e1c22; --paper: #f6f4f5; --line-2: #e2dbdf; }

/* ------------------------------------------------------------------ loading screen board */
.pil-board .pil-pcb { fill: #2a7a48; stroke: #1d5c35; stroke-width: 2; }
.pil-board .pil-holes circle { fill: #e9d9a6; stroke: #c9b27a; stroke-width: 2; }
.pil-board .pil-header rect { fill: #d9b45a; }
.pil-board .pil-soc { fill: #c9cdd2; stroke: #9aa0a6; stroke-width: 2; }
.pil-board .pil-chip { fill: #232327; }
.pil-board .pil-txt { font: 700 11px/1 "JetBrains Mono", monospace; fill: #3b3841; letter-spacing: .04em; }
.pil-board .pil-txt.sm { fill: #d9d3ca; font-size: 10px; }
.pil-board .pil-port { fill: #c5c9ce; stroke: #8e949b; stroke-width: 1.5; }
.pil-board .pil-port.blue { fill: #2b63c9; stroke: #1d4791; }
.pil-board .pil-bar { fill: #1d5c35; }
.pil-board .pil-fill { fill: #7dff9c; transform-box: fill-box; transform-origin: left center; transform: scaleX(var(--p, .04)); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.pil-board .pil-led { fill: #39ff6a; animation: pil-blink 1.1s steps(2, end) infinite; }
@keyframes pil-blink { 50% { fill: #165a28; } }
@media (prefers-reduced-motion: reduce) { .pil-board .pil-led { animation: none; } }
.fzl-brand span { color: #ff7aa2 !important; }

/* ------------------------------------------------------------------ live GPIO header panel (stage, bottom-left) */
.pi-header { position: absolute; left: 18px; bottom: 18px; z-index: 3; width: 300px; padding: 10px 12px 10px; background: #fffefecc; backdrop-filter: blur(8px);
  border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 10px 28px #1e1c2214; }
.pi-header header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.pi-header header b { font: 700 12px/1 var(--cond); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.pi-header header small { font-size: 10.5px; color: var(--faint, #8a857f); }
.pih-grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.pih-pin { position: relative; aspect-ratio: 1; border-radius: 3px; background: #ece8ea; border: 1px solid #d6cfd3; cursor: help; padding: 0; transition: background .12s, box-shadow .12s; }
.pih-pin.k-3v3 { background: #f6d9a3; border-color: #e3b45d; } .pih-pin.k-5v { background: #f3b3ad; border-color: #d8706a; }
.pih-pin.k-gnd { background: #4a4750; border-color: #2b2830; } .pih-pin.k-id { background: #d9d6dc; }
.pih-pin.used { box-shadow: 0 0 0 1.5px var(--pi); }
.pih-pin.is-out { background: #fff; } .pih-pin.is-high { background: #ff3b3b; border-color: #c41f1f; box-shadow: 0 0 6px #ff3b3b99, 0 0 0 1.5px var(--pi); }
.pih-pin.is-in { background: #e4f0ff; border-color: #7aa6e0; } .pih-pin.is-in.is-high { background: #4f8ef0; border-color: #2a62c0; box-shadow: 0 0 6px #4f8ef099, 0 0 0 1.5px var(--pi); }
.pih-pin.is-pwm { background: linear-gradient(to top, #b44cf0 calc(var(--d, 0) * 100%), #f3e6fb 0); border-color: #8a35bd; }
.pih-pin.pin1 { border-radius: 1px; }
.pih-row-label { display: flex; justify-content: space-between; font: 500 9.5px/1 var(--mono); color: #8a857f; margin: 4px 1px 0; }
.pih-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; font-size: 10.5px; color: #67625d; }
.pih-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; border: 1px solid #0002; }
.pih-tip { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); padding: 6px 9px; border-radius: 9px; background: var(--ink); color: #fff; font: 500 12px/1.35 var(--sans); opacity: 0; transform: translateY(4px); pointer-events: none; transition: .15s; }
.pih-tip.is-on { opacity: 1; transform: none; }
.pih-tip b { color: #ff9ab6; font-family: var(--mono); font-weight: 500; }
html.compact .pi-header { display: none; }

/* ------------------------------------------------------------------ editable code */
.code-wrap { position: relative; }
.code-edit { position: absolute; inset: 0 0 auto 0; width: 100%; box-sizing: border-box; resize: none; border: 0; outline: 0; margin: 0;
  background: #19171c; color: #f3edf0; caret-color: #ff7aa2; font: 400 12.5px/1.62 var(--mono); padding: 10px 12px 10px 46px; tab-size: 4; white-space: pre; overflow: auto; z-index: 2; }
.code-card.is-editing .code { visibility: hidden; }
.code-card.is-editing .btn-edit { background: var(--pi); color: #fff; }
.code-card .btn-edit[aria-pressed=true] svg, .code-card.is-editing .btn-edit svg { stroke: #fff; }
.code .line .cm { color: #8f8a92; font-style: italic; }
.code .line .kw { color: #ff7aa2; } .code .line .fn { color: #ffd1de; } .code .line .num { color: #f6b26b; } .code .line .str { color: #a9dc8e; }
.code .line .bi { color: #8fc7ff; } .code .line .dec { color: #c3adfa; }
.console-line.cmd .cl-m { color: #7dd3a0; } .console-line.out .cl-m { color: #f1ece5; } .console-line.err .cl-m { color: #ff8b8b; white-space: pre-wrap; }
.console-line .cl-m { white-space: pre-wrap; }

/* ------------------------------------------------------------------ lab */
.pi-goal { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--pi-t); border: 1px solid #f0c5d2; margin: 0 0 10px; }
.pi-goal .gi { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--pi); display: grid; place-items: center; color: #fff; font-size: 13px; }
.pi-goal.is-done { background: #eaf6ec; border-color: #b8e0c1; } .pi-goal.is-done .gi { background: var(--leaf); border-color: var(--leaf); }
.pi-goal p { margin: 0; font-size: 13.5px; } .pi-goal small { display: block; color: #67625d; font-size: 12px; margin-top: 2px; }
.pi-ctls { display: grid; gap: 8px; }
.pi-ctl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line-2); }
.pi-ctl > span { font-size: 13px; font-weight: 600; color: var(--ink); } .pi-ctl > span small { display: block; font-weight: 500; color: #8a857f; font-size: 11px; }
.pi-ctl output { font: 500 12px/1 var(--mono); color: var(--pi-d); min-width: 64px; text-align: right; }
.pi-ctl input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--pi); }
.pi-ctl .pi-btn, .pi-btn { border: 1px solid #e3b7c4; background: #fff; color: var(--pi-d); font: 600 13px/1 var(--sans); padding: 8px 12px; border-radius: 9px; cursor: pointer; min-height: 34px; user-select: none; touch-action: none; }
.pi-btn:hover { background: var(--pi-t); } .pi-btn.is-down, .pi-btn[aria-pressed=true] { background: var(--pi); color: #fff; border-color: var(--pi); }
.pi-btn-row { display: flex; gap: 6px; }
.pi-readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin: 10px 0 0; }
.pi-readouts div { background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 9px; }
.pi-readouts dt { font-size: 11px; color: #8a857f; } .pi-readouts dd { margin: 2px 0 0; font: 600 13px/1.2 var(--mono); color: var(--ink); }
.pi-net { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.pi-net header { display: flex; gap: 6px; align-items: center; padding: 7px 8px; background: #f3eff1; border-bottom: 1px solid var(--line-2); }
.pi-net header input { flex: 1; min-width: 0; font: 500 12px/1 var(--mono); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; color: var(--ink); }
.pi-net iframe { display: block; width: 100%; height: 170px; border: 0; background: #fff; }
.pi-net .pi-net-off { padding: 18px 12px; font-size: 13px; color: #8a857f; text-align: center; }
.pi-net-log { max-height: 150px; overflow: auto; font: 500 11.5px/1.5 var(--mono); padding: 6px 9px; background: #19171c; color: #e9e3e6; }
.pi-net-log div.in { color: #9fd8ff; } .pi-net-log div.out { color: #ffc6d6; }
.pi-env { display: grid; gap: 6px; } .pi-env label { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: center; font: 500 12px/1 var(--mono); }
.pi-env input { font: 500 12px/1 var(--mono); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 7px; }
.pi-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.pi-photos figure { margin: 0; } .pi-photos img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--line-2); }
.pi-photos figcaption { font: 500 11px/1.4 var(--mono); color: #67625d; }
.pi-screen { width: 100%; image-rendering: pixelated; border-radius: 8px; background: #000; display: block; margin-top: 8px; }

/* ------------------------------------------------------------------ wiring tab */
.pi-wire-table td:first-child { white-space: nowrap; }
.pi-wire-table .sw { display: inline-block; width: 18px; height: 6px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.pi-pinref { font: 500 12px/1 var(--mono); color: var(--pi-d); }
.pi-schem { width: 100%; height: auto; display: block; margin: 6px 0 10px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; }
.pi-schem text { font-family: var(--sans); }
.pi-safety { font-size: 12.5px; color: #7d0e2e; background: #fdf0f4; border: 1px solid #f0c5d2; border-radius: 10px; padding: 8px 10px; }

/* step-by-step build list in the Wiring tab */
.pi-steps { margin: 12px 0 14px; border: 1px solid var(--line, #e3dde0); border-radius: 12px; background: #fff; padding: 8px 12px; }
.pi-steps summary { cursor: pointer; font-weight: 700; color: var(--navy, #2b2730); padding: 4px 0; }
.pi-steps ol { margin: 6px 0 4px; padding-left: 22px; display: grid; gap: 4px; }
.pi-step { font-size: 13.5px; line-height: 1.35; }
.pi-step label { display: inline-flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.pi-step input { margin-top: 2px; accent-color: #c51a4a; }
.pi-step input:checked + span { color: #8b8690; text-decoration: line-through; }
.pi-step .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px #0002; }
.pi-step a { font-size: 12px; margin-left: 4px; }
.pi-step-note { font-size: 12px; color: #7a747c; margin: 4px 0 2px; }

/* schematic card: ESP32-style drawing, readable size, scrolls when the circuit is tall */
/* the card's height follows its drawing (no fixed height, no empty space); very tall circuits scroll.
   Once the student drags the resize grip, data-user-sized keeps their exact size. */
.schematic-card:not(.is-inline) { width: 360px; height: auto !important; max-height: 75%; }
html.compact .schematic-card:not(.is-inline) { width: 300px; }
.schematic-card:not(.is-inline):not([data-user-sized]) .sch-view { flex: 0 1 auto; min-height: 0; }
.schematic-card[data-user-sized]:not(.is-inline) { height: var(--user-h, 330px) !important; max-height: none; }
.sch-view { overflow-y: auto !important; overflow-x: hidden; }
.sch-view svg { height: auto !important; background: transparent; }
.pi-schem { max-width: 560px; }
