:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(9, 14, 18, 0.82);
  --panel-border: rgba(215, 233, 231, 0.24);
  --text: #eef8f6;
  --muted: #91a6a1;
  --teal: #35f2cf;
  --amber: #ffc35c;
  --coral: #ff675c;
  --green: #9df28d;
  --shadow: rgba(0, 0, 0, 0.45);
  --hud-scale: 0.75;
  --speed-readout-scale: 0.9;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13, 20, 22, 0.35), rgba(0, 0, 0, 0)),
    #05070a;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.game-shell.menu-open #gameCanvas {
  cursor: default;
}

.game-shell.probe-hover #gameCanvas {
  cursor: pointer;
}

.speed-readout {
  position: absolute;
  z-index: 6;
  min-width: 43px;
  border: 1px solid rgba(53, 242, 207, 0.48);
  border-radius: 3px;
  background: rgba(4, 8, 10, 0.9);
  box-shadow:
    0 5px 14px rgba(0, 0, 0, 0.42),
    0 0 9px rgba(53, 242, 207, 0.16);
  color: var(--teal);
  font-size: 0.39rem;
  font-weight: 900;
  line-height: 1;
  padding: 4px 5px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  transform: scale(var(--speed-readout-scale));
  transform-origin: top left;
}

.speed-readout[hidden] {
  display: none;
}

.top-right-hud {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  gap: 10px;
  align-items: stretch;
  pointer-events: none;
  transform: scale(var(--hud-scale));
  transform-origin: top right;
}

.trajectory-mils,
.shuttle-view-button {
  min-height: 40px;
  border: 1px solid rgba(238, 248, 246, 0.22);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.84);
  box-shadow: 0 16px 44px var(--shadow);
  backdrop-filter: blur(16px);
}

.trajectory-mils {
  display: grid;
  min-width: 112px;
  align-content: center;
  gap: 3px;
  padding: 7px 12px;
  pointer-events: none;
}

