:root {
  color-scheme: dark;
  --void: #090d0b;
  --surface: #0f1512;
  --surface-raised: #151d18;
  --surface-hot: #1c2720;
  --line: #2a372e;
  --line-bright: #47584b;
  --text: #e5e6d9;
  --muted: #8e998b;
  --quiet: #657265;
  --accent: #bfce8a;
  --accent-ink: #11170b;
  --amber: #d4a06b;
  --danger: #d37d70;
  --success: #a6c98a;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--void); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--void); color: var(--text); font: 13px/1.45 var(--sans); }
button, input, select { color: inherit; font: inherit; }
button { border: 1px solid var(--line); border-radius: 2px; background: var(--surface-raised); color: var(--text); cursor: pointer; min-height: 38px; padding: 9px 12px; transition: background-color .14s, border-color .14s, color .14s; }
button:hover:not(:disabled) { background: var(--surface-hot); border-color: var(--line-bright); }
button:disabled { cursor: not-allowed; opacity: .38; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select { background: #0a100c; border: 1px solid var(--line); border-radius: 2px; min-width: 0; padding: 11px 12px; }
input::placeholder { color: var(--quiet); }
input:focus, select:focus { border-color: var(--accent); outline: none; }
.hidden { display: none !important; }
.app-shell { margin: 0 auto; max-width: 1920px; min-height: 100vh; padding: 0 26px 20px; }
.topbar { align-items: center; border-bottom: 1px solid var(--line); display: flex; height: 68px; justify-content: space-between; }
.brand-lockup { align-items: center; display: flex; gap: 11px; min-width: 0; }
.brand-emblem { fill: none; flex: 0 0 32px; height: 32px; stroke: var(--accent); stroke-width: 1; }
.brand-emblem .emblem-core { fill: var(--accent); stroke: none; }
.brand-lockup .eyebrow { margin-bottom: 2px; }
h1 { color: #d8dccd; font-size: 14px; font-weight: 650; letter-spacing: .15em; margin: 0; }
h2, h3, p { margin-top: 0; }
.eyebrow, .metric-label { color: var(--muted); font: 10px/1.2 var(--mono); letter-spacing: .13em; margin: 0 0 6px; text-transform: uppercase; }
.topbar-right { align-items: center; display: flex; gap: 17px; }
.connection { align-items: center; color: var(--muted); display: flex; font: 10px var(--mono); gap: 8px; text-transform: uppercase; }
#connection-dot { background: var(--amber); border-radius: 50%; height: 7px; width: 7px; }
#connection-dot.live { background: var(--success); box-shadow: 0 0 9px rgba(166,201,138,.55); }
.account-badge { align-items: center; border-left: 1px solid var(--line); display: inline-flex; gap: 9px; padding-left: 15px; }
.account-marker { align-items: center; border: 1px solid var(--line-bright); color: var(--accent); display: inline-flex; font: 9px var(--mono); height: 23px; justify-content: center; width: 23px; }
#account-name { color: #cdd3c4; font-size: 11px; }
.logout-button { background: transparent; color: var(--muted); font: 10px var(--mono); min-height: 30px; padding: 5px 9px; text-transform: uppercase; }

/* Authentication: one restrained atmospheric panel, with the actual form as the focus. */
.auth-screen { background: var(--surface); border: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1.15fr) minmax(350px,.85fr); margin: clamp(24px,5vh,52px) auto; max-width: 1180px; min-height: min(630px, calc(100vh - 160px)); }
.auth-scene { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 560px; overflow: hidden; padding: 26px 32px 22px; position: relative; }
.auth-scene::before { background: radial-gradient(ellipse at 51% 44%, rgba(191,206,138,.08), transparent 43%); content: ""; inset: 0; pointer-events: none; position: absolute; }
.scene-topline, .scene-coordinate { color: var(--muted); display: flex; font: 9px var(--mono); justify-content: space-between; letter-spacing: .12em; position: relative; text-transform: uppercase; z-index: 1; }
.scene-topline { border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.status-led { background: var(--success); border-radius: 50%; display: inline-block; height: 6px; margin-right: 6px; vertical-align: 1px; width: 6px; }
.orbit-art { height: min(350px, 42vw); left: 50%; max-height: 360px; max-width: 440px; position: absolute; top: 16%; transform: translateX(-50%); width: 80%; }
.orbit { border: 1px solid rgba(191,206,138,.13); border-radius: 50%; left: 50%; position: absolute; top: 50%; transform: translate(-50%,-50%); }
.orbit-a { height: 42%; width: 42%; }
.orbit-b { height: 70%; transform: translate(-50%,-50%) rotate(-24deg); width: 70%; }
.orbit-c { height: 96%; transform: translate(-50%,-50%) rotate(35deg); width: 96%; }
.orbit-star { background: #d7d2a3; border-radius: 50%; box-shadow: 0 0 26px rgba(212,160,107,.32); height: 48px; left: 50%; position: absolute; top: 50%; transform: translate(-50%,-50%); width: 48px; }
.orbit-world { border-radius: 50%; position: absolute; }
.world-a { background: #9faf79; height: 10px; left: 76%; top: 30%; width: 10px; }
.world-b { background: #b9795b; height: 7px; left: 18%; top: 47%; width: 7px; }
.world-c { background: #85989a; height: 12px; left: 52%; top: 3%; width: 12px; }
.scene-copy { margin: auto 0 50px; max-width: 430px; position: relative; z-index: 1; }
.scene-copy .eyebrow { color: var(--accent); }
.scene-copy h2 { color: var(--text); font-size: clamp(32px,4vw,49px); font-weight: 450; letter-spacing: -.035em; line-height: 1.05; margin: 13px 0 15px; }
.scene-copy > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; max-width: 350px; }
.scene-coordinate { border-top: 1px solid var(--line); padding-top: 13px; }
.scene-coordinate strong { color: var(--success); font-weight: 500; margin-left: 5px; }
.auth-column { align-self: center; justify-self: center; max-width: 380px; padding: 38px 28px; width: 100%; }
.auth-heading { margin-bottom: 27px; }
.auth-heading .eyebrow { color: var(--accent); }
.auth-heading h2 { font-size: 27px; font-weight: 500; letter-spacing: -.025em; margin: 0 0 7px; }
.auth-heading > p:last-child { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.auth-tabs { border-bottom: 1px solid var(--line); display: flex; gap: 20px; margin-bottom: 24px; }
.auth-tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-size: 11px; margin-bottom: -1px; min-height: 38px; padding: 7px 2px; }
.auth-tab:hover:not(:disabled) { background: transparent; color: var(--text); }
.auth-tab.active { border-bottom-color: var(--accent); color: var(--text); }
.auth-form { display: grid; gap: 8px; }
.auth-form label { color: #a9b2a2; font: 10px var(--mono); margin: 5px 0 1px; text-transform: uppercase; }
.auth-form input { font-size: 12px; min-height: 42px; width: 100%; }
.auth-form input:focus { box-shadow: inset 2px 0 var(--accent); }
.optional { color: var(--quiet); font-family: var(--sans); text-transform: lowercase; }
.auth-submit { align-items: center; background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink); display: flex; font: 10px var(--mono); justify-content: space-between; letter-spacing: .08em; margin-top: 12px; min-height: 46px; padding: 0 14px; }
.auth-submit:hover:not(:disabled) { background: #d0dc9c; border-color: #d0dc9c; }
.auth-submit span:last-child { font-size: 15px; }
.auth-message { color: var(--accent); font-size: 11px; min-height: 18px; margin: 13px 0 3px; }
.auth-message.error { color: var(--danger); }
.auth-note { align-items: flex-start; border-top: 1px solid var(--line); color: var(--muted); display: flex; font-size: 10px; gap: 10px; line-height: 1.6; padding-top: 13px; }
.note-symbol { align-items: center; border: 1px solid var(--line-bright); color: var(--accent); display: inline-flex; flex: 0 0 16px; font: italic 11px Georgia,serif; height: 16px; justify-content: center; }

/* Operational game surface: chart first, actionable inspector second. */
.game-panel { display: block; }
.resource-strip { align-items: stretch; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(6,minmax(90px,auto)) 1fr; margin-bottom: 13px; min-height: 66px; }
.cycle-readout, .resource-item { align-items: center; border-right: 1px solid var(--line); display: flex; gap: 10px; min-width: 0; padding: 9px 15px; }
.cycle-readout { padding-left: 0; }
.resource-code { align-items: center; border: 1px solid var(--line-bright); color: var(--accent); display: inline-flex; flex: 0 0 27px; font: 11px var(--mono); height: 27px; justify-content: center; }
.energy-code { color: #dfbc81; }.mineral-code { color: #bb9b85; }.influence-code { color: #adbf8b; }.alloy-code { color: #c3a47c; }.research-code { color: #94b5a9; }
.resource-data { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resource-data .metric-label { font-size: 8px; margin: 0; white-space: nowrap; }
.resource-data strong { color: #dfe2d5; font: 15px var(--mono); }
.cycle-readout .resource-data strong { color: var(--accent); }
.live-pulse { background: var(--success); border-radius: 50%; box-shadow: 0 0 8px rgba(166,201,138,.4); height: 5px; margin-left: auto; width: 5px; }
.resource-help { align-self: center; color: var(--quiet); font: 9px var(--mono); justify-self: end; letter-spacing: .08em; padding: 0 3px 0 12px; }
.command-layout { border: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) 355px; height: calc(100vh - 164px); min-height: 530px; }
.map-workspace { background: #0b100d; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 0 16px 10px; }
.map-header { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; min-height: 59px; }
.map-header h2 { font-size: 18px; font-weight: 500; margin: 0; }
.map-header .eyebrow { color: var(--accent); margin: 0 0 3px; }
.map-context { align-items: center; color: #bfc7b8; display: flex; font: 10px var(--mono); gap: 8px; text-align: right; }
.context-led { background: var(--quiet); border-radius: 50%; height: 6px; width: 6px; }
.view-switch { border-bottom: 1px solid var(--line); display: flex; gap: 22px; margin: 0; }
.view-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font: 9px var(--mono); letter-spacing: .1em; margin-bottom: -1px; min-height: 35px; padding: 7px 2px; }
.view-tab:hover:not(:disabled) { background: transparent; color: var(--text); }
.view-tab.active { border-bottom-color: var(--accent); color: var(--text); }
.view-tab:disabled { opacity: .35; }
.map-toolbar { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; padding: 9px 0; }
.system-search { align-items: center; background: #080d0a; border: 1px solid var(--line); display: flex; flex: 1 1 190px; min-width: 150px; padding-left: 9px; }
.system-search > span { color: var(--quiet); font-size: 18px; line-height: 1; }
.system-search input { background: transparent; border: 0; font-size: 10px; min-height: 32px; outline: none; padding: 6px 8px; }
.system-search input:focus { box-shadow: none; }
.system-search button { background: var(--surface-raised); font: 8px var(--mono); letter-spacing: .05em; min-height: 32px; padding: 6px 9px; }
.map-toolbar select { font-size: 10px; min-height: 32px; padding: 6px 24px 6px 9px; }
.zoom-controls { align-items: center; border: 1px solid var(--line); display: flex; gap: 1px; padding: 2px; }
.zoom-controls button { background: transparent; border: 0; font: 14px var(--mono); min-height: 27px; min-width: 27px; padding: 3px 6px; }
.zoom-controls button:hover:not(:disabled) { background: var(--surface-hot); }
.zoom-reset { border-left: 1px solid var(--line) !important; color: var(--muted); font: 8px var(--mono) !important; letter-spacing: .05em; margin-left: 3px; width: auto !important; }
#zoom-level { color: var(--muted); font: 9px var(--mono); min-width: 37px; text-align: center; }
.map-stage { background-color: #080d0b; background-image: radial-gradient(circle,rgba(170,189,157,.12) .7px,transparent .8px); background-position: center; background-size: 23px 23px; flex: 1; min-height: 250px; overflow: hidden; position: relative; }
.map-stage::after { border: 1px solid rgba(129,150,127,.08); content: ""; inset: 12px; pointer-events: none; position: absolute; }
#galaxy { cursor: grab; height: 100%; inset: 0; position: absolute; touch-action: none; width: 100%; }
#galaxy:active { cursor: grabbing; }
#system-view { background: #080d0b; border: 0; cursor: grab; display: block; flex: 1; height: 100%; max-height: 100%; min-height: 250px; object-fit: fill; touch-action: none; width: 100%; }
#system-view:active { cursor: grabbing; }
.map-tooltip { background: #141c16; border: 1px solid var(--line-bright); color: var(--text); font: 10px var(--mono); left: 0; max-width: 210px; padding: 7px 9px; pointer-events: none; position: absolute; top: 0; z-index: 4; }
.map-tooltip strong { color: var(--accent); display: block; font-weight: 500; margin-bottom: 3px; }
.map-tooltip span { color: var(--muted); font-size: 9px; }
.map-footer { align-items: center; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; min-height: 36px; }
.map-footer p { color: var(--quiet); font: 9px var(--mono); margin: 0; }
.map-legend { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; gap: 11px; }
.map-legend span { align-items: center; display: flex; font-size: 9px; gap: 5px; }
.legend-dot { border-radius: 50%; display: inline-block; height: 6px; width: 6px; }
.habitable { background: #a8c4b0; }.colony { background: var(--success); }.fleet { background: var(--amber); }.hostile { background: var(--danger); }

.inspector { background: var(--surface); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.inspector-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; min-height: 59px; padding: 0 15px; }
.inspector-heading .eyebrow { color: var(--accent); margin-bottom: 3px; }
.inspector-heading h2 { font-size: 15px; font-weight: 550; margin: 0; }
.order-status { color: var(--accent); font: 9px var(--mono); text-align: right; }
.selection-block { border-bottom: 1px solid var(--line); padding: 12px 15px 13px; }
.section-caption { color: var(--muted); display: flex; font: 9px var(--mono); justify-content: space-between; letter-spacing: .08em; margin-bottom: 8px; }
.section-number { color: var(--quiet); }
.selection { color: var(--muted); font-size: 11px; min-height: 45px; }
.selection > strong { color: var(--text); display: block; font: 16px var(--sans); font-weight: 520; margin-bottom: 8px; }
.selection .facts { display: grid; gap: 5px 10px; grid-template-columns: 1fr 1fr; }
.selection .facts span { color: var(--muted); font-size: 10px; }
.planet-detail { border-top: 1px solid var(--line); margin-top: 10px; min-height: 48px; padding-top: 8px; }
.planet-detail-title { align-items: center; display: flex; gap: 8px; }
.planet-detail-title strong { color: #dce2d2; flex: 1; font-size: 11px; font-weight: 550; }
.planet-detail-title span:last-child, .planet-detail-meta { color: var(--muted); font: 9px var(--mono); }
.planet-detail-meta { line-height: 1.6; margin: 4px 0 0 16px; }
.world-swatch { border: 1px solid rgba(255,255,255,.18); border-radius: 50%; height: 8px; width: 8px; }
.anomaly { color: var(--amber); display: block; font: 9px var(--mono); margin-top: 7px; }
.actions { display: grid; gap: 7px; padding: 12px 15px; }
.primary-action { align-items: center; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); display: flex; font-size: 10px; justify-content: space-between; min-height: 37px; }
.primary-action:hover:not(:disabled) { background: #d0dc9c; }
.primary-action span { font-size: 15px; }
.secondary-actions { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.secondary-actions button { background: transparent; color: #b4bdb0; font-size: 9px; min-height: 33px; padding: 6px; }
.secondary-actions button:hover:not(:disabled) { border-color: var(--line-bright); color: var(--text); }
.inspector-tabs { border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); display: flex; flex: 0 0 auto; }
.inspector-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); flex: 1; font: 9px var(--mono); margin-bottom: -1px; min-height: 37px; padding: 7px 4px; }
.inspector-tab:hover:not(:disabled) { background: var(--surface-raised); }
.inspector-tab.active { border-bottom-color: var(--accent); color: var(--text); }
.inspector-pane { display: none; flex: 1; min-height: 100px; overflow: auto; padding: 13px 15px; }
.inspector-pane.active { display: block; }
.pane-heading { margin-bottom: 10px; }
.pane-heading .eyebrow { color: var(--quiet); font-size: 8px; margin-bottom: 4px; }
.pane-heading h3 { color: #d7ded0; font-size: 12px; font-weight: 500; margin: 0; }
.research-options { display: grid; gap: 6px; }
.tech-option { align-items: flex-start; background: transparent; border: 1px solid var(--line); color: var(--text); display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; text-align: left; }
.tech-option:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--line-bright); }
.tech-option strong { color: #d8dfd1; font-size: 10px; font-weight: 550; }
.tech-option span, .empty { color: var(--muted); font-size: 9px; margin: 0; }
.empire-row { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 8px; padding: 8px 0; }
.empire-row:last-child { border-bottom: 0; }
.empire-swatch { border-radius: 50%; flex: 0 0 7px; height: 7px; width: 7px; }
.empire-meta { flex: 1; min-width: 0; }
.empire-name { color: var(--text); display: block; font-size: 10px; }
.empire-sub { color: var(--muted); font: 8px var(--mono); }
.you-tag { color: var(--accent); font: 8px var(--mono); margin-left: 4px; }
.offers { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.offers-title { color: var(--accent); font: 8px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.offer-row { align-items: center; color: var(--muted); display: flex; font-size: 9px; justify-content: space-between; padding-top: 7px; }
.offer-row button { font-size: 8px; min-height: 26px; padding: 4px 8px; }
.event { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; padding: 8px 0; }
.event:last-child { border-bottom: 0; }
.event b { color: var(--accent); font: 8px var(--mono); margin-right: 7px; }
.inspector-footnote { border-top: 1px solid var(--line); color: var(--quiet); flex: 0 0 auto; font: 8px var(--mono); letter-spacing: .08em; margin: 0; padding: 8px 15px; }

@media (max-width: 1050px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .command-layout { grid-template-columns: minmax(0,1fr) 320px; }
  .resource-strip { grid-template-columns: repeat(6,minmax(68px,auto)); }
  .resource-help { display: none; }
  .resource-item, .cycle-readout { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 760px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .topbar { align-items: flex-start; height: auto; min-height: 62px; padding: 10px 0; }
  .brand-lockup { gap: 8px; }.brand-emblem { flex-basis: 27px; height: 27px; width: 27px; }
  h1 { font-size: 11px; letter-spacing: .1em; }
  .brand-lockup .eyebrow { font-size: 8px; }
  .topbar-right { align-items: flex-end; flex-direction: column; gap: 6px; }
  .connection { font-size: 8px; }
  .account-badge { gap: 5px; padding-left: 7px; }
  #account-name { font-size: 9px; max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logout-button { font-size: 8px; min-height: 25px; padding: 3px 5px; }
  .auth-screen { grid-template-columns: minmax(0,1fr); margin: 15px auto; min-height: 0; }
  .auth-scene { min-height: 320px; padding: 16px; }
  .orbit-art { height: 260px; top: 8%; width: min(280px,70vw); }
  .scene-copy { margin: auto 0 26px; }
  .scene-copy h2 { font-size: 35px; margin: 8px 0; }
  .scene-copy > p:last-child { font-size: 11px; max-width: 280px; }
  .scene-coordinate { font-size: 7px; }
  .auth-column { max-width: none; padding: 24px 20px; }
  .resource-strip { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .resource-item, .cycle-readout { border-bottom: 1px solid var(--line); min-height: 54px; padding: 7px 5px; }
  .resource-code { flex-basis: 22px; height: 22px; width: 22px; }
  .resource-data .metric-label { font-size: 7px; }.resource-data strong { font-size: 13px; }
  .command-layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .map-workspace { border-bottom: 1px solid var(--line); border-right: 0; min-height: 0; padding: 0 9px 8px; }
  .map-stage { flex: 0 0 auto; height: min(59vw,440px); min-height: 230px; }
  #system-view { flex: 0 0 auto; height: min(59vw,440px); min-height: 230px; }
  .map-header { min-height: 52px; }
  .map-toolbar { gap: 5px; }
  .system-search { flex-basis: 100%; }
  .map-toolbar select { flex: 1; }
  .map-footer { align-items: flex-start; flex-direction: column; gap: 6px; padding: 6px 0; }
  .map-footer p { font-size: 8px; }
  .inspector { overflow: visible; }
  .inspector-heading { min-height: 52px; }
  .inspector-pane { flex: 0 0 auto; max-height: 320px; }
}
@media (max-width: 410px) {
  .brand-lockup .eyebrow { letter-spacing: .07em; }
  .brand-emblem { display: none; }
  .map-context { font-size: 8px; }
  .zoom-controls { flex: 0 0 auto; }
  .zoom-controls button { min-width: 25px; }
  .map-legend { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
