/* v25: on-screen keyboard next to the NES controller + "no clipping" mode + the hangar room.
   Loaded only by index-alley.html. Original art and code; nothing from id Software. */

/* ---------- controller + keyboard side by side (stacked on phones) ---------- */
.pad-wrap { flex-wrap: wrap; align-items: flex-start; gap: 1.6rem 1.8rem; }
.pad-wrap .nes { flex: 0 1 24rem; }

/* ---------- the keyboard ---------- */
.kbd {
  flex: 0 1 26rem; width: min(26rem, 100%);
  background: #cfcdc4; border-radius: 10px; padding: .5rem;
  box-shadow: 0 6px 0 #8f8d86, 0 10px 0 #000;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
.kbd button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.kbd-screen {
  display: flex; align-items: center; gap: .15rem; min-height: 2rem;
  margin: 0 0 .4rem; padding: .45rem .7rem; border-radius: 5px;
  background: #07150a; box-shadow: inset 0 0 0 2px #000, inset 0 0 12px rgba(80,255,120,.15);
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .18em; color: var(--lime);
  text-shadow: 0 0 6px rgba(120,255,120,.6); overflow: hidden; white-space: nowrap; position: relative;
}
.kbd-text { text-transform: uppercase; }
.kbd-cursor { display: inline-block; width: .55em; height: .9em; background: var(--lime); opacity: .85; animation: kbd-blink 1.1s steps(1) infinite; }
@keyframes kbd-blink { 50% { opacity: 0; } }
.kbd-led { position: absolute; right: .6rem; top: 50%; width: .5rem; height: .5rem; margin-top: -.25rem; border-radius: 50%; background: #123018; box-shadow: inset 0 0 0 1px #000; }
.kbd.is-on .kbd-led { background: #39ff6a; box-shadow: 0 0 8px #39ff6a, inset 0 0 0 1px #0a3d17; }
.kbd-body { background: #1c1b1a; border-radius: 6px; padding: .6rem .45rem .7rem; display: flex; flex-direction: column; gap: .32rem; }
.kbd-row { display: flex; gap: .26rem; justify-content: center; }
.kbd-row2 { padding: 0 .9rem; }
.kbd-key {
  flex: 1 1 0; min-width: 0; height: 2.45rem; padding: 0;
  font-family: var(--font-ui); font-size: .62rem; color: #e6d8b4;
  background: #34322f; border: 0; border-radius: 4px; box-shadow: 0 3px 0 #0c0c0b, inset 0 1px 0 rgba(255,255,255,.14);
  cursor: pointer;
}
.kbd-clr { flex: 1.55 1 0; background: #7c1d1d; font-size: .5rem; box-shadow: 0 3px 0 #3d0e0e, inset 0 1px 0 rgba(255,255,255,.14); }
.kbd-bs { flex: 1.55 1 0; background: #4a3a22; font-size: .8rem; }
.kbd-key:active, .kbd-key.is-down { transform: translateY(3px); box-shadow: 0 0 0 #000, inset 0 1px 0 rgba(255,255,255,.1); filter: brightness(1.35); }
.kbd button:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
@media (max-width: 460px) {
  .pad-wrap { padding-left: .6rem; padding-right: .6rem; }
  .kbd-row { gap: .2rem; }
  .kbd-row2 { padding: 0 .7rem; }
  .kbd-key { height: 2.6rem; }
}

/* ---------- message ---------- */
.nc-toast {
  position: fixed; left: .6rem; top: .6rem; z-index: 4000; pointer-events: none;
  font-family: var(--font-ui); font-size: .62rem; letter-spacing: .06em; color: #e8e8e8;
  background: rgba(0,0,0,.78); padding: .4rem .55rem; border-left: 4px solid var(--lime);
  opacity: 0; transform: translateY(-4px); transition: opacity .18s ease, transform .18s ease;
}
.nc-toast.is-show { opacity: 1; transform: none; }

/* ---------- no clipping mode: boxes stop being boxes ---------- */
body.noclip .alley .hang, body.noclip .alley .board, body.noclip .alley figure, body.noclip .alley article,
body.noclip .alley .hours-panel, body.noclip .alley .ps1-window, body.noclip .alley .photo-grid,
body.noclip .alley .sign, body.noclip .alley .menu-block, body.noclip .alley .menu-col, body.noclip .alley .drinks-menu,
body.noclip .alley .story-board, body.noclip .alley .day-menu { overflow: visible !important; }
body.noclip .alley .hang { transition: opacity .4s ease !important; }
body.noclip .alley .hang, body.noclip .alley .nc-rel { will-change: translate, rotate; }
body.noclip .alley .nc-rel { position: relative; }
body.noclip .alley::before { translate: var(--nc-shx, 0px) 0; }
body.noclip::before { translate: var(--nc-bgx, 0px) var(--nc-bgy, 0px); rotate: var(--nc-bgr, 0deg); }
@media (max-width: 700px) { body.noclip::after { translate: calc(var(--nc-bgx, 0px) * -1.6) calc(var(--nc-bgy, 0px) * -1.4); rotate: calc(var(--nc-bgr, 0deg) * -1.5); } }
.nc-void {
  position: fixed; top: 0; bottom: 0; width: 0; z-index: 1; pointer-events: none; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(255,43,214,.55) 0 3px, rgba(42,240,255,.4) 3px 6px, rgba(8,6,12,.9) 6px 15px),
    repeating-linear-gradient(0deg, rgba(200,255,42,.22) 0 2px, transparent 2px 9px);
  background-size: 15px 100%, 100% 9px;
}
.nc-void-l { left: 0; -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent); mask-image: linear-gradient(90deg, #000 40%, transparent); }
.nc-void-r { right: 0; -webkit-mask-image: linear-gradient(270deg, #000 40%, transparent); mask-image: linear-gradient(270deg, #000 40%, transparent); }

/* ---------- the hangar room ---------- */
html.dr-lock, html.dr-lock body { overflow: hidden !important; }
.dr {
  position: fixed; inset: 0; z-index: 3000; background: #000; opacity: 0; transition: opacity .8s ease;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.dr[hidden] { display: none; }
.dr.is-in { opacity: 1; }
.dr canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; display: block; }
.dr-vig { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%),
              repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px); }
.dr-exit {
  position: absolute; top: .7rem; right: .7rem; z-index: 2; padding: .6rem .8rem;
  font-family: var(--font-ui); font-size: .6rem; letter-spacing: .1em; color: #e8e8e8;
  background: rgba(0,0,0,.7); border: 2px solid #8a8a8a; border-radius: 3px; cursor: pointer;
}
.dr-exit:active, .dr-exit.is-down { background: #7c1d1d; }
.dr-pad { position: absolute; bottom: 1rem; z-index: 2; display: grid; gap: .45rem; }
.dr-pad-l { left: 1rem; grid-template-columns: 3.4rem; }
.dr-pad-r { right: 1rem; grid-template-columns: 3.4rem 3.4rem; }
.dr-b {
  width: 3.4rem; height: 3.4rem; padding: 0; font-family: var(--font-ui); font-size: .9rem; color: #e6d8b4;
  background: rgba(20,20,18,.62); border: 2px solid rgba(200,190,160,.55); border-radius: 6px;
  touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; cursor: pointer;
}
.dr-b.is-down { background: rgba(124,29,29,.8); }
@media (prefers-reduced-motion: reduce) {
  .dr { transition: opacity .3s ease; }
  .kbd-cursor { animation: none; }
}

/* v26: horizontal swipes still reach JS; vertical page scrolling stays free */
body.noclip { touch-action: pan-y; }

/* v28: a few Freedoom monsters peek in after you leave the room, then go away. Never interactive. */
.nc-lurk { position: fixed; inset: 0; z-index: 900; pointer-events: none; overflow: hidden; }
.nc-lurk, .nc-lurk * { pointer-events: none !important; -webkit-user-select: none; user-select: none; touch-action: none; }
.nc-lurk-s { position: absolute; opacity: 0; transition: transform .6s cubic-bezier(.2,.8,.25,1), opacity .6s linear; will-change: transform, opacity; }
.nc-lurk-s img { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; animation: nc-bob .6s steps(2) infinite; }
.nc-lurk-s.is-in { opacity: 1; }
.nc-lurk-s.is-out { opacity: 0; }
@keyframes nc-bob { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .nc-lurk-s { transition: opacity .5s linear; }
  .nc-lurk-s img { animation: none; }
}
