:root {
  --bg: #0c1118;
  --bg-elev: #141c27;
  --panel: #1a2431;
  --text: #ecf2f8;
  --muted: #9eb1c5;
  --accent: #36c7a1;
  --warn: #f4b942;
  --danger: #ff6e6e;
  --border: #2a3a4f;
  --border-accent: rgba(54, 199, 161, 0.22);
  --border-gold: rgba(255, 210, 80, 0.3);
  --border-blue: rgba(46, 168, 229, 0.28);
  --card-bg: linear-gradient(160deg, rgba(10, 18, 30, 0.92), rgba(14, 24, 40, 0.92));
  --panel-bg: linear-gradient(160deg, rgba(14, 24, 38, 0.97), rgba(20, 32, 50, 0.97));
  --topbar-height: 84px;
  --resource-header-height: 74px;
}

body.title-screen-active .topbar,
body.title-screen-active .resource-header,
body.title-screen-active .layout,
body.title-screen-active .modal,
body.title-screen-active .win-overlay {
  visibility: hidden;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 22%, rgba(54, 199, 161, 0.28) 0%, rgba(54, 199, 161, 0) 46%),
    radial-gradient(circle at 82% 75%, rgba(46, 168, 229, 0.32) 0%, rgba(46, 168, 229, 0) 52%),
    linear-gradient(145deg, #0f1620 0%, #162233 48%, #16283d 100%);
}

body.title-screen-active .title-screen {
  display: flex;
}

.title-screen-card {
  width: min(1080px, 100%);
  max-height: calc(100vh - 48px);
  padding: clamp(24px, 4vw, 42px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(11, 19, 30, 0.86);
  box-shadow: 0 20px 48px rgba(2, 7, 14, 0.55);
  backdrop-filter: blur(6px);
  text-align: left;
  overflow: auto;
  box-sizing: border-box;
}

.title-screen-kicker {
  margin: 0;
  color: #99ddc9;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
}

.title-screen-card h1 {
  margin: 8px 0 6px;
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 1.05;
  color: #f3f7ff;
}

.title-screen-subtitle {
  margin: 0;
  max-width: 52ch;
  color: #c8d3e5;
  line-height: 1.5;
}

.title-pack-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.title-pack-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.title-pack-panel-header h2 {
  margin: 0;
  font-size: 0.92rem;
  color: #e9efff;
}

.title-pack-hint {
  font-size: 0.75rem;
  color: #9fb5cb;
  text-align: right;
}

.title-content-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.title-pack-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(10, 16, 24, 0.82);
  color: #edf5ff;
  min-height: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.title-pack-card-header {
  display: grid;
  gap: 4px;
}

.title-pack-card-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #99ddc9;
}

.title-pack-card-title {
  margin: 0;
  font-size: 1.25rem;
  color: #f4f8ff;
}

.title-pack-card-meta {
  font-size: 0.78rem;
  color: #9fb5cb;
}

.title-pack-card-description {
  margin: 0;
  min-height: 3.6em;
  color: #c8d3e5;
  line-height: 1.45;
}

.title-save-preview {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e7eef9;
}

.title-save-preview.is-empty {
  opacity: 0.92;
}

.title-save-preview.has-save {
  border-color: rgba(54, 199, 161, 0.28);
  background: rgba(54, 199, 161, 0.08);
}

.title-save-preview-headline {
  font-size: 1.05rem;
  font-weight: 700;
}

.title-save-preview-detail {
  margin-top: 4px;
  color: #b9cade;
  font-size: 0.88rem;
}

.title-save-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.title-save-preview-stat {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(11, 18, 26, 0.45);
}

.title-save-preview-stat span,
.title-save-preview-empty span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9fb5cb;
}

.title-save-preview-stat strong,
.title-save-preview-empty strong {
  font-size: 0.98rem;
  color: #f3f7ff;
}

.title-save-preview-empty {
  display: grid;
  gap: 6px;
}

.title-save-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.title-save-preview-action {
  flex: 1 1 130px;
  min-width: 130px;
}

.title-save-preview-action--primary {
  flex-basis: 180px;
}

.title-save-preview-action--danger {
  background: rgba(149, 34, 34, 0.28);
  border-color: rgba(214, 102, 102, 0.4);
}

.title-save-preview-action--danger:hover,
.title-save-preview-action--danger:focus-visible {
  background: rgba(173, 49, 49, 0.4);
}

.title-screen-hint {
  margin: 12px 0 0;
  color: #adc0d8;
  font-size: 0.84rem;
  line-height: 1.45;
}

.title-settings-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
}

.title-settings-panel h2 {
  margin: 0;
  font-size: 0.92rem;
  color: #e9efff;
}

.title-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c8d3e5;
  font-size: 0.88rem;
}

.title-setting-row input {
  width: 16px;
  height: 16px;
  accent-color: #36c7a1;
}

body.pref-large-text {
  font-size: 18px;
}

body.pref-reduced-motion *,
body.pref-reduced-motion *::before,
body.pref-reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, #162437 0%, var(--bg) 45%, #080c12 100%);
  color: var(--text);
}

.topbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 17, 24, 0.85);
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
  z-index: 10;
}

.topbar-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.topbar-copy {
  min-width: 0;
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 200px;
}

.progression-header {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.progress-header {
  width: 200px;
  max-width: 100%;
  height: 0.4rem;
  background: rgba(158, 177, 197, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-header > span {
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(54, 199, 161, 0.6) 100%);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.run-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.56rem;
  border: 1px solid rgba(91, 136, 176, 0.45);
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(13, 27, 43, 0.88), rgba(9, 19, 31, 0.88));
  min-width: 6.8rem;
  justify-content: center;
}

.run-header-chip-label {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ec0de;
}

.run-header-chip strong {
  font-size: 0.84rem;
  color: #e2f0fd;
}

.run-header-chip-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.run-resource-chips {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.run-resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.52rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 141, 182, 0.52);
  background: linear-gradient(160deg, rgba(12, 25, 39, 0.9), rgba(9, 18, 30, 0.9));
  color: #dceefe;
}

.run-resource-chip img {
  width: 0.86rem;
  height: 0.86rem;
}

.run-resource-chip strong {
  font-size: 0.8rem;
}

.run-resource-chip--inventory {
  border-color: rgba(88, 148, 121, 0.6);
  background: linear-gradient(160deg, rgba(10, 34, 28, 0.92), rgba(8, 26, 22, 0.92));
}

body.meta-phase-active .run-header-chip--timer {
  display: none;
}

