/* DS-1 reconstruction console — Imperial archival-tool chrome */
:root {
  --ink: #9fe8f2;
  --ink-dim: #5f96a3;
  --ink-faint: #3a5a64;
  --bg: #04070a;
  --plate: rgba(6, 14, 19, 0.78);
  --line: rgba(140, 220, 235, 0.30);
  --line-hard: rgba(160, 230, 244, 0.62);
  --warn: #ffc46b;
  --alert: #ff6a55;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: var(--mono); color: var(--ink); -webkit-font-smoothing: antialiased; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
body.locked #gl { cursor: none; }

/* film grain + scanlines + vignette */
#grain, #scanlines, #vignette, #flash { position: fixed; inset: 0; pointer-events: none; }
#grain { opacity: 0.55; mix-blend-mode: overlay; animation: grain 0.9s steps(4) infinite; }
@keyframes grain {
  0% { background-position: 0 0; } 25% { background-position: -38px 22px; }
  50% { background-position: 24px -30px; } 75% { background-position: -16px -40px; }
  100% { background-position: 0 0; }
}
#scanlines { background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.022) 0 1px, transparent 1px 3px); }
#vignette { background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 4, 8, 0.55) 100%); }
#flash { background: #d8ffe2; opacity: 0; transition: opacity 60ms linear; }

/* ============================ HUD ============================ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#hud.hidden { display: none; }
.plate { position: absolute; background: var(--plate); border: 1px solid var(--line);
  padding: 8px 11px; font-size: 10px; letter-spacing: 0.08em; backdrop-filter: blur(2px); }
.plate::before, .plate::after { content: ""; position: absolute; width: 7px; height: 7px; }
.plate::before { top: -1px; left: -1px; border-top: 1px solid var(--line-hard); border-left: 1px solid var(--line-hard); }
.plate::after { bottom: -1px; right: -1px; border-bottom: 1px solid var(--line-hard); border-right: 1px solid var(--line-hard); }
.plate.tl { top: 14px; left: 14px; max-width: min(430px, 60vw); }
.plate.tr { top: 14px; right: 14px; min-width: 210px; }
.plate.bl { bottom: 14px; left: 14px; min-width: 240px; }
.plate.br { bottom: 14px; right: 14px; text-align: right; max-width: min(430px, 62vw); }
.microtag { color: var(--ink-dim); font-size: 8.5px; letter-spacing: 0.16em; }
.sector { color: #d6f4fb; font-size: 15px; letter-spacing: 0.12em; margin-top: 4px; text-shadow: 0 0 12px rgba(120,220,240,0.4); }
.subline { color: var(--ink-dim); font-size: 9px; margin-top: 3px; letter-spacing: 0.14em; }
.sysrow { display: flex; justify-content: space-between; gap: 18px; padding: 1.5px 0; font-size: 9.5px; }
.sysrow span { color: var(--ink-dim); }
.sysrow b { color: #d6f4fb; font-weight: 400; }
.sysrow b.warn { color: var(--warn); } .sysrow b.alert { color: var(--alert); } .sysrow b.ok { color: #7dffb0; }
.hudbtn { pointer-events: auto; margin-top: 7px; width: 100%; background: rgba(20,40,50,0.5); color: var(--ink);
  border: 1px solid var(--line); font: inherit; font-size: 9px; letter-spacing: 0.14em; padding: 5px 8px; cursor: pointer; }
.hudbtn:hover { background: rgba(60, 110, 125, 0.4); color: #eafcff; }
.telrow { display: flex; justify-content: space-between; gap: 16px; padding: 1.5px 0; font-size: 9.5px; }
.telrow span { color: var(--ink-dim); } .telrow b { color: #d6f4fb; font-weight: 400; font-variant-numeric: tabular-nums; }
.hints { font-size: 9px; color: var(--ink-dim); line-height: 1.75; letter-spacing: 0.1em; }
.hints b { color: #c8eef7; font-weight: 400; }
.secnav { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; text-align: left; }
.secnav .nvrow { pointer-events: auto; display: flex; gap: 8px; padding: 3px 4px; cursor: pointer; font-size: 9.5px;
  color: var(--ink-dim); letter-spacing: 0.1em; }
.secnav .nvrow:hover, .secnav .nvrow.here { color: #eafcff; background: rgba(60, 110, 125, 0.28); }
.secnav .nvrow kbd { color: var(--ink); border: 1px solid var(--line); padding: 0 4px; font-size: 8.5px; }
.secnav .nvrow.here::after { content: "◄ HERE"; color: var(--warn); margin-left: auto; font-size: 8px; }

/* reticle */
#reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ret-dot { width: 3px; height: 3px; background: var(--ink); border-radius: 50%; box-shadow: 0 0 6px rgba(140,230,245,0.9); }
.ret-ring { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%);
  border: 1px solid var(--line); border-radius: 50%; opacity: 0.0; transition: opacity 0.3s; }
