/* Galaxy Mode screens. */
.icon-btn,
.view-controls button,
.dock-btn,
.sheet-actions button,
#inventory-close,
#meters-more {
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}

.topbar {
  position: fixed;
  z-index: 36;
  top: calc(8px + var(--frame-y) + env(safe-area-inset-top));
  left: calc(14px + var(--frame-x) + env(safe-area-inset-left));
  right: calc(14px + var(--frame-x) + env(safe-area-inset-right));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 12px;
  pointer-events: none;
}

.brand { min-width: 0; pointer-events: none; }
.brand h1,
.brand .eyebrow {
  pointer-events: auto;
  cursor: pointer;
}

.eyebrow {
  margin: 1px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--transfer);
}

h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
  flex: none;
}

.top-menus {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(120, 196, 214, 0.38);
  border-radius: 4px;
  background: rgba(8, 18, 28, 0.82);
  color: var(--ink);
  backdrop-filter: blur(16px);
  padding: 0;
}

#own-ship-arrow {
  position: fixed;
  z-index: 33;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

#own-ship-arrow[hidden] { display: none; }

#own-ship-arrow i {
  display: block;
  width: 0;
  height: 0;
  margin: 4px auto 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 12px solid #ffe27a;
  filter: drop-shadow(0 0 6px rgba(255, 193, 74, 0.85));
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

#settings-open svg,
#primarus-open svg,
#guide-open svg,
#admin-open svg,
#map-open svg,
#wallet-open svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

#search-open[aria-expanded="true"] {
  color: #071018;
  background: var(--swap);
  border-color: var(--swap);
}

#admin-open {
  color: #1a1204;
  background: #ffc14a;
  border-color: #ffc14a;
}

#admin-open[aria-expanded="true"] {
  color: #ffc14a;
  background: #1a1204;
}

#settings-open[aria-expanded="true"],
#map-open[aria-expanded="true"],
#wallet-open[aria-expanded="true"] {
  color: var(--bg);
  background: var(--swap);
  border-color: var(--swap);
}

#wallet-open.live {
  color: #1a1408;
  background: #ffe27a;
  border-color: #ffe27a;
}

.wallet-menu { position: relative; pointer-events: auto; }

.wallet-panel {
  width: min(280px, calc(100vw - 96px));
}

.wallet-address {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink);
}

.wallet-name {
  display: block;
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--swap);
}

#wallet-nickname,
#ship-nickname,
#account-email,
#account-password,
#account-current,
#account-next {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--swap);
  border-radius: 12px;
  background: rgba(8, 10, 18, 0.55);
  color: var(--ink);
  font: 500 14px/1.2 "Sora", sans-serif;
}

.ship-name { margin: 10px 0 0; }

.ship-name button {
  border: 1px solid rgba(232, 238, 246, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 600 13px/1 "Sora", sans-serif;
  padding: 10px 12px;
}

.wallet-actions {
  display: flex;
  gap: 8px;
}

.wallet-actions button,
.wallet-providers-empty {
  border: 1px solid rgba(232, 238, 246, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 600 13px/1 "Sora", sans-serif;
  padding: 10px 12px;
}

.wallet-actions button { flex: 1; }

#wallet-providers .source-row { grid-template-columns: 28px 1fr; }

.wallet-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

span.wallet-mark {
  display: grid;
  place-items: center;
  background: rgba(255, 193, 74, 0.16);
  color: var(--swap);
  font: 700 11px/1 "Sora", sans-serif;
}

#power-sliders input:disabled { opacity: 0.45; cursor: default; }

#tracked-list button.pilot strong::before,
#selection-list button.pilot strong::before {
  content: "◆ ";
  color: #ffe27a;
}

.pick-callout.pilot-name::before {
  content: none;
}

.map-panel {
  width: min(280px, calc(100vw - 32px));
}

.map-panel .source-row { grid-template-columns: 36px 1fr; }

.map-panel .source-row[data-faction="dominion"][aria-checked="true"] .source-switch { background: #e23b3b; }
.map-panel .source-row[data-faction="vanguard"][aria-checked="true"] .source-switch { background: #3b7cff; }
.map-panel .source-row[data-faction="ascendancy"][aria-checked="true"] .source-switch { background: #b45cff; }
.map-panel .source-row[data-faction="mercenary"][aria-checked="true"] .source-switch { background: #ff9a2a; }
.map-panel .source-row[data-faction="independent"][aria-checked="true"] .source-switch { background: #f4f1ea; }

.settings { position: relative; pointer-events: auto; display: flex; gap: 8px; align-items: flex-start; }

.settings-panel {
  position: absolute;
  top: 52px;
  right: 0;
  width: min(300px, calc(100vw - 32px));
  max-height: calc(var(--app-height, 100dvh) - 120px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(16, 40, 54, 0.96), rgba(6, 14, 22, 0.94));
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}

.wallet-menu .wallet-panel {
  right: 54px;
  width: min(280px, calc(100vw - 96px));
}

.sources-kicker { margin-top: 16px; }

.zone-legend {
  display: flex;
  gap: 14px;
  padding: 2px 12px 8px;
  color: #c5d0d6;
  font-size: 11px;
}

.zone-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: -1px;
}

.zone-legend i.neutral { background: #8ea2b8; }
.zone-legend i.disputed { background: #d7c39a; }

.settings-kicker {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--swap);
}

.settings-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-list { display: flex; flex-direction: column; gap: 8px; }

.sound-level {
  display: grid;
  grid-template-columns: 58px 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: -2px 4px 2px;
  color: var(--muted);
  font: 500 11px/1 "IBM Plex Mono", monospace;
}

.sound-level output { color: var(--ink); text-align: right; }

.sound-level input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--swap);
}

.source-row {
  display: grid;
  grid-template-columns: 36px 1fr 10px;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}

.source-row strong { display: block; font-size: 13px; font-weight: 600; }
.source-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.source-switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(232, 238, 246, 0.16);
  position: relative;
}

.source-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
}

.source-row[aria-checked="true"] .source-switch { background: var(--swap); }
.source-row[aria-checked="true"] .source-switch i { background: var(--bg); transform: translateX(16px); }

.display-block { margin-top: 12px; }

.display-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.display-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.display-choices button {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.display-choices button[aria-pressed="true"] {
  background: var(--swap);
  border-color: var(--swap);
  color: var(--bg);
}

.display-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.display-switch { margin-top: 12px; }

.display-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  margin-top: 10px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.source-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(232, 238, 246, 0.25);
}

.source-pip.on { background: var(--mint); box-shadow: 0 0 8px var(--mint); }

.ship-search {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(var(--dock-h) + 8px);
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0;
  pointer-events: auto;
}

.ship-search input {
  width: 100%;
  min-width: 0;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  font-family: "IBM Plex Mono", monospace;
  font-size: 16px;
  color: var(--ink);
  background: rgba(8, 10, 18, 0.92);
  border: 1px solid var(--swap);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  min-height: 44px;
}

.ship-search button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 10, 18, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 14px;
  cursor: pointer;
  min-height: 44px;
  pointer-events: auto;
}

.ship-search-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.4;
}

.meters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: safe center;
  gap: 6px 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  pointer-events: auto;
}

.meters::-webkit-scrollbar { display: none; }

.meter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  height: 18px;
}

.meter::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: -4px;
  bottom: -8px;
}

