/* المنطق · DTK-02 Logic Lab
   Design language: KH-01 "mission-control telemetry over real photography".
   Black, warm white, one red. Arabic leads; English mono labels act as instrument readouts. */

/* ---------- Fonts (self-hosted, @fontsource subsets) ---------- */
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 600; src: url(../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 700; src: url(../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 600; src: url(../fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-display: swap; font-weight: 700; src: url(../fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

/* ---------- Tokens ---------- */
:root {
    --red: #ff3b30;
    --ink: #f3f0ea;
    --ink-2: rgba(243, 240, 234, 0.72);
    --ink-3: rgba(243, 240, 234, 0.44);
    --line: rgba(243, 240, 234, 0.22);
    --line-2: rgba(243, 240, 234, 0.14);
    --line-3: rgba(243, 240, 234, 0.08);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --expo: cubic-bezier(0.16, 1, 0.3, 1);
    --io3: cubic-bezier(0.65, 0, 0.35, 1);
    --in3: cubic-bezier(0.32, 0, 0.67, 0);
    --sans: 'IBM Plex Sans Arabic', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --side: clamp(20px, 5vw, 80px);
    --rail: clamp(64px, 8vw, 132px);
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; color: var(--ink); font-family: var(--sans); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
[hidden] { display: none !important; }

.mono {
    font-family: var(--mono); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase;
    direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums;
}
.kicker { font-size: 11px; color: var(--red); letter-spacing: 0.14em; }
.red-num { color: var(--ink); }
.grid-bg {
    background-color: #000;
    background-image: linear-gradient(rgba(243, 240, 234, 0.045) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(243, 240, 234, 0.045) 1px, transparent 1px);
    background-size: 72px 72px; background-position: center;
}
.blink { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Pills and capsules ---------- */
.pill {
    height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-weight: 600; font-size: 15px; white-space: nowrap; cursor: pointer; user-select: none;
    transition: background .25s var(--ease), color .25s var(--ease), opacity .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}
.pill:hover:not(:disabled) { background: rgba(243, 240, 234, 0.12); }
.pill:active:not(:disabled) { transform: scale(0.97); }
.pill:disabled { opacity: 0.32; cursor: default; }
.pill-primary { background: var(--ink); color: #000; border-color: var(--ink); }
.pill-primary:hover:not(:disabled) { background: #fff; }
.pill-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.pill-ghost { border-color: transparent; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; height: 36px; padding: 0 14px; font-size: 14px; }
.pill-ghost.active, .pill-ghost.active:hover:not(:disabled) { background: var(--ink); color: #000; }

.capsule {
    display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px;
    background: rgba(0, 0, 0, 0.62); border: 1px solid var(--line-2);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.cap-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; flex: none; }

.text-link {
    font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 2px;
    transition: color .25s var(--ease), border-color .25s var(--ease);
}
.text-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Sound control (global, top left) ---------- */
.sound {
    position: fixed; top: 14px; left: 14px; z-index: 60; display: flex; align-items: center; gap: 6px; direction: ltr;
    padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line-2);
    background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sound-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: background .25s var(--ease); }
.sound-btn:hover { background: rgba(243, 240, 234, 0.12); }
.sound-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn .sound-off { display: none; }
.sound-btn[aria-pressed="false"] .sound-on { display: none; }
.sound-btn[aria-pressed="false"] .sound-off { display: inline; }
.sound-sep { width: 1px; height: 16px; background: var(--line); }
.sound-label { font-size: 10px; color: var(--ink-3); }

/* ---------- HUD log (top centre) ---------- */
.hud-log {
    position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 5; text-align: center;
    font-size: 10px; line-height: 1.8; color: var(--ink-2); pointer-events: none; white-space: nowrap;
}
.hud-log p:last-child { color: var(--ink-3); }

/* ---------- Stages ---------- */
.stage { position: fixed; inset: 0; transition: opacity .6s var(--ease), transform .9s var(--io3), filter .6s var(--ease); }
body:not(.at-intro) .intro { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .5s var(--ease), visibility 0s linear .5s; }
body:not(.at-lab) .lab { opacity: 0; visibility: hidden; pointer-events: none; }
body.sheet-open .stage { opacity: 0.2; transform: scale(0.97); }

/* ---------- 1. Intro ---------- */
.intro { background: #000; overflow: hidden; }
.intro::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.94) 26%, rgba(0, 0, 0, 0.62) 44%, rgba(0, 0, 0, 0) 62%);
}
.intro-obj { position: absolute; left: -3vw; top: 47%; width: min(56vw, 1040px); margin: 0; transform: translate3d(var(--px, 0px), calc(-50% + var(--py, 0px)), 0); }
.intro-obj::before {
    content: ''; position: absolute; inset: -12% -8%; pointer-events: none;
    background: radial-gradient(closest-side, rgba(255, 59, 48, 0.12), rgba(255, 59, 48, 0.03) 60%, rgba(255, 59, 48, 0) 80%);
}
.intro-obj img {
    position: relative; display: block; width: 100%; height: auto;
    filter: drop-shadow(0 40px 90px rgba(0, 0, 0, 0.65));
    animation: drift 32s var(--io3) infinite alternate;
}
@keyframes drift { from { transform: scale(1.06) translateX(0); } to { transform: scale(1) translateX(-1.5%); } }
.intro.leaving .intro-obj img { transform: scale(1.55); filter: blur(10px) brightness(1.4); opacity: 0; transition: transform 1.1s var(--in3), filter 1.1s var(--in3), opacity 1.1s var(--in3); animation: none; }
.intro.leaving .intro-copy { opacity: 0; filter: blur(10px); transition: opacity .35s cubic-bezier(.55, 0, 1, .45), filter .35s cubic-bezier(.55, 0, 1, .45); }

.intro-copy {
    position: absolute; z-index: 2; right: var(--side); bottom: clamp(40px, 10vh, 120px); width: min(560px, 40vw);
    display: grid; justify-items: start; gap: 18px;
}
.wordmark { font-weight: 700; font-size: clamp(76px, 13vw, 210px); line-height: 0.92; margin-top: 6px; }
.lead { font-size: clamp(15px, 1.25vw, 18px); line-height: 1.85; color: var(--ink-2); --st: 26ms; text-wrap: pretty; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.9); }
.intro-cta { margin-top: 10px; }
.hint { font-size: 13px; color: var(--ink-3); }

/* Word-by-word headline entrance */
[data-words] .w { display: inline-block; opacity: 0; transform: translateY(55%); filter: blur(14px);
    transition: transform 1.15s var(--expo), opacity 1.15s var(--expo), filter 1.15s var(--expo);
    transition-delay: calc(var(--i, 0) * var(--st, 90ms)); }
[data-words].words-in .w { opacity: 1; transform: none; filter: none; }

/* ---------- 2. Lab (workbench) ---------- */
.lab { display: grid; grid-template-rows: 76px minmax(0, 1fr) auto; padding: 0 20px; overflow: hidden; }
.lab-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-left: 116px; }
.lab-top::before { content: ''; position: absolute; inset: 0 -20px -20px; background: linear-gradient(rgba(5, 5, 5, 0.75), rgba(5, 5, 5, 0)); pointer-events: none; z-index: -1; }
.lab-top .hud-log { top: 20px; }
.capsule-aux .pill-ghost { height: 34px; padding: 0 13px; font-size: 13.5px; }
#upload-label { cursor: pointer; }

/* Power-on: panels switch on like displays, not like fades */
body.at-lab .pwr { animation: pwr .45s steps(6) both; animation-delay: calc(0.2s + var(--d, 0) * 0.12s); }
@keyframes pwr { from { opacity: 0; } to { opacity: 1; } }

#board-scroll { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 4px 0; }
.board-frame { position: relative; padding: 24px 22px; flex: none; }
#board-wrapper {
    --board-h: calc(100svh - 76px - 112px - 56px);
    position: relative; width: min(calc(100vw - 84px), calc(var(--board-h) * (2048 / 1534)));
    aspect-ratio: 2048 / 1534; margin: 0 auto;
}
#board-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; user-select: none; }
.bk { position: absolute; width: 16px; height: 16px; border: 0 solid var(--red); pointer-events: none; }
.bk1 { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.bk2 { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.bk3 { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.bk4 { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.fl { position: absolute; font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.14em; pointer-events: none; display: flex; align-items: center; gap: 6px; }
.fl-tl { top: 3px; left: 26px; }
.fl-tr { top: 3px; right: 26px; color: var(--ink-2); }
.fl-tr i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.fl-bl { bottom: 3px; left: 26px; }
.fl-br { bottom: 3px; right: 26px; }
#tl-mode { color: var(--red); }

.lab-bottom {
    display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "hint tools status";
    align-items: center; gap: 16px; padding: 10px 0 max(16px, env(safe-area-inset-bottom));
}
.capsule-tools { grid-area: tools; }
.hud-status { grid-area: status; justify-self: end; display: grid; gap: 4px; max-width: 360px; text-align: left; direction: ltr; }
.hud-k { font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.16em; }
#status-msg { font-size: 11px; color: var(--ink); letter-spacing: 0.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 12px; position: relative; }
#status-msg::before { content: ''; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--red); }
#status-msg.flash { animation: flash .5s steps(5); }
@keyframes flash { 0%, 40%, 80% { opacity: 1; } 20%, 60% { opacity: .2; } }
.hud-hint { grid-area: hint; justify-self: start; font-size: 14px; color: var(--ink-2); line-height: 1.6; }

/* Board overlay (positions are percentages of the photo; colours follow the design) */
#wire-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
#ui-overlay { position: absolute; inset: 0; pointer-events: none; }
.interactive { pointer-events: auto; position: absolute; transform: translate(-50%, -50%); }
.hole { width: 1.4%; aspect-ratio: 1; border-radius: 50%; cursor: crosshair; background: transparent; transition: background .12s, box-shadow .12s; }
.hole:hover { background: rgba(243, 240, 234, 0.35); box-shadow: 0 0 0 2px rgba(243, 240, 234, 0.55); }
.hole.selected { background: rgba(255, 59, 48, 0.8); box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.25), 0 0 12px rgba(255, 59, 48, 0.7); }
.hole.connected { background: rgba(243, 240, 234, 0.16); }
.hole.net-highlight { background: rgba(255, 59, 48, 0.7); box-shadow: 0 0 10px rgba(255, 59, 48, 0.85); }
.hole.dc-hole { background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(243, 240, 234, 0.46); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55) inset; }
.hole.dc-hole:hover { background: rgba(243, 240, 234, 0.45); }
.switch-hitbox, .btn-hitbox, .ic-hitbox { background: transparent; cursor: pointer; border-radius: 2px; transition: box-shadow .15s; }
.switch-hitbox:hover, .btn-hitbox:hover, .ic-hitbox:hover { box-shadow: 0 0 0 1px rgba(243, 240, 234, 0.6), 0 0 12px rgba(243, 240, 234, 0.18); }

.wire-drawn { pointer-events: none; }
.wire-drawn .wire-sleeve { stroke: rgba(16, 16, 16, 0.62); stroke-width: 6.4px; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; filter: drop-shadow(0 1px 1.3px rgba(0,0,0,0.55)); transition: stroke-width .12s, filter .12s; }
.wire-drawn .wire-main { stroke-width: 3.6px; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; opacity: 0.98; transition: stroke-width .12s, filter .12s; }
.wire-drawn .wire-spec { stroke: rgba(255,255,255,0.22); stroke-width: 1.05px; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; opacity: 0.85; }
.wire-drawn .wire-cap { stroke: rgba(15,15,15,0.65); stroke-width: 0.8px; pointer-events: stroke; }
.wire-drawn:hover .wire-sleeve { stroke-width: 7.2px; }
.wire-drawn:hover .wire-main { stroke-width: 4.4px; opacity: 1; }
.wire-drawn:hover .wire-cap { r: 2.35px; }
/* Wires let clicks through to the points under them, except with the delete tool (click a wire to remove it). */
.wire-drawn .wire-sleeve, .wire-drawn .wire-main, .wire-drawn .wire-cap { pointer-events: none; }
body[data-tool="delete"] .wire-drawn .wire-sleeve, body[data-tool="delete"] .wire-drawn .wire-main { pointer-events: stroke; cursor: pointer; }
body[data-tool="delete"] .wire-drawn:hover .wire-sleeve { stroke: rgba(255, 59, 48, 0.7); }
.wire-drawn.wire-highlight .wire-sleeve { stroke: rgba(255, 59, 48, 0.55); stroke-width: 7.8px; filter: drop-shadow(0 0 5px rgba(255, 59, 48, 0.85)); }
.wire-drawn.wire-highlight .wire-main { stroke-width: 4.9px; filter: drop-shadow(0 0 3.5px rgba(255, 59, 48, 0.7)); }

.led-glow { width: 1.0%; aspect-ratio: 1; border-radius: 50%; opacity: 0; transition: opacity .05s; pointer-events: none; }
.led-glow.red { background: radial-gradient(circle, #ffb3ad, #ff2a1f); box-shadow: 0 0 10px #ff2a1f, 0 0 16px rgba(255, 42, 31, 0.6); }
.led-glow.green { background: radial-gradient(circle, #c4ffc0, #2bd62b); box-shadow: 0 0 10px #2bd62b, 0 0 16px rgba(43, 214, 43, 0.55); }
.led-glow.on { opacity: 0.95; }
.seven-seg { width: 3.5%; height: 6.5%; opacity: 0.9; }
.seg-line { fill: transparent; stroke: transparent; transition: fill .05s; }
.seven-seg .seg-line.on { fill: #ff2a1f; stroke: #ff2a1f; filter: drop-shadow(0 0 5px #ff2a1f); }

.ic-placed {
    position: absolute; background: linear-gradient(135deg, #1f1f1f, #111); border: 1px solid #000;
    color: rgba(243, 240, 234, 0.62); display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); letter-spacing: 0.06em; font-size: 0.7vw;
    box-shadow: 0 5px 8px rgba(0,0,0,0.9), inset 0 1px 1px rgba(255,255,255,0.18);
    border-radius: 2px; pointer-events: auto; writing-mode: vertical-lr; text-orientation: mixed; user-select: none;
}
.ic-placed .notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 25%; height: 5%; background: #000; border-radius: 0 0 4px 4px; box-shadow: inset 0 2px 2px rgba(0,0,0,0.9); }

/* Alignment editor */
.edit-mode .hole, .edit-mode .switch-hitbox, .edit-mode .btn-hitbox, .edit-mode .ic-hitbox { background: rgba(243, 240, 234, 0.18) !important; outline: 1px solid rgba(243, 240, 234, 0.7); cursor: move !important; }
.edit-mode .seven-seg { outline: 1px solid var(--ink-2); background: rgba(243, 240, 234, 0.08) !important; }
.edit-mode .seven-seg.selected-display { outline: 2px solid var(--red); box-shadow: 0 0 14px rgba(255, 59, 48, 0.6); }
.edit-mode .led-glow { opacity: 0.7; background: rgba(255, 59, 48, 0.45); outline: 1px dashed var(--red); display: block; pointer-events: auto; }
.edit-mode #tl-mode { color: var(--ink); }
.dragging { opacity: 0.4; z-index: 1000; box-shadow: 0 0 20px var(--ink) !important; }

/* ---------- IC picker (a HUD box) ---------- */
.ic-picker-modal {
    position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(0, 0, 0, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    animation: fade .3s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.ic-picker-dialog {
    width: min(980px, 96vw); max-height: min(86svh, 860px); display: flex; flex-direction: column; gap: 14px;
    background: #050505; border: 1px solid var(--line); padding: 20px 22px 22px; position: relative;
    animation: pwr .45s steps(6) both;
}
.ic-picker-dialog::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(243,240,234,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(243,240,234,.05) 1px, transparent 1px);
    background-size: 22px 22px; -webkit-mask-image: radial-gradient(circle at 50% 0%, #000, transparent 70%); mask-image: radial-gradient(circle at 50% 0%, #000, transparent 70%);
}
.ic-picker-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; }
.ic-picker-header h3 { font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; line-height: 1.2; margin-top: 6px; }
.ic-picker-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); font-size: 18px; line-height: 1; display: grid; place-items: center; transition: background .25s var(--ease); flex: none; }
.ic-picker-close:hover { background: rgba(243, 240, 234, 0.12); }
.ic-picker-search {
    position: relative; width: 100%; height: 44px; padding: 0 2px; background: none; color: var(--ink);
    border: 0; border-bottom: 1px solid var(--line); font: inherit; font-size: 15px; outline: none;
}
.ic-picker-search:focus { border-bottom-color: var(--red); }
.ic-picker-search::placeholder { color: var(--ink-3); }
.ic-picker-grid { position: relative; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 2px; }
.ic-picker-card {
    text-align: right; border: 1px solid var(--line-2); background: rgba(9, 9, 9, 0.8); padding: 14px; display: grid; gap: 6px; align-content: start;
    transition: border-color .25s var(--ease), background .25s var(--ease);
}
.ic-picker-card:hover, .ic-picker-card:focus-visible { border-color: var(--red); background: rgba(255, 59, 48, 0.05); }
.ic-picker-chip { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: 0.02em; direction: ltr; text-align: right; line-height: 1.1; }
.ic-picker-desc { font-size: 10.5px; color: var(--ink-3); }
.ic-picker-pins summary { font-size: 13px; color: var(--ink-2); cursor: pointer; margin-top: 4px; }
.ic-picker-pins ul { list-style: none; margin-top: 8px; max-height: 140px; overflow: auto; border-top: 1px solid var(--line-3); direction: ltr; }
.ic-picker-pins li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line-3); font-family: var(--mono); font-size: 10.5px; }
.ic-picker-pins li span { color: var(--ink-3); }
.ic-picker-pins li strong { font-weight: 500; }
.ic-picker-pins li em { color: var(--ink-3); font-style: normal; text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.08em; }
.ic-picker-empty { color: var(--ink-3); font-size: 12px; }

/* ---------- AI assistant (a HUD box) ---------- */
.ai-panel {
    position: fixed; left: 20px; bottom: 96px; width: min(400px, calc(100vw - 40px)); height: min(540px, calc(100svh - 200px));
    background: rgba(5, 5, 5, 0.94); border: 1px solid var(--line); display: flex; flex-direction: column; z-index: 55;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    transition: opacity .3s var(--ease), transform .45s var(--ease), visibility 0s;
}
.ai-panel.hidden { opacity: 0; transform: translateY(14px); pointer-events: none; visibility: hidden; transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s linear .25s; }
.ai-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); direction: ltr; }
.ai-header .mono { font-size: 10px; color: var(--ink-2); letter-spacing: 0.14em; display: flex; align-items: center; gap: 8px; }
.ai-header .mono i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.ai-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 15px; }
.ai-close:hover { background: rgba(243, 240, 234, 0.12); }
.ai-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: 88%; font-size: 14.5px; line-height: 1.75; word-wrap: break-word; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; color: var(--ink-2); padding-inline-start: 12px; border-inline-start: 1px solid var(--red); }
.ai-msg.user { align-self: flex-end; color: var(--ink); background: rgba(243, 240, 234, 0.08); padding: 8px 12px; }
.ai-msg.typing { color: var(--ink-3); }
.ai-input-area { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: center; }
.ai-input-area input[type="text"], .ai-input-area input[type="password"] {
    flex: 1; min-width: 0; height: 38px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink);
    font: inherit; font-size: 14px; padding: 0 4px; outline: none;
}
.ai-input-area input:focus { border-bottom-color: var(--red); }
.ai-input-area input::placeholder { color: var(--ink-3); }
.ai-input-area .pill { height: 36px; padding: 0 14px; font-size: 13.5px; }
.ai-img-preview { position: relative; padding: 8px 10px; border-top: 1px solid var(--line-2); }
.ai-img-preview img { max-height: 80px; display: block; }
.ai-img-preview button { position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.7); border: 1px solid var(--line); font-size: 12px; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line-2); padding: 5px; text-align: center; }
.markdown-body th { color: var(--ink-3); font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.markdown-body pre { background: #0b0b0b; padding: 10px; overflow-x: auto; margin: 6px 0; border: 1px solid var(--line-3); direction: ltr; }
.markdown-body code { font-family: var(--mono); font-size: .9em; color: var(--ink); background: rgba(243, 240, 234, 0.08); padding: 1px 4px; }

/* ---------- 3. The about sheet (rises over the stage) ---------- */
.sheet {
    position: fixed; inset: 0; z-index: 40; background: #050505; transform: translateY(100%); visibility: hidden;
    transition: transform .95s var(--io3), visibility 0s linear .95s;
}
body.sheet-open .sheet { transform: none; visibility: visible; transition: transform 1.15s var(--io3), visibility 0s; }
.sheet-top { position: absolute; top: 0; left: 0; right: 0; height: 96px; z-index: 4; display: flex; align-items: flex-start; padding: 14px var(--side) 0 0; background: linear-gradient(rgba(5, 5, 5, 0.85), rgba(5, 5, 5, 0)); pointer-events: none; }
.sheet-top > * { pointer-events: auto; }
.sheet-top .hud-log { pointer-events: none; }

.rail { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); z-index: 4; }
.rail ol { list-style: none; display: grid; gap: 4px; direction: ltr; justify-items: start; }
.rail button { display: flex; align-items: center; gap: 10px; height: 23px; direction: ltr; color: var(--ink-3); }
.rail .tk { width: 10px; height: 1px; background: currentColor; transition: width .4s var(--ease), background .4s var(--ease); }
.rail .n { font-size: 10px; }
.rail .nm { font-size: 13px; opacity: 0; transform: translateX(-6px); transition: opacity .4s var(--ease), transform .4s var(--ease); direction: rtl; }
.rail button:hover { color: var(--ink-2); }
.rail button:hover .nm { opacity: 1; transform: none; }
.rail [aria-current="step"] { color: var(--red); }
.rail [aria-current="step"] .tk { width: 24px; }
.rail [aria-current="step"] .nm { opacity: 1; transform: none; }

.meter { position: absolute; left: 30px; bottom: 18px; z-index: 4; font-size: 10px; color: var(--ink-2); letter-spacing: 0.14em; pointer-events: none; }
.meter b { font-weight: 400; color: var(--red); }
.meter .meter-name { color: var(--ink-3); margin-top: 4px; }
.meter-bar { display: block; width: 120px; height: 1px; background: var(--line); margin-top: 8px; position: relative; }
.meter-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--red); height: 2px; top: -0.5px; transition: width .2s linear; }