.trajectory-label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.trajectory-mils strong {
  color: var(--teal);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.shuttle-view-button {
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 9px 13px;
  pointer-events: auto;
  text-transform: uppercase;
}

.shuttle-view-button:hover {
  border-color: rgba(53, 242, 207, 0.58);
  color: var(--teal);
}

.shuttle-view-button:active {
  transform: translateY(1px);
}

.hud {
  position: absolute;
  inset: 18px 18px auto 18px;
  display: grid;
  grid-template-columns: minmax(108px, max-content) minmax(72px, max-content) 48px minmax(260px, 360px);
  gap: 10px;
  align-items: center;
  z-index: 3;
  pointer-events: none;
  transform: scale(var(--hud-scale));
  transform-origin: top left;
}

.stat,
.life-bars,
.sound-button {
  min-height: 56px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 16px 44px var(--shadow);
  backdrop-filter: blur(16px);
}

.stat {
  display: grid;
  gap: 6px;
  min-width: 104px;
  padding: 8px 12px;
  border-radius: 8px;
}

.action-stat {
  align-content: center;
}

.stat-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label,
.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stat strong {
  color: var(--text);
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1;
}

.solar-cell-stat strong {
  color: var(--green);
}

.key-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(238, 248, 246, 0.22);
  border-radius: 6px;
  background: rgba(238, 248, 246, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
}

.life-bars {
  display: grid;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
}

.resource-bar {
  display: grid;
  gap: 3px;
}

.resource-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resource-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.resource-bar-head strong {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.sound-button {
  display: grid;
  place-items: center;
  width: 48px;
  padding: 0;
  border-radius: 8px;
  color: var(--teal);
  cursor: pointer;
  pointer-events: auto;
}

.sound-button:hover {
  border-color: rgba(53, 242, 207, 0.54);
}

.sound-button:active {
  transform: translateY(1px);
}

.speaker-icon {
  position: relative;
  width: 25px;
  height: 22px;
}

.speaker-icon::before {
  position: absolute;
  top: 7px;
  left: 1px;
  width: 7px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.speaker-icon::after {
  position: absolute;
  top: 4px;
  left: 7px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 10px solid currentColor;
  content: "";
}

.speaker-wave {
  position: absolute;
  top: 50%;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  transform: translateY(-50%);
}

.speaker-wave.small {
  right: 3px;
  width: 7px;
  height: 10px;
  opacity: 0.76;
}

.speaker-wave.large {
  right: -1px;
  width: 11px;
  height: 17px;
  opacity: 0.38;
}

.speaker-slash {
  position: absolute;
  top: 1px;
  left: 13px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: var(--coral);
  opacity: 0;
  transform: rotate(-43deg);
  transform-origin: center;
}

.sound-button.muted {
  color: var(--muted);
}

.sound-button.muted .speaker-wave {
  opacity: 0;
}

.sound-button.muted .speaker-slash {
  opacity: 1;
}

.resource-track {
  position: relative;
  display: block;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(238, 248, 246, 0.18);
  border-radius: 999px;
  background: rgba(238, 248, 246, 0.08);
}

.resource-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  transform-origin: left center;
}

.health-bar .resource-fill {
  background: linear-gradient(90deg, var(--coral), var(--amber));
  box-shadow: 0 0 16px rgba(255, 103, 92, 0.28);
}

.oxygen-bar .resource-fill {
  background: linear-gradient(90deg, #8bdcf5, var(--teal));
  box-shadow: 0 0 16px rgba(53, 242, 207, 0.28);
}

.fuel-bar .resource-fill {
  background: linear-gradient(90deg, var(--green), var(--amber));
  box-shadow: 0 0 16px rgba(157, 242, 141, 0.24);
}

.brake-fluid-bar .resource-fill {
  background: linear-gradient(90deg, #eef8f6, #8bdcf5, var(--teal));
  box-shadow: 0 0 16px rgba(139, 220, 245, 0.28);
}

.game-shell.coast-active .fuel-bar .key-badge {
  border-color: rgba(157, 242, 141, 0.68);
  color: var(--green);
  box-shadow: 0 0 14px rgba(157, 242, 141, 0.18);
}

.game-shell.coast-active .fuel-bar .resource-fill {
  box-shadow: 0 0 20px rgba(157, 242, 141, 0.42);
}

.game-shell.engine-off-active .brake-fluid-bar .engine-off-key {
  border-color: rgba(53, 242, 207, 0.68);
  color: var(--teal);
  box-shadow: 0 0 14px rgba(53, 242, 207, 0.18);
}

.game-shell.engine-off-active .brake-fluid-bar .resource-fill {
  box-shadow: 0 0 20px rgba(53, 242, 207, 0.38);
}

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.start-menu-active .hud,
.start-menu-active .top-right-hud,
.start-menu-active .speed-readout,
.start-menu-active .uplink-panel,
.start-menu-active .hydrogen-harvest-status,
.start-menu-active .probe-action-menu {
  opacity: 0;
  pointer-events: none;
}

.start-menu {
  place-items: end start;
  z-index: 8;
  padding: clamp(28px, 6vw, 76px);
  background:
    radial-gradient(circle at 72% 24%, rgba(255, 195, 92, 0.16), transparent 32%),
    radial-gradient(circle at 44% 38%, rgba(53, 242, 207, 0.1), transparent 36%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0.2) 48%, rgba(0, 0, 0, 0.58));
}

.start-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.56)),
    radial-gradient(circle at 62% 54%, transparent 0 38%, rgba(0, 0, 0, 0.48) 78%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), transparent 54%);
  pointer-events: none;
}

.uplink-panel {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  width: min(330px, calc(100vw - 36px));
  gap: 5px;
  border: 1px solid rgba(53, 242, 207, 0.24);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.84);
  box-shadow: 0 16px 44px var(--shadow);
  padding: 10px 12px 12px;
  pointer-events: none;
  backdrop-filter: blur(16px);
  transform: scale(var(--hud-scale));
  transform-origin: bottom left;
}

.uplink-panel[hidden] {
  display: none;
}

.hydrogen-harvest-status {
  position: absolute;
  left: 50%;
  top: 190px;
  z-index: 3;
  border: 1px solid rgba(238, 248, 246, 0.24);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.78);
  box-shadow: 0 16px 44px var(--shadow);
  color: #eef8f6;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 7px 11px;
  pointer-events: none;
  text-transform: uppercase;
  transform: translateX(-50%) scale(var(--hud-scale));
  transform-origin: top center;
  backdrop-filter: blur(14px);
}

.hydrogen-harvest-status[hidden] {
  display: none;
}

.uplink-kicker {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.uplink-panel strong {
  color: var(--teal);
  font-size: 1rem;
  line-height: 1.1;
}

.uplink-row.complete strong,
.uplink-panel.complete strong {
  color: var(--green);
}

.uplink-list {
  display: grid;
  gap: 9px;
}

.uplink-row {
  display: grid;
  gap: 5px;
}

.uplink-detail {
  color: #c2d1cd;
  font-size: 0.82rem;
  line-height: 1.25;
}

.uplink-track {
  position: relative;
  display: block;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(238, 248, 246, 0.16);
  border-radius: 999px;
  background: rgba(238, 248, 246, 0.08);
}

.uplink-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transform: scaleX(0);
  transform-origin: left center;
}