.meter svg { width: 14px; height: 14px; flex: none; }
.meter.ships svg { color: #7ee0ff; }
.meter.pulses svg { color: #d56bff; }
.meter.launches svg { color: #ff9a3c; }
.meter.nfts svg { color: #b388ff; }

.meter span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #e7eef6;
}

.meter-name {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#meters-more {
  position: relative;
  width: 14px;
  height: 14px;
  flex: none;
  margin-left: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

#meters-more::after {
  content: "";
  position: absolute;
  inset: -6px -4px -8px;
}

#meters-more svg { width: 12px; height: 12px; transform: rotate(180deg); }
#meters-more[aria-expanded="true"] { color: var(--ink); }
#meters-more[aria-expanded="true"] svg { transform: none; }

.meter-tray {
  position: fixed;
  z-index: 37;
  top: auto;
  bottom: var(--meters-lift, 72px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

#status,
#status-mirror {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

#status.live, #status-mirror.live { color: var(--mint); }
#status.stale, #status-mirror.stale { color: var(--swap); }
#status.offline, #status-mirror.offline { color: #ff8d8d; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.source { text-transform: none; letter-spacing: 0; }

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}

.swatch.nft { background: var(--nft); color: var(--nft); }
.swatch.transfer { background: var(--transfer); color: var(--transfer); }
.swatch.mint { background: var(--mint); color: var(--mint); }
.swatch.swap { background: var(--swap); color: var(--swap); }
.swatch.bridge { background: var(--bridge); color: var(--bridge); }
.swatch.burn { background: var(--burn); color: var(--burn); }
.swatch.node { background: var(--swap); color: var(--swap); }

.view-controls {
  position: fixed;
  z-index: 30;
  right: calc(14px + var(--frame-x) + env(safe-area-inset-right));
  top: calc(164px + var(--frame-y) + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.view-controls button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232, 238, 246, 0.12);
  border-radius: 14px;
  background: rgba(10, 12, 20, 0.55);
  color: var(--ink);
  backdrop-filter: blur(14px);
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.view-controls svg { width: 20px; height: 20px; }

.zoom-pair {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(232, 238, 246, 0.12);
}

.zoom-pair button {
  border: 0;
  border-radius: 0;
  background: rgba(10, 12, 20, 0.55);
}

.zoom-pair button + button { border-top: 1px solid rgba(232, 238, 246, 0.1); }

.hail-dock {
  position: fixed;
  z-index: 30;
  left: calc(12px + var(--frame-x) + env(safe-area-inset-left));
  bottom: var(--dock-h);
  width: min(420px, calc(100vw - 84px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

body.detail-open .hail-dock {
  top: calc(128px + env(safe-area-inset-top));
  bottom: auto;
  width: min(420px, calc(100vw - 28px));
}

#hails {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

#hails:empty { display: none; }

#hails li {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink);
  background: rgba(8, 10, 18, 0.86);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
}

.cam-readout {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(4px + var(--frame-y) + env(safe-area-inset-bottom) + var(--keyboard));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 16px);
  height: 22px;
  margin: 0;
  padding: 0 2px 0 10px;
  border: 1px solid rgba(232, 238, 246, 0.12);
  border-radius: 999px;
  background: rgba(12, 14, 22, 0.55);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.readout-dot {
  flex: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  color: var(--muted);
}

#cam-pose {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

#cam-copy {
  width: 16px;
  height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

#cam-copy svg { width: 10px; height: 10px; }
#cam-copy.copied { color: var(--mint); }

.bottom-chrome {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(4px + var(--frame-y) + env(safe-area-inset-bottom) + var(--keyboard));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(720px, calc(100vw - 20px - (var(--frame-x) * 2)));
  pointer-events: none;
}

.bottom-chrome .dock,
.bottom-chrome .cam-readout {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
}

.bottom-chrome .dock,
.bottom-chrome .cam-readout {
  max-width: 100%;
}

@media (max-width: 520px) {
  .meter svg { width: 12px; height: 12px; }
  .meter span { font-size: 12px; }
  .meters { gap: 4px 8px; }
}

.dock[hidden],
.dock-btn[hidden] {
  display: none !important;
}

.dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(30px + var(--frame-y) + env(safe-area-inset-bottom) + var(--keyboard));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 20px);
  padding: 6px;
  border-radius: 22px;
  border: 1px solid rgba(232, 238, 246, 0.12);
  background: rgba(12, 14, 22, 0.55);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.ship-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dock-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #9aa6b8;
  padding: 0;
}

.dock-btn svg { width: 18px; height: 18px; }

.dock-btn.alerts,
.dock-btn.find,
.dock-btn.tracked {
  border-radius: 50%;
  color: #d7e7ff;
  border: 2px solid transparent;
  background-image: linear-gradient(rgba(20, 24, 36, 0.62), rgba(20, 24, 36, 0.62)), linear-gradient(140deg, #7ee0ff, #9b7bff 45%, #ff4fd8);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 14px rgba(160, 120, 255, 0.35);
}

.dock-btn.alerts svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dock-btn.alerts span {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ffc14a;
  color: #071018;
  font: 700 10px/16px "IBM Plex Mono", monospace;
  text-align: center;
  pointer-events: none;
}

.dock-btn.alerts.on,
.dock-btn.find.on,
.dock-btn.tracked.on {
  color: #fff;
  box-shadow: 0 0 18px rgba(160, 120, 255, 0.72);
}

.dock-btn.alerts.is-live {
  color: #ffc14a;
  animation: dispatch-flash 1.05s ease-in-out infinite;
}

@keyframes dispatch-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 74, 0); }
  50% { box-shadow: 0 0 0 7px rgba(255, 193, 74, 0.28); }
}

@media (prefers-reduced-motion: reduce) {
  .dock-btn.alerts.is-live { animation: none; box-shadow: 0 0 0 2px rgba(255, 193, 74, 0.7); }
}

.dock-btn.object {
  color: #7ee0ff;
  background: rgba(126, 224, 255, 0.1);
  border: 1px solid rgba(126, 224, 255, 0.55);
}

.dock-btn.object.on {
  color: #071018;
  background: #7ee0ff;
  border-color: #7ee0ff;
}

.panel {
  pointer-events: auto;
  touch-action: manipulation;
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--panel-bottom);
  width: min(560px, calc(100vw - 16px));
  height: min(46dvh, 480px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(16, 40, 54, 0.96), rgba(6, 14, 22, 0.94));
  backdrop-filter: blur(18px);
}

body.feed-off .panel { display: none; }

body.detail-open:not(.feed-off) .panel {
  bottom: var(--sheet-stack);
  height: min(24dvh, 200px);
}

.panel-head {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
}

.panel h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b7e7f2;
}
#status { flex: 1; min-width: 8rem; text-align: right; }

.filters {
  display: flex;
  flex: none;
  gap: 6px;
  margin: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filters button {
  flex: none;
  border: 1px solid rgba(120, 196, 214, 0.35);
  background: rgba(8, 20, 28, 0.8);
  color: #d5eef5;
  border-radius: 2px;
  padding: 5px 10px;
  min-height: 36px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font: 500 12px/1 "Sora", sans-serif;
  cursor: pointer;
}

.filters button.on { color: #071018; background: #8fd0e4; border-color: #8fd0e4; }

#feed {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 4px 12px 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#feed button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 12px 4px;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}

.row-top, .route { display: flex; justify-content: space-between; gap: 10px; }
.row-top span, .route span { min-width: 0; overflow-wrap: anywhere; }

.kind {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kind.nft { color: var(--nft); }
.kind.transfer { color: var(--transfer); }
.kind.mint { color: var(--mint); }
.kind.swap { color: var(--swap); }
.kind.bridge { color: var(--bridge); }
.kind.burn { color: var(--burn); }
.kind.allowance, .kind.other { color: var(--allowance); }

.token { color: var(--muted); font-size: 12px; text-align: right; }
.route { margin-top: 6px; font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.meta { margin-top: 4px; color: var(--muted); font-size: 11px; }

#lists {
  position: fixed;
  z-index: 12;
  left: calc(12px + var(--frame-x) + env(safe-area-inset-left));
  top: max(calc(64px + env(safe-area-inset-top)), var(--lists-top));
  bottom: var(--lower);
  width: min(260px, calc(100vw - 78px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  pointer-events: none;
}

#lists:has(#selection:not([hidden])) {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

#selection {
  position: relative;
  flex: 1 1 0;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  touch-action: manipulation;
  overflow: hidden;
}

#tracked {
  position: fixed;
  z-index: 31;
  left: calc(10px + var(--frame-x) + env(safe-area-inset-left));
  right: calc(10px + var(--frame-x) + env(safe-area-inset-right));
  bottom: var(--dock-h);
  width: auto;
  max-width: 560px;
  margin: 0 auto;
  max-height: min(46dvh, 420px);
  display: flex;
  flex-direction: column;
  padding: 12px 12px 8px;
  border: 1px solid rgba(232, 238, 246, 0.12);
  border-radius: 24px;
  background: rgba(10, 12, 20, 0.62);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  touch-action: manipulation;
  overflow: hidden;
}

body.detail-open #tracked,
body.detail-open #dispatch {
  bottom: var(--sheet-stack);
}

#tracked-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #c5ceda;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.selection-head,
.head-actions { display: flex; align-items: center; gap: 8px; }
.selection-head { justify-content: space-between; flex-wrap: wrap; }
.head-actions { flex: none; }

#selection-kicker,
#tracked-kicker,
#inventory-kicker {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--transfer);
}

#tracked-kicker { color: var(--mint); }

#selection-track,
#selection-close,
#tracked-clear {
  flex: none;
  border: 1px solid var(--line);
  background: rgba(8, 10, 18, 0.55);
  color: var(--ink);
  border-radius: 999px;
  min-height: 36px;
  padding: 8px 14px;
  font: 500 13px/1 "Sora", sans-serif;
  cursor: pointer;
}

#selection-track.on {
  background: rgba(198, 245, 106, 0.16);
  border-color: rgba(198, 245, 106, 0.5);
}

#selection-count,
#tracked-count { margin: 8px 0 0; }

#selection-list,
#tracked-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#tracked-list { max-height: min(36dvh, 280px); }

#selection-list button,
#tracked-list button {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 8px 4px;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}

#selection-list button.on,
#tracked-list button.on { background: rgba(255, 193, 74, 0.14); }

#selection-list .kind,
#tracked-list .kind { font-size: 10px; letter-spacing: 0.08em; }

#tracked-list button { grid-template-columns: 104px minmax(0, 1fr); }

#tracked-list .kind { white-space: nowrap; }

#selection-list strong,
#tracked-list strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

#inventory {
  position: fixed;
  z-index: 27;
  inset: 0;
  width: auto;
  max-width: none;
  margin: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: rgba(6, 8, 14, 0.4);
  box-shadow: none;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: text;
  -webkit-user-select: text;
}

#inventory[hidden] { display: none !important; }

.track-chip,
.sheet-card { pointer-events: auto; }

.track-chip {
  align-self: center;
  width: min(440px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 10px;
  border-radius: 18px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  background: rgba(8, 12, 18, 0.9);
  backdrop-filter: blur(16px);
}

#inventory.is-tracked .track-chip {
  border-color: rgba(61, 255, 138, 0.55);
  box-shadow: 0 0 0 1px rgba(61, 255, 138, 0.12);
}

.chip-thumb {
  width: 46px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
}

.chip-thumb svg { width: 46px; height: 28px; }

.chip-copy { min-width: 0; flex: 1; }
.chip-copy strong {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
}
.chip-copy small {
  display: block;
  margin-top: 1px;
  color: #9dffc2;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#sheet-expand,
#chip-close {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d5deea;
  padding: 0;
  cursor: pointer;
}

#sheet-expand svg { width: 16px; height: 16px; transition: transform 0.15s linear; }
#sheet-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
#chip-close { font-size: 22px; line-height: 1; }

.sheet-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(78px + var(--frame-y) + env(safe-area-inset-top))
    calc(18px + var(--frame-x) + env(safe-area-inset-right))
    calc(var(--dock-h) + 16px + env(safe-area-inset-bottom) + var(--keyboard))
    calc(18px + var(--frame-x) + env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.inventory-head {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.sheet-thumb {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 40%, rgba(80, 150, 255, 0.28), transparent 60%),
    #10151f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sheet-thumb svg { width: 48px; height: 36px; }

.sheet-id { min-width: 0; }
.sheet-id .meta { margin: 2px 0 0; font-size: 13px; color: #c5d0de; }

.name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }

.name-pencil {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d5deea;
  padding: 0;
  cursor: pointer;
}

.name-pencil svg { width: 16px; height: 16px; }
.name-pencil[hidden] { display: none; }

.ship-rename {
  position: fixed;
  z-index: 80;
  left: 50%;
  top: calc(var(--frame-y) + 72px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 32px - (var(--frame-x) * 2)));
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(120, 196, 214, 0.55);
  border-radius: 16px;
  background: rgba(8, 14, 22, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.ship-rename[hidden] { display: none !important; }

.ship-rename label {
  margin: 0;
  color: #9eb0c4;
  font: 600 11px/1 "Sora", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ship-rename input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--swap);
  border-radius: 12px;
  background: rgba(8, 10, 18, 0.55);
  color: var(--ink);
  font: 500 16px/1.2 "Sora", sans-serif;
}

.ship-rename-actions {
  display: flex;
  gap: 8px;
}

.ship-rename-actions button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(232, 238, 246, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 600 14px/1 "Sora", sans-serif;
  cursor: pointer;
}

.ship-rename-actions button[type="submit"] {
  border-color: #ffc14a;
  background: rgba(255, 193, 74, 0.16);
  color: #ffc14a;
}

.ship-rename .meta {
  margin: 0;
  color: #ffb4a8;
  font-size: 13px;
  line-height: 1.35;
}

.ship-wallet {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 1px 0 0;
  min-width: 0;
  color: #d5deea;
  font: 500 12px/1.2 "IBM Plex Mono", monospace;
}

.ship-wallet[hidden] { display: none; }

.ship-wallet span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ship-wallet button {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

.ship-wallet button svg { width: 13px; height: 13px; }
.ship-wallet button.copied { color: var(--mint); }

.ship-wallet b {
  flex: none;
  margin-left: auto;
  color: var(--swap);
  font: 600 12px/1 "IBM Plex Mono", monospace;
}

#name-copy {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

#name-copy svg { width: 14px; height: 14px; }
#name-copy.copied { color: var(--mint); }

#inventory.ship-detail #inventory-kicker { display: none; }

#inventory.ship-detail #inventory-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #3dff8a;
  box-shadow: 0 0 8px #3dff8a;
}

#inventory h2 {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  color: #f7fafc;
}

#inventory,
#inventory .meta,
#inventory .sheet-id .meta,
#inventory li,
#inventory-power .meta,
#combat-card,
#combat-faction,
.combat-meters > div,
.fold-toggle,
#inventory .detail-tabs button {
  color: #f3f7fb;
}

