/*
 * Multimeter Lab — design system
 * Layout concept: an anti-static (ESD) workbench mat. Teal-green dotted surface,
 * the yellow meter is the one loud object; controls feel like hardware keys
 * (a bevel that presses down), readouts use the meter's LCD green.
 * Single committed dark look (a real lab mat is dark), so no light theme.
 */
:root {
  --mat: #160F23;
  --mat-2: #1b1230;
  --mat-dot: rgba(220, 205, 255, .05);
  --surface: #261637;
  --surface-2: #2e1b44;
  --surface-3: #382254;
  --line: rgba(196, 168, 255, .22);
  --line-2: rgba(196, 168, 255, .34);
  --ink: #f3eefa;
  --muted: #b8aad2;
  --yellow: #D5AD59;
  --yellow-2: #ecc879;
  --yellow-ink: #2a1e00;
  --lcd: #b9e3c6;
  --lcd-ink: #16201a;
  --red: #e0453f;
  --ok: #4cc38a;
  --warn: #f0b429;
  --danger: #ef5d58;
  --info: #7cc6fe;
  --f-display: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --f-body: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 16px;
  --r-sm: 11px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 6px rgba(0, 0, 0, .35), 0 14px 30px -14px rgba(0, 0, 0, .75);
  --gut-l: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --tabbar: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--f-body); font-size: 15px; line-height: 1.6; color: var(--ink);
  background-color: var(--mat);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(166, 107, 235, .07), transparent 60%),
    radial-gradient(var(--mat-dot) 1.2px, transparent 1.3px);
  background-size: auto, 18px 18px;
  background-attachment: fixed, scroll;
}
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.25; text-wrap: balance; margin: 0; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(166, 107, 235, .35); }

/* ───────── icons ───────── */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
h2 .ic { width: 22px; height: 22px; color: var(--yellow); vertical-align: -4px; }