.topbar-status {
  margin: 0.55rem 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-control {
  display: inline-flex;
  align-items: center;
}

.language-select {
  min-width: 5.5rem;
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 220;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
  max-width: min(28rem, calc(100vw - 2rem));
}

.toast {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  padding: 0.62rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(95, 128, 162, 0.48);
  background: linear-gradient(160deg, rgba(13, 24, 39, 0.96), rgba(17, 30, 48, 0.96));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  color: #e6f1fb;
  font-size: 0.82rem;
  line-height: 1.3;
  backdrop-filter: blur(6px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--info {
  border-color: rgba(46, 168, 229, 0.62);
  box-shadow: 0 0 0 1px rgba(46, 168, 229, 0.12), 0 10px 24px rgba(0, 0, 0, 0.32);
}

.toast--success {
  border-color: rgba(54, 199, 161, 0.62);
  box-shadow: 0 0 0 1px rgba(54, 199, 161, 0.12), 0 10px 24px rgba(0, 0, 0, 0.32);
}

.toast--warn {
  border-color: rgba(244, 185, 66, 0.68);
  box-shadow: 0 0 0 1px rgba(244, 185, 66, 0.15), 0 10px 24px rgba(0, 0, 0, 0.32);
}

.toast--danger {
  border-color: rgba(255, 110, 110, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 110, 110, 0.2), 0 10px 24px rgba(0, 0, 0, 0.32);
}

.speed-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem;
  border: 1px solid rgba(54, 88, 130, 0.45);
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(12, 22, 36, 0.88), rgba(8, 16, 26, 0.88));
}

.speed-value {
  min-width: 2.8rem;
  text-align: center;
  font-weight: 600;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

.chevron {
  width: 0.4rem;
  height: 0.4rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  display: inline-block;
}

.chevron-left {
  transform: rotate(-135deg);
  margin-left: 0.18rem;
}

.chevron-right {
  transform: rotate(45deg);
  margin-right: 0.18rem;
}

.header-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  order: 999;
}

.burger-btn {
  flex-direction: column;
  gap: 0.18rem;
}

.burger-btn span {
  display: block;
  width: 0.95rem;
  height: 2px;
  background: currentColor;
  border-radius: 99px;
}

.header-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  display: grid;
  gap: 0.4rem;
  min-width: 10rem;
  padding: 0.45rem;
  border: 1px solid rgba(54, 88, 130, 0.45);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(12, 22, 36, 0.99), rgba(16, 28, 46, 0.99));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(54, 199, 161, 0.06);
  backdrop-filter: blur(8px);
}

.header-menu-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(118, 144, 170, 0.2), rgba(118, 144, 170, 0.7), rgba(118, 144, 170, 0.2));
  margin: 0.15rem 0;
}

.header-menu-label {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.debug-menu-btn {
  border-color: rgba(183, 134, 62, 0.55);
  background: linear-gradient(180deg, rgba(62, 46, 20, 0.92), rgba(52, 37, 16, 0.92));
}

.debug-menu-btn:hover {
  border-color: #f4b942;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  background: linear-gradient(90deg, #ecf2f8 0%, #b8dff5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout {
  display: grid;
  gap: 0.9rem;
  padding: calc(1rem + var(--resource-header-height)) 1rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.resource-header {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--topbar-height);
  z-index: 9;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(14, 21, 30, 0.94), rgba(10, 15, 22, 0.92));
  backdrop-filter: blur(8px);
}

.scene-panel {
  grid-column: 1 / -1;
}

.management-panel {
  grid-column: 1 / -1;
}

.management-location-controls {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.location-meta-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.location-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(103, 136, 170, 0.55);
  background: rgba(16, 26, 36, 0.75);
  color: #cfe0f1;
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
}

.location-pill--label {
  border-color: rgba(126, 219, 186, 0.55);
  background: rgba(24, 49, 43, 0.72);
  color: #a8f0d7;
}

.location-pill--neutral {
  border-color: rgba(103, 136, 170, 0.55);
  background: rgba(16, 26, 36, 0.75);
  color: #cfe0f1;
}

.location-pill--ok {
  border-color: rgba(110, 219, 151, 0.65);
  background: rgba(22, 56, 41, 0.76);
  color: #baf4d1;
}

.location-pill--info {
  border-color: rgba(101, 182, 228, 0.62);
  background: rgba(21, 42, 58, 0.76);
  color: #c5eaff;
}

.location-pill--warn {
  border-color: rgba(236, 190, 106, 0.68);
  background: rgba(59, 44, 20, 0.76);
  color: #ffe2b3;
}

.location-pill--danger {
  border-color: rgba(234, 124, 124, 0.72);
  background: rgba(62, 28, 33, 0.78);
  color: #ffd2d2;
}

.scene-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.scene-panel-header h2 {
  margin-bottom: 0.25rem;
}

.scene-view-switch {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid rgba(54, 88, 130, 0.42);
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(10, 20, 34, 0.88), rgba(7, 14, 26, 0.88));
}

.scene-view-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.scene-view-btn:hover:not(.active) {
  border-color: rgba(71, 105, 145, 0.5);
  background: rgba(20, 38, 58, 0.6);
}

.scene-view-btn.active {
  background: linear-gradient(90deg, rgba(30, 80, 120, 0.55), rgba(24, 78, 66, 0.55));
  border-color: rgba(54, 199, 161, 0.55);
  color: #a8f0e0;
  box-shadow: 0 0 10px rgba(54, 199, 161, 0.12);
}

.scene-canvas {
  position: relative;
  min-height: clamp(18rem, 48vh, 24rem);
  overflow: hidden;
  border: 1px solid rgba(88, 118, 153, 0.35);
  border-radius: 20px;
  background: radial-gradient(circle at 20% 20%, rgba(31, 54, 84, 0.75), rgba(7, 11, 18, 0.98) 60%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.24), 0 16px 32px rgba(0, 0, 0, 0.18);
}

.scene-canvas--planetary {
  background: radial-gradient(circle at 50% 24%, rgba(74, 154, 219, 0.24), rgba(7, 12, 18, 0.98) 66%), linear-gradient(180deg, rgba(8, 17, 28, 0.9), rgba(4, 7, 11, 1));
}

.scene-canvas--orbital {
  background: radial-gradient(circle at 52% 36%, rgba(84, 126, 188, 0.34), rgba(8, 12, 18, 0.98) 68%), linear-gradient(180deg, rgba(8, 15, 24, 0.96), rgba(3, 6, 10, 1));
}

.scene-canvas--system {
  background: radial-gradient(circle at 12% 45%, rgba(255, 194, 92, 0.14), rgba(9, 12, 20, 0.98) 55%), linear-gradient(180deg, rgba(8, 14, 24, 0.96), rgba(3, 6, 10, 1));
}

.scene-canvas--helios {
  background: radial-gradient(circle at 50% 52%, rgba(255, 191, 95, 0.22), rgba(9, 12, 20, 0.98) 54%), linear-gradient(180deg, rgba(14, 18, 26, 0.96), rgba(3, 6, 10, 1));
}

.scene-stars,
.scene-stars::before,
.scene-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 24%, rgba(255,255,255,0.9) 0 1px, transparent 1.2px),
    radial-gradient(circle at 24% 72%, rgba(174,205,255,0.7) 0 1px, transparent 1.2px),
    radial-gradient(circle at 44% 18%, rgba(255,255,255,0.75) 0 1px, transparent 1.2px),
    radial-gradient(circle at 67% 63%, rgba(255,255,255,0.8) 0 1px, transparent 1.2px),
    radial-gradient(circle at 79% 26%, rgba(156,216,255,0.8) 0 1px, transparent 1.2px),
    radial-gradient(circle at 86% 76%, rgba(255,255,255,0.8) 0 1px, transparent 1.2px);
  opacity: 0.9;
}

