/* True Cosmos HUD: glass panels with glowing corner brackets, cyan accent, condensed technical type.
   Fonts are local only (no downloads): Bahnschrift ships with Windows; the others are fallbacks. */
:root {
  --font: "Bahnschrift", "DIN Alternate", "Barlow Semi Condensed", "Roboto Condensed", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;
  --ink: #e6f3ff; --dim: #7f93ad; --faint: #4a5a70;
  --acc: #4fe3ff; --acc-rgb: 79, 227, 255;          /* primary accent (cyan) */
  --cool: #4fe3ff;                                     /* kept for older rules */
  --hot: #ffb547; --warn: #ff5a6e; --good: #7cffb2; --violet: #b99bff;
  --line: rgba(var(--acc-rgb), .16); --line-hi: rgba(var(--acc-rgb), .55);
  --panel: linear-gradient(160deg, rgba(14, 24, 38, .62), rgba(6, 10, 18, .52));
  --glow: 0 0 12px rgba(var(--acc-rgb), .35);
  --col-l: 250px; --col-r: 300px;   /* left column (location + system list), right column (target + map) */
}
html, body { margin: 0; height: 100%; background: #010208; color: var(--ink); overflow: hidden; font: 14px/1.45 var(--font); font-stretch: semi-condensed; -webkit-font-smoothing: antialiased; }
#app canvas.gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#overlay { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#hud[hidden] { display: none; }
::selection { background: rgba(var(--acc-rgb), .3); }

/* ---------- panels ---------- */
.panel {
  position: absolute; box-sizing: border-box; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 3px;
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 30px rgba(0,0,0,.35);
  text-shadow: 0 0 6px rgba(0,0,0,.6);
}
/* corner brackets */
.panel::before, .panel::after { content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none; border: 0 solid var(--acc); filter: drop-shadow(0 0 3px rgba(var(--acc-rgb), .8)); }
.panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.panel::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
/* section caption: small accent bar + spaced caps */
#bodies h4 { margin: 0 0 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .28em; color: var(--acc); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
#bodies h4::before { content: ""; width: 3px; height: 11px; background: var(--acc); box-shadow: var(--glow); }
#bodyList li.home { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); color: #ffd76a; }
#bodies h4 span { margin-left: auto; color: var(--faint); letter-spacing: .1em; }

/* ---------- location (top left) ---------- */
#loc { left: 18px; top: 16px; width: var(--col-l); }
#loc b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
#loc span { display: block; color: var(--dim); font-size: 12px; letter-spacing: .06em; }
#locTime { color: var(--acc) !important; font: 11.5px var(--mono); margin-top: 2px; }

/* ---------- time bar (top centre) ---------- */
#timebar { left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 7px 14px; pointer-events: auto; font-size: 12px; white-space: nowrap; }
#timebar button { padding: 4px 10px; font-size: 10.5px; }
#timebar input[type=range] { width: 180px; }
#tRate { color: var(--acc); min-width: 78px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }
#tDate { color: var(--dim); font: 11.5px var(--mono); }

/* range slider */
input[type=range] { -webkit-appearance: none; appearance: none; height: 18px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--acc), rgba(var(--acc-rgb), .15)); }
input[type=range]::-moz-range-track { height: 2px; background: linear-gradient(90deg, var(--acc), rgba(var(--acc-rgb), .15)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 16px; margin-top: -7px; background: #021018; border: 1.5px solid var(--acc); transform: skewX(-12deg); box-shadow: var(--glow); }
input[type=range]::-moz-range-thumb { width: 8px; height: 14px; border-radius: 0; background: #021018; border: 1.5px solid var(--acc); box-shadow: var(--glow); }

/* ---------- target panel (top right) ---------- */
#target { right: 18px; top: 16px; width: var(--col-r); font-size: 12.5px; }
#target b.n { display: block; font-size: 19px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
#target .t { color: var(--acc); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; }
#target table { width: 100%; border-collapse: collapse; margin-top: 8px; table-layout: fixed; } /* fixed: long values wrap instead of widening the panel */
#target td { padding: 3px 0; vertical-align: top; overflow-wrap: anywhere; border-bottom: 1px solid rgba(var(--acc-rgb), .07); font-variant-numeric: tabular-nums; }
#target td:first-child { color: var(--dim); width: 36%; white-space: normal; overflow-wrap: anywhere; padding-right: 8px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; padding-top: 5px; }
#target .flag, #tip .flag { display: inline-block; max-width: 100%; box-sizing: border-box; font-size: 9.5px; padding: 0 5px; margin-left: 4px; border: 1px solid var(--line); color: var(--dim); white-space: normal; letter-spacing: .08em; text-transform: uppercase; }
#target .flag.m, #tip .flag.m { color: var(--good); border-color: rgba(124,255,178,.35); }
#target .flag.e, #tip .flag.e { color: var(--hot); border-color: rgba(255,181,71,.35); }
#target .flag.g, #tip .flag.g { color: var(--violet); border-color: rgba(185,155,255,.35); }
#target p { margin: 8px 0 0; color: #b9c8da; line-height: 1.5; }

/* ---------- flight (bottom centre) ---------- */
#flight { left: 50%; bottom: 18px; transform: translateX(-50%); text-align: center; min-width: 360px; }
.spd b { font: 600 30px var(--mono); letter-spacing: .02em; color: #fff; text-shadow: 0 0 14px rgba(var(--acc-rgb), .45); }
.spd small { display: block; color: var(--dim); font-size: 11.5px; letter-spacing: .08em; }
.thr { height: 4px; margin: 9px 0 7px; overflow: hidden; background: repeating-linear-gradient(90deg, rgba(var(--acc-rgb), .14) 0 6px, transparent 6px 8px); }
.thr i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--acc) 0 6px, transparent 6px 8px); filter: drop-shadow(0 0 4px rgba(var(--acc-rgb), .9)); }
#tags span { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; padding: 1px 8px; margin: 2px 3px; border: 1px solid var(--line); color: var(--dim); }
#tags span.on { color: var(--acc); border-color: var(--line-hi); box-shadow: inset 0 0 8px rgba(var(--acc-rgb), .15); }
#tags span.warn { color: var(--hot); border-color: rgba(255,181,71,.5); }

/* ---------- system list (left) ---------- */
#bodies { left: 18px; top: 120px; bottom: 200px; width: var(--col-l); overflow: hidden; pointer-events: auto; font-size: 13px; display: flex; flex-direction: column; }
#bodies.hide { display: none; }
#bodies ul { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: hidden; }
#bodies li.off { display: none; }
#bodies li { position: relative; padding: 3px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .04em; border-left: 2px solid transparent; transition: background .12s, border-color .12s; }
#bodies li:hover { background: linear-gradient(90deg, rgba(var(--acc-rgb), .14), transparent); border-left-color: rgba(var(--acc-rgb), .6); }
#bodies li.sel { background: linear-gradient(90deg, rgba(var(--acc-rgb), .24), transparent); border-left-color: var(--acc); color: #fff !important; }
#bodies li.moon { padding-left: 20px; color: #9fb0c6; font-size: 12px; }
#bodies li.moon::before { content: "└"; position: absolute; left: 8px; color: var(--faint); }
#bodies li .k { color: var(--faint); font-size: 10px; margin-left: 6px; letter-spacing: .14em; text-transform: uppercase; }
#bodySearch { width: 100%; box-sizing: border-box; margin: 0 0 8px; padding: 6px 10px 6px 26px; font: inherit; font-size: 12.5px; letter-spacing: .04em; color: var(--ink); outline: none;
  background: rgba(0, 10, 20, .5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%234fe3ff' stroke-width='1.6'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M8 8l3 3'/%3E%3C/svg%3E") 8px 50% no-repeat;
  border: 1px solid var(--line); border-radius: 0; }
#bodySearch::placeholder { color: var(--faint); }
#bodySearch:focus { border-color: var(--line-hi); box-shadow: 0 0 0 1px rgba(var(--acc-rgb), .15), var(--glow); }
#sysResults { flex: none; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
#sysResults li { color: var(--violet); }
#sysResults li .k { display: block; margin-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: .02em; }
#bodies .empty { color: var(--dim); font-style: italic; cursor: default; }
#bodyPager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
#bodyPager[hidden] { display: none; }
#bodyPager button { padding: 2px 16px; font-size: 10px; line-height: 1.5; }
#bodyPager button:disabled { opacity: .25; cursor: default; }
#bodyPage { color: var(--dim); font: 11px var(--mono); }

/* ---------- map (bottom right) ---------- */
#mapWrap { right: 18px; bottom: 18px; width: var(--col-r); padding: 8px; pointer-events: auto; }
#mapWrap canvas { width: 100%; height: auto; aspect-ratio: 1; display: block; cursor: pointer; }
#mapWrap.big { width: min(70vh, 640px); }
#mapWrap .cap { display: block; text-align: center; font-size: 9.5px; color: var(--dim); letter-spacing: .16em; text-transform: uppercase; margin-top: 4px; }

#hintbar { position: absolute; left: 18px; bottom: 18px; max-width: calc(50vw - 215px); box-sizing: border-box; padding: 6px 12px; font-size: 10.5px; line-height: 1.6; color: var(--dim); letter-spacing: .14em; text-transform: uppercase;
  background: rgba(6, 12, 20, .82); border: 1px solid var(--line); border-radius: 3px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-shadow: none; } /* own background: sky labels must not show through */