.sheet-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--side) 0 clamp(170px, 17vw, 260px); scroll-behavior: smooth; }
.sc { max-width: 1180px; margin: 0 auto; padding: clamp(110px, 16vh, 170px) 0 clamp(60px, 10vh, 120px); display: grid; gap: 22px; }
.sc + .sc { border-top: 1px solid var(--line-3); }
.sc-title { font-size: clamp(30px, 3.6vw, 54px); font-weight: 700; line-height: 1.12; text-wrap: balance; max-width: 900px; }
.sc-lead { font-size: clamp(15px, 1.2vw, 17.5px); line-height: 1.85; color: var(--ink-2); max-width: 720px; }

[data-in] { opacity: 0; translate: 0 18px; transition: opacity .9s var(--ease), translate .9s var(--ease); }
[data-in].in { opacity: 1; translate: 0 0; }
[data-in] > [style*="--i"] { opacity: 0; translate: 0 14px; transition: opacity .9s var(--ease), translate .9s var(--ease); transition-delay: calc(var(--i) * 90ms + 120ms); }
[data-in].in > [style*="--i"] { opacity: 1; translate: 0 0; }

/* Overview: tile | photo card | tile */
.three { display: grid; grid-template-columns: 1fr 2.3fr 1fr; gap: 16px; margin-top: 26px; align-items: stretch; }
.tile { border-radius: 18px; padding: 20px 22px; background: rgba(9, 9, 9, 0.74); border: 1px solid rgba(243, 240, 234, 0.1); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); display: grid; align-content: start; gap: 14px; }
.tile-k { font-size: 10px; color: var(--ink-3); letter-spacing: 0.14em; }
.rows { list-style: none; display: grid; }
.rows li { display: flex; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-3); font-size: 14.5px; }
.rows li i { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-4px); }
.rows li b { font-size: 12px; font-weight: 400; color: var(--ink); }
.photo-card { position: relative; margin: 0; border-radius: 18px; overflow: hidden; background: #070707; border: 1px solid rgba(243, 240, 234, 0.08); display: grid; place-items: center; padding: 22px 22px 40px; min-height: 300px; }
.photo-card::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(243,240,234,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(243,240,234,.045) 1px, transparent 1px); background-size: 22px 22px; background-position: center; -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 80%); mask-image: radial-gradient(circle, #000 30%, transparent 80%); }
.photo-card img { position: relative; width: 100%; height: auto; display: block; filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.7)); }
.photo-card figcaption { position: absolute; bottom: 14px; left: 18px; font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.14em; }
.tile-count { align-content: space-between; }
.counter { font-size: clamp(84px, 9vw, 150px); line-height: 0.9; color: var(--red); letter-spacing: -0.03em; direction: ltr; text-align: right; }
.tile-note { font-size: 14px; line-height: 1.75; color: var(--ink-2); }

