/* DUK-DOS: VGA text mode. One face, one cell (--cw x --ch), 16 colours, frames drawn with box characters. */
@font-face { font-family: "Web437 IBM VGA 8x16"; src: url(/fonts/Web437_IBM_VGA_8x16.woff) format("woff"); font-display: block; }
:root {
  --cw: 10px; --ch: 20px;
  --k: #000; --b: #0000a8; --g: #00a800; --c: #00a8a8; --r: #a80000; --m: #a800a8; --y6: #a85400; --l7: #a8a8a8;
  --d8: #545454; --B: #5454fc; --G: #54fc54; --C: #54fcfc; --R: #fc5454; --M: #fc54fc; --Y: #fcfc54; --W: #fcfcfc;
  --vga: "Web437 IBM VGA 8x16", ui-monospace, Consolas, monospace;
  --meme: "Anton", Impact, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--b); color: var(--l7); font: var(--ch)/var(--ch) var(--vga); overflow: hidden; -webkit-font-smoothing: none; font-smooth: never; }
button, input { font: inherit; color: inherit; }
p { margin: 0; }
pre { margin: 0; font: inherit; }
img, video { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--W); outline-offset: 0; }

.wall { position: fixed; left: 0; top: 0; z-index: 0; image-rendering: pixelated; }

/* ---------------- boot: POST on black, then the welcome window over the live pond */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--k); color: var(--l7); padding: var(--ch) var(--cw); overflow: auto; transition: background .5s steps(4); }
.boot.lit { background: transparent; }
.boot[hidden], .intro[hidden], .os[hidden], .modal[hidden], .welcome[hidden] { display: none; }
.post { position: absolute; left: calc(var(--cw) * 2); top: var(--ch); white-space: pre-wrap; transition: opacity .3s steps(3); }
.boot.lit .post { opacity: 0; }
.welcome { position: relative; background: var(--Y); color: var(--k); box-shadow: calc(var(--cw) * 2) var(--ch) 0 rgba(0, 0, 0, .6); animation: pop .35s steps(4) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.welcome .frame { color: var(--r); animation: blinkframe 1s steps(1) infinite; }
.wel-body { position: relative; z-index: 2; padding: var(--ch) calc(var(--cw) * 3) calc(var(--ch) * 1.5); display: flex; flex-direction: column; align-items: center; }
.wel-top { display: flex; align-items: center; gap: calc(var(--cw) * 3); }
.wel-duk { width: calc(var(--ch) * 10); height: auto; animation: bob 1.9s steps(6) infinite; }
@keyframes bob { 50% { transform: translateY(calc(var(--ch) * -.5)) rotate(-4deg); } }
.wel-txt { display: flex; flex-direction: column; align-items: center; }
.welcome .wm .wf { color: var(--r); } .welcome .wm .ws { color: var(--k); }
.welcome .wm { font-size: calc(var(--ch) * 1.5); line-height: calc(var(--ch) * 1.5); margin-top: 0; }
.wel-line { margin-top: var(--ch); max-width: calc(var(--cw) * 36); text-align: center; }
.open {
  margin-top: calc(var(--ch) * 1.5); display: inline-flex; align-items: center; gap: calc(var(--cw) * 2);
  height: calc(var(--ch) * 3); padding: 0 calc(var(--cw) * 4); border: 0; background: var(--G); color: var(--k);
  font-size: calc(var(--ch) * 2); line-height: 1; cursor: pointer; box-shadow: calc(var(--cw) * 2) var(--ch) 0 var(--k);
  animation: throb 1s steps(1) infinite;
}
.open:hover, .open:focus-visible { background: var(--W); outline: none; }
.open:active { transform: translate(calc(var(--cw) * 2), var(--ch)); box-shadow: none; }
@keyframes throb { 50% { background: var(--g); color: var(--W); } }
.open:hover, .open:focus-visible { animation: none; }
.open-arrows { color: var(--r); }
.open:hover .open-arrows, .open:focus-visible .open-arrows { animation: nudge .5s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateX(calc(var(--cw) * .5)); } }
.open-sub { margin-top: calc(var(--ch) * 1.5); }
.key { display: inline-block; padding: 0 calc(var(--cw) * .5); background: var(--k); color: var(--Y); }
.quiet { margin-top: var(--ch); border: 0; background: none; color: var(--b); cursor: pointer; text-decoration: underline; }
.quiet:hover { color: var(--r); }
@media (max-width: 759px) {
  .wel-top { flex-direction: column; gap: 0; }
  .wel-duk { width: calc(var(--ch) * 8); }
  .welcome .wm { font-size: var(--ch); line-height: var(--ch); }
  .open { font-size: calc(var(--ch) * 1.25); height: calc(var(--ch) * 2.5); padding: 0 calc(var(--cw) * 2); gap: var(--cw); }
}