#inventory .meta,
#inventory .sheet-id .meta,
#inventory li,
#inventory-power .meta,
.combat-meters > div,
.fold-toggle {
  font-size: 14px;
}

#inventory li span:last-child { color: #dbe3ee; }

.sheet-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

#inventory .status-pill { align-self: flex-start; margin: 8px 0 0; }

.status-pill {
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #1c8f4d;
  color: #f3fff6;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill[data-state="route"] { background: #1a6f8a; }
.status-pill[data-state="hold"] { background: #8a6416; }
.status-pill[data-state="return"] { background: #8a6416; }
.status-pill[data-state="plot"] { background: #8a3d16; }
.status-pill[data-state="combat"] { background: #8a2a2a; }
.status-pill[data-state="rebuild"] { background: #3d4654; }

#inventory:not(.ship-detail) .status-pill,
#inventory:not(.ship-detail) .hull-row,
#inventory:not(.ship-detail) .stat-grid,
#inventory:not(.ship-detail) #sheet-tabs,
#inventory:not(.ship-detail) #ship-order-card,
#inventory:not(.ship-detail) #sheet-more,
#inventory:not(.ship-detail) #inventory-cargo,
#inventory:not(.ship-detail) #sheet-expand,
#inventory:not(.ship-detail) #sheet-extra { display: none !important; }

#inventory:not(.ship-detail) .sheet-actions { grid-template-columns: 1fr 1fr; }

#inventory-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #c5ceda;
  font-size: 26px;
  line-height: 1;
  padding: 0;
}

.inventory-body { flex: 0 0 auto; }

.hull-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 14px 0 12px;
  color: #c5ceda;
  font-size: 14px;
}

.power-meter {
  height: 8px;
  border-radius: 99px;
  background: #1b2430;
  overflow: hidden;
}

.power-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #178a45, #3dff8a);
}

#hull-pct {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: #d5deea;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  min-width: 0;
  padding: 8px 4px 6px;
  cursor: pointer;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

.stat-tile svg { width: 16px; height: 16px; display: block; margin: 0 auto 4px; }
.stat-tile.power svg { color: #ff9a3c; }
.stat-tile.defense svg { color: #5aa2ff; }
.stat-tile.manifest svg { color: #9aa8ba; }
.stat-tile.nfts svg { color: #b388ff; }

.stat-tile strong {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.stat-tile small { color: var(--muted); font-size: 11px; }

.sheet-actions {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr 46px;
  gap: 8px;
  margin-top: 12px;
}

.sheet-actions button {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(232, 238, 246, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #d5deea;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.sheet-actions svg { width: 16px; height: 16px; flex: none; }

.sheet-corner {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 4px;
}

#inventory-track {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d5deea;
  cursor: pointer;
}

#inventory-track svg { width: 16px; height: 16px; }
#inventory-track .track-minus { display: none; }
#inventory-track.on .track-plus { display: none; }
#inventory-track.on .track-minus { display: block; }

#inventory-track.on {
  color: var(--mint);
  background: transparent;
}

#sheet-more {
  padding: 0;
  letter-spacing: 0.12em;
  color: #c5ceda;
}

#sheet-menu { margin-top: 8px; }

.detail-tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

#sheet-tabs.detail-tabs {
  margin: 0 0 8px;
}

#sheet-tabs[hidden] { display: none; }

#sheet-tabs.detail-tabs button.on {
  color: #071018;
  background: #ffc14a;
  border-color: #ffc14a;
}

#sheet-body,
#sheet-loadout,
#sheet-cargo {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#sheet-body[hidden],
#sheet-loadout[hidden],
#sheet-cargo[hidden] { display: none; }

.detail-tabs button {
  flex: 1;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: 600 12px/1 "Sora", sans-serif;
  cursor: pointer;
}

.detail-tabs button.on {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

.inventory-scroll {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: min(52dvh, 480px);
  margin-top: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#inventory h3 {
  margin: 12px 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
#system-brief { margin-top: 4px; }
.system-banner {
  height: 84px;
  margin: 0 0 8px;
  border-radius: 12px;
  background: #10161f center / cover no-repeat;
  box-shadow: inset 0 -24px 28px rgba(6, 8, 14, 0.72);
}
#system-brief h3 { margin-top: 2px; }
.system-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0 0 4px;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.system-row:hover { background: rgba(232, 238, 246, 0.06); }
.system-row.on { background: rgba(198, 245, 106, 0.14); }
.system-row .kind {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.system-row .body-name {
  font-size: 13px;
  color: var(--ink);
}

#inventory-power .meta {
  margin: 4px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.power-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.power-row input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--transfer);
  touch-action: none;
  cursor: pointer;
}

#fit-save {
  position: sticky;
  bottom: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 8px 8px 8px 14px;
  border: 1px solid rgba(255, 193, 74, 0.55);
  border-radius: 16px;
  background: rgba(18, 14, 8, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

#fit-save span {
  color: #ffe7bf;
  font: 600 13px/1.3 "Sora", sans-serif;
}

#fit-save button {
  appearance: none;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 193, 74, 0.9);
  border-radius: 16px;
  background: rgba(28, 18, 8, 0.92);
  color: #ffe7bf;
  font: 700 12px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

#fit-save[hidden] { display: none; }
#fit-save button:disabled { opacity: 0.55; cursor: default; }

.power-row span:last-child { color: var(--muted); text-align: right; }

.ship-hangar {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #f3f7fb;
  font-size: 14px;
}
.ship-hangar[hidden] { display: none; }
.hangar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.hangar-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3f7fb;
}
.hangar-balance {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: #ffc14a;
}
.hangar-edge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: #f3f7fb;
}
.hangar-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.doctrine-info,
.doctrine-guide summary {
  touch-action: manipulation;
}
.doctrine-info {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px 0;
  border: 1px solid rgba(243, 247, 251, 0.28);
  border-radius: 50%;
  background: rgba(20, 30, 44, 0.7);
  color: #7ee0ff;
  font: 700 16px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.doctrine-guide {
  margin: 0 0 12px;
  color: #f3f7fb;
  font-size: 14px;
  line-height: 1.45;
}
.doctrine-guide summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
.doctrine-guide summary::-webkit-details-marker { display: none; }
.doctrine-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(126, 224, 255, 0.55);
  border-radius: 50%;
  color: #7ee0ff;
  font: 700 14px/1 "IBM Plex Mono", monospace;
}
.doctrine-body {
  padding: 4px 0 8px;
}
.doctrine-body p { margin: 0 0 10px; }
.doctrine-body dl { margin: 0 0 10px; }
.doctrine-body dt {
  margin-top: 8px;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.doctrine-body dd { margin: 2px 0 0; color: #d5e2ee; }
.hangar-group { margin-top: 12px; }
.hangar-group h4 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c9d6e4;
}
.hangar-fits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
}
.hangar-fit,
.hangar-buy {
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid rgba(243, 247, 251, 0.22);
  border-radius: 10px;
  background: rgba(20, 30, 44, 0.7);
  color: #f3f7fb;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.hangar-fit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}
.hangar-fit small {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #c9d6e4;
}
.hangar-fit.on {
  border-color: #7ee0ff;
  background: rgba(126, 224, 255, 0.16);
  cursor: default;
}
.hangar-fit:disabled:not(.on),
.hangar-buy:disabled { opacity: 0.55; cursor: default; }
.hangar-buy { width: 100%; margin-top: 6px; }
.hangar-slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 0 2px;
}
.hangar-slot > span {
  color: #9ae7ff;
  font: 600 12px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hangar-picks,
.hangar-flames { display: flex; flex-wrap: wrap; gap: 8px; }
.hangar-pill {
  appearance: none;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(243, 247, 251, 0.22);
  border-radius: 999px;
  background: rgba(20, 30, 44, 0.7);
  color: #f3f7fb;
  font: 600 13px/1 "Sora", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.hangar-pill.on {
  border-color: #7ee0ff;
  background: rgba(126, 224, 255, 0.16);
  color: #fff;
}
.hangar-pill:disabled:not(.on) { opacity: 0.45; cursor: default; }
.hangar-captain {
  min-height: 72px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
}
.hangar-captain strong,
.hangar-captain small { grid-column: 2; }
.hangar-captain img { grid-row: 1 / span 3; }
.hangar-captain img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}
.ship-captain {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
}
.ship-captain[hidden] { display: none; }
.ship-captain img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}
.ship-captain span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.ship-captain strong {
  font-size: 14px;
  font-weight: 600;
}
.ship-captain em {
  font-style: normal;
  font-size: 13px;
  color: #c9d6e4;
}
.rarity-pill {
  display: inline-block;
  margin: 2px 6px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(143, 216, 191, 0.18);
  color: #f3f7fb;
  font-size: 12px;
}
.rarity-legendary, .rarity-unique { background: rgba(255, 193, 74, 0.28); }
.rarity-epic { background: rgba(201, 160, 255, 0.28); }
.rarity-rare { background: rgba(77, 180, 255, 0.28); }
.hangar-flame {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: auto;
  min-height: 40px;
  padding: 0 12px 0 8px;
  border: 1px solid rgba(243, 247, 251, 0.22);
  border-radius: 999px;
  background: rgba(20, 30, 44, 0.7);
  box-shadow: none;
  color: #f3f7fb;
  font: 600 13px/1 "Sora", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.hangar-flame::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--flame, #4db4ff);
  box-shadow: 0 0 8px var(--flame, #4db4ff);
}
.hangar-flame.on { border-color: var(--flame, #7ee0ff); background: rgba(126, 224, 255, 0.12); }
.hangar-flame:disabled:not(.on) { opacity: 0.55; cursor: default; }
.hangar-note {
  margin: 6px 0 0;
  font-size: 13px;
  color: #c9d6e4;
}
.hangar-alert { color: #ffc14a; }

.landmark-block {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.landmark-line {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--landmark, #9fd8ff);
  color: #f3f7fb;
  font-size: 14px;
}
.landmark-charted { --landmark: #9fd8ff; }
.landmark-ruins {
  border-left-color: rgba(243, 247, 251, 0.3);
  color: #c9d6e4;
  font-style: italic;
}
.landmark-found {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
}
.landmark-found input {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(243, 247, 251, 0.22);
  border-radius: 10px;
  background: rgba(8, 14, 22, 0.7);
  color: #f3f7fb;
  font: inherit;
}
.landmark-found .hangar-buy { width: auto; }
@media (max-width: 420px) {
  .landmark-found { grid-template-columns: 1fr; }
  .landmark-found .hangar-buy { width: 100%; }
}

.contributors { margin-top: 12px; }
.contributors h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9d6e4;
}
.roster-row.contributor-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
.contributor-row b {
  color: #ffc14a;
  font-size: 12px;
  text-align: center;
}
.contributor-points { color: #ffc14a !important; font-size: 12px !important; }

#inventory ul { list-style: none; margin: 0; padding: 0; }

#inventory li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

#inventory li span:last-child { color: var(--muted); }

.nft-scroll { min-height: 0; }

#inventory-targets {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.fold-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: #d5deea;
  font: 600 11px/1 "Sora", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.fold-toggle span { flex: 1; text-align: left; }

.fold-toggle b {
  font: 500 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0;
  color: var(--muted);
}

.fold-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.fold-toggle[aria-expanded="true"]::after {
  transform: translateY(2px) rotate(-135deg);
}

.fold-list ul,
.fold-list .nft-scroll {
  max-height: min(28dvh, 220px);
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

#inventory .fold-list {
  display: block;
}

#inventory .fold-list ul,
#inventory .fold-list .nft-scroll {
  max-height: none;
  margin: 0;
}

#inventory-rewards .fold-toggle {
  margin-top: 4px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: #0b2f5c;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.12em;
}

#inventory-rewards .fold-toggle b { color: #fff; }

#inventory-rewards li,
#inventory-hold li,
#inventory-manifest li {
  padding: 10px 12px;
  border-top: 0;
  font-size: 16px;
}

#inventory-rewards li,
#inventory-rewards li span,
#inventory-rewards li span:last-child {
  color: #fff;
}

#inventory-rewards li:nth-child(odd) { background: #1f5f9e; }
#inventory-rewards li:nth-child(even) { background: #2a72b8; }

#inventory-hold .fold-toggle {
  margin-top: 4px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 160, 40, 0.55);
  color: #fff6e4;
  font-size: 16px;
  letter-spacing: 0.12em;
}

#inventory-manifest .fold-toggle {
  margin-top: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(150, 90, 255, 0.55);
  color: #f7efff;
  font-size: 16px;
  letter-spacing: 0.12em;
}

#inventory-hold li:nth-child(odd) { background: rgba(255, 176, 64, 0.16); }
#inventory-hold li:nth-child(even) { background: rgba(255, 176, 64, 0.06); }
#inventory-manifest li:nth-child(odd) { background: rgba(176, 120, 255, 0.18); }
#inventory-manifest li:nth-child(even) { background: rgba(176, 120, 255, 0.07); }

#inventory.ship-detail .inventory-scroll {
  overflow: visible;
  max-height: none;
}

#target-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: min(36dvh, 280px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#target-list li {
  display: block;
  padding: 0;
  border-top: 0;
}