.ret-ring.on { opacity: 1; }
.ret-ring.aligned { border-color: #7dffb0; box-shadow: 0 0 14px rgba(110,255,160,0.35); }
.ret-ring::before { content: ""; position: absolute; inset: 26px; border: 1px dashed var(--line); border-radius: 50%; }
#ret-label { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); font-size: 9px;
  letter-spacing: 0.2em; color: var(--ink-dim); white-space: nowrap; }
#ret-label.aligned { color: #7dffb0; }
#bigstatus { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 13px;
  letter-spacing: 0.34em; color: #d6f4fb; text-shadow: 0 0 16px rgba(120,220,240,0.6); white-space: nowrap; }
#bigstatus:empty { display: none; }
#bigstatus.fire { color: #8dffb0; text-shadow: 0 0 22px rgba(110,255,150,0.8); }
#fire-btn { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); pointer-events: auto;
  background: rgba(10, 40, 24, 0.6); color: #8dffb0; border: 1px solid rgba(120,255,160,0.55);
  font: inherit; font-size: 10.5px; letter-spacing: 0.22em; padding: 9px 18px; cursor: pointer;
  text-shadow: 0 0 10px rgba(110,255,150,0.6); }
#fire-btn:hover { background: rgba(30, 90, 50, 0.6); }
#fire-btn.hidden { display: none; }
#lockhint { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); font-size: 9.5px;
  letter-spacing: 0.18em; color: var(--warn); background: var(--plate); padding: 6px 12px; border: 1px solid var(--line); }
#lockhint.hidden { display: none; }

/* holographic callouts */
#callouts { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.callout { position: absolute; transform: translate(0, -50%); font-size: 8.5px; letter-spacing: 0.18em;
  color: var(--ink); white-space: nowrap; opacity: 0; transition: opacity 0.25s; }
.callout.on { opacity: 1; }
.callout .co-tag { border: 1px solid var(--line); background: rgba(8, 20, 26, 0.6); padding: 3px 7px; }
.callout .co-line { position: absolute; top: 50%; width: 46px; height: 1px; background: var(--line-hard); }
.callout.left .co-line { right: 100%; transform-origin: right; }
.callout.right .co-line { left: 100%; }
.callout .co-dot { position: absolute; top: 50%; width: 5px; height: 5px; border: 1px solid var(--line-hard); }
.callout.left .co-dot { right: calc(100% + 46px); transform: translate(50%, -50%) rotate(45deg); }
.callout.right .co-dot { left: calc(100% + 46px); transform: translate(-50%, -50%) rotate(45deg); }

/* ============================ title screen ============================ */
#title-screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  justify-content: space-between; color: var(--ink);
  background: linear-gradient(180deg, rgba(2,6,10,0.86) 0%, rgba(2,6,10,0.55) 38%, rgba(2,6,10,0.55) 62%, rgba(2,6,10,0.88) 100%); }
#title-screen.hidden { display: none; }
.ts-top { display: flex; justify-content: space-between; padding: 16px 22px; font-size: 9.5px;
  letter-spacing: 0.22em; color: var(--ink-dim); border-bottom: 1px solid var(--line); }
.ts-cls { color: var(--warn); }
.ts-main { text-align: center; padding: 12px; }
.ts-plate { display: inline-block; color: var(--ink); opacity: 0.9; margin-bottom: 6px;
  filter: drop-shadow(0 0 18px rgba(110,210,235,0.18)); }
.ts-plate svg { display: block; }
h1 { font-size: clamp(19px, 3.4vw, 34px); font-weight: 500; letter-spacing: 0.30em; color: #eafcff;
  text-shadow: 0 0 26px rgba(120, 220, 240, 0.45); margin-top: 8px; }
