* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #040507; color: #e8eaee; font-family: "Courier New", monospace; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.logo { font-family: Impact, "Arial Black", sans-serif; font-size: 26px; letter-spacing: 2px; color: #fff; text-shadow: 0 2px 8px #000; }
.logo span { font-family: "Courier New", monospace; font-size: 11px; letter-spacing: 3px; color: #e0b21a; text-transform: uppercase; margin-left: 6px; }
.links { display: flex; gap: 8px; }
.pill { background: rgba(8, 10, 13, 0.72); color: #e8eaee; border: 1px solid #3a3f48; padding: 7px 12px; font-size: 12px; letter-spacing: 1px; text-decoration: none; backdrop-filter: blur(6px); }
.pill:hover { border-color: #ccff00; color: #ccff00; }
.pill.gold, #ca { background: #000; border: 2px solid #ccff00; color: #ccff00; font-weight: bold; }
.pill.gold:hover, #ca:hover { background: #ccff00; color: #000; border-color: #ccff00; }
.pill.solid { background: #ccff00; color: #000; border: 2px solid #000; box-shadow: 0 0 0 2px #ccff00; font-weight: bold; }
.pill.solid:hover { background: #fff; color: #000; }
#ca b { background: #ccff00; color: #000; padding: 1px 6px; margin-right: 8px; }
#ca:hover b { background: #000; color: #ccff00; }
.topbar .logo span { color: #ccff00; }
.links { flex-wrap: wrap; justify-content: flex-end; }
body[data-state="gate"] .topbar { display: none; }

/* ---------- hud ---------- */
.zone { position: fixed; left: 16px; bottom: 16px; z-index: 4; font-size: 12px; letter-spacing: 3px; color: #e0b21a; text-shadow: 0 1px 6px #000; }
.zone::before { content: ""; display: inline-block; width: 8px; height: 8px; background: #ff2a1a; margin-right: 10px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }
body[data-state="gate"] .zone, body[data-state="pfp"] .zone { display: none; }

.prompt { position: fixed; left: 50%; bottom: 16%; transform: translateX(-50%); z-index: 4; background: rgba(8, 10, 13, 0.85); color: #fff; border: 1px solid #e0b21a; padding: 12px 20px; font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
.prompt kbd { display: inline-block; background: #e0b21a; color: #000; font-family: inherit; font-weight: bold; padding: 2px 9px; margin-right: 10px; }
.hint { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 4; max-width: 92vw; text-align: center; font-size: 12px; letter-spacing: 1px; color: #c8ccd2; background: rgba(8, 10, 13, 0.7); padding: 8px 14px; }

.joy { display: none; position: fixed; left: 22px; bottom: 54px; z-index: 4; width: 110px; height: 110px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(8, 10, 13, 0.35); touch-action: none; }
.joy div { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(224, 178, 26, 0.8); }
@media (pointer: coarse) {
  body[data-state="play"] .joy { display: block; }
  .zone { bottom: auto; top: 58px; }
  .hint { display: none !important; }
}

/* ---------- gate ---------- */
.gate { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px), radial-gradient(circle at 50% 40%, #12161b, #040507 70%); }
.gate-inner { text-align: center; max-width: 640px; }
.gate h1 { font-size: clamp(26px, 6vw, 54px); letter-spacing: 4px; margin: 18px 0 8px; color: #fff; }
.gate .sub { color: #e0b21a; letter-spacing: 3px; font-size: 13px; margin: 0 0 30px; }
.gate .log { color: #39ffb0; font-size: 13px; letter-spacing: 2px; min-height: 18px; }
.gate .small { color: #6b717b; font-size: 11px; letter-spacing: 1px; margin-top: 18px; }
.stamp { display: inline-block; border: 3px solid #ff2a1a; color: #ff2a1a; font-weight: bold; letter-spacing: 6px; padding: 6px 16px; transform: rotate(-4deg); font-size: 16px; }
#gateBtn, #briefBtn { background: #e0b21a; color: #000; border: 0; font-weight: bold; font-size: 16px; letter-spacing: 3px; padding: 15px 30px; margin-top: 14px; }
#gateBtn:disabled { background: #3a3f48; color: #8a909a; cursor: default; }
#gateBtn:not(:disabled):hover, #briefBtn:hover { background: #fff; }

/* ---------- lift ride (cinematic) ---------- */
.ride { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.ride .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
.ride .bar.top { top: 0; }
.ride .bar.bottom { bottom: 0; }
body[data-state="ride"] .zone { display: none; }
.fade { position: fixed; inset: 0; z-index: 7; background: #000; opacity: 0; pointer-events: none; }
.gate .chan { color: #3aae3a; font-family: Tahoma, Verdana, Arial, sans-serif; text-transform: none; letter-spacing: 0; }
canvas#c.dragging { cursor: grabbing; }
#rideSkip { position: absolute; right: 20px; bottom: 20px; pointer-events: auto; background: rgba(8, 10, 13, 0.8); color: #c8ccd2; border: 1px solid #3a3f48; padding: 9px 18px; letter-spacing: 3px; font-size: 12px; }

/* ---------- briefing dossier ---------- */
.brief { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 3, 4, 0.72); backdrop-filter: blur(4px); }
.dossier { position: relative; width: min(620px, 100%); max-height: 92vh; overflow: auto; background: #efe6d2; color: #1a1712; padding: 28px 30px 26px; border: 1px solid #b9ab8c; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 0 60px rgba(120, 90, 40, 0.18); animation: rise 0.45s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) rotate(-1deg); } to { opacity: 1; transform: none; } }
.dossier-top { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; letter-spacing: 2px; border-bottom: 2px solid #1a1712; padding-bottom: 8px; }
.dossier .stamp { position: absolute; right: 26px; top: 58px; transform: rotate(8deg); opacity: 0.85; }
.dossier h2 { font-size: 30px; letter-spacing: 3px; margin: 26px 0 14px; }
.dossier .lead { font-size: 16px; line-height: 1.55; font-weight: bold; }
.dossier ul { padding-left: 18px; margin: 14px 0; font-size: 14px; line-height: 1.6; }
.dossier .warn { font-size: 13px; color: #8a1a10; letter-spacing: 1px; }
#briefBtn { width: 100%; background: #1a1712; color: #efe6d2; font-size: 14px; }
#briefBtn:hover { background: #8a1a10; color: #fff; }

/* ---------- gallery lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; background: rgba(2, 3, 4, 0.86); }
.lb-post { background: #f0e0d6; border: 1px solid #d9bfb7; padding: 12px; max-width: min(720px, 76vw); font-family: Tahoma, Verdana, Arial, sans-serif; color: #800000; font-size: 14px; }
.lb-cap b { color: #117743; }
.lb-cap span { color: #789922; }
.lb-post img { display: block; margin-top: 10px; max-width: 100%; max-height: 66vh; background: #ffffee; border: 1px solid #d9bfb7; }
.lb-nav { background: #f0e0d6; color: #800000; border: 1px solid #d9bfb7; font-size: 24px; font-weight: bold; width: 46px; height: 64px; }
.lb-close { position: absolute; top: 16px; right: 16px; background: #f0e0d6; color: #800000; border: 1px solid #d9bfb7; padding: 8px 14px; font-weight: bold; }

/* ---------- Fsjalifier panel ---------- */
#pfp { position: fixed; top: 64px; right: 16px; bottom: 16px; z-index: 10; width: min(390px, 44vw); display: flex; flex-direction: column; background: rgba(4, 17, 12, 0.9); border: 1px solid #39ffb0; box-shadow: 0 0 40px rgba(57, 255, 176, 0.15); backdrop-filter: blur(8px); color: #c9ffe9; }
.pfp-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 10px; border-bottom: 1px solid rgba(57, 255, 176, 0.35); }
.pfp-head b { font-size: 20px; letter-spacing: 4px; color: #39ffb0; }
.pfp-head span { font-size: 11px; letter-spacing: 2px; }
.pfp-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 16px 6px; }
.pfp-tabs button, .pfp-actions button { background: transparent; color: #c9ffe9; border: 1px solid rgba(57, 255, 176, 0.4); padding: 9px 4px; font-size: 12px; letter-spacing: 1px; }
.pfp-tabs button.on, .pfp-tabs button:hover, .pfp-actions button:hover { background: #39ffb0; color: #04110c; }
.pfp-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); grid-auto-rows: 76px; gap: 6px; padding: 8px 16px; }
.pfp-grid button { background: #e9efe9; border: 2px solid transparent; padding: 0; overflow: hidden; color: #04110c; font-weight: bold; font-size: 11px; }
.pfp-grid button.none { background: #0c2a20; color: #c9ffe9; border-color: rgba(57, 255, 176, 0.4); }
.pfp-grid button.on { border-color: #39ffb0; box-shadow: 0 0 0 2px #39ffb0; }
.pfp-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pfp-actions { display: grid; grid-template-columns: 1fr 1fr 0.7fr; gap: 6px; padding: 10px 16px 16px; border-top: 1px solid rgba(57, 255, 176, 0.35); }
#pfpSave { background: #39ffb0; color: #04110c; font-weight: bold; }
@media (max-width: 720px) {
  #pfp { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 48vh; }
  .topbar .logo span { display: none; }
  .topbar { flex-wrap: wrap; padding: 8px; gap: 6px; }
  .topbar .pill { padding: 6px 9px; font-size: 10px; }
  .logo { font-size: 20px; }
}

/* ---------- Records Room reader ---------- */
.lore { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 3, 4, 0.78); backdrop-filter: blur(4px); }
.lore-book { position: relative; width: min(760px, 100%); max-height: 90vh; display: flex; flex-direction: column; padding: 30px 34px 26px; font-family: Georgia, "Times New Roman", serif; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7); animation: rise 0.4s ease-out; }
.lore[data-theme="paper"] .lore-book { background: #efe6d2; color: #1a1712; border: 1px solid #b9ab8c; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 0 70px rgba(120, 90, 40, 0.2); }
.lore[data-theme="gold"] .lore-book { background: #120d05; color: #e9dfc4; border: 1px solid #c9a44a; }
.lore-kicker { font-family: "Courier New", monospace; font-size: 12px; letter-spacing: 3px; opacity: 0.75; }
.lore-book h2 { font-size: clamp(24px, 4vw, 38px); margin: 8px 0 14px; padding-bottom: 12px; border-bottom: 2px solid currentColor; }
.lore[data-theme="gold"] h2 { color: #f0d27a; }
.lore-body { overflow-y: auto; padding-right: 12px; font-size: 17px; line-height: 1.65; }
.lore-body h3 { font-size: 22px; margin: 24px 0 6px; }
.lore-body ul { padding-left: 22px; }
.lore-body blockquote { margin: 18px 0; padding: 10px 18px; border-left: 3px solid #c9a44a; font-style: italic; }
.lore-body .lead { font-size: 21px; font-style: italic; }
.lore-body .gold { color: #f0d27a; font-weight: bold; }
.lore-body .center, .lore-body .end { text-align: center; }
.lore-body .end { font-weight: bold; margin-top: 22px; }
.lore-body .links { display: grid; gap: 10px; margin: 16px 0; }
.lore-body .links a { display: block; padding: 13px 16px; border: 2px solid currentColor; color: inherit; text-decoration: none; font-weight: bold; }
.lore-body .links a:hover { background: #8a1a10; color: #fff; border-color: #8a1a10; }
.lore-body .links small { display: block; font-weight: normal; opacity: 0.75; margin-top: 3px; }
.lore-body .ca { font-family: "Courier New", monospace; font-size: 13px; word-break: break-all; opacity: 0.8; }
#loreClose { position: absolute; top: 14px; right: 14px; background: transparent; color: inherit; border: 1px solid currentColor; padding: 7px 12px; font-size: 12px; letter-spacing: 2px; }

/* ---------- Terminal Room: inside the monitor ---------- */
.pc { position: fixed; inset: 0; z-index: 16; display: flex; align-items: center; justify-content: center; padding: 2.5vh 2.5vw; background: radial-gradient(circle at 50% 45%, #1a2338, #05060a 75%); opacity: 0; transition: opacity 0.35s; }
.pc.on { opacity: 1; }
.pc-monitor { width: min(100%, 150vh); height: 100%; display: flex; flex-direction: column; padding: 2.4vh 2.4vh 0; border-radius: 26px; background: linear-gradient(#ddd6c2, #b9b19a); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -8px 20px rgba(0, 0, 0, 0.25); }
.pc-screen { position: relative; flex: 1; border-radius: 18px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 4px #3b3a34, 0 0 0 3px #8f8872; transform: scaleY(0.004); transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1) 0.2s; }
.pc.on .pc-screen { transform: none; }
.pc-screen iframe { width: 100%; height: 100%; border: 0; display: block; background: #245edb; }
.pc-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.55); }
.pc-chin { height: 6.5vh; min-height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.pc-brand { font-family: Tahoma, Verdana, Arial, sans-serif; font-weight: bold; font-size: 13px; letter-spacing: 2px; color: #5a5545; }
#pcExit { background: #5a5545; color: #efe9d6; border: 0; border-radius: 4px; padding: 7px 16px; font-size: 12px; letter-spacing: 2px; }
#pcExit:hover { background: #8a1a10; }
.pc-led { width: 10px; height: 10px; border-radius: 50%; background: #39ff6a; box-shadow: 0 0 10px #39ff6a; }
body[data-state="pc"] .topbar, body[data-state="pc"] .zone { display: none; }
