@font-face { font-family: "VT323 Cells"; src: local("Consolas"); size-adjust: 72.727%; unicode-range: U+0394, U+039E, U+03A8, U+2190-22FF, U+2580-25FF, U+26A0; }
@font-face { font-family: "VT323 Cells 2"; src: local("Menlo"), local("Menlo-Regular"), local("DejaVu Sans Mono"), local("DejaVuSansMono"); size-adjust: 66.445%; unicode-range: U+0394, U+039E, U+03A8, U+2190-22FF, U+2580-25FF, U+26A0; }
@font-face { font-family: "VT323 Cells 3"; src: local("Courier New"), local("CourierNewPSMT"); size-adjust: 66.667%; unicode-range: U+0394, U+039E, U+03A8, U+2190-22FF, U+2580-25FF, U+26A0; }
.sq { position: relative; top: -0.08em; }
:root {
  --bg: #050805;
  --fg: #3bff7a;
  --dim: #1d8a43;
  --glow: rgba(59, 255, 122, 0.55);
  --font: "VT323", "VT323 Cells", "VT323 Cells 2", "VT323 Cells 3", "Consolas", monospace;
}
body.theme-amber { --fg: #ffb22e; --dim: #a87418; --glow: rgba(255, 178, 46, 0.5); --bg: #0a0702; }
body.theme-cyan  { --fg: #5ef2ff; --dim: #2a8a94; --glow: rgba(94, 242, 255, 0.5); --bg: #02080a; }
body.theme-white { --fg: #e6e6e0; --dim: #85857f; --glow: rgba(230, 230, 224, 0.4); --bg: #070707; }
body.theme-red   { --fg: #ff4a3d; --dim: #d44f45; --glow: rgba(255, 74, 61, 0.5); --bg: #0a0302; }

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--dim) transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: clamp(18px, 2.3vw, 26px);
  line-height: 1.15;
  text-shadow:
    0 0 2px var(--glow),
    0 0 9px var(--glow),
    0 0 22px color-mix(in srgb, var(--glow) 40%, transparent),
    -0.7px 0 rgba(255, 0, 70, 0.35),
    0.7px 0 rgba(0, 150, 255, 0.35);
}

#crt {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding: clamp(24px, 4.5vh, 48px) clamp(28px, 5vw, 72px) clamp(26px, 5vh, 52px);
  animation: flicker 7s infinite steps(1);
}
@keyframes flicker {
  0%, 100% { opacity: 1; transform: none; }
  31% { opacity: 0.96; }
  32% { opacity: 1; }
  47% { opacity: 0.92; transform: translateX(0.6px); }
  48% { opacity: 1; transform: none; }
  82% { opacity: 0.97; transform: translateX(-0.4px); }
  83% { transform: none; }
}

#crt.power-on { animation: powerOn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes powerOn {
  0%   { transform: scale(1, 0.004); filter: brightness(6); opacity: 1; }
  40%  { transform: scale(1, 0.004); filter: brightness(4); }
  70%  { transform: scale(1, 1.03); filter: brightness(1.8); }
  100% { transform: none; filter: none; }
}

#hdr {
  display: flex; gap: 0.6em; flex-wrap: wrap; align-items: baseline;
  border-bottom: 2px solid var(--dim);
  padding-bottom: 6px; margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
#hdr .grow { flex: 1; }
#hdr .sep { color: var(--dim); }
#hdr b { font-weight: normal; background: var(--fg); color: var(--bg); padding: 0 0.3em; text-shadow: none; }
#hdr .link { color: var(--fg); }
#hdr .link.down { color: var(--dim); animation: blink 1s infinite steps(1); }

.vol { display: inline-flex; align-items: center; gap: 0.35em; }
#vol-mute {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; font: inherit; text-shadow: inherit; letter-spacing: inherit;
}
#vol-mute.muted { color: var(--dim); animation: blink 1.2s infinite steps(1); }
#vol-bars { display: inline-flex; gap: 2px; cursor: pointer; padding: 4px 0; touch-action: none; outline: none; }
#vol-bars:focus-visible { outline: 1px dashed var(--fg); outline-offset: 2px; }
#vol-bars i { width: 0.32em; height: 0.8em; border: 1px solid var(--dim); box-shadow: 0 0 4px var(--glow); }
#vol-bars i.on { background: var(--fg); border-color: var(--fg); }

#screen {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none;
}
#screen::-webkit-scrollbar { display: none; }

