:root {
  --teal: #64ffda;
  --sky: #0ea5e9;
  --void: #05070d;
  --void-2: #0a1220;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --lamp: #ffb46b;
  --gold: #ffd27a;
  --fw: 14px; /* 1% of the frame width, set by JS */
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#space { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Cockpit plate: covers the viewport at the frame's 1671:941 aspect */
#frame {
  position: fixed;
  left: 50%;
  top: 50%;
  /* size is set by layout() in main.js: covers the viewport plus overscan for parallax/banking */
  width: max(100vw, calc(100vh * 1.7758));
  height: max(100vh, calc(100vw / 1.7758));
  transform: translate(-50%, -50%);
  will-change: transform;
}
#cockpit { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; pointer-events: none; }

/* Each screen = a glass face that follows the monitor's full perspective (.glass-face) plus the
   content layer (.glass) with only part of that skew, so text stays crisp and readable */
.glass-face {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none;
  background: rgba(10, 18, 32, 0.38);
  -webkit-backdrop-filter: blur(2px) saturate(1.25);
  backdrop-filter: blur(2px) saturate(1.25);
  border: 1px solid rgba(100, 255, 218, 0.55);
  box-shadow: 0 0 calc(var(--fw) * 1.2) rgba(100, 255, 218, 0.22), inset 0 0 calc(var(--fw) * 1.5) rgba(100, 255, 218, 0.07);
  border-radius: 3px;
  transition: opacity 0.5s ease, filter 0.5s ease;
}
.glass {
  position: absolute;
  color: var(--teal);
  font: 500 calc(var(--fw) * 0.62 * var(--fs, 1)) / 1.35 var(--mono);
  padding: calc(var(--fw) * 0.45);
  overflow: hidden;
  transition: opacity 0.5s ease, filter 0.5s ease;
}
.glass header { opacity: 0.7; letter-spacing: 0.12em; margin-bottom: 0.4em; font-size: 0.9em; }
/* Position + perspective come from PLATE.screens quads in main.js (CSS matrix3d) */
.glass { left: 0; top: 0; transform-origin: 0 0; backface-visibility: hidden; }
#term { display: flex; flex-direction: column; }
#cam  { padding: 0; }
#ctrl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* screens with text get denser glass so the nebula behind doesn't fight the text */
.glass-face[data-for=nav], .glass-face[data-for=tele], .glass-face[data-for=term] { background: rgba(6, 12, 22, 0.78); }
body.viewing .glass:not(#nav):not(#tele), body.viewing .glass-face:not([data-for=nav]):not([data-for=tele]) { opacity: 0.55; filter: saturate(0.6); }

/* NAV screen: header · sector tabs · route list · social links */
#nav { display: flex; flex-direction: column; gap: 0.45em; font-size: calc(var(--fw) * 0.62 * 0.84); padding: calc(var(--fw) * 0.35) calc(var(--fw) * 0.45); }
#nav header { display: flex; justify-content: space-between; margin: 0; }
#nav .nav-count { color: var(--text); opacity: 0.85; letter-spacing: 0.08em; }
#nav .boot { margin: 0; color: var(--muted); }
:where(#nav) button { all: unset; box-sizing: border-box; cursor: pointer; } /* zero specificity: tab/list rules below win */
.nav-tabs { display: grid; grid-template-columns: 0.8fr 1.15fr 1.45fr; gap: 0.3em; }
.nav-tabs button {
  text-align: center; padding: 0.12em 0; font-size: 0.82em; letter-spacing: 0.1em; color: var(--teal);
  border: 1px solid rgba(100, 255, 218, 0.28); border-radius: 2px; opacity: 0.7;
}
.nav-tabs button i { font-style: normal; margin-left: 0.4em; opacity: 0.6; }
.nav-tabs button[aria-selected="true"] { opacity: 1; background: rgba(100, 255, 218, 0.16); border-color: var(--teal); box-shadow: inset 0 -2px 0 var(--teal); }
.nav-tabs button:hover, .nav-tabs button:focus-visible { opacity: 1; outline: none; }
.nav-list {
  position: relative; list-style: none; margin: 0; padding: 0 0.15em 0 0; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(100, 255, 218, 0.35) transparent;
  mask-image: linear-gradient(to bottom, #000 85%, transparent);
}
.nav-list li + li { border-top: 1px solid rgba(100, 255, 218, 0.1); }
.nav-list button {
  display: grid; grid-template-columns: 1.7em 1fr auto; column-gap: 0.4em; align-items: baseline;
  width: 100%; padding: 0.24em 0.35em; line-height: 1.3; color: var(--text); border-left: 2px solid transparent;
}
.nav-list .n { color: var(--teal); opacity: 0.55; font-size: 0.85em; }
.nav-list .t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-list .d { color: var(--muted); font-size: 0.82em; white-space: nowrap; }
.nav-list small { grid-column: 2 / 4; color: var(--teal); opacity: 0.8; font-size: 0.8em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-list button:hover, .nav-list button:focus-visible { background: rgba(100, 255, 218, 0.08); outline: none; }
.nav-list button[aria-current="true"] { background: rgba(100, 255, 218, 0.16); border-left-color: var(--teal); }
.nav-list button[aria-current="true"] .n { opacity: 1; }
#nav footer { font-size: 0.72em; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; }
#nav footer kbd { font: inherit; color: var(--teal); border: 1px solid rgba(100, 255, 218, 0.35); border-radius: 2px; padding: 0 0.25em; }
.nav-social { display: flex; align-items: center; justify-content: space-between; gap: 0.8em; flex: none; font: 500 0.9em var(--mono); }
#nav .nav-social { border-top: 1px solid rgba(100, 255, 218, 0.28); padding-top: 0.35em; }
.nav-social a { color: var(--teal); text-decoration: none; white-space: nowrap; }
.nav-social a:hover { color: var(--text); text-decoration: underline; }
.nav-social a:focus-visible { outline: 1px solid var(--teal); outline-offset: 2px; }

/* Card sub-nav: previous / next in the sector */
.card-nav:empty { display: none; }
.card-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.8em;
  padding: 0.55em 1.2em; border-top: 1px solid rgba(100, 255, 218, 0.3); background: rgba(5, 7, 13, 0.45);
  font: 500 0.78em var(--mono); flex: none;
}
.card-nav button { all: unset; cursor: pointer; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-nav button:last-child { text-align: right; }
.card-nav button span { color: var(--teal); }
.card-nav button:hover, .card-nav button:focus-visible { color: var(--teal); outline: none; }
.card-nav .pos { color: var(--teal); opacity: 0.75; letter-spacing: 0.1em; }

#term { font-size: calc(var(--fw) * 0.5 * var(--fs, 1)); }
#term-out { flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; white-space: pre-wrap; word-break: break-word; color: var(--text); }
#term-out .sys { color: var(--teal); }
/* KW-OS boot: prompt hidden until the shell takes over */
#term.booting .prompt { visibility: hidden; }
#term-out .dim { color: var(--muted); }
#term-out .logo { color: var(--teal); white-space: pre; line-height: 1.1; text-shadow: 0 0 calc(var(--fw) * 0.4) rgba(100, 255, 218, 0.6); }
#term-out .ok { color: #7ee787; }
#term-out .warn { color: #ffb46b; }
#term-out .dir { color: var(--teal); }
#term-out mark { background: rgba(255, 180, 107, 0.3); color: #ffd9b0; }
#term-out .tilde { color: #3b82f6; opacity: 0.7; }
#term-out .status { color: #0b1016; background: var(--teal); padding: 0 0.3em; position: sticky; bottom: 0; flex: none; }
#term.vim #term-out > div { flex: none; }
#term.vim #term-out { justify-content: flex-start; }
#term.booting #term-out { animation: crt-on 0.35s ease-out; }
/* standby screensavers (in the glass face) while KW-OS boots; content powers on CRT-style */
.glass.standby { opacity: 0; pointer-events: none; transition: none; }
.glass-face .saver { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #04080e; }
.glass-face .saver canvas { width: 100%; height: 100%; display: block; }
.glass-face .saver::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,0.28) 0 1px, transparent 1px 3px); pointer-events: none; }
.glass-face .saver.off { animation: crt-off 0.26s ease-in forwards; }
.glass.powering { animation: crt-power 0.55s ease-out; }
@keyframes crt-off { 0% { clip-path: inset(0 0 0 0); filter: none; } 55% { clip-path: inset(49% 0 49% 0); filter: brightness(4); } 100% { clip-path: inset(49.5% 49% 49.5% 49%); filter: brightness(6); opacity: 0; } }
@keyframes crt-power {
  0% { clip-path: inset(49.5% 0 49.5% 0); filter: brightness(4) saturate(0); opacity: 1; }
  35% { clip-path: inset(0 0 0 0); filter: brightness(2.2); }
  50% { filter: brightness(0.6); opacity: 0.7; }
  62% { filter: brightness(1.5) hue-rotate(20deg); opacity: 1; }
  100% { clip-path: inset(0 0 0 0); filter: none; }
}
#term.handover #term-out { opacity: 0; transition: opacity 0.12s; }
@keyframes crt-on { from { transform: scaleY(0.02); filter: brightness(3); } 60% { transform: scaleY(1); filter: brightness(1.6); } to { filter: none; } }
#term .prompt { display: flex; flex-wrap: wrap; gap: 0.3em; color: var(--teal); }
#term input { all: unset; flex: 1; min-width: 4em; color: var(--text); caret-color: var(--teal); }

#tele header { display: flex; justify-content: space-between; }
#tele #t-fps { opacity: 0.7; }
.holo-ctl { display: flex; align-items: center; gap: 0.35em; margin-top: 0.55em; font-size: 0.9em; }
.holo-ctl span { opacity: 0.6; letter-spacing: 0.1em; margin-right: 0.2em; }
:where(.holo-ctl) button { all: unset; cursor: pointer; }
.holo-ctl button { padding: 0.08em 0.55em; border: 1px solid rgba(100, 255, 218, 0.3); border-radius: 2px; color: var(--teal); letter-spacing: 0.08em; opacity: 0.75; }
.holo-ctl button:hover, .holo-ctl button:focus-visible { opacity: 1; outline: none; }
.holo-ctl button[aria-pressed="true"] { opacity: 1; background: rgba(100, 255, 218, 0.18); border-color: var(--teal); }
#tele dl { display: grid; grid-template-columns: auto 1fr; gap: 0.15em 0.8em; margin: 0; }
#tele dt { opacity: 0.6; }
#tele dd { margin: 0; color: var(--text); }
.bar { display: inline-block; width: 100%; height: 0.6em; border: 1px solid rgba(100, 255, 218, 0.4); vertical-align: middle; }
.bar i { display: block; height: 100%; width: 20%; background: linear-gradient(90deg, var(--sky), var(--teal)); }

#cam img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 52%; transform-origin: 34% 52%; transform: scale(1.06); animation: camfloat 14s ease-in-out infinite alternate; opacity: 0.9; }
#cam span { position: absolute; left: 0.5em; top: 0.4em; font-size: 0.8em; color: var(--teal); text-shadow: 0 0 4px #000; }
@keyframes camfloat { from { transform: scale(1.06) translate(-0.4%, 0.2%); } to { transform: scale(1.065) translate(0.4%, -0.2%); } } /* fixed framing on the ship, only a faint float (same from the first frame) */

/* Projector beam from the console up to the card */
#beam {
  position: absolute;
  left: 36%;
  width: 28%;
  top: 40%;
  height: 34%;
  background: linear-gradient(to top, rgba(100, 255, 218, 0.5), rgba(100, 255, 218, 0.04) 85%, transparent);
  clip-path: polygon(47% 100%, 53% 100%, 100% 0, 0 0);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  mix-blend-mode: screen;
}
body.arrived #beam { opacity: 1; }
#beam { display: none; } /* replaced by the WebGL projector beam (#holo-fx) */

/* Hologram card */
.holo {
  position: fixed;
  z-index: 5;
  background: rgba(10, 18, 32, 0.62);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid rgba(100, 255, 218, 0.6);
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(100, 255, 218, 0.25), inset 0 0 40px rgba(100, 255, 218, 0.06);
  color: var(--text);
  overflow: hidden;
}
.holo::after { /* scanlines */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(100, 255, 218, 0.045) 0 1px, transparent 1px 3px);
}
.holo[hidden], #card[hidden] { display: none; }
#card::after { display: none; }
#card .holo-body { text-shadow: 0 0 8px rgba(100, 255, 218, 0.1); }
.holo.enter { animation: materialise 0.4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes materialise {
  0% { opacity: 0; transform: var(--tf) scaleY(0.02); filter: hue-rotate(40deg) brightness(2); }
  45% { opacity: 1; transform: var(--tf) scaleY(1.02); filter: hue-rotate(-20deg) brightness(1.4); }
  100% { opacity: 1; transform: var(--tf) scaleY(1); filter: none; }
}
#holo-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; } /* beam: under the cockpit, so it rises behind the monitors */
/* Projected panel out in space: space canvas → card (z1) → rocks in front of it (#holo-front, z2) → cockpit (z3) */
#holo-front { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
#frame { z-index: 3; pointer-events: none; }
#frame .glass { pointer-events: auto; }
/* Card = hologram body; edges, scanlines and glow come from the #holo-fx shader on top */
#card {
  display: flex;
  flex-direction: column;
  --tf: none;
  background: linear-gradient(to top, rgba(10, 52, 56, 0.5), rgba(6, 24, 34, 0.36) 60%, rgba(6, 20, 30, 0.3));
  border: 0; border-radius: 1px;
  box-shadow: 0 0 40px rgba(100, 255, 218, 0.05);
  -webkit-backdrop-filter: blur(9px) saturate(1.2); backdrop-filter: blur(9px) saturate(1.2);
  color: #dcf7f2;
  font-size: 16px; /* virtual: the projection scales the whole panel */
  line-height: 1.5;
}
/* desktop: laid out at a virtual width and natural height, then mapped onto the 3D panel (never scrolls) */
#card { left: 0; top: 0; transform-origin: 0 0; z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 100%, rgba(18, 70, 72, 0.45), transparent 70%),
    linear-gradient(to top, rgba(6, 30, 36, 0.84), rgba(4, 16, 26, 0.78) 55%, rgba(4, 14, 24, 0.74));
  -webkit-backdrop-filter: none; backdrop-filter: none; }