.scene-stars::before {
  transform: scale(1.15);
  opacity: 0.45;
}

.scene-stars::after {
  transform: scale(0.9);
  opacity: 0.25;
}

.scene-nebula,
.scene-orbit-layer,
.scene-body-layer,
.scene-dyson-layer {
  position: absolute;
  inset: 0;
}

.scene-dyson-layer {
  z-index: 5;
  pointer-events: none;
}

.scene-nebula {
  background:
    radial-gradient(circle at 22% 28%, rgba(58, 113, 180, 0.14), transparent 20%),
    radial-gradient(circle at 70% 35%, rgba(112, 76, 170, 0.12), transparent 24%),
    radial-gradient(circle at 82% 72%, rgba(64, 132, 154, 0.1), transparent 18%);
  filter: blur(10px);
}

.scene-track {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(140, 184, 228, 0.22);
  border-radius: 50%;
}

.scene-track--moon {
  animation: slowSpin 18s linear infinite;
}

.scene-track--orbit {
  border-style: solid;
  opacity: 0.5;
}

.scene-track--solar {
  border-style: solid;
  border-color: rgba(255, 210, 116, 0.2);
}

.scene-body-node {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.scene-body-node.is-locked {
  opacity: 0.26;
  filter: saturate(0.45);
}

.scene-body-core {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset -18px -16px 22px rgba(6, 12, 22, 0.36), 0 0 24px rgba(0, 0, 0, 0.18);
  animation: bodyFloat 7s ease-in-out infinite;
}

.scene-body-node--star .scene-body-core {
  background: radial-gradient(circle at 35% 35%, #fff5c7 0%, #f4d874 22%, #f4b942 58%, rgba(244, 185, 66, 0.18) 100%);
  box-shadow: 0 0 42px rgba(244, 185, 66, 0.4), 0 0 120px rgba(244, 185, 66, 0.2);
  animation: solarPulse 5s ease-in-out infinite;
}

.scene-body-node--star.is-black-hole .scene-body-core {
  background:
    radial-gradient(circle at 44% 40%, rgba(62, 15, 22, 0.55) 0%, rgba(18, 8, 18, 0.92) 38%, rgba(2, 4, 10, 1) 72%),
    radial-gradient(circle at 60% 60%, rgba(0, 0, 0, 0.96) 0%, #000 72%);
  box-shadow: 0 0 24px rgba(230, 60, 30, 0.18), 0 0 70px rgba(0, 0, 0, 0.72);
  animation: blackHolePulse 4.2s ease-in-out infinite;
}

.scene-body-node--planet-habitable .scene-body-core {
  background:
    radial-gradient(circle at 34% 30%, rgba(198, 239, 255, 0.95) 0%, rgba(112, 190, 234, 0.9) 20%, rgba(48, 112, 175, 0.92) 56%, rgba(19, 44, 84, 1) 100%),
    radial-gradient(circle at 66% 68%, rgba(81, 174, 123, 0.92) 0%, rgba(51, 122, 84, 0.85) 28%, transparent 34%),
    radial-gradient(circle at 30% 70%, rgba(110, 173, 117, 0.78) 0%, transparent 30%);
}

.scene-body-node--planet-resource .scene-body-core {
  background:
    radial-gradient(circle at 36% 28%, rgba(243, 214, 167, 0.95), rgba(177, 110, 68, 0.95) 34%, rgba(96, 53, 38, 1) 80%),
    radial-gradient(circle at 66% 62%, rgba(82, 42, 32, 0.7), transparent 24%);
}

.scene-body-node--gas-giant .scene-body-core {
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 229, 178, 0.95), rgba(201, 139, 77, 0.95) 35%, rgba(113, 74, 49, 1) 86%),
    repeating-linear-gradient(180deg, rgba(255, 219, 161, 0.35) 0 0.55rem, rgba(160, 98, 57, 0.32) 0.55rem 1.1rem, rgba(108, 63, 39, 0.34) 1.1rem 1.6rem);
}

.scene-body-node--ice-planet .scene-body-core {
  background:
    radial-gradient(circle at 35% 30%, rgba(242, 249, 255, 0.98), rgba(156, 194, 228, 0.94) 44%, rgba(84, 116, 150, 1) 88%),
    radial-gradient(circle at 66% 66%, rgba(214, 238, 255, 0.5), transparent 24%);
}

.scene-body-node--moon .scene-body-core {
  background: radial-gradient(circle at 34% 30%, rgba(247, 248, 250, 0.95), rgba(158, 169, 182, 0.95) 62%, rgba(84, 95, 110, 1));
}

.scene-body-node--moon .scene-body-core::before,
.scene-body-node--moon .scene-body-core::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(108, 120, 138, 0.35);
}

.scene-body-node--moon .scene-body-core::before {
  width: 16%;
  height: 16%;
  left: 24%;
  top: 30%;
}

.scene-body-node--moon .scene-body-core::after {
  width: 11%;
  height: 11%;
  right: 24%;
  bottom: 28%;
}

.scene-body-node--belt {
  width: 15rem;
  height: 5.5rem;
}

.scene-body-node--belt .scene-body-core {
  background: transparent;
  border-radius: 999px;
  border: 1px dashed rgba(184, 205, 228, 0.22);
  box-shadow: none;
}

.scene-belt-dust,
.scene-belt-dust::before,
.scene-belt-dust::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(circle at 12% 50%, rgba(188, 198, 210, 0.45) 0 1px, transparent 1.3px),
    radial-gradient(circle at 22% 42%, rgba(212, 196, 162, 0.36) 0 1.2px, transparent 1.5px),
    radial-gradient(circle at 31% 56%, rgba(172, 180, 189, 0.5) 0 1.1px, transparent 1.4px),
    radial-gradient(circle at 48% 45%, rgba(210, 200, 182, 0.42) 0 1.1px, transparent 1.4px),
    radial-gradient(circle at 62% 60%, rgba(180, 189, 198, 0.5) 0 1px, transparent 1.3px),
    radial-gradient(circle at 74% 40%, rgba(198, 206, 214, 0.4) 0 1.1px, transparent 1.4px),
    radial-gradient(circle at 88% 54%, rgba(210, 191, 160, 0.4) 0 1.1px, transparent 1.4px);
  animation: beltDrift 20s linear infinite;
}

.scene-belt-dust::before {
  transform: scale(1.04);
  opacity: 0.6;
}

.scene-belt-dust::after {
  transform: scale(0.96);
  opacity: 0.45;
}

.scene-body-label {
  position: absolute;
  left: 50%;
  bottom: -1.4rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.45rem;
  border: 1px solid rgba(126, 161, 199, 0.32);
  border-radius: 999px;
  background: rgba(7, 12, 18, 0.8);
  color: var(--text);
  font-size: 0.72rem;
  white-space: nowrap;
}

.scene-body-lock {
  color: var(--warn);
  font-size: 0.65rem;
}

