:root {
  --bg: #04070b;
  --bg2: #070c12;
  --panel: rgba(8, 13, 19, 0.94);
  --panel-solid: #0a1018;
  --raise: rgba(255, 255, 255, 0.035);
  --raise2: rgba(255, 255, 255, 0.07);
  --line: rgba(150, 180, 210, 0.14);
  --line2: rgba(150, 180, 210, 0.26);
  --text: #e8eef4;
  --muted: #94a3b2;
  --dim: #5f6f80;
  --se: #5ec8ff;
  --f2: #ffb31a;
  --f3: #ff4f4f;
  --f4: #b46cff;
  --mo: #ffe14d;
  --good: #59e3a0;
  --bad: #ff6159;
  --accent: var(--f2);
  --display: 'Chakra Petch', 'Barlow', system-ui, sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top: 56px;
  --side: 392px;
  --r: 4px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
[data-faction="3"] { --accent: var(--f3); }
[data-faction="4"] { --accent: var(--f4); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.f2 { --fc: var(--f2); } .f3 { --fc: var(--f3); } .f4 { --fc: var(--f4); } .f1 { --fc: var(--se); }

/* ---------- shared elements ---------- */
.label { font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.num { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line2); background: var(--raise); border-radius: var(--r); transition: background .15s, border-color .15s, color .15s;
}
.btn:hover:not(:disabled) { background: var(--raise2); border-color: rgba(200, 220, 240, .4); }
.btn:disabled { opacity: .42; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0b0b; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 11.5px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r); color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--raise2); }
.icon-btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 3px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--raise); }
.chip svg { width: 13px; height: 13px; }
.bar { height: 6px; background: rgba(255, 255, 255, .08); border-radius: 1px; overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--se); }
.bar.enemy > i { background: var(--fc, var(--accent)); }
.bar.mo > i { background: var(--mo); }
.emblem { width: 22px; height: 22px; color: var(--fc); flex: none; }
.emblem svg { width: 100%; height: 100%; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fc, var(--se)); display: inline-block; flex: none; }

/* ---------- app shell ---------- */
#app { position: fixed; inset: 0; }
.stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.map { position: absolute; inset: 0; touch-action: none; }
.map-svg { width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-svg:active { cursor: grabbing; }

/* top bar */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; height: calc(var(--top) + var(--safe-t)); padding: var(--safe-t) 12px 0;
  display: flex; align-items: center; gap: 14px; z-index: 20;
  background: linear-gradient(180deg, rgba(4, 7, 11, .96) 0%, rgba(4, 7, 11, .82) 100%); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.day { display: flex; flex-direction: column; line-height: 1.05; }
.day b { font-family: var(--display); font-size: 17px; letter-spacing: .06em; }
.day span { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.factions { display: flex; gap: 6px; margin-left: 6px; }
.fchip {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raise); position: relative; transition: border-color .15s, background .15s;
}
.fchip .emblem { width: 22px; height: 22px; }
.fchip .num { font-size: 16px; }
.fchip small { font-size: 11px; color: var(--muted); font-family: var(--display); }
.fchip.active { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, transparent); }
.fchip.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--fc); }
.fchip.out { opacity: .35; }
.sehc { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.stat { display: flex; align-items: center; gap: 7px; color: var(--se); }
.stat svg { width: 16px; height: 16px; }
.stat .num { color: var(--text); font-size: 15px; }
.stat small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-family: var(--display); }

/* Major Order card */
.mo-card {
  position: absolute; left: 12px; top: calc(var(--top) + var(--safe-t) + 12px); width: 330px; z-index: 15;
  background: var(--panel); border: 1px solid rgba(255, 225, 77, .32); border-left: 3px solid var(--mo); border-radius: var(--r);
  padding: 10px 12px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mo-card header { display: flex; align-items: center; gap: 8px; color: var(--mo); padding-right: 26px; }
.mo-card header svg { width: 15px; height: 15px; }
.mo-card header .label { color: var(--mo); }
.mo-card header .when { margin-left: auto; font-family: var(--display); font-size: 12px; color: var(--muted); }
.mo-card h3 { margin: 6px 0 2px; font-family: var(--display); font-size: 15px; letter-spacing: .03em; }
.mo-card p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.mo-card .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; font-family: var(--display); }
.mo-card.collapsed p, .mo-card.collapsed .row { display: none; }
.mo-card.collapsed .bar { height: 3px; margin-top: 2px; }
.mo-card .toggle { position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; }
.mo-card .toggle svg { transition: transform .2s; }
.mo-card.collapsed .toggle svg { transform: rotate(180deg); }