.probe-action-menu {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(238, 248, 246, 0.2);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.92);
  box-shadow: 0 16px 44px var(--shadow);
  padding: 6px;
  pointer-events: auto;
  backdrop-filter: blur(16px);
}

.probe-action-menu[hidden] {
  display: none;
}

.probe-action-menu button,
.distress-ship-prompt button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: rgba(238, 248, 246, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 11px;
}

.probe-action-menu button:hover,
.distress-ship-prompt button:hover {
  background: rgba(53, 242, 207, 0.14);
}

.distress-ship-prompt {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(255, 195, 92, 0.34);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.94);
  box-shadow:
    0 16px 44px var(--shadow),
    0 0 18px rgba(255, 195, 92, 0.1);
  padding: 6px;
  pointer-events: auto;
  backdrop-filter: blur(16px);
}

.distress-ship-prompt[hidden] {
  display: none;
}

.distress-ship-prompt button {
  color: #fff2cf;
}

.mobile-touch-controls {
  position: absolute;
  inset: auto 10px 10px 10px;
  z-index: 4;
  display: none;
  grid-template-columns: minmax(104px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  pointer-events: none;
}

.mobile-window-buttons,
.mobile-action-buttons,
.mobile-thruster-pad {
  pointer-events: auto;
}

.mobile-window-buttons {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: flex;
  gap: 6px;
}

.mobile-flight-controls {
  display: contents;
}

.mobile-action-buttons {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 7px;
  max-width: min(58vw, 260px);
}

.mobile-touch-button,
.mobile-arrow-button {
  min-height: 44px;
  border: 1px solid rgba(238, 248, 246, 0.18);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  padding: 8px 9px;
  text-transform: uppercase;
  touch-action: none;
  backdrop-filter: blur(14px);
}

.mobile-touch-button.primary {
  border-color: rgba(53, 242, 207, 0.42);
  background: rgba(53, 242, 207, 0.16);
  color: #dffcf3;
}

.mobile-touch-button.active,
.mobile-arrow-button.active {
  border-color: rgba(157, 242, 141, 0.68);
  background: rgba(157, 242, 141, 0.18);
  color: var(--green);
}

.mobile-touch-button:disabled,
.mobile-arrow-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.mobile-thruster-pad {
  display: grid;
  width: 116px;
  height: 116px;
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(3, 36px);
  gap: 4px;
  align-content: center;
  justify-content: center;
  border: 1px solid rgba(53, 242, 207, 0.18);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.46);
  backdrop-filter: blur(12px);
}

.mobile-arrow-button {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--teal);
  font-size: 1.05rem;
}

.mobile-arrow-button.up {
  grid-area: up;
}

.mobile-arrow-button.left {
  grid-area: left;
}

.mobile-arrow-button.right {
  grid-area: right;
}

.mobile-arrow-button.down {
  grid-area: down;
}

.inventory,
.craft-menu,
.map-window,
.control-window,
.shuttle-view-window,
.colony-hub-loading,
.colony-hub-window,
.distress-ship-stores-window {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 5;
  padding: 24px;
  background: rgba(5, 7, 10, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.inventory.visible,
.craft-menu.visible,
.map-window.visible,
.control-window.visible,
.shuttle-view-window.visible,
.colony-hub-loading.visible,
.colony-hub-window.visible,
.distress-ship-stores-window.visible {
  opacity: 1;
  pointer-events: auto;
}

.inventory-panel,
.craft-panel,
.map-panel,
.control-panel,
.shuttle-view-panel,
.colony-hub-loading-panel,
.colony-hub-panel,
.distress-ship-stores-panel {
  width: min(92vw, 520px);
  max-height: min(82vh, 680px);
  overflow: auto;
  border: 1px solid rgba(157, 242, 141, 0.24);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.9);
  box-shadow: 0 28px 82px rgba(0, 0, 0, 0.66);
  padding: clamp(18px, 4vw, 28px);
  backdrop-filter: blur(22px);
}

.craft-panel {
  width: min(92vw, 560px);
}

.map-panel {
  display: grid;
  width: min(94vw, 920px);
  height: min(84vh, 680px);
  grid-template-rows: auto minmax(0, 1fr);
}

.control-panel {
  width: min(92vw, 700px);
}

.distress-ship-stores-panel {
  width: min(92vw, 560px);
  border-color: rgba(255, 195, 92, 0.28);
}

.distress-ship-stores-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.distress-ship-stores-header h2 {
  margin-top: 4px;
  font-size: clamp(1.85rem, 6vw, 3.2rem);
  line-height: 0.96;
}

.distress-ship-stores-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.distress-store-slot,
.distress-stores-empty {
  min-height: 78px;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 195, 92, 0.09), rgba(238, 248, 246, 0.018)),
    rgba(8, 13, 16, 0.92);
  color: var(--text);
}