.scene-structure-ring {
  position: absolute;
  inset: -2.75rem;
}

.scene-structure {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid rgba(124, 178, 228, 0.34);
  border-radius: 999px;
  background: rgba(7, 12, 18, 0.85);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%) rotate(var(--marker-angle)) translateY(calc(var(--marker-distance) * -1)) rotate(calc(var(--marker-angle) * -1));
}

.scene-structure--orbit,
.scene-structure--belt,
.scene-structure--atmosphere {
  border-color: rgba(244, 185, 66, 0.45);
  background: rgba(11, 16, 24, 0.88);
}

.scene-structure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.26rem;
}

.scene-structure-badge {
  position: absolute;
  right: -0.25rem;
  bottom: -0.2rem;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.18rem;
  border-radius: 999px;
  background: var(--accent);
  color: #081119;
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scene-empty-state {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  padding: 0.45rem 0.7rem;
  border: 1px dashed rgba(126, 161, 199, 0.28);
  border-radius: 12px;
  background: rgba(7, 12, 18, 0.55);
  color: var(--muted);
  font-size: 0.8rem;
}

.scene-dyson-segment {
  position: absolute;
  left: var(--dyson-x, 12%);
  top: var(--dyson-y, 50%);
  width: var(--dyson-segment-width, 1.8rem);
  height: 0.42rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(227, 232, 240, 0.96), rgba(148, 158, 174, 0.96));
  box-shadow: 0 0 12px rgba(162, 176, 196, 0.35);
  transform: translate(-50%, -50%) rotate(var(--segment-angle)) translateY(calc(var(--dyson-distance, 5.4rem) * -1));
}

.scene-dyson-shell {
  position: absolute;
  left: var(--dyson-x, 12%);
  top: var(--dyson-y, 50%);
  width: var(--dyson-shell-size, 12.4rem);
  height: var(--dyson-shell-size, 12.4rem);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: conic-gradient(from -90deg, rgba(198, 209, 224, 0.9) calc(var(--dyson-progress) * 360deg), rgba(198, 209, 224, 0.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 69%, #000 71%);
  mask: radial-gradient(circle, transparent 69%, #000 71%);
  opacity: 0.25;
}

.scene-dyson-shell--dormant {
  opacity: 0.1;
}

.scene-dyson-shell--scaffold {
  opacity: 0.25;
  filter: saturate(0.9);
}

.scene-dyson-shell--lattice {
  opacity: 0.42;
  filter: saturate(1.05);
}

.scene-dyson-shell--ring {
  opacity: 0.6;
  box-shadow: 0 0 22px rgba(166, 181, 203, 0.22);
}

.scene-dyson-shell--crown {
  opacity: 0.84;
  box-shadow: 0 0 30px rgba(176, 192, 214, 0.35), 0 0 68px rgba(176, 192, 214, 0.2);
}

.scene-dyson-module {
  position: absolute;
  left: var(--dyson-x, 12%);
  top: var(--dyson-y, 50%);
  border-radius: 999px;
  transform: translate(-50%, -50%) rotate(var(--module-angle)) translateY(calc(var(--module-distance) * -1)) rotate(calc(var(--module-angle) * -1));
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.28);
}

.scene-dyson-module--bastion {
  width: 0.92rem;
  height: 0.92rem;
  border: 2px solid rgba(255, 214, 128, 0.95);
  background: rgba(74, 52, 16, 0.86);
}

.scene-dyson-mirror-field {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 0 4px rgba(104, 188, 248, 0.55)) drop-shadow(0 0 10px rgba(87, 132, 235, 0.25));
}

.scene-dyson-module--stabilizer {
  width: 0.78rem;
  height: 0.78rem;
  border: 1px solid rgba(214, 177, 255, 0.92);
  background: radial-gradient(circle at 45% 35%, rgba(214, 177, 255, 0.95), rgba(112, 84, 172, 0.95));
}

.scene-dyson-layer[data-stage="crown"] .scene-dyson-segment {
  box-shadow: 0 0 16px rgba(183, 199, 221, 0.55);
}

.scene-helios-ring-system {
  position: absolute;
  left: var(--dyson-x, 12%);
  top: var(--dyson-y, 50%);
  width: calc(var(--dyson-shell-size, 12.4rem) * 1.1);
  height: calc(var(--dyson-shell-size, 12.4rem) * 1.1);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 8;
}

.scene-helios-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1px solid rgba(238, 108, 64, 0.62);
  box-shadow: inset 0 0 14px rgba(255, 132, 84, 0.2), 0 0 18px rgba(255, 108, 44, 0.16);
  transform: translate(-50%, -50%);
  animation: heliosRingSpinA 16s linear infinite;
  opacity: 0.74;
}

.scene-helios-ring--a {
  width: 100%;
  height: 100%;
}

.scene-helios-ring--b {
  width: 84%;
  height: 84%;
  border-color: rgba(255, 164, 104, 0.58);
  animation-name: heliosRingSpinB;
  animation-duration: 12s;
}

.scene-helios-ring--c {
  width: 64%;
  height: 64%;
  border-color: rgba(255, 84, 44, 0.58);
  animation-name: heliosRingSpinC;
  animation-duration: 9s;
}

.scene-helios-singularity {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(calc(0.2 + var(--ignition-progress, 0) * 0.9));
  background: radial-gradient(circle at 45% 45%, rgba(255, 84, 44, 0.2) 0%, rgba(12, 0, 0, 0.65) 28%, rgba(0, 0, 0, 1) 62%);
  box-shadow: 0 0 30px rgba(255, 76, 42, 0.22), 0 0 70px rgba(0, 0, 0, 0.7);
  opacity: calc(var(--ignition-progress, 0) * 0.95);
  transition: opacity 0.2s linear;
}

.scene-dyson-layer.is-charged .scene-helios-ring {
  opacity: 0.68;
}

.scene-dyson-layer.is-igniting .scene-helios-ring {
  animation-duration: calc(16s - var(--ignition-progress, 0) * 12s);
  opacity: calc(0.75 + var(--ignition-progress, 0) * 0.2);
  filter: saturate(calc(1 + var(--ignition-progress, 0) * 1.2));
}

.scene-dyson-layer.is-igniting .scene-helios-ring--b {
  animation-duration: calc(12s - var(--ignition-progress, 0) * 9s);
}

.scene-dyson-layer.is-igniting .scene-helios-ring--c {
  animation-duration: calc(9s - var(--ignition-progress, 0) * 6s);
}

.scene-dyson-layer.is-black-hole .scene-helios-singularity {
  opacity: 0.95;
  transform: translate(-50%, -50%) scale(1.1);
}

/* === Phase 6: Dyson charge UI === */
.dyson-charge-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.dyson-charge-btn {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.28rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 185, 50, 0.6);
  background: rgba(255, 185, 50, 0.12);
  color: var(--warn);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.dyson-charge-btn:hover {
  background: rgba(255, 185, 50, 0.22);
  border-color: rgba(255, 185, 50, 0.9);
}