.line { white-space: pre-wrap; word-break: break-word; margin: 0 0 0.35em; }
.line.player { color: var(--dim); text-transform: uppercase; }
.line.player::before { content: attr(data-prompt); }
.line.roll { border: 3px double var(--fg); padding: 0.2em 0.5em; display: block; }
.line.roll.others { background: #ecece6; color: #0a0a0a; border-color: #ecece6; text-shadow: none; }
.line.roll.others.ok { background: #4fdc86; border-color: #4fdc86; color: #03150a; }
.line.roll.others.bad { background: #ff6a5c; border-color: #ff6a5c; color: #1c0402; }
.rollbox { border: 3px double var(--fg); padding: 0.5em 0.8em; margin: 0.4em 0 0.8em; max-width: 46em; }
.rollbox[hidden] { display: none; }
.rb-title { animation: blink 1s infinite steps(1); margin-bottom: 0.2em; }
.rb-dim { color: var(--dim); }
.rollbox form { margin-top: 0.4em; }
.rollbox input {
  background: transparent; border: 0; border-bottom: 2px solid var(--fg); outline: 0;
  color: var(--fg); font: inherit; text-shadow: inherit; text-align: center; padding: 0 0.1em;
}
.rollbox button {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--fg); font: inherit; text-shadow: inherit;
}
.rollbox button:hover, .rollbox button:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }
.rollbox button:disabled { opacity: 0.4; cursor: default; }
.rb-actions { display: flex; flex-wrap: wrap; gap: 0.6em; align-items: baseline; margin-top: 0.3em; }
#rb-err { min-height: 1.1em; }
.rollfx {
  position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; text-align: center;
  background: rgba(0, 0, 0, 0.72); pointer-events: none;
}
.rollfx[hidden] { display: none; }
.planfx { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8em; padding: 4vh 4vw; cursor: pointer; }
.planfx[hidden] { display: none; }
.pf-title { letter-spacing: 0.2em; text-shadow: 0 0 6px var(--glow); }
.pf-hint { color: var(--dim); font-size: 0.85em; animation: blink 1.2s infinite steps(1); }
.coldopen { cursor: default; z-index: 90; gap: 1.4vh; }
.coldopen [hidden] { display: none; }
.co-head { letter-spacing: 0.3em; text-shadow: 0 0 6px var(--glow); }
.co-stage { position: relative; width: min(70vw, 640px); aspect-ratio: 16 / 9; max-height: 46vh; }
.co-pic { position: absolute; inset: 0; flex: none; animation: p-flicker 2.7s infinite steps(1); }
.co-pic canvas { width: 100%; height: 100%; image-rendering: pixelated; filter: grayscale(1); mix-blend-mode: multiply; }
.co-who { position: absolute; left: 0.6em; bottom: 0.4em; z-index: 2; letter-spacing: 0.2em; background: var(--bg); padding: 0 0.4em; }
.co-text { width: min(70vw, 640px); min-height: 3.6em; font-size: clamp(1em, 2.4vw, 1.5em); text-align: center; text-shadow: 0 0 6px var(--glow); }
.co-title { text-align: center; max-width: 80vw; }
.co-big { font-size: clamp(1.4em, 4vw, 3.2em); letter-spacing: 0.14em; line-height: 1.25; text-shadow: 0 0 10px var(--glow); margin-bottom: 0.8em; }
.co-hook { font-style: italic; color: var(--dim); max-width: 60ch; margin: 0 auto; }
@media (prefers-reduced-motion: reduce) { .co-pic { animation: none; } }
.sectorfx { cursor: default; justify-content: flex-start; overflow-y: auto; padding: 3vh 3vw; }
.sf-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16em, 1fr); gap: 1.2em; width: 100%; max-width: 1200px; align-items: start; }
.sf-map svg { width: 100%; height: auto; display: block; border: 1px solid var(--dim); }
.sf-map line { stroke: var(--dim); stroke-width: 2; }
.sf-map line.dark { stroke-dasharray: 6 6; }
.sf-map circle { fill: var(--bg); stroke: var(--fg); stroke-width: 2; }
.sf-map circle.core { fill: var(--fg); stroke: none; }
.sf-map text { fill: var(--fg); font: 15px var(--font); text-anchor: middle; text-shadow: none; }
.sf-map .rig path { fill: var(--fg); }
.sf-map .rig text { font-size: 13px; }
.sf-map .job { cursor: pointer; }
.sf-map .job rect { fill: var(--bg); stroke: var(--fg); stroke-width: 2; }
.sf-map .job text { font-weight: 700; }
.sf-map .job.mine rect { fill: var(--fg); }
.sf-map .job.mine text { fill: var(--bg); }
.sf-side { display: flex; flex-direction: column; gap: 0.6em; }
.sf-head { color: var(--dim); letter-spacing: 0.2em; }
.sf-job { display: flex; flex-direction: column; gap: 0.3em; text-align: left; white-space: normal; padding: 0.5em 0.7em; }
.sf-job.mine, .sf-job:hover, .sf-job:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; }
.sf-job.mine .sf-hook, .sf-job:hover .sf-hook, .sf-job:focus-visible .sf-hook { color: var(--bg); }
.sf-hook { color: var(--dim); font-size: 0.85em; }
.sf-none, .sf-played { color: var(--dim); }
@media (max-width: 800px) { .sf-body { grid-template-columns: minmax(0, 1fr); } }
.mm-body { display: flex; flex-direction: column; gap: 1em; width: 100%; max-width: 760px; }
.mm-row { display: flex; gap: 1em; border: 1px solid var(--dim); padding: 0.6em 0.8em; }
.mm-row .mm-face { flex: none; width: 5em; height: 5em; filter: grayscale(1); }
.mm-who { text-decoration: line-through; letter-spacing: 0.12em; font-size: 1.35em; line-height: 1.2; color: var(--fg); text-shadow: 0 0 6px var(--glow); overflow-wrap: anywhere; }
.pf-close { letter-spacing: 0.1em; padding: 0.3em 0.6em; border: 1px solid var(--fg); }
.sectorfx .pf-close { order: -1; align-self: flex-end; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.sf-map { overflow-x: auto; }
@media (max-width: 800px) { .sf-map svg { min-width: 900px; } .sf-map text { font-size: 17px; } .mm-row .mm-face { width: 6em; height: 6em; } }
.mm-final, .mm-epitaph { color: color-mix(in srgb, var(--fg) 70%, var(--dim)); margin-top: 0.3em; }
.flatfx { z-index: 95; cursor: default; background: #000; }
.fl-trace { width: 100%; height: 30vh; }
.fl-trace polyline { fill: none; stroke: #ff5a4e; stroke-width: 1.5; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px #ff5a4e); }
.fl-title { color: #ff8478; font-size: 1.3em; letter-spacing: 0.3em; font-weight: bold; text-shadow: 0 0 6px rgba(255, 90, 78, 0.6); }
.fl-form { display: flex; flex-direction: column; align-items: center; gap: 0.6em; width: 100%; max-width: 640px; }
.fl-form input { width: 100%; box-sizing: border-box; background: transparent; color: var(--fg); border: 1px solid var(--fg); font: inherit; padding: 0.3em 0.5em; }
.fl-form[hidden], .fl-title[hidden] { display: none; }
.isofx { cursor: default; padding: 3vh 3vw; }
.isofx .if-map { flex: 1; min-height: 0; width: 100%; overflow: auto; text-shadow: none; scrollbar-width: none; }
.isofx .if-map.iso { overflow: hidden; }
.mapfx { --panel: color-mix(in srgb, var(--fg) 4%, var(--bg)); --panel2: color-mix(in srgb, var(--fg) 7%, var(--bg)); --panel3: color-mix(in srgb, var(--fg) 11%, var(--bg));
  --line: color-mix(in srgb, var(--dim) 55%, var(--bg)); --line2: var(--dim); --muted: var(--dim); --accent: var(--fg); --accent-soft: var(--fg);
  --danger: #ff4a3d; --warn: #ffb22e; --player: #ffffff; --mono: var(--font); }
.mapfx .sv { min-width: 560px; }
@media (max-width: 800px) { .mapfx .sv { order: -1; } .isofx .if-map:not(.iso) { scrollbar-width: thin; scrollbar-color: var(--dim) transparent; } }
.mapfx .smap { display: flex; flex-direction: column; gap: 10px; }
.mapfx .mchip { color: var(--fg); font-size: 16px; }
.mapfx .mchip .mk { font-size: 14px; }
.mapfx .msname, .mapfx .mrname { font-size: 15px; }
.mapfx .mdname { font: 17px var(--font); }
.mapfx .sv text { font-size: 15px; }
.mapfx .sv .sv-deckname { font-size: 17px; }
.mapfx .sv .sv-roomname { font-size: 16px; }
.mapfx .sv .sv-val, .mapfx .sv .sv-tag { font-size: 14px; }
.pf-plan { width: min(92vw, 900px); display: flex; justify-content: center; filter: drop-shadow(0 0 4px var(--glow)); }
#reveal { flex: 0 0 clamp(280px, 38%, 560px); display: flex; flex-direction: column; align-items: center; gap: 0.4em;
  border-left: 2px solid var(--dim); padding: 0 0 0 0.8em; cursor: pointer; min-height: 0; }
#reveal[hidden] { display: none; }
.rv-title { letter-spacing: 0.2em; text-shadow: 0 0 6px var(--glow); }
.rv-pic { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; background: var(--fg); box-shadow: 0 0 18px var(--glow); overflow: hidden; }
.rv-pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; }
.rv-pic::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.3) 2px 3px); }
.rv-credit { color: var(--dim); font-size: 0.6em; text-shadow: none; text-align: center; }
.rv-credit a { color: inherit; }
@media (max-width: 899px) {
  #reveal { position: fixed; inset: 0; z-index: 60; background: var(--bg); padding: 4vh 4vw; border: 0; }
}
.pf-plan .roomplan { width: 100%; max-height: 72vh; color: var(--fg); }
.roomplan .rp-wall { fill: color-mix(in srgb, currentColor 30%, #000); }
.roomplan .rp-floor { fill: color-mix(in srgb, currentColor 6%, transparent); stroke: color-mix(in srgb, currentColor 14%, transparent); stroke-width: 0.5; }
.roomplan .rp-glass { fill: color-mix(in srgb, currentColor 30%, #fff); }
.roomplan .rp-door { fill: currentColor; }
.roomplan .rp-door.hatch { fill: color-mix(in srgb, currentColor 70%, #fff); }
.roomplan .rp-thing { fill: color-mix(in srgb, currentColor 25%, #000); stroke: currentColor; stroke-width: 1; }
.roomplan .rp-thing.hollow { fill: none; }
.roomplan .rp-screen, .roomplan .rp-soft { fill: currentColor; opacity: 0.7; }
.roomplan .rp-line { stroke: currentColor; stroke-width: 1; fill: none; }
.roomplan .rp-pipe { stroke: color-mix(in srgb, currentColor 70%, #000); stroke-width: 2; }
.roomplan .rp-core { fill: color-mix(in srgb, currentColor 25%, #000); stroke: currentColor; stroke-width: 1.5; }
.roomplan .rp-debris { stroke: currentColor; stroke-width: 2; fill: none; stroke-linejoin: round; }
.roomplan .rp-hit { fill: transparent; }
.rf-dice { font-size: clamp(64px, 16vw, 200px); line-height: 1; letter-spacing: 0.08em; }
.rf-out { font-size: clamp(22px, 4vw, 48px); margin-top: 0.4em; min-height: 1.2em; }
.rollfx.crit .rf-out { animation: blink 0.35s infinite steps(1); }
.rollfx.fail .rf-out { color: #ff4a3d; text-shadow: 0 0 10px rgba(255, 74, 61, 0.6); }

.line.style-boxed { border: 1px solid var(--fg); padding: 0.2em 0.5em; display: inline-block; }
.line.style-label::before { content: attr(data-label); opacity: 0.75; }
.line.has-portrait { display: flex; gap: 0.6em; align-items: flex-start; }
.line.has-portrait::before { content: none; }
.line.has-portrait .lt { flex: 1; min-width: 0; white-space: pre-wrap; }
.line.style-label .lt::before { content: attr(data-label); opacity: 0.75; }
.portrait.face { float: left; margin: 0.1em 0.7em 0.2em 0; }
#crewpick-list li.has-face::after { content: ""; display: block; clear: both; }
#crewpick-list li.current { outline: 1px solid var(--fg); outline-offset: 0.15em; }
#crewpick-list li { padding: 0.25em 0.4em; cursor: pointer; }
#crewpick-list li:hover, #crewpick-list li:has(.pick:focus-visible) { background: var(--fg); color: var(--bg); text-shadow: none; }
#crewpick-list li:hover :is(.pick, .p-dim, b), #crewpick-list li:has(.pick:focus-visible) :is(.pick, .p-dim, b) { background: none; color: inherit; text-shadow: none; }
.portrait.big { float: right; width: 7em; height: 7em; margin: 0 0 0.6em 1em; }
.portrait.side { width: 5.5em; height: 5.5em; margin-bottom: 0.5em; }
.portrait {
  position: relative; display: block; flex: none; width: 2.3em; height: 2.3em; margin-top: 0.05em;
  overflow: hidden; isolation: isolate;
  outline: 1px solid color-mix(in srgb, currentColor 40%, transparent); outline-offset: -1px;
  box-shadow: 0 0 6px color-mix(in srgb, currentColor 30%, transparent);
}
.portrait .ink { position: absolute; inset: 0; background: currentColor; -webkit-mask: var(--src) center / cover no-repeat; mask: var(--src) center / cover no-repeat; }
.portrait::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.32) 2px 3px);
}
.portrait.comms { animation: p-flicker 2.7s infinite steps(1); }
.portrait.comms .ink { filter: brightness(0.85) blur(0.4px); }
.portrait.comms::before {
  content: ""; position: absolute; inset: -32px; z-index: 1; pointer-events: none;
  background-image: var(--noise, none); background-size: 32px 32px; image-rendering: pixelated;
  mix-blend-mode: screen; opacity: 0.55; animation: p-noise 0.4s infinite steps(4);
}
.portrait.comms::after {
  z-index: 2;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.18) 46%, rgba(0, 0, 0, 0.35) 54%, transparent 100%) 0 0 / 100% 40% no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 1px, rgba(0, 0, 0, 0.45) 1px 2px);
  animation: p-roll 2.2s linear infinite;
}
@keyframes p-noise { 0% { transform: translate(0, 0); } 25% { transform: translate(-11px, 7px); } 50% { transform: translate(9px, -13px); } 75% { transform: translate(-5px, 15px); } }
@keyframes p-roll { from { background-position: 0 -60%, 0 0; } to { background-position: 0 160%, 0 0; } }
@keyframes p-flicker { 0%, 100% { opacity: 0.8; } 7% { opacity: 0.45; } 9% { opacity: 0.85; } 52% { opacity: 0.7; } 54% { opacity: 0.35; } 56% { opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) {
  .portrait.comms, .portrait.comms::before, .portrait.comms::after { animation: none; }
}
.line.style-narration { font-style: italic; color: #ecece6 !important; text-shadow: 0 0 2px rgba(236, 236, 230, 0.45), 0 0 9px rgba(236, 236, 230, 0.25) !important; }

#busy { color: var(--dim); margin-bottom: 0.35em; }
.dots::after { content: ""; animation: dots 1.2s infinite steps(4); }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

#inputrow { display: flex; align-items: baseline; gap: 0.4em; position: relative; }
#inputrow[hidden] { display: none; }
#prompt { white-space: nowrap; }
#in {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--fg); font: inherit; text-shadow: inherit;
  text-transform: uppercase; caret-color: transparent;
  padding: 0;
}
#caret { position: absolute; width: 0.55em; height: 1em; background: var(--fg); animation: blink 1s infinite steps(1); pointer-events: none; }
#inputrow.disabled { opacity: 0.35; }
#inputrow.disabled #caret, #inputrow:not(:focus-within) #caret { display: none; }
@keyframes blink { 50% { opacity: 0; } }

.ending-verdict { margin: 0.5em 0 0.3em; letter-spacing: 0.06em; }
#ending-recap .rc-h { margin-top: 0.8em; color: var(--fg); }
#ending-recap .rc-t { white-space: pre-wrap; color: var(--dim); }
#ending { max-height: 80vh; overflow-y: auto; }

.docbody .alog { white-space: normal; }
.alog-head { display: flex; justify-content: space-between; gap: 1em; color: var(--dim); }
.alog-state { color: var(--fg); }
.alog-ctl { margin: 0.4em 0 0.6em; display: flex; align-items: center; gap: 1em; }
.alog-lines { white-space: normal; }
.alog-line { color: var(--dim); opacity: 0.55; margin: 0 0 0.25em; }
.alog-line.said { color: var(--fg); opacity: 0.85; }
.alog-line.now { color: var(--fg); opacity: 1; text-shadow: 0 0 2px var(--glow), 0 0 9px var(--glow), 0 0 18px var(--glow); }
.alog-line.now::before { content: "> "; }
.alog-who { color: var(--fg); opacity: 0.8; letter-spacing: 0.04em; }
.alog-sfx { letter-spacing: 0.06em; }
.docbody { margin: 0.6em 0; font: inherit; max-height: 60vh; overflow-y: auto; overflow-x: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.docbody .md-h { color: var(--fg); letter-spacing: 0.08em; text-transform: uppercase; }
.docbody .md-h1 { border-bottom: 1px solid var(--dim); margin-bottom: 0.2em; }
.docbody .md-hr { border-top: 1px dashed var(--dim); margin: 0.5em 0; }
.docbody .md-gap { height: 0.6em; }
.docbody .md-q { border-left: 2px solid var(--dim); padding-left: 0.6em; color: var(--dim); }
#docs .docbody ul, #docs .docbody ol { margin: 0.1em 0; padding-left: 1.6em; white-space: normal; list-style: disc outside; }
#docs .docbody ol { list-style: decimal outside; }
#docs .docbody li > ul, #docs .docbody li > ol { margin: 0; list-style-type: circle; }
#docs .docbody li > ol { list-style-type: lower-alpha; }
.docbody .md-t { border-collapse: collapse; margin: 0.3em 0; max-width: 100%; white-space: normal; }
.docbody .md-t th, .docbody .md-t td { border: 1px solid var(--dim); padding: 0 0.4em; text-align: left; font-weight: normal; }
.docbody .md-t th { color: var(--fg); text-transform: uppercase; }
#docs .docbody li { margin: 0; }
.docbody b { font-weight: normal; background: var(--fg); color: var(--bg); padding: 0 0.2em; text-shadow: none; }
.docbody u { text-underline-offset: 0.15em; }
.docbody s { opacity: 0.7; }
.docbody code { font: inherit; border: 1px solid var(--dim); padding: 0 0.2em; }
#docs-list li .p-dim { margin-left: 0.6em; }

.shipbar { padding: 0.15em 0 0.4em; letter-spacing: 0.06em; }
.shipbar[hidden] { display: none; }
.shipbar .shiptoggle { display: none; }
.shipline { display: flex; flex-wrap: wrap; gap: 0.3em 0.7em; align-items: center; }
.shipline.shipbad { color: #ff4a3d; }
.shipdim { color: var(--dim); }
.shipbar button { background: none; border: 1px solid var(--fg); color: var(--fg); font: inherit; padding: 0 0.5em; cursor: pointer; letter-spacing: inherit; }
.shipbar button[aria-pressed="true"], .shipbar button:hover, .shipbar button:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }
.shipbar input { width: 3.2em; background: none; border: 1px solid var(--fg); color: var(--fg); font: inherit; padding: 0 0.3em; }
.clocks { display: flex; flex-wrap: wrap; gap: 0.4em 1.6em; padding: 0.15em 0 0.35em; letter-spacing: 0.08em; }
.clocks[hidden] { display: none; }
.clock b { font-weight: normal; background: var(--fg); color: var(--bg); padding: 0 0.3em; text-shadow: none; }
.clock.low { color: #ff4a3d; animation: blink 1s infinite steps(1); }
.clock.low b { background: #ff4a3d; }
.clock.paused { color: var(--dim); }
.clock.paused b { background: var(--dim); }

#credit {
  position: fixed; right: 2.2vw; bottom: 1.4vh; z-index: 210; margin: 0; max-width: 60vw;
  font-size: clamp(9px, 1.1vw, 12px); line-height: 1.3; text-align: right; color: var(--dim); opacity: 0.75; text-shadow: none;
}
#credit a { color: inherit; }
#credit a:hover, #credit a:focus-visible { color: var(--fg); }
.crt-glass { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.crt-glass > * { position: absolute; inset: 0; }

.crt-glass .grille {
  background: repeating-linear-gradient(to right,
    rgba(255, 40, 40, 0.06) 0 1px, rgba(40, 255, 80, 0.06) 1px 2px, rgba(40, 90, 255, 0.06) 2px 3px);
  mix-blend-mode: screen;
}

.crt-glass .scan {
  inset: -4px 0;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.32) 2px 3px, rgba(0,0,0,0) 3px 4px);
  animation: scanDrift 1.2s linear infinite;
}
@keyframes scanDrift { to { transform: translateY(4px); } }

.crt-glass .roll {
  inset: auto 0;
  height: 22vh;
  top: -22vh;
  background: linear-gradient(to bottom,
    transparent, color-mix(in srgb, var(--glow) 9%, transparent) 50%, transparent);
  mix-blend-mode: screen;
  animation: roll 9s linear infinite;
}
@keyframes roll { to { transform: translateY(122vh); } }

.crt-glass .grain {
  inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.07;
  mix-blend-mode: overlay;
  animation: grain 0.5s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-7%, 4%); } 40% { transform: translate(5%, -6%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(8%, 2%); } 100% { transform: translate(0, 0); }
}

.crt-glass .bezel {
  border-radius: 4% / 6%;
  box-shadow:
    0 0 0 60px #000,
    inset 0 0 6vmin 1vmin rgba(0, 0, 0, 0.85),
    inset 0 0 22vmin rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.55) 100%),
    radial-gradient(ellipse 55% 35% at 28% 18%, rgba(255, 255, 255, 0.045), transparent 70%);
}

@media (prefers-reduced-motion: reduce) {
  .crt-glass .scan, .crt-glass .roll, .crt-glass .grain { animation: none; }
  .crt-glass .roll { display: none; }
  #crt.power-on { animation: none; }
}

#boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  padding: 24px clamp(16px, 3vw, 48px);
  display: flex; flex-direction: column; cursor: pointer;
}
#boot pre { margin: 0; font: inherit; white-space: pre-wrap; }
#boot.gone { display: none; }
#join[hidden] { display: none; }
#join { margin-top: 0.5em; cursor: auto; }
#join label { margin-right: 0.4em; }
#join-code {
  background: transparent; border: 0; border-bottom: 2px solid var(--fg); outline: 0;
  color: var(--fg); font: inherit; text-shadow: inherit; text-transform: uppercase;
  letter-spacing: 0.3em; width: 8em; padding: 0 0.1em;
}
#join-err { color: var(--fg); min-height: 1.2em; margin-top: 0.4em; animation: blink 1.2s infinite steps(1); }
#join-err:empty { animation: none; }
.warden-link { margin-top: 2em; }
.warden-link a { color: var(--dim); text-decoration: none; border-bottom: 1px dashed var(--dim); text-shadow: none; }
.warden-link a:hover, .warden-link a:focus-visible { color: var(--fg); border-color: var(--fg); outline: none; }

#fx { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#fx > * { position: absolute; inset: 0; }
.fx-in { animation: fxIn 0.25s ease-out; }
.fx-out { transition: opacity 1.4s ease; opacity: 0 !important; }
@keyframes fxIn { from { opacity: 0; } }

.fx-canvas { width: 100%; height: 100%; }
.fx-ice { opacity: 0.9; }
.fx-goo { filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5)) saturate(1.2); }
.fx-goo { transform-origin: 50% 0; animation: gooBreathe calc(var(--beat, 3s) * 2.3) ease-in-out infinite; }
.fx-goo.fx-in { animation: fxIn 0.25s ease-out, gooBreathe calc(var(--beat, 3s) * 2.3) ease-in-out infinite; }
.fx-goo > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-goo .goo-glow { mix-blend-mode: screen; filter: blur(2.5px); animation: gooBeat var(--beat, 3s) infinite; }
@keyframes gooBreathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.004, 1.012); } }
@keyframes gooBeat { 0% { opacity: 0.12; } 7% { opacity: 0.75; } 16% { opacity: 0.3; } 25% { opacity: 0.55; } 45% { opacity: 0.18; } 100% { opacity: 0.1; } }
@media (prefers-reduced-motion: reduce) { .fx-goo, .fx-goo.fx-in, .fx-goo .goo-glow { animation: none; } }
.fx-static { image-rendering: pixelated; mix-blend-mode: screen; }