/* Procedure: checklist console */
.console { border: 1px solid var(--line); margin-top: 18px; position: relative; }
.console-head { display: flex; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 10px; color: var(--ink-2); letter-spacing: 0.14em; }
.console-head b { font-weight: 400; color: var(--red); }
.console-rows { list-style: none; }
.console-rows li {
    display: grid; grid-template-columns: 64px 1fr 130px; gap: 16px; align-items: center; padding: 18px; border-bottom: 1px solid var(--line-3);
    clip-path: inset(0 0 0 100%); transition: clip-path .9s var(--ease);
}
.console-rows li:last-child { border-bottom: 0; }
.console-rows li.shown { clip-path: inset(0 0 0 0); }
.console-rows li > .mono:first-child { font-size: 11px; color: var(--ink-3); }
.console-rows p { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); }
.console-rows strong { color: var(--ink); font-weight: 600; }
.st { font-size: 10px; color: var(--ink-3); letter-spacing: 0.16em; text-align: left; }
.st.on { color: var(--red); }
.st.on::after { content: ' ▮'; animation: blink 1s steps(1) infinite; }
.console-bar { position: absolute; left: -1px; right: -1px; bottom: -3px; height: 2px; }
.console-bar i { display: block; height: 100%; width: 0; background: var(--red); margin-left: auto; transition: width .9s var(--ease); }