.dyson-charge-btn.is-active {
  background: rgba(255, 185, 50, 0.28);
  border-color: var(--warn);
  box-shadow: 0 0 8px rgba(244, 185, 66, 0.35);
}

.dyson-charge-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 240px;
}

.dyson-charge-bar {
  flex: 1;
  height: 0.42rem;
  background: rgba(158, 177, 197, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.dyson-charge-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f4b942, #ffe080);
  border-radius: 2px;
  transition: width 0.3s linear;
}

.dyson-charge-label {
  font-size: 0.64rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.dyson-charge-rate {
  margin: 0;
  font-size: 0.67rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* === Phase 7: Ignite button === */
.dyson-ignite-header {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dyson-ignite-btn {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.4rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(252, 200, 80, 0.8);
  background: linear-gradient(90deg, rgba(200, 100, 10, 0.3), rgba(255, 200, 30, 0.2));
  color: #ffd86e;
  cursor: pointer;
  animation: igniteGlow 1.6s ease-in-out infinite alternate;
  transition: transform 0.12s;
}

.dyson-ignite-btn:hover {
  transform: scale(1.04);
}

@keyframes igniteGlow {
  from { box-shadow: 0 0 6px rgba(255, 190, 40, 0.3); }
  to   { box-shadow: 0 0 20px rgba(255, 200, 60, 0.7), 0 0 40px rgba(255, 140, 20, 0.3); }
}

/* === Win overlay === */
.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.win-content {
  position: relative;
  text-align: center;
  padding: 3.5rem 3rem;
  border-radius: 1.2rem;
  background: linear-gradient(160deg, #101c2e 0%, #1a2c42 100%);
  border: 1px solid rgba(255, 210, 80, 0.4);
  box-shadow: 0 0 60px rgba(255, 180, 30, 0.25), 0 0 120px rgba(255, 120, 0, 0.1);
  max-width: 480px;
  width: 90vw;
}

.win-glow {
  position: absolute;
  inset: -4px;
  border-radius: 1.3rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 200, 60, 0.18), transparent 70%);
  pointer-events: none;
  animation: igniteGlow 2s ease-in-out infinite alternate;
}

.win-title {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  color: #ffd86e;
  text-shadow: 0 0 20px rgba(255, 200, 60, 0.6);
}

.win-subtitle {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.win-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1.2rem;
  margin: 0 0 1.8rem;
  text-align: left;
}

.win-stat {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  background: rgba(255, 200, 60, 0.05);
  border: 1px solid rgba(255, 200, 60, 0.1);
}

.win-stat-icon {
  width: 1.4rem;
  height: 1.4rem;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(54, 199, 161, 0.35));
}

.win-stat-label {
  flex: 1;
  font-size: 0.72rem;
  color: var(--muted);
}

.win-stat-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffe080;
  white-space: nowrap;
}

.win-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.win-close-btn,
.win-restart-btn {
  padding: 0.55rem 1.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.18s;
}

.win-close-btn {
  border: 1px solid rgba(255, 210, 80, 0.5);
  background: rgba(255, 185, 50, 0.14);
  color: var(--warn);
}

.win-close-btn:hover {
  background: rgba(255, 185, 50, 0.28);
}

.win-restart-btn {
  border: 1px solid rgba(158, 177, 197, 0.35);
  background: rgba(158, 177, 197, 0.08);
  color: var(--muted);
}

.win-restart-btn:hover {
  background: rgba(158, 177, 197, 0.18);
  color: var(--text);
}

@keyframes solarPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 42px rgba(244, 185, 66, 0.4), 0 0 120px rgba(244, 185, 66, 0.2);
  }

  50% {
    transform: scale(1.03);
    box-shadow: 0 0 54px rgba(244, 185, 66, 0.48), 0 0 132px rgba(244, 185, 66, 0.24);
  }
}

@keyframes bodyFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes beltDrift {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(0.7rem);
  }
}

@keyframes slowSpin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes heliosRingSpinA {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes heliosRingSpinB {
  from {
    transform: translate(-50%, -50%) rotate(360deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

@keyframes heliosRingSpinC {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(-360deg);
  }
}

@keyframes blackHolePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 24px rgba(230, 60, 30, 0.18), 0 0 70px rgba(0, 0, 0, 0.72);
  }

  50% {
    transform: scale(1.04);
    box-shadow: 0 0 30px rgba(230, 84, 40, 0.25), 0 0 92px rgba(0, 0, 0, 0.85);
  }
}

@keyframes activeResearchPulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(127, 242, 207, 0.24), 0 0 14px rgba(54, 199, 161, 0.14);
  }

  50% {
    box-shadow: 0 0 0 1px rgba(127, 242, 207, 0.4), 0 0 24px rgba(54, 199, 161, 0.24);
  }
}

.panel {
  background: var(--panel-bg);
  border: 1px solid rgba(42, 62, 88, 0.75);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.panel h2 {
  margin-top: 0;
  font-size: 1rem;
  color: #d8eaf8;
  letter-spacing: 0.02em;
}

.resource-grid {
  display: grid;
  gap: 0.5rem;
}

.resource-grid--header {
  display: flex;
  gap: 0.45rem;
  padding: 0.45rem 1rem 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 156, 194, 0.5) rgba(15, 22, 31, 0.5);
}

.resource-group {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: max-content;
  padding: 0.28rem 0.36rem;
  border: 1px solid rgba(54, 88, 130, 0.42);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(12, 22, 36, 0.92), rgba(8, 16, 26, 0.92));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.resource-group-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.resource-group-list {
  display: inline-flex;
  gap: 0.28rem;
}

.resource-grid--header .resource-row {
  width: 7.45rem;
  min-width: 7.45rem;
  max-width: 7.45rem;
  flex: 0 0 7.45rem;
  height: 2.05rem;
  min-height: 2.05rem;
  max-height: 2.05rem;
  padding: 0.2rem 0.28rem;
}

select {
  width: 100%;
  background: linear-gradient(180deg, rgba(18, 32, 50, 0.95), rgba(12, 22, 36, 0.95));
  color: var(--text);
  border: 1px solid rgba(71, 105, 145, 0.6);
  border-radius: 10px;
  padding: 0.48rem 0.6rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s;
}

select:hover,
select:focus {
  border-color: rgba(54, 199, 161, 0.55);
}

.resource-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(42, 62, 90, 0.55);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(10, 18, 30, 0.85), rgba(7, 14, 24, 0.85));
}

.resource-main {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.resource-icon {
  width: 1.02rem;
  height: 1.02rem;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  flex-shrink: 0;
}

.resource-icon--fallback {
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(158, 177, 197, 0.5);
  background: rgba(158, 177, 197, 0.15);
}

.resource-name {
  display: none;
}

.resource-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.08rem;
  width: 5.05rem;
  min-width: 5.05rem;
  height: 100%;
  min-height: 100%;
  font-variant-numeric: tabular-nums;
}