/* ---------------- text-mode buttons: a coloured bar with a black half-cell shadow (Borland style) */
.tbtn {
  display: inline-flex; align-items: center; gap: 0; height: var(--ch); padding: 0 var(--cw); border: 0; border-radius: 0;
  background: var(--g); color: var(--k); cursor: pointer; white-space: nowrap; text-decoration: none; line-height: var(--ch);
  box-shadow: var(--cw) calc(var(--ch) / 2) 0 var(--k); margin: 0 var(--cw) calc(var(--ch) / 2) 0;
}
.tbtn u { text-decoration: none; color: var(--Y); }
.tbtn:hover { filter: brightness(1.15); }
.tbtn:active { transform: translate(var(--cw), calc(var(--ch) / 2)); box-shadow: none; }
.tbtn:disabled, .tbtn.off { background: var(--d8); color: var(--l7); cursor: not-allowed; }
.tbtn:disabled:active, .tbtn.off:active { transform: none; box-shadow: var(--cw) calc(var(--ch) / 2) 0 var(--k); }
.tbtn-green { background: var(--g); color: var(--W); }
.tbtn-green u { color: var(--Y); }
.tbtn-gray { background: var(--l7); color: var(--k); }
.tbtn-gray u { color: var(--r); }
.tbtn-cyan { background: var(--c); color: var(--k); }
.tbtn-white { background: var(--W); color: var(--k); }
.tbtn-yellow { background: var(--Y); color: var(--k); }
.tbtn-big { height: calc(var(--ch) * 2); padding: 0 calc(var(--cw) * 3); font-size: calc(var(--ch) * 2); line-height: calc(var(--ch) * 2); background: var(--G); color: var(--k); box-shadow: var(--cw) var(--ch) 0 var(--k); margin-bottom: var(--ch); }
.tbtn-big:active { transform: translate(var(--cw), var(--ch)); }
.tbtn-big.off { background: var(--d8); color: var(--l7); }
.tbtn-big .mark { width: calc(var(--ch) * 1.4); height: calc(var(--ch) * 1.4); }
.tbtn-sm { box-shadow: none; margin: 0; }
.tbtn-key { background: var(--c); color: var(--k); padding: 0; min-width: calc(var(--cw) * 2); justify-content: center; margin-right: var(--cw); box-shadow: none; }
.tbtn-key[aria-pressed="true"] { background: var(--Y); }
.mark { width: var(--ch); height: var(--ch); object-fit: contain; margin-right: var(--cw); }

/* ---------------- intro */
.intro { position: fixed; inset: 0; z-index: 110; background: var(--k); }
.intro video { width: 100%; height: 100%; object-fit: contain; }
.skip { position: absolute; right: calc(var(--cw) * 3); bottom: var(--ch); }

