@font-face { font-family: "Pixelated MS Sans Serif"; src: url(../vendor/ms_sans_serif.woff2) format("woff2"); font-weight: 400; }
@font-face { font-family: "Pixelated MS Sans Serif"; src: url(../vendor/ms_sans_serif_bold.woff2) format("woff2"); font-weight: 700; }
@font-face { font-family: "Perfect DOS VGA 437 Win"; src: url(../vendor/PerfectDOSVGA437Win.woff2) format("woff2"); }

[hidden] { display: none !important; } /* vendor sheets set display on pre etc. */
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }

/* fixed 1280x720 virtual screen, scaled to fit by engine.js */
#frame { position: fixed; left: 50%; top: 50%; width: 1280px; height: 720px; margin: -360px 0 0 -640px; background: #000; overflow: hidden; transform-origin: center; }
#stage { position: absolute; inset: 0; overflow: hidden; background: #000; }
.scene { position: absolute; inset: 0; overflow: hidden; }
.scene canvas.fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#frame.paused #stage, #frame.paused #stage * , #frame.paused #stage *::before, #frame.paused #stage *::after { animation-play-state: paused !important; }

/* CRT glass: scanlines + vignette */
#crt { position: absolute; inset: 0; pointer-events: none; z-index: 50;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.13) 2px 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 62%, rgba(0,0,0,.42) 100%);
  box-shadow: inset 0 0 90px rgba(0,0,0,.55); }

#static { position: absolute; inset: 0; z-index: 40; pointer-events: none; opacity: 0;
  background: #777 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  1.6 0 0 0 -.2'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: static-jit .12s steps(4) infinite; }
@keyframes static-jit { to { background-position: 173px 97px; } }

/* transitions: engine sets #frame[data-tr="<kind>-out|in"] */
#frame[data-tr="fade-out"] #stage { animation: tr-fade .45s forwards; }
#frame[data-tr="fade-in"] #stage { animation: tr-fade .45s reverse backwards; }
@keyframes tr-fade { to { opacity: 0; } }
#frame[data-tr="crt-out"] #stage { animation: tr-crt .45s cubic-bezier(.6,0,.9,.4) forwards; }
#frame[data-tr="crt-in"] #stage { animation: tr-crt .45s cubic-bezier(.6,0,.9,.4) reverse backwards; }
@keyframes tr-crt { 55% { transform: scale(1,.006); filter: brightness(4); } 100% { transform: scale(0,.006); filter: brightness(8); } }
#frame[data-tr="wipe-out"] #stage { animation: tr-wipe .45s steps(9) forwards; }
#frame[data-tr="wipe-in"] #stage { animation: tr-wipe .45s steps(9) reverse backwards; }
@keyframes tr-wipe { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }
#frame[data-tr="static-out"] #static { animation: static-jit .12s steps(4) infinite, tr-static .45s forwards; }
#frame[data-tr="static-in"] #static { animation: static-jit .12s steps(4) infinite, tr-static .45s reverse backwards; }
@keyframes tr-static { to { opacity: 1; } }

#ticker { position: absolute; left: 22px; bottom: 18px; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .6s;
  font: 16px "Perfect DOS VGA 437 Win", monospace; color: #7dff7d; text-shadow: 0 0 6px #0f0, 1px 1px 0 #000; }
#ticker.on { opacity: .9; }
#progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; z-index: 60; pointer-events: none; }
#progress i { display: block; height: 100%; width: 0; background: rgba(125,255,125,.55); }

/* start dialog: hand-rolled Win9x look so it needs neither vendor sheet */
#start { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; background: #008080; }
#start[hidden] { display: none; }
.dlg { width: 430px; background: #c0c0c0; font: 14px "Pixelated MS Sans Serif", Arial, sans-serif; color: #000;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px grey, inset 2px 2px #fff, 6px 6px 0 rgba(0,0,0,.35); padding: 3px; }
.dlg-title { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: 700; padding: 5px 6px; }
.dlg-body { padding: 14px 18px 12px; line-height: 1.5; }
.dlg-body p { margin: 0 0 12px; }
.dlg-body .keys { margin: 14px 0 0; color: #444; font-size: 12px; }
#go { font: inherit; min-width: 110px; padding: 6px 14px; background: #c0c0c0; color: #000; border: 0; cursor: pointer;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px grey, inset 2px 2px #dfdfdf; }
#go:active { box-shadow: inset 1px 1px #0a0a0a, inset -1px -1px #fff, inset 2px 2px grey; }
#go:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }

#hud { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; font: 13px/1 system-ui, sans-serif; color: #ddd; background: linear-gradient(transparent, rgba(0,0,0,.75));
  opacity: 0; transition: opacity .3s; pointer-events: none; }
#hud.on, #hud:focus-within { opacity: 1; pointer-events: auto; }
#hud button { all: unset; cursor: pointer; padding: 6px 9px; font-size: 16px; border-radius: 4px; color: #eee; }
#hud button:hover { background: rgba(255,255,255,.15); }
#hud button:focus-visible { outline: 2px solid #7dff7d; }

#test { position: fixed; inset: 0; z-index: 200; margin: 0; padding: 16px; overflow: auto; background: rgba(0,0,0,.88); color: #7dff7d; font: 12px monospace; white-space: pre-wrap; }