#card:not(.game) .bullets { columns: 2 22em; column-gap: 2.4em; }
#card .bullets li { break-inside: avoid; }
#card:not(.game) .project-media { width: min(30%, 280px); }
#card:not(.game) .holo-body { padding: 0.95em 1.4em 0.8em; line-height: 1.42; }
/* projected panels: denser type, so every entry projects larger */
#card:not(.game) h3 { font-size: 1.38em; }
#card:not(.game) .desc { margin-top: 0.55em; }
#card:not(.game) .bullets { margin-top: 0.5em; }
#card:not(.game) .bullets li { margin-bottom: 0.18em; }
#card:not(.game) .tags { margin-top: 0.6em; gap: 0.3em; }
#card:not(.game) .links { margin-top: 0.6em; }
#card:not(.game) .card-nav { padding-top: 0.42em; padding-bottom: 0.42em; }
.holo-body { flex: 1; min-height: 0; overflow: hidden; padding: 1.4em 1.6em; scrollbar-width: thin; scrollbar-color: rgba(100, 255, 218, 0.4) transparent; }
.holo .close {
  all: unset; position: absolute; right: 0.6em; top: 0.35em; z-index: 2;
  cursor: pointer; font-size: 1.4em; color: var(--teal); line-height: 1;
}

/* Imported article styles (subset of the live site, re-themed for glass) */
.holo h3 { margin: 0; font-size: 1.5em; color: var(--teal); text-shadow: 0 0 12px rgba(100, 255, 218, 0.5); }
.holo .role, .holo .event { margin: 0.15em 0 0; color: var(--text); font-weight: 500; }
.holo .meta { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.holo .job-head, .holo .project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.holo .project-media { float: right; width: 34%; margin: 0 0 0.8em 1.2em; border: 1px solid rgba(100, 255, 218, 0.35); border-radius: 4px; overflow: hidden; }
.holo .project-media img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.holo .prizes { list-style: none; margin: 0.8em 0 0; padding: 0; display: grid; gap: 0.3em; }
.holo .prizes li { color: var(--gold); font-size: 0.9em; }
.holo .prizes li::before { content: '★ '; }
.holo .desc { margin: 0.8em 0 0; }
.profile-avatar { float: right; width: 6em; height: 6em; object-fit: cover; border-radius: 50%; margin: 0 0 1em 1.2em; border: 1px solid var(--teal); }
.profile-pane .event { margin-bottom: 0.5em; color: var(--teal); }
.profile-handle { color: var(--teal); font-family: var(--mono); }
.profile-detail { color: var(--muted); }
.holo .bullets { margin: 0.7em 0 0; padding-left: 1.1em; color: #cbd5e1; }
.holo .bullets li { margin-bottom: 0.3em; }
.holo .bullets li::marker { color: var(--teal); }
.holo .tags { display: flex; flex-wrap: wrap; gap: 0.35em; margin: 0.9em 0 0; padding: 0; list-style: none; clear: both; }
.holo .tags li { font: 500 0.75em var(--mono); color: var(--teal); border: 1px solid rgba(100, 255, 218, 0.35); background: rgba(100, 255, 218, 0.07); padding: 0.2em 0.6em; border-radius: 999px; }
.holo .links { display: flex; flex-wrap: wrap; gap: 1.2em; margin-top: 1em; }
.holo .links a { color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(100, 255, 218, 0.4); }
.holo .links a::after { content: ' ↗'; color: var(--teal); }
.holo a.embed::before { content: '◉ '; color: var(--teal); font-size: 0.8em; vertical-align: 0.1em; }
.holo .links a.embed::after { content: none; }
.holo a.ext { border: 0 !important; margin-left: -0.9em; text-decoration: none; color: var(--muted); }
.holo a.ext::after { content: ' ↗'; color: var(--muted); }
.holo a.ext:hover::after { color: var(--teal); }
.card-nav a.pop { justify-self: end; text-decoration: none; color: #04110e; background: var(--teal); padding: 0.28em 0.8em; border-radius: 0.4em; font-weight: 600; box-shadow: 0 0 0.9em rgba(100, 255, 218, 0.35); }
.card-nav a.pop:hover { filter: brightness(1.12); }
#card.game { z-index: 4; } /* playing: in front of the canopy ribs (nothing to read behind it) */
.holo .launch {
  all: unset; cursor: pointer; display: inline-block; margin-top: 1em;
  padding: 0.5em 1em; border: 1px solid var(--teal); border-radius: 4px; color: var(--void); background: var(--teal);
  font-weight: 700; letter-spacing: 0.04em;
}
.holo .launch:hover { filter: brightness(1.1); }
.holo .links .launch { margin-top: 0; padding: 0.3em 1.3em; align-self: center; }

#card.game .holo-body { padding: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.game-wrap { position: relative; overflow: hidden; flex: none; }
.game-wrap iframe { position: absolute; left: 0; top: 0; border: 0; display: block; transform-origin: 0 0; background: #000; opacity: 0.94; }

#mnav { display: none; }
#hint {
  position: fixed; left: 50%; bottom: 1.2em; transform: translateX(-50%); z-index: 4;
  font: 500 12px var(--mono); color: var(--teal); background: rgba(5, 7, 13, 0.7);
  border: 1px solid rgba(100, 255, 218, 0.3); padding: 0.45em 0.9em; border-radius: 999px;
  transition: opacity 1s ease; white-space: nowrap;
}
#hint kbd { font: inherit; border: 1px solid rgba(100, 255, 218, 0.5); border-radius: 3px; padding: 0 0.3em; }
body.flown #hint { opacity: 0; }
.touch-only { display: none; }
@media (pointer: coarse), (orientation: portrait) and (max-width: 820px) { .touch-only { display: inline; } .desk-only { display: none; } }

#flat {
  position: fixed; left: 1em; top: 1em; z-index: 10; transform: translateY(-200%);
  background: var(--void); color: var(--teal); padding: 0.5em 0.9em; border: 1px solid var(--teal); border-radius: 4px;
}
#flat:focus { transform: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Phone portrait (Lite): bottom-sheet card + bottom destination bar (frame ⑥) */
@media (orientation: portrait) and (max-width: 820px) {
  #mnav {
    display: flex; flex-direction: column; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(5, 7, 13, 0.88); border-top: 1px solid rgba(100, 255, 218, 0.35);
  }
  #mnav button { all: unset; cursor: pointer; font: 600 12px var(--mono); color: var(--teal); border: 1px solid rgba(100, 255, 218, 0.3); border-radius: 6px; white-space: nowrap; }
  #mnav .m-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  #mnav .m-tabs button { text-align: center; padding: 6px 0; letter-spacing: 0.1em; opacity: 0.7; }
  #mnav .m-tabs button[aria-selected="true"] { opacity: 1; background: rgba(100, 255, 218, 0.15); }
  #mnav .m-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  #mnav .m-routes { display: flex; align-items: center; gap: 10px; }
  #mnav .m-routes .m-list { flex: 1; min-width: 0; }
  #mnav .nav-social { font-size: 11px; }
  #mnav .m-list button { padding: 8px 10px; color: var(--text); }
  #mnav button[aria-current="true"] { background: rgba(100, 255, 218, 0.18); border-color: var(--teal); color: var(--teal); }
  #card {
    --tf: none; transform: none !important; z-index: 8; font-size: 14px;
    -webkit-backdrop-filter: blur(9px) saturate(1.2); backdrop-filter: blur(9px) saturate(1.2);
    left: 0 !important; right: 0; width: auto !important; top: auto !important;
    bottom: calc(96px + env(safe-area-inset-bottom)); height: 48vh !important;
    border-radius: 14px 14px 0 0;
  }
  #card .holo-body { overflow: auto; }
  #card:not(.game) .bullets { columns: auto; }
  #hint { bottom: calc(106px + env(safe-area-inset-bottom)); white-space: normal; width: calc(100% - 32px); text-align: center; border-radius: 10px; }
  #beam { display: none; }
  #holo-fx { z-index: 9; } /* phone: the panel overlay sits on the bottom sheet (no beam) */
}