.distress-store-slot {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font: inherit;
  padding: 10px;
  text-align: left;
}

.distress-store-slot:hover {
  border-color: rgba(255, 195, 92, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 195, 92, 0.14);
}

.distress-store-slot .resource-symbol {
  width: 30px;
  height: 30px;
}

.distress-store-slot > span:not(.resource-symbol) {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.distress-store-slot .slot-label {
  overflow-wrap: anywhere;
}

.distress-store-slot strong {
  color: var(--green);
  font-size: 1.05rem;
  line-height: 1;
}

.distress-store-slot small {
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.distress-stores-empty {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.distress-claim-all {
  width: 100%;
  margin-top: 18px;
}

.distress-claim-all[disabled] {
  filter: grayscale(1) brightness(0.72);
  cursor: default;
}

.shuttle-view-panel {
  display: grid;
  width: min(92vw, 760px);
  height: min(82vh, 560px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.colony-hub-loading {
  z-index: 7;
  background:
    radial-gradient(circle at 50% 44%, rgba(53, 242, 207, 0.14), rgba(5, 7, 10, 0.52) 40%),
    rgba(5, 7, 10, 0.78);
}

.colony-hub-loading-panel {
  width: min(92vw, 580px);
  text-align: center;
}

.colony-hub-window {
  z-index: 7;
  background: rgba(2, 10, 22, 0.88);
}

.colony-hub-panel {
  display: grid;
  width: min(96vw, 1120px);
  height: min(88vh, 780px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-color: rgba(139, 220, 245, 0.32);
  background: rgba(3, 19, 43, 0.92);
}

.colony-hub-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.colony-hub-header h2 {
  margin-top: 4px;
  font-size: clamp(1.85rem, 6vw, 3.2rem);
  line-height: 0.96;
}

.colony-hub-map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  margin-top: 18px;
  border: 1px solid rgba(139, 220, 245, 0.28);
  border-radius: 8px;
  background: #03132b;
  cursor: grab;
  touch-action: none;
}

.colony-hub-map-canvas.dragging {
  cursor: grabbing;
}

.colony-loading-track {
  height: 10px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid rgba(53, 242, 207, 0.28);
  border-radius: 999px;
  background: rgba(238, 248, 246, 0.08);
}

.colony-loading-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(53, 242, 207, 0.18), #35f2cf, #8bdcf5);
  box-shadow: 0 0 18px rgba(53, 242, 207, 0.38);
  transform: translateX(-100%);
  animation: colony-loading-sweep 1.35s ease-in-out infinite;
}

.colony-loading-status {
  margin-top: 14px;
  color: #c2d1cd;
  font-size: 0.92rem;
  font-weight: 800;
}

.colony-loading-close {
  margin-top: 22px;
}

@keyframes colony-loading-sweep {
  0% {
    transform: translateX(-100%);
  }

  58% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(100%);
  }
}

.inventory-header,
.craft-header,
.map-header,
.control-header,
.shuttle-view-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.craft-header h2,
.map-header h2,
.control-header h2,
.shuttle-view-header h2 {
  margin-top: 4px;
  font-size: clamp(1.85rem, 6vw, 3.2rem);
  line-height: 0.96;
}

.inventory-header h2 {
  margin: 0;
}

.shuttle-view-header h2 {
  margin: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(238, 248, 246, 0.2);
  border-radius: 8px;
  background: rgba(238, 248, 246, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.icon-button:hover,
.inventory-slot:not(:disabled):hover,
.craft-slot:not(:disabled):hover {
  border-color: rgba(157, 242, 141, 0.56);
}

.inventory-slot:disabled {
  cursor: default;
  opacity: 0.58;
}

.inventory-grid,
.craft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.craft-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.craft-tab {
  min-height: 40px;
  border: 1px solid rgba(238, 248, 246, 0.16);
  border-radius: 8px;
  background: rgba(238, 248, 246, 0.07);
  color: #c2d1cd;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 9px 12px;
  text-transform: uppercase;
}

.craft-tab:hover,
.craft-tab.active {
  border-color: rgba(157, 242, 141, 0.58);
  color: var(--text);
}

.craft-tab.active {
  background: rgba(157, 242, 141, 0.12);
  box-shadow: inset 0 0 0 1px rgba(157, 242, 141, 0.16);
}

.craft-tab-panel[hidden] {
  display: none;
}

.kit-upgrades-panel {
  min-height: 260px;
}

.inventory-slot,
.craft-slot {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 74px;
  border: 1px solid rgba(238, 248, 246, 0.18);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.86);
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.inventory-slot.active,
.craft-slot.active {
  border-color: rgba(157, 242, 141, 0.62);
  box-shadow: inset 0 0 0 1px rgba(157, 242, 141, 0.2);
}

.inventory-slot.menu-open {
  border-color: rgba(139, 220, 245, 0.72);
  box-shadow: inset 0 0 0 1px rgba(139, 220, 245, 0.2);
}

.craft-slot:disabled {
  cursor: default;
  opacity: 0.58;
}

.craft-slot.crafting {
  border-color: rgba(139, 220, 245, 0.62);
  box-shadow: inset 0 0 0 1px rgba(139, 220, 245, 0.18);
}

.slot-icon {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
}

.probe-slot-icon::before {
  position: absolute;
  inset: 9px 4px;
  border: 1px solid var(--amber);
  border-radius: 4px;
  background: #dcebe7;
  content: "";
}

.probe-slot-icon::after {
  position: absolute;
  right: 4px;
  top: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

.solar-slot-icon::before,
.solar-slot-icon::after {
  position: absolute;
  top: 8px;
  width: 11px;
  height: 14px;
  border: 1px solid rgba(157, 242, 141, 0.8);
  border-radius: 3px;
  background: #12333a;
  content: "";
}

.solar-slot-icon::before {
  left: 1px;
}

.solar-slot-icon::after {
  right: 1px;
}

.energy-slot-icon::before {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #eef8f6, var(--green) 42%, rgba(157, 242, 141, 0.08) 72%);
  box-shadow: 0 0 16px rgba(157, 242, 141, 0.44);
  content: "";
}

.oxygen-slot-icon::before {
  position: absolute;
  inset: 4px 6px;
  border: 1px solid rgba(139, 220, 245, 0.78);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(238, 248, 246, 0.92), rgba(139, 220, 245, 0.3));
  box-shadow: inset 0 -9px 0 rgba(53, 242, 207, 0.24), 0 0 14px rgba(139, 220, 245, 0.34);
  content: "";
}

.oxygen-slot-icon::after {
  position: absolute;
  inset: 9px 11px 16px;
  border-radius: 999px;
  background: rgba(6, 10, 12, 0.72);
  content: "";
}

.fuel-slot-icon::before {
  position: absolute;
  left: 8px;
  top: 4px;
  width: 14px;
  height: 20px;
  border: 1px solid rgba(255, 195, 92, 0.82);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 195, 92, 0.92), rgba(255, 103, 92, 0.42));
  box-shadow: inset 0 -9px 0 rgba(157, 242, 141, 0.24), 0 0 14px rgba(255, 195, 92, 0.28);
  content: "";
}

.fuel-slot-icon::after {
  position: absolute;
  left: 12px;
  top: 7px;
  width: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(6, 10, 12, 0.64);
  content: "";
}

.brake-fluid-slot-icon::before {
  position: absolute;
  left: 8px;
  top: 4px;
  width: 14px;
  height: 20px;
  border: 1px solid rgba(139, 220, 245, 0.82);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(238, 248, 246, 0.92), rgba(53, 242, 207, 0.34));
  box-shadow: inset 0 -8px 0 rgba(139, 220, 245, 0.2), 0 0 14px rgba(53, 242, 207, 0.24);
  content: "";
}

.brake-fluid-slot-icon::after {
  position: absolute;
  left: 12px;
  top: 6px;
  width: 6px;
  height: 4px;
  border-radius: 999px;
  background: rgba(6, 10, 12, 0.64);
  content: "";
}

.planet-probe-slot-icon::before {
  position: absolute;
  left: 8px;
  top: 9px;
  width: 17px;
  height: 12px;
  border: 1px solid rgba(255, 195, 92, 0.78);
  border-radius: 50% 46% 46% 50%;
  background: linear-gradient(135deg, #eef8f6, #8bdcf5 36%, #253338 72%);
  box-shadow: 0 0 14px rgba(255, 195, 92, 0.24);
  clip-path: polygon(100% 50%, 68% 12%, 16% 10%, 0 50%, 16% 90%, 68% 88%);
  content: "";
}

.planet-probe-slot-icon::after {
  position: absolute;
  left: 6px;
  top: 12px;
  width: 13px;
  height: 6px;
  border-top: 1px solid rgba(255, 195, 92, 0.72);
  border-bottom: 1px solid rgba(255, 195, 92, 0.72);
  transform: skewX(-28deg);
  content: "";
}

.slot-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.inventory-slot strong,
.craft-slot strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: 1.28rem;
  line-height: 1;
}

.craft-recipe-slot strong {
  font-size: 1rem;
  line-height: 1.1;
}

.craft-progress {
  display: block;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 999px;
  background: rgba(238, 248, 246, 0.08);
}

.craft-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8bdcf5, var(--teal));
  transform: scaleX(0);
  transform-origin: left center;
}