#target-list button {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 8px 4px;
  cursor: pointer;
  font: inherit;
}

#target-list button.on { background: rgba(255, 193, 74, 0.14); }
#target-list .kind { font-size: 10px; letter-spacing: 0.08em; white-space: nowrap; }
#target-list strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

.sheet-foot {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(0, 0.7fr);
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.foot-cell { min-width: 0; }

.foot-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.foot-cell div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.foot-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.foot-cell button {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

.foot-cell button.copied { color: var(--mint); }
.foot-cell svg { width: 14px; height: 14px; }

#marquee {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  border: 1px solid rgba(126, 224, 255, 0.95);
  background: rgba(126, 224, 255, 0.14);
}

#tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(8, 10, 18, 0.94);
  border: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  white-space: nowrap;
}

.pick-callout {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.pick-callout > span {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  font: 600 12px/1.2 "IBM Plex Mono", monospace;
  color: inherit;
  background: rgba(8, 10, 18, 0.9);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 10px 5px;
  white-space: nowrap;
}

.pick-callout em {
  font: inherit;
  font-style: normal;
}

.pick-callout .summary-bar {
  display: block;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.pick-callout .summary-bar[hidden] { display: none; }

.pick-callout .summary-bar span {
  display: block;
  height: 100%;
  width: 0;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #7dff9a;
}

.pick-callout .summary-bar.mid span { background: #ffc14a; }
.pick-callout .summary-bar.low span { background: #e23b3b; }

#inspect-object[aria-pressed="true"] {
  color: #071018;
  background: #c6f56a;
}

.sheet-links {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
}

.sheet-links button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 238, 246, 0.2);
  background: transparent;
  color: #d5deea;
  font: 600 12px/1 "Sora", sans-serif;
  cursor: pointer;
}

.sheet-links button[hidden] { display: none; }

.sheet-links button.on {
  color: #071018;
  background: #ffc14a;
  border-color: #ffc14a;
}

.ship-order-card {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 193, 74, 0.45);
  border-radius: 10px;
  background: rgba(255, 193, 74, 0.08);
}

.ship-order-card[hidden] { display: none; }

#ship-order-card:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(52dvh, 480px);
  overflow: auto;
}

.ship-order-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 8px;
}

.ship-order-actions {
  display: flex;
  gap: 8px;
}

.ship-order-head button {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #ffc14a;
  background: rgba(255, 193, 74, 0.16);
  color: #ffc14a;
  font: 600 13px/1.2 "Sora", sans-serif;
  cursor: pointer;
}

.ship-order-actions button {
  flex: 1 1 0;
  width: auto;
}

#ship-order-copy {
  background: transparent;
  color: #d5deea;
  border-color: rgba(255, 193, 74, 0.45);
}

#ship-order-copy.copied {
  color: #9dffb0;
  border-color: #9dffb0;
}

.ship-order-kicker {
  margin: 0 0 4px;
  color: #ffc14a;
  font: 600 10px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ship-order-card h3 {
  margin: 0;
  font: 600 14px/1.2 "Sora", sans-serif;
  color: #f3f7fb;
}

.ship-order-block {
  margin-top: 10px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(142, 162, 184, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.ship-order-block.on {
  border-color: rgba(157, 255, 176, 0.75);
}

.ship-order-block.warn {
  border-color: rgba(255, 180, 168, 0.85);
}

.ship-order-block.on .ship-order-kicker,
.ship-order-block.on h3 { color: #9dffb0; }

.ship-order-block.warn .ship-order-kicker,
.ship-order-block.warn h3 { color: #ffb4a8; }

.ship-order-role {
  margin: 4px 0 0;
  color: #9eb0c4;
  font: 600 11px/1.3 "Sora", sans-serif;
}

#ship-order-text,
#ship-state-text {
  margin: 8px 0 0;
  color: #d5deea;
  font: 400 12px/1.45 "Sora", sans-serif;
}

#ship-order-text .order-lead {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffc14a;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.command-mark {
  width: 22px;
  height: 22px;
  color: #ffc14a;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255, 193, 74, 0.9));
  animation: command-flash 4s ease-out forwards;
}

.command-mark svg {
  display: block;
  width: 22px;
  height: 22px;
}

@keyframes command-flash {
  0% { opacity: 0; transform: translateY(6px); }
  12% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.pick-callout i {
  width: 1px;
  height: 18px;
  background: currentColor;
  display: block;
}

@media (max-height: 520px) {
  h1 { font-size: 15px; }
  .sheet-thumb { width: 44px; height: 44px; }
  .inventory-head { grid-template-columns: 44px minmax(0, 1fr) auto; }
  #inventory h2 { font-size: 16px; }
  .sheet-card { padding: 10px 12px 8px; }
}

@media (max-width: 380px) {
  .stat-tile strong { font-size: 13px; }
  .sheet-actions { grid-template-columns: 1fr 1fr 1fr 40px; }
  .sheet-actions button { font-size: 12px; padding: 0 4px; }
}

#combat-card {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
#combat-faction {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.combat-meters {
  display: grid;
  gap: 4px;
}
.combat-meters > div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.combat-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(232, 238, 246, 0.12);
  overflow: hidden;
}
.combat-bar span {
  display: block;
  height: 100%;
  width: 0;
}
.combat-bar.health span { background: #e23b3b; }
.combat-bar.energy span { background: #3b7cff; }
.empire {
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  user-select: none;
}
.empire img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  opacity: 0.78;
  filter: drop-shadow(0 0 14px currentColor);
}
.system-name {
  z-index: 2 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transform: translateY(11px);
  font-family: "Sora", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #e8eef2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.system-stats {
  display: flex;
  gap: 3px;
  height: 8px;
  align-items: center;
}
.system-stats i {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75);
}
.system-stats i.life {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.empire-title {
  z-index: 40 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  user-select: none;
}
.empire-title img {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: contain;
}
.empire-title span {
  font-family: "Sora", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0 0 10px currentColor,
    0 0 2px rgba(0, 0, 0, 0.95),
    0 1px 3px rgba(0, 0, 0, 0.9);
}
.planet-banner {
  z-index: 5 !important;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(3, 7, 12, 0.84);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
}
.planet-banner img {
  display: block;
  height: 18px;
  width: auto;
  object-fit: contain;
}
.empire span {
  font-family: "Sora", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: currentColor;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(0, 0, 0, 0.85);
}

#selection,
#tracked,
.sheet-card,
.panel,
.meter-tray,
#hails li {
  border-color: rgba(120, 196, 214, 0.42);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(16, 40, 54, 0.96), rgba(6, 14, 22, 0.94));
}

#inventory .sheet-card {
  border-color: transparent;
  border-radius: 0;
  background: transparent;
}

.empire-strip {
  pointer-events: auto;
  display: flex;
  flex: none;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  width: max-content;
  max-width: none;
  min-width: 0;
  height: 22px;
  margin: 0;
  padding: 0 6px;
  overflow: visible;
  border: 1px solid rgba(120, 196, 214, 0.45);
  border-radius: 2px;
  background: rgba(6, 16, 24, 0.72);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.empire-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

.empire-mark {
  width: 14px;
  height: 14px;
  flex: none;
  display: block;
}

.empire-chip:has(.empire-mark)::before { content: none; }

.empire-wait {
  flex: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.empire-chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.empire-fight { color: #ffb15a; }

#outliner {
  position: fixed;
  z-index: 28;
  top: calc(334px + var(--frame-y) + env(safe-area-inset-top));
  right: calc(12px + var(--frame-x) + env(safe-area-inset-right));
  width: min(280px, calc(100vw - 24px));
  bottom: calc(150px + var(--frame-y) + env(safe-area-inset-bottom) + var(--keyboard));
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(120, 196, 214, 0.45);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(12, 32, 44, 0.94), rgba(5, 12, 18, 0.94));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

body:not(.outliner-open) #outliner {
  width: 44px;
  height: 44px;
  bottom: auto;
  overflow: hidden;
  padding: 0;
}

#outliner-toggle {
  flex: none;
  width: 100%;
  min-height: 44px;
  border: 0;
  background: rgba(90, 180, 200, 0.12);
  color: #b7e7f2;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

body:not(.outliner-open) #outliner-toggle {
  font-size: 0;
}

body:not(.outliner-open) #outliner-toggle::before {
  content: "☰";
  font-size: 16px;
  letter-spacing: 0;
}

