:root{color-scheme:dark;background:#120f20;color:#f7edff;font:16px/1.5 system-ui;--ink:#f7edff;--muted:#d3c7e4;--edge:#65577c}
*,*::before,*::after{box-sizing:border-box}
body{margin:0;min-width:0;background:linear-gradient(#18122552,#120f20 53rem),url('lair.svg') center top/auto 38rem no-repeat}
a{color:#eed9ff;text-underline-offset:.2em}
button,a{touch-action:manipulation}
button{font:inherit;cursor:pointer}
button:disabled{cursor:default;opacity:.55}
:focus-visible{outline:3px solid #ffe68f;outline-offset:3px}
header,main{max-width:66rem;margin:auto;padding-inline:clamp(.75rem,3vw,1.5rem)}
header{height:4.4rem;display:flex;justify-content:space-between;align-items:center;gap:1rem}
header a:first-child{display:flex;align-items:center;gap:.55rem;text-decoration:none}
header img{width:1.8rem;height:1.8rem;object-fit:contain;border-radius:50%}
.intro{padding-block:clamp(.9rem,3vw,1.75rem) 1.05rem;max-width:48rem}
.kicker{letter-spacing:.13em;font-weight:800;font-size:.87rem;margin:0;color:#dfc5ff}
h1,h2{font-family:Georgia,serif;letter-spacing:-.04em;margin:.4rem 0}
h1{font-size:clamp(2.85rem,7.2vw,6.3rem);line-height:.89;text-shadow:0 2px 20px #080514}
h1 em{color:#e0b6ff}
.lede{font-size:clamp(1rem,2vw,1.2rem);color:#efe3f8;max-width:36ch;margin:.95rem 0 0;text-shadow:0 2px 9px #080514}
.mission{max-width:47rem;background:#1b152bed;border:1px solid var(--edge);padding:clamp(.6rem,2vw,1.2rem);border-radius:1rem;box-shadow:0 18px 65px #07051099}
.hud,.control-row,footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap}
.hud{padding:.15rem 0 .66rem;color:#f4e7ff;font-size:.88rem;font-weight:750}
.viewport{position:relative;isolation:isolate;overflow:hidden;background:#15142d;border-radius:.68rem}
#board{display:grid;position:relative;grid-template:repeat(10,1fr)/repeat(11,1fr);width:100%;aspect-ratio:11/10;isolation:isolate;background:radial-gradient(ellipse at 70% 20%,#4c375f,#17152f)}
.tile{position:relative;display:grid;place-items:center}
.bulkhead{background:linear-gradient(153deg,#0d10259e,#16142608 35%,#3d34536b 61%,#17172c);box-shadow:inset 0 2px #9a86b125,inset 0 -2px #0d0f27,inset -1px 0 #3d355370}
.bulkhead::after{content:"";width:65%;height:30%;border-top:1px solid #baa1d82b;border-bottom:1px solid #100e26aa;transform:skew(-20deg);opacity:.75}
.floor{background:linear-gradient(135deg,#a9b5f315,#0000 56%,#0004),var(--floor);border:.5px solid #d0b8ed18;border-radius:9%;box-shadow:inset 0 0 5px #efe3ff13}
.floor-blue{--floor:#335275}.floor-violet{--floor:#59456f}.floor-teal{--floor:#2f605f}.floor-amber{--floor:#664d60}
.circuit{width:34%;aspect-ratio:1;border:1px solid #fffbe2;transform:rotate(45deg);background:linear-gradient(135deg,#fff6ba 20%,#f9b67f 75%);border-radius:16%;box-shadow:0 0 0 3px #ffb06d2f,0 0 13px #ffca8c}
.collected .circuit{visibility:hidden}
.hatch{width:64%;height:67%;border:2px solid #e3aad0;border-bottom:3px solid #e3aad0;border-radius:48% 48% 12% 12%;background:linear-gradient(90deg,#782840 48%,#e3aac5 49% 53%,#782840 54%);box-shadow:0 0 11px #dd74a680}
.powered .hatch{border-color:#bffff0;background:#57c7bc;box-shadow:0 0 15px #6dffd7}
.tracer{position:absolute;width:calc(100% / 11);height:calc(100% / 10);top:0;left:0;display:grid;place-items:center;pointer-events:none;transform:translate(calc(var(--x,1) * 100%),calc(var(--y,1) * 100%));transition:transform .11s ease-out}
.tracer::after{content:"";width:54%;aspect-ratio:1;box-shadow:0 0 0 2px #0e3037,0 0 12px #6cf7dc;display:block;border-radius:50%;border:2px solid #effff8;background:radial-gradient(circle at 37% 34%,white 9%,#91ffe5 23%,#31a8b2 54%,#163951 74%)}
.modal{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:1rem;background:radial-gradient(ellipse at 55% 30%,#2e2149ed,#171124ee);z-index:2}
.modal[hidden]{display:none}
.modal h2{font-size:clamp(1.8rem,5vw,3.45rem);line-height:1;color:#ffefd8}
.modal p:not(.kicker){max-width:31ch;color:#e5d6f0;margin:.65rem auto 1rem}
.primary,.control-row button{min-height:44px;border:1px solid #e8cffb;border-radius:.5rem;padding:.55rem .75rem;font-weight:750}
.primary{background:#e9d5ff;color:#2d1842}
.control-row{margin-top:.72rem}
.dpad{display:grid;grid-template-columns:repeat(3,minmax(44px,3.2rem));gap:.25rem}
.dpad button:first-child{grid-column:2}
.dpad button:nth-child(2){grid-column:1;grid-row:2}
.dpad button:nth-child(3){grid-column:2;grid-row:2}
.dpad button:nth-child(4){grid-column:3;grid-row:2}
.control-row button{background:#2c2343;color:var(--ink);border-color:#86709e}
.dpad button{font-size:1.25rem;line-height:1;padding:0}
.secondary{display:flex;gap:.3rem}
.readout{margin-top:.7rem;border-top:1px solid #534663;padding-top:.55rem}
.readout p,.help{margin:.2rem 0;font-size:.92rem;color:var(--muted)}
#position{color:#f1d4ff;font-weight:750}
#status{min-height:1.5em;color:#ffe4a9}
.help span{display:block}
footer{padding-block:1.1rem 2rem}
@media(prefers-reduced-motion:reduce){.tracer{transition:none}}