.fx-alarm {
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 10px #ff2020, inset 0 0 120px rgba(255,0,0,0.6);
  animation: alarmFlash 0.5s infinite steps(1);
}
@keyframes alarmFlash { 50% { box-shadow: inset 0 0 0 10px transparent, inset 0 0 60px rgba(255,0,0,0.15); } }
.fx-alarm .box, .fx-lockout .box {
  background: rgba(10,0,0,0.92); color: #ff3030; text-shadow: 0 0 10px #f00;
  border: 3px double #ff3030; padding: 1em 2em; text-align: center; max-width: 90vw;
}
.fx-alarm .warn { font-size: 2.2em; animation: blink 0.5s infinite steps(1); }
.fx-alarm .warn svg { width: 0.9em; height: 0.9em; vertical-align: -0.1em; margin: 0 0.3em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fx-alarm .trace { margin-top: 0.6em; color: #ff8080; }

.fx-redalert { background: rgba(255,0,0,0.18); animation: redPulse 2.2s infinite ease-in-out; mix-blend-mode: hard-light; }
@keyframes redPulse { 0%, 100% { background: rgba(255,0,0,0.05); } 50% { background: rgba(255,0,0,0.38); } }
.fx-redalert .strip {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #b00000; color: #fff; text-shadow: none; text-align: center; padding: 4px; white-space: nowrap; overflow: hidden;
}

.fx-blood, .fx-goo, .fx-crack, .fx-ice { z-index: 61; }
.fx-blackout { background: #000; z-index: 60; display: flex; align-items: flex-end; padding: 24px; }
.fx-blackout .aux { color: #400; text-shadow: none; animation: blink 2s infinite steps(1); }
.fx-blackout.restoring { animation: restore 1.6s forwards steps(8); }
@keyframes restore { 0% { opacity: 1; } 15% { opacity: 0; } 25% { opacity: 1; } 40% { opacity: 0; } 50% { opacity: 0.8; } 70% { opacity: 0; } 80% { opacity: 0.4; } 100% { opacity: 0; } }

.fx-lockout { background: rgba(0,0,0,0.75); display: grid; place-items: center; }
.fx-lockout .big { font-size: 2.6em; }

.fx-banner { display: grid; place-items: center; }
.fx-banner .txt {
  font-size: clamp(40px, 9vw, 140px); text-align: center; line-height: 1;
  background: var(--bg); color: var(--fg); border: 4px solid var(--fg); padding: 0.1em 0.4em; max-width: 92vw;
  animation: blink 0.8s infinite steps(1);
}

#crt.glitching { animation: none; }
#crt.glitching #screen, #crt.glitching #hdr {
  transform: translate(var(--gx, 0), var(--gy, 0));
  text-shadow: calc(var(--gx, 0) * -0.6) 0 rgba(255,0,60,0.8), var(--gx, 0) 0 rgba(0,180,255,0.8), 0 0 6px var(--glow);
  clip-path: polygon(0 0, 100% 0, 100% var(--gs), 96% var(--gs), 96% calc(var(--gs) + 3%), 100% calc(var(--gs) + 3%), 100% 100%, 0 100%);
}
#crt.glitch-3 { filter: hue-rotate(40deg) contrast(1.3); }

#crt .cr-red { color: #ff2448; text-shadow: 0 0 6px rgba(255,36,72,0.7); }
#crt .cr-mag { color: #ff3df2; text-shadow: 0 0 6px rgba(255,61,242,0.7); }
#crt .cr-cyan { color: #39f3ff; text-shadow: 0 0 6px rgba(57,243,255,0.7); }
#crt .cr-white { color: #fff; text-shadow: 0 0 8px rgba(255,255,255,0.8); }
#crt .cr-inv { background: var(--fg); color: var(--bg); text-shadow: none; }
#crt .cr-dim { color: var(--dim); opacity: 0.6; }
#crt .cr-shift { display: block; transform: translateX(var(--cs, 0)); filter: hue-rotate(160deg) saturate(2); }
#crt.corrupting #lines, #crt.corrupting #hdr {
  text-shadow: var(--cx, 0) 0 rgba(255,30,90,0.7), calc(var(--cx, 0) * -1) 0 rgba(30,220,255,0.7), 0 0 6px var(--glow);
}
#crt .cr-img { position: relative; }
#crt .cr-img > * { transform: translateX(var(--fx, 0)); clip-path: inset(var(--ct, 0) 0 var(--cb, 0) 0); filter: hue-rotate(var(--fh, 0deg)) saturate(2.6) contrast(1.5); }
#crt .cr-img.cr-img-inv > * { filter: invert(1) hue-rotate(var(--fh, 0deg)) contrast(1.8); }
#crt .cr-img::after { content: ""; position: absolute; left: -4%; right: -4%; top: var(--bt, 50%); height: var(--bh, 4%); background: var(--fg); mix-blend-mode: difference; pointer-events: none; }
#crt .rv-pic.cr-img::after { left: 0; right: 0; top: 0; height: auto; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.3) 2px 3px); mix-blend-mode: normal; }
#crt .rv-pic.cr-img::before { content: ""; position: absolute; z-index: 1; left: -4%; right: -4%; top: var(--bt, 50%); height: var(--bh, 4%); background: var(--fg); mix-blend-mode: difference; pointer-events: none; }
.fx-corrupt { pointer-events: none; }
.fx-corrupt i { position: absolute; left: 0; right: 0; opacity: 0.55; }
.fx-corrupt .b-inv { backdrop-filter: invert(1) hue-rotate(180deg); }
.fx-corrupt .b-hue { backdrop-filter: hue-rotate(110deg) saturate(3) brightness(1.3); }
.fx-corrupt .b-sat { backdrop-filter: hue-rotate(-90deg) contrast(2) saturate(4); }

@media (prefers-reduced-motion: reduce) {
  #crt { animation: none; }
}

#hdr .hdr-btn { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; text-shadow: inherit; letter-spacing: inherit; text-transform: uppercase; }
#hdr .hdr-btn:hover, #hdr .hdr-btn:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }
body.panel-open #lines, body.panel-open #busy, body.panel-open #inputrow, body.panel-open #watchpick { display: none; }
.cs { display: flex; flex-direction: column; gap: 0.5em; max-width: 30em; }
.cs-card { border: 2px solid var(--fg); border-radius: 0.6em; padding: 0.45em 0.6em 0.55em; box-shadow: 0 0 8px color-mix(in srgb, var(--fg) 22%, transparent), inset 0 0 10px color-mix(in srgb, var(--fg) 7%, transparent); }
.cs-title { text-align: center; letter-spacing: 0.14em; margin-bottom: 0.35em; }
.cs-k { color: var(--dim); font-size: 0.78em; letter-spacing: 0.08em; }
.cs-head { display: grid; grid-template-columns: 6em 1fr; gap: 0.6em; align-items: start; }
.cs-facebox { aspect-ratio: 1; border: 2px solid var(--fg); border-radius: 0.4em; overflow: hidden; position: relative; display: grid; place-items: center; }
.cs-facebox .portrait { width: 100%; height: 100%; outline: 0; box-shadow: none; }
.cs-noface { color: var(--dim); font-size: 0.7em; }
.cs-field { margin-bottom: 0.2em; }
.cs-field .cs-k { display: block; }
.cs-field b { display: block; font-weight: normal; border: 2px solid var(--fg); border-radius: 0.35em; padding: 0 0.4em; text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.cs-vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4em; text-align: center; }
.cs-pill { display: flex; align-items: stretch; justify-content: space-between; gap: 0.2em; min-height: 1.6em; border: 2px solid var(--fg); border-radius: 999px; padding: 0; overflow: hidden; font-size: 1.15em; white-space: nowrap; }
.cs-of { color: var(--dim); }
.cs-now { display: inline-block; text-align: center; }
.cs-now.of { text-align: right; }
.cs-pill .cs-step { flex: none; display: flex; align-items: center; padding: 0 0.15em 0 0.4em; opacity: 0.75; line-height: 1; }
.cs-pill .cs-step:last-child { padding: 0 0.4em 0 0.15em; }
.cs-step svg { width: 0.55em; height: 0.55em; }
@media (max-width: 480px) { .cs-full .cs-vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.2em; } .cs-pill { font-size: 1em; } .cs-pill .cs-step { padding: 0 0.1em 0 0.25em; } .cs-pill .cs-step:last-child { padding: 0 0.25em 0 0.1em; } }
.cs-pill > span { flex: 1; align-self: center; padding: 0.05em 0.2em; text-align: center; }
.cs-pill .cs-step:hover, .cs-pill .cs-step:focus-visible { opacity: 1; }
.cs-subs { display: flex; justify-content: space-around; color: var(--dim); font-size: 0.68em; letter-spacing: 0.08em; margin-top: 0.15em; }
.cs-nums { display: flex; justify-content: space-around; text-align: center; }
.cs-num { display: flex; flex-direction: column; align-items: center; gap: 0.15em; background: none; border: 0; padding: 0; color: var(--fg); font: inherit; text-shadow: inherit; }
button.cs-num { cursor: pointer; }
.cs-circle { width: 2.6em; height: 2.6em; border: 2px solid var(--fg); border-radius: 50%; display: grid; place-items: center; font-size: 1.15em; }
button.cs-num:hover .cs-circle, button.cs-num:focus-visible .cs-circle { background: var(--fg); color: var(--bg); text-shadow: none; }
button.cs-num:focus-visible { outline: none; }
.cs-num .cs-k { font-size: 0.74em; }
.cs-hint { text-align: center; color: var(--dim); font-size: 0.78em; margin-top: 0.35em; }
.cs-list > div { border-bottom: 1px dashed var(--dim); padding: 0.05em 0; display: flex; justify-content: space-between; align-items: baseline; gap: 0.6em; }
.cs-list .cs-bonus { flex: none; font-size: 0.85em; opacity: 0.85; }
.cs-list > div:last-child { border: 0; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 0.3em; }
.cs-chips > span, .cs-chips > .cs-doc { border: 2px solid var(--fg); border-radius: 999px; padding: 2px calc(0.45em + 2px); font-size: 0.85em; }
.cs-chips .cs-doc { display: inline-flex; align-items: center; gap: 0.3em; background: none; color: inherit; font-family: inherit; text-shadow: inherit; line-height: inherit; cursor: pointer; }
.cs-chips .cs-doc:hover, .cs-chips .cs-doc:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }
.cs-chips .cs-file { width: 1em; height: 1em; flex: none; }
.cs-chips > * { max-width: 100%; min-width: 0; display: inline-flex; align-items: center; }
.cs-cw { display: flex; min-width: 0; overflow: hidden; white-space: nowrap; }
.cs-ct { display: inline-block; white-space: nowrap; }
.cs-cw.long { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
.cs-chips > :hover .cs-cw.long, .cs-chips > :focus-visible .cs-cw.long { -webkit-mask-image: none; mask-image: none; }
.cs-chips > :hover .cs-cw.long .cs-ct, .cs-chips > :focus-visible .cs-cw.long .cs-ct { animation: csMarquee var(--dur, 4s) ease-in-out infinite alternate; }
@keyframes csMarquee { 0%, 12% { transform: translateX(0); } 88%, 100% { transform: translateX(var(--shift, 0)); } }
@media (prefers-reduced-motion: reduce) { .cs-chips > :hover .cs-cw.long .cs-ct { animation: none; } }
.cs-story { display: flex; flex-direction: column; gap: 0.3em; }
#crewfile { max-width: none; }
#crewfile-body { container-type: inline-size; }
.cs-full { max-width: none; }
@container (min-width: 38em) {
  .cs-full { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5em; align-items: stretch;
    grid-template-areas: "head story" "status status" "stats saves" "skills items"; }
  .cs-full .cs-head { grid-area: head; }
  .cs-full .cs-story { grid-area: story; }
  .cs-full .cs-status { grid-area: status; }
  .cs-full .cs-stats { grid-area: stats; }
  .cs-full .cs-saves { grid-area: saves; }
  .cs-full .cs-skills { grid-area: skills; }
  .cs-full .cs-items { grid-area: items; }
  .cs-full .cs-stats, .cs-full .cs-saves { display: flex; flex-direction: column; }
  .cs-full .cs-nums { flex: 1; align-items: center; }
}
.cs-compact { font-size: 0.85em; max-width: none; }
.cs-compact .cs-head { grid-template-columns: 4.6em 1fr; }
.s-foot { position: sticky; bottom: -1px; display: flex; gap: 1.2em; padding: 0.45em 0 calc(0.2em + 1px); background: var(--bg); border-top: 1px solid var(--dim); margin-top: auto;
  box-shadow: -0.8em 0 0 var(--bg); }

.panel { border: 3px double var(--fg); padding: 0.6em 0.9em; margin: 0.2em 0 0.8em; max-width: 52em; }
.panel[hidden] { display: none; }
.p-title { margin-bottom: 0.2em; }
.p-dim { color: var(--dim); }
.p-dim b { font-weight: normal; color: var(--fg); }
.panel ol { list-style: none; padding: 0; margin: 0.6em 0; }
.panel li { margin: 0 0 0.6em; }
.p-crime { padding-left: 2.2em; }
.p-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--fg); font: inherit; text-shadow: inherit; text-align: left; text-transform: uppercase; }
.p-btn:hover, .p-btn:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; outline: none; }
.p-sec { margin-top: 0.45em; }
.p-text { white-space: pre-wrap; }
.p-actions { margin-top: 0.8em; display: flex; gap: 2em; flex-wrap: wrap; }
.p-actions.p-top { margin: 0 0 0.6em; }

