:root {
  --ease-out: cubic-bezier(.2,.7,.2,1);
  --tap-height: 44px;
  --nav-height: 44px;
  --resource-height: 58px;
}
button,a,input,select,textarea { -webkit-tap-highlight-color: transparent; }
button { transition: background-color 140ms,border-color 140ms,color 140ms,opacity 140ms; touch-action: manipulation; }
button:active:not(:disabled) { background-color: #ededed; }
.primary:active:not(:disabled) { background-color: #303030; }
.primary:hover:not(:disabled) { background: #303030; }
button:disabled { opacity: 1; color: #858585; border-color: var(--line); background: var(--soft); }
.primary:disabled { color: #777; background: #ececec; border-color: #ececec; }
.locked { opacity: 1; }
.locked h3,.locked .building-code { color: var(--muted); }
.site-links a { color: #525252; }
.game-nav button { position: relative; }
.game-nav button[aria-selected=true] { border-bottom-color: var(--ink); color: var(--ink); font-weight: 650; }
#research-notice { position: absolute; right: -8px; top: 14px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); font-size: 0; }
#view-content { scroll-margin-top: 20px; }
.facility-highlight { animation: facility-arrive 2s var(--ease-out) both; }
@keyframes facility-arrive { 0%,25% { background: #ececec; } 100% { background: transparent; } }
.control-actions { margin-top: 0; margin-bottom: 20px; }
.supply-progress { transform-origin: left center; background: #9c9c9c; }
.metric-unit { display: none; }
html:has(dialog[open]) { overflow: hidden; }
.game-dialog,.story-dialog { overscroll-behavior: contain; }
.orbital-map:not(.scene-ready) .map-canvas { opacity: 0; }
.scene-ready .map-canvas { opacity: 1; transition: opacity 180ms; }
.map-canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.session-notice { padding: 12px 14px; margin-bottom: 22px; background: var(--soft); color: #404040; border: 1px solid var(--line); font-size: 12px; line-height: 1.8; }
.session-notice button { display: block; min-height: 44px; margin-top: 10px; font-size: 12px; }
.building-hint { color: var(--muted); font-size: 11px; text-align: center; line-height: 1.7; }
.building-hint.warn { color: var(--warn); }
.building-hint:empty { display: none; }
.building-cost,.tech-price,.project-resources strong { overflow-wrap: anywhere; }
.save-preview { padding: 16px 0; border-block: 1px solid var(--line); margin-top: 16px; font-size: 12px; }
.save-preview strong { color: var(--ink); }
.save-preview dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin: 12px 0 0; }
.save-preview dt { color: var(--muted); }
.save-preview dd { margin: 0; text-align: right; font-family: var(--mono); }
.skip-content { position: fixed; top: 10px; left: 10px; z-index: 50; padding: 10px 16px; background: var(--white); transform: translateY(-160%); }
.skip-content:focus { transform: translateY(0); }
.dialog-close,.header-actions button,.map-hud button { min-height: var(--tap-height); min-width: var(--tap-height); }
.dialog-close { display: grid; place-items: center; margin: -9px -9px 0 0; }
.game-dialog { scrollbar-gutter: stable; }
.game-dialog::backdrop { background: #17171738; backdrop-filter: blur(3px); }
.settings-row input[type=checkbox] { appearance: none; width: 44px; height: 26px; flex: none; position: relative; border: 1px solid #bfbfbf; border-radius: 20px; background: #e5e5e5; cursor: pointer; }
.settings-row input[type=checkbox]:before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; transition: transform 160ms var(--ease-out); }
.settings-row input[type=checkbox]:checked { background: var(--ink); border-color: var(--ink); }
.settings-row input[type=checkbox]:checked:before { transform: translateX(18px); }
.dialog-body .settings-row label { padding-block: 9px; flex: 1; cursor: pointer; }
.text-button,.map-node,.auto-summary button,.tech button,.contract-row button { min-height: var(--tap-height); }
.map-node:focus-visible { outline-offset: -3px; }
.offline-values { min-width: 0; }
.offline-values strong { overflow-wrap: anywhere; }
.launch-preview { bottom: 50px; background: var(--white); border-color: var(--line-strong); }
#toast { border-radius: 2px; line-height: 1.6; pointer-events: none; }
/* Keep the scene's hardware, with neutral control surfaces matching LocalAI. */
.orbital-map .chart-heading,.map-caption { background: #f3f3f3; color: #737373; }
.map-stage,.map-nodes { background: #f7f7f7; }
.map-stage:before { background-image: radial-gradient(#00000017 .6px,transparent .8px); }
.map-live,.map-body-caption strong,.map-node,.map-node-name,.map-node-count,.chart-legend b { color: #525252; }
.map-live i { background: #525252; }
.map-body-caption span,.map-projection,.map-caption-hint { color: #737373; }
.map-hud button { color: #737373; background: #fafafacc; }
.map-track { color: #404040; background: #fafafade; }
.map-track:before { border-color: #a3a3a3; }
.map-node:hover:not(:disabled) { background: #ededed; }
.orbital-map .chart-legend i { background: #262626; }
.orbital-map .chart-legend span:nth-child(2) i { background: #737373; }
.orbital-map .chart-legend span:nth-child(3) i { background: #a3a3a3; }
@media (max-width: 640px) {
  :root { --page-gutter: 18px; }
  html { scroll-padding-top: calc(var(--resource-height) + 16px); scroll-padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px); }
  body { height: auto; min-height: 100dvh; overflow: auto; padding-bottom: calc(var(--nav-height) + 1px + env(safe-area-inset-bottom)); }
  .header-inner,.game-shell { padding-inline: var(--page-gutter); }
  .site-header { position: static; }
  .header-inner { min-height: 60px; }
  .game-shell { display: block; flex: none; min-height: 0; margin-block: 0; }
  .resource-strip { position: sticky; top: 0; z-index: 26; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 0 calc(-1 * var(--page-gutter)); background: var(--paper); border-bottom: 1px solid var(--line-strong); }
  .resource-strip>div:nth-child(n) { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px; height: var(--resource-height); padding: 7px 12px; border: 0; border-left: 1px solid var(--line); min-width: 0; }
  .resource-strip>div:first-child { border-left: 0; }
  .resource-strip>div>span { font-size: 10px; line-height: 16px; align-self: auto; white-space: nowrap; }
  .resource-strip strong { font: 15px/23px var(--mono); text-align: left; }
  .resource-strip strong em,.resource-strip small { display: none; }
  .metric-unit { display: inline; font: 8px var(--mono); margin-left: 2px; }
  .next-goal { width: 100%; min-height: 50px; }
  #view-content { scroll-margin-top: calc(var(--resource-height) + 16px); }
  .view-scroll { overflow: visible; min-height: 0; padding-top: 24px; padding-bottom: 32px; }
  .app-foot { position: static; min-height: 48px; padding-bottom: 12px; flex-wrap: wrap; }
  .app-foot button { min-height: 44px; }
  .app-foot span:last-child { white-space: nowrap; }
  .game-nav { position: fixed; inset: auto 0 0; z-index: 25; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; padding: 0 max(6px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px,env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--line-strong); background: var(--paper); }
  .game-nav button { min-width: 0; min-height: var(--nav-height); padding: 0 2px; border: 0; background: transparent; display: block; font-size: 12px; line-height: 1.4; color: var(--muted); font-weight: 500; }
  .game-nav button[aria-selected=true] { color: var(--ink); font-weight: 700; background: transparent; }
  .game-nav button[aria-selected=true]:after { content: ''; position: absolute; top: 0; left: calc(50% - 12px); height: 2px; width: 24px; background: var(--ink); }
  .game-nav button:focus-visible { outline-offset: -4px; }
  #research-notice { top: 9px; right: calc(50% - 17px); }
  .section-heading { align-items: flex-start; gap: 12px; }
  .section-heading .quiet { white-space: nowrap; font-size: 11px; }
  .section-heading h2 { font-size: 20px; }
  .control-actions button { min-height: 44px; }
  .control-actions { margin-bottom: 18px; }
  .building-buy button,.segmented button,.tech button { min-height: 44px; }
  .building-buy { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 6px 12px; }
  .building-hint { grid-column: 1 / -1; text-align: left; font-size: 11px; }
  .building-cost { font: 11px/1.7 var(--sans); }
  .tech-price { font: 12px/1.7 var(--sans); }
  .tech-bottom { gap: 12px; }
  .tech-bottom button { flex: none; }
  .tech-locked { line-height: 1.8; }
  .contract-row { align-items: flex-start; }
  .game-dialog { max-height: calc(100dvh - 32px); }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions button { flex: 1; min-width: 100px; }
  .offline-values { gap: 10px; }
  .offline-values strong { font-size: 15px; }
  .launch-preview { right: 12px; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px); max-width: calc(100vw - 24px); }
  .launch-heading button { min-height: 44px; min-width: 44px; }
  #toast { bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 14px); width: max-content; max-width: calc(100vw - 32px); }
}
@media (max-width: 360px) {
  :root { --page-gutter: 12px; }
  .resource-strip>div:nth-child(n) { padding-inline: 9px; }
  .resource-strip strong { font-size: 14px; }
  .game-nav button { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { button,.settings-row input:before { transition: none; } }