/* ───────── buttons: hardware keys ───────── */
.btn {
  --bev: #0d0816;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px; border-radius: 12px;
  border: 1px solid var(--line-2); color: var(--ink);
  background: linear-gradient(180deg, #2f1d47, #24163a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 0 var(--bev), 0 6px 14px -8px rgba(0, 0, 0, .6);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: rgba(166, 107, 235, .55); background: linear-gradient(180deg, #382357, #2a1a42); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 0 0 var(--bev); }
.btn.primary {
  --bev: #a87406; color: var(--yellow-ink); border-color: transparent;
  background: linear-gradient(180deg, var(--yellow-2), #eea70c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 3px 0 var(--bev), 0 10px 24px -10px rgba(166, 107, 235, .55);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffd35e, #f5b41a); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .04); }
.btn.ghost:active { transform: translateY(1px); }
.btn.danger { --bev: #8f2622; background: linear-gradient(180deg, #f06c66, #d84a44); color: #fff; border-color: transparent; }
.btn.danger-ghost { background: transparent; box-shadow: none; border-color: rgba(239, 93, 88, .5); color: #ffb3b0; }
.btn.danger-ghost:hover { background: rgba(239, 93, 88, .1); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 14px; border-radius: 10px; gap: 6px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn.icon { padding: 4px 9px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn .kbd { font: 600 11px var(--f-mono); opacity: .7; }

/* ───────── fields ───────── */
input[type="text"], input[type="number"], input:not([type]), .field {
  min-height: 44px; width: 100%; padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: #120b1e; color: var(--ink); font: inherit;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35);
  transition: border-color .15s, box-shadow .15s;
}
input:hover { border-color: rgba(166, 107, 235, .45); }
input:focus { outline: none; border-color: var(--yellow); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35), 0 0 0 3px rgba(166, 107, 235, .22); }
input[type="number"] { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="checkbox"] { accent-color: var(--yellow); width: 18px; height: 18px; }
label { font-weight: 500; }

/* ───────── top bar & navigation ───────── */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--surface); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding-block: 8px; padding-left: var(--gut-l); padding-right: var(--gut-r);
  background: rgba(22, 15, 35, .92); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand svg { transition: transform .3s; }
.brand:hover svg { transform: rotate(-8deg); }
.nav { display: flex; gap: 2px; margin-inline-start: auto; padding: 3px; border-radius: 14px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; transition: color .15s, background .15s; }
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"] { color: var(--yellow-ink); background: var(--yellow); box-shadow: 0 2px 0 #a87406; }
.top-actions { display: flex; gap: 4px; align-items: center; }
.top-actions .btn { box-shadow: none; }

/* ───────── views ───────── */
.view-in { animation: viewin .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

/* ───────── home ───────── */
.home { max-width: 1200px; margin: 0 auto; padding-block: 28px 70px; padding-left: var(--gut-l); padding-right: var(--gut-r); display: grid; gap: 44px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--yellow); font-weight: 600; letter-spacing: .02em; margin: 0 0 10px; }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(76, 195, 138, .18); animation: blink 2.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hero h1 { font-size: clamp(30px, 4.6vw, 50px); font-weight: 700; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: var(--yellow); }
.lead-p { color: var(--muted); max-width: 58ch; font-size: 16.5px; margin: 14px 0 24px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: flex; gap: 26px; margin-top: 28px; align-items: center; flex-wrap: wrap; }
.stat { display: grid; }
.stat b { font-family: var(--f-display); font-size: 30px; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.15; }
.stat small { color: var(--muted); font-size: 16px; font-weight: 500; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat-ring { display: flex; align-items: center; gap: 12px; }

.ring { display: block; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--yellow); stroke-width: 7; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; animation: ringin 1.1s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 6px rgba(166, 107, 235, .35)); }
@keyframes ringin { from { stroke-dashoffset: var(--c); } }
.ring-t { fill: var(--ink); font: 700 17px var(--f-display); }

/* hero visual: a tiny live bench */
.hero-vis { position: relative; border-radius: 26px; padding: 18px; display: grid; gap: 14px; background: linear-gradient(160deg, #2a1940, #1a1029); border: 1px solid var(--line-2); box-shadow: var(--shadow); overflow: hidden; }
.hero-vis::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(220, 205, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(220, 205, 255, .04) 1px, transparent 1px); background-size: 26px 26px; pointer-events: none; }
.hv-svg { width: 100%; height: auto; display: block; position: relative; z-index: 1; direction: ltr; }
.hv-wire { fill: none; stroke: #c98a3a; stroke-width: 4; stroke-linejoin: round; }
.hv-flow { fill: none; stroke: #fff3b0; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1 18; animation: flow 1.4s linear infinite; opacity: .9; }
@keyframes flow { to { stroke-dashoffset: -38; } }
.hv-led { animation: ledpulse 2.8s ease-in-out infinite; }
@keyframes ledpulse { 50% { opacity: .55; } }
.hv-lcd {
  position: relative; z-index: 1; direction: ltr; display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 10px;
  background: var(--lcd); color: var(--lcd-ink); border-radius: 10px; padding: 10px 16px;
  box-shadow: inset 0 0 0 6px #17191c, inset 0 8px 18px rgba(0, 0, 0, .18), 0 0 30px rgba(150, 240, 200, .16);
}
.hv-lcd .m { font: 700 12px var(--f-mono); align-self: start; padding-top: 6px; }
.hv-lcd b { font: italic 700 clamp(40px, 5.5vw, 60px) var(--f-mono); letter-spacing: .04em; text-align: end; line-height: 1; }
.hv-lcd .u { font: 700 18px var(--f-mono); padding-bottom: 4px; min-width: 34px; }
.hv-lcd.tick b { animation: lcdflick .25s steps(2); }
@keyframes lcdflick { 50% { opacity: .25; } }
.hv-cap { position: relative; z-index: 1; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.hv-cap b { color: var(--ink); }

/* levels & mission cards */
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { font-size: 24px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); }
.levels { display: grid; gap: 28px; }
.level { display: grid; gap: 12px; }
.level-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.level-badge { font: 700 12px var(--f-mono); letter-spacing: .08em; padding: 4px 10px; border-radius: 8px; background: var(--lcd); color: var(--lcd-ink); box-shadow: inset 0 0 0 2px #17191c; }
.level-head h3 { font-size: 19px; }
.level-prog { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; min-width: 160px; }
.level-prog small { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w, 0%); border-radius: 8px; background: linear-gradient(90deg, var(--ok), #8fe3b9); animation: barin 1s cubic-bezier(.2, .8, .2, 1); }
@keyframes barin { from { width: 0; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mcard {
  --tilt-x: 0deg; --tilt-y: 0deg;
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r);
  background: linear-gradient(170deg, var(--surface-3), var(--surface)); border: 1.5px solid rgba(196, 168, 255, .34);
  box-shadow: var(--shadow); text-decoration: none; overflow: hidden;
  transform: perspective(700px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.mcard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(166, 107, 235, .12), transparent 45%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.mcard:hover { border-color: rgba(166, 107, 235, .5); box-shadow: var(--shadow), 0 16px 34px -14px rgba(0, 0, 0, .7); }
.mcard:hover::before { opacity: 1; }
.mcard:focus-visible { outline-offset: 3px; }
.mcard.done { border-color: rgba(76, 195, 138, .75); }
.mcard.free { background: linear-gradient(170deg, rgba(166, 107, 235, .16), rgba(166, 107, 235, .04) 55%), var(--surface); border: 2px dashed rgba(166, 107, 235, .8); box-shadow: var(--shadow); }
.mcard.free:hover { border-color: rgba(166, 107, 235, .85); }
.mc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mc-lcd { direction: ltr; min-width: 52px; text-align: center; padding: 3px 10px; border-radius: 8px; background: var(--lcd); color: var(--lcd-ink); font: italic 700 15px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; }
.mcard.free .mc-lcd { background: #2b2f34; color: var(--yellow); box-shadow: none; font-style: normal; }
.mc-num { font: 700 13px var(--f-mono); color: var(--muted); letter-spacing: .06em; }
.mc-done { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #062014; }
.mc-done .ic { width: 14px; height: 14px; stroke-width: 3; }
.mcard h3 { font-size: 18px; }
.mcard p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.mc-foot { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; border-top: 1px dashed var(--line); padding-top: 10px; }
.mc-foot .mstars { margin-inline-start: auto; }
.diff { display: inline-flex; gap: 2px; align-items: end; height: 12px; }
.diff i { width: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); }
.diff i:nth-child(1) { height: 5px; } .diff i:nth-child(2) { height: 8px; } .diff i:nth-child(3) { height: 12px; }
.diff[data-d="1"] i:nth-child(-n+1), .diff[data-d="2"] i:nth-child(-n+2), .diff[data-d="3"] i:nth-child(-n+3) { background: var(--yellow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #d6cceb; }
.mstars, .big-stars { direction: ltr; text-align: right; white-space: nowrap; }
.star { color: rgba(236, 228, 248, .18); font-size: 17px; }
.star.on { color: var(--yellow); text-shadow: 0 0 10px rgba(166, 107, 235, .45); }

/* ───────── lab layout ───────── */
.lab {
  position: relative; display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 280px; grid-template-areas: "panel bench meter";
  gap: 16px; max-width: 1460px; margin: 0 auto;
  padding-block: 16px 28px; padding-left: var(--gut-l); padding-right: var(--gut-r); align-items: start;
}
.panel { grid-area: panel; }
.bench-wrap { grid-area: bench; min-width: 0; display: grid; gap: 10px; }
.meter-wrap { grid-area: meter; display: grid; gap: 10px; justify-items: center; }
.bench {
  background: var(--mat-2);
  background-image: linear-gradient(rgba(220, 205, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(220, 205, 255, .045) 1px, transparent 1px);
  background-size: 32px 32px; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .25), var(--shadow);
  padding: 8px; user-select: none; -webkit-user-select: none;
}
.bench-svg { display: block; width: 100%; height: auto; overflow: visible; }
.live { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: #ddd3ee; min-height: 52px; box-shadow: var(--shadow); }
.live > span:last-child { flex: 1; min-width: 0; }
.live b { color: var(--ink); }
.live .w { color: var(--warn); font-weight: 600; }
.mode-chip { flex: none; direction: ltr; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 7px; background: var(--lcd); color: var(--lcd-ink); font: italic 700 13px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; margin-top: 1px; }
.mode-chip.off { background: #3a3f44; color: #9aa0a6; font-style: normal; }

.meter { width: 100%; max-width: 280px; user-select: none; -webkit-user-select: none; border-radius: 36px; transition: box-shadow .2s; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .45)); }
.meter.beeping { box-shadow: 0 0 0 4px rgba(76, 195, 138, .55), 0 0 30px rgba(76, 195, 138, .35); }
.meter.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.meter-svg { display: block; width: 100%; height: auto; direction: ltr; }
.fuses { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; font-size: 12.5px; }
.fuse { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); }
.fuse::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.fuse.ok { color: #a9d9c1; }
.fuse.bad { color: #fff; background: rgba(239, 93, 88, .25); border-color: var(--danger); }

/* ───────── bench SVG parts ───────── */
.plabel { fill: var(--ink); font: 600 15px var(--f-body); }
.plabel.small { font-size: 12.5px; fill: #ddd0f0; }
.plabel.on { fill: var(--ok); }
.tag { fill: #1c1f22; stroke: var(--yellow); stroke-width: 2; }
.tag-t { fill: var(--yellow); font: 700 17px var(--f-display); }
.bat-big { fill: #1d1f22; font: 700 30px var(--f-display); }
.bat-small { fill: #2a1a08; font: 600 10px var(--f-mono); letter-spacing: .12em; }
.bat-pol { fill: #f2f2f2; font: 700 15px var(--f-mono); }
.bat-pol.dark { fill: #1d1f22; }
.aa-t { fill: #f1e6d7; font: 700 12px var(--f-mono); }
.chip-t { fill: #9aa0a6; font: 600 9px var(--f-mono); }
.hole-n { fill: #3a3d38; font: 700 15px var(--f-display); }
.danger-t { fill: #1d1f22; font: 800 14px var(--f-mono); }
.lead { stroke-width: 4; fill: none; stroke-linecap: round; }
.lead.metal { stroke: #b7bec6; }
.lead.metal.thick { stroke-width: 7; }
.lead.red { stroke: #d7322f; stroke-width: 5; }
.lead.black { stroke: #111; stroke-width: 5; }
.wire { fill: none; stroke: #c98a3a; stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round; }
.tappable { cursor: pointer; }
.tappable:hover .plabel, .tappable:focus-visible .plabel { fill: var(--yellow); }
.term { cursor: pointer; }
.term-ring { fill: rgba(255, 255, 255, .08); stroke: rgba(166, 107, 235, .55); stroke-width: 2; stroke-dasharray: 3 3; transition: r .15s; }
.term-dot { fill: #e9eef2; }
.term-hit { fill: transparent; }
.term:hover .term-ring, .term.near .term-ring { stroke: var(--yellow); stroke-dasharray: none; stroke-width: 3; r: 13px; }
.term.has-red .term-ring { stroke: #ff5a52; stroke-dasharray: none; stroke-width: 3; fill: rgba(224, 69, 63, .3); }
.term.has-black .term-ring { stroke: #fff; stroke-dasharray: none; stroke-width: 3; fill: rgba(0, 0, 0, .45); }

/* ───────── meter SVG ───────── */
.mbrand { font: 700 12px var(--f-mono); letter-spacing: .18em; fill: #c3c9cf; }
.lcd { fill: #93a58c; transition: fill .3s; }
.lcd.lit { fill: #b9f0d6; filter: drop-shadow(0 0 6px rgba(150, 240, 200, .55)); }
.lcd.dead { fill: #7c8775; }
.seg { fill: #18210f; opacity: .07; }
.seg.on { opacity: .95; }
.lcd-ind { fill: #1a2316; font: 700 10.5px var(--f-mono); }
.lcd-unit { fill: #1a2316; font: 700 14px var(--f-mono); }
.tick { stroke: #7d848c; stroke-width: 2; }
.dial-hit { fill: transparent; cursor: pointer; }
.dial-pos { cursor: pointer; }
.dial-t { fill: #e6ebef; font: 600 11.5px var(--f-mono); pointer-events: none; }
.dial-t.sm { font-size: 10px; }
.dial-pos.off .dial-t { fill: #ff7a6e; font-weight: 700; }
.dial-pos:hover .dial-t { fill: var(--yellow); }
.dial-pos.sel .dial-t { fill: var(--yellow); font-weight: 800; }
.garc { fill: none !important; stroke-width: 3; stroke-linecap: round; }
.gsym { font: 700 11px var(--f-mono); letter-spacing: .04em; }
.g-VDC { stroke: #ffd166; fill: #ffd166; }
.g-ADC { stroke: #ff8a80; fill: #ff8a80; }
.g-CONT { stroke: #c3a6ff; fill: #c3a6ff; }
.g-OHM { stroke: #7cc6fe; fill: #7cc6fe; }
.g-VAC { stroke: #b8e986; fill: #b8e986; }
.knob { cursor: grab; touch-action: none; }
.knob:active { cursor: grabbing; }
.knob-ptr { transform-box: view-box; transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.ridge { stroke: #0e0f11; stroke-width: 2; }
.jack { cursor: pointer; }
.jack-hit { fill: transparent; }
.jack-t { fill: #e6ebef; font: 700 11.5px var(--f-mono); }
.jack:hover .jack-t { fill: var(--yellow); }
.plug { fill: transparent; pointer-events: none; }
.plug.in-red { fill: #d7322f; stroke: #ff8a85; stroke-width: 2; }
.plug.in-black { fill: #2a2c30; stroke: #8b9097; stroke-width: 2; }
.fine { fill: #8b939b; font: 600 8.5px var(--f-mono); letter-spacing: .08em; }
.mbtn { cursor: pointer; }
.mbtn-r { fill: #41474f; stroke: #23272b; }
.mbtn-r.light { fill: #c99512; }
.mbtn-r.active { fill: var(--yellow); }
.mbtn-t { fill: #f1f3f4; font: 700 11px var(--f-mono); pointer-events: none; }
.mbtn-r.active + .mbtn-t { fill: #241a00; }

/* ───────── probes & leads ───────── */
.leads { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: visible; }
.lead-path { fill: none; stroke-width: 6; stroke-linecap: round; }
.lead-path.red { stroke: #cf2f2b; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.lead-path.black { stroke: #0c0d0f; filter: drop-shadow(0 0 1.2px rgba(225, 212, 255, .55)); }
.probe { position: absolute; z-index: 6; width: 28px; height: 132px; transform-origin: 14px 132px; cursor: grab; touch-action: none; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .45)); }
.probe svg { display: block; }
.probe.dragging { cursor: grabbing; z-index: 7; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .5)); }
.probe.sel::after { content: ""; position: absolute; left: -8px; right: -8px; top: 6px; bottom: 30px; border: 2px dashed var(--yellow); border-radius: 12px; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

/* ───────── panel ───────── */
.panel { background: linear-gradient(175deg, var(--surface-3), var(--surface) 40%); border: 1.5px solid rgba(196, 168, 255, .32); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-head h2 { font-size: 19px; display: flex; align-items: center; gap: 10px; }
.pnum { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--lcd); color: var(--lcd-ink); font: italic 700 14px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; flex: none; }
.p-toggle { display: none; }
.progress { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #8fe3b9); border-radius: 6px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.p-current { display: none; margin: 0; font-weight: 600; font-size: 14.5px; }
.panel-body { display: grid; gap: 12px; }
.p-brief { margin: 0; color: #ddd3ee; }
.p-warn { display: flex; gap: 8px; margin: 0; padding: 9px 12px; border-radius: var(--r-sm); background: rgba(240, 180, 41, .1); border: 1px solid rgba(240, 180, 41, .4); color: #ffd98a; font-size: 14px; }

/* steps as a timeline */
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tasks li { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 8px 10px 14px; border-radius: 12px; color: var(--muted); font-size: 14.5px; }
.tasks li:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 21px; top: 34px; bottom: -6px; width: 2px; background: var(--line-2); }
.tasks li.done:not(:last-child)::before { background: var(--ok); }
.tasks li.cur { background: rgba(166, 107, 235, .07); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(166, 107, 235, .35); }
.tasks li.done { color: #a6d4bd; }
.tick-box { position: relative; z-index: 1; flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--f-mono); border: 2px solid currentColor; background: var(--surface); }
.tick-box .ic { width: 14px; height: 14px; stroke-width: 3; }
.tasks li.done .tick-box { background: var(--ok); color: #062014; border-color: var(--ok); animation: popin .35s cubic-bezier(.3, 1.6, .5, 1); }
.tasks li.cur .tick-box { border-color: var(--yellow); color: var(--yellow); box-shadow: 0 0 0 0 rgba(166, 107, 235, .5); animation: ping 1.6s infinite; }
@keyframes popin { from { transform: scale(.4); } }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(166, 107, 235, 0); } 100% { box-shadow: 0 0 0 0 rgba(166, 107, 235, 0); } }
.p-row { display: flex; gap: 8px; flex-wrap: wrap; }
.p-hint { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(124, 198, 254, .08); border: 1px solid rgba(124, 198, 254, .3); color: #d7ecff; font-size: 14px; animation: viewin .3s; }
.p-hint .ic { color: var(--info); margin-top: 2px; }
.p-free h4 { font-size: 15px; margin-bottom: 6px; }
.p-free ul { margin: 0; padding-inline-start: 18px; color: #ddd3ee; font-size: 14px; display: grid; gap: 4px; }
.p-question { padding: 14px; border-radius: 14px; background: linear-gradient(160deg, #33204d, #22152f); border: 1px solid rgba(166, 107, 235, .5); display: grid; gap: 10px; animation: viewin .4s; }
.p-question h4 { display: flex; align-items: center; gap: 8px; color: var(--yellow); font-size: 15px; }
.p-question p { margin: 0; }
.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.ans { min-height: 44px; padding: 8px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; box-shadow: 0 2px 0 #0d0816; transition: transform .08s, border-color .15s, background .15s; text-align: center; }
.ans:hover:not(:disabled) { border-color: var(--yellow); background: var(--surface-2); }
.ans:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.ans.right { background: var(--ok); color: #062014; border-color: var(--ok); animation: popin .35s cubic-bezier(.3, 1.6, .5, 1); }
.ans.wrong { background: rgba(239, 93, 88, .2); border-color: var(--danger); animation: shake .4s; }

/* ───────── tables ───────── */
.ctable, .rtable { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.ctable th, .ctable td, .rtable th, .rtable td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.ctable th { color: var(--muted); font-weight: 600; }
.ctable.compact { font-size: 13px; }
.ctable.compact td, .ctable.compact th { padding: 3px 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-inline-end: 8px; vertical-align: -2px; border: 1px solid rgba(255, 255, 255, .25); }
.rtable th { width: 42%; color: #ddd3ee; font-weight: 600; }
.rtable td { direction: ltr; text-align: right; font-family: var(--f-mono); font-size: 13px; }

/* ───────── drawer ───────── */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-bg { position: absolute; inset: 0; background: rgba(8, 5, 14, .6); backdrop-filter: blur(2px); animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.drawer-in {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%);
  background: var(--surface); border-inline-start: 1px solid var(--line); overflow-y: auto;
  padding-block: calc(env(safe-area-inset-top, 0px) + 16px) calc(env(safe-area-inset-bottom, 0px) + 30px);
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: grid; gap: 22px; align-content: start; animation: slidein .28s cubic-bezier(.2, .8, .2, 1); box-shadow: -30px 0 60px rgba(0, 0, 0, .4);
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -16px; background: var(--surface); padding-block: 6px; z-index: 1; }
.drawer-in section { display: grid; gap: 8px; }
.drawer-in h3 { font-size: 17px; color: var(--yellow); }
.drawer-in p, .drawer-in li, .drawer-in dd { color: #e2daf0; font-size: 14.5px; }
.drawer-in ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.drawer-in .btn { justify-self: start; }
.concepts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; }
.concepts dt { font-family: var(--f-display); font-weight: 700; white-space: nowrap; }
.concepts dd { margin: 0; }
.ohm { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.ohm-out { grid-column: 1 / -1; padding: 10px 12px; border-radius: 10px; background: #1c1f22; font-size: 15px; }
.ohm-out b { color: var(--yellow); font-family: var(--f-mono); }

/* ───────── modal ───────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 5, 14, .72); backdrop-filter: blur(3px); padding: 16px; padding-left: var(--gut-l); padding-right: var(--gut-r); animation: fadein .2s; }
.modal-in { width: min(580px, 100%); max-height: 90vh; overflow-y: auto; background: linear-gradient(175deg, var(--surface-3), var(--surface) 35%); border: 1px solid var(--line-2); border-radius: 22px; padding: 26px; animation: pop .3s cubic-bezier(.3, 1.4, .5, 1); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.finish { display: grid; gap: 12px; }
.big-stars { text-align: center; }
.big-stars .star { font-size: 48px; display: inline-block; }
.big-stars .star.on { animation: starpop .5s cubic-bezier(.3, 1.8, .5, 1) backwards; }
.big-stars .star:nth-child(2) { animation-delay: .15s; } .big-stars .star:nth-child(3) { animation-delay: .3s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.finish h2 { text-align: center; font-size: 22px; }
.finish .meta { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.finish .meta span { display: inline-flex; align-items: center; gap: 6px; }
.finish h3 { font-size: 16px; color: var(--yellow); }
.why { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); font-size: 14.5px; }
.learned { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: #e2daf0; }
.learned li { display: flex; gap: 10px; }
.learned li .ic { color: var(--ok); margin-top: 3px; }
.new-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.new-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(166, 107, 235, .14); border: 1px solid rgba(166, 107, 235, .5); color: #ffe3a3; font-weight: 600; animation: popin .5s cubic-bezier(.3, 1.6, .5, 1) .4s backwards; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.name-form { display: grid; gap: 8px; }
.name-form p { margin: 0 0 6px; color: var(--muted); }

/* ───────── toasts ───────── */
.toasts {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: var(--tabbar); pointer-events: none;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); padding-left: var(--gut-l); padding-right: var(--gut-r);
  display: grid; gap: 8px; justify-items: center; grid-template-columns: minmax(0, 1fr);
}
.toast {
  --life: 6s; position: relative; overflow: hidden;
  pointer-events: auto; width: min(560px, 100%); max-width: 100%; min-width: 0; display: flex; gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: 14px; background: rgba(20, 13, 32, .96); border: 1px solid var(--line-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45); font-size: 14px; animation: toastin .35s cubic-bezier(.3, 1.4, .5, 1); transition: opacity .4s, transform .4s;
}
@keyframes toastin { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.toast::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .5; transform-origin: left; animation: life var(--life) linear forwards; }
[dir="rtl"] .toast::after { transform-origin: right; }
@keyframes life { to { transform: scaleX(0); } }
.toast > span { flex: 1; min-width: 0; color: var(--ink); }
.toast .t-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; background: rgba(255, 255, 255, .06); }
.toast.info { color: var(--info); }
.toast.danger { color: var(--danger); background: rgba(42, 18, 18, .97); border-color: rgba(239, 93, 88, .6); --life: 9s; }
.toast.warn { color: var(--warn); background: rgba(42, 34, 16, .97); border-color: rgba(240, 180, 41, .55); }
.toast.ok { color: var(--ok); border-color: rgba(76, 195, 138, .55); }
.toast.out { opacity: 0; transform: translateY(10px); }
.toast .x { display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; }
.toast .x:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
.spark { position: absolute; z-index: 8; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff 0, #ffe066 30%, #ff7b00 60%, transparent 70%); animation: spark .8s ease-out forwards; }
.spark.big { animation-duration: .9s; background: radial-gradient(circle, #fff 0, #fff3b0 25%, #ff5a00 55%, rgba(60, 60, 60, .5) 68%, transparent 72%); }
@keyframes spark { 0% { transform: scale(1); opacity: 1; } 30% { transform: scale(14); opacity: 1; } 100% { transform: scale(22); opacity: 0; } }

/* ───────── power supply, boards, car, kettle ───────── */
.sup-title { fill: #aab3ba; font: 700 9.5px var(--f-mono); letter-spacing: .12em; }
.sup-v { fill: #64f0a5; font: 700 26px var(--f-mono); }
.sup-i { fill: #ffd166; font: 700 17px var(--f-mono); }
.sup-b { fill: #f1f3f4; font: 700 14px var(--f-body); pointer-events: none; }
.sup-b.dark, .sup-sm.dark { fill: #241a00; }
.sup-sm { fill: #aab3ba; font: 600 10.5px var(--f-mono); pointer-events: none; }
.sup-btn:hover rect { filter: brightness(1.15); }
.cap-t { fill: #f1f5fb; font: 700 13px var(--f-mono); }
.cap-t.sm { font-size: 11px; opacity: .8; }
.cap-minus { fill: #1d3566; font: 800 15px var(--f-mono); }
.pot-t { fill: #e6efff; font: 700 13px var(--f-mono); }
.chip-t.big { font-size: 12px; fill: #b7bdc4; }
.car-big { fill: #e6ebef; font: 700 34px var(--f-display); }
.scene-label { fill: var(--yellow); font: 700 15px var(--f-display); }
.vibe { animation: vibe .25s infinite alternate; }
@keyframes vibe { to { transform: translateY(2px); } }

/* ───────── analog meter ───────── */
.a-face { fill: #f3efe0; }
.a-arc { fill: none; stroke: #1b1d1f; stroke-width: 1.6; }
.a-arc.ohm { stroke: #18794e; }
.a-mirror { fill: none; stroke: #b9c2c9; stroke-width: 6; opacity: .75; }
.a-tk { stroke: #1b1d1f; stroke-width: 1.6; }
.a-tk.thin { stroke-width: .9; }
.a-tk.ohm { stroke: #18794e; }
.a-t { fill: #1b1d1f; font: 700 10px var(--f-mono); }
.a-t.sm { font-size: 8.5px; font-weight: 600; fill: #3b3f44; }
.a-t.ohm { fill: #18794e; font-size: 9.5px; }
.a-lbl { fill: #1b1d1f; font: 700 11px var(--f-mono); }
.a-lbl.ohm { fill: #18794e; font-size: 15px; }
.a-lbl.sm { font-size: 8.5px; fill: #6b6f74; letter-spacing: .06em; }
.needle-l { stroke: #c62828; stroke-width: 2.4; stroke-linecap: round; }
.meter-switch { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; background: rgba(0, 0, 0, .25); }
.meter-switch button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--muted); padding: 6px 18px; border-radius: 9px; font-weight: 600; cursor: pointer; min-height: 34px; transition: color .2s, background .2s; }
.meter-switch button[aria-pressed="true"] { background: var(--yellow); color: var(--yellow-ink); box-shadow: 0 2px 0 #a87406; }

/* ───────── V–I chart ───────── */
.p-chart { display: grid; gap: 8px; justify-items: start; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.p-chart h4 { font-size: 15px; }
.chart { width: 100%; max-width: 440px; height: auto; display: block; background: #120b1e; border-radius: 8px; direction: ltr; }
.ch-grid { stroke: rgba(225, 212, 255, .08); }
.ch-axis { stroke: rgba(225, 212, 255, .5); stroke-width: 1.2; }
.ch-t { fill: #a99bc4; font: 600 9.5px var(--f-mono); }
.ch-ax { fill: #ddd3ee; font: 600 10px var(--f-body); }
.ch-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.ch-line.r, .ch-dot.r { stroke: #ffd166; }
.ch-line.led, .ch-dot.led { stroke: #ff6b70; }
.ch-dot { fill: #120b1e; stroke-width: 2.4; animation: popin .3s; transform-box: fill-box; transform-origin: center; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; }
.lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-inline-end: 6px; vertical-align: -1px; border: 2.4px solid; }
.lg.r::before { border-color: #ffd166; }
.lg.led::before { border-color: #ff6b70; }
.p-rechint { margin: 0; font-size: 13px; color: #ddd3ee; font-variant-numeric: tabular-nums; }

/* ───────── exam mode ───────── */
.exam-bar { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(240, 180, 41, .16); border: 1px solid var(--warn); color: #ffd98a; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-bar.urgent { background: rgba(239, 93, 88, .25); border-color: var(--danger); color: #fff; animation: pulse .6s infinite alternate; }
.exam-home { padding: 20px; border-radius: var(--r); background: rgba(240, 180, 41, .1); border: 1px solid rgba(240, 180, 41, .45); display: grid; gap: 6px; }
.exam-home h2 { font-size: 24px; }
.exam-home p { margin: 0; color: #e8dcc0; }
.mcard.locked { opacity: .6; pointer-events: none; }

/* ───────── certificate ───────── */
.cert { background: #f6f1e1; color: #1d2a28; border-radius: 14px; padding: 10px; }
.cert-in { border: 3px double #b88a1a; border-radius: 10px; padding: 26px 20px; text-align: center; display: grid; gap: 8px; }
.cert-in p { margin: 0; }
.cert-eyebrow { color: #8a6a12; font-weight: 700; letter-spacing: .05em; }
.cert h2 { font-size: 30px; color: #1d2a28; }
.cert-name { font-family: var(--f-display); font-size: 28px; font-weight: 700; color: #0f4d3a; border-bottom: 2px solid #b88a1a; padding-bottom: 4px; margin: 4px auto !important; min-width: 60%; }
.cert-skills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.cert-skills span { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid #b88a1a; color: #5b4510; }
.cert-date { color: #5b6b67; font-size: 13px; margin-top: 8px !important; }
.cert-label { display: block; margin-top: 12px; font-size: 14px; color: var(--muted); }
.cert-note { margin: 0; color: var(--muted); font-size: 14px; }
@media print {
  body.printing-cert * { visibility: hidden; }
  body.printing-cert .cert, body.printing-cert .cert * { visibility: visible; }
  body.printing-cert .cert { position: fixed; inset: 0; margin: auto; width: 90%; height: fit-content; }
}

/* ───────── circuit workshop ───────── */
.b-lead { fill: none; stroke: #b7bec6; stroke-width: 3.5; stroke-linecap: round; }
.b-wire { fill: none; stroke: #2d9a63; stroke-width: 6; stroke-linecap: round; }
.b-hit { fill: transparent; }
.b-hit-line { fill: none; stroke: transparent; stroke-width: 22; }
.b-comp { cursor: pointer; }
.b-comp:hover .b-lead, .b-comp:hover .b-wire { filter: brightness(1.3); }
.b-selbox { fill: none; stroke: var(--yellow); stroke-width: 2.5; stroke-dasharray: 5 4; }
.b-comp.sel .b-wire { stroke: #57d699; }
.b-label { fill: #e6efea; font: 700 12px var(--f-mono); pointer-events: none; }
.b-pol { fill: #f2f2f2; font: 700 13px var(--f-mono); }
.b-pol.dark { fill: #1d1f22; }
.b-empty { fill: var(--muted); font: 600 14px var(--f-body); }
.b-post.first circle { stroke: var(--yellow); stroke-width: 4; }
.toolbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.tool { display: grid; justify-items: center; gap: 4px; padding: 9px 4px 7px; border-radius: 12px; border: 1px solid var(--line-2); background: linear-gradient(180deg, #2f1d47, #24163a); color: var(--ink); font: 600 12.5px var(--f-body); cursor: pointer; min-height: 62px; box-shadow: 0 2px 0 #0d0816; transition: transform .08s, background .15s, border-color .15s; }
.tool .ic { width: 22px; height: 22px; color: var(--yellow); }
.tool:hover { border-color: rgba(166, 107, 235, .55); }
.tool:active { transform: translateY(2px); box-shadow: none; }
.tool.on { background: var(--yellow); color: var(--yellow-ink); border-color: transparent; box-shadow: 0 2px 0 #a87406; }
.tool.on .ic { color: var(--yellow-ink); }
.p-build { display: grid; gap: 10px; }
.p-build h4 { font-size: 15px; }
.b-hint { display: flex; gap: 8px; margin: 0; padding: 9px 12px; border-radius: var(--r-sm); background: rgba(166, 107, 235, .1); color: #ffe3a3; font-size: 14px; }
.b-selbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--yellow); animation: viewin .25s; }
.b-selbar b { margin-inline-end: auto; }
.b-ch { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.b-ch li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.b-ch li.done { color: #a6d4bd; }
.b-ch li.done .tick-box { background: var(--ok); color: #062014; border-color: var(--ok); }
.b-ch small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.b-ch b { color: var(--ink); font-weight: 600; }

/* ───────── laws page ───────── */
.laws, .progress-page { max-width: 1200px; margin: 0 auto; padding-block: 28px 70px; padding-left: var(--gut-l); padding-right: var(--gut-r); display: grid; gap: 36px; }
.laws-hero h1 { font-size: clamp(28px, 4vw, 42px); }
.path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.path li { display: flex; gap: 12px; padding: 14px; border-radius: var(--r); background: linear-gradient(170deg, var(--surface-3), var(--surface)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.path li p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.pn { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--lcd); color: var(--lcd-ink); font: italic 700 15px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; }
.laws-block { display: grid; gap: 14px; }
.laws-block h2 { font-size: 22px; }
.tbl-scroll { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.cmp { width: 100%; border-collapse: collapse; min-width: 620px; font-size: 14.5px; }
.cmp th, .cmp td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.cmp thead th { color: var(--yellow); font-family: var(--f-display); font-size: 16px; background: rgba(255, 255, 255, .02); }
.cmp tbody th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.cmp tbody tr:hover td, .cmp tbody tr:hover th { background: rgba(255, 255, 255, .025); }
.note { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(166, 107, 235, .1); border: 1px solid rgba(166, 107, 235, .35); }
.laws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.law { display: grid; gap: 9px; align-content: start; padding: 18px; border-radius: var(--r); background: linear-gradient(170deg, var(--surface-3), var(--surface) 45%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.law h3 { font-size: 18px; }
.law p { margin: 0; font-size: 14.5px; color: #e2daf0; }
.law p b { color: var(--yellow); margin-inline-end: 4px; }
.law .ex { padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.formula { padding: 14px 12px; border-radius: 12px; background: #17191c; text-align: center; display: grid; gap: 4px; box-shadow: inset 0 0 0 1px rgba(150, 240, 200, .12); }
.formula .f { font-family: var(--f-mono); font-size: 23px; font-weight: 700; color: #b9f0d6; text-shadow: 0 0 14px rgba(150, 240, 200, .35); }
.formula small .f { font-size: 13px; color: #a99bc4; font-weight: 600; text-shadow: none; }
.calc { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-items: end; padding: 11px; border-radius: 12px; border: 1px dashed var(--line-2); }
.calc label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.calc .u { font-family: var(--f-mono); }
.calc input { min-height: 40px; padding: 4px 9px; }
.calc output { grid-column: 1 / -1; font-size: 14.5px; }
.calc output b { color: var(--yellow); font-family: var(--f-mono); font-size: 18px; }
.law .btn { justify-self: start; }

/* ───────── progress page ───────── */
.prog-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding: 22px; border-radius: 22px; background: linear-gradient(160deg, #2a1940, #1a1029); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.prog-head h1 { font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 16px; }
.prog-ring .ring-t { font-size: 26px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 2px; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.tile b { font: 700 28px var(--f-display); font-variant-numeric: tabular-nums; line-height: 1.15; display: inline; }
.tile small { color: var(--muted); font-size: 15px; }
.tile span { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.prog-block { display: grid; gap: 14px; }
.prog-block h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.skill { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.skill-top { display: flex; justify-content: space-between; font-weight: 600; }
.skill-top b { font-family: var(--f-mono); color: var(--yellow); }
.skill small { color: var(--muted); font-size: 12.5px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 16px 12px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--line-2); color: var(--muted); }
.badge b { font-size: 14.5px; color: var(--muted); }
.badge small { font-size: 12px; line-height: 1.45; }
.badge-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.badge-ic .ic { width: 24px; height: 24px; }
.badge.on { border-style: solid; border-color: rgba(166, 107, 235, .45); background: linear-gradient(170deg, rgba(166, 107, 235, .12), var(--surface) 70%); color: #e3d2a8; }
.badge.on b { color: var(--ink); }
.badge.on .badge-ic { background: radial-gradient(circle at 35% 30%, var(--yellow-2), #c98a0c); color: var(--yellow-ink); box-shadow: 0 0 0 4px rgba(166, 107, 235, .15), 0 8px 20px -6px rgba(166, 107, 235, .5); }
.hist { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: start; }
.hist th { color: var(--muted); font-weight: 600; font-size: 13px; }
.hist .st { color: var(--yellow); letter-spacing: 2px; direction: ltr; text-align: end; }
.hist .st i { color: rgba(236, 228, 248, .15); font-style: normal; }
.hist tr.todo td { color: var(--muted); }
.reset-box { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; border-radius: 16px; border: 1px solid rgba(239, 93, 88, .3); background: rgba(239, 93, 88, .05); }
.reset-box p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.reset-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.confirm-q { color: #ffb3b0; font-weight: 600; }

/* ───────── signature footer ───────── */
.site-foot { border-top: 1px solid var(--line); background: rgba(0, 0, 0, .18); margin-top: 20px; }
.sf-in { max-width: 1200px; margin: 0 auto; padding-block: 22px; padding-left: var(--gut-l); padding-right: var(--gut-r); display: flex; align-items: center; gap: 16px 22px; flex-wrap: wrap; }
.sf-brand { text-decoration: none; }
.sf-lcd {
  position: relative; display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 14px; border-radius: 10px; overflow: hidden;
  background: var(--lcd); color: var(--lcd-ink); font: italic 700 18px var(--f-mono); letter-spacing: .12em;
  box-shadow: inset 0 0 0 3px #17191c, 0 0 22px rgba(150, 240, 200, .14);
}
.sf-lcd .sf-t { color: #8a6a12; }
.sf-lcd::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-120%); animation: sfshine 5s ease-in-out infinite 1.5s; }
@keyframes sfshine { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.sf-brand:hover .sf-lcd { box-shadow: inset 0 0 0 3px #17191c, 0 0 30px rgba(150, 240, 200, .35); }
.sf-copy { margin: 0; color: var(--muted); font-size: 14px; flex: 1; min-width: 200px; }
.sf-insta { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.sf-insta:hover { border-color: rgba(166, 107, 235, .6); background: rgba(166, 107, 235, .08); }
.sf-insta .ic { color: var(--yellow); }
.cert-sign { margin-top: 10px !important; font: italic 700 12px var(--f-mono); letter-spacing: .14em; color: #8a6a12; direction: ltr; }

/* ───────── meter tour & explain mode ───────── */
.meter-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
#explainBtn[aria-pressed="true"] { background: var(--info); color: #06243a; border-color: transparent; }
body.explain-mode #meter, body.explain-mode .probe { cursor: help; }
body.explain-mode #meter { outline: 2px dashed var(--info); outline-offset: 6px; border-radius: 36px; }
.tour-ring { position: fixed; z-index: 90; border-radius: 14px; pointer-events: none; border: 3px solid var(--yellow); box-shadow: 0 0 0 9999px rgba(8, 5, 14, .62), 0 0 24px rgba(166, 107, 235, .6); transition: left .25s, top .25s, width .25s, height .25s; }
.tour-tip { position: fixed; z-index: 91; display: grid; gap: 8px; padding: 14px 16px; border-radius: 16px; background: #f6f1e1; color: #1d2a28; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); animation: pop .25s cubic-bezier(.3, 1.4, .5, 1); }
.tour-tip p { margin: 0; font-size: 14.5px; line-height: 1.6; }
.tt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tt-head b { font-family: var(--f-display); font-size: 16px; color: #0f4d3a; }
.tt-head small { font: 600 12px var(--f-mono); color: #6b7a76; }
.tt-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tour-tip .btn.ghost { color: #1d2a28; border-color: rgba(29, 42, 40, .3); }
.tour-tip .btn.ghost:hover { background: rgba(29, 42, 40, .06); }

/* ───────── components page ───────── */
.cmp-jump { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-jump a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; font-weight: 600; font-size: 14px; }
.cmp-jump a:hover { border-color: var(--yellow); color: var(--yellow); }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.comp { display: grid; gap: 10px; align-content: start; padding: 16px; border-radius: var(--r); background: linear-gradient(170deg, var(--surface-3), var(--surface) 45%); border: 1.5px solid rgba(196, 168, 255, .32); box-shadow: var(--shadow); scroll-margin-top: 80px; }
.comp.flash { animation: compflash 1.2s; }
@keyframes compflash { 0%, 40% { box-shadow: 0 0 0 4px var(--yellow), var(--shadow); } }
.comp-visual { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.comp-visual figure { margin: 0; display: grid; gap: 4px; justify-items: center; padding: 10px; border-radius: 12px; background: #1a1029; border: 1px solid var(--line); }
.comp-visual svg { width: 100%; max-height: 90px; }
.comp-visual .sym { color: #b9f0d6; background: #17191c; }
.comp-visual figcaption { font-size: 12px; color: var(--muted); }
.comp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.comp-head h3 { font-size: 19px; }
.comp > p { margin: 0; color: #e2daf0; }
.comp-dl { margin: 0; display: grid; gap: 4px; }
.comp-dl dt { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--yellow); font-size: 13.5px; margin-top: 4px; }
.comp-dl dt .ic { width: 16px; height: 16px; }
.comp-dl dd { margin: 0; color: #e2daf0; font-size: 14px; }
.comp .btn { justify-self: start; }

/* ───────── home: brand line, perks, start path ───────── */
.brand-txt { display: grid; line-height: 1.15; }
.brand-txt small { font: 700 10px var(--f-mono); letter-spacing: .12em; color: var(--yellow); opacity: .9; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.perks li { display: flex; align-items: center; gap: 8px; color: #e2daf0; font-weight: 600; font-size: 14.5px; }
.perks .ic { color: var(--ok); stroke-width: 3; }
.start-path { display: grid; gap: 4px; }
.sp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.sp-step { position: relative; display: flex; align-items: center; gap: 14px; height: 100%; padding: 16px; border-radius: var(--r); text-decoration: none;
  background: linear-gradient(170deg, var(--surface-3), var(--surface)); border: 1.5px solid rgba(196, 168, 255, .34); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.sp-step:hover { transform: translateY(-2px); border-color: rgba(166, 107, 235, .6); }
.sp-step.next { border-color: var(--yellow); box-shadow: var(--shadow), 0 0 0 3px rgba(166, 107, 235, .18); }
.sp-step.done { opacity: .72; border-color: rgba(76, 195, 138, .6); }
.sp-n { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--lcd); color: var(--lcd-ink); font: italic 800 18px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; }
.sp-step.done .sp-n { background: var(--ok); color: #062014; }
.sp-n .ic { stroke-width: 3; }
.sp-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.sp-body b { font-family: var(--f-display); font-size: 16.5px; }
.sp-body small { color: var(--muted); font-size: 13.5px; }
.sp-ic { width: 26px; height: 26px; color: var(--yellow); opacity: .85; }
.swipe-hint { display: none; }


/* ═════════════════════════════════════════════════════════════════
 * v2 — ALKING TECH identity: deep purple, gold, Tajawal.
 * Dark tech · rounded cards · subtle glow · realistic electronics.
 * The yellow meter and the circuit stay the visual heroes.
 * ═════════════════════════════════════════════════════════════════ */
:root {
  --primary: #7136B8; --accent: #A66BEB; --gold: #D5AD59;
  --grad: linear-gradient(135deg, #8a4fd6, #6a2fb0 60%, #5a2799);
  --glow: 0 0 0 1px rgba(166, 107, 235, .35), 0 14px 40px -12px rgba(113, 54, 184, .75);
  --card: linear-gradient(170deg, var(--surface-3), var(--surface) 70%);
  --card-line: rgba(196, 168, 255, .3);
}
body {
  background-image:
    radial-gradient(900px 560px at 85% -10%, rgba(113, 54, 184, .38), transparent 60%),
    radial-gradient(700px 520px at -10% 35%, rgba(166, 107, 235, .13), transparent 60%),
    radial-gradient(rgba(220, 205, 255, .05) 1.2px, transparent 1.3px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed, fixed, scroll;
  line-height: 1.65;
}
h1, h2, h3, h4 { font-weight: 800; }
.flip-rtl { transition: transform .2s; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.ok { color: var(--ok); }
.ok .ic { width: 14px; height: 14px; stroke-width: 3; vertical-align: -2px; }

/* buttons */
.btn { border-radius: 14px; background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 18px -12px rgba(0, 0, 0, .8); }
.btn:hover { border-color: rgba(166, 107, 235, .75); background: rgba(166, 107, 235, .13); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary { color: #fff; border-color: transparent; background: var(--grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), var(--glow); }
.btn.primary:hover { background: linear-gradient(135deg, #9a62e4, #7638c4 60%, #6430a8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 1px rgba(166, 107, 235, .55), 0 16px 44px -10px rgba(113, 54, 184, .95); }
.btn.big { min-height: 54px; padding: 10px 26px; font-size: 17px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; }
:focus-visible { outline-color: var(--accent); }
.bar span, .progress span { background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 0 10px rgba(166, 107, 235, .55); }
.eyebrow { color: var(--gold); font-weight: 700; font-size: 14px; }
.eyebrow::before { width: 18px; height: 3px; border-radius: 2px; background: var(--gold); box-shadow: none; animation: none; }
.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(76, 195, 138, .2); animation: blink 2.4s infinite; flex: none; }
.lead-p { color: #cbbfe0; line-height: 1.85; }
.chip { background: rgba(166, 107, 235, .1); border-color: rgba(196, 168, 255, .28); color: #ddd0f3; }

/* top bar */
.topbar { min-height: 66px; background: rgba(22, 15, 35, .8); border-bottom: 1px solid rgba(196, 168, 255, .16); box-shadow: 0 10px 30px -20px rgba(0, 0, 0, .9); }
.brand { gap: 10px; }
.brand .logo { filter: drop-shadow(0 0 10px rgba(213, 173, 89, .35)); transition: transform .3s; }
.brand:hover .logo { transform: rotate(-6deg) scale(1.05); }
.brand-txt b { font: 800 16px var(--f-display); letter-spacing: .07em; color: #fff; }
.brand-txt b i, .sf-brand i, .about-brand h2 i { font-style: normal; color: var(--gold); }
.brand-txt small { font: 600 11.5px var(--f-body); letter-spacing: 0; color: var(--muted); opacity: 1; }
.nav { margin-inline: auto; background: rgba(255, 255, 255, .03); border: 1px solid rgba(196, 168, 255, .14); border-radius: 999px; gap: 2px; padding: 4px; }
.nav a { padding: 7px 15px; border-radius: 999px; font-size: 14.5px; color: #cfc3e6; font-weight: 600; }
.nav a:hover { color: #fff; background: rgba(166, 107, 235, .1); }
.nav a[aria-current="page"] { color: #fff; background: linear-gradient(135deg, rgba(138, 79, 214, .55), rgba(106, 47, 176, .55)); box-shadow: inset 0 0 0 1px rgba(166, 107, 235, .7), 0 0 18px rgba(113, 54, 184, .5); }
.top-actions .btn { border-color: rgba(196, 168, 255, .22); }
.top-actions .btn.on { color: var(--gold); border-color: var(--gold); }
@media (min-width: 1181px) { .nav a .ic { display: none; } }

/* ── home ── */
.home { max-width: 1240px; gap: 60px; padding-block: 18px 70px; }
.hero { position: relative; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 34px; min-height: 540px; }
.pill { display: inline-flex; align-items: center; gap: 9px; padding: 6px 16px; border-radius: 999px; margin-bottom: 18px;
  background: rgba(113, 54, 184, .3); border: 1px solid rgba(166, 107, 235, .6); color: #eee3ff; font-weight: 700; font-size: 14px; box-shadow: 0 0 24px rgba(113, 54, 184, .4); }
.hero h1 { font-size: clamp(34px, 5.2vw, 62px); line-height: 1.18; letter-spacing: 0; }
.hero h1 em { color: transparent; background: linear-gradient(90deg, #d7b8ff, var(--accent) 45%, var(--gold)); -webkit-background-clip: text; background-clip: text; }
.hero .lead-p { font-size: 17.5px; max-width: 56ch; margin: 18px 0 28px; }
.hero-actions { gap: 12px; }
.stats { margin-top: 30px; }
.perks li { color: #e2d8f3; }
.ring-fg { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(166, 107, 235, .55)); }

.hero-vis { position: relative; display: block; min-height: 500px; padding: 0; background: none; border: 0; box-shadow: none; overflow: visible; }
.hero-vis::after { display: none; }
.hv-orb { position: absolute; inset: 4% 0 6% 4%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(166, 107, 235, .55), rgba(113, 54, 184, .2) 45%, transparent 70%); filter: blur(12px); animation: orb 9s ease-in-out infinite alternate; }
@keyframes orb { to { transform: scale(1.07) translate(-2%, 2%); } }
.hv-board { position: absolute; inset-inline-start: 0; bottom: 58px; width: 70%; padding: 14px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(60, 37, 90, .92), rgba(30, 18, 46, .95)); border: 1px solid rgba(196, 168, 255, .32);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 40px -10px rgba(113, 54, 184, .6); transform: perspective(900px) rotateX(8deg) rotateY(-8deg); }
[dir="ltr"] .hv-board { transform: perspective(900px) rotateX(8deg) rotateY(8deg); }
.hv-board::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background-image: linear-gradient(rgba(220, 205, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(220, 205, 255, .05) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.hv-wire { stroke: #c98a3a; }
.hv-meter { position: absolute; inset-inline-end: 5%; top: 0; width: min(270px, 50%); pointer-events: none; transform: rotate(-6deg);
  filter: drop-shadow(0 34px 40px rgba(0, 0, 0, .65)) drop-shadow(0 0 46px rgba(113, 54, 184, .5)); animation: hvfloat 6s ease-in-out infinite; }
[dir="ltr"] .hv-meter { transform: rotate(6deg); animation-name: hvfloat-l; }
@keyframes hvfloat { 50% { transform: rotate(-4deg) translateY(-12px); } }
@keyframes hvfloat-l { 50% { transform: rotate(4deg) translateY(-12px); } }
.hv-meter .meter-svg, .hv-meter svg { width: 100%; height: auto; display: block; }
.hv-cap { position: absolute; inset-inline-start: 4%; bottom: 0; display: flex; gap: 12px; align-items: center; padding: 8px 16px; border-radius: 999px;
  background: rgba(22, 15, 35, .88); border: 1px solid var(--line-2); font-size: 14px; color: var(--muted); box-shadow: var(--shadow); }
.hv-cap b { color: var(--gold); font-family: var(--f-mono); }

.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: -18px; }
.feat { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 22px 14px; border-radius: 20px;
  background: linear-gradient(170deg, rgba(60, 37, 90, .8), rgba(38, 22, 55, .8)); border: 1px solid var(--card-line); box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.feat:hover { transform: translateY(-3px); border-color: rgba(166, 107, 235, .75); box-shadow: var(--shadow), 0 0 30px -6px rgba(113, 54, 184, .65); }
.feat-ic, .res-ic { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 16px; color: #ead9ff;
  background: radial-gradient(circle at 30% 30%, rgba(166, 107, 235, .5), rgba(113, 54, 184, .2)); box-shadow: inset 0 0 0 1px rgba(166, 107, 235, .55), 0 0 22px rgba(113, 54, 184, .4); }
.feat-ic .ic, .res-ic .ic { width: 26px; height: 26px; }
.feat b { font-size: 16px; }
.feat small { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.home-sec { display: grid; gap: 4px; }
.sec-head .eyebrow { margin: 0 0 4px; }
.sec-head h2 { font-size: 26px; }

/* paths */
.path-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.path-card { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; text-decoration: none; background: var(--card);
  border: 1.5px solid var(--card-line); box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.path-card:hover { transform: translateY(-4px); border-color: rgba(166, 107, 235, .85); box-shadow: var(--shadow), 0 0 38px -8px rgba(113, 54, 184, .75); }
.pc-art { aspect-ratio: 16 / 8; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 65%, rgba(113, 54, 184, .5), transparent 70%), linear-gradient(180deg, #1c1230, #26173c); border-bottom: 1px solid var(--line); }
.pc-art svg { width: 92%; height: auto; transition: transform .4s; }
.path-card:hover .pc-art svg { transform: scale(1.05); }
.pc-body { display: grid; gap: 8px; padding: 16px; flex: 1; align-content: start; }
.pc-level { font-size: 13px; font-weight: 700; color: var(--gold); }
.path-card h3 { font-size: 19px; }
.path-card p { margin: 0; color: var(--muted); font-size: 14px; }
.pc-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.pc-meta .ic { width: 15px; height: 15px; }
.pc-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 6px; }
.pc-foot small { color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-go { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; box-shadow: 0 8px 18px -6px rgba(113, 54, 184, .9); }
.path-grid.compact .pc-art { aspect-ratio: 16 / 7; }
.path-grid.compact .path-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* generic page */
.page { max-width: 1240px; margin: 0 auto; padding-block: 30px 70px; padding-left: var(--gut-l); padding-right: var(--gut-r); display: grid; gap: 34px; align-content: start; }
.page-hero { display: grid; gap: 8px; max-width: 840px; }
.page-hero .eyebrow { margin: 0; }
.page-hero h1 { font-size: clamp(28px, 4vw, 44px); }
.page-hero .lead-p { margin: 2px 0 0; font-size: 16.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fchip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: #d8cdeb; font: 700 14px var(--f-body); cursor: pointer; transition: background .15s, border-color .15s; }
.fchip:hover { border-color: rgba(166, 107, 235, .7); }
.fchip b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(166, 107, 235, .25); font-size: 12px; margin-inline-end: 6px; }
.fchip[aria-pressed="true"] { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(113, 54, 184, .95); }
.fchip[aria-pressed="true"] b { background: rgba(255, 255, 255, .22); }
.how { display: grid; gap: 14px; }
.how h2 { font-size: 22px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.how-steps li { display: grid; gap: 6px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); }
.how-n { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--grad); font-weight: 800; color: #fff; }
.how-steps small { color: var(--muted); font-size: 14px; }

/* lesson page */
.crumbs { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs b { color: var(--ink); }
.crumb-back { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line-2); }
.crumb-back:hover { border-color: var(--accent); }
.lesson-page { gap: 18px; }
.lesson-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-areas: "side main"; gap: 20px; align-items: start; }
.lesson-main { grid-area: main; display: grid; gap: 16px; min-width: 0; }
.lesson-side { grid-area: side; position: sticky; top: 84px; display: grid; gap: 12px; padding: 16px; border-radius: 22px; background: var(--card); border: 1.5px solid var(--card-line); box-shadow: var(--shadow); }
.lesson-side h2 { font-size: 18px; }
.ls-prog { display: flex; align-items: center; gap: 10px; }
.ls-prog small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ls-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ls-list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px; text-decoration: none; color: #d8cdeb; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.ls-list a:hover { background: rgba(255, 255, 255, .04); border-color: var(--line); }
.ls-list a.on { background: var(--grad); color: #fff; box-shadow: 0 8px 22px -10px rgba(113, 54, 184, .95); }
.ls-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, .08); font-weight: 800; font-size: 13px; }
.ls-list a.done .ls-n { background: var(--ok); color: #062014; }
.ls-n .ic { width: 15px; height: 15px; stroke-width: 3; }
.ls-t { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.ls-ic { width: 16px; height: 16px; opacity: .7; }
.ls-other { display: flex; flex-wrap: wrap; gap: 6px; }
.ls-other a { font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.ls-other a:hover { color: var(--ink); border-color: var(--accent); }
.lesson-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); border-radius: 24px; overflow: hidden;
  background: linear-gradient(160deg, #2e1b47, #1c1230); border: 1.5px solid rgba(196, 168, 255, .34); box-shadow: var(--shadow), 0 0 60px -24px rgba(113, 54, 184, .75); animation: viewin .35s; }
.lv-art { order: 2; position: relative; display: grid; place-items: center; min-height: 250px; padding: 22px; background: radial-gradient(circle at 50% 55%, rgba(166, 107, 235, .5), transparent 66%), #1a102a; }
.lv-art > svg { width: 100%; max-width: 330px; height: auto; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .55)); }
.lv-lcd { padding: 14px 26px; border-radius: 14px; background: var(--lcd); color: var(--lcd-ink); font: italic 800 clamp(34px, 5vw, 54px) var(--f-mono); box-shadow: inset 0 0 0 6px #17191c, 0 0 44px rgba(150, 240, 200, .28); }
.lv-chip { position: absolute; top: 14px; inset-inline-end: 14px; padding: 3px 10px; border-radius: 8px; background: var(--lcd); color: var(--lcd-ink); font: italic 700 14px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; }
.lh-text { display: grid; gap: 10px; align-content: center; padding: 28px; }
.lh-text h1 { font-size: clamp(24px, 3vw, 34px); }
.lh-text p { margin: 0; color: #d6cceb; line-height: 1.85; }
.lh-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.lesson-info { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; }
.goals { padding: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-2); display: grid; gap: 12px; align-content: start; }
.goals h2 { font-size: 18px; display: flex; gap: 8px; align-items: center; }
.goals h2 .ic { color: var(--accent); }
.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.goal { display: grid; justify-items: center; align-content: start; text-align: center; gap: 8px; padding: 14px 10px; border-radius: 16px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.goal p { margin: 0; font-size: 13.5px; color: #ddd3ee; line-height: 1.6; }
.goal-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: rgba(166, 107, 235, .18); color: #dcc4ff; box-shadow: inset 0 0 0 1px rgba(166, 107, 235, .5); }
.goal-ic .ic { width: 22px; height: 22px; }
.facts { display: grid; gap: 10px; align-content: start; }
.fact { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); }
.fact > span { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: rgba(213, 173, 89, .14); color: var(--gold); }
.fact small { display: block; color: var(--muted); font-size: 12.5px; }
.fact b { font-size: 15.5px; }

/* resources */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.res-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 20px; text-decoration: none; background: var(--card); border: 1.5px solid var(--card-line); box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.res-card:hover { transform: translateY(-3px); border-color: rgba(166, 107, 235, .85); box-shadow: var(--shadow), 0 0 32px -8px rgba(113, 54, 184, .7); }
.res-card > div { flex: 1; display: grid; gap: 4px; justify-items: start; }
.res-card h3 { font-size: 17.5px; }
.res-card p { margin: 0; color: var(--muted); font-size: 14px; }
.res-go { align-self: center; opacity: .6; }
.safety { padding: 20px; border-radius: 20px; border: 1px solid rgba(213, 173, 89, .5); background: linear-gradient(160deg, rgba(213, 173, 89, .12), rgba(213, 173, 89, .02)); display: grid; gap: 10px; }
.safety h2 { font-size: 19px; display: flex; gap: 8px; align-items: center; }
.safety h2 .ic { color: var(--gold); }
.safety-list { margin: 0; padding-inline-start: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 26px; color: #efe5cc; }

/* about */
.about-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.about-stats div { display: grid; justify-items: center; padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-2); }
.about-stats b { font-size: 42px; font-weight: 800; line-height: 1.1; background: linear-gradient(90deg, #d7b8ff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.about-stats span { color: var(--muted); }
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.about-card { display: grid; gap: 10px; align-content: start; padding: 22px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--card-line); }
.about-card p { margin: 0; color: #d6cceb; font-size: 14.5px; line-height: 1.85; }
.about-brand { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 24px; border-radius: 24px; background: radial-gradient(500px 220px at 15% 0, rgba(113, 54, 184, .45), transparent), var(--surface); border: 1.5px solid rgba(213, 173, 89, .5); }
.about-brand > div { flex: 1; min-width: 240px; }
.about-brand h2 { letter-spacing: .08em; }
.about-brand p { margin: 4px 0 0; color: var(--muted); }

/* ── lab ── */
.lab-head { max-width: 1520px; margin: 0 auto; padding-top: 14px; padding-left: var(--gut-l); padding-right: var(--gut-r); display: flex; align-items: center; gap: 14px; }
.lab-title { display: grid; flex: 1; min-width: 0; }
.lab-title small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-title h1 { font-size: 22px; display: flex; gap: 10px; align-items: center; }
.lab-title h1 .ic { width: 24px; height: 24px; color: var(--accent); }
.sim-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(76, 195, 138, .1); border: 1px solid rgba(76, 195, 138, .4); color: #bdf0d6; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.lab { max-width: 1520px; grid-template-columns: 300px minmax(0, 1fr) 270px 112px; grid-template-areas: "panel bench meter lib" "panel tools tools tools"; gap: 14px; padding-block: 14px 28px; }
#lab:fullscreen { overflow-y: auto; background: var(--mat); }
.panel { background: var(--card); border: 1.5px solid var(--card-line); border-radius: 22px; }
.panel-tag { justify-self: center; padding: 4px 14px; border-radius: 999px; background: rgba(113, 54, 184, .35); border: 1px solid rgba(166, 107, 235, .6); font-size: 12.5px; font-weight: 700; color: #eadcff; }
.pnum { background: var(--grad); color: #fff; box-shadow: none; font-style: normal; }
.tasks li.cur { background: rgba(166, 107, 235, .1); box-shadow: inset 0 0 0 1px rgba(166, 107, 235, .45); }
.tasks li.cur .tick-box { border-color: var(--accent); color: #e2ccff; }
.bench { background-color: #1b1230; background-image: linear-gradient(rgba(196, 168, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(196, 168, 255, .07) 1px, transparent 1px);
  background-size: 32px 32px; border: 1.5px solid var(--card-line); border-radius: 22px; box-shadow: inset 0 0 80px rgba(0, 0, 0, .35), var(--shadow); }
.live { border-radius: 16px; background: var(--surface); border-color: var(--line-2); color: #ddd3ee; }
.meter-switch button[aria-pressed="true"] { background: var(--grad); color: #fff; box-shadow: none; }
.library { grid-area: lib; display: grid; gap: 10px; align-content: start; padding: 12px 8px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--card-line); box-shadow: var(--shadow); }
.library h3 { font-size: 14.5px; text-align: center; }
.lib-list { display: grid; gap: 8px; }
.lib-item { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--ink); font: 600 12.5px/1.35 var(--f-body); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.lib-item:hover:not(:disabled) { border-color: rgba(166, 107, 235, .75); background: rgba(166, 107, 235, .12); }
.lib-item:disabled { cursor: default; }
.lib-item.on { background: var(--grad); border-color: transparent; color: #fff; }
.lib-vis { display: grid; place-items: center; width: 100%; height: 44px; }
.lib-vis svg { width: 76px; height: 44px; }
.lib-vis .ic { width: 26px; height: 26px; color: var(--gold); }
.lib-item.on .lib-vis .ic { color: #fff; }
.lib-x { position: absolute; top: 4px; inset-inline-start: 7px; font: 700 11px var(--f-mono); color: var(--gold); }
.lib-i { position: absolute; top: 5px; inset-inline-end: 5px; width: 14px; height: 14px; opacity: .55; }
.lib-empty { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.lab-tools { grid-area: tools; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px; border-radius: 20px; background: rgba(22, 15, 35, .75); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.tbtn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 86px; min-height: 58px; padding: 6px 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: #e2d8f3; font: 600 12.5px var(--f-body); cursor: pointer; transition: background .15s, border-color .15s, transform .08s; }
.tbtn .ic { width: 21px; height: 21px; color: var(--accent); }
.tbtn:hover { border-color: rgba(166, 107, 235, .75); background: rgba(166, 107, 235, .13); }
.tbtn:active { transform: translateY(1px); }
.tbtn[aria-pressed="true"] { background: var(--info); color: #06243a; border-color: transparent; }
.tbtn[aria-pressed="true"] .ic { color: #06243a; }
.comp-modal { box-shadow: none; border: 0; padding: 0; background: none; }
.comp-modal + .modal-actions { justify-content: flex-end; }

/* parts/components visuals on purple */
.comp-visual figure { background: #1a1029; }
.comp, .law, .path li, .skill, .badge, .tile { border-color: var(--card-line); }
.comp, .law, .path li { background: var(--card); }
.prog-hero { background: linear-gradient(160deg, #2e1b47, #1c1230); }
.modal-in { background: linear-gradient(175deg, var(--surface-3), var(--surface) 40%); border-color: rgba(196, 168, 255, .4); }
.drawer-in { background: #1f1330; }
.drawer-head { background: #1f1330; }
.drawer-in h3, .finish h3 { color: var(--gold); }
.p-question { background: linear-gradient(160deg, #33204d, #22152f); border-color: rgba(166, 107, 235, .6); }
.p-question h4 { color: #e2ccff; }
.level-badge, .mc-lcd, .sp-n, .pn { font-style: normal; }
.mcard.free { background: linear-gradient(170deg, rgba(213, 173, 89, .16), rgba(213, 173, 89, .03) 55%), var(--surface); border-color: rgba(213, 173, 89, .75); }
.mcard.free:hover { border-color: var(--gold); }
.mcard.free .mc-lcd { color: var(--gold); }
.sp-step.next { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px rgba(166, 107, 235, .22); }
.sp-ic { color: var(--accent); }

/* footer */
.site-foot { margin-top: 30px; border-top: 1px solid rgba(196, 168, 255, .16); background: linear-gradient(180deg, rgba(22, 15, 35, .3), rgba(10, 6, 18, .85)); }
.sf-in { max-width: 1240px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 24px; align-items: start; padding-block: 34px 20px; }
.sf-brand { display: inline-flex; align-items: center; gap: 10px; font: 800 18px var(--f-display); letter-spacing: .08em; color: #fff; }
.sf-about p { margin: 10px 0 0; color: var(--muted); font-size: 14px; max-width: 46ch; }
.sf-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.sf-links a { text-decoration: none; color: #d6cceb; font-size: 14px; }
.sf-links a:hover { color: var(--accent); }
.sf-insta:hover { border-color: var(--accent); background: rgba(166, 107, 235, .12); }
.sf-insta .ic { color: var(--gold); }
.site-foot > .sf-copy { max-width: 1240px; margin: 0 auto; padding: 14px var(--gut-r) calc(22px + env(safe-area-inset-bottom, 0px)) var(--gut-l); border-top: 1px dashed rgba(196, 168, 255, .16); color: var(--muted); font-size: 13.5px; text-align: center; flex: none; min-width: 0; }
.tour-tip { background: #f7f2ff; }
.tt-head b { color: #4b1f8a; }
.tour-ring { border-color: var(--gold); }

/* ───────── responsive ───────── */
@media (max-width: 1120px) {
  .lab { grid-template-columns: minmax(0, 1fr) 250px; grid-template-areas: "panel panel" "bench meter"; }
  .meter-wrap { top: 64px; }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .nav a span { display: none; }
  .nav a { padding: 7px 10px; }
}
@media (max-width: 720px) {
  :root { --tabbar: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  body { padding-bottom: var(--tabbar); }
  .brand svg { width: 26px; height: 26px; }
  .nav {
    position: fixed; z-index: 35; inset: auto 0 0 0; margin: 0; border-radius: 0; border: 0; border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
    background: rgba(22, 15, 35, .97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .nav a { flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 11.5px; border-radius: 12px; }
  .nav a span { display: block; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav a[aria-current="page"] { background: rgba(166, 107, 235, .14); color: var(--yellow); box-shadow: none; }
  .top-actions { margin-inline-start: auto; }
  body[data-view="lab"] #studentChip { display: none; }
  .lab { grid-template-columns: minmax(0, 1fr); grid-template-areas: "panel" "bench" "meter"; gap: 10px; padding-block: 10px 40px; }
  .panel { padding: 12px; gap: 8px; }
  .panel-head h2 { font-size: 16px; }
  .p-toggle { display: inline-flex; }
  .p-current { display: block; }
  .panel:not(.open) .panel-body { display: none; }
  .bench { padding: 4px; }
  .live { font-size: 13px; padding: 8px 10px; }
  .meter-wrap { position: static; }
  .meter { max-width: min(270px, 74vw); }
  .laws-grid { grid-template-columns: 1fr; }
  .prog-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .prog-head h1 { text-align: center; }
  .stats { gap: 18px; }
  .hero-vis { padding: 14px; }
  .sf-in { justify-content: center; text-align: center; }
  /* صفوف أفقية تُسحب بالإصبع بدل قائمة طويلة */
  .level .grid, #extraGrid {
    grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 84%;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    padding: 4px 2px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .level .grid::-webkit-scrollbar, #extraGrid::-webkit-scrollbar { display: none; }
  .level .mcard, #extraGrid .mcard { scroll-snap-align: start; }
  .level-head { gap: 8px 12px; }
  .level-prog { order: 3; flex-basis: 100%; margin-inline-start: 0; }
  .swipe-hint { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; color: var(--muted); font-size: 12.5px; }
  .swipe-ic { width: 14px; height: 14px; }
  [dir="rtl"] .swipe-ic { transform: scaleX(-1); }
  .sp-steps { grid-template-columns: 1fr; gap: 8px; }
  .sp-step { padding: 12px 14px; }
  .perks { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .perks li { font-size: 13px; }
  /* مقدمة أقصر على الجوال حتى تظهر المهام أسرع */
  .home { padding-block: 16px 40px; gap: 30px; }
  .hero { gap: 18px; }
  .hero h1 { font-size: 28px; }
  .lead-p { font-size: 15px; margin: 10px 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .hero-vis { display: none; }
  #homeGuide { display: none; }
  .stats { margin-top: 18px; gap: 14px 20px; }
  .stat-ring .ring { width: 60px; height: 60px; }
  .stat b { font-size: 24px; }
  /* أهداف لمس أكبر للإصبع */
  .btn.small { min-height: 40px; padding: 6px 14px; }
  .btn { min-height: 44px; }
  .p-toggle { min-height: 40px; }
  .sf-copy { flex-basis: 100%; order: 3; }
}
@media (max-width: 480px) {
  .brand span { display: none; }
  #studentChip { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 26px; }
  .topbar { gap: 6px; }
  .answers { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ───────── v2 responsive ───────── */
@media (max-width: 1320px) {
  .lab { grid-template-columns: 290px minmax(0, 1fr) 250px; grid-template-areas: "panel bench meter" "panel lib lib" "panel tools tools"; }
  .library { position: static; grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 10px 12px; }
  .library h3 { writing-mode: initial; padding-inline-end: 6px; }
  .lib-list { grid-auto-flow: column; grid-auto-columns: 96px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
}
@media (max-width: 1180px) {
  .nav a span { display: none; }
  .nav a { padding: 8px 11px; }
  .path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-info { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 1120px) {
  .lab { grid-template-columns: minmax(0, 1fr) 250px; grid-template-areas: "panel panel" "bench meter" "lib lib" "tools tools"; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-vis { min-height: 440px; max-width: 620px; width: 100%; justify-self: center; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
  .lesson-layout { grid-template-columns: 1fr; grid-template-areas: "main" "side"; }
  .lesson-side { position: static; }
  .lesson-hero { grid-template-columns: 1fr; }
  .lv-art { order: -1; min-height: 200px; }
  .about-grid, .how-steps { grid-template-columns: 1fr; }
  .sf-in { grid-template-columns: 1fr 1fr; }
  .sf-about { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .topbar { min-height: 58px; background: #1a1129; }
  .nav { inset: auto 0 0 0; grid-template-columns: repeat(5, 1fr); border-radius: 0; padding-top: 6px; background: rgba(22, 15, 35, .97); border: 0; border-top: 1px solid rgba(196, 168, 255, .18); }
  .nav a[data-nav="about"] { display: none; }
  .nav a { border-radius: 12px; padding: 5px 2px; color: #b9abd3; }
  .nav a .ic { display: block; }
  .nav a span { display: block; font-size: 11px; white-space: nowrap; }
  .nav a[data-nav="lab"] span, .nav a[data-nav="paths"] span { display: none; }
  [dir="rtl"] .nav a[data-nav="lab"]::after { content: "المختبر"; font-size: 11px; }
  [dir="ltr"] .nav a[data-nav="lab"]::after { content: "Lab"; font-size: 11px; }
  [dir="rtl"] .nav a[data-nav="paths"]::after { content: "المسارات"; font-size: 11px; }
  [dir="ltr"] .nav a[data-nav="paths"]::after { content: "Paths"; font-size: 11px; }
  .nav a[aria-current="page"] { background: rgba(166, 107, 235, .18); color: #fff; box-shadow: none; }
  .nav a[aria-current="page"] .ic { color: var(--accent); }
  .home { gap: 34px; padding-block: 12px 40px; }
  .hero { gap: 6px; }
  .hero h1 { font-size: 32px; }
  .hero .lead-p { font-size: 15px; margin: 12px 0 18px; -webkit-line-clamp: 4; }
  .pill { margin-bottom: 12px; font-size: 13px; }
  .btn.big { min-height: 50px; font-size: 16px; padding: 8px 18px; flex: 1 1 auto; }
  .hero-vis { display: block; min-height: 300px; margin-top: 8px; }
  .hv-meter { width: 44%; inset-inline-end: 2%; }
  .hv-board { width: 78%; bottom: 46px; padding: 10px; }
  .hv-cap { font-size: 12.5px; padding: 6px 12px; }
  .features { gap: 10px; }
  .feat { padding: 14px 10px; border-radius: 16px; }
  .feat-ic { width: 44px; height: 44px; border-radius: 13px; }
  .feat b { font-size: 14.5px; }
  .feat small { font-size: 12.5px; }
  .sec-head h2 { font-size: 22px; }
  .path-grid.compact, #homeNext .grid {
    grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 82%;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: 4px 2px 14px; scrollbar-width: none;
  }
  .path-grid.compact::-webkit-scrollbar, #homeNext .grid::-webkit-scrollbar { display: none; }
  .path-grid.compact > *, #homeNext .grid > * { scroll-snap-align: start; }
  .path-grid { grid-template-columns: 1fr; }
  .page { padding-block: 18px 40px; gap: 24px; }
  .page-hero h1 { font-size: 26px; }
  .page-hero .lead-p { font-size: 15px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .fchip { flex: none; }
  .lh-text { padding: 20px; }
  .goal-grid { grid-template-columns: 1fr; }
  .goal { grid-template-columns: auto 1fr; justify-items: start; text-align: start; align-items: center; }
  .res-grid { grid-template-columns: 1fr; }
  .safety-list { grid-template-columns: 1fr; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .about-stats b { font-size: 34px; }
  .lab-head { padding-top: 10px; gap: 10px; }
  .lab-title h1 { font-size: 18px; }
  .sim-status > span:last-child { display: none; }
  .sim-status { padding: 8px; }
  .lab { grid-template-columns: minmax(0, 1fr); grid-template-areas: "panel" "bench" "meter" "lib" "tools"; }
  .panel-tag { display: none; }
  .library { grid-template-columns: 1fr; padding: 10px; }
  .library h3 { text-align: start; }
  .lib-list { grid-auto-columns: 92px; }
  .lab-tools { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding: 8px; }
  .tbtn { flex: none; min-width: 78px; }
  .sf-in { grid-template-columns: 1fr; text-align: start; justify-items: start; }
  .sf-links { width: 100%; }
}
@media (max-width: 480px) {
  .brand .brand-txt { display: grid !important; }
  .brand-txt small { display: none; }
  .brand-txt b { font-size: 14px; }
  .hero h1 { font-size: 29px; }
  .hero-vis { min-height: 260px; }
}

/* the workshop toolbox lives in the components column */
#pBuild .toolbox { display: none; }
@media (max-width: 480px) {
  #progBtn { display: none; }
  .top-actions { gap: 2px; }
  .top-actions .btn.icon { padding: 4px 7px; }
  .brand { min-width: 0; flex-shrink: 1; }
  .brand-txt b { white-space: nowrap; }
}
@media (max-width: 370px) { .brand .brand-txt { display: none !important; } }
.lv-art > svg { max-height: 220px; }
@media (max-width: 720px) { .lv-art > svg { max-height: 150px; } .lv-art { min-height: 0; padding: 18px; } }
@media (max-width: 720px) { .topbar:has(#examBar:not([hidden])) .brand-txt { display: none !important; } }
/* icon-only nav keeps its accessible names */
@media (min-width: 721px) and (max-width: 1180px) { .nav a { position: relative; } .nav a span { display: block !important; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* ═════ v2.1 — no overlaps: the hero visual lives in normal flow ═════ */
.hero-vis { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); align-items: center; gap: 18px; min-height: 0; padding: 24px 0; }
.hv-orb { inset: 0; }
.hv-board { position: relative; inset: auto; bottom: auto; width: auto; grid-column: 1; grid-row: 1; z-index: 1; }
.hv-meter { position: relative; inset: auto; top: auto; width: 100%; max-width: 270px; justify-self: center; grid-column: 2; grid-row: 1; z-index: 2; }
.hv-cap { position: relative; inset: auto; bottom: auto; grid-column: 1 / -1; justify-self: center; z-index: 2; }
.path-card { position: relative; }
.pc-art { position: relative; }
.pc-ribbon { position: absolute; top: 12px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: var(--gold); color: #2a1c00; font-weight: 800; font-size: 13px; box-shadow: 0 6px 18px -6px rgba(213, 173, 89, .8); }
.pc-ribbon .ic { width: 13px; height: 13px; fill: currentColor; }
.path-card.start { border-color: rgba(213, 173, 89, .85); box-shadow: var(--shadow), 0 0 0 3px rgba(213, 173, 89, .18); }
.stats:empty { display: none; }
@media (max-width: 960px) {
  .hero-vis { max-width: 560px; }
}
@media (max-width: 720px) {
  .hero-vis { grid-template-columns: 1fr; padding: 8px 0 0; gap: 12px; min-height: 0; max-width: none; }
  .hv-board { display: none; }
  .hv-meter { grid-column: 1; width: min(230px, 62vw); max-width: none; inset-inline-end: auto; }
  .hv-cap { grid-column: 1; }
  /* المختبر في منتصف شريط الجوال كزر بارز */
  .nav a[data-nav="lab"] .ic { width: 40px; height: 40px; padding: 9px; margin-top: -18px; border-radius: 14px; background: var(--grad); color: #fff; box-shadow: 0 8px 20px -6px rgba(113, 54, 184, .95), 0 0 0 4px #1a1129; }
  .nav a[data-nav="lab"][aria-current="page"] .ic { color: #fff; }
}
.home, .page { overflow-x: clip; }

/* ───────── electric FX ───────── */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.fx-spark { position: absolute; z-index: 9; width: 4px; height: 4px; border-radius: 50%; pointer-events: none; background: #fff6d0; box-shadow: 0 0 6px 2px rgba(255, 196, 80, .95), 0 0 14px 4px rgba(166, 107, 235, .55); }
.fx-flash { position: absolute; z-index: 8; width: 34px; height: 34px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(213, 173, 89, .6) 35%, rgba(166, 107, 235, 0) 70%); }

/* new parts: USB charger, NTC, relay */
.usb-t { fill: #3a3f46; font: 800 17px var(--f-mono); }
.usb-t.sm { font-size: 10px; letter-spacing: .14em; font-weight: 700; }
.usb-n { fill: #e6ebef; font: 700 14px var(--f-mono); }
.ntc-t { fill: #e6efff; font: 700 9px var(--f-mono); }
.ntc-temp { fill: #16201a; font: italic 800 24px var(--f-mono); }
.relay-n { fill: #e6ebef; font: 700 13px var(--f-mono); }
.relay-n.sm { font-size: 11px; fill: #cfd5db; }
.jtag { fill: var(--gold); font-weight: 800; font-family: var(--f-mono); }

/* ───────── path quiz ───────── */
.quiz-page { max-width: 860px; }
.quiz-card { display: grid; gap: 16px; padding: 26px; border-radius: 24px; background: var(--card); border: 1.5px solid var(--card-line); box-shadow: var(--shadow), 0 0 50px -24px rgba(113, 54, 184, .7); animation: viewin .3s; }
.quiz-card h1 { font-size: clamp(21px, 2.6vw, 28px); line-height: 1.45; }
.quiz-top { display: flex; align-items: center; gap: 14px; }
.quiz-top small { color: var(--muted); font-variant-numeric: tabular-nums; }
.q-dots { list-style: none; margin: 0 auto; padding: 0; display: flex; gap: 6px; }
.q-dots li { width: 28px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.q-dots li.past { background: var(--accent); }
.q-dots li.now { background: var(--gold); }
.q-choices { display: grid; gap: 10px; }
.q-ch { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--ink); font: 600 16px var(--f-body); text-align: start; cursor: pointer; transition: border-color .15s, background .15s, transform .08s; }
.q-ch:hover:not(:disabled) { border-color: var(--accent); background: rgba(166, 107, 235, .1); }
.q-ch:active:not(:disabled) { transform: translateY(1px); }
.q-ch:disabled { cursor: default; }
.q-l { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(166, 107, 235, .2); font-weight: 800; }
.q-ch > span:nth-child(2) { flex: 1; }
.q-ic { width: 22px; height: 22px; stroke-width: 3; }
.q-ch.right { border-color: var(--ok); background: rgba(76, 195, 138, .14); }
.q-ch.right .q-l { background: var(--ok); color: #062014; }
.q-ch.right .q-ic { color: var(--ok); }
.q-ch.wrong { border-color: var(--danger); background: rgba(239, 93, 88, .12); animation: shake .4s; }
.q-ch.wrong .q-ic { color: var(--danger); }
.q-ch.dim { opacity: .5; }
.q-why { display: flex; gap: 10px; padding: 14px; border-radius: 14px; line-height: 1.75; animation: viewin .3s; }
.q-why.ok { background: rgba(76, 195, 138, .1); border: 1px solid rgba(76, 195, 138, .45); }
.q-why.no { background: rgba(213, 173, 89, .1); border: 1px solid rgba(213, 173, 89, .45); }
.q-why .ic { flex: none; margin-top: 4px; }
.quiz-card > .btn.big { justify-self: start; }
.quiz-done { justify-items: center; text-align: center; }
.quiz-done .lh-actions { justify-content: center; }
.qd-ring .ring-t { font-size: 22px; }
.qd-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; background: linear-gradient(135deg, #f0d48c, var(--gold)); color: #2a1c00; font-weight: 800; box-shadow: 0 10px 28px -10px rgba(213, 173, 89, .9); animation: popin .5s cubic-bezier(.3, 1.6, .5, 1); }
.ls-quiz { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; text-decoration: none; color: var(--ink); border: 1.5px dashed rgba(213, 173, 89, .7); background: rgba(213, 173, 89, .07); }
.ls-quiz:hover { background: rgba(213, 173, 89, .14); }
.ls-quiz .ls-n { background: var(--gold); color: #2a1c00; }
.ls-quiz.done { border-style: solid; border-color: rgba(76, 195, 138, .7); background: rgba(76, 195, 138, .08); }
.ls-quiz.done .ls-n { background: var(--ok); color: #062014; }
.ls-quiz .ls-t { display: grid; }
.ls-quiz small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.pc-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #2a1c00; vertical-align: -5px; margin-inline-start: 4px; }
.pc-badge .ic { width: 13px; height: 13px; }

/* ───────── glossary ───────── */
.g-search { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 0 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: #120b1e; max-width: 520px; }
.g-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(166, 107, 235, .25); }
.g-search .ic { color: var(--accent); }
.g-search input { border: 0; background: transparent; box-shadow: none; min-height: 50px; padding: 0; font-size: 16px; }
.g-search input:focus { box-shadow: none; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.g-item { display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: 18px; background: var(--card); border: 1.5px solid var(--card-line); }
.g-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.g-head h3 { font-size: 17.5px; }
.g-alt { margin: 0; color: var(--gold); font-weight: 700; font-size: 14px; }
.g-item p:last-child { margin: 0; color: #d6cceb; font-size: 14px; line-height: 1.7; }
.g-empty { color: var(--muted); }
@media (max-width: 720px) { .quiz-card { padding: 18px; } .q-ch { font-size: 15px; } }

.tt-head { align-items: center; }
.tt-head small { margin-inline-start: auto; }
.tt-x { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 0; background: rgba(29, 42, 40, .08); color: #1d2a28; cursor: pointer; }
.tt-x:hover { background: rgba(239, 93, 88, .16); color: #b3261e; }
.tt-x .ic { width: 16px; height: 16px; stroke-width: 2.6; }

/* reading card inside the live explanation */
.rd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; width: 100%; margin: 6px 0; padding: 8px 10px; border-radius: 12px; background: rgba(166, 107, 235, .1); border: 1px solid rgba(166, 107, 235, .35); }
.rd-v { padding: 2px 10px; border-radius: 8px; background: var(--lcd); color: var(--lcd-ink); font: italic 800 15px var(--f-mono); box-shadow: inset 0 0 0 2px #17191c; }
.rd b { color: #fff; }
.rd small { color: var(--muted); }
.live > span:last-child { display: block; }
.sf-note { max-width: 1240px; margin: 0 auto; padding: 0 var(--gut-r) 10px var(--gut-l); color: #e8d9b0; font-size: 13px; text-align: center; }
/* AC vs DC */
.acdc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.acdc article { display: grid; gap: 8px; padding: 18px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--card-line); }
.acdc h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.acdc svg { width: 100%; height: auto; border-radius: 12px; background: #120b1e; direction: ltr; }
.acdc p { margin: 0; color: #d6cceb; font-size: 14.5px; line-height: 1.8; }
@media (max-width: 720px) { .acdc { grid-template-columns: 1fr; } }