.recipe-cost {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.recipe-ingredient {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c2d1cd;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}

.recipe-ingredient .resource-symbol,
.recipe-ingredient .slot-icon {
  flex-basis: 20px;
  width: 20px;
  height: 20px;
}

.inventory-action-menu {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid rgba(139, 220, 245, 0.24);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.86);
  padding: 8px;
}

.inventory-action-menu[hidden] {
  display: none;
}

.inventory-action-menu button {
  min-height: 36px;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 8px;
  background: rgba(238, 248, 246, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.inventory-action-menu button:not(:disabled):hover {
  border-color: rgba(139, 220, 245, 0.56);
}

.inventory-action-menu button:disabled {
  color: rgba(194, 209, 205, 0.48);
  cursor: default;
}

.map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  margin-top: 18px;
  border: 1px solid rgba(53, 242, 207, 0.2);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.82);
  cursor: zoom-in;
  touch-action: none;
}

.shuttle-view-stage {
  position: relative;
  min-height: 260px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(53, 242, 207, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(53, 242, 207, 0.14), rgba(5, 7, 10, 0) 42%),
    linear-gradient(180deg, rgba(238, 248, 246, 0.05), rgba(5, 7, 10, 0.82));
}

.shuttle-view-stage::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(238, 248, 246, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 248, 246, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

.shuttle-view-stage canvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.control-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.control-section {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.76);
  padding: 12px;
}