.outliner-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
}

.outliner-section,
.outliner-row,
.council-factions button,
.roster-row,
.chain-row {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.outliner-section {
  color: #9fd4e4;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.outliner-row small,
.roster-row small,
.chain-row small,
.holding-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.outliner-row strong,
.roster-row strong,
.chain-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outliner-row.on,
.roster-row.on,
.council-factions button.on {
  background: rgba(126, 224, 255, 0.12);
}

.swatch-pip {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

#council {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: calc(68px + var(--frame-y) + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 20px));
  max-height: calc(var(--app-height, 100dvh) - 150px - var(--keyboard));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(120, 196, 214, 0.5);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(14, 36, 48, 0.97), rgba(5, 12, 18, 0.97));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  touch-action: manipulation;
}

.council-head,
.council-tabs { flex: none; }

.council-head,
.duel-side header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 0;
}

.council-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

#council-close {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.council-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  -webkit-overflow-scrolling: touch;
}

.council-tabs button,
.empire-jump {
  min-height: 36px;
  border: 1px solid rgba(120, 196, 214, 0.35);
  border-radius: 2px;
  background: rgba(8, 20, 28, 0.8);
  color: #d5eef5;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.council-tabs button {
  flex: none;
  padding: 0 10px;
}

.council-tabs button[aria-selected="true"] {
  color: #071018;
  background: #8fd0e4;
  border-color: #8fd0e4;
}

.council-layout {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.council-factions,
.council-main-wrap {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.council-factions {
  border-top: 1px solid rgba(120, 196, 214, 0.2);
  border-right: 1px solid rgba(120, 196, 214, 0.2);
}

.council-factions button {
  grid-template-columns: 8px minmax(0, 1fr);
  border-bottom: 1px solid rgba(120, 196, 214, 0.12);
}

.council-factions button strong,
.council-factions button small { display: block; }

.council-factions button small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

body.council-open #outliner,
body.admin-open #outliner { visibility: hidden; }

#admin {
  position: fixed;
  z-index: 46;
  left: calc(var(--frame-x) + env(safe-area-inset-left));
  right: calc(var(--frame-x) + env(safe-area-inset-right));
  top: calc(var(--frame-y) + env(safe-area-inset-top));
  bottom: calc(var(--frame-y) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 193, 74, 0.55);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(28, 22, 10, 0.98), rgba(8, 10, 14, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  touch-action: manipulation;
}

#admin-tabs { flex: none; }

.admin-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 16px 24px;
  overscroll-behavior: contain;
}

.admin-title {
  margin: 18px 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--swap, #ffc14a);
}

#strategy-form,
#doctrine-form {
  display: grid;
  gap: 8px;
}

#strategy-form label,
#doctrine-form label {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#strategy-form label.strategy-interval,
#doctrine-form label {
  grid-template-columns: 118px 44px minmax(0, 1fr);
}

#strategy-form output,
#doctrine-form output {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--text, #d5eef5);
}

#strategy-form input,
#doctrine-form input[type="range"] {
  width: 100%;
  margin: 0;
}

#strategy-form input[type="range"],
#doctrine-form input[type="range"] {
  height: 28px;
  accent-color: var(--swap, #ffc14a);
}

#strategy-form input:not([type="range"]) {
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 193, 74, 0.45);
  border-radius: 2px;
  background: rgba(8, 10, 14, 0.8);
  color: var(--text, #d5eef5);
  font: 13px/1.2 "IBM Plex Mono", monospace;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions button,
#strategy-form button,
#logic-form button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 193, 74, 0.7);
  border-radius: 2px;
  background: rgba(255, 193, 74, 0.14);
  color: #ffc14a;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

.admin-factions {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 12px;
  border-right: 0;
}

.admin-factions button {
  width: max-content;
  min-width: 140px;
}

.usage-wrap { overflow-x: auto; }

#logic-form {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

#logic-form label {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#logic-form input {
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid rgba(255, 193, 74, 0.45);
  border-radius: 2px;
  background: rgba(8, 10, 14, 0.8);
  color: var(--text, #d5eef5);
  font: 13px/1.2 "IBM Plex Mono", monospace;
}

.logic-maps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

.logic-map h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--swap, #ffc14a);
}

.logic-tree,
.logic-tree ul,
.logic-tree li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.logic-tree ul {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 193, 74, 0.28);
}

.logic-tree > li + li,
.logic-tree ul > li + li { margin-top: 8px; }

.logic-step {
  padding: 8px 10px;
  border: 1px solid rgba(255, 193, 74, 0.22);
  border-left: 3px solid rgba(255, 193, 74, 0.35);
  background: rgba(8, 10, 14, 0.55);
}

.logic-step strong {
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #e7eef6;
}

.logic-step .logic-text,
.logic-note {
  display: block;
  margin-top: 4px;
  color: var(--muted, #9eb0c0);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.35;
}

.logic-note {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 193, 74, 0.2);
}

.logic-here,
.logic-exit-mark {
  display: none;
  margin-left: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logic-step.logic-on {
  border-color: rgba(198, 245, 106, 0.7);
  border-left-color: #c6f56a;
  background: rgba(198, 245, 106, 0.08);
}

.logic-step.logic-on strong,
.logic-step.logic-on .logic-here { color: #c6f56a; }

.logic-step.logic-on .logic-here,
.logic-step.logic-exit .logic-exit-mark { display: inline; }

.logic-step.logic-exit {
  border-color: rgba(255, 193, 74, 0.7);
  border-left-color: #ffc14a;
}

.logic-step.logic-exit .logic-exit-mark { color: #ffc14a; }

.usage-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.usage-grid th,
.usage-grid td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 193, 74, 0.16);
  white-space: nowrap;
}

.usage-grid th:first-child,
.usage-grid td:first-child { text-align: left; }

.usage-grid th {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.usage-cycle td {
  padding-top: 14px;
  color: #ffc14a;
  text-align: left;
}

.usage-total td { font-weight: 600; }

.usage-count {
  padding: 0;
  border: 0;
  background: transparent;
  color: #7ee0ff;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.usage-count[aria-expanded="true"] { color: #ffc14a; }

.usage-grid .usage-detail > td {
  white-space: normal;
  text-align: left;
  padding: 8px 8px 12px;
  background: rgba(255, 193, 74, 0.05);
}

.usage-note {
  margin: 0 0 8px;
  color: #c5dbe4;
  font-size: 12px;
}

.usage-grid .usage-nested {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.usage-grid .usage-nested th,
.usage-grid .usage-nested td {
  padding: 4px 8px;
  text-align: left;
  white-space: normal;
  border-bottom: 1px solid rgba(255, 193, 74, 0.12);
  font-weight: 400;
}

.usage-grid .usage-nested th {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.council-main-wrap { padding: 8px 12px 16px; }

#council-main p,
.council-copy {
  margin: 0 0 10px;
  color: #c5dbe4;
  font-size: 13px;
  line-height: 1.45;
}

.stat-grid,
.fit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}

.stat-grid div,
.fit-grid div,
.holding-row,
.chain-row,
.roster-row {
  padding: 6px 8px;
  border: 1px solid rgba(120, 196, 214, 0.16);
  background: rgba(4, 12, 18, 0.45);
}

.stat-grid small,
.fit-grid small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-grid strong,
.fit-grid strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

#holding-query {
  width: 100%;
  min-height: 40px;
  margin: 0 0 8px;
  padding: 0 8px;
  border: 1px solid var(--swap);
  border-radius: 2px;
  background: rgba(4, 10, 16, 0.8);
  color: inherit;
  font: inherit;
}

#doctrine-form {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

#doctrine-form label {
  display: grid;
  grid-template-columns: 118px 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#doctrine-form output {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--text, #d5eef5);
}

#doctrine-form input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--swap, #ffc14a);
}

.war-order {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(120, 196, 214, 0.35);
  border-radius: 2px;
  background: rgba(8, 20, 28, 0.8);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.war-order strong { font-size: 14px; }
.war-order small,
.war-order p { margin: 0; color: var(--muted); }

.holding-row,
.chain-row,
.roster-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0 0 4px;
  color: inherit;
  font: inherit;
  text-align: left;
}

.roster-row,
.chain-row { cursor: pointer; }

.mini-bar {
  width: 72px;
  height: 6px;
  background: rgba(232, 238, 246, 0.12);
  overflow: hidden;
}

.mini-bar span {
  display: block;
  height: 100%;
  background: #7dff9a;
}

.duel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.duel-side {
  min-width: 0;
  padding-bottom: 6px;
  border: 1px solid rgba(120, 196, 214, 0.2);
  background: rgba(4, 12, 18, 0.35);
}

.duel-side header { padding: 6px 8px 0; }
.duel-side header strong {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.duel-side header small {
  color: var(--muted);
  font-size: 10px;
}
.duel .combat-meters { padding: 4px 8px 8px; }
.combat-bar.health span { background: #7dff9a; }
.combat-bar.energy span { background: #5eb6ff; }

#inventory li span.holding-name { flex: 1; min-width: 0; }
#inventory li span.holding-faction {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#inventory li span.holding-share {
  flex: none;
  min-width: 42px;
  text-align: right;
  color: var(--ink);
}

#inventory-facts { margin: 8px 0 0; }
.empire-jump { width: 100%; }

@media (max-width: 800px) {
  .dock {
    max-width: calc(100vw - 16px - (2 * var(--frame-x)));
    justify-content: safe center;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dock::-webkit-scrollbar { display: none; }
  .meters { gap: 4px 8px; }
  .empire-chip { font-size: 11px; gap: 2px; }
  .empire-mark { width: 12px; height: 12px; }
  .council-layout { grid-template-columns: 1fr; }
  .council-factions {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(120, 196, 214, 0.2);
  }
  .council-factions button { width: max-content; flex: none; min-width: 168px; }
  #council {
    top: calc(108px + var(--frame-y) + env(safe-area-inset-top));
  }
  .stat-grid,
  .fit-grid,
  .duel { grid-template-columns: 1fr 1fr; }
  body.outliner-open #outliner {
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    top: auto;
    width: auto;
    bottom: calc(148px + var(--frame-y) + env(safe-area-inset-bottom) + var(--keyboard));
    max-height: 46dvh;
  }
  body.detail-open #outliner {
    z-index: 29;
    left: auto;
    right: calc(12px + env(safe-area-inset-right));
    top: calc(68px + env(safe-area-inset-top));
    bottom: auto;
    width: 44px;
    height: 44px;
    max-height: none;
    overflow: hidden;
  }
  body.detail-open #outliner .outliner-scroll { display: none; }
  body.detail-open #outliner-toggle { font-size: 0; }
  body.detail-open #outliner-toggle::before {
    content: "☰";
    font-size: 16px;
    letter-spacing: 0;
  }
  #inventory { inset: 0; max-height: none; }
  #inventory .sheet-card {
    overflow: auto;
    border-radius: 0;
    padding:
      calc(var(--frame-y) + 52px + env(safe-area-inset-top))
      calc(var(--frame-x) + 8px + env(safe-area-inset-right))
      calc(var(--dock-h) + 44px + env(safe-area-inset-bottom) + var(--keyboard))
      calc(var(--frame-x) + 8px + env(safe-area-inset-left));
  }
  #inventory h2 { font-size: 24px; line-height: 1.15; }
  #inventory .inventory-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    align-items: start;
  }
  #inventory .sheet-thumb { display: none; }
  #inventory .ship-wallet {
    flex-wrap: wrap;
    row-gap: 4px;
    margin-top: 6px;
    font-size: 13px;
  }
  #inventory .ship-wallet b { margin-left: 0; }
  #inventory .detail-tabs { gap: 8px; margin-top: 4px; }
  #inventory .detail-tabs button {
    min-height: 44px;
    font-size: 14px;
  }
  #inventory .sheet-foot {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
  }
  #inventory .foot-cell strong {
    font-size: 14px;
    white-space: normal;
  }
  #inventory .combat-meters > div { font-size: 14px; }
  #inventory .tactical-read { gap: 8px; font-size: 14px; line-height: 1.4; }
  #inventory .fit-grid,
  #inventory .stat-grid { gap: 8px; }
  #inventory .fit-grid div,
  #inventory .stat-grid div { padding: 10px; }
  #inventory .fit-grid small,
  #inventory .stat-grid small { font-size: 11px; }
  #inventory .fit-grid strong,
  #inventory .stat-grid strong { font-size: 15px; }
  #inventory li { padding: 10px 0; }
  #inventory .power-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 14px 0;
    font-size: 14px;
  }
  #inventory .power-row span:first-child { grid-column: 1; grid-row: 1; }
  #inventory .power-row span:last-child { grid-column: 2; grid-row: 1; text-align: right; }
  #inventory .power-row input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 40px;
  }
  #inventory .ship-order-head button { min-height: 44px; font-size: 14px; }
  .system-banner { height: 52px; }
  #council {
    top: calc(108px + var(--frame-y) + env(safe-area-inset-top));
    width: calc(100vw - 12px);
    max-height: calc(var(--app-height, 100dvh) - 180px - var(--keyboard));
  }
}