.resource-values strong {
  display: block;
  width: 100%;
  text-align: right;
  font-size: 0.7rem;
  line-height: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.resource-rate {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  width: 100%;
  font-size: 0.68rem;
  line-height: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.resource-rate-arrow {
  min-width: 0.6rem;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1;
}

.resource-rate.is-positive {
  color: #6be08a;
}

.resource-rate.is-negative {
  color: #ff7d7d;
}

.resource-rate.is-neutral {
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(180deg, rgba(22, 38, 58, 0.95), rgba(14, 26, 42, 0.95));
  color: var(--text);
  border: 1px solid rgba(64, 96, 136, 0.6);
  border-radius: 10px;
  padding: 0.48rem 0.7rem;
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

button:hover {
  border-color: rgba(54, 199, 161, 0.65);
  box-shadow: 0 0 10px rgba(54, 199, 161, 0.1);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.building-card,
.research-card {
  border: 1px solid rgba(42, 60, 84, 0.7);
  border-radius: 12px;
  padding: 0.6rem;
  margin-bottom: 0.45rem;
  background: var(--card-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.building-card:hover {
  border-color: rgba(54, 199, 161, 0.32);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(54, 199, 161, 0.1);
}

.building-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.55rem;
}

.building-list .building-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-height: 11.2rem;
}

.building-list .building-card button {
  margin-top: auto;
  width: 100%;
  background: linear-gradient(180deg, rgba(24, 54, 47, 0.92), rgba(16, 38, 34, 0.92));
  border: 1px solid rgba(54, 199, 161, 0.4);
  color: #7ff2cf;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.building-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: auto;
}

.building-actions button {
  flex: 1;
}

.btn-build-max {
  background: linear-gradient(180deg, rgba(18, 44, 66, 0.92), rgba(12, 30, 48, 0.92)) !important;
  border: 1px solid rgba(46, 168, 229, 0.45) !important;
  color: #9edfff !important;
}

.btn-build-max:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(24, 60, 88, 0.96), rgba(14, 40, 62, 0.96)) !important;
  border-color: rgba(46, 168, 229, 0.78) !important;
  box-shadow: 0 0 12px rgba(46, 168, 229, 0.2) !important;
}

.btn-demolish {
  background: linear-gradient(180deg, rgba(54, 22, 22, 0.92), rgba(38, 14, 14, 0.92)) !important;
  border: 1px solid rgba(255, 110, 110, 0.35) !important;
  color: #ffaaaa !important;
}

.btn-demolish:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(80, 28, 28, 0.96), rgba(56, 18, 18, 0.96)) !important;
  border-color: rgba(255, 110, 110, 0.75) !important;
  box-shadow: 0 0 12px rgba(255, 110, 110, 0.18) !important;
}

.building-list .building-card button:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(32, 72, 62, 0.96), rgba(20, 50, 44, 0.96));
  border-color: rgba(54, 199, 161, 0.8);
  box-shadow: 0 0 12px rgba(54, 199, 161, 0.2);
}

.building-list .building-card button:disabled {
  background: linear-gradient(180deg, rgba(16, 26, 36, 0.8), rgba(12, 20, 28, 0.8));
  border-color: rgba(42, 60, 84, 0.5);
  color: var(--muted);
}

.meta-line {
  color: var(--muted);
  font-size: 0.82rem;
}

.resource-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  vertical-align: middle;
}

.resource-inline-icon {
  width: 0.78rem;
  height: 0.78rem;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  flex-shrink: 0;
}

.resource-inline-icon--fallback {
  border: 1px solid rgba(158, 177, 197, 0.5);
  background: rgba(158, 177, 197, 0.16);
}

.resource-inline-name {
  color: #d6e6f6;
}

.resource-inline-amount {
  color: #b6cadf;
  font-variant-numeric: tabular-nums;
}

.resource-inline-sep {
  color: rgba(160, 184, 208, 0.7);
  margin: 0 0.12rem;
}

.progress {
  height: 10px;
  border: 1px solid rgba(42, 62, 88, 0.6);
  background: rgba(7, 12, 20, 0.7);
  border-radius: 99px;
  overflow: hidden;
  margin: 0.35rem 0 0.55rem;
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2ea8e5 0%, #36c7a1 100%);
  box-shadow: 0 0 8px rgba(54, 199, 161, 0.45);
  transition: width 0.25s linear;
}

.hidden {
  display: none;
}