.control-section h3 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(108px, max-content) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 36px;
  border-top: 1px solid rgba(238, 248, 246, 0.08);
  padding-top: 8px;
  color: #c2d1cd;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.25;
}

.control-section h3 + .control-row {
  border-top: 0;
  padding-top: 0;
}

.control-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.control-keys kbd {
  display: inline-grid;
  min-width: 28px;
  min-height: 24px;
  place-items: center;
  border: 1px solid rgba(53, 242, 207, 0.34);
  border-radius: 6px;
  background: rgba(53, 242, 207, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  padding: 4px 7px;
  white-space: nowrap;
}

.inventory-cargo,
.inventory-resources {
  margin-top: 18px;
  border-top: 1px solid rgba(238, 248, 246, 0.14);
  padding-top: 16px;
}

.inventory-cargo h3,
.inventory-resources h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.inventory-cargo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.inventory-cargo-slot {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  min-height: 92px;
  grid-template-rows: 28px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(238, 248, 246, 0.06), rgba(238, 248, 246, 0.018)),
    rgba(8, 13, 16, 0.92);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 10px 8px;
  text-align: center;
}

.inventory-cargo-slot.empty {
  background:
    linear-gradient(135deg, rgba(238, 248, 246, 0.038), rgba(238, 248, 246, 0.012)),
    rgba(7, 11, 14, 0.84);
}

.inventory-cargo-slot.empty::before {
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(238, 248, 246, 0.09);
  border-radius: 6px;
  content: "";
}

.inventory-cargo-slot.occupied:hover,
.inventory-cargo-slot.selected {
  border-color: rgba(157, 242, 141, 0.62);
  box-shadow: inset 0 0 0 1px rgba(157, 242, 141, 0.18);
}

.inventory-cargo-slot.dragging {
  opacity: 0.52;
}

.inventory-cargo-slot .resource-symbol {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
}

.inventory-cargo-label {
  display: flex;
  min-width: 0;
  min-height: 2.2em;
  align-items: center;
  color: #c2d1cd;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.inventory-cargo-slot strong {
  color: var(--green);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.15;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.resource-row {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(238, 248, 246, 0.14);
  border-radius: 8px;
  background: rgba(238, 248, 246, 0.05);
  padding: 8px 10px;
}

.resource-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #c2d1cd;
  font-size: 0.82rem;
  font-weight: 700;
}

.resource-name > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.resource-symbol {
  position: relative;
  display: block;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}