.ts-sub { font-size: clamp(9px, 1.15vw, 12px); letter-spacing: 0.42em; color: var(--ink-dim); margin-top: 10px; }
.ts-actions { display: flex; flex-direction: column; gap: 9px; align-items: center; margin-top: 30px; }
.ts-actions button { pointer-events: auto; width: min(430px, 84vw); display: flex; align-items: center; gap: 14px;
  background: rgba(8, 20, 26, 0.72); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 12px; letter-spacing: 0.24em; padding: 12px 18px; cursor: pointer;
  text-transform: uppercase; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.ts-actions button i { font-style: normal; color: var(--ink-faint); font-size: 9px; }
.ts-actions button kbd { margin-left: auto; color: var(--ink-dim); border: 1px solid var(--line);
  padding: 2px 6px; font-size: 8.5px; font-family: inherit; }
.ts-actions button:hover, .ts-actions button:focus-visible { background: rgba(46, 96, 112, 0.5);
  border-color: var(--line-hard); color: #eafcff; outline: none; }
.ts-actions button:active { transform: translateY(1px); }
.ts-note { margin-top: 26px; font-size: 8.5px; letter-spacing: 0.2em; color: var(--ink-faint); }
.ts-bottom { border-top: 1px solid var(--line); overflow: hidden; padding: 8px 0; }
#ticker { font-size: 9px; letter-spacing: 0.16em; color: var(--ink-dim); white-space: nowrap;
  animation: tick 60s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* transition + loading */
#transition { position: fixed; inset: 0; z-index: 20; background: #01030a; opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center; transition: opacity 0.42s ease; }
#transition.on { opacity: 1; pointer-events: auto; }
#transition-text { font-size: 10px; letter-spacing: 0.4em; color: var(--ink-dim); }
#loading { position: fixed; inset: 0; z-index: 30; background: #01030a; display: flex;
  align-items: center; justify-content: center; transition: opacity 0.5s; }
#loading.off { opacity: 0; pointer-events: none; }
.ld-in { font-size: 11px; letter-spacing: 0.34em; color: var(--ink-dim); }
.ld-dots::after { content: "···"; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { opacity: 0.2; } 100% { opacity: 1; } }

/* touch UI */
#touch-ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#touch-ui.hidden { display: none; }
#joy { position: absolute; left: 22px; bottom: 90px; width: 108px; height: 108px; border: 1px solid var(--line);
  border-radius: 50%; background: rgba(8, 20, 26, 0.4); pointer-events: auto; touch-action: none; }
#joy-nub { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border: 1px solid var(--line-hard); border-radius: 50%; background: rgba(60, 110, 125, 0.35); }
.tcluster { position: absolute; right: 20px; bottom: 90px; display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; pointer-events: auto; }
.tbtn { width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--line-hard); font: inherit;
  font-size: 10px; letter-spacing: 0.1em; color: var(--ink); background: rgba(8, 20, 26, 0.55); touch-action: none; }
.tbtn.fire { color: #8dffb0; border-color: rgba(120,255,160,0.55); }
.tbtn.on { background: rgba(90, 160, 180, 0.5); }

@media (max-width: 720px) {
  .plate { font-size: 8.5px; padding: 6px 8px; }
  .plate.tr { min-width: 0; }
  .plate.bl { min-width: 0; max-width: 46vw; }
  .sector { font-size: 11px; }
  .ts-actions button { font-size: 10px; padding: 12px 12px; }
  .ts-plate svg { width: 210px; height: 210px; }
  h1 { letter-spacing: 0.2em; }
  #fire-btn { bottom: 26%; }
}
@media (max-width: 560px) {
  .plate { font-size: 8px; padding: 5px 7px; }
  .plate.tl { max-width: 52vw; }
  .plate.br { max-width: 52vw; }
  .microtag { display: none; }
  .sector { font-size: 10px; letter-spacing: 0.08em; }
  .hints { font-size: 8px; line-height: 1.55; }
  .telrow, .sysrow { font-size: 8px; gap: 8px; }
  .secnav .nvrow { font-size: 8.5px; padding: 4px 4px; }
  #bigstatus { font-size: 10px; letter-spacing: 0.22em; }
  #lockhint { font-size: 8px; max-width: 84vw; text-align: center; white-space: normal; }
  .ts-top { font-size: 8px; padding: 12px 12px; letter-spacing: 0.12em; }
  .ts-cls { display: none; }
  .ts-note { letter-spacing: 0.12em; }
  #joy { left: 14px; bottom: 120px; }
  .tcluster { right: 12px; bottom: 120px; gap: 8px; }
  .tbtn { width: 56px; height: 56px; }
}