#toast { position: absolute; left: 50%; top: 17%; transform: translateX(-50%); padding: 9px 22px; max-width: 70vw; text-align: center; letter-spacing: .06em;
  background: linear-gradient(90deg, transparent, rgba(8, 20, 32, .8) 15%, rgba(8, 20, 32, .8) 85%, transparent);
  border-top: 1px solid var(--line-hi); border-bottom: 1px solid var(--line-hi); opacity: 0; transition: opacity .4s; text-shadow: 0 0 10px rgba(var(--acc-rgb), .4); }
#toast.on { opacity: 1; }
/* tooltip next to a body just selected: name, type, distance, keys */
#tip { position: absolute; pointer-events: none; max-width: 240px; padding: 7px 11px; font-size: 12px; line-height: 1.5; color: var(--ink);
  background: rgba(6, 12, 20, .86); border: 1px solid var(--line-hi); border-radius: 3px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#tip b { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
#tip .t { color: var(--acc); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
#tip .disc { margin: 7px 0 2px; font-size: 12px; }
#tip .disc span { display: block; color: var(--acc); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
#tip .k { margin-top: 4px; color: var(--dim); font-size: 11px; }
#tip.full { max-width: 330px; padding: 10px 14px; }
#tip.full b { font-size: 15px; }
#tip table { margin: 6px 0 2px; border-collapse: collapse; font-size: 11.5px; }
#tip td { padding: 1px 0; vertical-align: top; }
#tip td:first-child { color: var(--dim); padding-right: 10px; white-space: nowrap; }
#tip p { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--line); color: var(--ink); font-size: 11.5px; }
#tip kbd { font: 600 10px var(--mono); color: var(--acc); border: 1px solid var(--line-hi); border-radius: 2px; padding: 0 4px; }

