/* fulox — a portfolio you walk through.
   Layout: a 1440×900 "stage" (three rooms side by side on a sliding track) scaled to the viewport,
   with a HUD (brand, clock, rooms nav, caption, time control) laid over it in normal flow,
   and a full-screen "screen" overlay for detail views reached by a camera dive. */

:root {
  /* ink + light */
  --bg: #0E1116;
  --bg-2: #141920;
  --bg-3: #1B212A;
  --line: #2B3340;
  --line-2: #3A4454;
  --fg: #E6EDF3;
  --fg-2: #C9D1D9;
  --fg-3: #9BA7B4;
  --fg-4: #6B7684;
  /* two light sources in every room: cool monitor green and warm lamp amber */
  --green: #3DDC97;
  --green-2: #8FF0C4;
  --green-dim: #24443A;
  --amber: #F2A65A;
  --amber-2: #FFD9AE;
  --red: #FF6B6B;
  --blue: #7FB4E6;
  --violet: #9B8CFF;
  --screen: #07090C;

  /* type */
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* lighting, set per time of day by JS (defaults = night) */
  --sky-a: #06102A;
  --sky-b: #1B2A52;
  --wall: #12161D;
  --wall-2: #0B0E13;
  --floor: #0C0F14;
  --floor-2: #070A0D;
  --lamp: 0.42;
  --daylight: 0;
  --city: 1;
  --bld: #060A14;

  --radius: 14px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-dive: cubic-bezier(.65,0,.15,1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
a:hover { color: var(--green-2); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
img, video { max-width: 100%; display: block; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 10px 14px; background: var(--green); color: var(--bg); border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 16px; }

/* ---------- stage ---------- */
#main { position: relative; height: 100%; }
.stage-wrap {
  position: absolute; inset: 0;
  overflow: hidden;
  perspective: 1600px;
}
.stage {
  position: absolute; left: 50%; top: 50%;
  width: 1440px; height: 900px;
  transform-origin: 50% 50%;
  /* scale + centre are set by JS via --s, --tx, --ty; tilt via --rx, --ry */
  transform: translate(-50%, -50%) scale(var(--s, 1)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  will-change: transform, filter;
  transition: filter .7s var(--ease-dive);
}
.stage.is-diving { filter: blur(10px) brightness(.55); }
.dive { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform .75s var(--ease-dive); transform-style: preserve-3d; }
.stage.is-diving .dive { transform: scale(2.4); }
.track {
  position: absolute; left: 0; top: 0;
  width: 4320px; height: 900px;
  display: flex;
  transform: translateX(calc(var(--room, 0) * -1440px));
  transition: transform .95s var(--ease-dive);
}
@media (prefers-reduced-motion: reduce) {
  .track, .stage, .dive { transition: none; }
  .stage.is-diving .dive { transform: none; }
}
.room {
  position: relative; flex: 0 0 1440px; height: 900px; overflow: hidden;
  font-family: var(--mono);
  color: var(--fg);
}
.room > * { position: absolute; }
.layer { position: absolute; inset: 0; pointer-events: none; transform: translate(calc(var(--px, 0px) * var(--depth, 0)), calc(var(--py, 0px) * var(--depth, 0))); will-change: transform; }
.layer > * { position: absolute; }
.layer.hit { pointer-events: none; }
.layer.hit > * { pointer-events: auto; }

/* lighting primitives shared by rooms */
.wall {
  left: 0; top: 0; width: 1440px; height: 640px;
  background:
    radial-gradient(900px 600px at 72% 70%, rgba(242,166,90,calc(var(--lamp) * .55)) 0%, rgba(242,166,90,0) 60%),
    radial-gradient(700px 500px at 20% 35%, rgba(143,176,220,calc(var(--daylight) * .22)) 0%, rgba(143,176,220,0) 65%),
    linear-gradient(180deg, var(--wall) 0%, var(--wall-2) 100%);
  transition: background 1.2s var(--ease);
}
.floor {
  left: 0; top: 640px; width: 1440px; height: 260px;
  background:
    radial-gradient(700px 180px at 50% 0%, rgba(242,166,90,calc(var(--lamp) * .25)) 0%, rgba(242,166,90,0) 70%),
    linear-gradient(180deg, var(--floor) 0%, var(--floor-2) 100%);
  transition: background 1.2s var(--ease);
}
.floor::before {
  content: ""; position: absolute; left: 0; top: -3px; width: 100%; height: 5px;
  background: linear-gradient(180deg, #2A313B, #171C23);
}
.floor::after {
  content: ""; position: absolute; left: 0; top: 2px; width: 100%; height: 258px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 2px, transparent 2px 120px);
  mask: linear-gradient(180deg, rgba(0,0,0,.6), transparent);
}
.rug {
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #232A35 0%, #1A2029 70%, #171C24 100%);
  box-shadow: inset 0 0 0 1px #262E39, 0 10px 30px rgba(0,0,0,.35);
}
.vignette {
  left: 0; top: 0; width: 1440px; height: 900px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%);
}
.grain {
  left: 0; top: 0; width: 1440px; height: 900px; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .35 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

/* window */
.win {
  border: 10px solid #232A35; background: linear-gradient(180deg, var(--sky-a), var(--sky-b));
  overflow: hidden; transition: background 1.2s var(--ease);
  box-shadow: inset 0 0 40px rgba(0,0,0,.35), 0 0 0 2px #1A1F27, 0 30px 60px rgba(0,0,0,.35);
}
.win::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 60%, rgba(255,255,255,.05) 100%);
  pointer-events: none;
}
.win .mull-v, .win .mull-h { position: absolute; background: #232A35; }
.win .orb { position: absolute; border-radius: 50%; transition: all 1.2s var(--ease); }
.win .bld { position: absolute; bottom: 0; background: var(--bld); transition: background 1.2s var(--ease); }
.win .bld i { position: absolute; width: 4px; height: 6px; background: #FFB86B; opacity: var(--city); transition: opacity 1.2s var(--ease); }
.win-spill {
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(143,176,220,calc(var(--daylight) * .35 + .04)) 0%, rgba(143,176,220,0) 70%);
  transition: background 1.2s var(--ease);
}
.sill { background: linear-gradient(180deg, #343D4A, #222933); border-radius: 2px; box-shadow: 0 8px 18px rgba(0,0,0,.4); }

/* doors */
.door {
  border: 6px solid #2B3340; border-bottom: none; background: linear-gradient(180deg, #0A0D12, #05070A);
  box-shadow: inset 0 0 40px rgba(0,0,0,.8);
}
.door .light { position: absolute; top: 0; height: 100%; width: 10px; opacity: .35; }
.door-label { font-size: 11px; letter-spacing: .12em; color: var(--fg-3); white-space: nowrap; }

/* furniture */
.desk-top {
  border-radius: 3px;
  background: linear-gradient(180deg, #4A3729 0%, #3B2C22 60%, #2E221A 100%);
  box-shadow: 0 2px 0 #2A1F18, 0 14px 30px rgba(0,0,0,.45);
}
.desk-top::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 1px, transparent 1px 23px); border-radius: 3px; }
.desk-leg { background: linear-gradient(90deg, #1E232B, #2A313B 50%, #1A1F26); }
.drawer { border-radius: 2px; background: linear-gradient(180deg, #332A23, #261F19); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.knob { border-radius: 2px; background: #6A5848; }

.monitor {
  border: 6px solid #1C2129; border-radius: 6px; background: var(--screen);
  box-shadow: 0 0 0 1px #0A0D11, 0 22px 50px rgba(0,0,0,.6), 0 0 60px rgba(61,220,151,.12);
  overflow: hidden; font-size: 11px; line-height: 16px; color: var(--green);
}
.monitor::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
              linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,0) 40%);
}
.monitor .scr { position: absolute; inset: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.stand { background: linear-gradient(180deg, #1C2129, #12161C); border-radius: 2px; }
.glow-green { pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse, rgba(61,220,151,.14) 0%, rgba(61,220,151,0) 70%); }
.glow-amber { pointer-events: none; border-radius: 50%; background: radial-gradient(circle, rgba(242,166,90,calc(var(--lamp) * .9)) 0%, rgba(242,166,90,0) 65%); transition: background 1.2s var(--ease); }

.laptop { border: 4px solid #1C2129; border-radius: 4px 4px 2px 2px; background: #0B0E13; overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,.5), 0 0 30px rgba(242,166,90,.12); }
.laptop-base { border-radius: 2px; background: linear-gradient(180deg, #2B3340, #1C2129); }

.lamp-head { border-radius: 22px 22px 4px 4px; background: linear-gradient(180deg, #343D4A, #222933); border-bottom: 3px solid var(--amber-2); box-shadow: 0 0 30px rgba(242,166,90,calc(var(--lamp) * .8)); transition: box-shadow 1.2s var(--ease); }
.lamp-arm { background: #2B3340; }
.lamp-base { border-radius: 3px; background: #1C2129; }

.chair-back { border-radius: 22px 22px 8px 8px; background: linear-gradient(180deg, #262C36, #1A1F27); box-shadow: inset 0 0 0 1px #2B3340; }
.chair-seat { border-radius: 6px; background: linear-gradient(180deg, #2A313B, #1E242D); }
.chair-post { background: #1E232B; }
.chair-foot { border-radius: 3px; background: #1E232B; }

.plant-leaf { border-radius: 50%; background: linear-gradient(180deg, #3A7357, #24543F); box-shadow: inset -6px -8px 14px rgba(0,0,0,.3); }
.plant-pot { border-radius: 4px 4px 10px 10px; background: linear-gradient(180deg, #4A3A2E, #2E241D); }
.beanbag { border-radius: 48% 52% 40% 40%; background: radial-gradient(ellipse at 40% 30%, #3B3550, #241F33); box-shadow: 0 10px 20px rgba(0,0,0,.4); }

.mug { border-radius: 2px 2px 5px 5px; background: linear-gradient(180deg, #ECEFF3, #C7CDD6); }
.mug::after { content: ""; position: absolute; right: -7px; top: 5px; width: 8px; height: 10px; border: 2px solid #D9DEE5; border-left: none; border-radius: 0 6px 6px 0; }
.keyboard { border-radius: 2px; background: linear-gradient(180deg, #1F252E, #171C23); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.keyboard::after { content: ""; position: absolute; inset: 1px 4px; background: repeating-linear-gradient(90deg, #2A313B 0 6px, transparent 6px 9px); opacity: .7; }
.mouse { border-radius: 40% 40% 50% 50%; background: linear-gradient(180deg, #2A313B, #1C2129); }

/* server room */
.glass {
  border: 3px solid #2B3340; background: linear-gradient(180deg, rgba(61,220,151,.06), rgba(61,220,151,.02));
  box-shadow: inset 0 0 60px rgba(61,220,151,.06), 0 20px 50px rgba(0,0,0,.4);
}
.glass::after { content: ""; position: absolute; left: 70%; top: 0; width: 7%; height: 100%; background: rgba(255,255,255,.035); transform: skewX(-10deg); }
.rack { border: 4px solid #232A35; background: linear-gradient(180deg, #0C0F14, #090B0F); box-shadow: inset 0 0 20px rgba(0,0,0,.6); }
.unit { display: flex; align-items: center; gap: 5px; height: 24px; margin: 6px 6px 0; padding: 0 7px; background: linear-gradient(180deg, #161B23, #11151B); border: 1px solid #232A35; border-radius: 2px; }
.unit i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px currentColor; color: var(--green); }
.unit i.dim { background: var(--green-dim); box-shadow: none; }
.unit i.warn { background: var(--amber); color: var(--amber); }
.unit b { flex: 1; height: 2px; background: #232A35; }
.handle { border-radius: 3px; background: #8A94A3; }

/* neon */
.neon {
  font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 52px; letter-spacing: -.01em;
  color: var(--amber-2); white-space: nowrap;
  text-shadow: 0 0 6px var(--amber), 0 0 18px var(--amber), 0 0 42px rgba(242,166,90,.6);
  animation: flick 7s linear infinite;
}
@keyframes flick { 0%,90%,100%{opacity:1} 92%{opacity:.5} 94%{opacity:1} 96%{opacity:.7} }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
.blink { animation: blink 1.4s ease-in-out infinite; }
.blink-slow { animation: blink 2.6s ease-in-out infinite; }
@keyframes caret { 0%,49%{opacity:1} 50%,100%{opacity:0} }
.caret { animation: caret 1s steps(1) infinite; }

/* clock on the wall */
.wall-clock {
  width: 80px; height: 80px; border-radius: 50%; border: 4px solid #2B3340; background: radial-gradient(circle at 50% 35%, #12161D, #0B0E13);
  color: var(--fg); font-family: var(--mono); font-size: 15px; font-weight: 700; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.wall-clock small { font-size: 10px; font-weight: 400; color: var(--fg-3); }

/* the character */
.char { width: 120px; height: 204px; transform-origin: 50% 50%; transition: left 1.2s var(--ease), top 1.2s var(--ease), transform 1.2s var(--ease); }
.char > * { position: absolute; }
.char .head { left: 33px; top: 0; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #2A211C, #15100D); }
.char .hair { left: 30px; top: -4px; width: 60px; height: 30px; border-radius: 30px 30px 8px 8px; background: #0B0908; }
.char .body { left: 10px; top: 48px; width: 100px; height: 100px; border-radius: 40px 40px 12px 12px; background: linear-gradient(180deg, #2F6F5E, #245548); animation: breathe 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
.char .hood { left: 30px; top: 44px; width: 60px; height: 22px; border-radius: 0 0 30px 30px; background: #265A4C; }
.char .leg { top: 148px; width: 22px; height: 56px; border-radius: 0 0 6px 6px; background: #1E232B; }
.char .leg.l { left: 28px; } .char .leg.r { left: 70px; }
.char.sit .leg { height: 30px; top: 146px; }
@keyframes breathe { 0%,100%{transform:scaleY(1)} 50%{transform:scaleY(1.025)} }
.bubble {
  padding: 10px 14px; border-radius: 14px; background: #F3F5F7; color: #12161C;
  font-family: var(--display); font-size: 15px; line-height: 20px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transition: left 1.2s var(--ease), top 1.2s var(--ease);
}
.bubble::after { content: ""; position: absolute; left: var(--tail, 24px); bottom: -6px; width: 12px; height: 12px; background: #F3F5F7; transform: rotate(45deg); }

/* hotspots */
.hit a, .hit button { display: block; background: transparent; border: 0; padding: 0; border-radius: 6px; cursor: pointer; }
.hit a:hover, .hit button:hover { box-shadow: 0 0 0 2px rgba(61,220,151,.35), 0 0 40px rgba(61,220,151,.12); }
.pin {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 4px;
  border-radius: 999px; border: 1px solid rgba(61,220,151,.7); background: rgba(10,12,16,.82);
  color: var(--fg); font-family: var(--mono); font-size: 11px; font-weight: 500; white-space: nowrap; text-decoration: none;
  backdrop-filter: blur(6px);
  transition: transform .15s var(--ease), background .15s, color .15s;
  pointer-events: auto;
}
.pin b { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: var(--bg); font-weight: 700; }
.pin::before { content: ""; position: absolute; left: 16px; top: 16px; width: 0; height: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(61,220,151,.5); animation: pulse 2.6s ease-out infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(61,220,151,.45)} 100%{box-shadow:0 0 0 22px rgba(61,220,151,0)} }
.pin:hover, .pin:focus-visible, .pin.is-on { transform: translateY(-2px); background: var(--green); color: var(--bg); }
.pin:hover b, .pin:focus-visible b, .pin.is-on b { background: var(--bg); color: var(--green); }
.pin.is-on::before { animation: none; }
.room .pins { position: absolute; inset: 0; pointer-events: none; }
.room .pins .pin { position: absolute; }

/* optional rendered backdrop (drop a Blender render at assets/<room>.webp and set room.render) */
.render { left: 0; top: 0; width: 1440px; height: 900px; object-fit: cover; opacity: 0; transition: opacity .8s var(--ease); }
.room.has-render .render { opacity: 1; }
.room.has-render .layer:not(.hit):not(.pins) { opacity: 0; }

/* ---------- HUD ---------- */
.hud { position: absolute; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top {
  left: 0; right: 0; top: env(safe-area-inset-top, 0px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
  padding-block: 20px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: var(--fg); justify-self: start; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 30px; letter-spacing: -.02em; }
.brand-sub { font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.hud-room { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--fg-3); padding-top: 8px; }
.hud-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(14,17,22,.8); color: var(--fg); text-decoration: none;
  font-family: var(--mono); font-size: 12px; backdrop-filter: blur(8px);
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--line-2); background: rgba(27,33,42,.9); color: var(--fg); }
.chip-solid { background: var(--fg); color: var(--bg); font-weight: 700; border-color: var(--fg); }
.chip-solid:hover { background: #fff; color: var(--bg); }

.caption {
  position: absolute; z-index: 5; left: max(24px, env(safe-area-inset-left, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: min(456px, calc(100vw - 48px));
  padding: 16px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(14,17,22,.9);
  display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.caption-head { display: flex; align-items: center; gap: 10px; }
.caption-num { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: var(--bg); font-family: var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.caption-title { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.caption-body { margin: 0; font-size: 14px; line-height: 20px; color: var(--fg-2); }
.caption-link { align-self: flex-start; font-family: var(--mono); font-size: 12px; font-weight: 700; text-decoration: none; }
.caption-link[hidden] { display: none; }

.rooms-nav {
  position: absolute; z-index: 5; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(400px, calc(100vw - 48px)); display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(14,17,22,.88); backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.rooms-nav a {
  flex: 1; display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 999px;
  color: var(--fg-2); font-family: var(--mono); font-size: 12px; text-decoration: none; transition: background .2s, color .2s;
}
.rooms-nav a:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.rooms-nav a[aria-current="page"] { background: var(--fg); color: var(--bg); font-weight: 700; }

.time-ctl {
  position: absolute; z-index: 5; right: max(24px, env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(14,17,22,.88); backdrop-filter: blur(10px);
}
.time-ctl-label { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--fg-3); margin-right: 4px; text-transform: uppercase; }
.time-ctl button { height: 36px; padding: 0 10px; border-radius: 8px; border: none; background: transparent; color: var(--fg-2); font-family: var(--mono); font-size: 11px; }
.time-ctl button:hover { background: rgba(255,255,255,.06); color: var(--fg); }
.time-ctl button[aria-pressed="true"] { background: var(--fg); color: var(--bg); font-weight: 700; }
.time-ctl button.is-live[aria-pressed="true"] { background: var(--green); }

/* ---------- screen overlay (detail views) ---------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  background: rgba(10,12,16,.72);
  backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0; transform: scale(.96); transition: opacity .45s var(--ease), transform .55s var(--ease);
}
.screen.is-open { opacity: 1; transform: none; }
.screen[hidden] { display: none; }
.screen-bar {
  flex: none; display: flex; align-items: center; gap: 16px;
  padding-block: 14px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: rgba(14,17,22,.6);
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.screen-back, .screen-close {
  height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(14,17,22,.8);
  font-family: var(--mono); font-size: 12px; color: var(--fg); white-space: nowrap;
}
.screen-close { width: 36px; padding: 0; font-size: 18px; line-height: 1; margin-left: auto; }
.screen-back:hover, .screen-close:hover { border-color: var(--line-2); background: var(--bg-2); }
.screen-crumb { font-family: var(--mono); font-size: 12px; color: var(--fg-3); letter-spacing: .04em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-crumb b { color: var(--fg); font-weight: 500; }
.screen-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-block: 32px calc(40px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.sheet { width: min(1120px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.sheet > * { min-width: 0; }

/* shared detail components */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.title { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4.6vw, 52px); line-height: 1.02; letter-spacing: -.025em; }
.lead { font-size: clamp(16px, 1.6vw, 19px); line-height: 1.5; color: var(--fg-2); max-width: 64ch; margin: 0; }
.head { display: flex; flex-direction: column; gap: 10px; }
.head .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.head .meta b { color: var(--fg); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-family: var(--mono); font-size: 11px; color: var(--fg-2); }
.tag.on { border-color: rgba(61,220,151,.5); color: var(--green); }
.tag.warn { border-color: rgba(242,166,90,.5); color: var(--amber); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.card p, .card li { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.55; }
.card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.card .k { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.card .v { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--fg); letter-spacing: -.02em; }
.card.accent { border-color: rgba(61,220,151,.4); box-shadow: inset 0 0 0 1px rgba(61,220,151,.15), 0 0 60px rgba(61,220,151,.06); }
.card.amber { border-color: rgba(242,166,90,.4); }
.card.ghost { background: transparent; border-style: dashed; color: var(--fg-3); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font-family: var(--mono); font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-2); color: var(--fg); transform: translateY(-1px); }
.btn.primary { background: var(--green); color: var(--bg); border-color: var(--green); }
.btn.primary:hover { background: var(--green-2); color: var(--bg); }
.btn.amber { background: var(--amber); color: var(--bg); border-color: var(--amber); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12px; font-weight: 500; }
.note { font-family: var(--mono); font-size: 12px; color: var(--fg-3); border-left: 2px solid var(--line); padding-left: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; background: var(--bg-2); }
tr:last-child td { border-bottom: none; }
td.mono { font-family: var(--mono); font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { font-family: var(--mono); font-size: 12px; color: var(--fg-3); padding-top: 2px; }
.kv dd { margin: 0; color: var(--fg); }
.media {
  position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: linear-gradient(135deg, #141920, #0E1116);
  display: grid; place-items: center; color: var(--fg-3); font-family: var(--mono); font-size: 12px; text-align: center; padding: 20px;
}
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media.square { aspect-ratio: 1; }
.media.wide { aspect-ratio: 21 / 9; }
.media .slot { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.media .slot b { color: var(--fg-2); font-weight: 500; }
.media .slot i { font-style: normal; color: var(--fg-4); }

/* terminal */
.term {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--screen); overflow: hidden;
  font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--fg-2);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 80px rgba(61,220,151,.06);
}
.term-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); font-size: 12px; color: var(--fg-3); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.term-bar i:nth-child(1) { background: #FF6B6B; } .term-bar i:nth-child(2) { background: var(--amber); } .term-bar i:nth-child(3) { background: var(--green); }
.term-bar span { margin-left: 8px; }
.term-out { padding: 16px 18px 6px; min-height: 240px; max-height: 50vh; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.term-out .p { color: var(--fg-3); } .term-out .c { color: var(--fg); } .term-out .g { color: var(--green); } .term-out .a { color: var(--amber); } .term-out .r { color: var(--red); } .term-out .d { color: var(--fg-4); }
.term-in { display: flex; align-items: center; gap: 8px; padding: 6px 18px 16px; }
.term-in label { color: var(--green); }
.term-in input { flex: 1; min-width: 0; background: transparent; border: none; color: var(--fg); font: inherit; outline: none; caret-color: var(--green); }
.term-hint { font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.term-hint code { color: var(--fg-2); background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }

/* desktop windows (fuloxOS) */
.os { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .os { grid-template-columns: 1.3fr 1fr; } }
.win-app { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.win-app .bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.win-app .bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.win-app .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--fg-2); }
.win-app .body p { margin: 0; }
.dock { display: flex; flex-wrap: wrap; gap: 8px; }
.dock button { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font-family: var(--mono); font-size: 12px; color: var(--fg-2); }
.dock button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700; }
.dock button:hover { border-color: var(--line-2); color: var(--fg); }
.dock button[aria-pressed="true"]:hover { color: var(--bg); }

/* dashboard panels */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel .k { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); display: flex; justify-content: space-between; gap: 10px; }
.panel .v { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.panel .s { font-size: 13px; color: var(--fg-3); }
.panel svg { width: 100%; height: auto; display: block; }
.ok { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; vertical-align: middle; margin-right: 6px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.bars i { flex: 1; background: var(--green); opacity: .85; border-radius: 1px 1px 0 0; min-height: 2px; }
.heat { display: grid; grid-template-columns: repeat(26, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: var(--green); }

/* steps / loop demo */
.chain { display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); opacity: .45; transition: opacity .3s, border-color .3s, transform .3s; }
.step.is-on { opacity: 1; border-color: rgba(61,220,151,.5); transform: translateX(4px); }
.step.is-alert.is-on { border-color: rgba(242,166,90,.7); box-shadow: 0 0 40px rgba(242,166,90,.12); }
.step.is-done { opacity: .8; }
.step .n { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; color: var(--fg-2); }
.step.is-on .n { background: var(--green); color: var(--bg); border-color: var(--green); }
.step.is-alert.is-on .n { background: var(--amber); border-color: var(--amber); }
.step h4 { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 700; }
.step p { margin: 4px 0 0; font-size: 13px; color: var(--fg-2); }
.step code { font-family: var(--mono); font-size: 12px; color: var(--green); }

/* badges (career) */
.badge { perspective: 1200px; min-height: 260px; }
.badge-inner { position: relative; width: 100%; height: 100%; min-height: 260px; transform-style: preserve-3d; transition: transform .7s var(--ease); }
.badge.is-flipped .badge-inner { transform: rotateY(180deg); }
.badge-face { position: absolute; inset: 0; backface-visibility: hidden; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(160deg, #1A2029, #11151B); padding: 20px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.badge-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, #122A22, #0E1116); border-color: rgba(61,220,151,.4); }
.badge-face .hole { width: 36px; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); align-self: center; }
.badge-face .co { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.badge-face .role { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.badge-face .dates { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.badge-face ul { margin: 0; padding-left: 16px; font-size: 13px; color: var(--fg-2); display: flex; flex-direction: column; gap: 5px; }
.badge-face .flip { margin-top: auto; align-self: flex-start; }
.badge button.flip-btn { position: absolute; inset: 0; background: transparent; border: none; border-radius: 16px; cursor: pointer; }
.badge-face .front-cta { margin-top: auto; font-family: var(--mono); font-size: 12px; color: var(--green); }

/* diagrams */
.diagram { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); padding: 12px; overflow-x: auto; }
.diagram svg { display: block; min-width: 760px; width: 100%; height: auto; font-family: var(--mono); }
.diagram .node rect { fill: #11151B; stroke: var(--line-2); stroke-width: 1; rx: 10; }
.diagram .node.hot rect { stroke: var(--green); }
.diagram .node.warm rect { stroke: var(--amber); }
.diagram .node text { fill: var(--fg); font-size: 12px; }
.diagram .node .sub { fill: var(--fg-3); font-size: 10px; }
.diagram .edge { stroke: var(--line-2); stroke-width: 1.5; fill: none; marker-end: url(#arr); }
.diagram .edge.hot { stroke: var(--green); }
.diagram .edge-label { fill: var(--fg-3); font-size: 10px; }
.diagram .lane { fill: rgba(255,255,255,.02); stroke: var(--line); stroke-dasharray: 4 4; rx: 12; }
.diagram .lane-label { fill: var(--fg-3); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }

/* contact */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.field input, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--fg); padding: 12px 14px; font: inherit; font-size: 14px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(61,220,151,.15); }
.cipher { font-family: var(--mono); font-size: 12px; color: var(--green); word-break: break-all; min-height: 60px; background: var(--screen); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; line-height: 1.6; }
.copy { display: inline-flex; align-items: center; gap: 10px; }
.copy code { font-family: var(--mono); font-size: 13px; color: var(--fg); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; user-select: all; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72ch; padding: 10px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); font-size: 14px; color: var(--fg-2); }
.msg.me { align-self: flex-end; background: var(--green); color: var(--bg); border-color: var(--green); }
.msg.him { align-self: flex-start; background: #F3F5F7; color: #12161C; border-color: #F3F5F7; font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }

/* arcade cabinets */
.cab { border: 1px solid var(--line); border-radius: 16px 16px 8px 8px; background: linear-gradient(180deg, #1A2029, #0E1116); padding: 14px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg); transition: transform .2s var(--ease), border-color .2s; }
.cab:hover { transform: translateY(-3px); border-color: var(--line-2); color: var(--fg); }
.cab .marquee { border-radius: 8px; padding: 8px 10px; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: -.01em; color: var(--bg); background: var(--amber); text-align: center; }
.cab .scr { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--screen); border: 3px solid #1C2129; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--fg-3); text-align: center; padding: 10px; }
.cab .scr .big { font-size: 30px; }
.cab .bl { font-size: 13px; color: var(--fg-2); }

/* timeline */
.tl { display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 6px; }
.tl > div { position: relative; padding: 4px 0 22px 22px; }
.tl > div::before { content: ""; position: absolute; left: -7px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--green); }
.tl .when { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.tl .what { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.tl .where { font-size: 13px; color: var(--fg-3); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-room { display: none; }
}
@media (max-width: 760px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 22px; }
  .hud-right .chip:not(.chip-solid) { display: none; }
  .caption { left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); width: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding: 12px 14px; }
  .caption-body { display: none; }
  .rooms-nav { left: max(12px, env(safe-area-inset-left, 0px)); right: auto; transform: none; width: calc(100vw - 24px - 150px); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .time-ctl { right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding-left: 6px; }
  .time-ctl-label, .time-ctl button:not(.is-live):not([aria-pressed="true"]) { display: none; }
  .time-ctl button { padding: 0 10px; }
  .stage-wrap { overflow-x: auto; overflow-y: hidden; }
  .screen-back { font-size: 0; width: 36px; padding: 0; }
  .screen-back::before { content: "←"; font-size: 16px; }
  .title { font-size: 30px; }
}
