/* ESP32 Workshop interface. Simulation geometry stays in the original bundle. */
:root {
  --bg: #f0f3f6; --bg-deep: #e6ebef; --card: #fff; --card-soft: #fff; --panel: #fff;
  --line: #dce4e9; --line-strong: #bdced5; --line-soft: #eaf0f3;
  --navy: #142c3d; --navy-2: #284456; --ink: #4e6373; --muted: #627583; --faint: #788995;
  --accent: #087568; --accent-deep: #056558; --accent-soft: #e4f4ee; --green: #087568; --track: #e4ebe9;
  --shadow: 0 8px 28px -18px #18394d30;
  --sans: "Barlow", "Nirmala UI", "Segoe UI", Tahoma, sans-serif;
  --cond: "Barlow", "Nirmala UI", "Segoe UI", Tahoma, sans-serif;
  --workshop-sidebar-width: 216px;
  --workshop-content-left: 250px;
}
body { color: var(--ink); }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [role="button"]:focus-visible { outline: 3px solid #078675; outline-offset: 4px; }
.artboard { background: var(--bg); }
.scenery, .side-desert, .status-cactus, .app-foot { display: none; }

/* ─── Twin dock cards (brand + status) ───────────────────────── */
/* Shared pill shell */
.brand, .status {
  box-sizing: border-box;
  height: 64px;
  padding: 10px 14px;
  gap: 12px;
  background: #ffffffd8;
  border: 1px solid #e3ebe7;
  border-radius: 18px;
  box-shadow: 0 10px 28px -14px #18394d1f, 0 2px 4px #18394d08;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: inline-flex;
  align-items: center;
}
.brand { top: 20px; left: 20px; }

/* Shared icon badge — 40 px squircle with the teal gradient */
.dock-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.dock-icon svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* Shared text block — big value on top, small meta underneath */
.dock-text { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.dock-value { margin: 0; color: #0f2e3f; font: 700 17px/1.1 var(--sans); letter-spacing: -.015em; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.dock-value span.highlight, .dock-value > span:first-child { color: inherit; }
.dock-meta { margin: 0; color: #7a8e95; font: 600 10px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.dock-meta i { color: #39a98a; margin: 0 .35em; font-style: normal; font-weight: 700; }

/* Brand-specific accents */
.brand .dock-value { font-size: 18px; font-weight: 700; }
.brand .dock-value span { color: #087568; font-weight: 700; }
.brand-bars rect { animation: brand-bar-glow 2.4s ease-in-out infinite; }
.brand-bars rect:nth-child(2) { animation-delay: .25s; }
.brand-bars rect:nth-child(3) { animation-delay: .5s; }
.brand-orb { animation: brand-orb-pulse 1.8s ease-in-out infinite; transform-origin: 30px 13px; transform-box: fill-box; }
.brand-orb-halo { animation: brand-orb-halo 1.8s ease-in-out infinite; transform-origin: 30px 13px; transform-box: fill-box; }
@keyframes brand-bar-glow { 0%,100% { opacity: 1; } 50% { opacity: .78; } }
@keyframes brand-orb-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes brand-orb-halo { 0%,100% { opacity: .25; transform: scale(1); } 50% { opacity: .55; transform: scale(1.4); } }
.sidebar { left: 16px; top: 112px; bottom: auto; width: var(--workshop-sidebar-width); padding: 0 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 22px #18394d05; overflow: visible; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 19px 8px 17px; color: #627583; font-size: 13px; line-height: 20px; font-weight: 600; }
.sidebar-chip { padding: 3px 6px; border: 1px solid #dce7e6; border-radius: 5px; background: #f5f9f8; color: #52766d; font: 500 11px var(--mono); }
.side-nav { display: flex; flex-direction: column; gap: 5px; padding: 0; }
.side-nav li, .side-nav li:nth-child(n) { position: relative; inset: auto; width: 100%; }
.side-nav li:nth-child(4) { width: 100%; margin-top: 9px; padding-top: 14px; border-top: 1px solid #edf1f4; }
.side-nav a { flex-direction: row; justify-content: flex-start; min-height: 49px; height: auto; padding: 12px; border: 0; border-radius: 9px; gap: 12px; }
.side-nav a svg { flex: 0 0 21px; width: 21px; height: 21px; stroke: #6a7d8b; stroke-width: 1.8px; }
.side-nav svg .fill, .side-nav svg.fill { fill: #6a7d8b; }
.side-label { display: block; flex: 1; width: auto; min-width: 0; white-space: normal; overflow-wrap: break-word; text-align: start; font-size: 15px; line-height: 23px; font-weight: 500; color: #455d6e; }
.side-nav a:hover { background: #f2f6f8; box-shadow: none; }
.side-nav li.is-active a { border: 0; background: #1e3b4e; box-shadow: none; }
.side-nav li.is-active a::before { display: none; }
.side-nav li.is-active .side-label { color: #fff; font-weight: 500; }
.side-nav li.is-active svg { stroke: #bde7d8; }
.side-nav li.is-active svg.fill, .side-nav li.is-active svg .fill { fill: #bde7d8; }
:is(.side-nav li.is-on a, .side-nav:not(:has(li.is-on)) li.is-active a) { border: 0; background: #1e3b4e; box-shadow: none; }
:is(.side-nav li.is-on .side-label, .side-nav:not(:has(li.is-on)) li.is-active .side-label) { color: #fff; font-weight: 500; }
:is(.side-nav li.is-on svg, .side-nav:not(:has(li.is-on)) li.is-active svg) { stroke: #bde7d8; }
:is(.side-nav li.is-on svg.fill, .side-nav li.is-on svg .fill, .side-nav:not(:has(li.is-on)) li.is-active svg.fill, .side-nav:not(:has(li.is-on)) li.is-active svg .fill) { fill: #bde7d8; }
.side-nav:has(li.is-on) li.is-active:not(.is-on) a { background: transparent; }
.side-nav:has(li.is-on) li.is-active:not(.is-on) .side-label { color: #455d6e; }
.side-nav:has(li.is-on) li.is-active:not(.is-on) svg { stroke: #6a7d8b; }
.side-nav:has(li.is-on) li.is-active:not(.is-on) svg.fill, .side-nav:has(li.is-on) li.is-active:not(.is-on) svg .fill { fill: #6a7d8b; }

/* Status pill — same dock anatomy as the brand, with a divider + clock half */
.status { top: 20px; right: 20px; padding: 10px 14px; }
.progress-card { display: inline-flex; align-items: center; gap: 12px; padding: 0; border: 0; min-width: 0; width: auto; }
.progress-bars rect { animation: progress-bar-rise 2.4s ease-in-out infinite; transform-origin: center bottom; transform-box: fill-box; }
.progress-bars rect:nth-child(2) { animation-delay: .2s; }
.progress-bars rect:nth-child(3) { animation-delay: .4s; }
.progress-spark { animation: progress-spark-float 2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes progress-bar-rise { 0%,100% { opacity: 1; transform: scaleY(1); } 50% { opacity: .78; transform: scaleY(.88); } }
@keyframes progress-spark-float { 0%,100% { transform: translateY(0) scale(1); opacity: 1; } 50% { transform: translateY(-2px) scale(1.25); opacity: .7; } }
.progress-card .dock-value { font-family: var(--mono); font-size: 15px; letter-spacing: .02em; }
.progress-card .dock-value #progress-count { color: #087568; font-weight: 700; }
.progress-track { position: relative; display: inline-block; width: 90px; height: 5px; border-radius: 99px; background: #e8efeb; overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #087568 0%, #39a98a 100%); box-shadow: 0 0 10px #087568aa; transform-origin: 0 50%; }
/* Vertical divider between progress and clock */
.dock-divider { width: 1px; height: 32px; margin: 0 4px; background: linear-gradient(180deg, transparent, #cfdbd7 20%, #cfdbd7 80%, transparent); flex: none; }
.clock, .status-cactus, .dock-divider { display: none !important; }

/* 3D workspace */
.stage { inset: 112px 522px 174px var(--workshop-content-left); background: #f9fbfc; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.workshop-stage-heading { position: absolute; top: 20px; left: 24px; z-index: 4; pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
.workshop-stage-heading strong { font-size: 16px; font-weight: 600; color: var(--navy); }
.workshop-stage-heading span { color: var(--muted); font-size: 14px; }
.workshop-stage-badge { position: absolute; right: 22px; top: 20px; z-index: 4; border: 1px solid var(--line); background: #ffffffde; border-radius: 8px; padding: 6px 10px; color: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none; }
.viewbar { left: 50%; bottom: 16px; padding: 6px; gap: 3px; border: 1px solid var(--line); border-radius: 16px; background: #fffffff2; box-shadow: 0 8px 24px #19344b10; }
.viewbar button { width: 38px; height: 38px; border-radius: 10px; }
.viewbar button:hover { background: var(--accent-soft); }
.view-hint { background: #203a4b; color: #edf7f3; padding: 6px 12px; font-size: 13px; font-weight: 500; letter-spacing: 0; }
.callout { border: 1px solid var(--line); border-radius: 16px; background: #ffffffed; box-shadow: 0 5px 22px #1c374b0a; }
.callout:hover { border-color: #91bfb2; }
.tag { border: 1px solid var(--line); color: var(--navy); background: #ffffffed; text-transform: none; letter-spacing: .01em; }
.schematic-card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px #1c374b0a; }
.sch-head h2 { color: var(--muted); text-transform: none; letter-spacing: 0; }
.inspector { border-color: var(--line); border-radius: 18px; box-shadow: 0 12px 30px #19344b1a; }

/* Lesson guide */
.info-card { display: flex; flex-direction: column; height: 406px; border: 1px solid #dce4eb; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px #18394d06; overflow: hidden; contain: paint; }
.lesson-guide-header { flex: none; padding: 20px 22px 13px; }
.lesson-guide-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: #627583; font-size: 13px; line-height: 20px; font-weight: 500; }
#lesson-guide-number { color: #597687; font: 400 12px var(--mono); white-space: nowrap; }
.lesson-guide-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
#lesson-guide-title { min-width: 0; color: #193647; font-size: 23px; line-height: 30px; letter-spacing: -.025em; font-weight: 600; overflow-wrap: break-word; }
.info-card .expand { position: static; display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border: 1px solid #e1e8ed; border-radius: 8px; background: #fff; }
.info-card .expand svg { width: 16px; height: 16px; }
.info-card .expand:hover { background: #f3f7f9; border-color: #b7c9d3; }
.tabs { flex: none; height: auto; min-height: 45px; padding: 0 20px; align-items: stretch; gap: 18px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #e7edf1; }
.tabs button { flex: 0 0 auto; height: auto; min-height: 44px; padding: 9px 0 12px; color: #627583; font-size: 14px; line-height: 21px; font-weight: 500; text-transform: none; letter-spacing: 0; border-radius: 0; white-space: nowrap; }
.tabs button.is-active { color: #176e61; background: transparent; font-weight: 600; }
.tabs button::after { display: block; height: 2px; border-radius: 0; bottom: 0; background: #238273; }
.tabs button.is-active::after { left: 0; right: 0; opacity: 1; }
.info-body { position: relative; flex: 1; min-height: 0; margin: 0; inset: auto; border: 0; background: none; padding: 18px 16px 18px 22px; border-radius: 0; overflow: hidden; }
.info-content { height: 100%; padding: 0 6px 0 0; scrollbar-color: #cfdae0 transparent; scrollbar-width: thin; scrollbar-gutter: stable; overflow-y: auto; overscroll-behavior: contain; }
.info-card[data-guide-tab="overview"] .info-content > h2 { display: none; }
.info-body h2 { font-size: 21px; line-height: 29px; font-weight: 600; letter-spacing: -.02em; text-transform: none; }
.lede { max-width: none; font-size: 16px; line-height: 25px; color: #566b79; margin-top: 0; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.features li { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; min-width: 0; min-height: 0; padding: 12px 10px; border: 1px solid #e5ecef; border-radius: 10px; background: #f8fafb; gap: 10px; color: #3f596b; font-size: 14px; line-height: 21px; }
.feature-icon { flex: none; width: 23px; height: 23px; border: 0; background: transparent; border-radius: 0; }
.feature-icon svg { width: 23px; height: 23px; stroke: #397c70; stroke-width: 1.7px; }
.pin-table { width: 100%; table-layout: fixed; color: var(--ink); font-size: 15px; line-height: 24px; }
.pin-table th, .pin-table td { overflow-wrap: anywhere; text-align: start; }
.pin-table th:first-child, .pin-table td:first-child { width: 27%; white-space: normal; }
.pin-table th:nth-child(2), .pin-table td:nth-child(2) { width: 29%; }
.pin-table code { white-space: normal; overflow-wrap: anywhere; }
.pinout-list { display: grid; gap: 12px; margin-top: 18px; padding: 0; list-style: none; }
.pinout-card { min-width: 0; padding: 14px; border: 1px solid #e0e8ed; border-inline-start: 3px solid var(--wire-color, #8da5b4); border-radius: 11px; background: #f9fbfc; }
.pinout-card-top { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); align-items: start; gap: 14px; }
.pinout-badge { display: inline-flex; align-items: center; gap: 8px; justify-self: start; max-width: 100%; min-height: 35px; padding: 7px 9px; border: 1px solid #dce5eb; border-radius: 7px; background: #fff; }
.pinout-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--wire-color, #8da5b4); }
.pinout-badge code { min-width: 0; padding: 0; border: 0; background: transparent; color: #28495f; font: 500 13px/21px var(--mono); white-space: normal; overflow-wrap: break-word; direction: ltr; unicode-bidi: isolate; }
.pinout-destination { min-width: 0; padding-top: 1px; }
.pinout-caption { display: block; margin-bottom: 3px; color: #627583; font-size: 12px; line-height: 18px; }
.pinout-destination strong { display: block; color: #25465a; font-size: 15px; line-height: 23px; font-weight: 600; overflow-wrap: anywhere; }
.pinout-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e5ecf0; color: #536c7d; font-size: 15px; line-height: 24px; overflow-wrap: anywhere; }
.lesson-controls { min-width: 0; margin: 20px 0 0; padding: 14px; border: 1px solid #dce8e2; border-radius: 10px; background: #f7fbf9; }
.lesson-controls legend { padding: 0 5px; color: #315d50; font-size: 15px; font-weight: 600; }
.lesson-controls > p { margin-bottom: 12px; color: #627583; font-size: 14px; line-height: 22px; }
.lab-field { display: block; padding: 10px 0; border-top: 1px solid #e5eee9; }
.lab-field > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #385466; font-size: 14px; line-height: 23px; }
.lab-field b { font-weight: 500; }
.lab-field output { flex: none; color: #176e61; font: 500 13px var(--mono); }
.lab-field input[type=range] { display: block; width: 100%; margin: 10px 0 0; accent-color: #087568; }
.lab-field.is-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lab-field input[type=checkbox] { width: 19px; height: 19px; accent-color: #087568; }
.lesson-challenge { margin-top: 18px; padding: 14px; border: 1px solid #e1e8ed; border-radius: 10px; background: #f8fafc; }
.lesson-challenge h3 { color: #25465a; font-size: 16px; line-height: 24px; }
.lesson-challenge p { margin-top: 5px; color: #536c7d; font-size: 15px; line-height: 24px; }
.lesson-challenge > span { display: inline-block; margin-top: 10px; color: #627583; font-size: 13px; line-height: 20px; font-weight: 600; }
.lesson-challenge.is-complete { border-color: #b8dccb; background: #eff9f3; }
.lesson-challenge.is-complete > span { color: #087568; }
.network-panel { margin-top: 18px; padding: 14px; border: 1px solid #dce6ed; border-radius: 10px; background: #f7fafc; }
.network-panel h3 { color: #25465a; font-size: 16px; line-height: 24px; }
.network-panel > p { margin: 3px 0 12px; color: #627583; font-size: 13px; line-height: 21px; }
.network-panel dl { display: grid; gap: 7px; }
.network-panel dl > div { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; line-height: 22px; }
.network-panel dt { color: #627583; }
.network-panel dd { margin: 0; color: #176e61; text-align: end; overflow-wrap: anywhere; }
.network-panel h4 { margin-top: 12px; color: #627583; font-size: 13px; font-weight: 500; }
.network-panel pre { margin: 6px 0; padding: 10px; border: 1px solid #e1e8ed; border-radius: 6px; background: #fff; color: #28495e; white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; unicode-bidi: plaintext; font: 12px/21px var(--mono); }
.network-panel ol { display: grid; gap: 5px; margin-top: 10px; color: #536c7d; font-size: 12px; line-height: 20px; }
.network-panel li { unicode-bidi: plaintext; }
.info-content, .fly-text, .callout { overflow-wrap: anywhere; }
.info-content { min-width: 0; }
.spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spec-grid > div { min-width: 0; }
.spec-grid dt { font-size: 14px; line-height: 22px; letter-spacing: 0; text-transform: none; }
.spec-grid dd { overflow-wrap: anywhere; line-height: 24px; }
.steps li { line-height: 25px; }
.callout h3 { text-transform: none; letter-spacing: 0; line-height: 27px; }
.callout p { line-height: 24px; }
.pin-table th { color: var(--muted); font-size: 13px; letter-spacing: .03em; }
.pin-table td { border-top: 1px solid var(--line-soft); }
.info-card.is-expanded { height: 655px; background: var(--card); }

/* Code editor */
.code-card {
  --line: #2b4050; --line-soft: #243a4b; --navy: #e0eef3; --navy-2: #b8cbd6;
  --kw: #89c6f4; --fn: #eac391; --num: #c3adfa; --str: #a6dcb1; --gutter: #718999;
  --faint: #94aab8; --accent: #8edaba; --accent-deep: #b5ead3;
  top: 534px; height: 233px; background: #fff; border: 1px solid #dce4eb; border-radius: 16px;
  padding: 0; box-shadow: 0 6px 24px #18394d06; overflow: hidden;
}
.code-card header { height: auto; min-height: 64px; gap: 12px; padding: 12px 14px; }
.code-file-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.code-file-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 36px; border: 1px solid #dde9e5; border-radius: 8px; background: #f0f7f4; }
.code-file-icon svg { width: 20px; height: 20px; fill: none; stroke: #397766; stroke-width: 1.5px; stroke-linejoin: round; stroke-linecap: round; }
.code-file-text { min-width: 0; }
.code-file-text p { color: #627583; font-size: 12px; line-height: 18px; }
.code-card header h2 { max-width: 200px; color: #29485a; font: 500 14px/21px var(--mono); text-transform: none; letter-spacing: -.015em; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.code-actions { flex: none; gap: 6px; }
.code-card .btn-ghost { width: 32px; height: 34px; background: #fff; border: 1px solid #dfe7ec; border-radius: 8px; }
.code-card .btn-ghost:hover { background: #f1f6f8; border-color: #b7cbd5; }
.code-card .btn-ghost svg { width: 17px; height: 17px; stroke: #5d7787; }
.code-card .btn-expand svg .fill { fill: #5d7787; }
.code-card .btn-ghost.is-done svg { stroke: #087568; }
.btn-run { display: inline-flex; justify-content: center; align-items: center; gap: 7px; width: auto; min-width: 74px; height: 34px; padding: 0 12px; background: #087568; color: #fff; box-shadow: none; border-radius: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.btn-run svg { flex: none; width: 16px; height: 16px; }
.btn-run svg, .btn-run svg .fill { fill: #fff; }
.btn-run:hover { background: #065e54; }
.btn-run.is-busy { background: #fff0cb; color: #765600; }
.btn-run.is-busy svg, .btn-run.is-busy svg .fill { fill: #765600; }
.code-card[data-state=running] .btn-run { background: #fdecea; color: #a13c33; box-shadow: none; }
.code-card[data-state=running] .btn-run svg, .code-card[data-state=running] .btn-run svg .fill { fill: #a13c33; }
.code-card.is-expanded { height: 655px; background: #fff; }
.code-wrap { margin: 0 12px; border-radius: 10px; background: #152a3a; }
.code-wrap .code { border: 0; border-radius: 10px; background: linear-gradient(90deg, #132635 41px, #2a3e4d 41px, #2a3e4d 42px, transparent 42px), #182d3d; color: #d4e2e9; font-size: 13.5px; line-height: 22px; font-weight: 400; padding-top: 12px; }
.code-editor-footer { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 14px; min-height: 28px; padding: 5px 15px 6px; color: #627583; font-size: 12px; line-height: 17px; }
.code-language { color: #506c7c; font-weight: 500; }
.code-language span { margin: 0 4px; color: #92a3ac; }
.code .str { color: var(--str); }
.code .cm { color: var(--faint); }
.code .param { color: #f1d098; background: #eac39118; box-shadow: inset 0 -1px #eac39180; }
.code .param:hover, .code .param.is-marked { background: #eac3912b; }
.code .param.is-marked { box-shadow: inset 0 0 0 1px #eac391a0; }
.code .line.is-running { background: #8edaba15; }
.console { background: #0f202e; color: #afc4d0; border-top: 1px solid #324a59; }
.console-head { border-color: #263d4d; }
.console-title { color: #b7cbd6; }
.console-status { color: #a4b8c4; }
.console-lines div:last-child { color: #c4e9d8; }

/* Searchable lesson shelf */
.lessons { left: var(--workshop-content-left); right: 18px; bottom: 20px; border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px 18px 12px; box-shadow: var(--shadow); }
.workshop-lessons-heading { display: flex; align-items: center; gap: 16px; margin: 0 0 9px; min-height: 34px; }
.workshop-lessons-heading h2 { margin: 0; font-size: 18px; font-weight: 600; text-transform: none; letter-spacing: -.01em; }
.workshop-search { margin-left: auto; }
.workshop-search input { width: 220px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #f5f8f9; color: var(--navy); font: 400 14px var(--sans); }
.workshop-search input::placeholder { color: #667e8b; }
.workshop-search input:focus { background: #fff; border-color: var(--accent); }
.workshop-progress { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.workshop-search-status { position: static; margin: 0; color: var(--accent-deep); font-size: 13px; line-height: 20px; }
.workshop-search-status:empty { display: none; }
.lesson-list { gap: 12px; min-height: 88px; margin: -8px 38px; padding: 8px 4px; }
.lesson { height: 72px; padding: 0 26px 0 8px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafb; box-shadow: none; }
.lesson:hover { border-color: var(--line); background: #f2f8f5; transform: none; box-shadow: none; }
.lesson.is-active { border: 1px solid var(--accent); background: #edf7f2; box-shadow: inset 0 0 0 1px var(--accent); }
.lesson-title { color: #375263; text-align: left; text-transform: none; font-size: 16px; line-height: 21px; letter-spacing: 0; font-weight: 500; }
.lesson-thumb { height: 64px; margin-right: 10px; }
.lesson-done { width: 16px; height: 16px; top: 8px; right: 7px; border: 1px solid #c9d6dc; background: var(--card); }
.lesson.is-done .lesson-done, .lesson.is-done.is-active .lesson-done { width: 18px; height: 18px; top: 7px; right: 6px; box-shadow: none; background: var(--accent); border: 1px solid var(--accent); }
.lesson-done svg { width: 11px; height: 11px; }
.lesson-step { width: 32px; height: 32px; bottom: 32px; border-radius: 10px; border: 1px solid var(--line); box-shadow: none; }
.lesson-step.prev { left: 16px; }
.lesson-step.next { right: 16px; }

/* Menus and native-script language labels */
.flyout { left: calc(28px + var(--workshop-sidebar-width)); padding: 18px 14px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fffffffa; box-shadow: 0 18px 48px -16px #17384940; }
html:not(.compact) .flyout { top: max(112px, var(--top, 112px)); }
.flyout header { padding-bottom: 14px; margin-bottom: 8px; }
.flyout header h2 { font-size: 20px; font-weight: 600; text-transform: none; letter-spacing: -.02em; }
.fly-list button, .fly-list label { padding: 10px 8px; border-radius: 12px; }
.fly-list button:hover, .fly-list label:hover { background: #f2f7f5; }
.fly-list button.is-current { background: var(--accent-soft); }
.fly-num { border: 1px solid var(--line); background: #fff; border-radius: 9px; font-size: 14px; }
.fly-text b { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.fly-text small { font-size: 14px; line-height: 20px; color: var(--muted); }
.fly-list [lang="ar"] { direction: rtl; unicode-bidi: isolate; }
.flyout[data-kind=language] { width: 480px; }
.lang-list { gap: 8px 12px; }
.fly-mini { border-radius: 9px; }
.loader { background: #f0f3f6; }
.loader:before { background-image: radial-gradient(#b9cec5 1px, transparent 1px); background-size: 24px 24px; }
.loader-title { text-transform: none; letter-spacing: -.03em; }
.loader-fill { background: var(--accent); }
.loader-step { letter-spacing: .02em; color: var(--muted); }

/* Compact mode is selected by the existing viewport and camera code. */
html.compact .artboard { background: var(--bg); padding: 20px 18px calc(140px + env(safe-area-inset-bottom)); gap: 18px; }
html.compact .brand { gap: 12px; }
html.compact .brand-logo { width: 48px; height: 48px; padding: 10px; border-radius: 15px; }
html.compact .brand-text h1 { font-size: 25px; line-height: 30px; }
html.compact .brand-text p { font-size: 14px; line-height: 20px; letter-spacing: 0; }
html.compact .brand-text p { max-width: 480px; }
html.compact .status { border: 1px solid var(--line); border-radius: 16px; height: 62px; }
html.compact .progress-card { width: 190px; gap: 10px; padding: 0 12px; }
html.compact .progress-label { font-size: 14px; }
html.compact .clock { font-size: 13px; padding: 0 12px; }
html.compact .stage { background: #f9fbfc; border: 1px solid var(--line); border-radius: 22px; height: clamp(360px, 58vh, 660px); }
html.compact .workshop-stage-heading { top: 18px; left: 18px; }
html.compact .workshop-stage-heading strong { font-size: 15px; }
html.compact .workshop-stage-heading span { font-size: 13px; }
html.compact .workshop-stage-badge { top: 18px; right: 16px; font-size: 12px; }
html.compact .viewbar { bottom: 12px; }
html.compact .viewbar button { width: 36px; height: 36px; }
html.compact .lessons { padding: 14px 12px; border-radius: 20px; }
html.compact .workshop-lessons-heading { gap: 8px 12px; flex-wrap: wrap; margin: 0 0 12px; }
html.compact .workshop-lessons-heading h2 { font-size: 18px; margin: 0; }
html.compact .workshop-search input { width: 180px; height: 36px; font-size: 16px; }
html.compact .workshop-progress { font-size: 13px; }
html.compact .lesson-list { min-height: 92px; margin: -8px 30px; }
html.compact .lesson { height: 76px; padding: 0 24px 0 7px; }
html.compact .lesson-title { font-size: 15px; line-height: 21px; }
html.compact .lesson-step { width: 30px; height: 34px; bottom: 35px; }
html.compact .lesson-step.prev { left: 10px; }
html.compact .lesson-step.next { right: 10px; }
html.compact .info-card, html.compact .code-card { border-radius: 16px; }
html.compact .lesson-guide-header { padding: 19px 20px 12px; }
html.compact .tabs { gap: 20px; padding: 0 20px; }
html.compact .tabs button { font-size: 14px; padding: 10px 0 12px; flex: 0 0 auto; }
html.compact .info-body { flex: none; padding: 18px 20px 20px; margin: 0; overflow: visible; }
html.compact .info-content { height: auto; overflow: visible; padding: 0; }
html.compact .info-body h2 { font-size: 21px; line-height: 29px; }
html.compact .lede { font-size: 16px; line-height: 25px; }
html.compact .features li { font-size: 14px; line-height: 23px; gap: 10px; }
html.compact .feature-icon, html.compact .feature-icon svg { width: 23px; height: 23px; }
html.compact .pin-table { font-size: 14px; line-height: 21px; }
html.compact .code-card { padding: 0; }
html.compact .code-card header { padding: 12px 14px; }
html.compact .code-wrap .code { font-size: 13.5px; line-height: 22px; max-height: 450px; }
html.compact .sidebar { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); top: auto; width: auto; height: auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: #fffffffa; box-shadow: 0 8px 32px #142c3d1a; overflow: visible; }
html.compact .sidebar-heading { display: none; }
html.compact .side-nav { height: auto; padding: 6px; gap: 4px; flex-direction: row; align-items: stretch; justify-content: flex-start; max-width: none; overflow-x: auto; scrollbar-width: none; }
html.compact .side-nav li, html.compact .side-nav li:nth-child(4) { flex: 0 0 auto; width: auto; margin: 0; padding: 0; border: 0; }
html.compact .side-nav a { flex-direction: row; width: auto; height: 48px; min-height: 48px; padding: 10px 13px; gap: 8px; border-radius: 10px; }
html.compact .side-nav a svg { flex: 0 0 20px; width: 20px; height: 20px; }
html.compact .side-label { width: auto; font-size: 14px; line-height: 22px; white-space: nowrap; }
html:lang(ml) .side-label { line-height: 1.65; }
html.compact .flyout { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); border-radius: 16px; padding: 18px 14px 14px; max-width: 560px; }
html.compact .flyout[data-kind=language] { width: auto; }
@media (max-width: 600px) {
  html.compact .artboard { padding: 18px 12px calc(100px + env(safe-area-inset-bottom)); gap: 14px; }
  html.compact .brand-text h1 { font-size: 25px; }
  html.compact .status { height: 60px; }
  html.compact .progress-card { flex: 1; width: auto; }
  html.compact .workshop-progress, html.compact .workshop-search-status { width: 100%; order: 3; }
  html.compact .workshop-search input { width: 170px; }
  html.compact .lang-list { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  html.compact .workshop-stage-badge { display: none; }
  html.compact .code-file-icon { display: none; }
  html.compact .code-card header { gap: 8px; padding: 12px; flex-wrap: wrap; }
  html.compact .code-file-heading { flex: 1 1 110px; }
  html.compact .code-card header h2 { font-size: 13px; }
  html.compact .features { grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid #e5ecef; border-radius: 10px; overflow: hidden; }
  html.compact .features li { flex-direction: row; align-items: center; border: 0; border-radius: 0; border-bottom: 1px solid #e5ecef; padding: 12px; gap: 12px; font-size: 15px; }
  html.compact .features li:last-child { border-bottom: 0; }
  html.compact .side-nav { justify-content: space-between; overflow: visible; }
  html.compact .side-nav li { flex: 1; }
  html.compact .side-nav a { justify-content: center; width: 100%; padding: 10px 4px; }
  html.compact .side-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  html.compact .side-nav a:is(:hover, :focus-visible) .side-label { clip: auto; overflow: visible; top: -44px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 180px; height: auto; margin: 0; padding: 6px 10px; border: 1px solid #dbe5eb; border-radius: 7px; background: #fff; color: #29485b; font-size: 13px; white-space: normal; box-shadow: 0 4px 12px #142c3d12; }
  html.compact .side-nav li:first-child a:is(:hover, :focus-visible) .side-label { left: 0; transform: none; }
  html.compact .side-nav li:last-child a:is(:hover, :focus-visible) .side-label { left: auto; right: 0; transform: none; }
}
@media (max-width: 380px) {
  html.compact .brand-text h1 { font-size: 22px; }
  html.compact .brand-text p { font-size: 13px; }
  html.compact .workshop-search input { width: 150px; }
  html.compact .tabs { gap: 17px; padding: 0 16px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  html.compact .artboard { padding: 12px 12px 16px 88px; gap: 14px; }
  html.compact .stage { height: calc(100dvh - 24px); top: 12px; }
  html.compact .sidebar { left: 8px; top: 12px; bottom: 12px; right: auto; width: 66px; height: auto; }
  html.compact .side-nav { flex-direction: column; height: 100%; padding: 8px 5px; gap: 5px; }
  html.compact .side-nav li { flex: 0; width: 100%; }
  html.compact .side-nav a { height: 46px; }
  html.compact .side-nav a { min-height: 46px; padding: 8px 2px; }
  html.compact .side-nav a { width: 100%; justify-content: center; }
  html.compact .side-label { display: none; }
  html.compact .flyout { left: 86px; right: auto; top: 12px; bottom: auto; max-height: calc(100dvh - 24px); width: min(400px, calc(100vw - 100px)); }
  html.compact .flyout[data-kind=language] { width: min(480px, calc(100vw - 100px)); }
  html.compact .status { height: 62px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Keep wheel, touch, and keyboard scrolling without visible scrollbar tracks. */
html, body, body * { scrollbar-width: none !important; }
html::-webkit-scrollbar, body::-webkit-scrollbar, body *::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ─── Premium dark splash screen ───────────────────────────────── */
.loader { box-sizing: border-box; position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; padding: 32px 24px; color: #e8f1ef; background: radial-gradient(ellipse at 50% 20%, #0f2a37 0%, #061520 55%, #020a10 100%); transition: opacity .4s ease; isolation: isolate; }
.loader:before { content: none; }
.loader.is-done { opacity: 0; pointer-events: none; }

.loader-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.loader-grid { position: absolute; inset: 0; background-image: linear-gradient(#1a3d4a3a 1px, transparent 1px), linear-gradient(90deg, #1a3d4a3a 1px, transparent 1px); background-size: 42px 42px; -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 85%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 85%); }
.loader-glow { position: absolute; left: 50%; top: 42%; width: 620px; height: 620px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #0c6b5833 0%, transparent 60%); filter: blur(10px); animation: loader-glow-breathe 5s ease-in-out infinite; }
.loader-glow-2 { top: 55%; width: 380px; height: 380px; background: radial-gradient(circle, #67bfff22 0%, transparent 65%); animation-delay: -2s; animation-duration: 7s; }

.loader-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; width: min(560px, 100%); padding: 0; }

/* Hero: chip + rings + sparks */
.loader-hero { position: relative; width: 320px; height: 320px; display: grid; place-items: center; margin-bottom: 20px; }
.loader-rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.loader-rings .lr { opacity: 0; transform-origin: 160px 160px; animation: loader-ring-pulse 3.5s ease-out infinite; }
.loader-rings .lr1 { animation-delay: 0s; }
.loader-rings .lr2 { animation-delay: 1.1s; }
.loader-rings .lr3 { animation-delay: 2.2s; }

.loader-chip { position: relative; width: 132px; height: 132px; display: grid; place-items: center; border-radius: 26px; background: linear-gradient(145deg, #103240, #061b24); border: 1px solid #1f5267; box-shadow: 0 0 0 1px #4de3b81a, 0 0 60px -10px #4de3b866, 0 30px 70px -20px #000a, inset 0 1px 0 #ffffff18; }
.loader-chip:after { content: ""; position: absolute; inset: -6px; border-radius: 30px; border: 1px solid #4de3b833; animation: loader-chip-pulse 2.5s ease-in-out infinite; }
.loader-chip svg { width: 100px; height: 100px; overflow: visible; }
.chip-body { stroke: #2a5d72; stroke-width: 1.2; }
.chip-die { stroke: #3e7a92; stroke-width: .8; }
.chip-radio { fill: none; stroke: #4de3b8; stroke-width: 1.5; stroke-linecap: round; }
.chip-radio-dot { fill: #4de3b8; }
.chip-text { fill: #a7d8c9; font: 700 9px var(--mono); letter-spacing: .16em; }
.chip-pins line { stroke: #94b7bd; stroke-width: 1.8; stroke-linecap: round; }

/* Floating sparks around the chip */
.loader-spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #4de3b8; box-shadow: 0 0 12px #4de3b8; opacity: 0; }
.loader-spark-1 { top: 10%; left: 30%; animation: loader-spark 3s ease-in-out infinite; }
.loader-spark-2 { top: 20%; right: 20%; animation: loader-spark 3s ease-in-out .7s infinite; }
.loader-spark-3 { bottom: 25%; left: 18%; animation: loader-spark 3s ease-in-out 1.4s infinite; background: #67bfff; box-shadow: 0 0 12px #67bfff; }
.loader-spark-4 { bottom: 18%; right: 25%; animation: loader-spark 3s ease-in-out 2.1s infinite; background: #ffd36a; box-shadow: 0 0 12px #ffd36a; }

/* Brand lockup */
.loader-brand { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 20px; color: #e8f1ef; font: 600 15px/1 var(--sans); letter-spacing: -.01em; }
.loader-brand b { color: #4de3b8; font-weight: 600; }
.loader-brand-mark { width: 28px; height: 28px; }

/* Typography */
.loader-headline { margin: 0 0 12px; color: #f1f8fb; font: 600 clamp(30px, 4.5vw, 44px)/1.1 var(--sans); letter-spacing: -.035em; }
.loader-headline em { font-style: normal; background: linear-gradient(135deg, #4de3b8 0%, #67bfff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.loader-sub { margin: 0 auto 32px; max-width: 460px; color: #93b0b9; font: 400 15px/1.55 var(--sans); }

/* Progress */
.loader-progress { width: 100%; max-width: 460px; }
.loader-progress-meta { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 10px; font: 600 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.loader-step { margin: 0; color: #c6dbe1; min-height: 14px; }
.loader-track { position: relative; width: 100%; height: 4px; margin: 0; border-radius: 99px; background: #0d2b35; border: 1px solid #143b47; overflow: hidden; }
.loader-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #4de3b8 0%, #67bfff 100%); box-shadow: 0 0 16px #4de3b899; transform: scaleX(0); transform-origin: 0 50%; transition: transform .4s cubic-bezier(.4,.1,.3,1); }
.loader-fill:after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #ffffff40, transparent); transform: translateX(-100%); animation: loader-fill-shine 1.6s ease-in-out infinite; }
@keyframes loader-fill-shine { to { transform: translateX(100%); } }

/* Feature chips */
.loader-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin-top: 28px; }
.loader-chip-item { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px; background: #0d2b35aa; border: 1px solid #143b47; color: #a9c3cb; font: 500 11px/1 var(--sans); letter-spacing: .02em; backdrop-filter: blur(6px); }
.loader-chip-item i { width: 5px; height: 5px; border-radius: 50%; background: #4de3b8; box-shadow: 0 0 8px #4de3b8; }

/* Failure state */
.loader.is-failed .loader-rings, .loader.is-failed .loader-chips, .loader.is-failed .loader-spark, .loader.is-failed .loader-glow { display: none; }
.loader.is-failed .loader-chip { border-color: #7a2f26; box-shadow: 0 0 0 1px #ff553322, 0 0 60px -10px #ff553366, 0 30px 70px -20px #000a; }
.loader.is-failed .loader-chip:after { border-color: #ff553333; }
.loader.is-failed .chip-text, .loader.is-failed .chip-radio, .loader.is-failed .chip-radio-dot { fill: #ff8a73; stroke: #ff8a73; }
.loader.is-failed .loader-fill { background: linear-gradient(90deg, #ff6b4e, #e04d33); box-shadow: 0 0 16px #ff6b4e99; }
.loader.is-failed .loader-step { color: #ffb4a3; text-transform: none; letter-spacing: 0; font: 500 13px/1.5 var(--sans); max-width: 440px; }

/* Animations */
@keyframes loader-glow-breathe { 0%,100% { opacity: .5; transform: translate(-50%,-50%) scale(1); } 50% { opacity: .95; transform: translate(-50%,-50%) scale(1.1); } }
@keyframes loader-ring-pulse { 0% { transform: scale(.65); opacity: 0; } 20% { opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes loader-chip-pulse { 0%,100% { opacity: .35; transform: scale(1); } 50% { opacity: .85; transform: scale(1.05); } }
@keyframes loader-spark { 0%,100% { opacity: 0; transform: scale(.4) translate(0,0); } 30% { opacity: 1; } 60% { opacity: .5; transform: scale(1.2) translate(10px, -15px); } 100% { opacity: 0; transform: scale(.3) translate(20px, -30px); } }

@media (max-width: 640px) {
  .loader { padding: 24px 18px; }
  .loader-hero { width: 240px; height: 240px; margin-bottom: 16px; }
  .loader-chip { width: 108px; height: 108px; border-radius: 22px; }
  .loader-chip svg { width: 82px; height: 82px; }
  .loader-headline { font-size: 28px; }
  .loader-sub { font-size: 14px; margin-bottom: 24px; }
  .loader-chips { gap: 8px 16px; margin-top: 22px; }
}
@media (max-width: 380px) {
  .loader-hero { width: 200px; height: 200px; }
  .loader-chip { width: 92px; height: 92px; border-radius: 18px; }
  .loader-chip svg { width: 70px; height: 70px; }
  .loader-headline { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .loader-glow, .loader-rings .lr, .loader-chip:after, .loader-spark, .loader-fill:after { animation: none !important; opacity: .6; }
}

/* Author block — minimal, matches sidebar typography */
.sidebar { display: flex; flex-direction: column; }
.sidebar .side-nav { flex: 1 0 auto; }
.side-author { margin: 8px 2px 14px; padding: 16px 12px 4px; border-top: 1px solid #eaf0ec; display: flex; flex-direction: column; gap: 10px; }
.side-author-kicker { margin: 0; font: 600 10px/1 var(--sans); color: #7a8e95; letter-spacing: .18em; text-transform: uppercase; }
.side-author-name { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 0; color: #0f2e3f; text-decoration: none; font: 600 13.5px/1.25 var(--sans); letter-spacing: -.01em; transition: color .15s ease; }
.side-author-name span { color: #087568; font-weight: 700; font-size: 14px; transition: transform .2s ease; }
.side-author-name:hover { color: #087568; }
.side-author-name:hover span { transform: translateX(3px); }
.side-author-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.side-author-row a { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: transparent; color: #6a7d8b; text-decoration: none; transition: background .15s ease, color .15s ease; }
.side-author-row a svg { width: 15px; height: 15px; }
.side-author-row a:hover { background: #e3f2ec; color: #087568; }

/* Compact sidebar keeps it minimal — just the icons */
html.compact .side-author { padding: 10px 4px 2px; margin: 4px 2px; gap: 6px; align-items: center; }
html.compact .side-author-kicker, html.compact .side-author-name span { display: none; }
html.compact .side-author-name { font-size: 0; justify-content: center; }
html.compact .side-author-name::before { content: "G"; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #087568, #39a98a); color: #fff; font: 700 13px var(--sans); }
html.compact .side-author-row { flex-direction: column; gap: 2px; }

.side-desert { display: none; }