:root{
  --deep:#07111f;      /* night water */
  --hull:#0e2135;      /* panel */
  --brass:#b98a3c;     /* fittings */
  --lamp:#f4c94e;      /* the light */
  --salt:#cfd8dd;      /* weathered paint */
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--deep);color:var(--salt);
  font:500 13px/1.45 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing:.04em;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:max(10px,env(safe-area-inset-top)) 10px max(10px,env(safe-area-inset-bottom));
  overflow:hidden;-webkit-user-select:none;user-select:none;
  -webkit-tap-highlight-color:transparent;
  height:100%;
}
#cab{width:100%;max-width:520px;height:100%;display:flex;flex-direction:column;gap:10px;min-height:0}

/* the lamp room: screen sits in a brass-lipped housing that glows amber */
#housing{
  position:relative;padding:8px;border-radius:10px;
  background:linear-gradient(180deg,#12283f,#0a1626);
  border:1px solid rgba(185,138,60,.55);
  box-shadow:0 0 0 1px rgba(0,0,0,.6) inset,0 18px 40px -18px #000,
             0 0 var(--glow,26px) rgba(244,201,78,.16);
  min-height:120px;flex:1 1 auto;display:flex;
}
#screen{position:relative;width:auto;height:100%;max-width:100%;aspect-ratio:4/3;background:#000;border-radius:4px;overflow:hidden;margin:auto}
canvas{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges}
#scan{
  position:absolute;inset:0;pointer-events:none;
  background:
    repeating-linear-gradient(to bottom,rgba(0,0,0,.22) 0 1px,rgba(0,0,0,0) 1px 3px),
    radial-gradient(120% 100% at 50% 50%,rgba(0,0,0,0) 55%,rgba(0,0,0,.55) 100%);
}

#pad{display:flex;gap:10px;align-items:stretch;flex-shrink:0}
.key{
  flex:1;appearance:none;border:1px solid rgba(185,138,60,.5);border-radius:8px;
  background:linear-gradient(180deg,#183149,#0d1e30);color:var(--salt);
  font:600 20px/1 ui-monospace,monospace;letter-spacing:.1em;
  padding:18px 0;touch-action:none;cursor:pointer;
  box-shadow:0 3px 0 rgba(0,0,0,.5);transition:transform .06s,background .06s;
}
.key.mid{flex:0 0 34%;font-size:12px;letter-spacing:.22em;color:var(--brass)}
.key.on{background:linear-gradient(180deg,#2a4b68,#16304a);transform:translateY(2px);box-shadow:0 1px 0 rgba(0,0,0,.5)}
.key:focus-visible{outline:2px solid var(--lamp);outline-offset:2px}
.key.mid.ready{
  color:#eaffff;border-color:rgba(140,240,255,.7);
  animation:wavePulse 1s ease-in-out infinite;
}
@keyframes wavePulse{
  0%,100%{box-shadow:0 3px 0 rgba(0,0,0,.5),0 0 6px rgba(140,240,255,.3)}
  50%{box-shadow:0 3px 0 rgba(0,0,0,.5),0 0 16px rgba(140,240,255,.85)}
}
@media (prefers-reduced-motion:reduce){.key.mid.ready{animation:none}}

#label{margin:0;font-size:11px;line-height:1.6;color:#7f95a5;letter-spacing:.06em;flex:0 1 auto;min-height:0;max-height:34%;overflow:auto}
#label b{color:var(--lamp);font-weight:600}
#label i{color:#d9694a;font-style:normal;font-weight:600}
#label .rule{display:block;border-top:1px solid rgba(185,138,60,.25);margin:2px 0}

@media (orientation:landscape) and (max-height:520px){
  #cab{max-width:none;flex-direction:row;align-items:center;gap:12px}
  #housing{flex:1;min-width:0}
  #pad{flex-direction:column;order:-1;width:88px}
  #pad .key{padding:22px 0}
  #label{display:none}
}
@media (prefers-reduced-motion:reduce){#housing{transition:none}}