/* Chips: filters + table with DIP pinouts */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; transition: background .25s var(--ease), color .25s var(--ease); }
.chip .mono { font-size: 10px; color: var(--ink-3); font-weight: 400; }
.chip:hover { background: rgba(243, 240, 234, 0.08); }
.chip[aria-pressed="true"] { background: var(--ink); color: #000; border-color: var(--ink); }
.chip[aria-pressed="true"] .mono { color: rgba(0, 0, 0, 0.55); }
.table { border-top: 1px solid var(--line); margin-top: 6px; }
.trow { border-bottom: 1px solid var(--line-3); }
.trow > button { width: 100%; display: grid; grid-template-columns: 48px 120px 1fr 90px 28px; gap: 14px; align-items: center; padding: 14px 6px; text-align: right; transition: background .2s var(--ease); }
.trow > button:hover { background: rgba(243, 240, 234, 0.04); }
.trow .t-n { font-size: 10.5px; color: var(--red); }
.trow .t-chip { font-family: var(--mono); font-size: 22px; font-weight: 500; direction: ltr; text-align: right; }
.trow .t-fn { font-size: 11px; color: var(--ink-2); text-align: right; }
.trow .t-pins { font-size: 10.5px; color: var(--ink-3); text-align: right; }
.trow .t-x { font-family: var(--mono); color: var(--ink-3); font-size: 18px; transition: transform .35s var(--ease), color .2s; }
.trow.open .t-x { transform: rotate(45deg); color: var(--red); }
.trow .t-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ease); }
.trow.open .t-more { grid-template-rows: 1fr; }
.t-more > div { overflow: hidden; }
.dip { display: grid; grid-template-columns: 1fr 120px 1fr; gap: 0; width: min(560px, 100%); margin: 8px auto 26px; direction: ltr; }
.dip-side { display: grid; align-content: stretch; }
.dip-pin { display: flex; align-items: center; gap: 8px; height: 26px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; }
.dip-l .dip-pin { justify-content: flex-end; }
.dip-pin .pn { color: var(--ink-3); width: 18px; text-align: center; }
.dip-pin .stub { width: 18px; height: 1px; background: var(--line); }
.dip-pin.out .nm::after { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--red); margin: 0 6px; vertical-align: middle; }
.dip-pin.pw .nm { color: var(--ink-3); }
.dip-body { border: 1px solid var(--line); position: relative; display: grid; place-items: center; }
.dip-body::before { content: ''; position: absolute; top: -1px; left: 50%; width: 22px; height: 11px; transform: translateX(-50%); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 11px 11px; background: #050505; }
.dip-body span { font-family: var(--mono); font-size: 13px; writing-mode: vertical-rl; letter-spacing: 0.2em; color: var(--ink-2); }
.dip-legend { font-size: 9.5px; color: var(--ink-3); text-align: center; letter-spacing: .14em; margin-bottom: 20px; }

/* Experiment: callout + result tile */
.exp { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 18px; align-items: start; }
.callout { border: 1px solid var(--red); background: #070707; padding: 22px 24px; display: grid; gap: 14px; }
.callout ul { list-style: none; display: grid; gap: 10px; }
.callout li { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); padding-inline-start: 22px; position: relative; }
.callout li::before { content: '—'; position: absolute; right: 0; color: var(--red); }
.eq { font-size: clamp(18px, 1.8vw, 24px); color: var(--ink); letter-spacing: 0.04em; }
.tt { border-collapse: collapse; width: 100%; font-size: 12px; }
.tt th { font-weight: 400; color: var(--ink-3); font-size: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tt td { text-align: center; padding: 5px 0; border-bottom: 1px solid var(--line-3); color: var(--ink-2); }
.tt td.f1 { color: var(--red); }

/* Contact, maker card, footer */
.sc-end { padding-bottom: 60px; }
.ct-big { font-size: clamp(56px, 10vw, 180px); font-weight: 700; line-height: 0.98; margin: 8px 0 18px; }
.ct-l { display: block; }
.ct-l + .ct-l, .ct-l:last-child .w { color: var(--red); }
.ct-rows { list-style: none; border-top: 1px solid var(--line-3); max-width: 860px; }
.ct-rows li { display: flex; align-items: baseline; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line-3); }
.ct-rows .mono { width: 110px; flex: none; font-size: 10px; color: var(--ink-3); text-align: right; }
.ct-rows i { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-5px); min-width: 30px; }
.ct-rows a { font-size: clamp(16px, 1.6vw, 21px); text-decoration: none; transition: color .25s var(--ease); }
.ct-rows a:hover { color: var(--red); }
.ct-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.mk { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; border: 1px solid var(--line); margin-top: clamp(40px, 7vh, 80px); background: linear-gradient(270deg, rgba(255, 59, 48, 0.07), rgba(255, 59, 48, 0) 70%); max-width: 880px; }
.mk-photo { position: relative; margin: 0; aspect-ratio: 720 / 799; overflow: hidden; background: radial-gradient(58% 50% at 50% 40%, rgba(255, 59, 48, 0.26), rgba(255, 59, 48, 0.05) 60%, rgba(255, 59, 48, 0) 78%), #070707; }
.mk-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(243, 240, 234, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(243, 240, 234, 0.07) 1px, transparent 1px); background-size: 22px 22px; background-position: center; -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 25%, transparent 78%); mask-image: radial-gradient(circle at 50% 42%, #000 25%, transparent 78%); }
.mk-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; filter: drop-shadow(0 0 1px rgba(255, 59, 48, 0.55)) drop-shadow(0 0 24px rgba(255, 59, 48, 0.22)); clip-path: inset(100% 0 0 0); transition: clip-path 1.5s var(--ease) .25s; }
.mk.in .mk-photo img { clip-path: inset(0 0 0 0); }
.mk-photo::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.26) 0 1px, rgba(0, 0, 0, 0) 1px 3px); }
.mk-scan { position: absolute; left: 0; right: 0; top: 100%; height: 2px; background: var(--red); box-shadow: 0 0 14px 2px rgba(255, 59, 48, 0.55); opacity: 0; pointer-events: none; }
.mk.in .mk-scan { animation: mk-develop 1.5s var(--ease) .25s both, mk-sweep 7s linear 2.4s infinite; }
@keyframes mk-develop { 0% { top: 100%; opacity: 1; } 92% { opacity: 1; } 100% { top: 0; opacity: 0; } }
@keyframes mk-sweep { 0% { top: 100%; opacity: 0; } 6% { opacity: .35; } 40% { top: 0; opacity: .35; } 46%, 100% { top: 0; opacity: 0; } }
.mk-c { position: absolute; width: 16px; height: 16px; border: 0 solid var(--red); pointer-events: none; }
.mk-c1 { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.mk-c2 { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.mk-c3 { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }
.mk-c4 { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.mk-rec { position: absolute; bottom: 14px; left: 34px; display: flex; align-items: center; gap: 6px; font-size: 9px; letter-spacing: 0.14em; color: var(--ink-2); }
.mk-rec i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.6s steps(1) infinite; }
.mk-text { display: grid; gap: 12px; align-content: center; padding: clamp(22px, 3vw, 40px); }
.mk-name { font-weight: 700; font-size: clamp(38px, 4.8vw, 68px); line-height: 1.15; }
.mk-role { font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; line-height: 1.6; }
.mk-line { max-width: 440px; font-size: clamp(15px, 1.3vw, 18px); line-height: 1.8; color: var(--ink-2); }
.mk-tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin-top: 4px; justify-content: flex-end; }
.mk-tags li { padding: 5px 11px; border: 1px solid var(--line); font-size: 10px; letter-spacing: 0.12em; color: var(--ink-3); }
.foot { display: grid; gap: 10px; margin-top: clamp(50px, 9vh, 100px); padding-top: 22px; border-top: 1px solid var(--line-3); }
.foot-credit { font-size: 13.5px; line-height: 1.8; color: var(--ink-3); max-width: 760px; }
.foot-mark { font-size: 10px; color: var(--ink-3); letter-spacing: 0.22em; text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .intro-obj { width: 55vw; top: 44%; }
    .intro-copy { width: min(520px, 44vw); }
}
@media (max-width: 1240px) {
    .lab-top .hud-log { display: none; }
}
@media (max-width: 1100px) {
    .lab-bottom { grid-template-columns: 1fr 1fr; grid-template-areas: "hint status" "tools tools"; gap: 10px; }
    .capsule-tools { justify-self: center; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    #board-wrapper { --board-h: calc(100svh - 76px - 160px - 56px); }
    .three { grid-template-columns: 1fr 1fr; }
    .three .photo-card { grid-column: 1 / -1; order: -1; }
    .three .photo-card img { max-width: 680px; }
}
@media (max-width: 900px) {
    :root { --side: 20px; --rail: 20px; }
    .rail, .sheet-top .hud-log, .meter { display: none; }
    .sheet-scroll { padding: 0 var(--side); }
    .meter { left: 20px; }
    .intro-obj { left: 50%; top: 9svh; width: 108vw; transform: translate3d(-50%, 0, 0); }
    .intro::after { background: linear-gradient(0deg, #000 46%, rgba(0, 0, 0, 0.6) 62%, rgba(0, 0, 0, 0) 78%); }
    .intro-copy { left: 20px; right: 20px; width: auto; bottom: max(28px, env(safe-area-inset-bottom)); }
    .wordmark { font-size: clamp(72px, 22vw, 140px); }
    .intro .hud-log { display: none; }
    .lab { padding: 0 10px; }
    .lab-top { padding-left: 104px; }
    .capsule-aux { overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 230px); }
    #board-scroll { overflow: auto; align-items: flex-start; justify-content: flex-start; }
    .board-frame { margin: 0 auto; }
    #board-wrapper { width: max(calc(100vw - 64px), 720px); }
    .exp { grid-template-columns: 1fr; }
    .console-rows li { grid-template-columns: 40px 1fr; }
    .console-rows .st { grid-column: 2; }
    .trow > button { grid-template-columns: 34px 92px 1fr 24px; }
    .trow .t-pins { display: none; }
    .ai-panel { left: 10px; right: 10px; width: auto; bottom: 120px; }
}
@media (max-width: 620px) {
    .mk { grid-template-columns: 1fr; }
    .mk-photo { aspect-ratio: auto; height: min(96vw, 62svh); }
    .three { grid-template-columns: 1fr; }
    .hud-status { display: none; }
    .lab-bottom { grid-template-columns: 1fr; grid-template-areas: "hint" "tools"; }
    .hud-hint { font-size: 13px; }
}
@media (max-width: 520px) {
    .pill { height: 40px; padding: 0 16px; font-size: 14px; }
    .pill-ghost { height: 34px; padding: 0 11px; font-size: 13px; }
}

/* ---------- Reduced motion: every move has a calm fallback ---------- */
@media (prefers-reduced-motion: reduce) {
    .intro-obj img, .blink, .mk-rec i, .st.on::after { animation: none; }
    [data-words] .w { transform: none; filter: none; transition: opacity .4s linear; transition-delay: 0s; }
    [data-in], [data-in] > [style*="--i"] { translate: none; transition: opacity .4s linear; transition-delay: 0s; }
    body.at-lab .pwr { animation-duration: .2s; animation-delay: 0s; }
    .intro.leaving .intro-obj img { transform: none; filter: none; transition: opacity .3s linear; }
    .sheet, body.sheet-open .sheet { transition-duration: .35s; }
    .stage, body.sheet-open .stage { transform: none; }
    .console-rows li { transition: none; }
    .mk-photo img { transition: none; clip-path: none; }
    .mk.in .mk-scan { animation: none; }
    .sheet-scroll { scroll-behavior: auto; }
}