.hydrogen-symbol {
  border: 1px solid rgba(238, 248, 246, 0.58);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 248, 246, 0.2), rgba(139, 220, 245, 0.05) 66%);
}

.helium3-symbol {
  border: 1px solid rgba(255, 195, 92, 0.76);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 195, 92, 0.2), rgba(255, 195, 92, 0.02) 64%);
}

.hydrogen-symbol::before,
.hydrogen-symbol::after,
.helium3-symbol::before,
.helium3-symbol::after,
.electrolyte-symbol::before,
.electrolyte-symbol::after,
.rare-metals-symbol::before,
.rare-metals-symbol::after,
.alien-relics-symbol::before,
.alien-relics-symbol::after,
.radioactive-symbol::before,
.dark-matter-symbol::before,
.dark-matter-symbol::after {
  position: absolute;
  content: "";
}

.hydrogen-symbol::before,
.hydrogen-symbol::after {
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #eef8f6;
  box-shadow: 0 0 8px rgba(238, 248, 246, 0.48);
}

.hydrogen-symbol::before {
  left: 3px;
}

.hydrogen-symbol::after {
  right: 3px;
}

.helium3-symbol::before {
  inset: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 195, 92, 0.58);
}

.helium3-symbol::after {
  inset: 5px 1px;
  border: 1px solid rgba(238, 248, 246, 0.52);
  border-radius: 50%;
  transform: rotate(-28deg);
}

.ice-symbol {
  clip-path: polygon(50% 0, 88% 30%, 70% 100%, 30% 100%, 12% 30%);
  background: linear-gradient(145deg, #eef8f6, #8bdcf5 46%, rgba(53, 242, 207, 0.38));
  box-shadow: 0 0 12px rgba(139, 220, 245, 0.36);
}

.electrolyte-symbol::before {
  left: 3px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #eef8f6;
  box-shadow: 9px 5px 0 #8bdcf5, 4px 12px 0 rgba(238, 248, 246, 0.82);
}

.electrolyte-symbol::after {
  inset: 2px;
  border: 1px dashed rgba(139, 220, 245, 0.52);
  border-radius: 50%;
}

.rare-metals-symbol::before {
  inset: 5px 3px;
  border: 1px solid rgba(255, 195, 92, 0.9);
  border-radius: 4px;
  background: linear-gradient(135deg, #f7e6a7, var(--amber) 48%, #9b7034);
  transform: skewX(-14deg) rotate(-10deg);
}

.rare-metals-symbol::after {
  left: 7px;
  top: 7px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transform: rotate(-10deg);
}

.alien-relics-symbol {
  border: 1px solid rgba(184, 139, 245, 0.72);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(184, 139, 245, 0.24), rgba(53, 242, 207, 0.08) 62%, rgba(6, 10, 12, 0.8));
}

.alien-relics-symbol::before {
  left: 6px;
  top: 5px;
  width: 10px;
  height: 12px;
  clip-path: polygon(50% 0, 100% 76%, 50% 100%, 0 76%);
  background: linear-gradient(180deg, #eef8f6, #b88bf5 68%);
}

.alien-relics-symbol::after {
  left: 9px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #04100e;
}

.radioactive-symbol {
  border: 1px solid rgba(157, 242, 141, 0.74);
  border-radius: 50%;
  background:
    radial-gradient(circle, #06100e 0 18%, transparent 19%),
    conic-gradient(from 28deg, var(--green) 0 52deg, transparent 52deg 120deg, var(--green) 120deg 172deg, transparent 172deg 240deg, var(--green) 240deg 292deg, transparent 292deg 360deg);
  box-shadow: 0 0 12px rgba(157, 242, 141, 0.28);
}

.radioactive-symbol::before {
  inset: 8px;
  border-radius: 50%;
  background: #04100e;
}

.dark-matter-symbol {
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, rgba(238, 248, 246, 0.3), #22133d 30%, #05070a 66%);
  box-shadow: 0 0 16px rgba(184, 139, 245, 0.42);
}

.dark-matter-symbol::before {
  inset: 3px;
  border: 1px solid rgba(184, 139, 245, 0.55);
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-24deg);
}

.dark-matter-symbol::after {
  right: 3px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(53, 242, 207, 0.7);
}

.resource-row strong {
  color: var(--green);
  font-size: 1rem;
}

.modal-panel {
  width: min(92vw, 520px);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(6, 10, 12, 0.88);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.62);
  padding: clamp(24px, 6vw, 42px);
  text-align: center;
  backdrop-filter: blur(22px);
}

.modal-panel.compact {
  width: min(92vw, 420px);
}

.start-menu-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 570px);
  border: 0;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(4, 8, 10, 0.76), rgba(4, 8, 10, 0.34) 58%, transparent 82%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0.12) 72%, transparent);
  box-shadow: none;
  padding: clamp(18px, 3vw, 34px) clamp(18px, 4vw, 44px) clamp(20px, 4vw, 42px) 0;
  text-align: left;
  backdrop-filter: none;
}

