:root{
  --amber:#ffb000; --amber-dim:#a86f00; --ink:rgba(12,10,6,.82);
  --red:#c91a09; --yellow:#f2cd37; --blue:#0055bf;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#0b1026;font-family:'JetBrains Mono',monospace;color:var(--amber)}
#scene-container{position:fixed;inset:0}
canvas{display:block;touch-action:none}
.hidden{display:none!important}

#boot{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(560px,92vw);
  background:var(--ink);border:2px solid var(--amber-dim);border-radius:10px;padding:18px 20px 20px;
  box-shadow:0 0 0 4px rgba(0,0,0,.4),0 20px 60px rgba(0,0,0,.6),inset 0 0 40px rgba(255,176,0,.06);
  transition:all .9s cubic-bezier(.7,0,.2,1);z-index:10;backdrop-filter:blur(3px)}
#boot::after{content:"";position:absolute;inset:0;border-radius:10px;pointer-events:none;
  background:repeating-linear-gradient(0deg,rgba(255,176,0,.04) 0 1px,transparent 1px 3px)}
#boot.building{left:14px;top:14px;transform:none;width:min(380px,70vw);padding:10px 12px}
#boot.building h1,#boot.building .sub{display:none}
.term-head{display:flex;gap:6px;align-items:center;font-size:11px;letter-spacing:.15em;color:var(--amber-dim)}
.term-head b{margin-left:8px;font-weight:800}
.dot{width:9px;height:9px;border-radius:50%;background:var(--amber-dim)}
h1{font-family:'Rubik Mono One',sans-serif;font-size:clamp(36px,9vw,68px);margin:12px 0 4px;color:#fff;
  letter-spacing:-.02em;text-shadow:4px 4px 0 var(--red),8px 8px 0 rgba(0,0,0,.5)}
h1 span{color:var(--yellow)}
.sub{font-size:12px;font-weight:300;line-height:1.5;opacity:.85;margin-bottom:10px}
#bootlog{font-size:12px;line-height:1.55;min-height:20px;max-height:170px;overflow:hidden;white-space:pre-wrap}
#bootlog div::after{content:""}
#bootlog div:last-child::after{content:"▋";animation:blink 1s steps(1) infinite;margin-left:2px}
@keyframes blink{50%{opacity:0}}
#progress{display:flex;gap:3px;margin:10px 0}
#progress i{flex:1;height:12px;background:#2a2112;border-radius:2px;position:relative;transition:background .2s}
#progress i.on{background:var(--yellow)}
#progress i.on:nth-child(3n){background:var(--red)}
#progress i.on:nth-child(4n){background:#4c8ef0}
#progress i::before{content:"";position:absolute;left:50%;top:-3px;width:6px;height:3px;margin-left:-3px;background:inherit;border-radius:2px 2px 0 0}
.btns{display:flex;gap:10px;flex-wrap:wrap;margin-top:8px}
#boot.building .btns #buildBtn{display:none}

.lego{position:relative;font-family:'Rubik Mono One',sans-serif;font-size:14px;color:#fff;border:none;cursor:pointer;
  padding:14px 18px 12px;border-radius:6px;background:var(--red);
  box-shadow:inset 0 -5px 0 rgba(0,0,0,.25),0 4px 0 rgba(0,0,0,.35);margin-top:8px;transition:transform .08s}
.lego::before,.lego::after{content:"";position:absolute;top:-7px;width:18px;height:8px;border-radius:4px 4px 0 0;background:inherit;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.3)}
.lego::before{left:18%}.lego::after{right:18%}
.lego:active{transform:translateY(3px)}
.lego.yellow{background:var(--yellow);color:#3a2a00}
.lego.blue{background:var(--blue)}
.lego.small{font-size:11px;padding:10px 12px 9px}

#cross{position:fixed;left:50%;top:50%;width:14px;height:14px;margin:-7px;border-radius:50%;
  border:2px solid rgba(255,255,255,.85);box-shadow:0 0 0 1px rgba(0,0,0,.4);pointer-events:none;transition:all .15s}
#cross.on{width:22px;height:22px;margin:-11px;border-color:var(--yellow);background:rgba(242,205,55,.15)}
#tip{position:fixed;left:50%;top:calc(50% + 22px);transform:translateX(-50%);background:var(--ink);color:var(--yellow);
  font-size:12px;padding:5px 9px;border-radius:4px;border:1px solid var(--amber-dim);pointer-events:none;white-space:nowrap;opacity:0;transition:opacity .15s}
#tip.on{opacity:1}
#log{position:fixed;left:12px;top:12px;width:min(360px,62vw);font-size:11px;line-height:1.5;background:var(--ink);
  border-left:3px solid var(--amber);padding:8px 10px;border-radius:0 6px 6px 0;pointer-events:none}
#log div{animation:fadein .4s}
@keyframes fadein{from{opacity:0;transform:translateX(-6px)}}
#minimap{position:fixed;right:12px;top:12px;width:150px;height:150px;border-radius:8px;background:var(--ink);border:2px solid var(--amber-dim)}
#floorLbl{position:fixed;right:12px;top:168px;width:150px;text-align:center;font-size:10px;letter-spacing:.2em}
#topbtns{position:fixed;right:12px;top:184px}
#hint{position:fixed;left:50%;bottom:64px;transform:translateX(-50%);font-size:11px;background:var(--ink);padding:5px 10px;border-radius:4px;white-space:nowrap;opacity:.85}
#cmdbar{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);width:min(560px,94vw);display:flex;align-items:center;gap:6px;
  background:var(--ink);border:1px solid var(--amber-dim);border-radius:6px;padding:6px 10px}
#cmd{flex:1;background:transparent;border:none;outline:none;color:var(--amber);font-family:inherit;font-size:13px}
#cmd::placeholder{color:var(--amber-dim)}
footer{position:fixed;right:10px;bottom:4px;font-size:10px;z-index:20}
footer a{color:var(--amber-dim)}

#joy,#mbtns{display:none}
body.touch #joy{display:block;position:fixed;left:24px;bottom:80px;width:120px;height:120px;border-radius:50%;
  background:rgba(12,10,6,.45);border:2px solid var(--amber-dim);z-index:5}
#knob{position:absolute;left:50%;top:50%;width:50px;height:50px;margin:-25px;border-radius:50%;background:var(--yellow);opacity:.85}
body.touch #mbtns{display:flex;flex-direction:column;gap:8px;position:fixed;right:20px;bottom:90px;z-index:5;align-items:flex-end}
body.touch #hint{display:none}
body.touch #cmdbar{bottom:20px;width:min(560px,70vw)}
body.prebuild #joy,body.prebuild #mbtns{display:none!important}
@media (max-width:600px){#minimap{width:100px;height:100px}#floorLbl{width:100px;top:116px}#topbtns{top:130px}#log{font-size:10px}}