/* Flipper Zero Workshop — Flipper palette + components on top of the ESP32 Workshop layout (esp32.itgg.space). */
:root {
  --fz-orange: #ff8200; --fz-orange-2: #ff9a2e; --fz-orange-d: #e06f00; --fz-orange-dd: #b85800; --fz-orange-t: #fff1e2;
  --fz-ink: #1b1b1d; --fz-ink-2: #2a2a2d; --fz-ink-3: #3a3a3e; --fz-paper: #f6f3ef; --fz-paper-2: #ece7e1; --fz-white: #fffefb;
  --accent: var(--fz-orange-d); --accent-deep: var(--fz-orange-dd); --accent-soft: var(--fz-orange-t); --green: var(--fz-orange);
  --navy: var(--fz-ink); --navy-2: var(--fz-ink-2);
  --kw: #ff9a2e; --fn: #ffd29a; --num: #f4c06a; --str: #a9dc8e; --gutter: #6d6862;
}
body { background: var(--fz-paper); }
#board-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tags .tag { transition: opacity .2s, border-color .15s; }
.tags.is-off .tag { opacity: 0 !important; pointer-events: none !important; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.leaders .hotspot { pointer-events: all; cursor: pointer; }
.workshop-stage-badge { display: none; }
:focus-visible { outline-color: var(--fz-orange); }

/* ===================================================================== loading screen */
.loader.fz-loader { background: radial-gradient(120% 90% at 50% 30%, #2a2a2d 0, #1b1b1d 55%, #121213 100%); color: #f3efe9; z-index: 1000; }
.loader.fz-loader::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#ffffff14 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0, transparent 70%); mask-image: radial-gradient(circle at 50% 40%, #000 0, transparent 70%); }
.fzl-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 16px; width: min(100%, 460px); }
.fzl-device { width: min(100%, 360px); height: auto; filter: drop-shadow(0 22px 34px #0009); animation: fzl-float 3.2s ease-in-out infinite; }
.fzl-body { fill: #f4f1ec; stroke: #d8d2c8; stroke-width: 1.5; }
.fzl-bezel { fill: #1b1b1d; }
.fzl-lcd { fill: var(--fz-orange); }
.fzl-txt { font: 700 15px/1 "JetBrains Mono", ui-monospace, monospace; fill: #1b1b1d; letter-spacing: .12em; }
.fzl-sub { font-size: 9.5px; font-weight: 500; letter-spacing: .14em; }
.fzl-bar { fill: none; stroke: #1b1b1d; stroke-width: 1.6; }
.fzl-fill { fill: #1b1b1d; transform-box: fill-box; transform-origin: left center; transform: scaleX(var(--p, .04)); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.fzl-dpad { fill: var(--fz-orange); stroke: #e06f00; stroke-width: 2; animation: fzl-pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fzl-ok { fill: #fff6ec; stroke: #e06f00; stroke-width: 1.5; }
.fzl-back { fill: #1b1b1d; }
.fzl-brand { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.fzl-brand .fz-logo { width: 46px; height: 46px; }
.fzl-brand b { display: block; font: 700 24px/1 var(--cond); letter-spacing: .02em; color: #fff; }
.fzl-brand span { display: block; margin-top: 3px; font: 600 12px/1 var(--cond); letter-spacing: .32em; text-transform: uppercase; color: var(--fz-orange); }
.fz-loader .loader-step { margin: 18px 0 10px; font: 500 12.5px/1.4 var(--mono); color: #b9b3aa; letter-spacing: 0; text-transform: none; white-space: normal; text-align: center; }
.fz-loader .loader-track { width: min(100%, 300px); height: 4px; margin: 0; background: #ffffff1a; border-radius: 4px; overflow: hidden; }
.fz-loader .loader-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--fz-orange-d), var(--fz-orange-2)); transform-origin: left; transform: scaleX(var(--p, .04)); transition: transform .35s; }
.fzl-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 22px 0 0; }
.fzl-chips li { font: 600 11.5px/1 var(--cond); letter-spacing: .06em; text-transform: uppercase; color: #d9d3ca; border: 1px solid #ffffff22; border-radius: 999px; padding: 6px 10px; }
.fz-loader.is-failed .loader-step { color: #ffb0a0; font-family: var(--sans); font-size: 14px; }
@keyframes fzl-float { 50% { transform: translateY(-6px); } }
@keyframes fzl-pulse { 50% { transform: scale(.94); fill: #ff9a2e; } }
@media (prefers-reduced-motion: reduce) { .fzl-device, .fzl-dpad { animation: none; } }

/* ===================================================================== brand / wordmark */
.workshop-wordmark { display: flex; align-items: center; gap: 11px; min-width: 0; }
.workshop-wordmark .fz-logo { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 8px #ff820040); }
.fz-wordmark { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.fz-wordmark strong { font: 700 22px/1 var(--cond); color: var(--fz-ink); letter-spacing: .01em; white-space: nowrap; }
.fz-wordmark em { font: 600 11.5px/1 var(--cond); font-style: normal; letter-spacing: .34em; text-transform: uppercase; color: var(--fz-orange-d); margin-top: 4px; }
.brand .fz-wordmark strong { color: #fffefb; }
.brand .fz-wordmark em { color: var(--fz-orange-2); }
.sidebar-chip { background: var(--fz-orange) !important; color: #fff !important; }
.side-nav li.is-active a { color: var(--fz-orange-d); }

/* ===================================================================== mode bar + module picker */
.fz-modes { position: absolute; top: 16px; right: 16px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px;
  border: 1px solid var(--line); background: #fffefbf0; border-radius: 12px; box-shadow: var(--shadow); font-family: var(--sans); backdrop-filter: blur(6px); }
.fz-modes > button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 30px; }
.fz-modes > button:hover { color: var(--fz-ink); background: var(--fz-paper-2); }
.fz-modes > button.is-on { background: var(--fz-ink); color: #fff; box-shadow: inset 0 -2px 0 var(--fz-orange); }
.fz-explode { display: flex; align-items: center; gap: 6px; padding: 0 8px; margin-left: 2px; border-left: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.fz-explode input { width: 96px; accent-color: var(--fz-orange); }
.fz-module { position: relative; padding-left: 6px; border-left: 1px solid var(--line); }
.fzm-trigger { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 3px 8px 3px 4px; cursor: pointer; min-height: 34px; color: var(--fz-ink); }
.fzm-trigger:hover, .fzm-trigger[aria-expanded=true] { border-color: var(--fz-orange); }
.fzm-trigger.is-on { background: var(--fz-orange-t); border-color: var(--fz-orange); }
.fzm-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--fz-ink); }
.fzm-trigger.is-on .fzm-ico { background: var(--fz-orange); }
.fzm-ico svg, .fzm-none svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fzm-txt { display: flex; flex-direction: column; text-align: left; line-height: 1.05; }
.fzm-txt small { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fzm-txt b { font-size: 12.5px; font-weight: 700; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.fzm-caret { width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; transition: transform .2s; }
.fzm-trigger[aria-expanded=true] .fzm-caret { transform: rotate(180deg); }
.fzm-pop { position: absolute; top: calc(100% + 10px); right: 0; width: 330px; max-width: calc(100vw - 24px); padding: 8px; background: #fffefb; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 24px 48px -20px #1b1b1d55, 0 2px 6px #1b1b1d12; z-index: 20; animation: fzm-in .16s ease-out; }
.fzm-pop[hidden] { display: none; }
@keyframes fzm-in { from { opacity: 0; transform: translateY(-4px); } }
.fzm-head { margin: 2px 6px 8px; font: 700 11px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.fzm-pop [data-acc] { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 6px; cursor: pointer; text-align: left; color: var(--fz-ink); }
.fzm-pop [data-acc]:hover, .fzm-pop [data-acc]:focus-visible { background: var(--fz-paper); outline: none; border-color: var(--line); }
.fzm-pop [data-acc][aria-selected=true] { background: var(--fz-orange-t); border-color: var(--fz-orange); }
.fzm-pop img, .fzm-none { width: 58px; height: 46px; flex: none; object-fit: contain; border-radius: 8px; background: linear-gradient(160deg, #fff, var(--fz-paper-2)); border: 1px solid var(--line); }
.fzm-none { display: grid; place-items: center; background: var(--fz-ink); border-color: var(--fz-ink); }
.fzm-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fzm-meta b { font-size: 13.5px; font-weight: 700; }
.fzm-meta small { font-size: 12px; color: var(--muted); }
.fzm-meta em { font-style: normal; align-self: flex-start; margin-top: 2px; }
.fzm-check { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--fz-orange-d); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
[aria-selected=true] > .fzm-check { opacity: 1; }

/* ===================================================================== device panel (LCD mirror + Flipper keys) */
.fz-device { position: absolute; left: 18px; bottom: 18px; z-index: 3; width: 290px; padding: 10px 12px 12px; border: 1px solid #ddd6cc;
  background: linear-gradient(180deg, #fffefb, #f3efe9); border-radius: 18px 18px 26px 18px; box-shadow: 0 18px 36px -24px #1b1b1d80, inset 0 1px 0 #fff; }
.fz-device header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.fz-device header span { display: flex; align-items: center; gap: 6px; font-family: var(--cond); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: var(--fz-ink); }
.fzd-led { width: 7px; height: 7px; border-radius: 50%; background: var(--fz-orange); box-shadow: 0 0 0 3px #ff82002b; }
.fz-device header small { font-size: 10.5px; color: var(--faint); }
.fzd-screen { background: var(--fz-ink); border-radius: 9px; padding: 6px; display: grid; place-items: center; box-shadow: inset 0 2px 6px #000a; }
.fz-device canvas { border-radius: 2px; image-rendering: pixelated; image-rendering: crisp-edges; background: #ff8c0a; display: block; }
.fz-pad { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin-top: 10px; padding-right: 40px; }
.fzp-ring { width: 124px; height: 124px; flex: none; touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent; }
.fzp-base { fill: var(--fz-orange-d); filter: drop-shadow(0 3px 0 #a54f00); }
.fzp-seg { cursor: pointer; outline: none; }
.fzp-hit { fill: var(--fz-orange); transition: fill .12s; }
.fzp-seg:hover .fzp-hit { fill: var(--fz-orange-2); }
.fzp-arrow { fill: #fff; pointer-events: none; }
.fzp-gaps { stroke: #c45f00; stroke-width: 2; pointer-events: none; }
.fzp-seg.is-down .fzp-hit { fill: #d86500; }
.fzp-seg.is-down .fzp-arrow { fill: #ffe2c2; transform: translateY(2px); }
.fzp-ok { cursor: pointer; }
.fzp-ok circle { fill: #fffaf3; stroke: #c45f00; stroke-width: 2; transition: fill .12s; }
.fzp-ok text { font: 800 12px/1 var(--cond); fill: var(--fz-orange-dd); text-anchor: middle; letter-spacing: .05em; pointer-events: none; }
.fzp-ok:hover circle { fill: #fff; }
.fzp-ok.is-down circle { fill: #ffd9b0; transform: scale(.94); transform-origin: 60px 60px; }
.fzp-back { position: absolute; right: 2px; bottom: 0; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--fz-ink); color: #fff; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 0; box-shadow: 0 3px 0 #000, inset 0 1px 0 #ffffff26; transition: transform .1s, box-shadow .1s; touch-action: manipulation; }
.fzp-back svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fzp-back span { font: 700 8.5px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: #cfc8be; margin-top: 1px; }
.fzp-back:hover { background: var(--fz-ink-3); }
.fzp-back.is-down, .fzp-back:active { transform: translateY(3px); box-shadow: 0 0 0 #000; }

/* ===================================================================== lesson strip: equal cards, wrapped titles, every card has an icon */
.lesson { flex: none; width: 252px; height: 76px; padding: 0 26px 0 8px; gap: 10px; background: var(--fz-white); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 14px -12px #1b1b1d80; }
.lesson:hover { background: #fff; border-color: var(--fz-orange-2); transform: translateY(-2px); }
.lesson.is-active { background: var(--fz-orange-t); border-color: var(--fz-orange); box-shadow: inset 0 0 0 1px var(--fz-orange), 0 8px 22px -12px #ff820080; }
.lesson-thumb, .lesson-icon { width: 62px; height: 58px; flex: none; margin: 0; object-fit: contain; border-radius: 9px; background: linear-gradient(160deg, #fff 0, var(--fz-paper-2) 100%); }
.lesson.is-active .lesson-thumb { background: linear-gradient(160deg, #fff, #ffd9b0); }
.lesson-icon { display: grid; place-items: center; background: var(--fz-ink); }
.lesson-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--fz-orange); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lesson-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.lesson-title { flex: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; white-space: normal; text-align: left;
  font: 600 13.5px/16px var(--sans); color: var(--fz-ink-2); text-transform: none; letter-spacing: 0; overflow-wrap: break-word; hyphens: auto; }
.ln-n { display: block; font: 700 10.5px/13px var(--cond); letter-spacing: .1em; color: var(--fz-orange-d); text-transform: uppercase; }
.lesson.is-active .lesson-title { color: var(--fz-ink); }
.lesson-done { top: 7px; right: 7px; }
.lesson.is-done .lesson-done { background: var(--fz-orange); border-color: var(--fz-orange); }
.lesson[hidden] { display: none !important; }
.fz-strip-nav { position: absolute; bottom: 28px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--fz-ink); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.fz-strip-nav:hover { border-color: var(--fz-orange); color: var(--fz-orange-d); }
.fz-strip-nav.prev { left: 6px; } .fz-strip-nav.next { right: 6px; }

/* ===================================================================== code card + virtual runner */
.code-wrap { display: flex; flex-direction: column; background: var(--fz-ink); border-radius: 10px; border: 1px solid #000; }
.code-wrap .code { flex: 1; min-height: 0; height: auto; background: var(--fz-ink) !important; color: #e9e4dd; border-radius: 0; margin: 0; }
.code .ln { color: var(--gutter); }
.code .cm { color: #7d776f; font-style: italic; } .code .str { color: var(--str); } .code .kw { color: var(--kw); } .code .fn { color: var(--fn); } .code .num { color: var(--num); }
.code .line { position: relative; border-left: 3px solid transparent; margin-left: -3px; transition: background .2s; }
.code .line.is-ran { border-left-color: #ff820055; }
.code .line.is-running { background: #ff82002e; border-left-color: var(--fz-orange); }
.code .line.is-running .ln { color: var(--fz-orange); font-weight: 700; }
.run-strip { position: relative; z-index: 3; flex: none; display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 32px; padding: 4px 10px; background: #232326; border-top: 1px solid #000; font: 500 11.5px/1.2 var(--mono); color: #a39e97; }
.run-strip b { color: #f3efe9; font-weight: 600; }
.rs-state { display: flex; align-items: center; gap: 6px; }
.rs-state i { width: 8px; height: 8px; border-radius: 50%; background: #6d6862; }
.code-card[data-state=running] .rs-state i { background: var(--fz-orange); box-shadow: 0 0 0 3px #ff820040; animation: pulse 1s infinite; }
.code-card[data-state=done] .rs-state i { background: #57c26f; }
.code-card[data-state=error] .rs-state i { background: #e5533d; }
.rs-spacer { flex: 1; }
.rs-speed { display: flex; align-items: center; gap: 6px; }
.rs-speed select { font: inherit; color: #f3efe9; background: #1b1b1d; border: 1px solid #3a3a3e; border-radius: 6px; padding: 2px 4px; }
.console { bottom: 32px; background: #151517 !important; border-top: 1px solid #000 !important; color: #e9e4dd; }
.console-head { border-bottom: 1px solid #2a2a2d !important; background: #1d1d20; }
.console-title { color: #f3efe9 !important; }
.console-status { color: #a39e97 !important; }
.console-dot { background: #6d6862; }
.code-card[data-state=running] .console-dot { background: var(--fz-orange); }
.console-close svg { stroke: #cfc8be !important; }
.console-close:hover { background: #ffffff14 !important; }
.console-lines { padding: 4px 0 6px; }
.console-line { display: grid; grid-template-columns: 44px 16px 1fr; gap: 6px; padding: 1px 10px; font: 12px/1.55 var(--mono); color: #cfc8be; }
.console-line .cl-t { color: #5f5b57; text-align: right; white-space: pre; }
.console-line .cl-l { color: #8a857f; font-weight: 700; }
.console-line .cl-m { white-space: pre-wrap; overflow-wrap: anywhere; }
.console-line.ok .cl-m { color: #ffb366; } .console-line.ok .cl-l { color: var(--fz-orange); }
.console-line.fn .cl-m { color: #f3efe9; font-weight: 600; } .console-line.fn .cl-l { color: #c3adfa; }
.console-line.dim .cl-m { color: #87827b; }
.console-line.note .cl-m { color: #7d776f; font-style: italic; }
.console-line.warn .cl-m, .console-line.warn .cl-l { color: #f4c06a; }
.console-line.err .cl-m, .console-line.err .cl-l { color: #ff7b66; }
.btn-run { background: linear-gradient(#ff9a2e, #ff8200) !important; box-shadow: 0 5px 12px -6px #ff8200b3 !important; width: auto !important; padding: 0 14px 0 10px; display: flex !important; gap: 6px; align-items: center; color: #fff; }
.btn-run .run-label { font: 700 13px/1 var(--cond); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.code-card[data-state=idle] .btn-run svg, .code-card[data-state=idle] .btn-run .fill, .btn-run svg, .btn-run svg .fill { fill: #fff !important; }
.code-card[data-state=running] .btn-run { background: linear-gradient(#3a3a3e, #1b1b1d) !important; box-shadow: 0 5px 12px -6px #000 !important; }
.code-editor-footer .code-language { color: var(--fz-orange-d); }

/* wide artboard: guide and code card share the right column evenly, bottoms aligned with the 3D stage */
html:not(.compact) .info-card { bottom: auto !important; height: calc((100% - 112px - 174px - 16px) / 2) !important; }
html:not(.compact) .code-card { top: auto !important; bottom: 174px !important; height: calc((100% - 112px - 174px - 16px) / 2) !important; }
html:not(.compact) .console { height: min(var(--console-h, 92px), 58%); }
/* expand buttons: the card takes the whole right column (wide) or the whole screen (compact) */
html:not(.compact) .info-card.is-expanded, html:not(.compact) .code-card.is-expanded { top: 112px !important; bottom: 174px !important; height: auto !important; z-index: 6; box-shadow: 0 24px 48px -24px #1b1b1d66; }
html:not(.compact) .code-card.is-expanded .console { height: min(var(--console-h, 92px), 40%); }
html.compact .info-card.is-expanded, html.compact .code-card.is-expanded { position: fixed !important; inset: 8px 8px calc(84px + env(safe-area-inset-bottom, 0px)) 8px !important; height: auto !important; z-index: 30;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px -20px #1b1b1d99; }
html.compact .info-card.is-expanded .info-body { flex: 1; min-height: 0; overflow: auto; max-height: none; }
html.compact .code-card.is-expanded .code-wrap { flex: 1; min-height: 0; }
html.compact .code-card.is-expanded .code-wrap .code { max-height: none; flex: 1; }
html.compact .info-card .expand, html.compact .btn-expand { display: grid !important; place-items: center; min-width: 44px; min-height: 44px; }
.expand[aria-expanded=true], .btn-expand[aria-expanded=true] { background: var(--fz-orange) !important; border-color: var(--fz-orange) !important; }
.expand[aria-expanded=true] svg, .btn-expand[aria-expanded=true] svg { stroke: #fff !important; }
.expand[aria-expanded=true] svg .fill, .btn-expand[aria-expanded=true] svg .fill { fill: #fff !important; }

/* ===================================================================== inspector + tip */
.inspector .insp-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.inspector h3 { margin: 4px 0 0; font-size: 17px; color: var(--fz-ink); line-height: 1.2; }
.inspector .insp-close { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.inspector .insp-desc { margin: 8px 0; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.inspector .insp-rows { margin: 0; display: grid; gap: 4px; }
.inspector .insp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; border-top: 1px solid var(--line-soft); padding-top: 4px; }
.inspector .insp-row dt { color: var(--muted); } .inspector .insp-row dd { margin: 0; color: var(--fz-ink); font-weight: 600; text-align: right; }
.fz-insp-actions { display: flex; gap: 6px; margin-top: 10px; }
.fz-insp-actions button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; font-size: 12.5px; font-weight: 600; color: var(--fz-ink); cursor: pointer; }
.fz-insp-actions button:hover { border-color: var(--fz-orange); color: var(--fz-orange-d); }
.tip b { display: block; color: var(--fz-ink); font-size: 13.5px; } .tip span { font-size: 12px; color: var(--muted); }
.fz-src { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; background: #f1ece5; color: #5f5b57; }
.fz-src.official-cad { background: var(--fz-ink); color: #fff; } .fz-src.official-pdf { background: var(--fz-orange-t); color: var(--fz-orange-dd); }

/* ===================================================================== lesson guide content */
.info-content .features li span b { color: var(--fz-ink); }
.feature-icon { background: var(--fz-orange-t) !important; }
.feature-icon svg { stroke: var(--fz-orange-d) !important; }
.feature-icon svg .fill { fill: var(--fz-orange) !important; }
.fz-h { margin: 14px 0 6px; font-family: var(--cond); font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.fz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fz-chips button, .fz-chip-static { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13px; color: var(--fz-ink); cursor: pointer; }
.fz-chip-static { cursor: default; border-color: var(--fz-orange); background: var(--fz-orange-t); }
.fz-chips button:hover { border-color: var(--fz-orange); color: var(--fz-orange-d); }
.fz-quiz p { margin: 4px 0 8px; color: var(--fz-ink); }
.fz-quiz button { display: block; width: 100%; text-align: left; margin: 4px 0; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 10px; font-size: 14px; cursor: pointer; color: var(--fz-ink); }
.fz-quiz button:hover { border-color: var(--fz-orange-2); }
.fz-quiz button.is-good { background: #eaf6ec; border-color: #3a9a52; } .fz-quiz button.is-bad { background: #fde8e6; border-color: #d64a3a; }
.fz-quiz-out { font-size: 13px; color: var(--muted); }
.pin-table tr[data-focus] { cursor: pointer; } .pin-table a { color: var(--fz-ink); text-decoration: none; font-weight: 600; }
.fz-blocks { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin: 8px 0; }
.fz-doc-note { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--fz-paper); border-radius: 10px; padding: 8px 10px; }
.fz-doc-note p { margin: 0; font-size: 13px; }
.sch-view svg { width: 100%; height: 100%; }
.fz-acc-note { background: var(--fz-orange-t); border: 1px solid #ffc78a; border-radius: 10px; padding: 8px 10px; }

/* ===================================================================== labs */
.lab { background: var(--fz-paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.lab canvas { width: 100%; display: block; background: var(--fz-ink); border-radius: 8px; margin: 6px 0; }
.lab p { font-size: 13.5px; margin: 6px 0; }
.ctl { display: grid; grid-template-columns: 112px 1fr 62px; gap: 8px; align-items: center; margin: 5px 0; font-size: 12.5px; }
.ctl input[type=range] { width: 100%; accent-color: var(--fz-orange); }
.lab select, .lab input[type=text], .lab textarea { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; background: #fff; color: var(--fz-ink); max-width: 100%; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.lab .btn { border: 1px solid var(--fz-orange); background: var(--fz-orange); color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; margin: 2px 2px 2px 0; }
.lab .btn:hover { background: var(--fz-orange-d); }
.lab .btn.alt { background: #fff; color: var(--fz-orange-dd); }
.out { background: var(--fz-ink); color: #ffcf9e; border-radius: 8px; padding: 8px 10px; font: 12px/1.5 var(--mono, monospace); white-space: pre-wrap; min-height: 48px; max-height: 190px; overflow: auto; margin-top: 6px; }
.synthetic { font-size: 11.5px; color: var(--fz-orange-dd); background: var(--fz-orange-t); border-radius: 8px; padding: 5px 9px; margin: 0 0 6px; }
.focus-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.focus-btns button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.feat { list-style: none; padding: 0; display: grid; gap: 5px; } .feat li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.quiz label { display: block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; font-size: 13px; }

/* ===================================================================== flyouts */
.flyout { border-top-color: var(--fz-orange) !important; }
.fz-scroll { max-height: 470px; overflow: auto; }
.fz-fly-mod { margin: 10px 6px 2px; font-family: var(--cond); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.fly-num { min-width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.fz-tick { margin-left: auto; color: var(--fz-orange-d); font-weight: 700; }
.fz-part { display: flex; align-items: center; gap: 4px; } .fz-part > button:first-child { flex: 1; min-width: 0; }
.fz-part > button:not(:first-child) { width: auto !important; flex: none; border: 1px solid var(--line) !important; padding: 2px 7px !important; font-size: 11.5px; border-radius: 6px !important; }
.fz-part.is-off .fly-text { opacity: .45; text-decoration: line-through; }
.fz-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9c3bb; flex: none; }
.fz-dot.official-cad { background: var(--fz-ink); } .fz-dot.official-pdf { background: var(--fz-orange); }
.fz-fly-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.fz-fly-foot button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.fz-fly-foot i { margin: 0 2px 0 6px; vertical-align: -1px; }
.ref-list { list-style: none; padding: 0 4px; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.fz-src-key li { display: flex; align-items: center; gap: 8px; }
.ref-keys { display: inline-block; min-width: 118px; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--fz-ink); }

/* ===================================================================== languages */
/* system fonts that cover each script (Barlow has Latin only); no extra downloads */
html[data-lang=ml] { --script: "Noto Sans Malayalam", "Nirmala UI", "Kartika", "Manjari", sans-serif; }
html[data-lang=hi] { --script: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", sans-serif; }
html[data-lang=ar] { --script: "Noto Sans Arabic", "Segoe UI", "Tahoma", "Geeza Pro", sans-serif; }
html[data-lang=zh] { --script: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif; }
html:is([data-lang=ml], [data-lang=hi], [data-lang=ar], [data-lang=zh]) body :is(h1, h2, h3, p, span, b, strong, small, em, button, label, li, dt, dd, th, td, a, option, select, input) {
  font-family: "Barlow", var(--script); }
html:is([data-lang=ml], [data-lang=hi], [data-lang=ar], [data-lang=zh]) :is(.code, .code *, .console, .console *, .ref-keys, #rs-line, #rs-calls, #rs-time) { font-family: var(--mono); }
/* letter-spacing breaks Arabic joining and crowds Indic / CJK glyphs; scripts without case ignore uppercase anyway */
html:is([data-lang=ml], [data-lang=hi], [data-lang=ar], [data-lang=zh]) body *:not(.code *, .console *) { letter-spacing: 0 !important; }
html[data-lang=ml] .lesson-title, html[data-lang=hi] .lesson-title { line-height: 1.3; font-size: 13px; }
html[data-lang=ml] .lesson-title { font-size: 12.5px; }
/* Malayalam words are long: allow a 4th line; every card grows together so they stay equal */
html[data-lang=ml] .lesson { height: 84px !important; }
html[data-lang=ml] .lesson-title { -webkit-line-clamp: 4; line-clamp: 4; font-size: 12px !important; line-height: 15.5px !important; }
/* Arabic: text runs right-to-left inside panels; the artboard layout and the 3D view keep their positions */
html.is-rtl :is(.lesson-text, .fzm-meta, .fzm-head, .fz-doc-note, .fz-quiz, .fz-h, .fz-chips, .lab, .lesson-guide-header, .tabs, .masthead-current,
  .info-content, .fly-list, .flyout header, .ref-list, .fz-fly-mod, .fz-lang-note, .fz-device header, .inspector, .workshop-lessons-heading, .side-nav, .sch-notes) { direction: rtl; }
html.is-rtl :is(.lesson-title, .info-content p, .fzm-meta, .fz-quiz button, .fly-text) { text-align: right; }
html.is-rtl :is(.code, .console, .run-strip, .pin-table td:nth-child(3), .fzd-screen, .fz-pad, .fz-explode input) { direction: ltr; }
html.is-rtl :is(.info-content, .lab) code { direction: ltr; unicode-bidi: isolate; }
.fz-lang-hint { display: inline-block; margin: 0 0 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--fz-paper-2); color: var(--muted); }
.fz-langs { display: grid; gap: 4px; }
.fz-langs [data-lang] { display: flex !important; align-items: center; gap: 10px; width: 100%; border: 1px solid var(--line) !important; border-radius: 10px !important; background: #fff; padding: 9px 12px !important; cursor: pointer; text-align: start; }
.fz-langs [data-lang]:hover { border-color: var(--fz-orange-2) !important; }
.fz-langs [data-lang].is-current { border-color: var(--fz-orange) !important; background: var(--fz-orange-t); }
.fz-lang-native { flex: 1; font-size: 15px; font-weight: 600; color: var(--fz-ink); }
.fz-lang-native:lang(ml) { font-family: "Noto Sans Malayalam", "Nirmala UI", sans-serif; }
.fz-lang-native:lang(hi) { font-family: "Noto Sans Devanagari", "Nirmala UI", sans-serif; }
.fz-lang-native:lang(ar) { font-family: "Noto Sans Arabic", "Segoe UI", sans-serif; }
.fz-lang-native:lang(zh) { font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.fz-lang-en { font-size: 12px; color: var(--muted); }
.fz-langs [data-lang] .fzm-check { opacity: 0; } .fz-langs [data-lang].is-current .fzm-check { opacity: 1; }
.fz-lang-note { margin: 10px 4px 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ===================================================================== responsive: compact layout (phones, portrait tablets, short windows) */
html.compact .fz-modes { top: 8px; right: 8px; left: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: none; gap: 2px; padding: 3px; }
html.compact .fz-modes > button { padding: 6px 8px; font-size: 12px; min-height: 36px; }
html.compact .fz-explode input { width: 80px; }
html.compact .fzm-txt small { display: none; }
html.compact .fzm-trigger { min-height: 36px; }
html.compact .fz-device { left: 8px; bottom: 56px; width: 156px; padding: 6px 7px 8px; border-radius: 14px; }
html.compact .fz-device header small { display: none; }
html.compact .fzd-screen { padding: 4px; border-radius: 7px; }
html.compact .fz-pad { margin-top: 6px; padding-right: 30px; gap: 4px; }
html.compact .fzp-ring { width: 92px; height: 92px; }
html.compact .fzp-back { width: 34px; height: 34px; }
html.compact .fzp-back span { display: none; }
html.compact .lesson { width: 214px; height: 72px; }
html.compact .lesson-thumb, html.compact .lesson-icon { width: 54px; height: 52px; }
html.compact .lesson-title { font-size: 13.5px; line-height: 16px; }
html.compact .fz-strip-nav { width: 40px; height: 40px; bottom: 22px; }
/* compact: bottom tab bar holds only the nav (credits move to the page foot), content clears it, console flows below the code */
html:not(.compact) .app-foot { display: none; }
html.compact .app-foot { padding: 4px 4px 12px; }
html.compact .sidebar .side-author { display: none; }
html.compact .app-foot .side-author { display: flex; margin: 0; }
html.compact .side-nav { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
html.compact .side-nav::-webkit-scrollbar { display: none; }
html.compact body { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
html.compact .code-wrap { min-height: 0; overflow: visible; }
html.compact .code-wrap .code { max-height: 46vh; overflow: auto; }
html.compact .console { position: relative; bottom: auto; left: auto; right: auto; transform: none; height: auto !important; max-height: 260px; border-radius: 0 0 10px 10px; }
html.compact .console:not(.is-open) { display: none; }
html.compact .console-lines { overflow: auto; max-height: 220px; }
@media (max-width: 560px) {
  html.compact .side-nav a { flex-direction: column; gap: 2px; padding: 6px 4px; min-width: 62px; }
  html.compact .side-label { font-size: 11px; }
  html.compact .stage { min-height: min(72vh, 560px); }
  html.compact .tags .tag:nth-child(n+5), html.compact .leaders > g:nth-child(n+4) { display: none; }
  html.compact .lesson-list { margin-inline: 38px; }
  html.compact .fz-strip-nav { width: 34px; height: 34px; bottom: 30px; font-size: 18px; }
  html.compact .lesson { width: min(230px, calc(100vw - 150px)); }
  html.compact .fz-modes { justify-content: center; }
  html.compact .fz-explode span { display: none; }
  html.compact .fz-explode { border-left: 0; padding: 0 4px; }
  html.compact .fz-module { border-left: 0; padding-left: 0; }
  html.compact .fz-module { position: static; }
  html.compact .fzm-pop { top: calc(100% + 8px); left: 0; right: 0; width: auto; max-width: none; max-height: 62vh; overflow: auto; }
  html.compact .fzm-txt b { max-width: 96px; }
  html.compact .ctl { grid-template-columns: 92px 1fr 52px; }
  html.compact .run-strip .rs-item:nth-of-type(3) { display: none; }
  html.compact .wordmark-hide-sm, html.compact .fz-wordmark em { display: none; }
  html.compact .workshop-wordmark .fz-logo { width: 36px; height: 36px; }
  html.compact .fz-wordmark strong { font-size: 19px; }
}
@media (max-width: 380px) {
  html.compact .fz-modes > button { padding: 6px 6px; font-size: 11.5px; }
  html.compact .fz-device { width: 140px; }
  html.compact .fzp-ring { width: 84px; height: 84px; }
}
@media (hover: none) { .lesson:hover { transform: none; } }