/* short desktop windows: smaller project media so long entries need less scrolling */
@media (max-height: 780px) and (min-width: 821px) {
  .holo .project-media { width: 24%; }
  .holo .bullets li { margin-bottom: 0.15em; }
}

@media (prefers-reduced-motion: reduce) {
  .holo.enter, #cam img { animation: none; }
}

#impact-flash { position: fixed; inset: 0; pointer-events: none; z-index: 7; opacity: 0;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 244, 225, 0.55), rgba(255, 180, 120, 0.12) 45%, transparent 70%); }
#impact-flash.on { animation: impact 0.45s ease-out; }
#hostile-alert { position: fixed; top: max(18px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 5;
  box-sizing: border-box; width: max-content; max-width: calc(100% - 32px); padding: 0.65em 1em; border: 1px solid rgba(255, 119, 85, 0.65); border-radius: 5px;
  background: rgba(22, 9, 12, 0.78); color: #ffb08c; font: 600 12px/1.5 var(--mono); text-align: center; pointer-events: none; }
#hostile-alert[hidden] { display: none; }
@keyframes impact { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #impact-flash.on { animation: none; } }

/* targeting reticle: follows the pointer over the canopy, closes in and turns amber on a lock */
body.aiming #frame, body.aiming #space { cursor: none; }
#reticle { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 5; pointer-events: none; }
#reticle i { position: absolute; width: 9px; height: 9px; border: 1.5px solid rgba(100, 255, 218, 0.85); transition: transform 0.15s, border-color 0.15s; }
#reticle i:nth-child(1) { left: -14px; top: -14px; border-right: 0; border-bottom: 0; }
#reticle i:nth-child(2) { left: 5px; top: -14px; border-left: 0; border-bottom: 0; }
#reticle i:nth-child(3) { left: -14px; top: 5px; border-right: 0; border-top: 0; }
#reticle i:nth-child(4) { left: 5px; top: 5px; border-left: 0; border-top: 0; }
#reticle b { position: absolute; left: -1.5px; top: -1.5px; width: 3px; height: 3px; border-radius: 50%; background: #64ffda; box-shadow: 0 0 6px #64ffda; }
#reticle.lock i { border-color: #ffb46b; }
#reticle.lock i:nth-child(1) { transform: translate(4px, 4px); } #reticle.lock i:nth-child(2) { transform: translate(-4px, 4px); }
#reticle.lock i:nth-child(3) { transform: translate(4px, -4px); } #reticle.lock i:nth-child(4) { transform: translate(-4px, -4px); }
#reticle.lock b { background: #ffb46b; box-shadow: 0 0 8px #ffb46b; }

/* lighting falloff: the cockpit's top corners sit in shadow (moves with the cockpit, under the screens) */
#vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 42% 48% at 4% 0%, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.28) 45%, transparent 100%),
              radial-gradient(ellipse 42% 48% at 96% 0%, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.28) 45%, transparent 100%); }