#mainrow { flex: 1; min-height: 0; display: flex; gap: 0.9em; }
#mainrow #screen { min-width: 0; }
#side {
  flex: 0 0 auto; overflow-y: auto; scrollbar-width: none;
  border-left: 2px solid var(--dim); padding: 0 0 0 0.8em; line-height: 1.25;
  display: flex; flex-direction: column;
}
#side > .cs { flex: 1 0 auto; }
#side::-webkit-scrollbar { display: none; }
#side[hidden] { display: none; }
#hdr .hdr-btn.on { text-decoration: underline; }
#hdr-menu { display: none !important; }
@media (pointer: coarse) and (max-width: 700px), (pointer: coarse) and (max-height: 520px) {
  #hdr #hdr-menu, #hdr.menu-open .hdr-btn:not([hidden]), #hdr.menu-open .vol { min-height: 44px; min-width: 44px; align-items: center; }
  #hdr.menu-open .hdr-btn:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; padding: 0 0.6em; }
  #hdr #hdr-menu { align-items: center; justify-content: center; padding: 0 0.6em; }
  .shipbar button { min-height: 40px; }
}
@media (max-width: 700px), (max-height: 520px) {
  #hdr { gap: 0.2em 0.8em; padding-bottom: 4px; margin-bottom: 6px; }
  #hdr .sep, #hdr-os, #hdr-clock { display: none; }
  #hdr .hdr-btn, #hdr .vol { display: none; }
  #hdr #hdr-menu { display: inline !important; }
  #hdr.menu-open .hdr-btn:not([hidden]) { display: inline; }
  #hdr.menu-open .vol { display: inline-flex; }
  #hdr.menu-open #hdr-menu { background: var(--fg); color: var(--bg); text-shadow: none; }
  .shipbar { font-size: 0.9em; }
  .shipbar .shiptoggle { display: block; margin: 0 0 0.3em; min-height: 44px; }
  .shipbar:not(.open) .shipline:nth-of-type(n+2):not(.shipbad) { display: none; }
  .shipbar:not(.open) .shipline:first-of-type { max-height: 2.6em; overflow: hidden; }
}

