/* SPEACEWAR client — "Hull & Signal" (06 §1). Tokens on :root; dark theme only (06 §1.2 rule 5). */
:root {
  --faction-ashen: #C8432B; --faction-veyra: #2BB3A8; --faction-hollow: #8E5BD6;
  --zone-neutral: #8A8F98; --npc-custodian: #6B7F2A;
  --bg-void: #0D1015; --surface-1: #161A21; --surface-2: #1E232B; --line: #2D333D;
  --text-1: #E8E2D4; --text-2: #9BA1AA; --signal-warn: #E3A72F;
  --font-head: "Chakra Petch", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", "IBM Plex Sans", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, monospace;
  --cut: 6px; --tab-h: 60px; --top-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; margin: 0; height: 100%; background: var(--bg-void); color: var(--text-1); font: 15px/1.5 var(--font-body); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; }
h1, h2, h3, .head { font-family: var(--font-head); font-weight: 600; letter-spacing: .02em; margin: 0; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.num, .mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.warn { color: var(--signal-warn); }
.small { font-size: 12px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- app shell (06 §3.2 mobile first, §3.1 desktop rail) ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; }
.topbar { padding: calc(6px + var(--safe-t)) 10px 6px; background: var(--surface-1); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.res-row { min-width: 0; display: flex; gap: 4px 10px; align-items: center; flex-wrap: wrap; }
.res-row::-webkit-scrollbar { display: none; }
.res { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; font-family: var(--font-num); font-size: 14px; }
.res .ico { width: 16px; height: 16px; }
.res.full { color: var(--signal-warn); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; white-space: nowrap; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.chip.warn { border-color: var(--signal-warn); color: var(--signal-warn); }
.safe-chip { margin-left: auto; cursor: pointer; min-height: 28px; }
main { min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 12px 12px calc(16px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface-1); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 5; }
.tab { min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; color: var(--text-2); font-size: 12px; cursor: pointer; position: relative; }
.tab .ico { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text-1); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--text-1); }
.tab .badge { position: absolute; top: 6px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; background: var(--signal-warn); color: #111; font: 600 11px/16px var(--font-num); text-align: center; }
@media (min-width: 1024px) {
  .shell { grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar { grid-column: 1 / 3; }
  .tabbar { grid-row: 2; grid-column: 1; grid-template-columns: 1fr; grid-auto-rows: 72px; border-top: 0; border-right: 1px solid var(--line); align-content: start; }
  main { grid-column: 2; padding: 20px 28px; }
  .screen { max-width: 980px; margin: 0 auto; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ---------- panels (flat, 1px line, cut corners, no shadow/gradient/glow — 06 §1.1) ---------- */
.panel { background: var(--surface-1); border: 1px solid var(--line); padding: 12px; margin-bottom: 12px; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.panel.raised { background: var(--surface-2); }
.panel h2, .panel h3 { margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.screen-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.screen-head h1 { flex: 1; }
.subtabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.subtabs button { flex: none; }
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--text-1); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 14px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; text-align: right; font-family: var(--font-num); }
.cost { display: inline-flex; flex-wrap: wrap; gap: 6px; font-family: var(--font-num); font-size: 13px; }
.cost .short { color: var(--signal-warn); }
.empty { color: var(--text-2); text-align: center; padding: 24px 8px; }

/* ---------- controls (tap targets ≥ 44px — 06 §3.2) ---------- */
.btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--text-1); background: transparent; color: var(--text-1); font-family: var(--font-head); font-weight: 600; letter-spacing: .03em; cursor: pointer; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.btn.primary { background: var(--text-1); color: var(--bg-void); }
.btn.ghost { border-color: var(--line); }
.btn.small { min-height: 36px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--signal-warn); outline-offset: 2px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line); cursor: pointer; }
.why { font-size: 12px; color: var(--signal-warn); margin-top: 4px; }
input, select { min-height: 44px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-1); padding: 0 10px; font: 15px var(--font-num); width: 100%; }
label.field { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
label.field > span { display: block; margin-bottom: 4px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.stepper button { width: 40px; height: 40px; background: var(--surface-2); border: 0; cursor: pointer; font-size: 18px; }
.stepper output { min-width: 40px; text-align: center; font-family: var(--font-num); }

/* ---------- faction marks (faction colors only for factions — 06 §1.2 rule 1) ---------- */
.fac { display: inline-flex; align-items: center; gap: 6px; }
.fac i { width: 12px; height: 12px; display: inline-block; }
.fac.ashen i { background: var(--faction-ashen); } .fac.veyra i { background: var(--faction-veyra); } .fac.hollow i { background: var(--faction-hollow); }
.fac.neutral i { border: 2px solid var(--zone-neutral); border-radius: 50%; }
.infl { display: flex; height: 12px; border: 1px solid var(--line); overflow: hidden; }
.infl > span { height: 100%; }
.infl .mine { outline: 1px solid var(--text-1); outline-offset: -1px; }

/* ---------- bottom sheet ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(13,16,21,.6); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto; background: var(--surface-1); border-top: 1px solid var(--text-1); z-index: 21; padding: 8px 14px calc(16px + var(--safe-b)); transform: translateY(0); transition: transform .15s ease-out; }
.sheet .grab { width: 40px; height: 4px; background: var(--line); margin: 4px auto 10px; }
@media (min-width: 1024px) { .sheet { left: auto; right: 24px; bottom: 24px; width: 420px; border: 1px solid var(--text-1); } }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px + var(--safe-b)); z-index: 40; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--text-1); padding: 8px 12px; font-size: 14px; animation: toast-in .15s ease-out; }
.toast.warn { border-left-color: var(--signal-warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- landing / onboarding ---------- */
.splash, .landing { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.logo { font: 600 34px/1 var(--font-head); letter-spacing: .12em; }
.landing .play { min-width: 220px; min-height: 56px; font-size: 18px; }
.cards { display: grid; gap: 10px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { text-align: left; }
.card .glyph { width: 40px; height: 40px; }
.cinematic { position: fixed; inset: 0; background: var(--bg-void); z-index: 30; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; }
.cinematic .ship { animation: launch 3.6s ease-in forwards; }
@keyframes launch { 0% { transform: translateY(40vh); } 60% { transform: translateY(0); } 100% { transform: translateY(-60vh); } }

/* ---------- Mother Ship cutaway: vertical, bow up, Modules stacked as decks (06 §4.3, portrait first) ---------- */
.cutaway { position: relative; max-width: 420px; margin: 0 auto 12px; padding: 54px 18px 40px; background: var(--surface-1); border: 1px solid var(--line);
  clip-path: polygon(50% 0, 100% 44px, 100% calc(100% - 22px), 82% 100%, 18% 100%, 0 calc(100% - 22px), 0 44px);
  background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 16px; }
.cutaway .bow, .cutaway .stern { position: absolute; left: 0; right: 0; text-align: center; font: 11px var(--font-num); color: var(--text-2); letter-spacing: .2em; }
.cutaway .bow { top: 24px; } .cutaway .stern { bottom: 10px; }
.deck { display: flex; flex-direction: column; gap: 4px; position: relative; }
.deck::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1px; background: repeating-linear-gradient(180deg, var(--text-1) 0 8px, transparent 8px 16px); opacity: .25; animation: flowv 1.2s linear infinite; }
@keyframes flowv { from { background-position: 0 0; } to { background-position: 0 16px; } }
.cell { position: relative; z-index: 1; min-width: 0; width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; color: var(--text-1); min-height: 44px; }
.cell .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .art-box { width: 40px; display: flex; justify-content: center; align-items: center; flex: none; }
.cell.free { background: transparent; border-style: dashed; color: var(--text-2); justify-content: center; }
.cell.busy::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--signal-warn); }
.cell.off { opacity: .55; }
.cell .lv { font-family: var(--font-num); font-size: 13px; color: var(--text-2); }
.cell svg.art { width: 24px; height: 24px; }
img.art, .sprite { image-rendering: pixelated; }
.actionbar { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 0 4px; background: linear-gradient(transparent, var(--bg-void) 30%); }
.actionbar .btn { flex: 1 1 auto; white-space: nowrap; font-size: 13px; padding: 0 10px; }
.lineup .line { border-left: 2px solid var(--line); padding-left: 10px; margin-bottom: 8px; }
.lineup .line-name { font: 600 11px var(--font-head); letter-spacing: .08em; color: var(--text-2); text-transform: uppercase; margin-bottom: 2px; }
.lineup .ship-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.lineup .ship-row .name { flex: 1; }
/* ---------- galaxy map ---------- */
.map-wrap { position: relative; height: calc(100dvh - var(--top-h) - var(--tab-h) - 90px); min-height: 320px; background: var(--bg-void); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
.map-wrap svg { width: 100%; height: 100%; display: block; }
.map-tools { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.map-tools .icon-btn { background: var(--surface-1); }
.lane { stroke: var(--line); stroke-width: 1.2; } .lane.gate { stroke: var(--text-2); stroke-dasharray: 4 3; }
.sys { cursor: pointer; } .sys text { fill: var(--text-2); font: 10px var(--font-num); }
.planet-dot { cursor: pointer; }

/* ---------- tutorial overlay (06 §4.10.1: dim, highlighted target, finger, bubble, skip) ---------- */
.tut-block { position: fixed; background: rgba(13,16,21,.78); z-index: 50; }
.tut-ring { position: fixed; z-index: 51; border: 2px solid var(--signal-warn); pointer-events: none; }
.tut-ring.pulse { animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 50% { outline: 6px solid rgba(227,167,47,.25); } }
.tut-finger { position: fixed; display: block; z-index: 52; width: 36px; height: 36px; pointer-events: none; animation: tap 1.1s ease-in-out infinite; }
@keyframes tap { 50% { transform: translate(-4px, -6px); } }
.tut-bubble { position: fixed; z-index: 53; left: 12px; right: 12px; max-width: 440px; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--signal-warn); padding: 12px; font-size: 15px; }
.tut-bubble .row { margin-top: 10px; }
.tut-step { font: 12px var(--font-num); color: var(--signal-warn); }
.tut-bubble.compact { padding: 8px 10px; font-size: 14px; }
.tut-bubble.compact .row { margin-top: 6px; }
.tut-bubble.compact .skip-all, .tut-bubble.compact .small.warn { display: none; }
@media (prefers-reduced-motion: reduce) { .deck::before, .tut-finger, .tut-ring.pulse, .power-flow, .cinematic .ship, .toast { animation: none !important; } }
html.reduced .deck::before, html.reduced .tut-finger, html.reduced .tut-ring.pulse, html.reduced .power-flow, html.reduced .cinematic .ship { animation: none !important; }

/* ---------- Commander's Path ---------- */
.path li { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.path .tick { width: 20px; height: 20px; border: 1px solid var(--text-2); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.path .done .tick { background: var(--text-1); color: var(--bg-void); border-color: var(--text-1); }
.path .done .t { color: var(--text-2); text-decoration: line-through; }

/* ---------- Decision Panel (06 §3.4) ---------- */
.decision { display: grid; grid-template-columns: 72px 1fr; gap: 6px 10px; font-size: 14px; }
.decision dt { font: 600 12px var(--font-head); color: var(--text-2); padding-top: 2px; }
.decision dd { margin: 0; font-family: var(--font-num); }
.tier { display: inline-flex; gap: 2px; vertical-align: middle; } .tier i { width: 10px; height: 10px; border: 1px solid var(--text-1); } .tier i.on { background: var(--text-1); }
.tier.hi i.on { background: var(--signal-warn); border-color: var(--signal-warn); }

/* ---------- book ---------- */
.book { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; font-family: var(--font-num); font-size: 13px; }
.book table { width: 100%; border-collapse: collapse; } .book td { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.book th { font: 600 12px var(--font-head); color: var(--text-2); text-align: right; padding: 3px 4px; }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
.tile { min-height: 84px; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 12px; text-align: left; background: var(--surface-1); border: 1px solid var(--line); cursor: pointer; color: var(--text-1); }
.tile .ico { width: 24px; height: 24px; }
html:has(.shell), html:has(.shell) body { overflow: hidden; } /* the shell scrolls inside main only */

/* tutorial-v2: story cards, mission cards, two-line bubble */
.story-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); }
.story { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.story .row { text-align: left; }
.story-art { display: flex; justify-content: center; align-items: center; min-height: 120px; }
.story-text { font-size: 16px; line-height: 1.55; white-space: pre-line; color: var(--text-1, inherit); }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 8px; height: 8px; background: var(--surface-3, #2D333D); display: block; }
.dots i.on { background: var(--signal-warn); }
.tut-dim { position: fixed; inset: 0; z-index: 52; background: rgba(5, 7, 10, .72); }
.tut-card { position: fixed; z-index: 54; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); max-width: 440px; margin: 0 auto; max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--surface-2); border: 1px solid var(--signal-warn); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.tut-card p { margin: 0; line-height: 1.5; }
.tut-card .skip-all { align-self: center; }
.tut-do { font-weight: 600; }
.tut-why { margin-top: 4px; font-size: 13px; color: var(--text-2, #9BA1AA); line-height: 1.45; }
.tut-bubble.compact .tut-why { display: none; }

/* ================= Mother Ship hero view (owner 2026-11-15: "show a real Mother Ship") ================= */
.ship-screen .screen-head .chip { font-family: var(--font-num); }
.ms-meters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.ms-meter { min-width: 0; font-size: 13px; }
.ms-meter b { font-weight: 600; }
.ms-meter .bar { height: 8px; margin-top: 3px; }
.ms-meter .bar > i { background: linear-gradient(90deg, #6FD3C8, #E8E2D4); }
.ms-meter.warn { color: var(--signal-warn); }
.ms-meter.warn .bar > i { background: var(--signal-warn); }
.ms-slots { white-space: nowrap; padding-bottom: 1px; }
.ms-space { position: relative; display: flex; flex-direction: column; align-items: center; margin: 0 -12px 10px; padding: 6px 4px 8px; overflow: hidden;
  background: radial-gradient(ellipse 70% 45% at 50% 40%, rgba(43,179,168,.14), transparent 70%), radial-gradient(ellipse 60% 40% at 20% 90%, rgba(142,91,214,.16), transparent 70%), linear-gradient(180deg, #070A10, #0B0F18 60%, #070A10);
  background-size: cover; background-position: center; }
.ms-stars { position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 78% 12%, #cfe3ff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 30% 72%, #fff3d8 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 64%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 56% 88%, #cfe3ff 50%, transparent 51%), radial-gradient(1px 1px at 6% 52%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 34%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 90%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 40% 8%, #fff 50%, transparent 51%);
  background-size: 180px 220px; }
.ms-stage { position: relative; flex: none; max-width: 100%; }
.ms-hull { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)); }
.ms-hull svg, .ms-hull .ms-hull-svg { width: 100%; height: 100%; display: block; }
img.ms-hull { object-fit: contain; image-rendering: auto; }
.ms-engine { position: absolute; display: flex; justify-content: space-around; align-items: flex-start; pointer-events: none; transform-origin: top; animation: ms-engine 2.4s ease-in-out infinite; }
.ms-engine i { width: 34%; height: 100%; border-radius: 50% 50% 45% 45%; background: radial-gradient(ellipse at 50% 15%, #FFF6D8 0 12%, #F2C14E 28%, rgba(242,120,40,.55) 52%, rgba(242,120,40,0) 75%); }
@keyframes ms-engine { 0%, 100% { opacity: .75; transform: scaleY(.92); } 50% { opacity: 1; transform: scaleY(1.08); } }
.ms-light { position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #FF5A4E; box-shadow: 0 0 6px 2px rgba(255,90,78,.7); pointer-events: none; animation: ms-blink 1.8s steps(1) infinite; }
.ms-light.alt { background: #7CF2E6; box-shadow: 0 0 6px 2px rgba(124,242,230,.7); }
@keyframes ms-blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .15; } }
.ms-room { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px 3px; min-width: 0; overflow: hidden;
  background: linear-gradient(180deg, rgba(30,38,50,.92), rgba(16,20,28,.92)); border: 1px solid rgba(160,190,220,.35); color: var(--text-1); cursor: pointer;
  border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 10px 18px rgba(124,242,230,.05); transition: transform .12s ease-out, border-color .12s; }
.ms-room:hover { border-color: var(--accent, #2BB3A8); }
.ms-room:focus-visible { outline: 2px solid var(--signal-warn); outline-offset: 1px; }
.ms-room:active { transform: scale(.95); }
.ms-room.tapped { animation: ms-tap .3s ease-out; }
@keyframes ms-tap { 0% { box-shadow: 0 0 0 0 rgba(232,226,212,.7); } 100% { box-shadow: 0 0 0 10px rgba(232,226,212,0); } }
.ms-room .ic { display: flex; align-items: center; justify-content: center; height: 55%; max-height: 32px; min-height: 0; }
.ms-room .ic > * { max-height: 100%; }
.ms-room .nm { font-size: 11px; line-height: 1.15; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.ms-room .lv { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; line-height: 16px; text-align: center; color: #0D1015; background: var(--text-1); border-radius: 3px; }
.ms-room .pip { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; border: 1.5px solid var(--signal-warn); background: #1E232B; display: flex; align-items: flex-end; justify-content: center; }
.ms-room .job { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 10px; color: var(--signal-warn); background: rgba(10,12,16,.82); line-height: 18px; }
.ms-room .job.wait { color: var(--text-2); }
.ms-room.busy { border-color: var(--signal-warn); }
.ms-room.off { opacity: .5; }
.ms-room.bridge { border-color: var(--accent, #2BB3A8); background: linear-gradient(180deg, rgba(26,62,64,.95), rgba(14,24,30,.95)); }
.ms-room.tiled { background: #0D1015; }
.ms-room .tile { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .85; }
.ms-room.tiled .ic { display: none; }
.ms-room.empty { background: rgba(10,14,20,.55); border: 1.5px dashed rgba(124,242,230,.55); color: #9FE9E0; }
.ms-room.empty .plus { font: 600 20px/1 var(--font-head); }
.ms-room.empty .nm { font-weight: 600; }
.ms-room.empty .sub { font-size: 9px; color: var(--text-2); }
.ms-room.locked { background: rgba(10,12,16,.35); border: 1px solid rgba(160,190,220,.1); box-shadow: none; }
.ms-overflow { position: relative; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.ms-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 8px; background: rgba(22,26,33,.9); border: 1px solid var(--line); color: var(--text-1); border-radius: 4px; cursor: pointer; font-size: 12px; }
.ms-chip.busy { border-color: var(--signal-warn); }
.ms-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.ms-actions .btn { flex: 1 1 auto; white-space: nowrap; font-size: 13px; padding: 0 8px; }
.sheet p { white-space: pre-line; }
/* ================= HUD (portrait + level + power · events · resources · objective pill) and the view switch ================= */
.shell { grid-template-rows: auto minmax(0, 1fr) auto auto; }
.topbar.hud { padding: calc(6px + var(--safe-t)) 8px 6px; background: linear-gradient(180deg, #121821, #0F141B); display: flex; flex-direction: column; gap: 5px; }
.hud-row1 { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.hud-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 0; background: none; border: 0; color: var(--text-1); cursor: pointer; text-align: left; }
.hud-face { position: relative; flex: none; width: 44px; height: 44px; display: flex; align-items: flex-end; justify-content: center; overflow: visible;
  background: radial-gradient(circle at 50% 35%, #2B3A4C, #121821); border: 2px solid #6FD3C8; border-radius: 6px; box-shadow: 0 0 0 1px #0A0C10, 0 0 10px rgba(111,211,200,.25); }
.hud-face > .art, .hud-face > .sprite, .hud-face > svg { max-height: 40px; }
.hud-lv { position: absolute; right: -7px; bottom: -6px; min-width: 20px; height: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; text-align: center; color: #0D1015; background: #F2C14E; border: 1.5px solid #0A0C10; border-radius: 9px; }
.hud-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hud-id b { font: 600 14px var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-pow { display: inline-flex; align-items: center; font-size: 13px; color: #F2C14E; }
.hud-events { display: flex; gap: 4px; flex: none; }
.hud-ev { position: relative; width: 50px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; background: none; border: 0; color: var(--text-1); cursor: pointer; }
.hud-ev .hud-ic, .hud-ev > svg { width: 28px; height: 28px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.hud-ev > span { font-size: 10px; line-height: 1; color: var(--text-2); }
.hud-ev:active { transform: scale(.92); }
.hud-badge { position: absolute; top: 0; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; font: 600 10px/16px var(--font-num); font-style: normal; color: #111; background: var(--signal-warn); border-radius: 8px; }
.topbar.hud .res-row { gap: 4px 9px; }
.topbar.hud .res { font-size: 13px; }
.topbar.hud .chip { font-size: 12px; padding: 1px 6px; }
.hud-row3 { display: flex; gap: 6px; align-items: stretch; }
.hud-obj { flex: 1; min-width: 0; min-height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; text-align: left; color: var(--text-1); cursor: pointer;
  background: linear-gradient(90deg, rgba(227,167,47,.22), rgba(227,167,47,.06) 60%, rgba(22,26,33,.9)); border: 1px solid rgba(227,167,47,.55); border-radius: 17px; }
.hud-obj:active { transform: scale(.98); }
.hud-obj-ic { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; color: #0D1015; background: var(--signal-warn); border-radius: 50%; }
.hud-obj-t { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-obj-n { flex: none; font-size: 12px; color: var(--signal-warn); }
.hud-obj-go { flex: none; font: 600 18px/1 var(--font-head); color: var(--signal-warn); }
span.hud-obj { cursor: default; font-size: 13px; }
.hud-row3 .safe-chip { margin-left: 0; min-height: 34px; border-radius: 0; }
.viewbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 8px; background: linear-gradient(180deg, rgba(13,16,21,.0), #0D1015 35%); border-top: 1px solid rgba(160,190,220,.12); z-index: 5; }
.view-btn { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; color: var(--text-2); cursor: pointer;
  background: linear-gradient(180deg, #1A222E, #121821); border: 1px solid rgba(160,190,220,.25); border-radius: 6px; font: 600 13px var(--font-head); }
.view-btn .hud-ic, .view-btn > svg { width: 28px; height: 28px; flex: none; }
.view-btn[aria-current="page"] { color: #0D1015; background: linear-gradient(180deg, #8FE6DC, #4FB8AD); border-color: #BFF3EC; box-shadow: 0 0 12px rgba(111,211,200,.35); }
.view-btn:active { transform: scale(.96); }
.tab .tab-art { width: 26px !important; height: 26px !important; }
.tab:not([aria-current="page"]) .tab-art { filter: grayscale(.6) brightness(.8); }
@media (min-width: 1024px) { .shell { grid-template-rows: auto minmax(0, 1fr) auto; } .viewbar { grid-column: 2; grid-row: 3; } .tabbar { grid-row: 2 / 4; } }

/* ================= System view: orbital 2.5D ================= */
.sv-stage { position: relative; margin: -12px -12px -16px; overflow: hidden; user-select: none;
  background: radial-gradient(ellipse 55% 40% at 50% 55%, rgba(255,200,120,.10), transparent 70%), radial-gradient(ellipse 60% 50% at 20% 20%, rgba(43,90,140,.22), transparent 70%), #05070C; }
@media (min-width: 1024px) { .sv-stage { margin: -20px -28px; } }
.sv-head { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 90; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(13,16,21,.86); border: 1px solid rgba(160,190,220,.25); }
.sv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sv-title b { font: 600 15px var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-title .small { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sv-head .icon-btn { width: 36px; height: 36px; flex: none; }
.sv-orbits { position: absolute; left: 0; top: 0; pointer-events: none; }
.sv-orbit { fill: none; stroke: rgba(150,190,240,.22); stroke-width: 1; }
.sv-orbit.inner { stroke: rgba(242,193,78,.25); stroke-dasharray: 3 4; }
.sv-star { position: absolute; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; z-index: 30; pointer-events: none;
  background: radial-gradient(circle, #FFFBEA 0 22%, #FFD36B 42%, rgba(255,150,40,.55) 62%, rgba(255,120,30,0) 72%); animation: sv-pulse 4s ease-in-out infinite; }
.sv-star.art { background: radial-gradient(circle, rgba(255,220,140,.35), rgba(255,160,60,0) 70%); width: 110px; height: 110px; margin: -55px 0 0 -55px; display: flex; align-items: center; justify-content: center; }
.sv-star.art .sv-star-img { max-width: 96px; max-height: 96px; }
@keyframes sv-pulse { 50% { transform: scale(1.06); filter: brightness(1.1); } }
.sv-layer { position: absolute; inset: 0; }
.sv-planet { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; background: none; border: 0; color: var(--text-1); cursor: pointer; }
.sv-planet:active .sv-pimg { transform: scale(.94); }
.sv-pimg { display: flex; align-items: center; justify-content: center; border-radius: 50%; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); transition: transform .12s; }
.sv-planet.owned .sv-pimg { box-shadow: 0 0 0 2px var(--pc), 0 0 14px var(--pc); }
.sv-plabel { display: flex; flex-direction: column; align-items: center; line-height: 1.15; text-shadow: 0 1px 3px #000, 0 0 6px #000; white-space: nowrap; }
.sv-plabel b { font-size: 12px; font-weight: 600; }
.sv-st { font-size: 11px; }
.sv-st.explore { color: var(--signal-warn); }
.sv-st.home { color: #F2C14E; }
.sv-threat { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 2px; padding: 2px 5px 2px 2px; background: rgba(40,8,12,.88); border: 1px solid #E0503C; border-radius: 12px; color: #FFB4A6; cursor: pointer; }
.sv-threat-ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: #C8432B; border-radius: 50%; }
.sv-threat-lv { font-size: 11px; font-weight: 600; }
.sv-ship { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; padding: 0; background: none; border: 0; color: var(--text-1); cursor: pointer; min-width: 40px; min-height: 40px; }
.sv-ship.me { z-index: 80 !important; }
.sv-ship.me .gm-me-img { position: static; width: auto; height: 40px; }
.sv-ship.me .gm-tag { position: static; transform: none; margin-top: 2px; }
.sv-ship .sv-sname { font-size: 10px; color: #C9CED6; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.sv-more { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--text-2); }
.sv-exit { position: absolute; transform: translate(-50%, -50%); z-index: 85; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 6px; min-width: 44px; min-height: 40px;
  background: rgba(13,16,21,.78); border: 1px solid var(--ec); border-radius: 6px; color: var(--text-1); cursor: pointer; }
.sv-exit-arrow { font-size: 13px; color: var(--ec); line-height: 1; }
.sv-exit-t { font-size: 10px; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.sv-fleet { font: 600 10px var(--font-num); color: #C9CED6; }
.sv-fleet.mine { color: #F2C14E; }
html.reduced .sv-star { animation: none; }
@media (prefers-reduced-motion: reduce) { .sv-star { animation: none; } }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ms-meters { grid-template-columns: 1fr 1fr auto auto !important; gap: 8px !important; align-items: center !important; }
.ms-meters .icon-btn { width: 40px; height: 40px; }
.ms-info { position: absolute; left: 10px; top: 8px; z-index: 3; display: flex; flex-direction: column; gap: 1px; color: var(--text-2); text-shadow: 0 1px 2px #000; pointer-events: none; }
.topbar.hud .res-row { flex-wrap: nowrap; gap: 6px; overflow: hidden; }
.topbar.hud .res { font-size: 12px; gap: 3px; }
.topbar.hud .res .ico { width: 13px; height: 13px; }
.topbar.hud .chip { font-size: 11.5px; padding: 1px 5px; gap: 3px; }
/* ================= Fleet formation ================= */
.fl-stage { position: relative; margin: 0 -12px; padding: 10px 12px 12px; min-height: 300px; display: flex; flex-direction: column; gap: 10px;
  background: radial-gradient(ellipse 70% 50% at 50% 60%, rgba(43,120,170,.18), transparent 70%), linear-gradient(180deg, #070A10, #0B111A); background-size: cover; background-position: center; }
.fl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fl-hero { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fl-hero > .art, .fl-hero > .sprite, .fl-hero > svg { flex: none; border: 2px solid #6FD3C8; border-radius: 6px; background: #121821; }
.fl-hero b { display: block; font: 600 14px var(--font-head); }
.fl-fp { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.fl-fp .small { color: var(--text-2); }
.fl-fp-n { font: 600 24px var(--font-num); color: #F2C14E; text-shadow: 0 0 12px rgba(242,193,78,.35); }
.counting { color: #FFE39A !important; }
.fl-form { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.fl-line { display: flex; align-items: center; gap: 8px; }
.fl-line-n { flex: none; width: 52px; font: 600 11px var(--font-head); color: var(--text-2); }
.fl-ships { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; flex: 1; }
.fl-group { display: flex; flex-direction: column; align-items: center; }
.fl-sprites { display: flex; }
.fl-sp { margin-left: -14px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.6)); transform: translateY(calc(var(--i) * 3px)); }
.fl-sp:first-child { margin-left: 0; }
.fl-cap { font-size: 11px; color: var(--text-1); text-shadow: 0 1px 2px #000; }
.fl-out { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fl-hp { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.fl-hp .bar > i { background: linear-gradient(90deg, #4FB86A, #9BE07A); }
.fl-tabs { display: flex; gap: 4px; margin: 0 -12px 12px; padding: 6px 12px; background: #0D1015; border-top: 1px solid var(--line); overflow-x: auto; }
.fl-tab { position: relative; flex: none; min-height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); cursor: pointer; font: 600 12px var(--font-head); }
.fl-tab[aria-selected="true"] { color: #0D1015; background: #8FE6DC; border-color: #BFF3EC; }
.fl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-2); font-style: normal; }
.fl-dot.outbound, .fl-dot.returning { background: #F2C14E; } .fl-dot.acting { background: #4FB86A; }
.fl-launch-fp { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.fl-launch-fp b { font-size: 20px; color: #F2C14E; }
.ms-head { margin-bottom: 8px; }
.ms-head h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-head .icon-btn { width: 40px; height: 40px; }
.ms-frame { position: relative; width: 100%; display: flex; justify-content: center; }
.ms-stage.art .ms-hull { filter: drop-shadow(0 8px 22px rgba(0,0,0,.7)) drop-shadow(0 0 18px rgba(80,170,255,.12)); image-rendering: pixelated; }
.ms-engine.soft { mix-blend-mode: screen; opacity: .6; }
.ms-engine.soft i { width: 22%; }
.ms-bay { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; display: block; overflow: visible; }
.ms-bay svg.bay-art { padding: 10%; }
.ms-bay::after { content: ""; position: absolute; inset: -1px; border: 1px solid rgba(124,242,230,.35); pointer-events: none; }
.ms-bay.busy::after { border-color: var(--signal-warn); animation: bay-busy 1.4s ease-in-out infinite; }
.ms-bay.bridge::after { border-color: var(--accent, #2BB3A8); }
.ms-bay.open::after { border-style: dashed; border-color: rgba(124,242,230,.8); }
.ms-bay.locked::after { border-color: transparent; }
.ms-bay.off { opacity: .5; }
.ms-bay.tapped { animation: ms-tap .3s ease-out; }
.ms-bay .bay-work { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: repeating-linear-gradient(90deg, var(--signal-warn) 0 4px, #0D1015 4px 8px); }
@keyframes bay-busy { 50% { box-shadow: 0 0 8px 1px rgba(227,167,47,.6); } }
.ms-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.ms-lines polyline { fill: none; stroke: rgba(124,242,230,.45); stroke-width: 1; }
.ms-lines polyline.busy { stroke: rgba(227,167,47,.7); }
.ms-lines circle { fill: #7CF2E6; }
.ms-tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px; padding: 3px 22px 3px 7px; border-left-width: 3px !important; text-align: left; color: var(--text-1); cursor: pointer;
  background: linear-gradient(90deg, rgba(16,22,30,.94), rgba(22,30,40,.88)); border: 1px solid rgba(124,242,230,.35); border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.45); transition: transform .12s ease-out; }
.ms-tag .pip { position: absolute; right: 2px; bottom: 2px; }
.ms-tag:has(.pip) { padding-right: 24px; }
.ms-tag:active { transform: scale(.96); }
.ms-tag:focus-visible { outline: 2px solid var(--signal-warn); outline-offset: 1px; }
.ms-tag.tapped { animation: ms-tap .3s ease-out; }
.ms-tag.busy { border-color: var(--signal-warn); }
.ms-tag.bridge { border-color: var(--accent, #2BB3A8); }
.ms-tag:not(.placed) { visibility: hidden; }
.ms-tag.open { border-style: dashed; color: #9FE9E0; background: rgba(10,14,20,.7); }
.ms-tag .tg-ic { position: relative; flex: none; width: 33px; height: 22px; display: flex; align-items: center; justify-content: center; }
.ms-tag .tg-ic.plus { font: 600 22px/1 var(--font-head); }
.ms-tag .tg-art { max-width: 33px; }
.ms-tag .pip { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%; overflow: hidden; border: 1.5px solid var(--signal-warn); background: #1E232B; display: flex; align-items: flex-end; justify-content: center; }
.ms-tag .tg-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.ms-tag .tg-t b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tag .tg-t .small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tag .tg-hero { color: var(--signal-warn); }
.ms-tag .tg-job { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; color: var(--signal-warn); }
.ms-tag .tg-job svg { width: 13px; height: 13px; }
.ms-tag .lv { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; line-height: 16px; text-align: center; color: #0D1015; background: var(--text-1); border-radius: 3px; }
html.reduced .ms-bay.busy::after, html.reduced .ms-bay.tapped, html.reduced .ms-tag.tapped { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .ms-bay.busy::after, .ms-bay.tapped, .ms-tag.tapped { animation: none !important; } }

/* ================= Galaxy Map: hex territory world map (owner 2026-11-15; Starborne-like patterns) ================= */
.gmap { position: relative; margin: -12px -12px -16px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse 60% 40% at 30% 30%, rgba(43,90,140,.25), transparent 70%), radial-gradient(ellipse 50% 40% at 75% 75%, rgba(120,60,160,.22), transparent 70%), #05070C;
  background-size: 130% 130%; background-position: 50% 50%; }
@media (min-width: 1024px) { .gmap { margin: -20px -28px; } }
.gm-canvas { position: absolute; inset: 0; display: block; }
.gm-ov { position: absolute; inset: 0; pointer-events: none; }
.gm-ov > * { pointer-events: auto; }
.gm-sys { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; border-radius: 50%; cursor: pointer; will-change: transform; }
.gm-sys:focus-visible { outline: 2px solid var(--signal-warn); }
.gm-sys:active { background: rgba(232,226,212,.12); }
.gm-me, .gm-pin { position: absolute; left: 0; top: 0; border: 0; padding: 0; background: none; cursor: pointer; will-change: transform; z-index: 2;
  display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 3px; }
.gm-me { width: 64px; height: 86px; margin: -86px 0 0 -32px; }
.gm-pin { width: 48px; height: 64px; margin: -64px 0 0 -24px; }
.gm-me .gm-tag, .gm-pin .gm-tag { position: static !important; transform: none !important; }
.gm-pin { z-index: 3; }
.gm-me .gm-me-img { position: relative; width: 44px; height: 46px; display: flex; align-items: flex-end; justify-content: center; filter: drop-shadow(0 2px 4px #000); }
.gm-me-ring { position: absolute; left: 6px; bottom: -4px; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(242,193,78,.85); animation: gm-ring 1.8s ease-out infinite; pointer-events: none; }
@keyframes gm-ring { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.gm-tag { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 11px/1 var(--font-body); padding: 4px 7px; color: #0D1015; background: #F2C14E; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.6); }

.gm-pin .gm-pin-ic { position: relative; margin-bottom: 6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: #0D1015; background: #E8E2D4; border: 2px solid #0D1015;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.6); animation: gm-bob 1.6s ease-in-out infinite; }
.gm-pin .gm-pin-ic svg { transform: rotate(45deg); }
.gm-pin.front .gm-pin-ic { background: var(--signal-warn); }
.gm-pin .gm-tag { background: #E8E2D4; }
.gm-pin.front .gm-tag { background: var(--signal-warn); }
.gm-pin > .art, .gm-pin > .sprite { position: relative; }
@keyframes gm-bob { 50% { translate: 0 -4px; } }
.gm-banner { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 4; padding: 8px 10px; background: rgba(13,16,21,.88); border: 1px solid rgba(160,190,220,.25);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.gm-fac { gap: 8px; }
.gm-fac-t { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.gm-fac-t b { font: 600 15px var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-held { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.gm-help { width: 36px; height: 36px; flex: none; }
.gm-terr { display: flex; height: 6px; margin: 6px 0 2px; gap: 2px; }
.gm-terr i { display: block; flex-basis: 0; min-width: 3px; }
.gm-terr i.mine { box-shadow: 0 0 0 1px #E8E2D4; }
.gm-terr i.free { background: #2D333D; }
.gm-goal { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(160,190,220,.15); }
.gm-goal-ic { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; background: var(--signal-warn); color: #0D1015; border-radius: 50%; }
.gm-goal-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.gm-goal-t .small { color: var(--signal-warn); }
.gm-goal-t b { font-weight: 600; font-size: 14px; }
.gm-goal .btn { flex: none; }
.gm-tools { position: absolute; right: 8px; bottom: 14px; z-index: 4; display: flex; flex-direction: column; gap: 6px; }
.gm-tools .icon-btn { background: rgba(13,16,21,.86); border-color: rgba(160,190,220,.3); }
.gm-pill { position: absolute; left: 8px; bottom: 14px; z-index: 4; display: inline-flex; align-items: center; gap: 4px; background: rgba(13,16,21,.86); border-color: rgba(160,190,220,.4); }
.gm-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.gm-badge.front { color: #0D1015; background: var(--signal-warn); border-color: var(--signal-warn); font-weight: 600; }
.gm-badge.home { color: #0D1015; background: #F2C14E; border-color: #F2C14E; font-weight: 600; }
.gm-why { line-height: 1.45; }
.gm-pl { display: flex; flex-direction: column; gap: 6px; }
.gm-pl-art, .gm-sys-art { flex: none; width: 48px; display: flex; justify-content: center; }
.gm-pl-t { min-width: 0; flex: 1; }
.gm-pl-t b { font-family: var(--font-head); }
.gm-pl-act { gap: 6px; padding-left: 58px; }
.gm-dot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.gm-prof-art { width: 52px; display: flex; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .ms-engine, .ms-light, .ms-room.tapped, .gm-me-ring, .gm-pin .gm-pin-ic { animation: none !important; } }
html.reduced .ms-engine, html.reduced .ms-light, html.reduced .ms-room.tapped, html.reduced .gm-me-ring, html.reduced .gm-pin .gm-pin-ic { animation: none !important; }

/* ---------- buttons: one kit for every screen (owner 2026-11-15 "แก้ไขปุ่มทั้งหมด"; art skins come from js/skin.js) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; line-height: 1.2; text-align: center; -webkit-user-select: none; user-select: none; }
.btn.small { min-height: 44px; }
.btn.block { display: flex; width: 100%; }
.btn > .ico, .btn > .art, .btn > .sprite { flex: none; }
.btn.danger { background: #7E2418; border-color: #E06A50; color: #fff; }
.btn:not([disabled]):active, .icon-btn:not([disabled]):active, .step-btn:not([disabled]):active { transform: translateY(1px); }
.btn[disabled], .icon-btn[disabled], .step-btn[disabled] { opacity: .45; filter: grayscale(.85); cursor: not-allowed; }
.icon-btn { min-width: 44px; min-height: 44px; color: var(--text-1); }
.stepper button.step-btn { min-width: 44px; min-height: 44px; color: var(--text-1); }
.btn:focus-visible, .icon-btn:focus-visible, .step-btn:focus-visible, .tile:focus-visible { outline: 2px solid var(--signal-warn); outline-offset: 2px; }
/* ship crafting entries (full screens in /craft.css, loaded lazily) */
.ms-dock { display: flex; align-items: center; gap: 10px; width: 100%; margin: 8px 0; padding: 6px 12px; color: #F2EEE4; font: inherit; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(42,51,66,.95), rgba(16,20,26,.95)); border: 1px solid #F2B33A; box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,.1); }
.ms-dock.ready { animation: ms-dock-glow 1.6s ease-in-out infinite; }
@keyframes ms-dock-glow { 50% { box-shadow: 0 0 18px rgba(255,200,80,.6), 0 3px 0 #000; } }
.ms-dock-art { flex: none; height: 64px; display: flex; align-items: center; }
.ms-dock-t { flex: 1; display: grid; gap: 2px; } .ms-dock-t b { font-family: var(--font-head); font-size: 16px; color: #FFE08A; }
.ms-dock-go { font: 700 26px var(--font-head); color: #FFE08A; }
.pr-dock { display: block; width: 100%; padding: 0; margin: 0 0 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pr-dock-art { flex: none; display: flex; align-items: center; height: 76px; }
.fl-named .fl-ships { gap: 6px; }
.fl-nh { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.fl-nh-art { position: relative; display: inline-flex; filter: drop-shadow(0 0 6px rgba(255,224,138,.45)); }
.fl-nh-g { position: absolute; left: -6px; bottom: -4px; }
.fl-pick-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.fl-pick-b { position: relative; flex: none; display: grid; justify-items: center; gap: 2px; width: 78px; min-height: 76px; padding: 4px; color: #E8E2D4; background: #151A21; border: 1px solid #3E4A5E; font: inherit; cursor: pointer; }
.fl-pick-b.on { border-color: #F2B33A; box-shadow: 0 0 0 1px #F2B33A inset, 0 0 10px rgba(255,200,80,.3); }
.fl-pick-g { position: absolute; left: 2px; top: 2px; }
.fl-flag { position: absolute; right: 2px; top: 2px; padding: 0 4px; font: 700 10px var(--font-head); color: #2A1A00; background: #FFE08A; }
.fl-flag.n { background: #6FDDFF; }
.fl-fit { margin-left: 8px; color: #FFC93C; letter-spacing: 1px; }