/* ---------- full screens (help, wormhole menu) ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(2, 6, 14, .45), rgba(1, 2, 8, .9)); }
.screen[hidden] { display: none; }
.sheet { position: relative; width: min(560px, 92vw); max-height: 92vh; overflow: auto; padding: 28px 32px; background: var(--panel); border: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: rgba(var(--acc-rgb), .4) transparent;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); }
.sheet::before { content: ""; position: absolute; top: 0; left: 0; width: 120px; height: 2px; background: var(--acc); box-shadow: var(--glow); }
.sheet.wide { width: min(900px, 94vw); }
h1 { margin: 0; text-align: center; font-size: 46px; letter-spacing: .42em; font-weight: 300; padding-left: .42em; text-shadow: 0 0 24px rgba(var(--acc-rgb), .5); }
.logo { width: min(560px, 84vw); margin: 2px auto 0; }
/* language picker on the start screen */
.lang { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 2px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.lang select { font: 13px var(--font); color: var(--ink); background: rgba(6, 12, 20, .9); border: 1px solid var(--line-hi); border-radius: 3px; padding: 4px 10px; letter-spacing: .04em; text-transform: none; cursor: pointer; }
/* ship picker: pictures rendered from the 3D models at start-up */
.ships { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 6px 0 2px; }
.ships .lbl { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.shipCard { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; background: rgba(6, 12, 20, .7); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; color: var(--dim); }
.shipCard img { width: 64px; height: 36px; display: block; object-fit: cover; border-radius: 2px; }
.shipCard b { font-weight: 500; font-size: 11.5px; letter-spacing: .08em; }
.shipCard.on { border-color: var(--acc); color: var(--ink); box-shadow: 0 0 12px rgba(var(--acc-rgb), .35); }
@media (max-width: 700px) { .shipCard img { width: 52px; height: 30px; } }
/* statistics consent: separate bar at the bottom, never blocks the game */
#consent { position: fixed; z-index: 20; left: 14px; bottom: 14px; width: min(400px, 94vw); box-sizing: border-box; padding: 12px 16px; background: rgba(6, 12, 20, .95); border: 1px solid var(--line-hi); border-radius: 3px; font-size: 13px; color: var(--ink); }
#consent p { margin: 0 0 8px; }
#consent .row { margin: 0; justify-content: flex-end; align-items: center; }
#consent a { color: var(--acc); font-size: 12px; }
@media (max-width: 1100px) { #consent { left: 50%; transform: translateX(-50%); bottom: auto; top: 10px; } } /* never over the START button */
.legal a { color: var(--dim); } .legal a:hover { color: var(--acc); }
.ver { margin-top: 2px; opacity: .6; font-family: var(--mono); letter-spacing: .08em; }
#verHud { position: absolute; right: 18px; bottom: 4px; font: 9.5px var(--mono); color: var(--faint); letter-spacing: .08em; }
.logo svg { width: 100%; height: auto; display: block; overflow: visible; }
.logo-planet { filter: drop-shadow(0 0 6px #aef2ff); }
@media (prefers-reduced-motion: reduce) { .logo-planet animateMotion { display: none; } }
h2 { margin: 0 0 4px; letter-spacing: .3em; font-size: 18px; font-weight: 600; color: var(--acc); }
h3 { margin: 16px 0 6px; font-size: 10.5px; letter-spacing: .3em; color: var(--acc); font-weight: 600; }
.tag { text-align: center; color: var(--dim); letter-spacing: .3em; text-transform: uppercase; font-size: 12px; margin: 8px 0 16px; }
.sub { color: var(--dim); margin: 0 0 10px; font-size: 13px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
/* phones / small screens: START always reachable (sticky at the bottom of the sheet), smaller type */
@media (max-width: 700px), (max-height: 560px) {
  .sheet.wide { box-sizing: border-box; padding: 18px 18px 0; max-height: 100vh; width: 100vw; border: 0; overflow-x: hidden; }
  .sheet p { overflow-wrap: anywhere; }
  .logo { width: min(420px, 78vw); }
  .tag { letter-spacing: .18em; font-size: 10.5px; margin: 6px 0 10px; }
  .sheet p { font-size: 12.5px; }
  #startRow { position: sticky; bottom: 0; margin: 12px -18px 0; padding: 12px 0 16px; background: linear-gradient(180deg, rgba(4, 9, 16, 0), rgba(4, 9, 16, .96) 30%); }
}
@media (max-width: 700px) { .cols { grid-template-columns: minmax(0, 1fr); } .cols > div { min-width: 0; } #bodies { display: none; } #target { width: 60vw; } #timebar #tDate { display: none; } }
.sheet p { margin: 5px 0; font-size: 13.5px; color: #c4d2e2; }
.fine { color: var(--dim) !important; font-size: 11.5px !important; }
.center { text-align: center; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 2px; font: 600 11px/19px var(--mono); text-align: center; color: var(--acc); border: 1px solid var(--line-hi); background: rgba(var(--acc-rgb), .07); }
em { color: var(--hot); font-style: normal; }
.row { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }

/* buttons: outlined, fill on hover */
button { font: 600 11.5px var(--font); letter-spacing: .2em; text-transform: uppercase; color: var(--acc); background: rgba(var(--acc-rgb), .06); border: 1px solid var(--line-hi); border-radius: 0; padding: 8px 18px; cursor: pointer; transition: background .15s, box-shadow .15s, color .15s; }
button:hover:not(:disabled) { background: rgba(var(--acc-rgb), .2); box-shadow: var(--glow); color: #fff; }
button:focus-visible { outline: 1px solid var(--acc); outline-offset: 2px; }
button.big { padding: 13px 56px; font-size: 15px; letter-spacing: .4em; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); background: rgba(var(--acc-rgb), .14); }
button.big:hover:not(:disabled) { background: var(--acc); color: #021018; }

#destList h3 { border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.dest { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; cursor: pointer; border-left: 2px solid transparent; transition: background .12s; }
.dest:hover { background: linear-gradient(90deg, rgba(var(--acc-rgb), .16), transparent); border-left-color: var(--acc); }
.dest b { min-width: 230px; font-weight: 600; letter-spacing: .05em; }
.dest span { color: var(--dim); font-size: 12.5px; flex: 1; }
.dest i { font-style: normal; color: var(--acc); font: 12px var(--mono); white-space: nowrap; }

#loading { position: fixed; left: 50%; bottom: 4%; transform: translateX(-50%); z-index: 12; text-align: center; width: 340px; }
#loading .bar { height: 3px; background: rgba(var(--acc-rgb), .12); overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--acc); box-shadow: var(--glow); }
#loading span { display: block; margin-top: 8px; color: var(--dim); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 9; transition: opacity .35s; }
#err { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 2em; text-align: center; background: #010208; color: var(--warn); }
#err[hidden] { display: none; }