body.detail-open #outliner {
  z-index: 29;
}

@media (max-width: 420px) {
  .stat-grid,
  .fit-grid,
  .duel { grid-template-columns: 1fr; }
}

.source-row,
.display-choices button,
.display-reset,
#selection-track,
#selection-close,
#tracked-clear,
.view-controls button,
.zoom-pair {
  border-radius: 2px;
  border-color: rgba(120, 196, 214, 0.38);
}

.source-row {
  background: rgba(4, 12, 18, 0.45);
}

.source-row[aria-checked="true"] {
  border-color: rgba(143, 208, 228, 0.75);
  background: rgba(143, 208, 228, 0.08);
}

.source-switch { border-radius: 2px; }
.source-switch i { border-radius: 1px; }
.source-row[aria-checked="true"] .source-switch { background: #8fd0e4; }
.source-row[aria-checked="true"] .source-switch i { background: #071018; }

.display-label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: #9fd4e4;
}

.display-choices button,
.display-reset,
#selection-track,
#selection-close,
#tracked-clear,
.ship-search button {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.display-choices button[aria-pressed="true"],
.ship-search button {
  background: #8fd0e4;
  border-color: #8fd0e4;
  color: #071018;
}

.view-controls button,
.zoom-pair {
  background: linear-gradient(180deg, rgba(16, 40, 54, 0.94), rgba(6, 14, 22, 0.94));
}

.zoom-pair button { background: transparent; }

.ship-search input { border-radius: 2px; }

#feed button {
  display: grid;
  gap: 4px;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 196, 214, 0.18);
  border-radius: 2px;
  background: rgba(4, 12, 18, 0.45);
}

#feed button:hover { border-color: rgba(143, 208, 228, 0.55); }

#feed .kind::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

#hails li { border-radius: 2px; }

#selection-list button,
#tracked-list button,
.system-row {
  border-radius: 2px;
}

.settings-panel {
  max-height: min(68dvh, calc(var(--app-height, 100dvh) - 220px - var(--keyboard)));
}

.filter-kinds { display: flex; flex-direction: column; gap: 8px; }
.filter-kind { display: grid; gap: 4px; }
.filter-mark {
  justify-self: stretch;
  margin-left: 28px;
  min-height: 36px;
  border: 1px solid rgba(120, 196, 214, 0.35);
  border-radius: 2px;
  background: rgba(4, 12, 18, 0.45);
  color: #d5eef5;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.filter-mark[aria-checked="true"] {
  color: #071018;
  background: #8fd0e4;
  border-color: #8fd0e4;
}
.filter-mark:disabled {
  opacity: 0.38;
  cursor: default;
}

body:not(.feed-off) .ship-search {
  top: calc(78px + var(--frame-y) + env(safe-area-inset-top));
  bottom: auto;
  z-index: 32;
}

body:not(.feed-off) .hail-dock,
body.detail-open .hail-dock {
  top: calc(132px + var(--frame-y) + env(safe-area-inset-top));
  bottom: auto;
  z-index: 32;
}
#combat-line,
#combat-record { margin: 0; }

#dispatch {
  position: fixed;
  z-index: 31;
  left: calc(10px + var(--frame-x) + env(safe-area-inset-left));
  right: calc(10px + var(--frame-x) + env(safe-area-inset-right));
  bottom: var(--dock-h);
  width: auto;
  max-width: 560px;
  margin: 0 auto;
  max-height: min(46dvh, 420px);
  display: flex;
  flex-direction: column;
  padding: 12px 12px 8px;
  border: 1px solid rgba(232, 238, 246, 0.12);
  border-radius: 24px;
  background: rgba(10, 12, 20, 0.62);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  touch-action: manipulation;
  color: #e7eef6;
  overflow: hidden;
}

.dispatch-head,
.dispatch-tabs,
.dispatch-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dispatch-head { justify-content: space-between; }

.dispatch-tabs button,
.dispatch-filters button,
#dispatch-more,
.context-actions button,
.fleet-card button {
  border: 1px solid rgba(232, 238, 246, 0.18);
  background: transparent;
  color: #c5d0dc;
  border-radius: 999px;
  min-height: 26px;
  padding: 0 8px;
  font: 600 11px/1 "Sora", sans-serif;
  cursor: pointer;
}

.dispatch-tabs button[aria-selected="true"],
.dispatch-filters button.on,
#dispatch-recent[aria-pressed="true"] {
  color: #071018;
  background: #d5deea;
}

.dispatch-tabs { flex-wrap: wrap; justify-content: flex-end; }

.dispatch-tabs button,
.dispatch-filters button,
#dispatch-more {
  min-height: 36px;
  padding: 8px 14px;
  font: 500 13px/1 "Sora", sans-serif;
}

.dispatch-filters {
  flex-wrap: wrap;
}

#dispatch-kicker { color: var(--swap); }

#dispatch-summary { margin: 8px 0 0; }

#dispatch-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #c5ceda;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#dispatch-list {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(36dvh, 280px);
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

#dispatch-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: start;
  gap: 2px;
  min-width: 0;
}

#dispatch-more { align-self: flex-start; }

.dispatch-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--dispatch-color, #8ea2b8);
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 8px 4px;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
}

#dispatch-list .dispatch-empty {
  display: block;
  margin: 0;
  padding: 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.dispatch-row.major { background: rgba(255, 193, 74, 0.08); }