.rulesdlg { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid #3a3f44; border-radius: 12px;
  background: #15181b; color: #e9ecef; font: 16px/1.55 system-ui, "Segoe UI", sans-serif; text-shadow: none; letter-spacing: normal; text-transform: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); display: flex; flex-direction: column; }
.rulesdlg:not([open]) { display: none; }
.rulesdlg::backdrop { background: rgba(0, 0, 0, 0.72); }
.rules-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #2c3135; }
.rules-head h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 650; color: #fff; }
.rules-head button { background: none; border: 1px solid #3a3f44; border-radius: 8px; color: #e9ecef; font-size: 16px; width: 34px; height: 34px; cursor: pointer; }
.rules-head button:hover, .rules-head button:focus-visible { background: #262b2f; outline: none; }
.rules-body { overflow-y: auto; padding: 4px 22px 18px; }
.rules-body h2 { margin: 18px 0 6px; font-size: 15px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg); }
.rules-body ul { margin: 0; padding-left: 20px; }
.rules-body li { margin: 4px 0; }
.rules-body b { color: #fff; }
.rules-body .lead { font-size: 17px; color: #fff; margin: 14px 0 4px; }
.rules-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.rules-body dt { font-weight: 600; color: #fff; }
.rules-body dd { margin: 0; color: #b9c0c6; }
.rules-body .home { margin: 14px 0 0; font-size: 14px; color: #8a939a; }
.rules-body a { color: var(--fg); }
.rules-body .fine { margin: 18px 0 0; font-size: 13px; color: #8a939a; }
@media (max-width: 520px) { .rules-body dl { grid-template-columns: 1fr; } .rules-body dd { margin-bottom: 6px; } }

#selfroll .p-btn { margin: 0 0.5em 0.2em 0; }
#selfroll .p-btn.on { color: var(--fg); }
#selfroll .sr-pip { width: 0.4em; height: 0.4em; vertical-align: 0.08em; }
#selfroll .sr-pip rect { fill: currentColor; }
#selfroll .sr-pip path { stroke: var(--bg); stroke-width: 1.5; stroke-linecap: square; }
#selfroll .p-btn:hover .sr-pip path, #selfroll .p-btn:focus-visible .sr-pip path { stroke: var(--fg); }
#selfroll [hidden] { display: none; }
#sr-dice { background: transparent; border: 0; border-bottom: 2px solid var(--fg); outline: 0; color: var(--fg); font: inherit; text-shadow: inherit; text-align: center; }
#sr-err { color: var(--fg); animation: blink 1s infinite steps(1); }

body.look-flicker #screen, body.look-flicker #side { animation: lookflicker 5s infinite steps(1); }
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; }
body.calm #crt.glitching #screen, body.calm #crt.glitching #hdr { transform: none; clip-path: none; }
body.calm #crt.glitch-3, body.calm #crt.glitch-3 #hdr, body.calm #crt.glitch-3 #clocks, body.calm #crt.glitch-3 #mainrow { filter: none; }
body.calm .crt-glass .roll { display: none; }
@keyframes lookflicker { 0%, 100% { opacity: 1; } 3% { opacity: 0.55; } 4% { opacity: 1; } 41% { opacity: 0.8; } 42% { opacity: 1; } 77% { opacity: 0.4; } 78.5% { opacity: 1; } }
body.look-dim #crt { filter: brightness(0.62) saturate(0.8); }
body.look-grime #crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; mix-blend-mode: multiply;
  background:
    radial-gradient(ellipse 22% 16% at 18% 78%, rgba(70, 48, 20, 0.55), transparent 70%),
    radial-gradient(ellipse 30% 12% at 72% 22%, rgba(60, 40, 18, 0.45), transparent 70%),
    radial-gradient(ellipse 12% 20% at 88% 70%, rgba(50, 32, 12, 0.5), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(40, 30, 10, 0.18), transparent 80%);
}
body.look-portable #crt { inset: 5vh 6vw; border: 3px solid var(--dim); border-radius: 22px; box-shadow: 0 0 0 9999px #050505, inset 0 0 40px rgba(0, 0, 0, 0.6); font-size: 0.9em; }
body.look-portable #crt::before { content: "PORTABLE UNIT · SIGNAL ▂▄▆_ · BATT 62%"; position: absolute; right: 2.2em; bottom: 0.6em; color: var(--dim); font-size: 0.7em; letter-spacing: 0.08em; }

.warden-link + .warden-link { margin-top: 0.8em; }
.warden-link .linkbtn { background: none; border: 0; border-bottom: 1px dashed var(--dim); padding: 0; font: inherit; color: var(--dim); letter-spacing: inherit; cursor: pointer; text-transform: inherit; }
.warden-link .linkbtn:hover, .warden-link .linkbtn:focus-visible { color: var(--fg); outline: none; }
.pilotform { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.pilotform [hidden] { display: none !important; }
.pilotform h2 { margin-bottom: 0; }
.pilotform p { margin: 0; }
.pilotform label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #b9c0c6; }
.pilotform label.check { flex-direction: row; align-items: center; gap: 8px; }
.pilotform label a { color: var(--fg); font-size: 13px; }
.pilotform input:not([type="checkbox"]), .pilotform select { font: 15px system-ui, "Segoe UI", sans-serif; color: #e9ecef; background: #0e1012; border: 1px solid #3a3f44; border-radius: 8px; padding: 8px 10px; text-shadow: none; text-transform: none; letter-spacing: normal; }
.pilotform input:focus, .pilotform select:focus { outline: 2px solid color-mix(in srgb, var(--fg) 60%, transparent); outline-offset: 0; }
.pilotform .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pilotform button, .pilotform .ghostbtn { font: 600 14px system-ui, "Segoe UI", sans-serif; color: #e9ecef; background: #262b2f; border: 1px solid #3a3f44; border-radius: 8px; padding: 8px 14px; cursor: pointer; text-shadow: none; text-transform: none; letter-spacing: normal; }
.pilotform button:hover { background: #30363b; }
.pilotform button.primary { background: var(--fg); color: #000; border-color: var(--fg); }
.pilotform button.dangerbtn { color: #ff8a80; border-color: #6b3330; }
.pilotform .ghostbtn { padding: 3px 10px; font-size: 13px; }
.pilotform .err { color: #ff8a80; font-size: 14px; }
#ss-note b { color: #ffcf6e; }
#busy-t { color: var(--dim); }
.pilotform b { letter-spacing: 0.08em; }
#rb-stakes { white-space: pre-line; }
#lines .line.notice { color: var(--dim); font-style: italic; }
#solopick li .p-btn { text-align: left; }
#solopick .tags { color: var(--dim); }

body.stream { --cb-face: 15vh; --cb-cam: 19vh; }
body.stream #fx, body.stream .rollfx, body.stream .planfx { bottom: var(--fx-bottom, 0px); overflow: hidden; }
body.stream #crt.glitch-3 { filter: none; }
body.stream #crt.glitch-3 #hdr, body.stream #crt.glitch-3 #clocks, body.stream #crt.glitch-3 #mainrow { filter: hue-rotate(40deg) contrast(1.3); }
#castbar { display: flex; justify-content: flex-end; align-items: flex-end; gap: 2.5vh; margin-top: 0.6em; padding-top: 0.6em; border-top: 2px solid var(--dim); }
#castbar[hidden] { display: none; }
#cb-map { margin-right: auto; align-self: stretch; min-width: 0; flex: 0 1 auto; display: flex; align-items: flex-end; }
#cb-map .mm { height: calc(var(--cb-cam) + 1.4em); width: auto; max-width: 100%; overflow: visible; font-family: var(--font); }
.mm-corr, .mm-lift { stroke: var(--dim); stroke-width: 3; }
.mm-lift { stroke-width: 6; }
.mm-deck { fill: var(--dim); font-size: 20px; }
.mm-room rect { fill: var(--bg); stroke: var(--dim); stroke-width: 2; }
.mm-name { fill: var(--dim); font-size: 20px; }
.mm-room.here rect { fill: var(--fg); stroke: var(--fg); filter: drop-shadow(0 0 5px var(--glow)); }
.mm-room.here .mm-name, .mm-room.here .mm-pcs { fill: var(--bg); }
.mm-pcs { font-size: 20px; }
#cb-crew { display: flex; gap: 2.5vh; align-items: flex-end; }
.cb-pc, .cb-cam { display: flex; flex-direction: column; gap: 0.15em; font-size: max(14px, 2vh); line-height: 1.1; text-transform: uppercase; }
.cb-pc { position: relative; width: var(--cb-face); }
.cb-cam { width: var(--cb-cam); }
.cb-face { position: relative; width: var(--cb-face); height: var(--cb-face); border: 2px solid var(--dim); display: grid; place-items: center; overflow: hidden; }
.cb-pc.talking .cb-face { border-color: var(--fg); box-shadow: 0 0 10px var(--glow); }
.vwave { display: flex; align-items: center; gap: 1.2%; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.cb-pc > .vwave, .cb-cam > .vwave { position: absolute; z-index: 2; left: 0; right: 0; top: calc(100% + 0.3em); height: calc(var(--cb-face) * 0.18); padding: 0 6%; }
.alog .vwave { width: 15vh; height: 2.7vh; padding: 0 0.9vh; }
.talking .vwave { opacity: 1; transition-duration: 0.1s; }
.cb-cam { position: relative; }
.vwave i { flex: 1; height: 100%; background: var(--fg); opacity: 0.75; box-shadow: 0 0 2px var(--glow); border-radius: 1px; transform-origin: center; transform: scaleY(0.12); }
.talking .vwave i, body.calm .talking .vwave i { animation: vwave-bar var(--t) ease-in-out var(--d, 0s) infinite !important; }
.vwave { -webkit-mask: var(--static) 0 0 / 48px 48px; mask: var(--static) 0 0 / 48px 48px; --static: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.5 -0.1'/></filter><rect width='48' height='48' filter='url(%23n)'/></svg>"); }
.talking .vwave { animation: vwave-static 0.32s infinite steps(4); }
@keyframes vwave-static { 25% { -webkit-mask-position: 17px 31px; mask-position: 17px 31px; } 50% { -webkit-mask-position: 35px 7px; mask-position: 35px 7px; } 75% { -webkit-mask-position: 9px 22px; mask-position: 9px 22px; } }
@keyframes vwave-bar { 0%, 100% { transform: scaleY(0.12); } 50% { transform: scaleY(var(--h)); } }
.cb-face .portrait { width: 100%; height: 100%; outline: 0; box-shadow: none; }
.cb-noface { color: var(--dim); }
.cb-camframe { width: var(--cb-cam); height: var(--cb-cam); border: 3px double var(--fg); box-shadow: 0 0 12px var(--glow), inset 0 0 12px var(--glow); }
.cb-name, .cb-vit { display: flex; justify-content: space-between; align-items: center; gap: 0.4em; white-space: nowrap; }
.cb-vit, .cb-by { color: var(--dim); }
.cb-by { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-wounds { display: inline-flex; gap: 2px; }
.cb-wounds i { width: 0.45em; height: 0.45em; border: 1px solid var(--fg); }
.cb-wounds i.on { background: var(--fg); }
.cb-rec { color: #ff4a3d; text-shadow: 0 0 6px rgba(255, 74, 61, 0.6); animation: blink 1.2s infinite steps(1); }
.line.msg { padding-left: 0.6em; border-left: 3px solid var(--fg); text-transform: uppercase; }
.line.msg.out { color: var(--dim); border-left-style: dotted; }
.line.msg.in::before, .line.msg.fail::before { font-weight: bold; opacity: 1; }
.line.msg.fail { color: #ff4a3d; border-left-color: #ff4a3d; text-shadow: 0 0 6px rgba(255, 74, 61, 0.5); }
#msgpick-list { list-style: none; padding: 0; margin: 0.6em 0; }
.line.meta { color: var(--dim); text-transform: uppercase; }
.line.meta.table, .line.meta.heard, .line.meta.warden { color: var(--fg); }
.line .var { color: var(--dim); margin-top: 0.15em; }

#chargen:focus { outline: none; }
#chargen .cg-rows { margin: 0.5em 0; }
#chargen .cg-row { padding: 0.1em 0; }
#chargen .cg-k { color: var(--dim); display: inline-block; min-width: 9ch; }
#chargen .cg-num { font-weight: normal; border: 1px solid var(--fg); padding: 0 0.4em; }
#chargen .cg-die { display: inline-block; min-width: 2ch; text-align: center; border-bottom: 1px solid var(--dim); }
#chargen .cg-acts { margin: 0.5em 0; display: flex; gap: 1.5em; flex-wrap: wrap; align-items: baseline; }
#chargen .cg-list li { padding: 0.25em 0.4em; }
#chargen .cg-list li.cg-on { outline: 1px solid var(--fg); }
#chargen .cg-cur:not(.cg-skill) { background: rgba(255, 255, 255, 0.06); }
#chargen .cg-skill.cg-cur { background: var(--fg); color: var(--bg); text-shadow: none; }
#chargen .cg-pick { background: var(--fg); color: var(--bg); text-shadow: none; }
#chargen .cg-tier { margin-top: 0.6em; color: var(--dim); border-bottom: 1px solid var(--dim); }
#chargen .cg-skills { display: flex; flex-direction: column; align-items: flex-start; }
#chargen .cg-skill.locked, #chargen .cg-skill.class { color: var(--dim); cursor: default; }
#chargen .cg-skill:disabled:hover { background: none; color: var(--dim); }
#chargen .cg-gear { margin: 0.6em 0; padding-bottom: 0.4em; border-bottom: 1px dashed var(--dim); }
#chargen input { background: transparent; color: var(--fg); border: 1px solid var(--dim); font: inherit; padding: 0.2em 0.4em; width: 100%; max-width: 40em; margin-top: 0.3em; text-shadow: inherit; }
#chargen input:focus { outline: none; border-color: var(--fg); }
#chargen .cg-label { display: block; margin: 0.6em 0; }
#chargen .cg-type input { width: 14em; }
#chargen .cg-faces { display: flex; flex-wrap: wrap; gap: 0.4em; max-height: 14em; overflow-y: auto; margin: 0.5em 0; }
#chargen .cg-faces button { background: none; border: 1px solid var(--dim); padding: 0; cursor: pointer; width: 4em; height: 4em; }
#chargen .cg-faces button.on, #chargen .cg-faces button:focus-visible { border-color: var(--fg); outline: 2px solid var(--fg); }
#chargen .cg-faces img { width: 100%; height: 100%; object-fit: cover; display: block; }
#chargen .cg-facepreview { display: inline-block; width: 4em; height: 4em; vertical-align: middle; }
#chargen .cg-err, #chargen .cg-problems { color: var(--fg); min-height: 1.2em; }
#chargen .cg-pend { margin: 0.6em 0 1.2em; padding-bottom: 0.6em; border-bottom: 1px dashed var(--dim); }
#chargen .cg-keys { margin-top: 0.6em; font-size: 0.85em; }
#chargen .cs { max-width: 100%; }
@media (max-width: 600px) { #chargen .cg-k { display: block; } }
.cs-combat { display: flex; flex-direction: column; gap: 0.15em; margin-top: 0.5em; color: var(--dim); font-size: 0.72em; letter-spacing: 0.08em; text-align: center; }
.cs-combat .cs-bad, .cs-deceased { color: #ff5a4e; }
.cs-deceased { text-align: center; font-weight: bold; letter-spacing: 0.3em; border: 1px solid #ff5a4e; padding: 0.2em; margin-top: 0.5em; }
.cs-conds { display: flex; flex-wrap: wrap; gap: 0.3em; }
.cs-conds > span { border: 2px solid var(--fg); border-radius: 999px; padding: 2px calc(0.45em + 2px); font-size: 0.85em; }

/* ux-flows: death bar, job-board key hint */
.deadbar { border: 1px solid var(--fg); padding: 0.4em 0.7em; margin: 0.4em 0; display: flex; flex-wrap: wrap; gap: 0.3em 1em; align-items: baseline; }
.deadbar[hidden] { display: none; }
.sf-hint { color: var(--dim); font-size: 0.85em; }

.rulesdlg { border: 2px solid var(--fg); border-radius: 0; background: var(--bg); color: var(--fg); font: inherit; font-size: clamp(18px, 4.6vw, 22px); line-height: 1.2; box-shadow: 0 0 18px color-mix(in srgb, var(--fg) 30%, transparent); text-shadow: 0 0 2px var(--glow); }
.rules-head { border-bottom: 2px solid var(--dim); }
.rules-head h1 { font-size: 1.2em; font-weight: normal; color: var(--fg); letter-spacing: 0.12em; text-transform: uppercase; }
.rules-head button { border: 1px solid var(--fg); border-radius: 0; color: var(--fg); font: inherit; }
.rules-head button:hover, .rules-head button:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; }
.rules-body b, .rules-body dt, .rules-body .lead { color: var(--fg); }
.rules-body .lead { font-size: 1.1em; }
.rules-body h2 { font-weight: normal; letter-spacing: 0.12em; border-bottom: 1px solid var(--dim); padding-bottom: 2px; }
.rules-body dd, .rules-body .home, .rules-body .fine { color: color-mix(in srgb, var(--fg) 70%, var(--dim)); }
.rules-body a, .pilotform label a { color: var(--fg); text-decoration: underline; }
.pilotform label { color: var(--fg); font-size: 0.9em; }
.pilotform input:not([type="checkbox"]), .pilotform select { font: inherit; font-size: 0.95em; color: var(--fg); background: var(--bg); border: 1px solid var(--dim); border-radius: 0; text-shadow: none; }
.pilotform input[type="checkbox"] { accent-color: var(--fg); }
.pilotform button, .pilotform .ghostbtn { font: inherit; font-size: 0.9em; color: var(--fg); background: none; border: 1px solid var(--fg); border-radius: 0; text-transform: uppercase; letter-spacing: 0.08em; }
.pilotform button:hover, .pilotform .ghostbtn:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.pilotform button.primary { background: var(--fg); color: var(--bg); text-shadow: none; }
.pilotform button.dangerbtn { color: #ff4a3d; border-color: #ff4a3d; }
.pilotform .err { color: #ff4a3d; font-size: 0.9em; }

.touchtip { position: fixed; z-index: 60; max-width: min(320px, calc(100vw - 16px)); padding: 0.4em 0.7em; background: var(--bg); color: var(--fg); border: 1px solid var(--fg); box-shadow: 0 0 10px var(--glow); font-size: 1em; white-space: pre-line; pointer-events: none; }
.touchtip[hidden] { display: none; }
@media (max-width: 480px) { .fx-alarm .warn { font-size: 1.6em; } }
.fl-form input::placeholder { color: var(--dim); opacity: 1; }
.fl-form input:focus { outline: 2px solid var(--fg); outline-offset: 2px; }