.icon-btn-img {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  display: block;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: linear-gradient(160deg, #101c2e 0%, #16243a 100%);
  border: 1px solid rgba(54, 199, 161, 0.2);
  border-radius: 16px;
  width: min(1120px, 96vw);
  max-height: min(calc(100vh - 2rem), 92dvh);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(54, 199, 161, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#research-modal .modal-content,
#achievements-modal .modal-content {
  width: min(1240px, 97vw);
  max-height: calc(100vh - 1.25rem);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(42, 62, 88, 0.6);
  background: linear-gradient(90deg, rgba(54, 199, 161, 0.06), transparent 60%);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  flex: 1;
  background: linear-gradient(90deg, #d8f5ec, #a8dfd4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.modal-close-btn:hover {
  opacity: 1;
}

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-body--research {
  min-height: 28rem;
}

.tutorial-modal-content {
  width: min(760px, 96vw);
}

.tutorial-modal-body {
  display: grid;
  gap: 0.8rem;
}

.tutorial-step-counter {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tutorial-step-title {
  margin: 0;
  font-size: 1.2rem;
}

.tutorial-step-text {
  margin: 0;
  color: #d3e3f3;
}

.tutorial-step-points {
  margin: 0;
  padding-left: 1.2rem;
  color: #b8cde1;
  display: grid;
  gap: 0.35rem;
}

.tutorial-actions {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

button.secondary {
  background: linear-gradient(180deg, rgba(25, 35, 50, 0.95), rgba(17, 24, 36, 0.95));
  border-color: rgba(86, 113, 145, 0.6);
  color: #d3deea;
}

button.secondary:hover:not(:disabled) {
  border-color: rgba(130, 168, 210, 0.75);
  box-shadow: 0 0 10px rgba(122, 170, 220, 0.14);
}

.research-tree {
  position: relative;
  min-height: 18rem;
  border: 1px solid rgba(46, 168, 229, 0.2);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(7, 14, 24, 0.88), rgba(10, 18, 32, 0.88));
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.22);
  padding: 0.8rem;
  overflow: auto;
}

.research-tree-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.research-tree-edges line {
  stroke: rgba(130, 174, 220, 0.45);
  stroke-width: 2;
}

.research-tree-edges path {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.9;
}

.research-tree-edges path.is-locked {
  stroke: rgba(103, 126, 151, 0.45);
}

.research-tree-edges path.is-ready {
  stroke: rgba(176, 203, 230, 0.78);
}

.research-tree-edges path.is-active {
  stroke: rgba(106, 206, 255, 0.95);
  filter: drop-shadow(0 0 4px rgba(106, 206, 255, 0.45));
}

.research-tree-edges path.is-completed {
  stroke: rgba(127, 242, 207, 0.92);
  filter: drop-shadow(0 0 4px rgba(127, 242, 207, 0.35));
}

.research-tree-nodes {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 3;
  min-height: 100%;
  min-width: max-content;
}

.research-tree-row {
  display: flex;
  flex-direction: row;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
}

.research-node {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  padding: 0;
  border: 1px solid rgba(100, 146, 187, 0.35);
  background: rgba(13, 20, 29, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.research-node img {
  width: 1.45rem;
  height: 1.45rem;
  object-fit: contain;
}

.research-node:hover {
  transform: translateY(-1px);
}

.research-node.is-completed {
  border-color: rgba(127, 242, 207, 0.8);
  box-shadow: 0 0 0 1px rgba(127, 242, 207, 0.34), 0 0 16px rgba(54, 199, 161, 0.2);
}

.research-node.is-active {
  border-color: rgba(127, 205, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(127, 205, 255, 0.35), 0 0 18px rgba(46, 168, 229, 0.25);
}

.research-node.is-available {
  border-color: rgba(255, 219, 145, 0.7);
}

.research-node.is-locked {
  opacity: 0.45;
  filter: grayscale(0.35);
  border-color: rgba(110, 128, 148, 0.5);
}

.research-node[aria-disabled="true"] {
  cursor: default;
}

.research-node-tooltip {
  position: fixed;
  z-index: 120;
  max-width: 320px;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(46, 168, 229, 0.4);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(10, 20, 34, 0.99), rgba(14, 26, 44, 0.99));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(46, 168, 229, 0.1);
  color: var(--text);
  pointer-events: none;
}

.research-node-tooltip strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #dff4ff;
}

.research-node-tooltip div {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.2rem;
}

.research-card.research-card--active {
  border-color: rgba(127, 242, 207, 0.6);
  box-shadow: 0 0 0 1px rgba(127, 242, 207, 0.24), 0 0 20px rgba(54, 199, 161, 0.15);
  background: linear-gradient(160deg, rgba(12, 34, 30, 0.92), rgba(8, 26, 26, 0.88));
  animation: activeResearchPulse 2.2s ease-in-out infinite;
}

.research-card.research-card--active h3::after {
  content: "  • aktiv";
  color: #7ff2cf;
  font-size: 0.8rem;
  font-weight: 500;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem;
  background: var(--card-bg);
  border: 1px solid rgba(255, 200, 60, 0.18);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.achievement-card.unlocked {
  border-color: rgba(255, 200, 60, 0.42);
  box-shadow: 0 0 14px rgba(255, 190, 40, 0.14), 0 4px 18px rgba(0, 0, 0, 0.22);
}

.achievement-card:hover {
  border-color: rgba(255, 200, 60, 0.7);
  box-shadow: 0 0 20px rgba(255, 190, 40, 0.22), 0 6px 22px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.achievement-card.locked {
  opacity: 0.45;
  filter: saturate(0.4);
  border-color: rgba(42, 60, 84, 0.55);
  box-shadow: none;
}

.achievement-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.achievement-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffe8a0;
  margin: 0;
  line-height: 1.2;
}

.achievement-card.locked .achievement-name {
  color: var(--muted);
}

button:active,
.icon-btn:active,
.scene-view-btn:active {
  transform: scale(0.98);
}

@media (max-width: 960px) {
  .topbar-main {
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 0.75rem;
  }

  .topbar-center {
    align-items: stretch;
  }

  .progress-header,
  .dyson-charge-bar-wrap {
    width: 100%;
    max-width: none;
  }

  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 700px) {
  .topbar-main {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .header-menu-wrap {
    justify-content: flex-end;
  }

  .scene-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .scene-view-switch {
    justify-content: space-between;
  }

  .scene-canvas {
    min-height: clamp(15rem, 45vh, 20rem);
  }

  .scene-view-btn {
    flex: 1;
  }

  .scene-body-node {
    transform: translate(-50%, -50%) scale(0.9);
  }

  .scene-body-node--belt {
    transform: translate(-50%, -50%) scale(0.82);
  }

  .scene-body-label {
    font-size: 0.72rem;
    bottom: -1.25rem;
  }

  .scene-structure {
    width: 1.45rem;
    height: 1.45rem;
  }

  .scene-empty-state {
    width: calc(100% - 2rem);
    text-align: center;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .management-location-controls {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .location-meta-pills {
    justify-content: flex-start;
  }

  .resource-grid--header {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    gap: 0.32rem;
  }

  .resource-group {
    gap: 0.18rem;
    padding: 0.2rem 0.26rem;
  }

  .resource-group-title {
    font-size: 0.54rem;
  }

  .resource-group-list {
    gap: 0.22rem;
  }

  .resource-grid--header .resource-row {
    width: 6.55rem;
    min-width: 6.55rem;
    max-width: 6.55rem;
    flex: 0 0 6.55rem;
    height: 1.78rem;
    min-height: 1.78rem;
    max-height: 1.78rem;
    padding: 0.16rem 0.22rem;
  }

  .resource-icon {
    width: 0.9rem;
    height: 0.9rem;
  }

  .resource-values {
    width: 4.45rem;
    min-width: 4.45rem;
    gap: 0.06rem;
  }

  .resource-values strong {
    font-size: 0.68rem;
    line-height: 0.8rem;
  }

  .resource-rate {
    font-size: 0.66rem;
    line-height: 0.72rem;
  }

  .resource-rate-arrow {
    min-width: 0.5rem;
    font-size: 0.62rem;
  }

  .dyson-charge-label {
    font-size: 0.72rem;
  }

  .dyson-charge-rate {
    font-size: 0.76rem;
  }

  .scene-view-btn {
    min-height: 2.6rem;
  }

  .header-menu button,
  .building-actions button,
  .tutorial-actions button {
    min-height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* CreationalClicker specific layout tweaks */
.clicker-layout {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.clicker-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.building-card {
  display: grid;
  gap: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 11, 20, 0.35);
  border-radius: 0.8rem;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}

.resource-item {
  min-width: 150px;
}

.run-panel {
  grid-column: 1 / -1;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.run-panel.meta-phase #panel-run-title,
.run-panel.meta-phase .run-stats-grid,
.run-panel.meta-phase #run-summary {
  display: none;
}

.run-panel.run-phase {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
}

.run-arena {
  position: relative;
  width: 100%;
  min-height: clamp(18rem, 56vh, 34rem);
  margin-bottom: 0.7rem;
  border: 1px solid rgba(76, 120, 164, 0.44);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(54, 199, 161, 0.14), transparent 34%),
    radial-gradient(circle at 75% 68%, rgba(46, 168, 229, 0.16), transparent 38%),
    linear-gradient(160deg, rgba(8, 14, 22, 0.98), rgba(11, 20, 32, 0.96));
  cursor: crosshair;
}

.run-panel.run-phase .run-arena {
  min-height: 0;
  height: 100%;
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
}

.run-panel.run-phase .run-stats-grid,
.run-panel.run-phase #run-summary {
  display: none;
}

.run-particle-layer {
  position: absolute;
  inset: 0;
}

.run-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f7fbff 0%, #8de4ff 38%, rgba(87, 201, 255, 0.25) 100%);
  box-shadow: 0 0 9px rgba(87, 201, 255, 0.4);
  pointer-events: none;
}

.run-cursor {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(145, 233, 210, 0.82);
  background: radial-gradient(circle, rgba(84, 231, 194, 0.14) 0%, rgba(84, 231, 194, 0.03) 62%, rgba(84, 231, 194, 0) 100%);
  box-shadow: 0 0 16px rgba(84, 231, 194, 0.2);
  pointer-events: none;
}

.run-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 0.7rem;
}

.run-resource-breakdown {
  grid-column: 1 / -1;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(110, 156, 196, 0.16);
}

.run-summary {
  margin-top: 0.65rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(94, 158, 122, 0.42);
  background: linear-gradient(160deg, rgba(13, 34, 24, 0.65), rgba(11, 27, 20, 0.62));
}

.run-results-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 8, 14, 0.62);
  backdrop-filter: blur(4px);
}

.run-results-modal.hidden {
  display: none;
  pointer-events: none;
}

.run-results-modal-card {
  width: min(34rem, calc(100vw - 2rem));
  border-radius: 14px;
  border: 1px solid rgba(74, 131, 174, 0.6);
  background: linear-gradient(160deg, rgba(10, 19, 31, 0.98), rgba(12, 24, 40, 0.98));
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
  padding: 1rem;
}

.run-results-modal-card h2 {
  margin: 0 0 0.45rem;
  color: #dff2ff;
}

.run-results-actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.55rem;
  justify-content: center;
}

.run-results-icon-btn {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 999px;
  border: 1px solid rgba(112, 164, 209, 0.55);
  background: linear-gradient(170deg, rgba(16, 31, 49, 0.95), rgba(11, 21, 36, 0.95));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.run-results-icon-btn:hover,
.run-results-icon-btn:focus-visible {
  border-color: rgba(151, 209, 255, 0.82);
  transform: translateY(-1px);
}

.run-results-icon-btn img {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}

.run-summary-title {
  margin: 0 0 0.35rem;
  color: #9ff1cc;
  font-weight: 700;
}

#run-summary-body {
  white-space: pre-line;
}

#run-start-next-btn {
  margin-top: 0.35rem;
  background: linear-gradient(180deg, rgba(24, 54, 47, 0.92), rgba(16, 38, 34, 0.92));
  border: 1px solid rgba(54, 199, 161, 0.55);
  color: #7ff2cf;
  font-weight: 600;
}

.meta-upgrade-block {
  margin-top: 0.9rem;
}

.meta-upgrade-list {
  position: relative;
  min-height: 11rem;
  border: 1px solid rgba(64, 104, 138, 0.52);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(46, 168, 229, 0.12), transparent 30%),
    radial-gradient(circle at 74% 72%, rgba(54, 199, 161, 0.12), transparent 36%),
    linear-gradient(165deg, rgba(8, 16, 28, 0.96), rgba(10, 20, 34, 0.96));
  padding: 0;
  touch-action: none;
  cursor: grab;
}

.meta-upgrade-list.is-panning {
  cursor: grabbing;
}

.run-panel.meta-phase .meta-upgrade-block {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  z-index: 1;
}

body.run-phase-active .layout {
  padding: 0;
}

.run-panel.meta-phase .meta-upgrade-list {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.meta-upgrade-list::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(130, 169, 201, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(130, 169, 201, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.meta-upgrade-edges {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.meta-upgrade-edge {
  fill: none;
  stroke: rgba(89, 138, 181, 0.5);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.meta-upgrade-edge.is-unlocked {
  stroke: rgba(90, 215, 188, 0.75);
  stroke-dasharray: 7 7;
  animation: metaEdgeFlow 1.8s linear infinite;
}

.meta-upgrade-nodes {
  position: relative;
  isolation: isolate;
  z-index: 1;
  transform-origin: 0 0;
  will-change: transform;
}

.meta-upgrade-node {
  position: absolute;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  border: 1px solid rgba(77, 126, 165, 0.64);
  background: linear-gradient(160deg, rgba(13, 25, 41, 0.94), rgba(11, 21, 35, 0.94));
  box-shadow: inset 0 0 0 1px rgba(170, 211, 245, 0.08), 0 10px 20px rgba(0, 0, 0, 0.28);
  color: #def5ff;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  z-index: 2;
  pointer-events: auto;
}

.meta-upgrade-node:hover,
.meta-upgrade-node:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(111, 174, 224, 0.86);
  box-shadow: inset 0 0 0 1px rgba(173, 224, 255, 0.12), 0 12px 24px rgba(0, 0, 0, 0.34);
}

.meta-upgrade-node.is-available {
  border-color: rgba(81, 208, 178, 0.72);
  box-shadow: inset 0 0 0 1px rgba(154, 255, 230, 0.12), 0 12px 26px rgba(31, 111, 88, 0.35);
  animation: metaNodePulse 2.2s ease-in-out infinite;
}

.meta-upgrade-node.is-locked {
  border-color: rgba(100, 108, 120, 0.55);
  filter: saturate(0.35);
  opacity: 0.78;
}

.meta-upgrade-node.is-maxed {
  border-color: rgba(240, 191, 101, 0.8);
  box-shadow: inset 0 0 0 1px rgba(245, 218, 164, 0.18), 0 12px 24px rgba(126, 91, 28, 0.32);
}

.meta-upgrade-node.is-requirement-missing {
  border-color: rgba(232, 88, 88, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 174, 174, 0.24), 0 0 0 2px rgba(231, 67, 67, 0.25), 0 12px 26px rgba(129, 34, 34, 0.38);
  animation: metaRequirementFlash 0.56s ease-out;
}

@keyframes metaRequirementFlash {
  0% {
    transform: scale(1);
    filter: saturate(1);
  }
  35% {
    transform: scale(1.05);
    filter: saturate(1.35);
  }
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

.meta-upgrade-node-icon {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
  pointer-events: none;
}

.meta-upgrade-node-level {
  position: absolute;
  right: 0.28rem;
  bottom: 0.2rem;
  font-size: 0.66rem;
  color: #b9d7ec;
  pointer-events: none;
}

.meta-upgrade-tooltip {
  position: fixed;
  z-index: 120;
  max-width: 320px;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(46, 168, 229, 0.45);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(10, 20, 34, 0.99), rgba(14, 26, 44, 0.99));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(46, 168, 229, 0.1);
  color: var(--text);
  pointer-events: none;
}

.meta-upgrade-tooltip strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #dff4ff;
}

.meta-upgrade-tooltip div {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.2rem;
}

@keyframes metaEdgeFlow {
  to {
    stroke-dashoffset: -28;
  }
}

@keyframes metaNodePulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px rgba(154, 255, 230, 0.12), 0 12px 26px rgba(31, 111, 88, 0.35);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(174, 255, 235, 0.18), 0 16px 30px rgba(35, 132, 103, 0.42);
  }
}

@media (max-width: 768px) {
  .meta-upgrade-list {
    min-height: 0;
  }

  .meta-upgrade-node {
    width: 58px;
    height: 58px;
    border-radius: 12px;
  }

  .meta-upgrade-node-icon {
    width: 1.45rem;
    height: 1.45rem;
  }
}