/* ---------------- menu bar: grey line, red hotkeys */
.os { position: fixed; inset: 0; z-index: 1; }
.menubar { position: relative; z-index: 5000; display: flex; align-items: center; height: var(--ch); background: var(--l7); color: var(--k); white-space: nowrap; }
.mb { height: var(--ch); padding: 0 var(--cw); border: 0; background: none; color: var(--k); cursor: pointer; }
.mb:hover, .mb:focus-visible { background: var(--g); color: var(--k); outline: none; }
.mb .hot { color: var(--r); }
.mb-wrap { position: relative; }
.mb-drop { position: absolute; left: 0; top: var(--ch); display: flex; flex-direction: column; min-width: calc(var(--cw) * 22); padding: calc(var(--ch) / 2) 0; background: var(--l7); box-shadow: calc(var(--cw) * 2) var(--ch) 0 rgba(0,0,0,.6); border: 2px solid var(--W); }
.mb-drop[hidden] { display: none; }
.mb-i { text-align: left; padding: 0 var(--cw); border: 0; background: none; color: var(--k); white-space: pre; cursor: pointer; }
.mb-i:hover, .mb-i:focus-visible { background: var(--g); outline: none; }
.mb-note { color: var(--d8); padding: 0 var(--cw); }
.mb-gap { flex: 1; }
.vol { color: var(--b); letter-spacing: 0; }
.mb-clock { padding: 0 var(--cw); color: var(--k); }