.start-menu-panel h1 {
  color: #f3fbff;
  text-shadow:
    0 0 24px rgba(53, 242, 207, 0.2),
    0 0 42px rgba(255, 195, 92, 0.12),
    0 12px 40px rgba(0, 0, 0, 0.8);
}

.start-menu-panel .eyebrow {
  color: rgba(157, 242, 141, 0.92);
}

.start-menu-panel .lede {
  max-width: 30rem;
  margin: 18px 0 0;
  color: #d6e1df;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.72);
}

.start-menu-panel .primary-button {
  background: linear-gradient(135deg, #eef8f6, #9df28d);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 28px rgba(53, 242, 207, 0.2);
  color: #060a0c;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  margin-top: 6px;
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(2rem, 7vw, 3.8rem);
}

.lede {
  max-width: 38rem;
  margin: 16px auto 0;
  color: #c2d1cd;
  font-size: clamp(1rem, 2.6vw, 1.14rem);
  line-height: 1.55;
}

.primary-button {
  min-width: 136px;
  min-height: 48px;
  margin-top: 28px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--green));
  color: #04100e;
  box-shadow: 0 16px 38px rgba(53, 242, 207, 0.22);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.primary-button:hover {
  filter: brightness(1.05);
}

.primary-button:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .game-shell {
    min-height: 0;
  }

  .hud {
    inset: 10px 10px auto 10px;
    grid-template-columns: minmax(96px, 1fr) minmax(82px, 1fr) 46px;
    gap: 8px;
  }

  .life-bars {
    grid-column: 1 / -1;
    min-height: 122px;
  }

  .stat {
    min-width: 0;
    min-height: 48px;
  }

  .sound-button {
    width: 46px;
    min-height: 48px;
  }

  .hydrogen-harvest-status {
    top: 302px;
  }

  .inventory,
  .craft-menu,
  .map-window,
  .control-window,
  .shuttle-view-window,
  .colony-hub-loading,
  .colony-hub-window,
  .distress-ship-stores-window {
    padding: 14px;
  }

  .top-right-hud {
    top: 244px;
    right: 10px;
  }

  .trajectory-mils {
    min-width: 102px;
    padding: 7px 10px;
  }

  .shuttle-view-button {
    min-height: 36px;
    padding: 8px 10px;
  }

  .map-panel {
    width: min(94vw, 920px);
    height: min(78vh, 680px);
  }

  .inventory-grid,
  .craft-grid,
  .distress-ship-stores-grid {
    grid-template-columns: 1fr;
  }

  .control-sections {
    grid-template-columns: 1fr;
  }

  .control-row {
    grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
  }

  .resource-list {
    grid-template-columns: 1fr;
  }

  .start-menu {
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    background-position: center center;
    overflow-y: auto;
  }

  .start-menu-panel {
    width: min(100%, 520px);
    padding: 16px 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18));
  }

  .start-menu-panel h1 {
    font-size: clamp(2rem, 12vw, 3.6rem);
    line-height: 0.98;
  }

  .start-menu-panel .lede {
    margin-top: 12px;
    font-size: 0.96rem;
    line-height: 1.4;
  }

  .start-menu-panel .primary-button {
    min-height: 50px;
    margin-top: 18px;
  }
}

@media (max-width: 720px) and (max-height: 520px) {
  .start-menu {
    padding: max(12px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  }

  .start-menu-panel {
    padding: 10px 0;
  }

  .start-menu-panel h1 {
    font-size: clamp(1.8rem, 10vw, 3rem);
  }

  .start-menu-panel .lede {
    display: none;
  }

  .start-menu-panel .primary-button {
    margin-top: 14px;
  }
}

@media (pointer: coarse), (max-width: 860px) {
  .mobile-touch-controls {
    display: grid;
  }
}

@media (max-width: 520px) {
  .mobile-touch-controls {
    gap: 8px;
  }

  .mobile-action-buttons {
    grid-template-columns: repeat(2, minmax(58px, 1fr));
    max-width: min(57vw, 188px);
  }

  .mobile-window-buttons {
    bottom: calc(100% + 8px);
  }

  .mobile-touch-button {
    min-height: 40px;
    font-size: 0.7rem;
    padding: 7px 8px;
  }
}
