:root {
  --bg: #05060c; --panel: rgba(10, 14, 26, 0.92); --panel2: rgba(18, 24, 42, 0.95); --line: #26324e; --ink: #dfe8f6; --dim: #8c9ab4;
  --cyan: #5fd8ff; --amber: #ffc45a; --red: #ff5a6a; --green: #5fff9a; --violet: #c48cff;
  --font: 'Rajdhani', system-ui, sans-serif; --head: 'Chakra Petch', 'Rajdhani', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#view, canvas#overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#overlay { pointer-events: none; }
.hidden { display: none !important; }
button { font: inherit; font-weight: 600; color: var(--ink); background: linear-gradient(#1c2640, #121a2e); border: 1px solid #344566; border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 40px; letter-spacing: 0.02em; }
button:hover:not(:disabled) { border-color: var(--cyan); box-shadow: 0 0 10px rgba(95, 216, 255, 0.25); }
button:disabled { opacity: 0.45; cursor: default; }
button.big { font-size: 1.15rem; padding: 12px 22px; min-height: 48px; }
button.primary { background: linear-gradient(#1d5a7a, #11384e); border-color: #3aa8d8; }
button.danger { background: linear-gradient(#6a2030, #3a1018); border-color: #c04050; }
button.small { min-height: 30px; padding: 3px 9px; font-size: 0.9rem; }
button.pad-focus, button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.center { justify-content: center; } .row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.hint { color: var(--dim); font-size: 0.92rem; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: 0.04em; }

/* title */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(40, 60, 120, 0.25), rgba(0, 0, 0, 0.55)); }
.title-card { text-align: center; padding: 24px; max-width: 520px; width: 100%; }
/* the wordmark sizes itself to the window, never to the 520px card (2026-11-12: it was clipped at the H at 970px wide,
   because background-clip:text only paints inside the h1 box). max-content keeps the gradient box around every letter;
   10.5vw keeps the word (about 7.9em wide) inside any phone; the right padding is smaller because letter-spacing
   already adds space after the last letter. */
.title-card h1 { width: max-content; max-width: none; margin-left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 0 0.06em 0 0.2em; font-size: clamp(1.6rem, 10.5vw, 5.4rem); font-weight: 700; letter-spacing: 0.14em; background: linear-gradient(90deg, #5fd8ff, #c48cff 50%, #ffc45a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(120, 160, 255, 0.45)); }
.title-card .tagline { color: var(--dim); margin: 6px 0 22px; font-size: 1.05rem; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
#title-buttons button { width: 100%; }
/* one look for the small title buttons, whichever shared helper made them (What's new, Credits, the account button) */
#title-extra { margin-top: 14px; gap: 8px; }
#title-extra > button, #title-extra .rgs-acct-btn { font-family: var(--font); font-weight: 600; font-size: 0.95rem; line-height: 1.2; color: var(--ink); background: linear-gradient(#1c2640, #121a2e); border: 1px solid #344566; border-radius: 8px; padding: 6px 14px; min-height: 40px; letter-spacing: 0.02em; }
#title-extra > button:hover, #title-extra .rgs-acct-btn:hover { border-color: var(--cyan); box-shadow: 0 0 10px rgba(95, 216, 255, 0.25); }
.slot { display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.slot small { color: var(--dim); font-weight: 500; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud > .sticks, #hud > #toasts, #hud > .banner, #hud > .target, #hud > .bars { pointer-events: none; }
.topbar { position: absolute; top: calc(6px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; gap: 8px; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-family: var(--head); white-space: nowrap; font-size: 0.95rem; }
#st-credits { color: var(--amber); }
.bars { position: absolute; top: calc(56px + var(--safe-t)); left: calc(8px + var(--safe-l)); width: min(230px, 46vw); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.bar { position: relative; height: 17px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; }
.bar span { position: relative; font-size: 0.74rem; font-weight: 700; padding-left: 5px; line-height: 15px; display: block; text-shadow: 0 1px 2px #000; }
.bar.hull i { background: linear-gradient(90deg, #ff9a3a, #ffd27a); }
.bar.shield i { background: linear-gradient(90deg, #3a8aff, #8fd8ff); }
.bar.boost i { background: linear-gradient(90deg, #8a5aff, #d0a0ff); }
/* report #60: an emptied booster is locked until it refills to 30% (the line marks where it unlocks) */
.bar.boost.locked i { background: repeating-linear-gradient(135deg, #5b5670 0 6px, #46425a 6px 12px); }
.bar.boost.locked::after { content: ''; position: absolute; top: 0; bottom: 0; left: 30%; width: 2px; background: #d0a0ff; box-shadow: 0 0 4px #d0a0ff; }
.bar.boost.locked span { color: #c8c2dc; }
.mini-stats { pointer-events: auto; cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.82rem; color: var(--dim); font-weight: 600; text-shadow: 0 1px 2px #000; }
.mini-stats b { color: var(--ink); }
.mini-stats .bad { color: var(--red); }
.quest { position: absolute; top: calc(56px + var(--safe-t)); right: calc(8px + var(--safe-r)); width: min(270px, 48vw); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 8px; padding: 7px 10px; font-size: 0.9rem; cursor: pointer; }
.quest b { color: var(--amber); font-family: var(--head); display: block; font-size: 0.95rem; }
.quest .prog { height: 5px; background: #1a2238; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.quest .prog i { display: block; height: 100%; background: var(--amber); }
.quest.min p, .quest.min .hint { display: none; }
.target { position: absolute; bottom: calc(196px + var(--safe-b)); right: calc(8px + var(--safe-r)); width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 0.85rem; pointer-events: none; }
.target h4 { margin: 0 0 3px; font-family: var(--head); }
.target .res { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-top: 4px; font-size: 0.72rem; text-align: center; }
.target .res span { background: #121a2c; border-radius: 3px; padding: 1px 0; }
.prompt { cursor: pointer; position: absolute; bottom: calc(110px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--cyan); border-radius: 20px; padding: 6px 16px; font-weight: 700; color: var(--cyan); white-space: nowrap; }
#toasts { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; pointer-events: none; width: min(92vw, 520px); }
.toast { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-weight: 600; font-size: 0.92rem; animation: toast 3.6s forwards; text-align: center; }
.toast.good { border-color: var(--green); color: var(--green); } .toast.bad { border-color: var(--red); color: var(--red); } .toast.loot { border-color: currentColor; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.banner { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; animation: banner 4.5s forwards; width: min(92vw, 600px); }
.banner h2 { font-size: clamp(1.4rem, 5vw, 2.2rem); color: var(--amber); text-shadow: 0 0 20px rgba(255, 196, 90, 0.6); }
.banner p { margin: 4px 0 0; font-size: 1.05rem; color: var(--ink); text-shadow: 0 1px 3px #000; }
.banner .new { color: var(--cyan); font-weight: 700; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.96); } 8% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; } }
#minimap { position: absolute; right: calc(8px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); width: 180px; height: 180px; border-radius: 50%; background: rgba(4, 8, 18, 0.75); border: 1px solid var(--line); }
.touch { position: absolute; right: calc(196px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); display: grid; grid-template-columns: repeat(2, auto); gap: 6px; }
.tbtn { min-width: 84px; min-height: 48px; background: rgba(20, 30, 50, 0.75); }
.sticks { position: absolute; inset: 0; pointer-events: none; }
.stick { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(95, 216, 255, 0.35); background: rgba(95, 216, 255, 0.06); }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(95, 216, 255, 0.4); }

/* panels (station, build, map, menu, hold) */
#panels { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#panels > * { pointer-events: auto; }
.panel-full { position: absolute; inset: 0; background: rgba(4, 6, 14, 0.96); backdrop-filter: blur(6px); display: flex; flex-direction: column; padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l)); }
.panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.3rem; color: var(--cyan); }
.panel-body { flex: 1; overflow: auto; padding-top: 8px; min-height: 0; }
.modal-back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; width: min(440px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.modal h2 { color: var(--cyan); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { min-height: 36px; padding: 4px 10px; }
.tabs button.on { border-color: var(--amber); color: var(--amber); }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.grid th, table.grid td { padding: 5px 6px; border-bottom: 1px solid #1a2238; text-align: right; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid th { color: var(--dim); font-weight: 600; position: sticky; top: 0; background: #0a0e1a; }
.good { color: var(--green); } .bad { color: var(--red); } .meh { color: var(--dim); } .amber { color: var(--amber); }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.rar-common { color: #c9ccd4; } .rar-uncommon { color: #4dff7a; } .rar-rare { color: #4da6ff; } .rar-epic { color: #c45cff; } .rar-legendary { color: #ff9a1f; } .rar-relic { color: #ff3b5c; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: #0b1020f2; border: 1px solid #3a4a6a; border-radius: 8px; padding: 8px 10px; font-size: 0.9rem; max-width: 300px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); }
.tip h4 { margin: 0 0 4px; font-family: var(--head); }
.kv { display: grid; grid-template-columns: auto auto; gap: 1px 12px; font-size: 0.88rem; }
.kv span:nth-child(odd) { color: var(--dim); }
input[type=range] { width: 100%; }
input, textarea, select { font: inherit; color: var(--ink); background: #0c1222; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }

@media (max-width: 640px) {
  .bars { width: 46vw; }
  #minimap { width: 120px; height: 120px; }
  .touch { right: calc(134px + var(--safe-r)); }
  .target { bottom: calc(136px + var(--safe-b)); width: 180px; }
  .quest { width: 46vw; font-size: 0.82rem; }
  .stat { font-size: 0.85rem; padding: 5px 8px; }
}

/* station */
.panel-full.station .panel-head h2 { flex: 0 1 auto; }
.st-info { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.st-info .stat { font-size: 0.9rem; }
.st-tabs { position: sticky; top: 0; z-index: 2; background: #070a14; padding: 6px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.st-tabs button { min-height: 40px; }
.st-tabs button.locked { opacity: 0.4; font-weight: 500; }
.st-content { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; }
.st-h { color: var(--amber); font-size: 1.05rem; margin-top: 6px; }
.st-content > p.hint { margin: 0; }
.st-quick { gap: 8px; }
.st-event { border-color: var(--amber); }
.st-done { opacity: 0.7; }
.st-ready { border-color: var(--green); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 2px; vertical-align: middle; }
table.grid.st-market th { position: static; }
table.grid.st-market td { vertical-align: middle; }
table.grid.st-market tr.st-cat td { text-align: left; color: var(--cyan); font-family: var(--head); padding-top: 12px; border-bottom: 1px solid var(--line); }
.st-acts { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.st-acts button { min-width: 44px; padding: 4px 8px; }
.st-actlabel { color: var(--dim); font-size: 0.8rem; margin-left: 4px; }
.st-preview { background: radial-gradient(ellipse at center, #1a2440, #070a14); border-radius: 8px; display: flex; justify-content: center; }
.st-preview canvas { max-width: 100%; height: auto; }
.it-card h4 { margin: 0; font-family: var(--head); }
.it-mods { display: flex; flex-wrap: wrap; gap: 4px; }
.it-mods span { background: #142036; border-radius: 4px; padding: 1px 6px; font-size: 0.82rem; color: var(--green); }
.it-power { color: #ff9a1f; font-weight: 700; font-size: 0.9rem; }
.it-more summary { cursor: pointer; color: var(--cyan); font-size: 0.88rem; min-height: 32px; line-height: 32px; }
.it-foot { margin-top: 4px; }
.it-price { font-weight: 700; }
@media (max-width: 640px) {
  .st-info .stat { font-size: 0.8rem; padding: 4px 6px; }
  .st-tabs { gap: 3px; }
  .st-tabs button { padding: 4px 8px; font-size: 0.88rem; }
  table.grid.st-cards thead { display: none; }
  table.grid.st-cards, table.grid.st-cards tbody { display: block; }
  table.grid.st-cards tr { display: block; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; margin-bottom: 8px; }
  table.grid.st-cards tr.st-cat { background: none; border: none; padding: 4px 0 0; margin: 0; }
  table.grid.st-cards td { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: none; padding: 2px 0; text-align: right; }
  table.grid.st-cards td[data-l]:not([data-l=""])::before { content: attr(data-l); color: var(--dim); font-size: 0.85rem; text-align: left; }
  table.grid.st-cards td:first-child { font-size: 1.05rem; }
  table.grid.st-cards .st-acts { justify-content: flex-start; width: 100%; margin-top: 4px; }
  table.grid.st-cards .st-acts button { flex: 1; }
  .cards { grid-template-columns: 1fr; }
}
.panel-full.station { background: #04060e; }
.st-content .kv { grid-template-columns: minmax(110px, max-content) 1fr; }

/* build */
.bm { background: #04060d; padding-bottom: calc(4px + var(--safe-b)); }
.bm-head { flex-wrap: nowrap; }
.bm-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bm-head .bm-cls { color: var(--dim); font-size: 0.8em; font-weight: 600; }
.bm-head button { flex: none; }
.bm-cost { color: var(--amber); font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bm-head .bm-cancel { background: linear-gradient(#1c2640, #121a2e); border-color: #344566; }
.bm-head .bm-done { background: linear-gradient(#1f6a48, #11402c); border-color: #3ad890; }
.bm-head .bm-done.blocked { background: linear-gradient(#5a3a1a, #3a2410); border-color: #c08a40; }
.bm-head button.on { border-color: var(--amber); color: var(--amber); }
.bm-main { flex: 1; min-height: 0; display: flex; gap: 8px; padding-top: 8px; position: relative; }
.bm-pal { width: 290px; flex: none; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.bm-tabs { gap: 4px; }
.bm-tabs button { position: relative; min-height: 40px; padding: 4px 9px; font-size: 0.92rem; }
.bm-badge { position: absolute; top: -5px; right: -5px; background: var(--cyan); color: #04101a; font-style: normal; font-size: 0.7rem; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.bm-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.bm-tile { display: flex; align-items: center; gap: 8px; text-align: left; padding: 4px 8px; min-height: 48px; position: relative; font-weight: 600; flex: none; }
.bm-tile.on { border-color: var(--amber); box-shadow: 0 0 10px rgba(255, 196, 90, 0.35); }
.bm-tile.off { opacity: 0.45; }
.bm-ico { width: 36px; height: 36px; flex: none; background: #0b1224; border-radius: 6px; }
.bm-tl { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.bm-tl b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-tl small { color: var(--dim); font-weight: 500; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-cnt { margin-left: auto; font-style: normal; color: var(--cyan); font-size: 0.9rem; padding-left: 4px; }
.bm-empty { padding: 8px; }
.bm-info { min-height: 40px; }
.bm-info p { margin: 0; font-size: 0.86rem; }
.bm-sel { display: flex; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 8px; font-size: 0.9rem; flex-wrap: wrap; }
.bm-sel .hint { font-size: 0.82rem; }
.bm-sel button { min-width: 40px; min-height: 36px; }
.bm-stage { flex: 1; min-width: 0; min-height: 0; position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #04060d; }
.bm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.bm-warn { position: absolute; top: 6px; left: 8px; right: 8px; pointer-events: none; font-weight: 700; font-size: 0.88rem; text-shadow: 0 1px 3px #000; }
.bm-warn > div { background: rgba(10, 12, 22, 0.85); border: 1px solid currentColor; border-radius: 8px; padding: 4px 8px; display: inline-block; max-width: 100%; }
.bm-warn small { color: var(--dim); font-weight: 600; }
.bm-hover { position: absolute; left: 8px; bottom: 62px; background: rgba(10, 14, 26, 0.9); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 0.86rem; pointer-events: none; max-width: calc(100% - 16px); }
.bm-say { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; width: min(92%, 520px); }
.bm-msg { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; font-weight: 600; font-size: 0.9rem; text-align: center; animation: toast 3.2s forwards; }
.bm-msg.bad { border-color: var(--red); color: var(--red); } .bm-msg.good { border-color: var(--green); color: var(--green); }
.bm-zoom { position: absolute; top: 44px; right: 6px; display: flex; flex-direction: column; gap: 4px; }
.bm-zoom button { width: 44px; min-height: 40px; padding: 0; background: rgba(20, 30, 50, 0.85); }
.bm-tools { position: absolute; left: 4px; right: 4px; bottom: 4px; display: flex; gap: 4px; justify-content: center; }
.bm-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 52px; min-height: 48px; padding: 2px 6px; background: rgba(20, 30, 50, 0.88); line-height: 1.05; }
.bm-tool b { font-size: 1.1rem; }
.bm-tool span { font-size: 0.74rem; white-space: nowrap; }
.bm-tool.on { border-color: var(--amber); color: var(--amber); }
.bm-stats { width: 290px; flex: none; overflow: auto; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: none; }
.bm.bm-show-stats .bm-stats { display: block; }
.bm-stats h3 { font-size: 1.05rem; color: var(--cyan); }
.bm-stats h4 { margin: 10px 0 3px; font-family: var(--head); color: var(--amber); font-size: 0.92rem; }
.bm-stats .kv span:nth-child(even) { text-align: right; }
.bm-stats p { margin: 4px 0; }
.bm-stats .small, .bm-stats p.small { font-size: 0.84rem; }
.bm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.bm-costs { display: flex; flex-wrap: wrap; gap: 4px 10px; font-weight: 700; }
.bm-tipcost { margin-top: 6px; color: var(--amber); font-size: 0.85rem; }
.bm-dlist { max-height: 50vh; overflow: auto; }
.bm-drow { border-bottom: 1px solid var(--line); padding: 4px 0; }
.bm-drow .off { opacity: 0.45; }
.bm-plist { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

@media (max-width: 760px) {
  .bm .bm-wide { display: none; }
  .bm-head { gap: 5px; }
  .bm-head h2 { font-size: 1.05rem; flex: 1; }
  .bm-head .grow, .bm-cost { display: none; }
  .bm-head button { padding: 6px 8px; font-size: 0.9rem; }
  .bm-main { flex-direction: column; gap: 6px; padding-top: 6px; }
  .bm-stage { order: 1; flex: 1; }
  .bm-pal { order: 2; width: auto; flex: none; gap: 4px; }
  .bm-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .bm-tabs::-webkit-scrollbar { display: none; }
  .bm-tabs button { flex: none; }
  .bm-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; flex: none; padding: 4px 0 2px; }
  .bm-tile { width: 150px; flex: none; }
  .bm-info { min-height: 0; }
  .bm-stats { position: absolute; inset: 6px 0 0 0; width: auto; z-index: 3; background: rgba(8, 11, 22, 0.97); }
  .bm-tool { min-width: 0; flex: 1; padding: 2px 2px; }
  .bm-zoom { top: 40px; }
  .bm-hover { bottom: 58px; }
}
@media (max-width: 640px) { .st-tabs { position: static; } }
.bm-sel { flex-wrap: nowrap; }
.bm-sel > b { white-space: nowrap; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.bm-sel > .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.bm-sel > .grow { display: none; }

/* local map (js/ui/localmap.js) */
.lm-info { position: absolute; right: 10px; bottom: 10px; width: min(300px, calc(100% - 20px)); max-height: 40%; overflow: auto; }
.lm-key { position: absolute; left: 10px; top: 52px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 0.8rem; display: flex; flex-direction: column; gap: 2px; max-width: calc(100% - 20px); }
.lm-key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lm-key.hidden { display: none; }
/* star map traits */
.traits { margin-top: 6px; display: grid; gap: 1px; font-size: 0.9rem; }
.trait.bad { color: var(--bad, #ff6a6a); } .trait.good { color: var(--good, #6aff9a); }
.warp-card { margin-bottom: 10px; display: grid; gap: 4px; }
#minimap { cursor: pointer; }
.gx-key { position: absolute; left: 10px; right: 10px; top: 52px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.gx-key.hidden { display: none; }

/* build mode: fitted-weapon fire modes and drone fitting (expansion 2026-11-12) */
.bm-sec { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 8px; margin-bottom: 6px; border: 1px solid rgba(120,170,255,.18); border-radius: 10px; background: rgba(20,30,50,.55); }
.bm-sec h4 { margin: 0 0 2px; font-size: 14px; letter-spacing: .02em; }
.bm-row { display: flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13px; }
.bm-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.bm-row .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bm-why { margin: -4px 0 4px; font-size: 12px; color: #ffb38a; }
@media (max-width: 760px) {
  /* the palette is one sideways row on phones: each section is a card in that row */
  .bm-sec { width: 280px; margin: 0; }
  .bm-row { min-height: 34px; }
}
.st-sub { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 10px; }
.st-sub button { min-height: 40px; position: relative; }
@media (max-width: 640px) { .st-sub { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .st-sub button { flex: none; } }
.it-cmp { margin-top: 4px; font-size: 13px; }
.it-cmp .up { color: #6dffa0; } .it-cmp .down { color: #ff7a7a; }

/* rare-loot reveal card (ui/reveal.js) */
.reveal { position: fixed; z-index: 60; right: 16px; top: 72px; width: min(360px, calc(100vw - 32px)); max-height: calc(100vh - 140px); overflow: hidden;
  background: linear-gradient(160deg, rgba(14,18,34,.97), rgba(8,10,20,.97)); border: 2px solid var(--rc); border-radius: 14px; padding: 12px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 40px color-mix(in srgb, var(--rc) 55%, transparent), inset 0 0 30px color-mix(in srgb, var(--rc) 18%, transparent);
  transform: translateX(120%) scale(.9); opacity: 0; transition: transform .45s cubic-bezier(.2,1.3,.4,1), opacity .3s; }
.reveal.in { transform: none; opacity: 1; }
.reveal.out { transform: translateX(120%); opacity: 0; }
.reveal .card { background: transparent; border: none; padding: 0; }
.rv-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; position: relative; }
.rv-tag { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--rc); font-size: 15px; text-shadow: 0 0 12px var(--rc); }
.rv-from { font-size: 12px; color: #9fb0c8; }
.rv-uq { color: #ffd59a; font-size: 13px; margin-bottom: 6px; position: relative; }
.rv-rays { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 8%, color-mix(in srgb, var(--rc) 22%, transparent) 10%, transparent 12% 33%, color-mix(in srgb, var(--rc) 18%, transparent) 35%, transparent 37% 60%, color-mix(in srgb, var(--rc) 22%, transparent) 62%, transparent 64% 85%, color-mix(in srgb, var(--rc) 16%, transparent) 87%, transparent 89%);
  animation: rvspin 9s linear infinite; pointer-events: none; opacity: .6; }
.reveal > :not(.rv-rays) { position: relative; }
.reveal.unique { border-width: 3px; }
@keyframes rvspin { to { transform: rotate(1turn); } }
@media (max-width: 640px) { .reveal { top: auto; bottom: 150px; right: 8px; left: 8px; width: auto; max-height: 55vh; } }
@media (prefers-reduced-motion: reduce) { .rv-rays { animation: none; } }

/* workshop (ui/workshop.js) */
.ws-cost { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 2px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--mc, #8fa6c9) 60%, transparent); background: rgba(255,255,255,.04); }
.chip.ok { color: #dfe8f6; } .chip.no { color: #ff8a8a; border-color: rgba(255,120,120,.5); }
.chip small { color: #8a96ab; font-weight: 500; }
.ws-boost { margin-top: 6px; align-items: center; } .ws-boost button { min-height: 34px; min-width: 44px; }
.ws-odds { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 6px; background: #111; }
.ws-oddsw { font-size: 12px; margin-top: 2px; }
/* size tiers (#67/#68): Tier 1 · 1×1 / Tier 2 · 2×2 / Tier 3 · 4×4 switch on a craft card */
.ws-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0 4px; }
.ws-size { min-width: 0; min-height: 46px; padding: 4px 4px; background: rgba(255,255,255,.03); }
.ws-size.on { border-color: var(--amber); color: var(--amber); background: rgba(255, 196, 90, .08); box-shadow: 0 0 10px rgba(255, 196, 90, .2); }
.ws-size.dim:not(.on) { opacity: .55; }
.ws-size-in { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 6px; row-gap: 1px; }
.ws-size-in small { grid-column: 1 / -1; text-align: center; font-size: 12px; font-weight: 500; color: #9fb0c8; line-height: 1.1; white-space: nowrap; }
.ws-size-in b { font-size: 15px; line-height: 1.1; }
.ws-size.on .ws-size-in small { color: inherit; }
.ws-sq { width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 3px; display: inline-block; opacity: .9;
  background-image: linear-gradient(currentColor 1px, transparent 1px), linear-gradient(90deg, currentColor 1px, transparent 1px); background-position: -1px -1px; }
.ws-sq.s1 { background-image: none; background-color: rgba(255,255,255,.12); }
.ws-sq.s2 { background-size: 50% 50%; }
.ws-sq.s4 { background-size: 25% 25%; }
.ws-ore { margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ws-why { font-size: 13px; margin-top: 6px; }
.it-fit { font-size: 13px; margin-top: 6px; padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.03); border-left: 3px solid currentColor; }
.cache-card { border-color: #ffd84a66; background: linear-gradient(160deg, rgba(60,46,10,.35), rgba(14,18,34,.9)); }
.cache-roll { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(4,6,12,.72); }
.cr-box { padding: 26px 34px; border: 2px solid #ffd84a; border-radius: 16px; background: #0b0f1d; box-shadow: 0 0 60px #ffd84a55; min-width: min(420px, 86vw); text-align: center; }
.cr-name { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.uq.got { border-color: #ff9a1f66; }
button.off { opacity: .5; }
/* ship upgrades (ui/upgrades.js) */
.up-hero { display: flex; gap: 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(20,30,50,.5); margin-bottom: 8px; }
.up-rating { font-size: 34px; font-weight: 800; color: #ffd27a; line-height: 1; }
.up-ways { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-size: 13px; }
.up-way b { display: inline-block; min-width: 64px; color: #8fd8ff; }
.up-way.craft b { color: #6dffa0; } .up-way.loot b { color: #ffb35a; } .up-way.build b { color: #c9a0ff; } .up-way.yard b { color: #ffd27a; }
.gx-svc { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; }
.gx-svc .chip { font-size: 11px; padding: 2px 7px; }
.chip.dim { opacity: .45; }