/* targeting banner */
.banner {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--top) + var(--safe-t) + 12px); z-index: 25;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--r);
  background: var(--panel-solid); border: 1px solid var(--accent); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); max-width: calc(100vw - 24px);
}
.banner span { font-family: var(--display); font-size: 13px; letter-spacing: .06em; }

/* map controls */
.map-ctrl { position: absolute; left: 12px; bottom: 16px; z-index: 12; display: flex; flex-direction: column; gap: 4px; }
.map-ctrl .icon-btn { background: var(--panel); border: 1px solid var(--line); }
.legend { position: absolute; left: 64px; bottom: 16px; z-index: 12; display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* side panel */
.side {
  position: absolute; right: 0; top: calc(var(--top) + var(--safe-t)); bottom: 0; width: var(--side); z-index: 18;
  background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; position: relative; }
.tab svg { width: 16px; height: 16px; }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--accent); }
.tab .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #000; font-size: 11px; display: inline-grid; place-items: center; }
.side-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 24px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.side-foot { flex: none; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.endday { flex: 1; min-height: 48px; font-size: 15px; letter-spacing: .16em; }
.orders-count { font-family: var(--display); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* panel content */
.sec { margin-top: 20px; }
.sec:first-child { margin-top: 0; }
.sec > .label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sec > .label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.phead { display: flex; gap: 12px; align-items: flex-start; }
.phead .planet-orb { width: 46px; height: 46px; flex: none; border-radius: 50%; position: relative; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--fc) 80%, white) 0%, var(--fc) 35%, color-mix(in srgb, var(--fc) 30%, black) 100%); box-shadow: 0 0 22px color-mix(in srgb, var(--fc) 40%, transparent); }
.phead .planet-orb.dead { background: radial-gradient(circle at 35% 30%, #555, #111); box-shadow: none; }
.phead h2 { margin: 0; font-family: var(--display); font-size: 22px; line-height: 1.1; letter-spacing: .03em; text-transform: uppercase; }
.phead .sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.phead .sub b { color: var(--fc); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--display); font-weight: 600; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.note.warn { color: var(--bad); }
.poi { border: 1px solid var(--line); border-left: 2px solid var(--fc, var(--se)); padding: 10px 12px; border-radius: var(--r); background: var(--raise); }
.poi h4 { margin: 0 0 4px; font-family: var(--display); font-size: 13.5px; letter-spacing: .06em; text-transform: uppercase; }
.poi p { margin: 0; font-size: 13px; color: var(--muted); }
.progress-block { margin-top: 12px; }
.progress-block .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.progress-block .row b { color: var(--text); font-family: var(--display); }

/* attack rows */
.attack { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--raise); margin-bottom: 10px; }
.attack header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.attack header .name { font-family: var(--display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fc); }
.attack header .res { margin-left: auto; font-family: var(--display); font-size: 13px; color: var(--muted); }
.attack select { width: 100%; height: 36px; margin-bottom: 10px; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 0 8px; font: inherit; font-size: 13.5px; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tier { border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 6px; text-align: center; background: rgba(0, 0, 0, .2); transition: border-color .15s, background .15s; }
.tier:hover:not(:disabled) { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, transparent); }
.tier b { display: block; font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.tier span { display: block; font-family: var(--display); font-size: 15px; color: var(--fc); margin-top: 2px; }
.tier small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.tier:disabled { opacity: .38; }
.attack .why { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* abilities / divisions */
.cards { display: grid; gap: 8px; }
.card { border: 1px solid var(--line); border-radius: var(--r); background: var(--raise); padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.card h4 { margin: 0; font-family: var(--display); font-size: 13.5px; letter-spacing: .05em; text-transform: uppercase; }
.card p { margin: 0; grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.card .meta { font-family: var(--display); font-size: 12px; color: var(--muted); }
.card .meta b { color: var(--fc, var(--accent)); }
.card .act { grid-row: 1 / span 2; grid-column: 2; }
.card.locked { opacity: .65; }
.card .status { grid-column: 1 / -1; font-size: 12px; color: var(--fc); font-family: var(--display); letter-spacing: .04em; }

.inv-list { display: grid; gap: 8px; }
.inv { border: 1px solid var(--line); border-left: 2px solid var(--fc); border-radius: var(--r); padding: 10px 12px; background: var(--raise); cursor: pointer; }
.inv:hover { background: var(--raise2); }
.inv .top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.inv .top b { font-family: var(--display); letter-spacing: .04em; text-transform: uppercase; }
.inv .top .days { margin-left: auto; font-family: var(--display); font-size: 12px; color: var(--muted); }
.inv .bar { margin-top: 8px; }
.inv .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

.planet-list { display: grid; gap: 2px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r); font-size: 13.5px; width: 100%; text-align: left; }
.prow:hover { background: var(--raise2); }
.prow .r { margin-left: auto; font-family: var(--display); font-size: 12px; color: var(--muted); }

.intel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--raise); }
.tile .label { display: flex; align-items: center; gap: 6px; }
.tile .label svg { width: 13px; height: 13px; color: var(--se); }
.tile .num { font-size: 22px; display: block; margin-top: 4px; }
.tile .delta { font-size: 12px; font-family: var(--display); }
.delta.up { color: var(--bad); } .delta.down { color: var(--good); }
.spark { width: 100%; height: 40px; margin-top: 6px; }
.spark path.line { fill: none; stroke: var(--se); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark path.area { fill: var(--se); opacity: .12; }
.transmissions { display: grid; gap: 6px; }
.tx { font-size: 13px; padding: 8px 10px 8px 12px; border-left: 2px solid var(--se); background: rgba(94, 200, 255, .05); border-radius: 0 var(--r) var(--r) 0; }
.tx.gambit { border-left-color: var(--mo); background: rgba(255, 225, 77, .06); }
.tx.abandon { border-left-color: var(--dim); color: var(--muted); }
.tx.blind { border-left-color: var(--f3); }
.tx[data-planet] { cursor: pointer; }
.tx[data-planet]:hover { background: rgba(94, 200, 255, .1); }

.log-day { margin-bottom: 14px; }
.log-day h4 { margin: 0 0 6px; font-family: var(--display); font-size: 12px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.ev { display: flex; gap: 8px; font-size: 13px; padding: 4px 0; align-items: baseline; }
.ev .dot { transform: translateY(-1px); }
.ev.good { color: var(--text); }
.ev.bad { color: #ffb3ad; }

/* ---------- map styling ---------- */
.rim { fill: none; stroke: rgba(130, 170, 210, .12); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sector { fill: transparent; stroke: rgba(140, 175, 210, .13); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; transition: fill .3s; }
.sector.s-o2 { fill: rgba(255, 179, 26, .045); }
.sector.s-o3 { fill: rgba(255, 79, 79, .05); }
.sector.s-o4 { fill: rgba(180, 108, 255, .055); }
.sector.fx { stroke: rgba(220, 220, 255, .35); stroke-dasharray: 4 4; }
.targeting-sector .sector { pointer-events: visiblePainted; }
.targeting-sector .sector.valid { stroke: var(--accent); stroke-opacity: .5; }
.targeting-sector .sector.valid.hover { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke-opacity: 1; }
.sector-label { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: .26em; fill: rgba(160, 185, 210, .26); transform: scale(var(--ss)); pointer-events: none; }
.z0 .sector-label { fill: rgba(160, 185, 210, .2); }
.z3 .sector-label { fill: rgba(160, 185, 210, .16); }
.edge { stroke: rgba(170, 195, 220, .16); stroke-width: 1; vector-effect: non-scaling-stroke; }
.edge.e-o1 { stroke: rgba(94, 200, 255, .26); }
.edge.e-o2 { stroke: rgba(255, 179, 26, .42); }
.edge.e-o3 { stroke: rgba(255, 79, 79, .42); }
.edge.e-o4 { stroke: rgba(180, 108, 255, .45); }
.edge.e-front { stroke: rgba(255, 255, 255, .34); stroke-dasharray: 3 3; }
.edge.e-sel { stroke: rgba(255, 255, 255, .85); stroke-width: 1.6; stroke-dasharray: none; }
.sc { transform: scale(var(--ps)); }
.st { transform: scale(var(--ts)); }
.pl { cursor: pointer; }
.pl-hit { fill: transparent; }
.pl-core { fill: var(--se); stroke: rgba(4, 7, 11, .9); stroke-width: 1.6; transition: fill .3s, opacity .2s; }
.pl.o2 .pl-core { fill: var(--f2); }
.pl.o3 .pl-core { fill: var(--f3); }
.pl.o4 .pl-core { fill: var(--f4); }
.pl.o1 .pl-core { fill: #4aa9db; }
.pl.o0 .pl-core, .pl.dead .pl-core { fill: #1a2028; stroke: #4d5966; stroke-width: 1.2; }
.pl.cut .pl-core { stroke: rgba(255, 255, 255, .7); stroke-dasharray: 2 2; }
.pl-se-ring { fill: none; stroke: var(--se); stroke-width: 1.4; opacity: .8; }
.pl[data-id="0"] .pl-core { fill: #8fdcff; }
.pl.hover .pl-core, .pl.sel .pl-core { stroke: #fff; stroke-width: 2; }
.pl.dim { opacity: .28; }
.pl.valid .pl-core { stroke: #fff; stroke-width: 2; }
.pl.valid .pl-hit { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 1.4; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { stroke-opacity: .25; fill-opacity: .4; } }
.sel-ring { fill: none; stroke: #fff; stroke-width: 1.4; stroke-dasharray: 3 3; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hex { fill: none; stroke-width: 1.5; }
.hex.f2 { stroke: var(--f2); } .hex.f3 { stroke: var(--f3); } .hex.f4 { stroke: var(--f4); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 2.6; }
.ring-lib { fill: none; stroke: var(--se); stroke-width: 2.6; stroke-linecap: butt; }
.ring-def { fill: none; stroke: var(--se); stroke-width: 2.6; }
.atk-ring { fill: none; stroke-width: 5; opacity: .35; animation: throb 1.6s ease-in-out infinite; }
.atk-ring.f2 { stroke: var(--f2); } .atk-ring.f3 { stroke: var(--f3); } .atk-ring.f4 { stroke: var(--f4); }
@keyframes throb { 50% { opacity: .1; } }
.timer { font-family: var(--display); font-size: 8.5px; font-weight: 700; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .85); stroke-width: 2.5px; }
.div-mark { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.div-mark.f2 { stroke: var(--f2); } .div-mark.f3 { stroke: var(--f3); } .div-mark.f4 { stroke: var(--f4); }
.fort-mark rect { fill: rgba(255, 255, 255, .75); }
.se-mark path { fill: none; stroke: var(--se); stroke-width: 1.3; }
.poi-dot { fill: #fff; }
.city-seg { fill: none; stroke: var(--se); stroke-width: 3.2; }
.city-seg.fallen { stroke: #3a434d; }
.city-seg.atk { animation: throb 1.2s ease-in-out infinite; }
.city-seg.atk.f2 { stroke: var(--f2); } .city-seg.atk.f3 { stroke: var(--f3); } .city-seg.atk.f4 { stroke: var(--f4); }
.dss ellipse { fill: none; stroke: #dff4ff; stroke-width: 1.2; }
.dss circle { fill: #dff4ff; }
.dss.storm circle, .dss.blockade circle, .dss.ordnance circle { fill: var(--mo); }
.mo-mark { fill: none; stroke: var(--mo); stroke-width: 1.8; }
.flash { fill: none; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: flash 1.1s ease-out 3; }
.flash.good { stroke: var(--accent); }
.flash.bad { stroke: var(--se); }
@keyframes flash { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
.tip { position: fixed; z-index: 30; pointer-events: none; padding: 8px 10px; border-radius: var(--r); background: rgba(8, 13, 19, .96); border: 1px solid var(--line2); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-size: 12.5px; min-width: 150px; transform: translate(14px, -50%); }
.tip b { display: block; font-family: var(--display); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.tip span { display: block; color: var(--muted); }
.tip .o { color: var(--fc); }
.gambit-ring { fill: none; stroke: var(--mo); stroke-width: 1.4; stroke-dasharray: 2 3; animation: spin 6s linear infinite reverse; }
.arrow { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-dasharray: 7 5; animation: march 1s linear infinite; }
.arrow.f2 { stroke: var(--f2); } .arrow.f3 { stroke: var(--f3); } .arrow.f4 { stroke: var(--f4); }
.arrow.warp { stroke-dasharray: 2 5; stroke-linecap: round; }
.arrow-head.f2 { fill: var(--f2); } .arrow-head.f3 { fill: var(--f3); } .arrow-head.f4 { fill: var(--f4); }
@keyframes march { to { stroke-dashoffset: -12; } }
.lbl { pointer-events: none; display: none; }
.lbl.on { display: block; }
.lbl-name { font-family: var(--display); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; fill: rgba(225, 235, 245, .82); paint-order: stroke; stroke: rgba(4, 7, 11, .9); stroke-width: 3px; }
.lbl-divers { font-family: var(--display); font-size: 9.5px; font-weight: 600; fill: var(--se); paint-order: stroke; stroke: rgba(4, 7, 11, .9); stroke-width: 3px; display: none; }
.lbl.dv .lbl-divers { display: block; }
.lbl.sel .lbl-name { fill: #fff; }

/* ---------- overlays & screens ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(2, 4, 7, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: rise .25s ease; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal header { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal header h2 { margin: 0; font-family: var(--display); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.modal header .icon-btn { margin-left: auto; }
.modal .body { padding: 16px 20px; overflow-y: auto; }
.modal footer { padding: 14px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.report-group { margin-bottom: 16px; }
.report-group:last-child { margin-bottom: 0; }
.report-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.report-stats .tile { text-align: center; padding: 8px 6px; }
.report-stats .tile .num { font-size: 20px; }

.screen { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: radial-gradient(ellipse at 50% 40%, rgba(30, 60, 90, .3), transparent 60%), rgba(3, 5, 8, .88); }
.screen-inner { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(32px + var(--safe-t)) 20px calc(32px + var(--safe-b)); }
.title-emblems { display: flex; gap: 22px; margin-bottom: 26px; }
.title-emblems .emblem { width: 44px; height: 44px; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--fc) 60%, transparent)); }
.title { font-family: var(--display); font-weight: 700; font-size: clamp(34px, 7.5vw, 76px); line-height: .95; letter-spacing: .08em; text-align: center; margin: 0; text-transform: uppercase; }
.title em { font-style: normal; display: block; font-size: max(12px, .22em); letter-spacing: .36em; color: var(--muted); margin-bottom: 18px; padding-left: .36em; font-weight: 600; }
.tagline { margin: 18px 0 34px; color: var(--muted); text-align: center; max-width: 460px; font-size: 15.5px; }
.menu { display: grid; gap: 10px; width: min(320px, 100%); }
.menu .btn { min-height: 50px; font-size: 14px; }
.fineprint { margin-top: 40px; font-size: 12px; color: var(--dim); text-align: center; max-width: 520px; }

.setup { width: min(920px, 100%); }
.setup h2 { font-family: var(--display); font-size: 26px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 22px; text-align: center; }
.setup .group { margin-bottom: 24px; }
.setup .group > .label { margin-bottom: 10px; display: block; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: repeat(2, 1fr); }
.opts.four { grid-template-columns: repeat(4, 1fr); }
.opts.three { grid-template-columns: repeat(3, 1fr); }
.opt { text-align: left; border: 1px solid var(--line2); border-radius: var(--r); padding: 14px; background: rgba(9, 14, 21, .9); transition: border-color .15s, background .15s; position: relative; }
.opt:hover { background: rgba(18, 26, 36, .95); }
.opt[aria-pressed="true"] { border-color: var(--f2); background: linear-gradient(rgba(255, 179, 26, .09), rgba(255, 179, 26, .09)), rgba(9, 14, 21, .94); box-shadow: inset 0 0 0 1px var(--f2); }
.opt h3 { margin: 0 0 4px; padding-right: 30px; font-family: var(--display); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.opt .lvl { position: absolute; right: 12px; top: 12px; font-family: var(--display); font-size: 12px; color: var(--muted); }
.opt p { margin: 0; font-size: 13px; color: var(--muted); }
.opt .when { font-family: var(--display); font-size: 12px; color: var(--f2); letter-spacing: .08em; margin-bottom: 6px; display: block; }
.setup .actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.setup .actions .btn { min-width: 160px; min-height: 50px; }

.guide { width: min(720px, 100%); }
.guide h2 { font-family: var(--display); font-size: 26px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 18px; }
.guide h3 { font-family: var(--display); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; margin: 22px 0 6px; color: var(--f2); }
.guide p, .guide li { color: #c3cfda; font-size: 15px; }
.guide ul { padding-left: 18px; margin: 6px 0; }
.guide li { margin: 4px 0; }

.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(560px, 100%); margin: 6px 0 30px; }
.end-stats .tile { text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 80; padding: 10px 16px; border-radius: var(--r); background: var(--panel-solid); border: 1px solid var(--line2); font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: rise .2s ease; max-width: calc(100vw - 32px); }
.toast.bad { border-color: var(--bad); }

.bottomnav, .sheet-handle { display: none; }

/* ---------- tablet & mobile ---------- */
@media (max-width: 1100px) {
  :root { --side: 350px; }
  .sehc .stat:nth-child(3) { display: none; }
}
@media (max-width: 860px) {
  :root { --top: 52px; }
  .topbar { gap: 8px; padding-left: 8px; padding-right: 4px; }
  .brand .day span { display: none; }
  .brand-mark { display: none; }
  .factions { margin-left: 0; gap: 4px; flex: 1; justify-content: center; }
  .fchip { height: 38px; padding: 0 8px 0 6px; gap: 5px; }
  .fchip small { display: none; }
  .fchip .num { font-size: 15px; }
  .sehc { margin-left: 0; gap: 0; }
  .sehc .stat { display: none; }
  .mo-card { left: 8px; right: 8px; width: auto; top: calc(var(--top) + var(--safe-t) + 8px); padding: 8px 40px 8px 10px; }
  .mo-card h3 { font-size: 14px; margin-top: 2px; }
  .legend { display: none; }
  .map-ctrl { left: auto; right: 8px; bottom: calc(68px + var(--safe-b) + 8px); }
  .banner { top: auto; bottom: calc(68px + var(--safe-b) + 10px); }

  .side {
    top: auto; left: 0; right: 0; width: auto; bottom: calc(60px + var(--safe-b)); height: min(68dvh, 620px); border-left: 0; border-top: 1px solid var(--line2);
    border-radius: 12px 12px 0 0; transform: translateY(calc(100% + 80px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -16px 50px rgba(0, 0, 0, .5);
  }
  .side.open { transform: none; }
  .side.peek { transform: translateY(calc(100% - 172px)); }
  .side .tabs { display: none; }
  .side-foot { display: none; }
  .sheet-handle { display: flex; justify-content: center; align-items: center; height: 26px; flex: none; cursor: grab; touch-action: none; }
  .sheet-handle::before { content: ''; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); }
  .side-body { padding-top: 4px; }
  .phead .planet-orb { width: 36px; height: 36px; }
  .phead h2 { font-size: 20px; }
  .bottomnav {
    display: flex; position: absolute; left: 0; right: 0; bottom: 0; z-index: 22; height: calc(60px + var(--safe-b)); padding: 6px 8px var(--safe-b);
    background: rgba(4, 7, 11, .97); border-top: 1px solid var(--line); gap: 4px; align-items: center;
  }
  .bottomnav .nav { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 48px; justify-content: center; color: var(--muted); font-family: var(--display); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; border-radius: var(--r); position: relative; }
  .bottomnav .nav svg { width: 20px; height: 20px; }
  .bottomnav .nav.active { color: var(--text); }
  .bottomnav .nav .badge { position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #000; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .bottomnav .endday { flex: 1.5; min-height: 46px; font-size: 13px; letter-spacing: .12em; }
  .opts.four { grid-template-columns: repeat(2, 1fr); }
  .report-stats { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: calc(100dvh - 24px); }
}
@media (max-width: 520px) {
  .opts.two, .opts.three, .opts.four { grid-template-columns: 1fr; }
  .end-stats { grid-template-columns: repeat(2, 1fr); }
  .overlay { padding: 8px; align-items: end; }
  .modal { width: 100%; border-radius: 10px 10px 6px 6px; }
  .day b { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
