:root { --bg: #05070b; --panel: rgba(10, 14, 22, 0.86); --line: #23304a; --text: #d8e2f0; --dim: #8a97ab; --accent: #4fb3ff; --gold: #e3b341; --bad: #ff6b6b; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, sans-serif; overflow: hidden; }
canvas { width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.hidden { display: none !important; }
.panel { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.dim { color: var(--dim); }
kbd { background: #1b2436; border: 1px solid #2c3a55; border-radius: 4px; padding: 0 5px; font: 12px ui-monospace, monospace; }
button { background: #142034; color: var(--text); border: 1px solid #2c3a55; border-radius: 6px; padding: 8px 12px; font: inherit; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.6; cursor: default; }

#join { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 18px; }
#join h1 { margin: 0; font-size: 18px; letter-spacing: 0.12em; color: var(--gold); }
#join .sub { margin: 2px 0 14px; color: var(--dim); }
#join label { display: block; margin-bottom: 12px; }
#join input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; background: #0b1220; color: var(--text); border: 1px solid #2c3a55; border-radius: 6px; font: inherit; }
#join .label { margin: 4px 0 6px; }
#billets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-bottom: 14px; }
.billet { text-align: left; padding: 7px 9px; }
.billet small { display: block; color: var(--dim); }
.billet.taken { opacity: 0.45; cursor: not-allowed; }
.billet.vacant small { color: var(--gold); }
.billet.sel { border-color: var(--accent); background: #18304f; }
#board { width: 100%; padding: 11px; font-weight: 600; }
.msg { color: var(--bad); min-height: 1em; margin: 8px 0 0; }

#hud { top: 12px; left: 12px; }
#help { top: 12px; right: 12px; max-width: 360px; font-size: 12px; }
#prompt { left: 50%; bottom: 120px; transform: translateX(-50%); }
#liftmenu { left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 260px; }
#liftmenu button { display: block; width: 100%; margin-top: 6px; text-align: left; }

#manifest { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; }
#manifest h2 { margin: 0 0 8px; font-size: 15px; letter-spacing: 0.1em; color: var(--gold); }
#manifest table { width: 100%; border-collapse: collapse; font-size: 13px; }
#manifest th, #manifest td { text-align: left; padding: 4px 8px; border-bottom: 1px solid #1a2436; }
#manifest th { color: var(--dim); font-weight: 500; }
.vacant { color: var(--gold); } .open { color: var(--dim); } .you { color: var(--accent); }

#chat { position: fixed; left: 12px; bottom: 12px; width: min(460px, calc(100% - 24px)); }
#chatlog { max-height: 34vh; overflow: auto; font-size: 13px; text-shadow: 0 1px 2px #000; padding: 4px 2px; }
#chatlog .ship { color: var(--gold); } #chatlog .sys { color: var(--dim); font-style: italic; }
#chatin { width: 100%; padding: 8px 10px; background: rgba(8, 12, 20, 0.9); color: var(--text); border: 1px solid #2c3a55; border-radius: 6px; font: inherit; }

#touch { position: fixed; inset: 0; pointer-events: none; }
#stick { position: absolute; left: 24px; bottom: 120px; width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); pointer-events: auto; }
#knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.3); }
#tbtns { position: absolute; right: 12px; bottom: 120px; display: grid; grid-template-columns: repeat(2, 70px); gap: 8px; pointer-events: auto; }
#tbtns button { padding: 12px 6px; }
#screens { left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 320px; max-height: 80vh; overflow-y: auto; }
#screens button { display: block; width: 100%; margin-top: 6px; text-align: left; }
#screens button.on { border-color: #3fb6ff; color: #bfe6ff; }
#screens button.small { font-size: 12px; padding: 4px 8px; }

/* H: hide every overlay (the 3D nameplates are hidden in code) */
body.noui .panel, body.noui #chat { display: none !important; }

#h-version { font-size: 11px; margin-top: 2px; }
#h-version.stale { color: #ffb347; }
/* chat: Shift+Enter hides it; a badge counts what you missed; @ suggestions */
#chat.chathidden { display: none; }
#chatbadge { left: 16px; bottom: 16px; font-size: 12px; padding: 6px 10px; }
#chatlog .mention { background: rgba(227, 179, 65, 0.18); }
#chatlog .at { color: #e3b341; }
#mentions { position: absolute; bottom: 44px; left: 0; background: rgba(8,12,20,0.92); border: 1px solid #2a3442; border-radius: 6px; padding: 4px 8px; font-size: 13px; min-width: 200px; }
#mentions .first { color: #e3b341; }
#chatlog .npc, td.npc { color: #7fd1ff; }
/* hold-F radial menu */
#radial { position: fixed; left: 50%; top: 50%; width: 340px; height: 340px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(8,12,20,0.55) 0 28%, rgba(8,12,20,0.82) 29% 70%, rgba(8,12,20,0) 71%); z-index: 20; }
#radial .hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #8aa0b8; font-weight: bold; }
#radial .slice { position: absolute; transform: translate(-50%, -50%); min-width: 120px; padding: 8px 10px; }
#radial .slice.hot { border-color: #3fb6ff; color: #ffffff; background: rgba(63, 182, 255, 0.25); }
/* station screens */
#station { right: 16px; top: 16px; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
#station .st-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#station .st-status { margin: 8px 0; font-size: 13px; }
#station .st-sec { margin-top: 10px; border-top: 1px solid #2a3442; padding-top: 8px; }
#station .st-title { font-size: 11px; letter-spacing: 0.08em; color: #8aa0b8; text-transform: uppercase; margin-bottom: 6px; }
#station .st-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
#station .st-row button { flex: 1 1 auto; }
#station .st-input { flex: 1 1 120px; background: #0d1520; color: #fff; border: 1px solid #2a3442; border-radius: 4px; padding: 6px; }
#station .st-list { font-size: 13px; line-height: 1.5; }
#station .compass { width: 160px; height: 160px; display: block; margin: 0 auto; }
#station .compass circle { fill: rgba(10,20,32,0.8); stroke: #3a4a5c; }
#station .compass line { stroke: #5c7088; stroke-width: 1; }
#station .compass line.needle { stroke: #3fb6ff; stroke-width: 2.5; }
#station .compass line.target { stroke: #e3b341; stroke-width: 1.5; stroke-dasharray: 3 2; }
#station .compass text { fill: #8aa0b8; font-size: 7px; text-anchor: middle; }
#station button.on { border-color: #3fb6ff; color: #bfe6ff; }
.alert-normal { color: #6fdc8c; } .alert-yellow { color: #ffd34d; } .alert-red { color: #ff5a4d; font-weight: bold; }
button.alert-btn-red { border-color: #7a2a24; } button.alert-btn-yellow { border-color: #7a6424; }

#station .st-holo { align-items: center; }
#station .st-holo button { flex: 0 0 auto; min-width: 40px; }

/* station controls sit bottom right, out of the way of the station's own screens */
#station { top: auto; bottom: 16px; right: 16px; width: min(400px, calc(100vw - 32px)); max-height: 46vh; }

/* the strip across the very top: update available, or reconnecting */
#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center; padding: 7px 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
#banner.update { background: #e3b341; color: #1a1300; }
#banner.warn { background: #b3262e; color: #fff; cursor: default; }

/* compact station controls */
#station { width: min(460px, calc(100vw - 32px)); padding: 10px 12px; }
#station .st-head { gap: 10px; }
#station .st-head .st-status { flex: 1; font-size: 12px; margin: 0; }
#station .st-row { align-items: center; margin: 5px 0; gap: 5px; }
#station .st-label { min-width: 86px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #8aa0b8; }
#station .st-row button { flex: 0 1 auto; padding: 5px 9px; font-size: 13px; }
#station .st-input { flex: 0 1 70px; padding: 5px; }
#station .st-input.wide { flex: 1 1 180px; }
#station .st-hint { font-size: 11px; margin-top: 6px; }
#station .st-note { font-size: 12px; margin: 4px 0; }

/* at a station: just a hint along the bottom; the controls are on the screens */
#station { left: 50%; right: auto; transform: translateX(-50%); bottom: 12px; top: auto; width: auto; max-width: calc(100vw - 32px); max-height: none; overflow: visible;
  font-size: 12px; padding: 6px 12px; white-space: nowrap; color: #b9c9d9; }
/* chat: no scroll bar (it still scrolls) */
#chatlog { scrollbar-width: none; -ms-overflow-style: none; }
#chatlog::-webkit-scrollbar { display: none; }
/* the HUD moves down while the top banner shows */
body:has(#banner:not(.hidden)) #hud { top: 46px; }

/* at a station: a small crosshair in the middle of the view picks the button you click */
#crosshair { position: fixed; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 2px rgba(8, 12, 20, 0.6), 0 0 6px rgba(63, 182, 255, 0.8); pointer-events: none; z-index: 30; }
