.ht-stage { --fg: #39ff6a; --dim: rgba(57, 255, 106, .55); --bgc: #020a04; background: var(--bgc); color: var(--fg); cursor: text; overflow: hidden; }
.ht-stage[data-theme="amber"] { --fg: #ffb638; --dim: rgba(255, 182, 56, .55); --bgc: #0c0700; }
.ht-stage[data-theme="white"] { --fg: #e9edf2; --dim: rgba(233, 237, 242, .5); --bgc: #07080a; }
.ht-stage[data-theme="blue"] { --fg: #6fe3ff; --dim: rgba(111, 227, 255, .5); --bgc: #010812; }
.ht-stage[data-theme="cyber"] { --fg: #2ee6ff; --dim: rgba(46, 140, 255, .6); --bgc: #020617;
  background: radial-gradient(ellipse at 50% 120%, rgba(30, 90, 255, .28), transparent 60%), var(--bgc); }
.ht-stage[data-theme="red"] { --fg: #ff4a3d; --dim: rgba(255, 74, 61, .55); --bgc: #120101; }
.ht-stage[data-theme="purple"] { --fg: #e07bff; --dim: rgba(190, 90, 255, .6); --bgc: #0b0214; }
.ht-stage[data-theme="dos"] { --fg: #e8ecf2; --dim: rgba(232, 236, 242, .45); --bgc: #2b3a52; }
.ht-stage[data-theme="dos"] pre { text-shadow: none !important; }
.ht-stage[data-scene="main"] { --fg: #41ff6e !important; --dim: rgba(65, 255, 110, .55) !important; --bgc: #001a07 !important; background: #001a07; }
.ht-stage[data-scene="main"] pre { text-transform: uppercase; letter-spacing: .04em; }
.ht-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.ht-term { position: absolute; inset: 0; padding: 14px 16px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.ht-stage pre { margin: 0; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; white-space: pre-wrap;
  word-break: break-all; tab-size: 4; color: var(--fg); }
.ht-stage[data-size="s"] .ht-term pre { font-size: 11px; }
.ht-stage[data-size="l"] .ht-term pre { font-size: 17px; }
.ht-stage.is-full[data-size="s"] .ht-term pre { font-size: 13px; }
.ht-stage.is-full[data-size="m"] .ht-term pre { font-size: 17px; }
.ht-stage.is-full[data-size="l"] .ht-term pre { font-size: 23px; }
.ht-term pre::after, .p-code pre::after { content: ""; display: inline-block; width: .6em; height: 1.1em; vertical-align: -0.2em; background: var(--fg); animation: ht-blink 1.1s steps(1) infinite; }
@keyframes ht-blink { 50% { opacity: 0; } }
.ht-stage[data-crt="1"] pre, .ht-stage[data-crt="1"] .ht-sc { text-shadow: 0 0 6px var(--dim); }
.ht-stage[data-crt="1"]::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%); }

/* views: terminal, scene (sequence scenarios), desk (hacker desktop) */
.ht-scene, .ht-desk { position: absolute; inset: 0; display: none; }
.ht-stage[data-view="scene"] .ht-term, .ht-stage[data-view="desk"] .ht-term { display: none; }
.ht-stage[data-view="scene"] .ht-scene { display: block; }
.ht-stage[data-view="desk"] .ht-desk { display: grid; }

/* scenarios */
.ht-sc { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; color: var(--fg);
  font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.is-full .ht-sc { padding: 24px 28px; font-size: 16px; gap: 16px; }
.ht-hd { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--dim); letter-spacing: .12em; }
.ht-hd span:last-child { opacity: .8; }
.ht-sc .ht-read { font-size: 12px; opacity: .92; }
.is-full .ht-sc .ht-read { font-size: 15px; }
.ht-mapbox { position: relative; flex: 1; min-height: 60px; }
.ht-mapbox canvas, .ht-pb canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ht-sat .ht-read { min-height: 4.4em; }
.ht-pw { justify-content: center; }
.ht-pw .ht-hd { position: absolute; top: 14px; left: 16px; right: 16px; }
.is-full .ht-pw .ht-hd { top: 24px; left: 28px; right: 28px; }
.ht-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(3px, 1vw, 10px); margin-top: 30px; }
.ht-slots span { display: grid; place-items: center; width: clamp(18px, 6.2%, 72px); aspect-ratio: 3 / 4; border: 2px solid var(--dim);
  font-size: clamp(14px, 4.4vw, 52px); font-weight: 800; color: var(--fg); }
.ht-stage:not(.is-full) .ht-slots span { font-size: clamp(12px, 2.6vw, 30px); }
.ht-slots span.lk { background: var(--fg); color: var(--bgc); border-color: var(--fg); text-shadow: none; box-shadow: 0 0 14px var(--dim); }
.ht-pw .ht-read { align-self: center; min-width: min(100%, 26em); }
.ht-layers { display: grid; gap: 6px; }
.ht-layer { display: grid; grid-template-columns: minmax(9em, 1.2fr) 2fr 3.6em; gap: 10px; align-items: center; opacity: .55; }
.ht-layer.on, .ht-layer.down { opacity: 1; }
.ht-layer .ht-bar { height: 12px; }
.ht-layer b { text-align: right; }
.ht-layer.down span { text-decoration: line-through; }
.ht-ports { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.6em, 1fr)); gap: 4px; flex: 1; align-content: start; overflow: hidden; }
.ht-ports span { border: 1px solid var(--dim); padding: 2px 5px; display: flex; justify-content: space-between; gap: 4px; font-size: .85em; opacity: .5; }
.ht-ports small { font-size: .75em; opacity: .85; }
.ht-ports span.open { opacity: 1; background: var(--dim); color: var(--bgc); text-shadow: none; }
.ht-ports span.filt { opacity: .8; }
.ht-ports span.shut { opacity: .35; }
.ht-stage:not(.is-full)[data-w="s"] .ht-ports { display: none; }
.ht-stage:not(.is-full)[data-w="s"] .ht-sc { font-size: 11px; gap: 6px; padding: 10px 12px; }
.ht-stage:not(.is-full)[data-w="s"] .ht-sc .ht-read { font-size: 10px; }
.ht-stage:not(.is-full)[data-w="s"] .ht-layer { grid-template-columns: 1fr 1.2fr 3em; gap: 6px; }

/* movie montage titles */
.ht-cine .ht-term, .ht-cine .ht-sc { top: 7%; bottom: 7%; }
.ht-stage:not(.is-full)[data-w="s"] .ht-clk { display: none; }
.ht-stage:not(.is-full)[data-w="s"] .ht-sat .ht-read { columns: 2; min-height: 0; }
.ht-film { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.ht-film[hidden] { display: none; }
.ht-film-box { display: grid; gap: 8px; text-align: center; color: #fff; text-shadow: 0 0 24px var(--fg); }
.ht-film strong { font: 900 clamp(26px, 9vw, 120px)/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .06em; }
.ht-film small { font: 600 clamp(11px, 1.8vw, 20px)/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .45em; color: var(--fg); }
.ht-film.go .ht-film-box { animation: ht-zoom 2.3s ease-out both; }
@keyframes ht-zoom { 0% { transform: scale(1.35); opacity: 0; } 18% { opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.ht-stage.ht-cine::before { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(#000 0 7%, transparent 7% 93%, #000 93%); }

/* hacker desktop */
.ht-desk { gap: 6px; padding: 6px; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 1.15fr 1fr 1fr;
  grid-template-areas: "code code map map" "code code net meter" "hex log log prog"; }
.ht-p { grid-area: var(--a); position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--dim);
  background: rgba(0, 0, 0, .28); overflow: hidden; }
.p-code { --a: code; } .p-map { --a: map; } .p-net { --a: net; } .p-meter { --a: meter; } .p-hex { --a: hex; } .p-log { --a: log; } .p-prog { --a: prog; }
.ht-pt { display: flex; align-items: center; gap: 6px; padding: 3px 7px; font: 700 10px/1.3 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .16em;
  color: var(--bgc); background: var(--fg); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-pt i { width: 6px; height: 6px; border-radius: 50%; background: var(--bgc); flex-shrink: 0; }
.ht-pb { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ht-pb pre { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 7px; font-size: 10px; line-height: 1.35; }
.p-code .ht-pb pre { font-size: 11px; }
.ht-stage[data-size="l"] .ht-pb pre { font-size: 12px; }
.ht-stage[data-size="s"] .ht-pb pre { font-size: 9px; }
.ht-stage.is-full .p-code .ht-pb pre { font-size: 13px; }
.ht-stage.is-full[data-size="l"] .p-code .ht-pb pre { font-size: 16px; }
.ht-stage.is-full .ht-pt { font-size: 11px; padding: 4px 9px; }
.ht-stage.is-full .ht-desk { gap: 10px; padding: 10px; }
.p-hex pre { white-space: pre; word-break: normal; }
.ht-tasks { position: absolute; inset: 0; padding: 6px 8px; display: grid; gap: 6px; align-content: start; font: 600 10px/1.3 ui-monospace, Menlo, Consolas, monospace; color: var(--fg); }
.ht-task { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; }
.ht-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-task .ht-bar { grid-column: 1 / -1; height: 8px; padding: 1px; }
.is-full .ht-tasks { font-size: 12px; gap: 10px; }
.ht-stage[data-w="m"] .ht-desk { grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas: "code code meter" "code code net" "map map log"; }
.ht-stage[data-w="m"] .p-hex, .ht-stage[data-w="m"] .p-prog { display: none; }
.ht-stage[data-w="t"] .ht-desk { grid-template-columns: 1fr 1fr; grid-template-rows: 1.5fr 1fr 1fr 1fr;
  grid-template-areas: "code code" "map map" "meter net" "log log"; }
.ht-stage[data-w="t"] .p-hex, .ht-stage[data-w="t"] .p-prog { display: none; }
.ht-stage[data-w="s"] .ht-desk { grid-template-columns: 1.3fr 1fr; grid-template-rows: 1fr;
  grid-template-areas: "code meter"; gap: 4px; padding: 4px; }
.ht-stage[data-w="s"] .p-map, .ht-stage[data-w="s"] .p-net, .ht-stage[data-w="s"] .p-hex, .ht-stage[data-w="s"] .p-log, .ht-stage[data-w="s"] .p-prog { display: none; }

.ht-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 9px 16px; border-radius: 999px; z-index: 6;
  background: rgba(20, 22, 28, .8); color: #fff; font-weight: 600; font-size: .95rem; white-space: nowrap; pointer-events: none; }
.ht-start.off, .ht-stage[data-mode="seq"] .ht-start, .ht-stage[data-mode="auto"] .ht-start { display: none; }

/* pop ups */
.ht-ov, .ht-prog { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .35); }
.ht-ov[hidden], .ht-prog[hidden] { display: none; }
.ht-ov { --pc: #39ff6a; --pg: rgba(57, 255, 106, .35); }
.ht-ov.bad { --pc: #ff3b3b; --pg: rgba(255, 59, 59, .4); }
.ht-ov.info { --pc: #4fd8ff; --pg: rgba(79, 216, 255, .38); }
.ht-ov.gold { --pc: #ffd34d; --pg: rgba(255, 211, 77, .38); }
.ht-ov-box { display: grid; gap: 6px; text-align: center; max-width: 100%; padding: .6em 1.1em; border: 3px solid currentColor; background: rgba(0, 0, 0, .88);
  color: var(--pc); font: 800 clamp(20px, 6.4vw, 76px)/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; overflow-wrap: anywhere;
  box-shadow: 0 0 40px var(--pg), inset 0 0 30px var(--pg); text-shadow: 0 0 14px currentColor; animation: ht-pop .25s ease-out; }
.ht-ov-box small { font-size: .28em; letter-spacing: .12em; font-weight: 600; opacity: .85; }
.ht-ov.bad .ht-ov-box { animation: ht-pop .25s ease-out, ht-pulse 1.4s ease-in-out .25s infinite; }
@keyframes ht-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ht-pulse { 50% { opacity: .55; } }
.ht-prog-box { width: min(560px, 92%); border: 2px solid var(--fg); background: rgba(0, 0, 0, .9); padding: 14px 18px; color: var(--fg);
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-shadow: 0 0 30px var(--dim); }
.ht-prog-box p { margin: 0 0 10px; word-break: break-all; }
.ht-prog-box .ht-prog-n { display: flex; justify-content: space-between; margin: 8px 0 0; font-size: 13px; opacity: .85; }
.ht-bar { height: 18px; border: 1px solid var(--fg); padding: 2px; }
.ht-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--fg) 0 8px, transparent 8px 11px); }
.ht-in { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; font-size: 16px; }

/* controls under the stage and in the panel */
.px-under { margin-top: 12px; }
.ht-pops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ht-pops .btn { font-size: .85rem; padding: 6px 10px; gap: 6px; }
.ht-pops kbd { font-size: .75rem; }
.panel select, .panel input[type="text"] { width: 100%; margin-top: 6px; }
#ht-scen-box[hidden] { display: none; }
.ht-color { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .9rem; }
.ht-color input[type="color"] { width: 44px; height: 34px; padding: 0; border: 1px solid var(--field-border); border-radius: 8px; background: none; cursor: pointer; }
.ht-color label { font-weight: 500 !important; }
.px-exit { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 7; display: none; align-items: center; gap: 4px;
  font: 600 13px/1 system-ui, sans-serif; padding: 8px 12px; border-radius: 999px; border: 0; background: rgba(0, 0, 0, .45); color: #fff;
  opacity: .6; cursor: pointer; transition: opacity .3s; }
.px-exit span { font-size: 17px; line-height: 13px; }
.is-full .px-exit { display: inline-flex; }
.is-full.st-idle:not(.px-show) .px-exit { opacity: 0; pointer-events: none; }
.tool-stage.is-full .fs-btn { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ht-term pre::after, .p-code pre::after, .ht-ov.bad .ht-ov-box, .ht-ov-box, .ht-film.go .ht-film-box { animation: none; }
}