/* ---------------- windows: the frame is a <pre> of box characters laid over the coloured body */
.desk { position: absolute; left: 0; right: 0; top: var(--ch); bottom: 0; }
.win { position: absolute; background: var(--b); color: var(--W); box-shadow: calc(var(--cw) * 2) var(--ch) 0 rgba(0, 0, 0, .55); }
.frame { position: absolute; inset: 0; white-space: pre; overflow: hidden; pointer-events: auto; cursor: default; color: var(--l7); user-select: none; touch-action: none; }
.win.active .frame { color: var(--W); }
.wclose { position: absolute; left: calc(var(--cw) * 2); top: 0; z-index: 3; height: var(--ch); padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.wclose:hover { color: var(--G); }
.win .wclose { color: var(--l7); }
.win.active .wclose { color: var(--G); }
.wbody { position: absolute; left: var(--cw); right: var(--cw); top: var(--ch); bottom: var(--ch); z-index: 2; overflow: hidden; display: flex; flex-direction: column; }

.t-yellow { background: var(--Y); color: var(--k); }
.t-yellow .frame, .t-yellow.active .frame { color: var(--r); }
.t-yellow .wclose, .t-yellow.active .wclose { color: var(--r); }
.t-blue { background: var(--b); color: var(--W); }
.t-cyan { background: var(--c); color: var(--k); }
.t-cyan .frame { color: var(--b); } .t-cyan.active .frame { color: var(--W); }
.t-gray { background: var(--l7); color: var(--k); }
.t-gray .frame { color: var(--d8); } .t-gray.active .frame { color: var(--W); }
.t-black { background: var(--k); color: var(--l7); }
.t-green { background: var(--g); color: var(--k); }
.t-green .frame { color: var(--k); } .t-green.active .frame { color: var(--W); }
.t-magenta { background: var(--m); color: var(--W); }
.t-red { background: var(--r); color: var(--W); }
.t-red .frame, .t-red.active .frame { color: var(--Y); }

.row { display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--cw); margin-top: calc(var(--ch) / 2); }
.say { color: inherit; opacity: .9; }
.media { position: relative; flex: none; background: var(--k); overflow: hidden; }
.media video, .fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cap-line { flex: none; padding-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* DUK.COM: the brightest window on the desk, its frame blinks */
.t-yellow.win { box-shadow: calc(var(--cw) * 2) var(--ch) 0 rgba(0, 0, 0, .55); }
@keyframes blinkframe { 50% { color: var(--R); } }
.t-yellow .frame { animation: blinkframe 1s steps(1) infinite; }
.wm { line-height: var(--ch); white-space: pre; margin: calc(var(--ch) / 2) auto 0; width: max-content; max-width: 100%; overflow: hidden; }
.t-yellow .wm .wf { color: var(--r); }
.t-yellow .wm .ws { color: var(--k); }
.tick { text-align: center; margin-top: calc(var(--ch) / 2); }
.tick b { background: var(--r); color: var(--Y); padding: 0 var(--cw); font-weight: normal; }
.line { margin-top: calc(var(--ch) / 2); text-align: center; }
.lbl { margin-top: var(--ch); color: var(--r); }
.ca-field { background: var(--b); color: var(--Y); padding: 0 var(--cw); word-break: break-all; user-select: all; min-height: var(--ch); }
.ca-field.empty { color: var(--C); user-select: text; word-break: normal; }
.buy-row { margin-top: calc(var(--ch) * 1.5); display: flex; justify-content: center; }
.buy-row .tbtn-big { width: calc(100% - var(--cw) * 2); justify-content: center; }
.t-yellow .row { justify-content: center; }
.t-yellow .row .say { flex-basis: 100%; text-align: center; }

/* COMMAND.COM */
.sh-out { flex: 1; min-height: 0; overflow-y: auto; white-space: pre-wrap; word-break: break-word; scrollbar-width: none; }
.sh-out .echo { color: var(--W); }
.sh-out .hint { color: var(--Y); }
.sh-out .dim { color: var(--d8); }
.sh-line { flex: none; display: flex; color: var(--W); cursor: text; }
.sh-in { flex: 1; min-width: 0; border: 0; padding: 0; background: none; color: var(--W); outline: none; caret-color: var(--W); caret-shape: block; }

/* POND.EXE */
.pond { position: relative; flex: none; overflow: hidden; cursor: crosshair; background: var(--k) url(/art/pond.webp) center / cover; }
.pond video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ripples { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.loaf { position: absolute; left: 0; top: 0; width: 12%; pointer-events: none; }
.pond-row { flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--Y); }
.pond-row b { font-weight: normal; color: var(--W); background: var(--r); padding: 0 var(--cw); }

/* NEWS.LOG, INSPECT.LOG */
.log { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.log > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log .ts { color: var(--b); }
.log .hot { color: var(--W); background: var(--r); }
.t-red .log .ts { color: var(--Y); }

/* CUTSCENE.EXE */
.keys { flex: none; display: flex; flex-wrap: wrap; padding-top: calc(var(--ch) / 2); }

/* CAM2.VID */
.cctv video { filter: saturate(.8) contrast(1.1); }
.cctv-rec { position: absolute; left: var(--cw); top: 0; color: var(--R); background: rgba(0, 0, 0, .6); padding: 0 calc(var(--cw) / 2); animation: blinkframe 1s steps(1) infinite; }
.cctv-ts { position: absolute; right: var(--cw); bottom: 0; color: var(--W); background: rgba(0, 0, 0, .6); padding: 0 calc(var(--cw) / 2); }

/* C:\MEMES */
.mprev { position: relative; flex: none; display: block; width: 100%; padding: 0; border: 0; background: var(--k); cursor: zoom-in; overflow: hidden; }
.mlayer { position: absolute; inset: 0; opacity: 0; transition: opacity .25s steps(3); }
.mlayer.in { opacity: 1; }
.mlayer img, .mlayer video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mdir { flex: none; color: var(--C); }
.mlist { flex: 1; min-height: calc(var(--ch) * 3); display: grid; grid-template-columns: repeat(2, 1fr); align-content: start; overflow-y: auto; scrollbar-width: none; }
.mi { text-align: left; padding: 0 calc(var(--cw) / 2); border: 0; background: none; color: var(--W); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.mi[aria-selected="true"] { background: var(--c); color: var(--k); }
.mi:hover { color: var(--Y); }
.cap { position: absolute; left: 4%; right: 4%; text-align: center; font: calc(var(--ch) * 1.1)/1.02 var(--meme); color: #fff; text-transform: uppercase; pointer-events: none;
  text-shadow: 0 0 2px #000, 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000; }
.cap.top { top: 4%; } .cap.bot { bottom: 4%; }

/* MENU.TXT */
.mhead { color: var(--b); margin-bottom: calc(var(--ch) / 2); white-space: nowrap; overflow: hidden; }
.mrow { margin-bottom: calc(var(--ch) / 2); }
.mtxt { display: flex; white-space: nowrap; }
.mname { color: var(--k); }
.dots { flex: 1; overflow: hidden; margin: 0 calc(var(--cw) / 2); color: var(--d8); }
.dots::before { content: "................................................................................"; }
.mprice { color: var(--r); }
.mnote { display: flex; justify-content: space-between; align-items: center; gap: var(--cw); color: var(--d8); white-space: nowrap; }
.mnote span { overflow: hidden; text-overflow: ellipsis; }

/* LOYALTY.DAT */
.lhead { color: var(--W); }
.stamps { margin-top: calc(var(--ch) / 2); display: flex; flex-wrap: wrap; color: var(--k); }
.stamps span { white-space: pre; }
.stamps .on { color: var(--Y); }

/* INSPECT.LOG */
.insp { flex: none; display: grid; grid-template-columns: 40% 1fr; gap: var(--cw); align-items: center; }
.frog { width: 100%; height: auto; max-height: calc(var(--ch) * 8); object-fit: contain; }
.grade .wf { color: var(--Y); } .grade .ws { color: var(--k); }
.grade { margin: 0; }
.grade.slam { animation: slam .3s steps(3); }
@keyframes slam { 0% { transform: scale(2); opacity: 0; } }
.ilog { margin-top: calc(var(--ch) / 2); }

/* ---------------- modal dialog */
.modal { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: rgba(0, 0, 0, .45); }
.dlg { position: relative; background: var(--l7); color: var(--k); box-shadow: calc(var(--cw) * 2) var(--ch) 0 rgba(0, 0, 0, .6); max-height: 96vh; }
.dlg .frame { color: var(--W); }
.dlg .wclose { color: var(--G); }
.dbody { position: relative; z-index: 2; padding: var(--ch) calc(var(--cw) * 2) var(--ch); }
.vmedia { position: relative; background: var(--k); }
.vmedia img, .vmedia video { width: 100%; max-height: 74vh; object-fit: contain; }
.vmedia .cap { font-size: clamp(22px, 4vw, 46px); }
.vrow { display: flex; justify-content: space-between; align-items: center; margin-top: var(--ch); }
.chart { color: var(--b); background: var(--k); color: var(--G); padding: calc(var(--ch) / 2) var(--cw); overflow: hidden; }
.about { display: flex; flex-direction: column; align-items: center; gap: calc(var(--ch) / 2); text-align: center; }
.about .wm .wf { color: var(--r); } .about .wm .ws { color: var(--k); }
.nojs { color: var(--W); padding: 20px; }

/* ---------------- phone: the same windows, stacked in one scroll */
@media (max-width: 759px) {
  body { overflow-x: hidden; overflow-y: auto; }
  .os { position: relative; inset: auto; }
  .menubar { position: sticky; top: 0; overflow-x: auto; scrollbar-width: none; }
  .desk { position: relative; top: 0; display: flex; flex-direction: column; gap: var(--ch); padding: var(--ch) var(--cw) calc(var(--ch) * 2); }
  .win { position: relative; box-shadow: var(--cw) calc(var(--ch) / 2) 0 rgba(0, 0, 0, .55); }
  .wall { position: fixed; }
  .mb-note, .vol { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* layout measuring: the window grows to its content for one read */
.win.measure { height: auto !important; }
.win.measure .wbody { position: relative; inset: auto; margin: var(--ch) var(--cw); }
.win.measure .log, .win.measure .sh-out, .win.measure .mlist { flex: none; height: calc(var(--ch) * 3); }