/* ---------- Intro portal (same look as the site's) ---------- */
.no-intro #intro { display: none; }
#intro { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; font-family: Inter, system-ui, sans-serif; }
#intro canvas { position: absolute; inset: 0; display: block; }
.intro-overlay { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 0 1.5rem; text-align: center; pointer-events: none; }
.intro-name { margin: 0; font-size: clamp(2.4rem, 8vw, 4.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  background: linear-gradient(190deg, #fff 0%, rgba(224, 224, 224, 0.8) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-title { margin: 0; font-size: clamp(0.95rem, 2.5vw, 1.5rem); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.9; }
.intro-rule { width: 30vw; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.4); margin: 2.5rem 0; }
.intro-hint { color: #ccc; background: rgba(255, 255, 255, 0.13); border-radius: 12px; padding: 8px 16px; opacity: 0.45; animation: intro-pulse 2.4s ease-in-out infinite; }
.intro-rule, .intro-hint { transition: opacity 0.4s ease; }
#intro.entered .intro-rule, #intro.entered .intro-hint { opacity: 0; animation: none; }
#intro.entered .intro-overlay { opacity: 0; transform: scale(1.8); filter: blur(6px); transition: opacity 1.2s ease-in, transform 2s ease-in, filter 1.2s ease-in; }
#intro.releasing { background: transparent; pointer-events: none; cursor: default; }
@keyframes intro-pulse { 50% { opacity: 0.8; } }
.hint-tap { display: none; }
@media (hover: none) { .hint-click { display: none; } .hint-tap { display: inline; } }

/* disco: the overlay sits over the cockpit, under the UI */
#disco { position: fixed; inset: 0; z-index: 4; pointer-events: none; display: none; }
body.disco #frame .glass-face { animation: disco-glow 0.97s linear infinite; }
@keyframes disco-glow { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body.disco #frame .glass-face { animation-duration: 8s; } }
/* playing: the bar under the embed scales down with the panel, so draw it large enough to read and click */
@media (min-width: 821px) {
  #card.game .card-nav { font-size: 26px; padding: 0.35em 0.6em; align-items: center; }
  #card.game .card-nav a.pop { padding: 0.25em 0.9em; }
}

/* phone flight pad: thumb stick bottom-left, FIRE / SALVO / WARP bottom-right, above the destinations sheet */
#pad { display: none; }
@media (orientation: portrait) and (max-width: 820px) {
  #pad { display: flex; justify-content: space-between; align-items: flex-end; position: fixed; left: 12px; right: 12px; bottom: 112px; z-index: 6; pointer-events: none; transition: opacity 0.25s; }
  body.viewing #pad, html:not(.no-intro) body:has(#intro) #pad { opacity: 0; pointer-events: none; }
  body.viewing #pad * { pointer-events: none !important; }
  #hint { bottom: 256px !important; max-width: calc(100vw - 32px); }
  #pad .stick { pointer-events: auto; touch-action: none; width: 92px; height: 92px; border-radius: 50%; position: relative;
    background: radial-gradient(circle, rgba(100, 255, 218, 0.08), rgba(4, 12, 18, 0.55) 70%); border: 1px solid rgba(100, 255, 218, 0.45); box-shadow: 0 0 14px rgba(100, 255, 218, 0.18) inset; }
  #pad .stick i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #c9fff1, #39d6b4 60%, #0f6e5c); box-shadow: 0 0 12px rgba(100, 255, 218, 0.55); transition: transform 0.12s; }
  #pad .stick:active i { transition: none; }
  #pad .btns { display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
  #pad button { all: unset; touch-action: none; user-select: none; -webkit-user-select: none; text-align: center; font: 700 11px var(--mono); letter-spacing: 0.12em;
    color: var(--teal); padding: 9px 0; width: 74px; border-radius: 8px; border: 1px solid rgba(100, 255, 218, 0.45); background: rgba(4, 12, 18, 0.6); }
  #pad button[data-act="fire"] { color: #ffd0b0; border-color: rgba(255, 140, 80, 0.7); background: rgba(60, 16, 4, 0.6); padding: 16px 0; }
  #pad button.on { background: rgba(100, 255, 218, 0.3); color: #fff; }
  #pad button[data-act="fire"].on { background: rgba(255, 120, 60, 0.45); }
}
