:root {
  --hud: 200px; --mm: calc(var(--hud) - 30px);   /* the bottom bar is resizable (js/hudsize.js sets --hud); the minimap grows with it */
  --bg: #04060b; --panel: rgba(8, 14, 26, .94); --panel2: rgba(14, 24, 42, .92); --line: #1d3650; --line2: #2b5273;
  --text: #cfe3f2; --muted: #7b95aa; --cyan: #4fd1ff; --gold: #f5c04a; --green: #5be3a0; --red: #ff5b6b; --warn: #ffd24a; --violet: #b58cff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; overflow: hidden; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: crosshair; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); }
h3 { font-size: 12px; margin: 14px 0 6px; } h4 { font-size: 11px; color: var(--muted); margin: 10px 0 4px; }
.muted { color: var(--muted); } .gold { color: var(--gold); } .cyan { color: var(--cyan); } .green { color: var(--green); } .red { color: var(--red); } .warn { color: var(--warn); }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; } .gap4 { gap: 4px; } .between { justify-content: space-between; }
.hide { display: none !important; }

/* top bar */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: var(--tb, 52px); display: flex; align-items: center; gap: 4px; padding: 0 10px 0 64px; background: linear-gradient(180deg, rgba(5,10,20,.97), rgba(5,10,20,.82)); border-bottom: 1px solid var(--line); }
#topbar .logo { position: absolute; left: 0; top: 0; width: 56px; height: var(--tb, 52px); display: grid; place-items: center; border-right: 1px solid var(--line); background: #060d18; }
.res { display: flex; align-items: center; gap: 6px; padding: 2px 12px; height: 44px; box-sizing: border-box; border: 1px solid var(--line); background: rgba(10,20,36,.8); clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); min-width: 104px; }
.res .k { font-size: 9px; line-height: 1.1; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.res .v { font-family: var(--mono); font-weight: 600; font-size: 13px; line-height: 1.15; }
.res .d { font-size: 9px; line-height: 1.1; color: var(--muted); font-family: var(--mono); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
#clock { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 12px; }
#clock small { display: block; color: var(--muted); font-size: 10px; }

/* left rail */
#rail { position: absolute; top: var(--tb, 52px); bottom: 0; left: 0; width: 56px; display: flex; flex-direction: column; background: rgba(5,10,20,.9); border-right: 1px solid var(--line); padding-top: 6px; }
#rail button { position: relative; background: none; border: 0; border-left: 3px solid transparent; color: var(--muted); height: 52px; cursor: pointer; display: grid; place-items: center; }
#rail button:hover { color: var(--text); background: rgba(79,209,255,.07); }
#rail button.on { color: var(--cyan); border-left-color: var(--cyan); background: rgba(79,209,255,.12); }
#rail button .lbl { font-size: 8px; text-transform: uppercase; letter-spacing: .03em; margin-top: -2px; white-space: nowrap; max-width: 52px; text-align: center; }
#rail button .lbl.long { font-size: 7px; letter-spacing: 0; }
#rail button .pip { position: absolute; top: 8px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
#rail .sp { flex: 1; }
#rail button { touch-action: none; user-select: none; }
#rail.reordering { cursor: grabbing; }
#rail button.railhole { opacity: .25; background: rgba(79,209,255,.12); }
.railghost { background: rgba(10,22,40,.97) !important; border: 1px solid var(--cyan) !important; color: var(--cyan) !important; box-shadow: 0 6px 18px rgba(0,0,0,.6), 0 0 12px rgba(79,209,255,.35); border-radius: 6px; }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* side panel */
#panel { position: absolute; top: var(--tb, 52px); bottom: var(--hud); left: var(--rail, 56px); width: 430px; max-width: calc(100vw - var(--rail, 56px)); background: var(--panel); border-right: 1px solid var(--line2); display: flex; flex-direction: column; box-shadow: 8px 0 30px rgba(0,0,0,.4); }
#panel.wide { width: 620px; }
#panel header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(79,209,255,.12), transparent); }
#panel header h2 { font-size: 14px; flex: 1; }
#panel .body { overflow: auto; padding: 12px 14px 24px; flex: 1; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; } .x:hover { color: var(--red); }

/* controls */
.btn { background: linear-gradient(180deg, #14304a, #0d2236); border: 1px solid var(--line2); color: var(--text); padding: 5px 12px; cursor: pointer; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.btn:hover:not(:disabled) { border-color: var(--cyan); color: #fff; background: linear-gradient(180deg, #1a4264, #10304a); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #1e6a8f, #124863); border-color: var(--cyan); color: #fff; }
.btn.gold { background: linear-gradient(180deg, #6e5314, #4a380d); border-color: var(--gold); color: #ffe9a8; }
.btn.danger { background: linear-gradient(180deg, #6a1f2a, #451520); border-color: var(--red); color: #ffd0d4; }
.btn.sm { padding: 2px 8px; font-size: 10px; }
.btn.on { border-color: var(--cyan); color: var(--cyan); box-shadow: inset 0 0 8px rgba(79,209,255,.25); }
input, select, textarea { background: #07101c; border: 1px solid var(--line); padding: 5px 8px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--cyan); border-color: var(--cyan); }
input[type=number] { width: 92px; font-family: var(--mono); }
.card { background: var(--panel2); border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 8px; }
.card.hl { border-color: var(--gold); }
.card h4 { margin: 0 0 4px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 -14px 10px; padding: 0 10px; gap: 2px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 7px 10px; color: var(--muted); cursor: pointer; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.tab:hover { color: var(--text); } .tab.on { color: var(--cyan); border-bottom-color: var(--cyan); }
.bar { height: 6px; background: #0a1522; border: 1px solid var(--line); position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1b86b3, var(--cyan)); }
.bar.gold > i { background: linear-gradient(90deg, #a77a12, var(--gold)); } .bar.green > i { background: linear-gradient(90deg, #218a5e, var(--green)); } .bar.red > i { background: linear-gradient(90deg, #a1303d, var(--red)); }
.badge { display: inline-block; padding: 0 6px; font-size: 10px; border: 1px solid var(--line2); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.badge.good { color: var(--green); border-color: #1f6a4b; } .badge.bad { color: var(--red); border-color: #7a2a33; } .badge.gold { color: var(--gold); border-color: #7a5d17; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #12253a; font-size: 12px; } th { color: var(--muted); font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: #0a1424; }
td.n, th.n { text-align: right; font-family: var(--mono); }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(79,209,255,.08); } tr.sel td { background: rgba(79,209,255,.16); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; } .kv > :nth-child(odd) { color: var(--muted); }
.need { font-family: var(--mono); font-size: 11px; } .need .ok { color: var(--green); } .need .no { color: var(--red); }
.pillrow { display: flex; flex-wrap: wrap; gap: 4px; }
.sep { height: 1px; background: var(--line); margin: 10px 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); }
.err { color: var(--red); font-size: 12px; min-height: 16px; }
.qtyrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }

/* selection card & minimap & chat */
#sel { position: relative; min-width: 0; overflow: auto; padding: 8px 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
#sel .ships { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
#sel .ship { background: #0a1626; border: 1px solid var(--line); padding: 1px 6px; font-size: 11px; font-family: var(--mono); }
#minimap { position: relative; width: var(--mm); height: var(--mm); border: 1px solid var(--line2); background: rgba(3,6,12,.9); box-shadow: 0 0 14px rgba(0,0,0,.6), inset 0 0 22px rgba(0,0,0,.7); }
#minimap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
#minimap .mmtools { position: absolute; right: 3px; top: 3px; max-height: calc(100% - 6px); display: flex; flex-direction: column; flex-wrap: wrap-reverse; align-content: flex-start; gap: 2px; opacity: .35; transition: opacity .15s; }
#minimap:hover .mmtools { opacity: 1; }
#minimap .mmtools button { width: 20px; height: 20px; padding: 0; line-height: 1; font-size: 12px; background: rgba(8,16,28,.85); border: 1px solid var(--line2); color: var(--text); cursor: pointer; }
#minimap .mmtools button:hover { border-color: var(--cyan); color: #fff; }
#minimap .mmname { position: absolute; left: 4px; bottom: 3px; right: 4px; font: 10px var(--mono, monospace); color: rgba(190,225,250,.85); text-shadow: 0 0 4px #000, 0 0 4px #000; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* drag handle on the top edge of the bottom bar */
.hgrip { position: absolute; left: 0; right: 0; top: -7px; height: 12px; cursor: ns-resize; z-index: 6; touch-action: none; display: grid; place-items: center; }
.hgrip::after { content: ''; width: 56px; height: 4px; border-radius: 3px; background: var(--line2); opacity: .55; transition: opacity .15s, background .15s, width .15s; }
.hgrip:hover::after, .hgrip.drag::after { opacity: 1; background: var(--cyan); width: 84px; }
body.hudresize, body.hudresize * { cursor: ns-resize !important; user-select: none !important; }
#feed { position: absolute; top: 86px; right: 12px; width: 320px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#feed > div { background: rgba(8,14,26,.92); border-left: 3px solid var(--cyan); padding: 5px 9px; font-size: 12px; animation: slide .25s ease-out; }
#feed .salvage { border-left-color: #e0b060; }   /* update 74 */
#feed .lost, #feed .warn { border-left-color: var(--red); } #feed .win { border-left-color: var(--green); } #feed .prod, #feed .sale, #feed .convoy { border-left-color: var(--gold); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#toasts { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#toasts div { background: #0e1c30; border: 1px solid var(--cyan); padding: 7px 16px; box-shadow: 0 4px 20px rgba(0,0,0,.6); max-width: 520px; }
#toasts div.bad { border-color: var(--red); color: #ffd0d4; }
#hint { position: absolute; left: calc(var(--rail, 56px) + 14px); bottom: calc(var(--hud) + 8px); color: var(--muted); font-size: 11px; max-width: 360px; text-shadow: 0 0 6px #000; pointer-events: none; }
#panel ~ #hint { left: 500px; }
#tip { position: fixed; pointer-events: none; z-index: 30; background: rgba(6,12,22,.96); border: 1px solid var(--line2); padding: 6px 9px; font-size: 12px; max-width: 280px; display: none; }
.chat { height: 240px; overflow: auto; border: 1px solid var(--line); background: #060d17; padding: 6px; font-size: 12px; }
.chat div { margin-bottom: 2px; word-break: break-word; } .chat b { color: var(--cyan); }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(4,8,16,.82), rgba(2,4,8,.97)); overflow: auto; }
.overlay.show { display: flex; }
.authbox { width: 400px; max-width: 94vw; background: var(--panel); border: 1px solid var(--line2); padding: 28px 28px 22px; box-shadow: 0 0 60px rgba(79,209,255,.12); }
.authbox h1 { font-size: 24px; text-align: center; letter-spacing: .18em; color: #fff; text-shadow: 0 0 18px var(--cyan); }
.authbox .sub { text-align: center; color: var(--gold); margin: 4px 0 18px; font-size: 12px; letter-spacing: .1em; }
.authbox label { display: block; margin: 10px 0 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.authbox input { width: 100%; }
.authbox .btn { width: 100%; margin-top: 16px; padding: 9px; }
.hero { width: min(1080px, 96vw); max-height: 94vh; overflow: auto; background: var(--panel); border: 1px solid var(--line2); padding: 20px 24px; }
.races { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 14px 0; }
.race { border: 1px solid var(--line); background: var(--panel2); padding: 12px; cursor: pointer; position: relative; }
.race:hover { border-color: var(--line2); } .race.on { border-color: var(--cyan); box-shadow: 0 0 18px rgba(79,209,255,.18); }
.race h3 { margin: 0 0 2px; font-size: 15px; } .race .perk { font-size: 12px; margin-top: 6px; } .race .perk b { color: var(--gold); font-weight: 600; }
.race .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.cmdlist { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.cmdcard { border: 1px solid var(--line); background: var(--panel2); padding: 10px 14px; cursor: pointer; min-width: 200px; }
.cmdcard:hover { border-color: var(--cyan); } .cmdcard.cur { border-color: var(--gold); }
@media (max-width: 1100px) { #hud:not([style*="grid-template-columns"]) { grid-template-columns: calc(var(--mm) + 22px) 1fr 250px !important; } #panel { width: 380px; } }

/* ---- alerts, tools, quest checklist ---- */
#tools { position: absolute; top: calc(var(--tb, 52px) + 4px); right: 12px; z-index: 6; }
.tbtn { position: relative; background: rgba(8,14,26,.85); border: 1px solid var(--line2, #1d3a52); color: var(--text, #cfe6f5); border-radius: 3px; padding: 3px 8px; font-size: 13px; cursor: pointer; }
.tbtn.on { border-color: var(--cyan, #4fd1ff); }
.tbtn .abadge { position: absolute; top: -6px; right: -6px; background: var(--red, #ff5b6b); color: #fff; font-style: normal; font-size: 10px; border-radius: 8px; min-width: 14px; text-align: center; padding: 0 3px; }
.tbtn .abadge.hide { display: none; }
#alerts { position: absolute; top: 80px; right: 12px; width: 340px; max-height: 60vh; overflow: auto; background: rgba(8,14,26,.97); border: 1px solid var(--line2, #1d3a52); z-index: 7; }
#alerts.hide { display: none; }
#alerts .al { display: flex; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--line, #12263a); font-size: 12px; align-items: baseline; }
#alerts .al.click { cursor: pointer; } #alerts .al.click:hover { background: rgba(79,209,255,.08); }
#alerts .al.danger, #alerts .al.defeat, #alerts .al.lost, #alerts .al.warn { border-left: 3px solid var(--red, #ff5b6b); }
#alerts .al.win, #alerts .al.prod { border-left: 3px solid var(--green, #5be3a0); }
#quest { position: absolute; right: 12px; bottom: calc(var(--hud) + 10px); width: 262px; max-height: calc(100vh - var(--hud) - 110px); overflow-y: auto; background: rgba(8,14,26,.93); border: 1px solid var(--line2, #1d3a52); padding: 8px 10px; z-index: 5; font-size: 12px; }
#quest.hide { display: none; }
#quest .qh { display: flex; align-items: center; gap: 6px; cursor: pointer; }
#quest .qs { display: flex; gap: 8px; padding: 3px 0; align-items: flex-start; } #quest .qs.ok { opacity: .55; } #quest .qs.ok > div { text-decoration: line-through; }
#quest .ck { width: 14px; color: var(--gold, #f5c04a); } #quest .qs.ok .ck { color: var(--green, #5be3a0); }
#quest small { display: block; font-size: 10.5px; }
#groups { position: absolute; left: 50%; transform: translateX(-50%); top: 52px; display: flex; gap: 4px; z-index: 4; }
#groups:empty { display: none; }
#map { touch-action: none; }
@media (max-width: 760px) {
  #panel { width: calc(100vw - 56px); } #quest { display: none; }
  #feed { width: 220px; } #sel { max-width: calc(100vw - 70px); } #tools { top: calc(var(--tb, 52px) + 2px); } .res .k { display: none; }
}

#banner { position: absolute; top: 17%; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#banner .bn { background: linear-gradient(90deg, rgba(8,14,26,0), rgba(8,14,26,.92) 20%, rgba(8,14,26,.92) 80%, rgba(8,14,26,0)); padding: 14px 70px; text-align: center; animation: bnin .5s ease-out, bnout .6s ease-in 3.5s forwards; border-top: 1px solid var(--gold, #f5c04a); border-bottom: 1px solid var(--gold, #f5c04a); }
#banner .bn.event { border-color: var(--red, #ff5b6b); } #banner .bn.win { border-color: var(--green, #5be3a0); }
#banner .bn.tax { background: linear-gradient(90deg, rgba(40,4,10,0), rgba(46,5,12,.94) 20%, rgba(46,5,12,.94) 80%, rgba(40,4,10,0)); animation: bnin .5s ease-out, taxpulse 1.6s ease-in-out .5s 4, bnout .6s ease-in 7.3s forwards; border-width: 2px 0; } #banner .bn.tax .bs { color: #ffb3bb; max-width: 760px; margin-left: auto; margin-right: auto; }
@keyframes taxpulse { 0%, 100% { box-shadow: 0 0 0 rgba(255,91,107,0); } 50% { box-shadow: 0 0 34px rgba(255,91,107,.55) inset; } }
#banner .bt { font-size: 26px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold, #f5c04a); text-shadow: 0 0 18px rgba(245,192,74,.5); } #banner .bn.event .bt { color: var(--red, #ff5b6b); }
#banner .bs { font-size: 13px; color: var(--text, #cfe6f5); margin-top: 4px; }
@keyframes bnin { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } } @keyframes bnout { to { opacity: 0; transform: translateY(-14px); } }
#rail button.coach { animation: coachp 1.4s ease-in-out infinite; }
@keyframes coachp { 0%,100% { box-shadow: inset 0 0 0 1px rgba(245,192,74,.2); } 50% { box-shadow: inset 0 0 0 2px rgba(245,192,74,.9), 0 0 14px rgba(245,192,74,.5); } }
.res .v.up { animation: vup .7s ease-out; } @keyframes vup { 0% { color: #5be3a0; text-shadow: 0 0 8px rgba(91,227,160,.8); } 100% { } }

/* ---- away digest / next up / settings (task 15) ---- */
#nextup { display: flex; align-items: center; gap: 6px; margin-left: 10px; padding: 3px 9px; border: 1px solid var(--line2); background: rgba(10,26,42,.7); cursor: pointer; font-size: 11px; white-space: nowrap; max-width: 340px; }
#nextup:hover { border-color: var(--cyan); }
#nextup.hide { display: none; }
#nextup .nu-lbl { overflow: hidden; text-overflow: ellipsis; color: var(--muted); } #nextup b { color: var(--gold); }
.nu-ic { font-size: 9px; letter-spacing: .08em; color: var(--cyan); min-width: 44px; }
.nu-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-top: 1px solid var(--line); font-size: 12px; } .nu-row:first-child { border-top: 0; }
.nu-t { color: var(--gold); white-space: nowrap; }
.aw-box { width: min(640px, 94vw); }
.aw-box h1 { font-size: 20px; letter-spacing: .14em; color: #fff; text-shadow: 0 0 14px var(--cyan); margin: 0 0 4px; }
.aw-h { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); border-bottom: 1px solid var(--line); padding: 2px 0; margin: 12px 0 6px; } .aw-h .aw-n { color: var(--muted); }
.aw-todo { max-height: 24vh; border-top: 0; } .aw-todo .aw-t { width: 16px; text-align: center; }
.aw-sub { color: var(--gold); font-size: 12px; margin-bottom: 12px; }
.aw-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.aw-tile { background: var(--panel2); border: 1px solid var(--line); padding: 8px 10px; }
.aw-tile .aw-v { font-size: 17px; } .aw-tile .aw-k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.aw-tile.good .aw-v { color: var(--green); } .aw-tile.bad .aw-v { color: var(--red); }
.aw-lines { max-height: 38vh; overflow: auto; border-top: 1px solid var(--line); }
.aw-line { display: flex; gap: 10px; padding: 4px 2px; border-bottom: 1px solid var(--line); font-size: 12px; }
.aw-line .aw-t { width: 64px; flex: none; font-size: 10px; padding-top: 1px; }
.aw-line.bad { color: #ff9aa4; } .aw-line.good { color: #9fe8c4; } .aw-line.warn { color: var(--warn, #f5c04a); }
/* fleet bar */
#fleetbar { position: absolute; left: 66px; top: 54px; width: 190px; z-index: 4; font-size: 11px; }
#fleetbar .fbhead { cursor: pointer; font-size: 10px; letter-spacing: .08em; color: var(--muted); padding: 2px 4px; user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fleetbar .fblist { display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 330px); overflow-y: auto; }
.fchip { background: rgba(8,16,28,.84); border: 1px solid var(--line); border-left-width: 3px; padding: 3px 6px 4px; cursor: pointer; }
.fchip:hover { border-color: var(--line2); background: rgba(14,26,44,.92); }
.fchip.sel { border-color: #fff; background: rgba(20,36,60,.95); }
.fchip.idle { border-left-color: var(--warn); }
.fchip.eng { border-color: var(--red); animation: fpulse 1s infinite; }
.fchip .r1 { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.fchip .nm { overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: #dff3ff; }
.fchip .st { font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.fchip .bar2 { height: 3px; background: #10202e; margin-top: 2px; } .fchip .bar2 i { display: block; height: 100%; }
@keyframes fpulse { 50% { box-shadow: 0 0 10px rgba(255,91,107,.55); } }
@media (max-width: 900px) { #fleetbar { width: 150px; top: 94px; } }
body:has(#panel:not(.hide)) #fleetbar:not(.lw-free) { left: calc(var(--rail, 56px) + var(--pw, 430px) + 12px); } body:has(#panel.wide:not(.hide)) #fleetbar:not(.lw-free) { left: calc(var(--rail, 56px) + var(--pwide, 620px) + 12px); }
@media (max-width: 1100px) { body:has(#panel:not(.hide)) #fleetbar { display: none; } }
.card.dim { opacity: .62; }
/* command bar (press /) */
#cmdbar { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding-top: 16vh; background: rgba(2,5,12,.55); backdrop-filter: blur(3px); }
#cmdbar.hide { display: none; }
#cmdbar .cb-box { width: min(640px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line2); box-shadow: 0 20px 70px rgba(0,0,0,.75), 0 0 0 1px rgba(79,209,255,.08); clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%, 0 12px); }
#cmdbar .cb-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
#cmdbar .cb-slash { color: var(--cyan); font: 600 20px var(--mono); opacity: .8; }
#cmdbar input { flex: 1; background: transparent; border: 0; outline: 0; color: #eaf6ff; font-size: 18px; min-width: 0; }
#cmdbar input::placeholder { color: var(--muted); font-size: 14px; }
#cmdbar .cb-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
#cmdbar .cb-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; cursor: pointer; border-left: 3px solid transparent; }
#cmdbar .cb-row.on { background: rgba(79,209,255,.11); border-left-color: var(--cyan); }
#cmdbar .cb-row.dim { opacity: .55; }
#cmdbar .cb-ic { width: 26px; text-align: center; font-size: 17px; color: var(--cyan); }
#cmdbar .cb-row.warn .cb-ic { color: var(--warn); }
#cmdbar .cb-tx { flex: 1; min-width: 0; }
#cmdbar .cb-t { color: #eaf6ff; font-size: 14px; font-weight: 600; }
#cmdbar .cb-d { color: var(--muted); font-size: 12px; margin-top: 2px; }
#cmdbar .cb-row.warn .cb-d { color: var(--warn); }
#cmdbar .cb-enter { color: var(--cyan); font: 600 14px var(--mono); border: 1px solid var(--line2); padding: 1px 7px; }
#cmdbar .cb-foot { display: flex; gap: 14px; padding: 7px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

/* ---- individual ships (units) ---- */
.uchip { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: inherit; }
.uchip:hover { border-color: var(--cyan, #4fd1ff); }
.utiles { display: flex; flex-wrap: wrap; gap: 2px; margin: 4px 0; max-height: 92px; overflow: auto; }
.utile { position: relative; width: 17px; height: 17px; background: #0a1626; border: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.utile i { position: absolute; left: 0; bottom: 0; width: 100%; height: var(--hp); background: var(--c); opacity: .55; }
.utile span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 9px var(--mono, monospace); color: #fff; text-shadow: 0 0 2px #000; }
.utile:hover { border-color: #fff; } .utile.eng { border-color: var(--red); }
.uhist { display: flex; height: 6px; background: #10202e; margin: 4px 0 2px; } .uhist i { display: block; height: 100%; }
.fchip.squad { border-left-color: #8cffbe; }

/* ---- RTS bottom bar: minimap | selection | command card ---- */
#hud { position: absolute; left: var(--rail, 56px); right: 0; bottom: 0; height: var(--hud); display: grid; grid-template-columns: calc(var(--mm) + 22px) minmax(0, 1fr) 306px; background: linear-gradient(180deg, rgba(8,15,27,.95), rgba(3,7,14,.985)); border-top: 2px solid var(--line2); box-shadow: 0 -8px 26px rgba(0,0,0,.55); z-index: 4; }
#hud { grid-template-rows: minmax(0, 1fr); } #hud > * { min-height: 0; }
#hud #cmd { overflow: hidden; }
#hud .mmslot { display: grid; place-items: center; padding: 6px; }
#hud #sel.hide { display: block; }
.hrts { display: flex; gap: 14px; height: 100%; min-height: 0; }
.rinfo { flex: none; width: 262px; display: flex; gap: 10px; }
.rport { flex: none; width: 92px; height: 92px; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(79,209,255,.16), rgba(5,10,20,.9) 70%); border: 1px solid var(--line2); box-shadow: inset 0 0 16px rgba(0,0,0,.7); }
.rtxt { min-width: 0; flex: 1; } .rname { font-weight: 700; color: var(--cyan); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .rsub { font-size: 11px; } .rfacts { font-size: 10px; color: var(--muted); margin-top: 2px; }
.rtiles { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; overflow-y: auto; padding-right: 4px; }
.rtile { position: relative; width: 46px; height: 46px; background: linear-gradient(180deg, #0d1c30, #08121f); border: 1px solid var(--line2); display: grid; place-items: center; cursor: pointer; }
.rtile:hover { border-color: #fff; background: #12263f; } .rtile.on { border-color: var(--green); box-shadow: 0 0 8px rgba(91,227,160,.5); } .rtile.eng { border-color: var(--red); }
.rtile.big { width: 62px; height: 62px; }
.rtile .rn { position: absolute; right: 2px; top: 1px; font: 700 10px var(--mono, monospace); color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.rtile .rhp { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; background: #06101b; } .rtile .rhp s { display: block; height: 100%; }
.rpips { display: block; width: 100%; margin-top: 2px; image-rendering: pixelated; flex-basis: 100%; }
.hempty { max-width: 560px; }
.cwrap { padding: 6px 8px 6px 6px; display: flex; flex-direction: column; gap: 4px; height: 100%; box-sizing: border-box; min-height: 0; }
.cpage { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.cgrid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, minmax(34px, 1fr)); gap: 4px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.cbtn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: linear-gradient(180deg, #11233b, #0a1626); border: 1px solid var(--line2); color: var(--text); cursor: pointer; padding: 2px; font-family: inherit; min-width: 0; }
.cbtn:hover:not(.empty) { border-color: var(--cyan); background: linear-gradient(180deg, #17304f, #0d1c31); }
.cbtn.on { border-color: var(--green); box-shadow: inset 0 0 10px rgba(91,227,160,.35); } .cbtn.danger .cg { color: #ff8a94; } .cbtn.danger:hover { border-color: var(--red); }
.cbtn.empty { background: rgba(10,20,34,.35); border-style: dashed; border-color: rgba(60,100,130,.25); cursor: default; }
.cbtn .cg { font-size: 19px; line-height: 1; color: #bfe6ff; } .cbtn .cl { font-size: 9px; letter-spacing: .03em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cbtn.dim { opacity: .5; } .cbtn .cn { position: absolute; right: 3px; top: 1px; font: 700 10px var(--mono, monospace); color: #0b1a2a; background: var(--cyan); border-radius: 7px; padding: 0 4px; }
.cbtn .cg canvas, .cbtn .cg svg { display: block; }
.cbtn .ck { position: absolute; left: 3px; top: 1px; font: 700 9px var(--mono, monospace); color: var(--gold); }
@media (max-width: 800px) { #hud { grid-template-columns: 0 minmax(0, 1fr) 230px !important; } #hud .mmslot { display: none; } .rinfo { width: 190px; } .rport { width: 64px; height: 64px; } }

.rdetail { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 4px 18px; align-content: start; font-size: 12px; width: 100%; max-width: 560px; padding-top: 4px; } .rdetail div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 2px 0; } .rdetail b { color: #dff3ff; font-weight: 600; text-transform: capitalize; }

/* ---- race codex / creed picker ---- */
.race.creed { padding-left: 16px; } .race.creed .cx-quote { margin: 2px 0; }
.cx-k { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.cx-quote { font-style: italic; color: var(--gold); font-size: 12px; }
.cx-detail { margin: 6px 0 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.codex { --rc: #4fd1ff; line-height: 1.45; }
.codex h2 { margin: 0; font-size: 22px; letter-spacing: .06em; } .codex h3 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); }
.codex h3.green { color: #5be3a0; } .codex h3.red { color: #ff7b86; }
.cx-head { display: flex; gap: 16px; align-items: center; padding-bottom: 8px; border-bottom: 2px solid var(--rc); flex-wrap: wrap; }
.cx-ships { display: flex; gap: 6px; align-items: flex-end; } .cx-tag { color: var(--muted); font-size: 13px; }
.cx-creed { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--rc); background: rgba(255,255,255,.03); }
.cx-lore p { margin: 6px 0; } .cx-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.cx-op { border: 1px solid var(--line); background: var(--panel2); padding: 8px 10px; font-size: 12px; } .cx-op b { color: var(--gold); display: block; margin-bottom: 2px; }
.cx-rate { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; margin: 12px 0 0; font-size: 12px; } .cx-r { display: flex; justify-content: space-between; align-items: center; }
.pips { display: inline-flex; gap: 3px; } .pips i { width: 14px; height: 6px; background: var(--line); display: block; } .pips i.on { background: var(--rc, var(--cyan)); }
.cx-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 700px) { .cx-cols { grid-template-columns: 1fr; } }
.cx-list { padding-left: 18px; margin: 4px 0; font-size: 12px; } .cx-list li { margin: 3px 0; }
.traits { width: 100%; max-width: 460px; border-collapse: collapse; font-size: 12px; } .traits td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.rk { font-family: var(--mono); font-size: 11px; color: var(--muted); } .rk.top { color: var(--gold); font-weight: 600; }
.cx-quiz { border: 1px solid var(--line2); background: var(--panel2); padding: 12px 14px; margin: 8px 0; } .cx-answers { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---- planet panel (bottom bar): habitat backdrop, portrait, building tiles ---- */
#sel.pv { padding: 0; overflow: hidden; }
#sel .pv-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .55; z-index: 0; }
#sel .pv-shade { position: absolute; inset: 0; z-index: 0; background: linear-gradient(90deg, rgba(3,7,14,.92) 0%, rgba(3,7,14,.55) 38%, rgba(3,7,14,.7) 100%); }
#sel .pv-in { position: relative; z-index: 1; display: flex; gap: 12px; height: 100%; min-height: 0; box-sizing: border-box; padding: 8px 12px; align-items: stretch; }
#sel .pv-left { flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
#sel .pv-port { display: block; filter: drop-shadow(0 0 10px rgba(0,0,0,.6)); }
#sel .pv-biome { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; text-align: center; text-shadow: 0 0 6px #000; }
#sel .pv-body { flex: 1; min-width: 0; min-height: 0; display: flex; gap: 14px; align-items: stretch; overflow: hidden; }
#sel .pv-info { flex: 0 0 230px; display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 0; overflow-y: auto; text-shadow: 0 0 5px #000; }
#sel .pv-name { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }
#sel .pv-row { display: flex; gap: 6px; align-items: center; font-size: 11px; } #sel .pv-l { width: 26px; color: var(--muted); } #sel .pv-v { font-size: 10px; white-space: nowrap; }
#sel .pv-resrow { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10.5px; font-family: var(--mono); } #sel .pv-res b { font-weight: 600; }
#sel .pv-up { font-size: 11px; }
#sel .pv-tiles { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(60px, 1fr)); gap: 5px; align-content: stretch; max-height: 100%; overflow-y: auto; overflow-x: hidden; }
#sel .pv-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 2px; background: rgba(8,16,28,.82); border: 1px solid var(--line2); color: var(--text); cursor: pointer; overflow: hidden; }
#sel .pv-tile:hover:not(:disabled) { border-color: var(--cyan); box-shadow: 0 0 12px rgba(79,209,255,.25); }
#sel .pv-tile:disabled { cursor: default; } #sel .pv-tile.dim { opacity: .55; } #sel .pv-tile.empty .pv-g { opacity: .45; } #sel .pv-tile.max { border-color: rgba(91,227,160,.55); }
#sel .pv-tile.busy { border-color: var(--gold); animation: pvpulse 1.4s ease-in-out infinite; }
@keyframes pvpulse { 50% { box-shadow: 0 0 12px rgba(245,192,74,.4); } }
#sel .pv-g { font-size: 18px; line-height: 1; } #sel .pv-n { font-size: 9.5px; line-height: 1.1; text-align: center; color: #cfe6f5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sel .pv-pips { display: flex; gap: 2px; width: 100%; box-sizing: border-box; padding: 0 4px; justify-content: center; } #sel .pv-pips i { flex: 0 1 5px; min-width: 2px; height: 5px; background: #1b3249; } #sel .pv-pips i.on { background: var(--cyan); }
#sel .pv-c { font-size: 9.5px; font-family: var(--mono); color: var(--gold); }
#sel .pv-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #10202e; } #sel .pv-prog s { display: block; height: 100%; background: var(--gold); }
@media (max-width: 1100px) { #sel .pv-info { flex-basis: 190px; } #sel .pv-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: 64px; } }
/* planet bar + movable lists */
#planetbar { position: absolute; left: 264px; top: 54px; width: 190px; z-index: 4; font-size: 11px; }
#planetbar .fbhead { cursor: pointer; font-size: 10px; letter-spacing: .08em; color: var(--muted); padding: 2px 4px; user-select: none; }
#planetbar .fblist { display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 330px); overflow-y: auto; }
.pchip .nm { color: #cfeedd; } .pchip.sel { border-color: #fff; }
.fbhead.movable { cursor: grab !important; touch-action: none; }
.fbhead .grip { cursor: grab; opacity: .55; margin-right: 4px; letter-spacing: 0; } .fbhead .grip:hover { opacity: 1; color: var(--cyan, #4fd1ff); }
#fleetbar.lw-free .fbhead, #planetbar.lw-free .fbhead { background: rgba(8,16,28,.7); }
#fleetbar.dragging, #planetbar.dragging { opacity: .85; z-index: 9; } #fleetbar.dragging .fbhead, #planetbar.dragging .fbhead { cursor: grabbing !important; }
@media (max-width: 900px) { #planetbar { width: 150px; left: 222px; top: 94px; } }
body:has(#panel:not(.hide)) #planetbar { left: 696px; } body:has(#panel.wide:not(.hide)) #planetbar { left: 886px; }
@media (max-width: 1100px) { body:has(#panel:not(.hide)) #planetbar { display: none; } }

/* ---- Deliveries / Orders / Federation lists (hudlists.js): a row to the right of the Planets list; a dragged list leaves the row */
#hudstack { position: absolute; left: 462px; top: 54px; z-index: 4; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; max-width: calc(100vw - 480px); pointer-events: none; font-size: 11px; }
#hudstack > .hlist { width: 190px; pointer-events: auto; }
#hudstack > .hlist.lw-free { position: fixed; z-index: 5; }
#hudstack > .hlist.dragging { opacity: .85; z-index: 9; }
.hlist .fbhead { cursor: pointer; font-size: 10px; letter-spacing: .08em; color: var(--muted); padding: 2px 4px; user-select: none; }
.hlist.lw-free .fbhead { background: rgba(8,16,28,.7); }
.hlist .fblist { display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 330px); overflow-y: auto; }
.hlist .fchip .nm { min-width: 0; } .hlist .fchip.off { opacity: .6; } .hlist .fchip.hint2 { cursor: default; }
.hlist .fchip .cyan { color: var(--cyan, #4fd1ff); }
body:has(#panel:not(.hide)) #hudstack { left: 894px; max-width: calc(100vw - 910px); } body:has(#panel.wide:not(.hide)) #hudstack { left: 1084px; max-width: calc(100vw - 1100px); }
@media (max-width: 1500px) { body:has(#panel:not(.hide)) #hudstack { display: none; } }
@media (max-width: 900px) { #hudstack { left: 380px; top: 94px; } #hudstack > .hlist { width: 150px; } }

/* ---- Hotbar (hotbar.js) and the shared dialog / form rows (forms.js) ---- */
#hotbar { position: absolute; left: 50%; margin-left: -310px; bottom: calc(var(--hud) + 8px); z-index: 6; display: flex; align-items: stretch; gap: 3px; padding: 4px 4px 4px 0; background: linear-gradient(180deg, rgba(26,20,10,.88), rgba(12,9,4,.92)); border: 1px solid #6b5224; box-shadow: 0 2px 10px rgba(0,0,0,.6), inset 0 0 0 1px #2c200c; }
#hotbar.lw-free { position: fixed; margin-left: 0; } #hotbar.dragging { opacity: .85; z-index: 9; }
.hb-handle { width: 14px; display: flex; align-items: center; justify-content: center; cursor: grab; color: #a08545; font-size: 13px; user-select: none; touch-action: none; border-right: 1px solid #3a2c12; margin-right: 1px; }
.hb-handle:hover { color: #ffd36b; background: rgba(255,200,90,.08); }
.hb-row { display: flex; gap: 3px; }
.hb-slot { position: relative; width: 44px; height: 44px; box-sizing: border-box; background: radial-gradient(circle at 50% 35%, #1b2a3c, #0a121c 80%); border: 2px solid var(--kc, #31506e); border-radius: 3px; cursor: pointer; user-select: none; box-shadow: inset 0 0 6px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.08); }
.hb-slot:hover { filter: brightness(1.35); border-color: #ffd36b; }
.hb-slot:active { transform: translateY(1px); }
.hb-slot.empty { border-style: dashed; border-color: #2b3e52; background: rgba(8,14,22,.6); box-shadow: none; }
.hb-slot.empty .hb-g { color: #2f465d !important; font-size: 18px; }
.hb-slot.dim .hb-g, .hb-slot.dim .hb-l { opacity: .4; }
.hb-slot.drag { opacity: .35; } .hb-slot.over { border-color: #fff; box-shadow: 0 0 8px #ffd36b; }
.hb-g { position: absolute; inset: 0 0 8px 0; display: flex; align-items: center; justify-content: center; font-size: 21px; line-height: 1; text-shadow: 0 0 6px currentColor; pointer-events: none; }
.hb-l { position: absolute; left: 1px; right: 1px; bottom: 1px; text-align: center; font-size: 8px; letter-spacing: .02em; color: #c9d8e6; overflow: hidden; white-space: nowrap; text-overflow: clip; pointer-events: none; text-shadow: 0 1px 1px #000; }
.hb-k { position: absolute; left: 2px; top: 0; font: 700 10px var(--mono, monospace); color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000; pointer-events: none; }
.hb-q { position: absolute; right: 2px; top: 0; font: 700 9px var(--mono, monospace); color: #ffe9a8; text-shadow: 0 0 2px #000, 0 0 3px #000; pointer-events: none; }
.hb-q.on { color: #5be3a0; } .hb-q.off { color: #ff8a8a; }
.hb-cd { position: absolute; inset: 0; display: none; pointer-events: none; border-radius: 1px; }
.hb-cfg { align-self: flex-start; background: none; border: 0; color: #8a7340; cursor: pointer; font-size: 12px; padding: 0 2px; } .hb-cfg:hover { color: #ffd36b; }
@media (max-width: 900px) { #hotbar { margin-left: -230px; } .hb-slot { width: 34px; height: 34px; } .hb-g { font-size: 16px; } .hb-l { display: none; } }
.dlg-back { position: fixed; inset: 0; z-index: 60; background: rgba(2,6,12,.62); display: flex; align-items: center; justify-content: center; }
.dlg { background: #0b1626; border: 1px solid var(--line2); box-shadow: 0 8px 40px rgba(0,0,0,.8); width: 440px; max-width: calc(100vw - 24px); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.dlg.wide { width: 640px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #0f2034; letter-spacing: .04em; }
.dlg-head .x { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; } .dlg-head .x:hover { color: #fff; }
.dlg-body { padding: 12px; overflow-y: auto; }
.frow { display: grid; grid-template-columns: 120px 1fr; gap: 4px 8px; align-items: center; margin: 6px 0; }
.frow .fl { color: var(--muted); font-size: 11px; text-transform: capitalize; } .frow small { grid-column: 2; font-size: 10px; }
.frow select, .frow input[type=number] { width: 100%; box-sizing: border-box; } .frow input[type=checkbox] { justify-self: start; width: 16px; height: 16px; }
.hb-prev { margin-top: 10px; font-size: 11px; }
/* the hotbar steps aside for an open panel (unless the player has dragged it somewhere) */
body:has(#panel:not(.hide)) #hotbar:not(.lw-free) { margin-left: 0; left: max(calc(var(--rail, 56px) + var(--pw, 430px) + 12px), calc(50% - 310px)); }
body:has(#panel.wide:not(.hide)) #hotbar:not(.lw-free) { left: max(calc(var(--rail, 56px) + var(--pwide, 620px) + 12px), calc(50% - 310px)); }

.hb-g svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
/* update 20: thumbnails, families, hangars */
img.ico { display: inline-block; vertical-align: middle; flex: none; image-rendering: auto; border-radius: 4px; }
.famtag { font-size: 10px; padding: 1px 6px; border: 1px solid; border-radius: 9px; letter-spacing: .04em; white-space: nowrap; }
.need .ico { margin-right: 3px; margin-left: 2px; vertical-align: -5px; }
.needs { display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--mono); font-size: 11px; margin: 3px 0; }
.needs > span { display: inline-flex; align-items: center; gap: 3px; } .needs .ok { color: var(--green); } .needs .no { color: var(--red); }
.fampick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-top: 6px; }
.fampick .fam { display: flex; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line); background: #08121e; cursor: pointer; text-align: left; color: inherit; font: inherit; }
.fampick .fam.on { border-color: var(--gold); background: #1a1708; } .fampick .fam:disabled { opacity: .5; cursor: default; }
.fampick .fam small { display: block; color: #7b95aa; font-size: 10.5px; line-height: 1.25; }

/* ---- floating panel windows (detached side panels) ---- */
#panel header .wb, .fwin header .wb { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 6px; line-height: 1; }
#panel header .wb:hover, .fwin header .wb:hover { color: var(--cyan); } .fwin header .wb.x:hover { color: var(--red); }
.fwin { position: fixed; z-index: 41; display: flex; flex-direction: column; background: color-mix(in srgb, var(--panel) calc(var(--wa, 100) * 1%), transparent); border: 1px solid var(--line2); box-shadow: 0 10px 40px rgba(0,0,0,.65); overflow: hidden; min-width: 260px; min-height: 30px; }
.fwin.top { border-color: var(--cyan); box-shadow: 0 12px 46px rgba(0,0,0,.75), 0 0 0 1px rgba(79,209,255,.25); }
.fwin header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(79,209,255,.12), transparent); cursor: grab; user-select: none; touch-action: none; }
.fwin.moving header { cursor: grabbing; } .fwin header h2 { font-size: 14px; flex: 1; } .fwin header .grip { color: var(--muted); font-size: 12px; }
.fwin .bodies { flex: 1; min-height: 0; display: flex; flex-direction: column; } .fwin .body { overflow: auto; padding: 12px 14px 24px; flex: 1; min-height: 0; }
.railghost.detach { border-color: var(--gold) !important; color: var(--gold) !important; }
@media (max-width: 700px) { #panel header .wb.dk { display: none; } }
.statpanel .bar2 { height: 6px; background: #10202e; border-radius: 2px; } .statpanel .bar2 i { display: block; height: 100%; border-radius: 2px; } .statpanel table th.click { cursor: pointer; }

/* hangar command card: the production queue as RTS-style tiles */
.hq { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hq .qt { position: relative; width: 38px; height: 38px; border: 1px solid var(--line2); background: #0a1626; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hq .qt:hover { border-color: var(--red); } .hq .qt.wait { opacity: .55; } .hq .qt.run { border-color: var(--gold); }
.hq .qt .qn { position: absolute; right: 2px; top: 0; font: 700 10px var(--mono, monospace); color: var(--cyan); }
.hq .qt .qb { position: absolute; left: 2px; right: 2px; bottom: 2px; height: 3px; background: #1a2a3c; } .hq .qt .qb s { display: block; height: 100%; background: var(--gold); }
.hq .qt .qx { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; background: rgba(40,8,12,.82); color: #ff8a94; font-size: 16px; }
.hq .qt:hover .qx { display: flex; }
/* hover cards (update 29) */
#hcard { position: fixed; z-index: 60; display: none; pointer-events: none; width: 330px; max-width: calc(100vw - 16px); background: linear-gradient(180deg, rgba(14,26,42,.98), rgba(6,12,22,.98)); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.65), 0 0 0 1px rgba(95,200,255,.08), 0 0 24px rgba(60,150,255,.08); font-size: 12px; color: #d3e6f5; }
.hc { padding: 10px 12px 10px; }
.hc-head { display: flex; gap: 10px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 7px; }
.hc-ico { width: 52px; height: 52px; flex: 0 0 52px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: radial-gradient(circle at 50% 40%, rgba(80,170,255,.22), rgba(8,16,28,.9)); border: 1px solid var(--line); font-size: 28px; }
.hc-title { font-size: 14px; font-weight: 700; color: #fff; }
.hc-tag { display: inline-block; margin-top: 3px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line2); border-radius: 9px; padding: 0 7px; color: var(--cyan); }
.hc-desc { color: #bcd3e6; line-height: 1.4; margin-bottom: 6px; }
.hc-why { color: #9fb9cd; line-height: 1.4; margin-bottom: 6px; font-size: 11.5px; }
.hc-why b { color: var(--gold, #f5c04a); font-weight: 600; }
.hc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin: 4px 0 6px; }
.hc-st { display: flex; justify-content: space-between; border-bottom: 1px dotted #14283c; padding: 1px 0; }
.hc-l { color: var(--muted); } .hc-v { font-family: ui-monospace, monospace; color: #e6f3ff; } .hc-v.good { color: #5be3a0; } .hc-v.bad { color: #ff7b8a; } .hc-v.gold { color: #f5c04a; }
.hc-sec { margin: 8px 0 3px; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.hc-req { position: relative; display: grid; grid-template-columns: 20px 1fr auto 16px; align-items: center; gap: 6px; padding: 2px 0; }
.hc-req .hc-bar { grid-column: 1 / 5; height: 3px; background: #10202e; border-radius: 2px; overflow: hidden; margin-top: 1px; } .hc-req .hc-bar i { display: block; height: 100%; background: #5be3a0; }
.hc-req.no .hc-bar i { background: #ff5b6b; } .hc-req.no .hc-rv, .hc-req.no .hc-ck { color: #ff7b8a; } .hc-req.ok .hc-rv, .hc-req.ok .hc-ck { color: #5be3a0; }
.hc-rv { font-family: ui-monospace, monospace; font-size: 11px; } .hc-dot { width: 8px; height: 8px; border-radius: 50%; background: #35506a; margin: 0 6px; }
.hc-status { margin-top: 8px; padding: 6px 10px; border-radius: 5px; text-align: left; font-weight: 600; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.hc-status.ok { background: rgba(60,200,140,.14); color: #5be3a0; border: 1px solid rgba(60,200,140,.4); } .hc-status.no { background: rgba(255,90,110,.12); color: #ff8a97; border: 1px solid rgba(255,90,110,.4); }
.card .why { margin: 4px 0 2px; font-size: 11.5px; color: #9fb9cd; line-height: 1.4; } .card .why b { color: #f5c04a; font-weight: 600; }
/* factory picker (update 29) */
.fpick { position: fixed; inset: 0; z-index: 55; background: rgba(2,6,12,.6); display: flex; align-items: center; justify-content: center; }
.fp-win { width: min(760px, 94vw); max-height: 82vh; display: flex; flex-direction: column; background: linear-gradient(180deg,#0e1a2a,#070d17); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 16px 60px rgba(0,0,0,.7); }
.fp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fp-search { width: 150px; background: #0a1522; border: 1px solid var(--line); color: #dff; border-radius: 5px; padding: 3px 7px; }
.fp-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.fp-tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none; padding: 6px 12px; border-radius: 6px 6px 0 0; cursor: pointer; } .fp-tab.on { color: #fff; background: #12263a; border-color: var(--line2); }
.fp-n { margin-left: 6px; font-size: 10px; opacity: .7; }
.fp-body { overflow: auto; padding: 6px 12px 12px; }
.fp-fam { margin: 12px 0 5px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 7px; }
.fp-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; background: #0c1829; border: 1px solid var(--line); border-radius: 8px; color: #cfe3f3; cursor: pointer; }
.fp-cell:hover { border-color: #3aa7ff; background: #11233a; box-shadow: 0 0 12px rgba(60,160,255,.25); }
.fp-cell.cur { border-color: #f5a54a; box-shadow: 0 0 0 1px #f5a54a inset; } .fp-cell.lock { opacity: .4; filter: grayscale(.8); cursor: not-allowed; } .fp-cell.short .fp-name { color: #f5a54a; }
.fp-name { font-size: 11px; text-align: center; line-height: 1.15; } .fp-tag { position: absolute; top: 3px; right: 4px; font-size: 9px; font-style: normal; text-transform: uppercase; color: #f5a54a; }
.fp-foot { padding: 7px 12px; border-top: 1px solid var(--line); font-size: 11px; }
.fprod { display: flex; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #0b1624; cursor: pointer; width: 100%; text-align: left; color: #dbeaf7; } .fprod:hover { border-color: #3aa7ff; }
.fprod .fp-big { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle,#1b3550,#0a1522); border-radius: 8px; }
/* research tree (update 29) */
.rt-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(circle at 20% 30%, #0e1d30, #060c16); margin: 6px 0 10px; max-height: 470px; }
.rt-in { position: relative; } .rt-svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.rt-node { position: absolute; box-sizing: border-box; padding: 5px 7px; background: linear-gradient(180deg,#0f1f33,#0a1422); border: 1px solid var(--line2); border-left: 3px solid var(--bc); border-radius: 7px; cursor: pointer; color: #d6e8f6; overflow: hidden; transition: transform .1s, box-shadow .15s; }
.rt-node:hover { transform: translateY(-1px); box-shadow: 0 0 14px rgba(80,170,255,.3); border-color: #5ab8ff; }
.rt-node.sel { box-shadow: 0 0 0 2px #f5c04a inset, 0 0 16px rgba(245,192,74,.3); }
.rt-node.lock { opacity: .5; filter: grayscale(.6); } .rt-node.open { box-shadow: 0 0 10px color-mix(in srgb, var(--bc) 45%, transparent); } .rt-node.max { background: linear-gradient(180deg,#2a2410,#14110a); border-color: #f5c04a; }
.rt-node.busy { animation: rtpulse 1.4s ease-in-out infinite; } @keyframes rtpulse { 50% { box-shadow: 0 0 16px var(--bc); } }
.rt-top { display: flex; align-items: center; gap: 5px; } .rt-nm { font-size: 11px; font-weight: 600; line-height: 1.1; flex: 1; } .rt-lk { font-size: 10px; }
.rt-pips { display: flex; gap: 2px; margin: 4px 0 2px; } .rt-pips i { flex: 1; height: 4px; background: #10202e; border: 1px solid var(--line); max-width: 10px; } .rt-pips i.on { border-color: transparent; }
.rt-sub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; margin-top: 6px; }
.rt-bigwin { width: min(1240px, 97vw); max-height: 92vh; } .rt-bigbody { overflow: auto; padding: 10px 12px; }
.rt-split { display: flex; gap: 12px; align-items: flex-start; } .rt-wrap.big { max-height: none; flex: 1 1 auto; min-width: 0; overflow: auto; } .rt-side { flex: 0 0 360px; max-height: 70vh; overflow: auto; }

/* research tree v2 (update 33): one node per level */
.rl-node { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 7px; background: #0b1624; border: 1px solid var(--line2); color: #7f97ab; cursor: pointer; line-height: 1.05; }
.rl-node b { font-size: 13px; } .rl-node small { font-size: 9px; min-height: 10px; }
.rl-node:hover { border-color: #5ab8ff; transform: translateY(-1px); box-shadow: 0 0 12px rgba(80,170,255,.3); }
.rl-node.done { background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 38%, #0b1624), #0b1624); border-color: var(--bc); color: #fff; }
.rl-node.open { border-color: var(--bc); color: #e6f4ff; box-shadow: 0 0 10px color-mix(in srgb, var(--bc) 50%, transparent); }
.rl-node.lock { opacity: .6; border-style: dashed; } .rl-node.far { opacity: .38; }
.rl-node.busy { border-color: #f5c04a; color: #f5c04a; animation: rtpulse 1.4s ease-in-out infinite; }
.rl-node.pre { box-shadow: 0 0 0 2px #f5c04a; opacity: 1; } .rl-node.dep { box-shadow: 0 0 0 2px #5be3a0; opacity: 1; }
.rl-node.sel { box-shadow: 0 0 0 2px #fff, 0 0 16px rgba(245,192,74,.5); opacity: 1; }
.rl-lane { position: absolute; left: 6px; width: 130px; display: flex; align-items: center; gap: 6px; padding: 0 6px; border-radius: 7px; border-left: 3px solid var(--bc); background: #0a1422; cursor: pointer; box-sizing: border-box; }
.rl-lane.sel { background: #14304a; } .rl-nm { font-size: 11px; font-weight: 600; flex: 1; line-height: 1.1; color: #d6e8f6; } .rl-lv { font-size: 10px; color: var(--muted); }
.rl-branch { position: absolute; left: 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; opacity: .9; }
.rl-col { position: absolute; top: 3px; text-align: center; font-size: 10px; color: #44607a; }

/* ---------- update 34: window frame (tabs, edge resize, snap zones) ---------- */
.fwin header .tabs { flex: 1; min-width: 0; display: flex; gap: 2px; overflow: hidden; align-items: stretch; }
.fwin header h2.tab { flex: 0 1 auto; font-size: 13px; display: flex; align-items: center; gap: 4px; padding: 2px 8px; min-width: 0; white-space: nowrap; border-bottom: 2px solid transparent; }
.fwin header h2.tab .tt { overflow: hidden; text-overflow: ellipsis; }
.fwin:not(.tabbed) header h2.tab { padding: 0; flex: 1; }
.fwin.tabbed header h2.tab { cursor: pointer; color: var(--muted); background: rgba(255,255,255,.03); border: 1px solid transparent; border-bottom: 2px solid transparent; }
.fwin.tabbed header h2.tab:hover { color: var(--text); }
.fwin.tabbed header h2.tab.on { color: var(--cyan); border-bottom-color: var(--cyan); background: rgba(79,209,255,.1); }
.fwin header .tx { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; } .fwin header .tx:hover { color: var(--red); }
.fwin header .wb.on { color: var(--gold); }
.fwin.min .bodies, .fwin.min .rz:not(.e):not(.w) { display: none; } .fwin.min { min-height: 0; }
.fwin.max { border-color: var(--line2); } .fwin.max .rz { display: none; }
.fwin.dropt { outline: 2px dashed var(--gold); outline-offset: -2px; } .fwin.dropt header { background: rgba(245,192,74,.25); }
.fwin header.dropin { background: rgba(245,192,74,.18); }
.tabghost { position: fixed; z-index: 70; pointer-events: none; padding: 3px 10px; background: #0e1c30; border: 1px solid var(--gold); color: var(--gold); font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.6); }
.fwin .rz { position: absolute; z-index: 5; touch-action: none; }
.fwin .rz.n { left: 10px; right: 10px; top: 0; height: 5px; cursor: ns-resize; } .fwin .rz.s { left: 10px; right: 10px; bottom: 0; height: 6px; cursor: ns-resize; }
.fwin .rz.e { top: 10px; bottom: 10px; right: 0; width: 6px; cursor: ew-resize; } .fwin .rz.w { top: 10px; bottom: 10px; left: 0; width: 5px; cursor: ew-resize; }
.fwin .rz.ne { right: 0; top: 0; width: 12px; height: 12px; cursor: nesw-resize; } .fwin .rz.nw { left: 0; top: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.fwin .rz.se { right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; } .fwin .rz.sw { left: 0; bottom: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.fwin .rz.se::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid var(--line2); border-bottom: 2px solid var(--line2); opacity: .8; }
.fwin.top .rz.se::after { border-color: var(--cyan); }
.fwin.sizing, .fwin.moving { box-shadow: 0 16px 56px rgba(0,0,0,.8), 0 0 0 1px rgba(79,209,255,.4); }
body.lw-dragging { user-select: none; cursor: grabbing; } body.lw-dragging iframe { pointer-events: none; }
.lw-guides { position: fixed; inset: 0; z-index: 69; pointer-events: none; } .lw-guides .g { position: absolute; background: rgba(245,192,74,.85); box-shadow: 0 0 6px rgba(245,192,74,.7); }
.lw-guides .g.x { top: 0; bottom: 0; width: 1px; } .lw-guides .g.y { left: 0; right: 0; height: 1px; }
.lw-zone { position: fixed; z-index: 68; pointer-events: none; border: 2px solid var(--cyan); background: rgba(79,209,255,.14); border-radius: 6px; transition: all .08s; }

/* ---------- update 34: layout widgets (layout.js) ---------- */
:root { --tb: 52px; --rail: 56px; }
.lw-free { position: fixed !important; right: auto !important; bottom: auto !important; margin: 0 !important; transform: none !important; max-width: none !important; box-sizing: border-box; z-index: 8 !important; }
.lw-free:not(#hotbar):not(.hlist):not(#fleetbar):not(#planetbar) { max-height: none !important; }
.lw-hidden { display: none !important; }
#topbar.lw-bare, #hud.lw-bare { background: none !important; border: 0 !important; box-shadow: none !important; pointer-events: none; }
#topbar.lw-bare > *:not(.lw-free):not(.logo), #hud.lw-bare > *:not(.lw-free):not(.hgrip) { display: none !important; }
#topbar.lw-bare .logo { display: none; }
#topbar > .lw-free, #hud > .lw-free { pointer-events: auto; }
#hud.lw-empty { background: none !important; border: 0 !important; box-shadow: none !important; pointer-events: none; } #hud.lw-empty .hgrip { display: none; }
#hud.lw-free { display: grid; }
.lw-free.res, .lw-free#badges, .lw-free#nextup, .lw-free#clock, .lw-free#tools, .lw-free#groups { background: rgba(5,10,20,.9); border: 1px solid var(--line); padding: 3px 8px; }
.lw-free#clock { margin: 0 !important; } .lw-free#groups { display: flex; }
.lw-free#hotbar .hb-row { flex-wrap: wrap; }
.lw-free#feed { background: transparent; }
.lw-free#minimap, .mmslot.lw-free { background: rgba(5,10,20,.9); border: 1px solid var(--line2); }
#sel.lw-free, #cmd.lw-free { background: linear-gradient(180deg, rgba(8,15,27,.95), rgba(3,7,14,.985)); border: 1px solid var(--line2); box-shadow: 0 6px 24px rgba(0,0,0,.55); overflow: auto; }
#rail.lw-free { overflow: auto; border: 1px solid var(--line2); }
#rail.lw-h { flex-direction: row; padding-top: 0; padding-left: 6px; } #rail.lw-h button { width: 52px; height: auto; min-height: 52px; flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; } #rail.lw-h button.on { border-bottom-color: var(--cyan); } #rail.lw-h .sp { flex: 1; }
.lw-free .fblist { max-height: none; }
/* arrange mode */
body.lw-edit #map { cursor: default; }
#lw-shield { position: absolute; inset: 0; z-index: 39; background-color: rgba(4,10,20,.35); cursor: default; }
#lw-ovl { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.lw-ov { position: fixed; border: 1px dashed rgba(79,209,255,.75); background: rgba(79,209,255,.07); pointer-events: auto; cursor: move; box-sizing: border-box; touch-action: none; }
.lw-ov.free { border-style: solid; border-color: var(--gold); background: rgba(245,192,74,.07); }
.lw-ov:hover, .lw-ov.act { background: rgba(79,209,255,.16); } .lw-ov.free:hover, .lw-ov.free.act { background: rgba(245,192,74,.16); }
.lw-ov .lw-lb { position: absolute; left: -1px; top: -19px; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; background: #0b1a2a; color: var(--cyan); border: 1px solid rgba(79,209,255,.75); white-space: nowrap; pointer-events: none; }
.lw-ov.free .lw-lb { color: var(--gold); border-color: var(--gold); }
.lw-ov.flip .lw-lb { top: 1px; left: 1px; }
.lw-ov .lw-bts { position: absolute; right: 2px; top: 2px; display: flex; gap: 2px; z-index: 3; }
.lw-ov.small .lw-bts { right: -1px; top: auto; bottom: -19px; }
.lw-ov .lw-bt { background: #0b1a2a; border: 1px solid var(--line2); color: var(--muted); width: 18px; height: 18px; font-size: 11px; line-height: 1; padding: 0; cursor: pointer; } .lw-ov .lw-bt:hover { color: var(--cyan); border-color: var(--cyan); }
.lw-rz { position: absolute; z-index: 2; } .lw-rz::after { content: ''; position: absolute; background: var(--cyan); opacity: 0; transition: opacity .1s; } .lw-ov:hover .lw-rz::after { opacity: .7; } .lw-ov.free .lw-rz::after { background: var(--gold); }
.lw-rz.n { left: 8px; right: 8px; top: -4px; height: 8px; cursor: ns-resize; } .lw-rz.n::after, .lw-rz.s::after { left: 0; right: 0; top: 3px; height: 2px; }
.lw-rz.s { left: 8px; right: 8px; bottom: -4px; height: 8px; cursor: ns-resize; }
.lw-rz.e { top: 8px; bottom: 8px; right: -4px; width: 8px; cursor: ew-resize; } .lw-rz.e::after, .lw-rz.w::after { top: 0; bottom: 0; left: 3px; width: 2px; }
.lw-rz.w { top: 8px; bottom: 8px; left: -4px; width: 8px; cursor: ew-resize; }
.lw-rz.ne, .lw-rz.nw, .lw-rz.se, .lw-rz.sw { width: 12px; height: 12px; } .lw-rz.ne::after, .lw-rz.nw::after, .lw-rz.se::after, .lw-rz.sw::after { left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; }
.lw-rz.ne { right: -5px; top: -5px; cursor: nesw-resize; } .lw-rz.nw { left: -5px; top: -5px; cursor: nwse-resize; } .lw-rz.se { right: -5px; bottom: -5px; cursor: nwse-resize; } .lw-rz.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
#lw-bar { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 62; max-width: calc(100vw - 24px); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 8px 14px; background: rgba(8,16,30,.97); border: 1px solid var(--cyan); box-shadow: 0 10px 40px rgba(0,0,0,.7); font-size: 12px; }
#lw-bar b { color: var(--cyan); } #lw-bar .lwb-f { display: flex; align-items: center; gap: 5px; color: var(--muted); } #lw-bar select { background: #0a1626; color: var(--text); border: 1px solid var(--line2); }
#lw-bar .lwb-hid { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pgrip { position: absolute; top: 0; bottom: 0; right: -3px; width: 8px; cursor: ew-resize; z-index: 6; touch-action: none; } .pgrip:hover, body.lw-dragging .pgrip { background: linear-gradient(90deg, transparent, rgba(79,209,255,.35)); }
#panel { overflow: visible; } @media (max-width: 700px) { .pgrip { display: none; } }
/* diplomacy: negotiation table */
.between { justify-content: space-between; } .no { color: var(--red); font-size: 12px; }
.warn-box { border: 1px solid #7a5d17; background: rgba(245,192,74,.08); color: var(--gold); padding: 6px 10px; margin-bottom: 8px; font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.neg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 8px; } @media (max-width: 760px) { .neg-grid { grid-template-columns: 1fr; } }
.neg-side { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(20,40,64,.55), rgba(8,16,28,.7)); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.neg-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: .12em; border-bottom: 1px solid var(--line); padding-bottom: 4px; } .neg-head b { letter-spacing: 0; font-size: 13px; color: var(--text); }
.ic-idc { color: var(--gold); font-size: 16px; width: 20px; text-align: center; }
.neg-goods { display: flex; flex-direction: column; gap: 3px; } .neg-good { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border: 1px solid var(--line); background: rgba(6,12,20,.5); } .neg-good.short { border-color: #7a2a33; background: rgba(122,42,51,.15); }
.neg-terms { margin-bottom: 8px; } .neg-sum { border-color: #2c6b8f; } .neg-deal { margin-bottom: 6px; }
.neg-side { min-width: 0; } .neg-side input[type=number].grow { min-width: 0; width: 0; } .neg-side select.grow { min-width: 0; } .neg-good > span.grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .neg-side .neg-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

/* update 53: scroll bars in the game's look: a dark channel with a cyan-edged thumb, glowing on hover */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 9px; height: 9px; background: transparent; }
  ::-webkit-scrollbar-track { background: rgba(6, 13, 24, .85); border-left: 1px solid var(--line); box-shadow: inset 0 0 6px rgba(0, 0, 0, .7); }
  ::-webkit-scrollbar-track:horizontal { border-left: 0; border-top: 1px solid var(--line); }
  ::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #17314a, #24506f); border: 1px solid var(--line2); border-radius: 0; box-shadow: inset 0 0 4px rgba(79, 209, 255, .25); min-height: 28px; min-width: 28px; }
  ::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, #1f4466, #2f6f99); border-color: var(--cyan); box-shadow: 0 0 6px rgba(79, 209, 255, .55), inset 0 0 5px rgba(79, 209, 255, .45); }
  ::-webkit-scrollbar-thumb:active { background: #3a86b5; border-color: #8fe3ff; }
  ::-webkit-scrollbar-corner { background: rgba(6, 13, 24, .95); }
}
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--line2) #060d18; } }

/* research tree v3 (update 51): a real tree - one card per technology, bands per branch, arrows between them */
.rt-wrap.tt { max-height: 560px; background: radial-gradient(circle at 15% 20%, #0f2036, #050a13); }
.tt-band { position: absolute; left: 6px; right: 6px; border-radius: 10px; background: color-mix(in srgb, var(--bc) 7%, transparent); border: 1px solid color-mix(in srgb, var(--bc) 22%, transparent); pointer-events: none; }
.tt-bl { position: absolute; left: 10px; top: 3px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--bc); }
.tt-col { position: absolute; top: 4px; text-align: center; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: #5f7a91; pointer-events: none; }
.tt-n { position: absolute; box-sizing: border-box; padding: 5px 8px 4px; border-radius: 9px; background: linear-gradient(180deg, #0f1f33, #09131f); border: 1px solid var(--line2); border-left: 4px solid var(--bc); color: #c9deef; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; transition: transform .1s, box-shadow .15s; }
.tt-n:hover { transform: translateY(-1px); border-color: #5ab8ff; border-left-color: var(--bc); box-shadow: 0 0 14px rgba(80,170,255,.3); }
.tt-top { display: flex; align-items: center; gap: 7px; } .tt-nm { flex: 1; font-size: 12px; font-weight: 600; line-height: 1.1; min-width: 0; } .tt-lv { font-size: 10px; color: var(--muted); }
.tt-pips { display: flex; gap: 2px; } .tt-pips i { flex: 1; max-width: 12px; height: 5px; background: #10202e; border: 1px solid var(--line); } .tt-pips i.on { background: var(--bc); border-color: transparent; } .tt-pips i.busy { border-color: #f5c04a; animation: rtpulse 1.4s ease-in-out infinite; }
.tt-sub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-n.open { color: #eaf6ff; box-shadow: 0 0 10px color-mix(in srgb, var(--bc) 55%, transparent); border-color: color-mix(in srgb, var(--bc) 60%, #0b1624); } .tt-n.open .tt-sub { color: #8fe3b7; }
.tt-n.done { background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 30%, #0b1624), #09131f); border-color: var(--bc); color: #fff; } .tt-n.done .tt-sub { color: #f5d98a; }
.tt-n.lock { opacity: .55; filter: grayscale(.55); border-style: dashed; border-left-style: solid; }
.tt-n.busy { border-color: #f5c04a; color: #ffe9b0; animation: rtpulse 1.4s ease-in-out infinite; } .tt-n.busy .tt-sub { color: #f5c04a; }
.tt-n.pre { box-shadow: 0 0 0 2px #f5c04a; opacity: 1; filter: none; } .tt-n.dep { box-shadow: 0 0 0 2px #5be3a0; opacity: 1; filter: none; }
.tt-n.sel { box-shadow: 0 0 0 2px #fff, 0 0 16px rgba(245,192,74,.5); opacity: 1; filter: none; }

/* update 55: Quick trade, the simplified Exchange ticker */
.xt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.xt-search { flex: 0 1 190px; min-width: 120px; background: rgba(6,13,24,.9); border: 1px solid var(--line2); color: var(--text); padding: 5px 9px; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.xt-search:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 8px rgba(79,209,255,.35); }
.xt-hint { font-size: 11px; margin-left: auto; }
.xt-wrap { container-type: inline-size; }
.xt-list { display: flex; flex-direction: column; gap: 3px; }
.xt-row { display: grid; grid-template-columns: minmax(104px, 1.4fr) 68px 88px minmax(70px, 110px) 124px 84px; align-items: center; gap: 8px; padding: 4px 10px 4px 12px; position: relative;
  background: linear-gradient(90deg, rgba(14,28,48,.92), rgba(9,18,32,.9)); border: 1px solid var(--line); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.xt-row::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: var(--fam, var(--cyan)); box-shadow: 0 0 8px var(--fam, var(--cyan)); opacity: .85; }
.xt-row:not(.xt-head):hover { border-color: var(--line2); background: linear-gradient(90deg, rgba(20,40,66,.95), rgba(12,24,42,.92)); }
.xt-head { background: none; border: 0; clip-path: none; padding-top: 0; padding-bottom: 2px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); position: sticky; top: -1px; z-index: 2; background: var(--panel); }
.xt-head::before { display: none; }
.xt-row .n { text-align: right; } .xt-row .c { text-align: center; }
.xt-tier { display: flex; align-items: center; gap: 10px; margin: 10px 0 3px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.xt-tier i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line2), transparent); }
.xt-good { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.xt-name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; } .xt-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .xt-name small { font-size: 10px; }
.xt-good:hover b { color: var(--cyan); }
.xt-hold, .xt-px { display: flex; flex-direction: column; line-height: 1.2; align-items: flex-end; } .xt-hold small, .xt-px small { font-size: 10px; min-height: 12px; }
.xt-px b { font-size: 15px; }
.xt-px small.xt-dl { white-space: nowrap; text-align: right; }   /* update 75: "→ 0.41 delivered (reference)" on two lines */
.xt-row.up .xt-px b { color: #bff5d8; } .xt-row.down .xt-px b { color: #ffc3ca; }
.xt-spark { display: block; max-width: 100%; }
.xt-qty { display: flex; flex-direction: column; gap: 1px; align-items: stretch; }
.xt-step { display: flex; align-items: stretch; border: 1px solid var(--line2); background: rgba(5,11,20,.9); }
.xt-b { width: 26px; border: 0; background: rgba(36,80,111,.45); color: var(--cyan); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.xt-b:hover { background: rgba(79,209,255,.25); }
.xt-q { width: 100%; min-width: 0; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: transparent; color: var(--text); text-align: center; font-family: var(--mono); padding: 3px 2px; -moz-appearance: textfield; }
.xt-q::-webkit-outer-spin-button, .xt-q::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.xt-q:focus { outline: none; background: rgba(79,209,255,.08); }
.xt-cost { font-size: 10px; text-align: center; color: var(--muted); min-height: 12px; } .xt-cost.red { color: var(--red); }
.xt-go { display: flex; gap: 4px; }
.xt-buy, .xt-sell { flex: 1; border: 1px solid; padding: 4px 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; background: rgba(8,16,28,.9); }
.xt-buy { color: var(--green); border-color: #2c7a5a; } .xt-buy:hover { background: rgba(91,227,160,.16); box-shadow: 0 0 8px rgba(91,227,160,.3); }
.xt-sell { color: var(--gold); border-color: #8a6b25; } .xt-sell:hover:not(:disabled) { background: rgba(245,192,74,.16); box-shadow: 0 0 8px rgba(245,192,74,.3); }
.xt-sell:disabled { opacity: .35; cursor: default; }
@container (max-width: 640px) { .xt-row { grid-template-columns: minmax(100px, 1.4fr) 66px 84px 124px 82px; } .xt-row .xt-sp, .xt-head span:nth-child(4) { display: none; } }
@container (max-width: 520px) { .xt-row { grid-template-columns: minmax(90px, 1fr) 62px 80px 112px; } .xt-go { grid-column: 1 / -1; } .xt-head span:nth-child(6) { display: none; } .xt-name small { display: none; } }
/* update 54: Imperial demand (Empire panel) */
#imperial-demand details.demcat { margin-top: 4px; border-top: 1px solid #12253a; } #imperial-demand details.demcat > summary { cursor: pointer; padding: 4px 2px; list-style: none; font-size: 12px; } #imperial-demand details.demcat > summary::-webkit-details-marker { display: none; }
#imperial-demand details.demcat > summary::before { content: '▸ '; color: var(--muted); } #imperial-demand details.demcat[open] > summary::before { content: '▾ '; }
#imperial-demand .demtbl th { position: static; } #imperial-demand .demtbl tr.click { cursor: pointer; } #imperial-demand .demtbl tr.click:hover { background: rgba(120,190,255,.08); }
/* update 61: territory toggle on the minimap */
#minimap .mmtools button.mm-terr { color: var(--muted, #7f93aa); }
#minimap .mmtools button.mm-terr.on { color: var(--cyan, #4fd1ff); border-color: var(--cyan, #4fd1ff); }

/* update 62: admin pause banner */
#pausebar { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 60; padding: 8px 18px; border-radius: 8px; background: rgba(60, 20, 8, .92); border: 1px solid #ffb04f; color: #ffd9a3; font-size: 13px; box-shadow: 0 0 24px rgba(255, 140, 40, .35); pointer-events: none; animation: pausepulse 2.4s ease-in-out infinite; }
#pausebar b { letter-spacing: .14em; margin-right: 8px; color: #ffb04f; }
@keyframes pausepulse { 50% { box-shadow: 0 0 34px rgba(255, 140, 40, .6); } }

/* update 94: factory panel = production lines + list of producible goods */
.fl-wrap { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; align-items: flex-start; }
.fl-left { flex: 1 1 560px; min-width: 300px; display: flex; flex-direction: column; gap: 6px; }
.fl-right { flex: 1 1 520px; min-width: 320px; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--line); padding-left: 12px; }
.fl-lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 5px; }
.fl-line { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #0a1626; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.fl-line:hover { border-color: #3aa7ff; } .fl-line.armed { border-color: #f5a54a; box-shadow: 0 0 0 1px #f5a54a inset; background: #101c2c; } .fl-line.free { opacity: .8; }
.fl-line.act .fl-bar i { background: #5fd38d; }
.fl-no { width: 20px; height: 20px; border-radius: 50%; background: #16263b; color: #9fc3d9; display: flex; align-items: center; justify-content: center; font-size: 11px; flex: none; } .fl-line.armed .fl-no { background: #f5a54a; color: #1a1205; }
.fl-ico { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; flex: none; font-size: 18px; opacity: .9; }
.fl-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; } .fl-mid b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-st { font-size: 11px; color: #f5a54a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .fl-st.bad { color: #ff7d6b; }
.fl-bar { height: 4px; margin: 0; }
.fl-btns { display: flex; flex-direction: column; gap: 3px; flex: none; }
.fl-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .fl-search { background: #0a1522; border: 1px solid var(--line); color: #dff; border-radius: 5px; padding: 4px 8px; width: 170px; } .fl-lock { font-size: 11px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.fl-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); } .fl-tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none; padding: 5px 11px; border-radius: 6px 6px 0 0; cursor: pointer; } .fl-tab.on { color: #fff; background: #10213a; border-color: var(--line2); }
.fl-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .fl-qty { width: 92px; } 
.fl-list { display: flex; flex-direction: column; gap: 3px; max-height: 190px; overflow: auto; padding-right: 4px; }
.fl-row { display: flex; align-items: center; gap: 9px; padding: 4px 8px; background: #0c1829; border: 1px solid var(--line); border-radius: 6px; color: #dfeaf5; cursor: pointer; text-align: left; font: inherit; }
.fl-row:hover:not(:disabled) { border-color: #3aa7ff; background: #11233a; } .fl-row.on { border-color: #f5a54a55; } .fl-row.lock { opacity: .4; cursor: not-allowed; filter: grayscale(.7); }
.fl-dot { width: 8px; height: 8px; border-radius: 50%; background: #5fd38d; flex: none; } .fl-row.short .fl-dot { background: #f5a54a; } .fl-row.lock .fl-dot { background: #5b6877; }
.fl-nm { flex: 0 0 170px; display: flex; flex-direction: column; line-height: 1.15; position: relative; } .fl-nm small { font-size: 10px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; } .fl-nm .fp-tag { position: static; margin-top: 1px; }
.fl-ins { flex: 1; display: flex; gap: 8px; flex-wrap: wrap; } .fl-in { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: #9fd8b3; } .fl-in em { font-style: normal; } .fl-in.lack { color: #f59a6a; }
.fl-t { font-size: 11px; color: #9fc3d9; width: 48px; text-align: right; flex: none; } .fl-have { width: 52px; text-align: right; font-size: 12px; flex: none; display: flex; flex-direction: column; line-height: 1.1; } .fl-have small { font-size: 9px; color: var(--muted); text-transform: uppercase; }

/* update 94: production details popup */
.fd-win { width: min(1180px, 96vw); max-height: 88vh; } .fd-body { overflow: auto; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.fd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; } .fd-tile { background: #0a1626; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; display: flex; flex-direction: column; } .fd-tile small { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); } .fd-tile b { font-size: 16px; color: #dff3ff; } .fd-tile em { font-style: normal; font-size: 11px; color: #9fc3d9; }
.fd-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: #9fc3d9; margin-top: 4px; }
.fd-scroll { overflow-x: auto; } .fd-tbl { width: 100%; border-collapse: collapse; font-size: 12px; } .fd-tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; } .fd-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; } .fd-tbl tr.act td { background: rgba(95,211,141,.06); } .fd-tbl tr.free td { opacity: .55; } .fd-tbl .bad, .fd-rate .bad { color: #ff8a7a; }
.fd-prod { display: flex; align-items: center; gap: 7px; white-space: nowrap; } .fd-bar { height: 3px; margin: 3px 0 0; min-width: 90px; } .fd-ins { display: flex; flex-wrap: wrap; gap: 7px; } .fd-in { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: #9fd8b3; } .fd-in em { font-style: normal; } .fd-in small { color: var(--muted); } .fd-in.lack, .fd-in.lack small { color: #f59a6a; }
.fd-jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; } .fd-job { display: flex; align-items: center; gap: 8px; background: #0a1626; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; } .fd-job.act { border-color: rgba(95,211,141,.5); } .fd-job span { display: flex; flex-direction: column; } .fd-job small { color: var(--muted); font-size: 10px; }
.fd-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; } .fd-rate { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 12px; } .fd-rate span { flex: 1; } .fd-rate small { color: var(--muted); }

/* update 97: research advisors */
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin-top: 6px; }
.adv-col { border: 1px solid color-mix(in srgb, var(--ac) 45%, #10202e); border-top: 3px solid var(--ac); background: rgba(8,16,28,.7); padding: 6px 8px; min-width: 0; }
.adv-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.adv-tag { font: 700 11px/1 var(--mono, monospace); letter-spacing: .12em; color: #06101c; background: var(--ac); padding: 5px 6px; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.adv-rec { padding: 5px 0; border-top: 1px solid #12253a; } .adv-why { font-size: 12px; color: #b9cde0; margin: 2px 0; } .adv-tip { font-size: 11px; color: #8fb4d4; font-style: italic; margin-top: 4px; }
.tt-n.adv::after { content: '★'; position: absolute; top: 2px; right: 4px; font-size: 12px; color: #f5c04a; text-shadow: 0 0 6px rgba(245,192,74,.8); pointer-events: none; }
.tt-n.dim { opacity: .28; filter: grayscale(.7); }

/* ---- Automations (update 97): chains, switch, stock keeper tiles, library ---- */
.au-chain { margin: 6px 0 2px; border-left: 2px solid var(--line2); padding-left: 8px; }
.au-step { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; position: relative; }
.au-step.next::before { content: ''; position: absolute; left: 7px; top: -6px; height: 8px; border-left: 1px dashed var(--cyan); }
.au-n { color: var(--cyan); font-size: 16px; line-height: 1.1; width: 20px; flex: none; text-align: center; }
.au-body { flex: 1; min-width: 0; font-size: 12px; }
.au-gate { color: var(--gold); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1px; }
.au-if { color: #9fc3d9; font-size: 11px; }
.au-sc { flex: none; } .au-sc.fleets { color: var(--cyan); border-color: #1f5a73; } .au-sc.planets { color: var(--green); border-color: #1f6a4b; } .au-sc.empire { color: var(--gold); border-color: #7a5d17; }
.au-sw { display: inline-flex; align-items: center; gap: 6px; background: #0a1424; border: 1px solid var(--line2); border-radius: 12px; padding: 2px 4px; width: 38px; height: 20px; cursor: pointer; color: var(--muted); }
.au-sw i { width: 14px; height: 14px; border-radius: 50%; background: #3b566e; transition: transform .15s, background .15s; display: block; }
.au-sw.on { border-color: #1f6a4b; background: #0d2a22; } .au-sw.on i { transform: translateX(18px); background: var(--green); }
.au-sw.big { width: auto; height: 26px; padding: 3px 10px 3px 4px; border-radius: 14px; font-size: 11px; letter-spacing: .06em; } .au-sw.big.on { color: var(--green); } .au-sw.big.on i { transform: none; }
.card.auto-card.off { opacity: .6; }
.au-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; } .au-lib .card { margin: 0; }
.au-mini { font-size: 10.5px; color: #9fb9cd; line-height: 1.5; border-left: 2px solid var(--line); padding-left: 6px; }
.au-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px; margin: 6px 0; }
.au-tile { background: var(--panel2); border: 1px solid var(--line); padding: 6px 8px; min-height: 52px; } .au-tile:hover { border-color: var(--line2); }
.au-tile.on { border-color: var(--gold); box-shadow: inset 0 0 12px rgba(245,192,74,.10); }
.au-nm { font-size: 12px; } .au-st { font-size: 10.5px; margin-top: 3px; }
.au-edit { border-left: 3px solid var(--cyan); } .au-cond { margin: 4px 0 8px; }

/* ---- update 97: busy buttons (a command is on its way) ---- */
.btn.busy { opacity: .65; cursor: progress; position: relative; }
.btn.busy::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btnspin .7s linear infinite; vertical-align: -1px; }
@keyframes btnspin { to { transform: rotate(360deg); } }

/* update 97: economy juice, research cards, away reveal (client/js/juice.js) */
.res .v.dn { animation: vdn .7s ease-out; } @keyframes vdn { 0% { color: var(--red); text-shadow: 0 0 8px rgba(255,91,107,.8); } 100% { } }
.jf { position: fixed; z-index: 60; transform: translateX(-50%); pointer-events: none; font: 600 14px var(--mono); white-space: nowrap; animation: jfloat 1.6s ease-out forwards; text-shadow: 0 1px 6px #000; }
.jf.up { color: var(--green); } .jf.dn { color: var(--red); }
@keyframes jfloat { 0% { opacity: 0; transform: translate(-50%, -4px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 30px); } }
#toasts div.jt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; animation: slide .25s ease-out; }
.jchip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); color: var(--gold); }
#rcards { position: fixed; left: 50%; bottom: 300px; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.rcard { pointer-events: auto; cursor: pointer; display: flex; gap: 12px; align-items: center; min-width: 300px; max-width: 460px; padding: 10px 16px; background: linear-gradient(180deg, rgba(20,34,58,.97), rgba(8,14,26,.97)); border: 1px solid var(--gold); box-shadow: 0 0 24px rgba(245,192,74,.35), 0 6px 24px rgba(0,0,0,.7); animation: rcin .45s cubic-bezier(.2,1.3,.4,1); }
.rcard.out { animation: rcout .35s ease-in forwards; }
.rc-t { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); } .rc-n { font-size: 16px; font-weight: 600; margin: 1px 0 2px; } .rc-d { font-size: 12px; color: var(--muted); }
@keyframes rcin { from { opacity: 0; transform: translateY(24px) scale(.92); } to { opacity: 1; transform: none; } } @keyframes rcout { to { opacity: 0; transform: translateY(10px); } }
.aw-tile.rv, .aw-line.rv { opacity: 0; animation: awin .45s ease-out forwards; }
@keyframes awin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .jf, .rcard, .aw-tile.rv, .aw-line.rv { animation-duration: .01s !important; } }

/* update 97: attack arrows at the screen edge (combatfx.js) */
#atkarrows{position:fixed;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:40;overflow:hidden}
.atk-arrow{position:absolute;left:0;top:0;width:0;height:0;pointer-events:auto;cursor:pointer;will-change:transform}
.atk-arrow .atk-tri{position:absolute;left:-11px;top:-11px;width:22px;height:22px;display:block;transform-origin:50% 50%}
.atk-arrow .atk-tri::before{content:"";position:absolute;left:0;top:0;width:22px;height:22px;background:#ff4d5e;clip-path:polygon(100% 50%,15% 8%,35% 50%,15% 92%);filter:drop-shadow(0 0 5px rgba(255,77,94,.9));animation:atkpulse 1s ease-in-out infinite}
.atk-arrow .atk-lb{position:absolute;top:-8px;white-space:nowrap;font:600 11px/16px "Segoe UI",sans-serif;color:#ffd0d4;text-shadow:0 1px 2px #000,0 0 6px rgba(255,77,94,.6);background:rgba(20,6,10,.55);padding:0 6px;border-radius:8px}
@keyframes atkpulse{0%,100%{opacity:.65;transform:scale(.9)}50%{opacity:1;transform:scale(1.1)}}
/* update 98: raw-resource icons in the top bar */
.res .res-ico { flex: none; width: 26px; height: 26px; filter: drop-shadow(0 0 3px rgba(120,190,255,.35)); }
.res { gap: 8px; }