.dispatch-row.closed { opacity: 0.62; }
.dispatch-row.is-active { box-shadow: inset 0 0 0 1px var(--dispatch-color, #ffc14a); }
.dispatch-row strong,
.dispatch-row small,
.dispatch-row em {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-style: normal;
}
.alert-icon { display: flex; width: 18px; height: 18px; margin-top: 1px; color: var(--dispatch-color, #d5deea); }
.alert-icon svg { width: 18px; height: 18px; display: block; }
.dispatch-pips {
  display: inline-flex;
  gap: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.dispatch-pips i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dispatch-battle-track {
  display: block;
  height: 3px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.12);
}
.dispatch-battle-track i {
  display: block;
  height: 100%;
  width: 0;
  background: #e6c03c;
}
.dispatch-row.closed .dispatch-battle-track i { background: #5fd35f; }
.dispatch-row.is-unseen strong::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e6c03c;
  vertical-align: middle;
}
.dispatch-row strong { font: 650 12px/1.3 "Sora", sans-serif; }
.dispatch-row small { color: #9aa8b8; font: 500 10px/1.3 "IBM Plex Mono", monospace; margin-top: 2px; }
.dispatch-row em { margin-top: 3px; font: 500 12px/1.35 "Sora", sans-serif; }
.dispatch-dismiss {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #9aa8b8;
  cursor: pointer;
  padding: 0;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 8px;
}

.context-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.context-group span {
  font: 600 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ea0b4;
  margin-right: 2px;
}

.fleet-card[hidden] { display: none !important; }

.fleet-card {
  position: fixed;
  z-index: 33;
  left: 50%;
  top: calc(50% - 18px);
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 24px - var(--frame-x) * 2));
  max-height: min(640px, calc(var(--app-height, 100dvh) - 220px - var(--frame-y) - env(safe-area-inset-bottom) - var(--keyboard)));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px 12px;
  border-radius: 10px;
  border: 1px solid rgba(232, 238, 246, 0.16);
  background: rgba(8, 10, 16, 0.92);
  color: #e7eef6;
  pointer-events: auto;
}

.fleet-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fleet-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 16px; }
.fleet-mark { display: inline-flex; width: 16px; height: 16px; flex: none; }
.fleet-mark svg { width: 16px; height: 16px; display: block; }
.fleet-tag { display: inline-flex; align-items: center; gap: 6px; }
#fleet-composition { margin: 8px 0 0; color: #d5deea; }
#fleet-ships {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.fleet-card button.fleet-ship {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 4px;
  padding: 6px 8px;
  border-radius: 4px;
  min-height: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  background: rgba(4, 12, 18, 0.45);
}
.fleet-ship-pic {
  width: 76px;
  height: 42px;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 55%, rgba(126, 224, 255, 0.16), transparent 68%),
    rgba(0, 0, 0, 0.35);
  border-radius: 3px;
}
.fleet-card button.fleet-ship strong { display: block; font-size: 13px; }
.fleet-card button.fleet-ship small { color: #8ea0b4; }

.fleet-hull {
  position: relative;
  display: block;
  height: 10px;
  margin-top: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.fleet-hull i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
}
.fleet-hull b {
  position: relative;
  z-index: 1;
  display: block;
  padding-right: 4px;
  font: 700 9px/10px "IBM Plex Mono", monospace;
  text-align: right;
  color: #f7fbff;
  text-shadow: 0 1px 1px #000;
}

.fleet-tag { z-index: 60 !important; }
.fleet-tag,
.battle-tag,
.alert-mark {
  pointer-events: auto;
  border: 1px solid currentColor;
  background: rgba(6, 8, 14, 0.88);
  color: inherit;
  border-radius: 999px;
  padding: 3px 8px;
  font: 650 12px/1.2 "Sora", sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-bang {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(8, 6, 8, 0.94);
  color: #fff6ea;
  cursor: pointer;
  pointer-events: auto;
  overflow: visible;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.section-bang-sword {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(100% - 4px);
  width: 16px;
  height: 46px;
  transform: translateX(-50%);
  color: #ff8c12;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 140, 18, 0.95));
}

.section-bang-sword svg {
  display: block;
  width: 100%;
  height: 100%;
}

.section-bang-ring {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 56%, #000 58%);
  mask: radial-gradient(circle, transparent 56%, #000 58%);
}

.section-bang-core {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
}

.section-bang-core i {
  font: 700 16px/1 "IBM Plex Mono", ui-monospace, monospace;
  font-style: normal;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.section-bang.won {
  width: auto;
  height: auto;
  padding: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}

.section-bang.won .section-bang-sword,
.section-bang.won .section-bang-ring,
.section-bang.won .section-bang-core {
  display: none;
}

.section-bang-victory {
  display: none;
  font-family: "Sora", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0 0 10px currentColor,
    0 0 2px rgba(0, 0, 0, 0.95),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

.section-bang.won .section-bang-victory {
  display: block;
}

.section-bang.in {
  animation: section-bang-in 1.15s ease-out;
}

.section-bang.out {
  animation: section-bang-out 0.7s ease-in forwards;
  pointer-events: none;
}

@keyframes section-bang-in {
  0% { transform: scale(0.35); opacity: 0; }
  16% { transform: scale(1.22); opacity: 1; }
  32% { transform: scale(0.9); opacity: 0.45; }
  48% { transform: scale(1.14); opacity: 1; }
  64% { transform: scale(0.96); opacity: 0.65; }
  80% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes section-bang-out {
  to { transform: scale(0.72); opacity: 0; }
}

.section-bang:not(.won):not(.out) .section-bang-ring {
  animation: section-bang-breathe 1.4s ease-in-out infinite;
}

@keyframes section-bang-breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.07); filter: brightness(1.35); }
}

@media (prefers-reduced-motion: reduce) {
  .section-bang.in,
  .section-bang.out,
  .section-bang:not(.won):not(.out) .section-bang-ring { animation: none; }
}

.tactical-read {
  display: grid;
  gap: 3px;
  margin: 8px 0 0;
  font: 500 12px/1.35 "IBM Plex Mono", monospace;
  color: #d5deea;
}

.tactical-read div { display: flex; justify-content: space-between; gap: 8px; }
.tactical-read span { color: #8ea0b4; }

@media (max-width: 720px) {
  #dispatch { max-height: min(40dvh, 320px); }
}
body.settings-open .topbar,
body.hull-manage-open .topbar,
body.settings-open .bottom-chrome,
body.hull-manage-open .bottom-chrome,
body.settings-open #dispatch,
body.hull-manage-open #dispatch,
body.settings-open #battle-board,
body.hull-manage-open #battle-board,
body.settings-open .hail-dock,
body.hull-manage-open .hail-dock,
body.settings-open #ship-search,
body.hull-manage-open #ship-search,
body.settings-open #minute-mark,
body.hull-manage-open #minute-mark,
body.settings-open #fleet-card,
body.hull-manage-open #fleet-card,
body.settings-open .alert-mark,
body.hull-manage-open .alert-mark,
body.settings-open .section-bang,
body.hull-manage-open .section-bang {
  visibility: hidden;
  pointer-events: none;
}

#settings-panel {
  position: fixed;
  z-index: 44;
  inset: 0;
  width: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(6, 8, 14, 0.4);
  backdrop-filter: none;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: 72px;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom) + var(--keyboard))
    calc(16px + env(safe-area-inset-left));
  touch-action: pan-y;
  color: var(--ink);
}

#settings-panel .settings-sheet {
  width: 100%;
  max-width: none;
  margin: 0;
}

#settings-panel .settings-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#settings-panel .map-panel {
  display: contents;
}

#settings-panel .settings-section {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 8px 20px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(120, 196, 214, 0.28);
  background: rgba(4, 10, 16, 0.5);
}

#settings-panel h2.settings-kicker {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 500;
}

#settings-panel .settings-section-body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-start;
  min-width: 0;
}

#settings-panel .settings-section-body > .settings-note {
  flex: 1 1 100%;
  margin: 0;
}

#settings-panel .settings-section-body > .source-list,
#settings-panel .settings-section-body > .filter-kinds {
  flex: 1 1 100%;
  min-width: 0;
}

#settings-panel .settings-section-body > .display-block {
  flex: 1 1 200px;
  margin: 0;
  min-width: min(100%, 180px);
}

#settings-panel .settings-section-body > .source-row,
#settings-panel .settings-section-body > .display-reset {
  flex: 1 1 220px;
  width: auto;
  margin: 0;
}

#settings-panel .settings-section .source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

#settings-panel .settings-section .sound-grid {
  grid-template-columns: 1fr 1fr;
}

#settings-panel #set-view + .settings-section-body > .source-list {
  flex: 1 1 280px;
}

#settings-panel .sound-pair {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

#settings-panel .filter-kinds {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#settings-panel .filter-kind {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

#settings-panel .filter-kind .source-row {
  flex: 1;
  min-width: 0;
}

#settings-panel .filter-mark {
  margin-left: 0;
  flex: none;
  align-self: stretch;
}

.settings-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 4px 12px;
  background: rgba(6, 8, 14, 0.9);
}

#settings-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.45);
  color: #d5deea;
  font: 600 13px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

#settings-panel .display-choices button,
#settings-panel .display-reset,
#settings-panel .filter-mark,
#settings-panel .sound-level {
  min-height: 44px;
}

#settings-panel .sound-level input[type="range"] {
  height: 44px;
}

@media (max-width: 800px) {
  #settings-panel {
    padding:
      calc(8px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      calc(12px + env(safe-area-inset-bottom) + var(--keyboard))
      calc(12px + env(safe-area-inset-left));
  }

  #settings-panel .settings-section {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #settings-panel h2.settings-kicker { margin: 0; }

  #settings-panel .sound-grid,
  #settings-panel .settings-section .source-list,
  #settings-panel .filter-kinds {
    grid-template-columns: 1fr;
  }

  #settings-panel .display-choices button,
  #settings-panel .filter-mark,
  #settings-close {
    min-height: 44px;
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  #settings-panel .filter-kinds { grid-template-columns: 1fr 1fr; }
}

body:has(#council:not([hidden])) .topbar,
body:has(#council:not([hidden])) .bottom-chrome,
body:has(#admin:not([hidden])) .topbar,
body:has(#admin:not([hidden])) .bottom-chrome,
body:has(#dispatch:not([hidden])) .topbar,
body:has(#dispatch:not([hidden])) .bottom-chrome,
body:has(#tracked:not([hidden])) .topbar,
body:has(#tracked:not([hidden])) .bottom-chrome,
body:has(.fleet-card:not([hidden])) .topbar,
body:has(.fleet-card:not([hidden])) .bottom-chrome,
body:has(#wallet-panel:not([hidden])) .topbar,
body:has(#wallet-panel:not([hidden])) .bottom-chrome {
  visibility: hidden;
  pointer-events: none;
}

#council,
#admin,
#dispatch,
#tracked,
.fleet-card,
#wallet-panel {
  position: fixed;
  z-index: 44;
  inset: 0;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  transform: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(6, 8, 14, 0.4);
  backdrop-filter: none;
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom) + var(--keyboard))
    calc(16px + env(safe-area-inset-left));
}

body.detail-open #dispatch,
body.detail-open #tracked {
  inset: 0;
  bottom: 0;
  max-height: none;
}

#council,
#admin {
  display: flex;
  flex-direction: column;
}

.council-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 8px;
  padding: 4px 0 8px;
  background: rgba(6, 8, 14, 0.9);
}

.council-tabs,
#admin-tabs {
  flex-wrap: wrap;
}

.council-tabs button,
#admin-tabs button,
#dispatch-close,
#tracked-close,
#fleet-close,
#council-close,
#admin-close {
  min-height: 44px;
  min-width: 44px;
}

#council .council-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

#council .council-factions,
#admin .admin-factions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  border: 0;
  padding: 0;
}

#council .council-factions button,
#admin .admin-factions button {
  width: auto;
  flex: 1 1 180px;
  border: 1px solid rgba(120, 196, 214, 0.28);
  background: rgba(4, 10, 16, 0.5);
}

#council .council-main-wrap {
  overflow: visible;
}

#strategy-form,
#doctrine-form {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#strategy-form > .council-copy,
#strategy-form > .admin-actions,
#doctrine-form > .council-copy,
#doctrine-form > #doctrine-note,
.admin-title {
  grid-column: 1 / -1;
}

#dispatch,
#tracked,
.fleet-card {
  display: flex;
  flex-direction: column;
}

#dispatch-list,
#tracked-list,
#fleet-ships {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
  flex: 1 1 auto;
  max-height: none;
  align-content: start;
}

#dispatch-list li,
#tracked-list button,
.fleet-card button.fleet-ship {
  border: 1px solid rgba(120, 196, 214, 0.28);
  background: rgba(4, 10, 16, 0.5);
}

#wallet-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#wallet-panel .source-list,
#wallet-panel form {
  width: 100%;
}

#wallet-providers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

@media (max-width: 800px) {
  #council .council-factions,
  #admin .admin-factions,
  #dispatch-list,
  #tracked-list,
  #fleet-ships,
  #strategy-form,
  #doctrine-form {
    grid-template-columns: 1fr;
  }

  #council .council-factions button,
  #admin .admin-factions button {
    flex-basis: 100%;
  }

  .hull-manage,
  .hull-manage-views {
    grid-template-columns: 1fr;
  }

  .hull-manage-list { max-height: 240px; }
}

.admin-gate {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 14, 0.72);
}

.admin-gate[hidden] { display: none; }

.admin-gate-card {
  width: min(420px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.92);
}

.admin-gate-card input {
  width: 100%;
  min-height: 44px;
  margin: 8px 0;
  padding: 0 12px;
  border: 1px solid #ffc14a;
  border-radius: 10px;
  background: rgba(6, 8, 14, 0.65);
  color: #f3f7fb;
  font: 16px/1.2 "Sora", sans-serif;
}

#hull-manage {
  position: fixed;
  z-index: 46;
  inset: 0;
  width: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(6, 8, 14, 0.4);
  overflow: auto;
  overscroll-behavior: contain;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom) + var(--keyboard))
    calc(16px + env(safe-area-inset-left));
  color: #f3f7fb;
}

#hull-manage .settings-sheet { width: 100%; }

#hull-manage-close,
.hull-manage-turn button,
.hull-manage-actions button,
.hull-count input {
  min-height: 44px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.45);
  color: #d5deea;
  font: 600 13px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

