/* Hullforge — interface. Dark glass panels over the 3D view, Oxanium headings, Barlow text. Desktop first. */
:root {
  --bg: #05070c; --panel: rgba(10, 16, 28, 0.82); --panel2: #0e1626; --panel3: #121d31; --line: #26344f; --line2: #34476b;
  --ink: #e4ecf7; --dim: #93a3bd; --cyan: #5fd8ff; --amber: #ffc45a; --green: #62f0a8; --red: #ff6a5a; --violet: #b48cff;
  --head: 'Oxanium', 'Barlow', sans-serif; --font: 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#jumpfade { position: fixed; inset: 0; background: radial-gradient(circle, #dff4ff, #5fd8ff 40%, #000 100%); opacity: 0; pointer-events: none; z-index: 50; transition: opacity 0.1s; }
/* your own ship hit hard: the screen edges flash red (opacity set by main.js placeCamera) */
#hitflash { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 40, 20, 0) 55%, rgba(255, 50, 25, 0.35) 80%, rgba(200, 20, 10, 0.75) 100%); }
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: 0.02em; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.center { justify-content: center; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.hint { color: var(--dim); font-size: 0.92rem; margin: 0; }
.good { color: var(--green); } .bad { color: var(--red); } .amber { color: var(--amber); } .dim { color: var(--dim); }

button {
  font-family: var(--head); font-weight: 600; font-size: 0.98rem; letter-spacing: 0.02em; color: var(--ink); cursor: pointer;
  background: linear-gradient(#1a2640, #121b2e); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 16px; min-height: 40px;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s;
}
button:hover:not([disabled]) { border-color: var(--cyan); box-shadow: 0 0 12px rgba(95, 216, 255, 0.22); }
button:active:not([disabled]) { transform: translateY(1px); }
button[disabled] { opacity: 0.45; cursor: default; }
button.primary { background: linear-gradient(#1f4a6a, #173650); border-color: #3a86b6; }
button.gold { background: linear-gradient(#5a4516, #3d2f10); border-color: #b48a2c; color: #ffe2a0; }
button.danger { background: linear-gradient(#5a1d22, #3d1418); border-color: #a8424c; }
button.small { min-height: 32px; padding: 4px 10px; font-size: 0.88rem; }
button .key { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid currentColor; border-radius: 4px; font-size: 0.75rem; opacity: 0.7; }
.pad-focus { outline: 2px solid var(--amber) !important; outline-offset: 2px; }
input[type=text], textarea, select { font-family: var(--font); font-size: 1rem; color: var(--ink); background: #0a1120; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; }
input[type=range] { width: 100%; accent-color: var(--cyan); }

/* ---------------- title */
.screen { position: fixed; inset: 0; z-index: 30; display: grid; place-items: safe center; overflow-y: auto; padding: 24px; }
#title { background: radial-gradient(ellipse at 50% 45%, rgba(10, 20, 40, 0.15), rgba(0, 0, 0, 0.55)); }
.title-card { text-align: center; width: min(460px, 100%); }
.title-card h1 { width: max-content; position: relative; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: clamp(2.6rem, 8vw, 5.2rem); font-weight: 800; letter-spacing: 0.16em; padding-left: 0.16em;
  background: linear-gradient(180deg, #ffffff, #9fd8ff 55%, #4f88c8); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(95, 180, 255, 0.45)); }
.title-card .tagline { color: #c4d2e8; margin: 6px 0 26px; font-size: 1.08rem; text-shadow: 0 1px 8px #000; }
#title-buttons button { width: 100%; min-height: 48px; font-size: 1.08rem; }
#title-extra { margin-top: 16px; }
#title-extra > button, #title-extra .rgs-acct-btn { min-height: 38px; font-size: 0.92rem; padding: 6px 14px; }
.slot-btn { display: flex !important; justify-content: space-between; align-items: center; gap: 12px; text-align: left; }
.slot-btn small { color: var(--dim); font-family: var(--font); font-weight: 500; }

/* ---------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud > .bars, #hud > #toasts, #hud > .banner, #hud > .target { pointer-events: none; }
.topbar { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-family: var(--head); white-space: nowrap; font-size: 0.95rem; }
.stat.small { font-size: 0.8rem; padding: 3px 8px; align-self: flex-start; }
#st-credits { color: var(--amber); }
#st-cargo.bad { color: var(--red); border-color: var(--red); }
.bars { position: absolute; top: 64px; left: 12px; width: 250px; display: flex; flex-direction: column; gap: 5px; }
.bar { position: relative; height: 19px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; transition: box-shadow 0.1s; }
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; }
.bar span { position: relative; font-size: 0.78rem; font-weight: 700; padding-left: 7px; line-height: 17px; display: block; text-shadow: 0 1px 2px #000; }
.bar.hull i { background: linear-gradient(90deg, #d86a2a, #ffcf7a); }
.bar.shield i { background: linear-gradient(90deg, #2a72d8, #8fd8ff); }
.bar.boost i { background: linear-gradient(90deg, #6a4ad8, #c8a8ff); }
.bar.boost.cruise i { background: linear-gradient(90deg, #2ab88a, #8fffd0); }
.bar.power i { background: linear-gradient(90deg, #a83a3a, #ff8a6a); }
.goal { position: absolute; top: 64px; right: 12px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 9px; padding: 9px 12px; cursor: pointer; }
.goal b { color: var(--amber); font-family: var(--head); display: block; font-size: 1rem; }
.goal p { margin: 3px 0 6px; font-size: 0.92rem; }
.goal small { color: var(--dim); }
.prog { height: 6px; background: #1a2238; border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.prog i { display: block; height: 100%; background: var(--amber); }
.target { position: absolute; bottom: 20px; left: 12px; width: 240px; background: var(--panel); border: 1px solid #6a3a2a; border-left: 3px solid var(--red); border-radius: 9px; padding: 9px 12px; }
.target h4 { margin-bottom: 5px; color: #ffb09a; }
.kv { display: grid; grid-template-columns: auto auto; gap: 2px 14px; font-size: 0.9rem; }
.kv span { color: var(--dim); } .kv b { text-align: right; font-weight: 600; }
.prompt { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--green); border-radius: 22px; padding: 7px 18px; font-weight: 700; font-family: var(--head); color: var(--green); white-space: nowrap; }
#toasts { position: absolute; left: 50%; transform: translateX(-50%); bottom: 180px; display: flex; flex-direction: column-reverse; align-items: center; gap: 5px; width: min(92vw, 560px); }
.toast { --tc: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 14px; font-weight: 600; font-size: 0.95rem; animation: toast 3.6s forwards; text-align: center; color: var(--tc); }
.toast.good { border-color: var(--green); color: var(--green); } .toast.bad { border-color: var(--red); color: var(--red); } .toast.gold { color: var(--amber); border-color: #6a5420; }
.toast.loot { border-color: var(--tc); box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 35%, transparent); }
@keyframes toast { 0% { opacity: 0; transform: translateY(6px); } 6% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
.banner { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); text-align: center; animation: banner 4.2s forwards; width: min(92vw, 640px); }
.banner h2 { font-size: 2.3rem; color: var(--amber); text-shadow: 0 0 22px rgba(255, 196, 90, 0.55); letter-spacing: 0.08em; }
.banner p { margin: 6px 0 0; font-size: 1.1rem; text-shadow: 0 1px 4px #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -8px); } 8% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
#radar { position: absolute; right: 12px; bottom: 12px; width: 190px; height: 190px; border-radius: 50%; cursor: pointer; }

/* ---------------- panels */
#panels { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#panels > * { pointer-events: auto; }
.panel-full { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 9, 18, 0.94), rgba(3, 6, 12, 0.97)); backdrop-filter: blur(6px); display: flex; flex-direction: column; padding: 14px 20px; }
.panel-full.see-through { background: linear-gradient(90deg, rgba(4, 8, 16, 0.94) 0%, rgba(4, 8, 16, 0.86) 48%, rgba(4, 8, 16, 0.25) 100%); backdrop-filter: none; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.45rem; color: var(--cyan); letter-spacing: 0.06em; }
.panel-head .sub { color: var(--dim); }
.panel-body { flex: 1; overflow-y: auto; padding-top: 12px; min-height: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { min-height: 38px; padding: 5px 14px; }
.tabs button.on { border-color: var(--amber); color: var(--amber); background: linear-gradient(#2a2412, #1a160c); }
.modal-back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); display: grid; place-items: safe center; padding: 16px; overflow-y: auto; }
.hf-modal { background: var(--panel2); border: 1px solid var(--line2); border-radius: 14px; padding: 18px 20px; width: min(460px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.hf-modal.wide { width: min(720px, 100%); }
.hf-modal h2 { color: var(--cyan); margin-bottom: 4px; }
.menu-list { display: flex; flex-direction: column; gap: 7px; }
.menu-list button { text-align: left; }
.section { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.section h3 { font-size: 1.05rem; color: #cfe0f6; margin-bottom: 10px; }
.set-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.set-row .val { min-width: 48px; text-align: right; color: var(--dim); }
.seg { display: inline-flex; gap: 4px; } .seg button { min-height: 34px; padding: 4px 12px; } .seg button.on { border-color: var(--amber); color: var(--amber); }
.controls-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 18px; font-size: 0.95rem; }
.controls-grid b { font-family: var(--head); font-weight: 600; color: #cfe0f6; }
.controls-grid .k { color: var(--amber); font-family: var(--head); text-align: right; }

/* ---------------- cards and lists */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.card.sel { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.card h4 { font-size: 1.02rem; }
.card .rar { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.card .price { font-family: var(--head); color: var(--amber); font-weight: 700; }
.card .cmp { font-size: 0.85rem; }
.card .rows { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; font-size: 0.88rem; }
.card .rows b { text-align: right; }
.card .rows span { color: var(--dim); }
.card .why { color: var(--red); font-size: 0.85rem; }
.ore-row { display: grid; grid-template-columns: 22px 1fr 80px 90px auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #1a2438; }
.swatch { width: 18px; height: 18px; border-radius: 4px; display: inline-block; box-shadow: 0 0 6px currentColor; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.big-stat { font-family: var(--head); font-size: 1.6rem; font-weight: 700; }
.station-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; max-width: 980px; }
.svc { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; min-height: 96px; border-radius: 12px; }
.svc b { font-size: 1.12rem; }
.svc small { font-family: var(--font); color: var(--dim); font-weight: 500; font-size: 0.88rem; }
.svc.launch { border-color: var(--green); background: linear-gradient(#173a2c, #10261d); }
.station-side { width: min(860px, 100%); }
.station-side .station-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.station-side .svc { min-height: 82px; }

/* ---------------- star map */
.starmap { position: relative; width: 100%; height: 100%; min-height: 420px; }
.starmap svg { width: 100%; height: 100%; display: block; }
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; height: 100%; min-height: 0; }
.map-side { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.danger-pips { display: inline-flex; gap: 3px; } .danger-pips i { width: 12px; height: 6px; border-radius: 2px; background: #233149; } .danger-pips i.on { background: var(--red); }

/* ---------------- new game */
.newgame { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; height: 100%; min-height: 0; }
.newgame .left { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-right: 4px; }
.starter { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border-radius: 12px; }
.starter.on { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.starter small { font-family: var(--font); color: var(--dim); font-weight: 500; }
.paints { display: flex; flex-wrap: wrap; gap: 6px; }
.paints button { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 8px; }
.paints button.on { outline: 2px solid var(--amber); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 4px; } .field label { color: var(--dim); font-size: 0.88rem; }
.death { text-align: center; }
.death h2 { color: var(--red) !important; font-size: 1.8rem; }
