/* SECTOR SOVEREIGN - Copyright (c) 2026 Jan-Maurice Dahlmanns - MIT License (see LICENSE) */

:root {
  --bg: #04070d;
  --panel: rgba(8, 14, 26, 0.88);
  --panel-2: rgba(16, 26, 44, 0.92);
  --line: #1f3456;
  --line-2: #2d4a78;
  --text: #dce6f5;
  --dim: #8496b3;
  --accent: #47d6ff;
  --accent-2: #2f8cff;
  --red: #ff5a64;
  --green: #5fe07a;
  --gold: #ffd34d;
  --ore: #e2b878;
  --gas: #66e0a0;
  --crew: #9fc0ff;
  --cp: #ffd34d;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); user-select: none; -webkit-user-select: none; }
a { color: var(--accent); }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.center { text-align: center; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: #0b1424; font: 600 11px/18px var(--font); text-align: center; color: #fff; }
.ore { color: var(--ore); } .gas { color: var(--gas); } .crew { color: var(--crew); }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
body.targeting #game { cursor: crosshair; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#hud > * { pointer-events: auto; }
#hud #messages, #hud #tooltip { pointer-events: none; }
#hud #messages .msg[data-pos] { pointer-events: auto; cursor: pointer; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); backdrop-filter: blur(3px); }

#topbar { position: absolute; top: 0; left: 0; right: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: linear-gradient(#0a1424f2, #070d18e6); border-bottom: 1px solid var(--line); }
#topbar .res { display: flex; align-items: center; gap: 7px; min-width: 92px; padding: 3px 10px; border-radius: 6px; background: #0b1527; border: 1px solid #16284a; font-variant-numeric: tabular-nums; }
#topbar .res b { font-size: 15px; color: #fff; }
#topbar .res.warn b { color: var(--red); }
.ico { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: none; }
.ico.ore { background: var(--ore); transform: rotate(45deg); border-radius: 2px; }
.ico.gas { background: var(--gas); border-radius: 50%; }
.ico.crew { background: var(--crew); border-radius: 50% 50% 3px 3px; }
.ico.cp { background: var(--cp); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
#topbar .spacer { flex: 1; }
#sysName { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
#clock { min-width: 70px; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.chip { height: 28px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line-2); background: #0e1a30; color: var(--text); font: 600 12px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: #fff; }
.chip.warn { border-color: #b88a2a; color: var(--gold); }

#objectives { position: absolute; top: 48px; left: 10px; width: 340px; padding: 9px 12px; font-size: 13px; }
#objectives .t { font-weight: 700; color: var(--accent); text-transform: uppercase; font-size: 11px; letter-spacing: 0.1em; margin-bottom: 4px; }
#objectives .o { padding: 2px 0; }
#objectives .o.done { color: var(--green); }
#objectives .o.failed { color: var(--red); text-decoration: line-through; }

#messages { position: absolute; left: 12px; bottom: 236px; width: min(560px, 48vw); display: flex; flex-direction: column; gap: 4px; }
.msg { padding: 5px 10px; border-radius: 6px; background: rgba(6, 12, 22, 0.82); border-left: 3px solid var(--accent-2); font-size: 13px; transition: opacity 0.3s; }
.msg.good { border-left-color: var(--green); }
.msg.bad { border-left-color: var(--red); color: #ffd0d4; }
.msg.comm { border-left-color: var(--gold); background: rgba(24, 20, 6, 0.85); font-size: 14px; }
.msg.comm b { color: var(--gold); }

#sectorPanel { position: absolute; top: 48px; right: 10px; padding: 4px; }
#sectorPanel canvas { display: block; cursor: pointer; border-radius: 5px; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 226px; display: flex; gap: 8px; padding: 0 8px 8px; align-items: flex-end; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#minimapPanel { padding: 6px; flex: none; }
#minimapPanel .title { font: 700 11px var(--font); color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 4px 2px; }
#minimap { display: block; width: 190px; height: 190px; cursor: pointer; border-radius: 50%; }
#selPanel { flex: 1; min-width: 260px; height: 212px; padding: 10px 12px; overflow: hidden; }
#cmdPanel { flex: none; padding: 7px; }
#cmdGrid { display: grid; grid-template-columns: repeat(5, 64px); grid-template-rows: repeat(3, 64px); gap: 5px; }
.cmd { position: relative; width: 64px; height: 64px; border-radius: 7px; border: 1px solid var(--line-2); background: linear-gradient(#13223d, #0b1527); color: var(--text); cursor: pointer; padding: 4px 3px 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font); overflow: hidden; }
.cmd.empty { border: 1px dashed #13223a; background: rgba(8, 14, 26, 0.4); cursor: default; }
.cmd:not(.empty):hover { border-color: var(--accent); background: linear-gradient(#1a3057, #10203a); }
.cmd .ic { font: 700 16px/1 var(--font); color: #fff; letter-spacing: 0.02em; }
.cmd .lb { font-size: 9.5px; line-height: 1.1; margin-top: 4px; text-align: center; color: #b8c8e2; max-height: 22px; overflow: hidden; }
.cmd .hk { position: absolute; top: 2px; left: 4px; font: 700 10px var(--font); color: var(--gold); }
.cmd .bd { position: absolute; top: 2px; right: 3px; font: 700 10px var(--font); color: #fff; background: #2f8cff; border-radius: 4px; padding: 0 3px; }
.cmd.off { opacity: 0.4; }
.cmd.on { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.cmd.ability .ic { color: #e0b0ff; }

#tooltip { position: fixed; z-index: 20; max-width: 300px; padding: 8px 10px; border-radius: 7px; background: rgba(6, 12, 22, 0.97); border: 1px solid var(--line-2); font-size: 12.5px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6); }
#tooltip b { color: #fff; font-size: 13.5px; }
#tooltip .k { color: var(--gold); font-weight: 700; }
#tooltip .cost { display: flex; gap: 10px; margin: 4px 0; font-weight: 700; }
#tooltip .cost .ore::before { content: '◆ '; } #tooltip .cost .gas::before { content: '● '; } #tooltip .cost .crew::before { content: '▲ '; }
#tooltip .cost .cp { color: var(--cp); } #tooltip .cost .cp::after { content: ' CP'; }
#tooltip .cost .tm { color: var(--dim); }
#tooltip .cost .short { color: var(--red); }
#tooltip .d { color: #b8c8e2; }
#tooltip .why { color: var(--red); margin-top: 4px; font-weight: 600; }

/* selection panel */
.uhead { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.uabbr { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; border: 2px solid; background: #0e1a30; font: 800 13px var(--font); color: #fff; flex: none; }
.uname { font-weight: 700; font-size: 15px; color: #fff; }
.role { color: var(--dim); font-size: 12px; }
.uhead .mini { margin-left: auto; }
.mini { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line-2); background: #0e1a30; color: var(--text); cursor: pointer; }
.bar { position: relative; height: 16px; margin: 3px 0; border-radius: 4px; background: #0a1220; border: 1px solid #1a2b48; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); }
.bar i.mid { background: #e8c440; } .bar i.low { background: #ef4c4c; }
.bar.sup i { background: #3a8cff; }
.bar.bld i { background: #ffb030; }
.bar.res { cursor: pointer; } .bar.res i { background: #a060ff; }
.bar span { position: relative; z-index: 1; display: block; font-size: 11px; line-height: 14px; padding-left: 6px; color: #fff; text-shadow: 0 1px 2px #000; }
.line { font-size: 12.5px; margin-top: 3px; }
.line.status { color: var(--accent); }
.line.dim { color: var(--dim); font-size: 12px; }
.weap { font-size: 12px; color: #c8b8a8; margin-top: 4px; }
.stats { font-size: 13px; }
.stats > div { margin: 2px 0; }
.hint { color: var(--dim); font-size: 13px; padding-top: 8px; }
.multi { display: flex; flex-wrap: wrap; gap: 4px; }
.tile { position: relative; width: 50px; height: 40px; border-radius: 5px; border: 1px solid var(--line-2); background: #0e1a30; display: grid; place-items: center; font: 700 11px var(--font); cursor: pointer; overflow: hidden; }
.tile:hover { border-color: var(--accent); }
.tile.foe { border-color: #6a2a30; }
.tile i { position: absolute; left: 0; bottom: 3px; height: 3px; background: var(--green); }
.tile i.mid { background: #e8c440; } .tile i.low { background: #ef4c4c; }
.tile i.sup { bottom: 0; background: #3a8cff; }
.more { align-self: center; color: var(--dim); padding: 0 6px; }
.queue { display: flex; gap: 4px; margin-top: 6px; }
.qi { position: relative; width: 44px; height: 30px; border-radius: 5px; border: 1px solid var(--line-2); background: #0e1a30; display: grid; place-items: center; font: 700 11px var(--font); cursor: pointer; overflow: hidden; }
.qi:hover { border-color: var(--red); }
.qi i { position: absolute; left: 0; bottom: 0; height: 3px; background: #5fe0e0; }

#bigSector { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); }
#bigSectorCanvas { max-width: 94vw; max-height: 86vh; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; }

#fps { position: fixed; z-index: 30; right: 12px; bottom: 236px; color: var(--dim); font: 12px var(--font); }
#toast { position: fixed; z-index: 40; left: 50%; top: 56px; transform: translateX(-50%); padding: 8px 16px; border-radius: 8px; background: rgba(8, 18, 34, 0.96); border: 1px solid var(--accent-2); color: #fff; font-weight: 600; }

/* ------------------------------------------------------------ menus */
#screens { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; background: radial-gradient(ellipse at center, rgba(4, 8, 16, 0.25), rgba(2, 4, 10, 0.88)); overflow: auto; }
.screen.dim-bg { background: rgba(2, 5, 12, 0.78); }
#titleScreen { background: radial-gradient(ellipse at center, rgba(4, 8, 16, 0) 30%, rgba(2, 4, 10, 0.75)); }
.screen h2 { margin: 0 0 18px; font-size: 30px; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; text-shadow: 0 0 20px rgba(71, 214, 255, 0.35); }
.logo { text-align: center; margin-bottom: 34px; }
.logo .l1 { font: 800 clamp(38px, 7vw, 76px)/1 var(--font); letter-spacing: 0.14em; color: #fff; text-shadow: 0 0 34px rgba(71, 214, 255, 0.55), 0 0 4px rgba(255, 255, 255, 0.5); }
.logo .l2 { margin-top: 12px; font: 600 clamp(11px, 1.4vw, 15px) var(--font); letter-spacing: 0.42em; color: var(--accent); }
.menu { display: flex; flex-direction: column; gap: 9px; min-width: 280px; }
.menu.horiz { flex-direction: row; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.screen button { min-height: 42px; padding: 0 22px; border-radius: 8px; border: 1px solid var(--line-2); background: linear-gradient(#142644e8, #0b162be8); color: var(--text); font: 600 15px var(--font); letter-spacing: 0.04em; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.screen button:hover { border-color: var(--accent); color: #fff; background: linear-gradient(#1b3560, #10213e); }
.screen button.primary { border-color: #2f8cff; background: linear-gradient(#2a6fd8, #1b4d9e); color: #fff; }
.screen button.primary:hover { background: linear-gradient(#3a82ee, #2260bd); }
.screen button:disabled { opacity: 0.45; cursor: default; }
.foot { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--dim); font-size: 12px; }
.row-btns { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.row-btns label, .opts label { color: var(--dim); display: flex; align-items: center; gap: 8px; }
select { height: 34px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-2); background: #0b1527; color: var(--text); font: 14px var(--font); }
.split { display: grid; grid-template-columns: 300px minmax(0, 640px); gap: 18px; width: min(980px, 100%); max-height: 70vh; }
.split.sk { grid-template-columns: 260px minmax(0, 680px); }
.list { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.list .item { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; min-height: 52px; }
.list .item.sel { border-color: var(--accent); background: linear-gradient(#1d3a66, #11264a); }
.list .item.locked { opacity: 0.45; }
.list .item .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #0b1527; border: 1px solid var(--line-2); font-weight: 800; flex: none; }
.list .item .t { flex: 1; display: flex; flex-direction: column; }
.list .item .t small { color: var(--dim); font-weight: 400; font-size: 12px; letter-spacing: 0; }
.list .item .s { color: var(--green); }
.info { padding: 16px 20px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow: auto; }
.info h3 { margin: 0; font-size: 20px; color: #fff; }
.info .sub { color: var(--accent); margin-bottom: 10px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.info p { margin: 0 0 10px; color: #c8d4e8; }
.info .tips, .info .obj { margin-top: 10px; padding: 9px 12px; border-radius: 7px; background: rgba(10, 20, 38, 0.8); border: 1px solid #16284a; font-size: 13px; }
.info .obj b { color: var(--gold); display: block; margin-bottom: 3px; }
.info .best { margin-top: 10px; color: var(--green); }
#skPreview { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }
#skPlayers { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.prow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 7px; background: rgba(10, 20, 38, 0.8); border: 1px solid #16284a; }
.prow.off { opacity: 0.5; }
.prow .sw { width: 14px; height: 14px; border-radius: 3px; }
.prow .pn { width: 92px; font-weight: 700; }
.prow .chk { color: var(--dim); display: flex; gap: 4px; align-items: center; }
.opts { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
#skFaction > div { margin-top: 6px; }
.slots { display: flex; flex-direction: column; gap: 8px; width: min(620px, 100%); }
.slot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.slot.empty { opacity: 0.7; }
.slot .src { color: var(--accent); font-size: 12px; margin-left: 6px; }
.slot .btns { display: flex; gap: 8px; }
.slot .btns button { min-height: 34px; padding: 0 14px; font-size: 13px; }
.help { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; width: min(1100px, 100%); max-height: 72vh; overflow: auto; padding: 18px 22px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.help h3 { margin: 12px 0 4px; color: var(--accent); font-size: 15px; }
.help p { margin: 0 0 8px; color: #c8d4e8; }
.help table { border-collapse: collapse; width: 100%; font-size: 13px; }
.help td { padding: 4px 6px; border-bottom: 1px solid #13223a; vertical-align: top; }
.help td:first-child { white-space: nowrap; color: #fff; }
.settings { display: flex; flex-direction: column; gap: 12px; min-width: min(460px, 100%); padding: 18px 22px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.settings input[type=range] { width: 200px; accent-color: var(--accent-2); }
.settings input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-2); }
.about { width: min(760px, 100%); max-height: 70vh; overflow: auto; padding: 18px 22px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.about h3 { color: var(--accent); margin: 14px 0 6px; }
.about p { color: #c8d4e8; margin: 0 0 8px; }
#endTitle.win { color: var(--green); text-shadow: 0 0 28px rgba(95, 224, 122, 0.5); }
#endTitle.lose { color: var(--red); text-shadow: 0 0 28px rgba(255, 90, 100, 0.5); }
.endtext { max-width: 640px; text-align: center; color: #c8d4e8; white-space: pre-line; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(200px, 1fr)); gap: 6px 22px; padding: 14px 20px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.stats > div { display: flex; justify-content: space-between; gap: 16px; }
.stats span { color: var(--dim); }
.loading { font: 700 22px var(--font); letter-spacing: 0.3em; color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

@media (max-width: 1100px) {
  #cmdGrid { grid-template-columns: repeat(5, 54px); grid-template-rows: repeat(3, 54px); }
  .cmd { width: 54px; height: 54px; }
  .cmd .lb { display: none; }
  #minimap { width: 150px; height: 150px; }
  #bottom { height: 196px; }
  #selPanel { height: 182px; }
  #messages { bottom: 204px; }
  .split, .split.sk { grid-template-columns: 1fr; max-height: none; }
  .help { grid-template-columns: 1fr; }
}