#hull-manage-close { padding: 0 16px; }

.hull-manage {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.hull-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100dvh - 140px);
  overflow: auto;
}

.hull-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 6px;
  border: 1px solid rgba(120, 196, 214, 0.28);
  border-radius: 2px;
  background: rgba(4, 10, 16, 0.5);
  color: #f3f7fb;
  text-align: left;
  cursor: pointer;
}

.hull-row.on { border-color: #ffc14a; }

.hull-row img {
  width: 84px;
  height: 44px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.28);
}

.hull-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hull-row strong { font-size: 14px; }

.hull-row small {
  color: #9eb0c4;
  font-size: 11px;
}

.hull-manage-name {
  margin: 0 0 10px;
  font: 600 22px/1.2 "Sora", sans-serif;
}

.hull-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.hull-mode-tabs button {
  min-height: 48px;
  border: 1px solid rgba(243, 247, 251, 0.16);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.35);
  color: #9eb0c4;
  font: 600 14px/1 "Sora", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.hull-mode-tabs [data-hull-mode="engine"].on {
  color: #ffc14a;
  border-color: #ffc14a;
  background: rgba(255, 193, 74, 0.16);
  box-shadow: inset 0 -3px 0 #ffc14a;
}

.hull-mode-tabs [data-hull-mode="weapon"].on {
  color: #7ee7ff;
  border-color: #7ee7ff;
  background: rgba(126, 231, 255, 0.12);
  box-shadow: inset 0 -3px 0 #7ee7ff;
}

.hull-manage-editor[data-mode="engine"] .hull-place canvas {
  box-shadow: inset 0 0 0 1px rgba(255, 193, 74, 0.55);
}

.hull-manage-editor[data-mode="weapon"] .hull-place canvas {
  box-shadow: inset 0 0 0 1px rgba(126, 231, 255, 0.7);
}

.hull-manage-editor[data-mode="weapon"] .hull-manage-views {
  grid-template-columns: 1fr;
}

.hull-manage-editor[data-mode="weapon"] .hull-manage-views figure:not(.hull-place) {
  display: none;
}

.hull-manage-editor[data-mode="weapon"] #hull-orient {
  display: none;
}

.hull-manage-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hull-manage-views figure { margin: 0; }

.hull-manage-views figcaption,
.hull-facing {
  margin: 0 0 6px;
  font: 600 12px/1 "Sora", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3f7fb;
}

.hull-manage-views canvas {
  display: block;
  width: 100%;
  height: auto;
  background: rgba(0, 0, 0, 0.28);
}

#hull-back { cursor: crosshair; }

.hull-stern { position: relative; }

#hull-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hull-mark {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #ffc14a;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
}

.hull-engine-menu {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 6px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.96);
}

.hull-engine-menu[hidden] { display: none; }

.hull-engine-menu button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f3f7fb;
  font: 600 13px/1 "Sora", sans-serif;
  letter-spacing: 0.04em;
  text-align: left;
  cursor: pointer;
}

.hull-engine-menu button[hidden] { display: none; }

.hull-engine-menu button:hover {
  background: rgba(255, 193, 74, 0.16);
  color: #ffc14a;
}

.hull-mark.on {
  box-shadow: 0 0 0 3px #f3f7fb;
}

.hull-mark {
  pointer-events: auto;
  cursor: pointer;
}

.hull-mark[data-kind="gun"] { border-color: #ffd27a; }
.hull-mark[data-kind="missile"] { border-color: #ff8a3d; }
.hull-mark[data-kind="laser"] { border-color: #7ee7ff; }
.hull-mark[data-kind="beam"] { border-color: #ff4b1f; }

.hull-mark::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(6, 8, 14, 0.94);
  color: #f3f7fb;
  font: 600 11px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.hull-mark:hover::after { opacity: 1; }

.hull-manage-turn button.flame-swatch {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
}

.flame-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
}

.flame-swatch.on,
#hull-weapon-kinds button.on,
[data-hull-mode].on,
[data-flame-shape].on { border-color: #f3f7fb; }

.hull-facing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.hull-facing-sides { display: flex; gap: 14px; }

.hull-facing .up,
.hull-facing .down,
.hull-facing .on { color: #ffc14a; }

.hull-slider {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: #d5deea;
  font: 600 12px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hull-slider input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: #ffc14a;
}

.hull-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hull-slider-row input[type="range"] { flex: 1 1 auto; }

.hull-number {
  width: 76px;
  min-width: 76px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid #ffc14a;
  border-radius: 8px;
  background: rgba(6, 8, 14, 0.65);
  color: #f3f7fb;
  font: 600 14px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0;
  text-transform: none;
}

.hull-manage-turn,
.hull-manage-actions,
.hull-count {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0;
}

.hull-manage-turn button,
.hull-manage-actions button { padding: 0 16px; }

.hull-turn-note,
#hull-turn-note { flex: 1; margin: 0; }

.hull-count input {
  width: 72px;
  padding: 0 8px;
  text-transform: none;
  letter-spacing: 0;
}

#hull-save { background: rgba(255, 193, 74, 0.16); border-color: #ffc14a; color: #ffc14a; }

#hull-clear-weapons,
#hull-clear-engines {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.45);
  color: #d5deea;
  font: 600 13px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.away-report {
  position: fixed;
  z-index: 74;
  top: calc(72px + var(--frame-y) + env(safe-area-inset-top));
  right: calc(16px + var(--frame-x) + env(safe-area-inset-right));
  bottom: calc(var(--dock-h) + 12px + env(safe-area-inset-bottom));
  width: min(460px, 42vw);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(126, 200, 255, 0.28);
  border-radius: 28px;
  background: rgba(8, 14, 22, 0.86);
  color: #f3f7fb;
  font: 400 14px/1.4 "Sora", sans-serif;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.away-report[hidden] { display: none; }

.away-head { padding: 20px 22px 8px; }

.away-head h2 {
  margin: 0;
  font: 600 22px/1.2 "Sora", sans-serif;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.away-sub,
.away-galaxy {
  margin: 4px 0 0;
  color: #c9d6e4;
  font-size: 14px;
}

.away-galaxy { padding: 0 22px 10px; }

.away-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 8px;
}

.away-ship {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--away-faction, #f3f7fb);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.away-ship-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.away-ship-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  color: #ffffff;
}

.away-faction {
  flex: none;
  color: var(--away-faction, #f3f7fb);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.away-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0;
}

.away-total {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c9d6e4;
}

.away-total svg { width: 16px; height: 16px; }
.away-total b { color: #f3f7fb; font-weight: 600; }
.away-credits svg { color: #ffc14a; }
.away-kills svg { color: #7ee0ff; }
.away-deaths svg { color: #ff6b5a; }
.away-battles svg { color: #ff9a2a; }

.away-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.away-lines li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.away-lines time {
  flex: none;
  color: #9fb2c6;
  font-size: 12px;
}

.away-lines li[data-kind="destroyed"] span { color: #ffb3a8; }
.away-lines li[data-kind="kill"] span,
.away-lines li[data-kind="capture"] span { color: #c6f56a; }
.away-lines li[data-kind^="mission"] span { color: #ffd98a; }

.away-quiet,
.away-ready {
  margin: 6px 0 0;
  font-size: 14px;
  color: #c9d6e4;
}

.away-ready { color: #ffd98a; }

.away-tools,
.away-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.away-foot {
  justify-content: flex-end;
  margin: 0;
  padding: 12px 22px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.away-report button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(126, 224, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.45);
  color: #f3f7fb;
  font: 600 12px/1 "Sora", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.away-report button:disabled { opacity: 0.55; cursor: default; }

.away-report .away-more {
  min-height: 28px;
  margin-top: 4px;
  border-color: transparent;
  background: none;
  color: #7ec8ff;
}

.away-report .away-collect {
  border-color: #ffc14a;
  background: rgba(255, 193, 74, 0.16);
  color: #ffc14a;
}

.away-report .away-done { min-width: 120px; min-height: 44px; }

@media (max-width: 800px) {
  .away-report {
    top: calc(var(--frame-y) + 52px + env(safe-area-inset-top));
    right: var(--frame-x);
    left: var(--frame-x);
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
    width: auto;
    border-radius: 18px;
  }
}

.ui-held { display: none !important; }

body.ui-covered .ui-launcher-quiet {
  display: none !important;
  pointer-events: none !important;
}

#diag {
  position: fixed;
  z-index: 26;
  top: calc(62px + var(--frame-y) + env(safe-area-inset-top));
  right: calc(72px + var(--frame-x) + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 108px - (var(--frame-x) * 2)));
  max-height: min(68vh, 640px);
  overflow: auto;
  padding: 10px 12px 12px;
  border: 1px solid rgba(232, 238, 246, 0.16);
  border-radius: 16px;
  background: rgba(8, 14, 22, 0.86);
  color: #e7eef6;
  font: 11px/1.45 "IBM Plex Mono", ui-monospace, monospace;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

#diag[hidden] { display: none !important; }

body.settings-open #diag {
  visibility: hidden;
  pointer-events: none;
}

body.cinematic-on #diag:not([hidden]) {
  top: calc(8px + var(--frame-y) + env(safe-area-inset-top));
  right: calc(14px + var(--frame-x) + env(safe-area-inset-right));
  width: min(420px, calc(100vw - 36px - (var(--frame-x) * 2)));
}

.diag-head {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px -12px 8px;
  padding: 10px 12px 8px;
  background: rgba(8, 14, 22, 0.96);
}

.diag-head strong {
  font: 600 11px "Sora", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.diag-mode {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diag-mode:empty { display: none; }

.diag-head .diag-text:first-of-type { margin-left: auto; }

.diag-text {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(232, 238, 246, 0.22);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.diag-readout {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

#diag-graph {
  display: block;
  width: 100%;
  height: 280px;
  margin: 0 0 8px;
}

.diag-key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 4px;
}

.diag-key-title {
  min-width: 4.2rem;
  color: rgba(231, 238, 246, 0.55);
}

.diag-key-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.diag-key-item i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.diag-note {
  margin: 6px 0 8px;
  color: rgba(231, 238, 246, 0.62);
}

.diag-modes {
  width: 100%;
  border-collapse: collapse;
}

.diag-modes th,
.diag-modes td {
  padding: 2px 4px 2px 0;
  text-align: left;
  white-space: nowrap;
}

.diag-modes th { color: rgba(231, 238, 246, 0.55); font-weight: 500; }

.diag-fallback-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.diag-fallback {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid rgba(232, 238, 246, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  font: inherit;
}

#diag.is-collapsed .diag-body { display: none; }

@media (max-width: 800px) {
  #diag {
    top: calc(58px + var(--frame-y) + env(safe-area-inset-top));
    right: calc(62px + var(--frame-x) + env(safe-area-inset-right));
    width: min(320px, calc(100vw - 84px - var(--frame-x)));
    max-height: min(52vh, 480px);
  }
}
