:root {
  color-scheme: dark;
  --bg-0: #060816;
  --bg-1: #0c1430;
  --bg-2: #141c47;
  --text: #edf2ff;
  --muted: #9aa8d6;
  --line: rgba(158, 181, 255, 0.18);
  --panel: rgba(9, 16, 38, 0.7);
  --panel-strong: rgba(13, 22, 52, 0.88);
  --cyan: #4ce6ff;
  --pink: #ff62b0;
  --gold: #ffd36b;
  --lime: #9bf94d;
  --violet: #9c7bff;
  --red: #ff5a7f;
  --shadow: 0 24px 80px rgba(4, 8, 20, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(76, 230, 255, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 98, 176, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 45%, #090d1f);
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

#starfield,
.noise {
  inset: 0;
  pointer-events: none;
  position: fixed;
}

#starfield {
  z-index: 0;
}

.noise {
  z-index: 1;
  opacity: 0.07;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 5px 5px, 5px 5px;
  mix-blend-mode: soft-light;
}

.game-shell {
  position: relative;
  z-index: 2;
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar,
.status-strip,
.main-grid,
.bottom-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
}

.brand h1,
.section-heading h2,
.reactor-header h2,
.progress-copy h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.96;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.ghost-button,
.feature-button,
.prestige-button,
.buy-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.ghost-button,
.feature-button,
.prestige-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
}

.ghost-button:hover,
.feature-button:hover,
.prestige-button:hover,
.buy-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.ghost-button.danger:hover {
  border-color: rgba(255, 90, 127, 0.6);
  background: rgba(255, 90, 127, 0.12);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.status-pill,
.subpanel,
.reactor-zone,
.systems-zone {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.status-pill {
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.status-pill::after {
  content: "";
  position: absolute;
  inset: auto -12% -30% auto;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  opacity: 0.22;
  filter: blur(18px);
}

.status-pill strong {
  font-size: clamp(1.05rem, 2vw, 1.5rem);
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.accent-cyan::after {
  background: var(--cyan);
}

.accent-pink::after {
  background: var(--pink);
}

.accent-gold::after {
  background: var(--gold);
}

.accent-lime::after {
  background: var(--lime);
}

.accent-violet::after {
  background: var(--violet);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(500px, 1.15fr);
  gap: 18px;
  margin-top: 18px;
}

.reactor-zone,
.systems-zone,
.subpanel {
  border-radius: 24px;
}

.reactor-zone {
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 20px;
}

.reactor-header,
.progress-block,
.section-heading,
.module-heading,
.module-meta,
.systems-columns,
.bottom-grid {
  display: flex;
}

.reactor-header {
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.feature-button {
  display: inline-flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  min-width: 130px;
  background:
    linear-gradient(135deg, rgba(76, 230, 255, 0.14), rgba(156, 123, 255, 0.08)),
    rgba(255, 255, 255, 0.04);
}

.feature-button strong {
  font-size: 0.86rem;
}

.reactor-stage {
  position: relative;
  min-height: 520px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at center, rgba(76, 230, 255, 0.18), transparent 24%),
    radial-gradient(circle at center, rgba(156, 123, 255, 0.16), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  overflow: hidden;
  display: grid;
  place-items: center;
}

.reactor-stage::before {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.reactor-stage::after {
  content: "";
  position: absolute;
  inset: 20%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.reactor-button {
  position: relative;
  width: min(320px, 60vw);
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.reactor-button:focus-visible {
  outline: 2px solid rgba(76, 230, 255, 0.6);
  outline-offset: 10px;
}

.reactor-rings,
.reactor-core {
  position: absolute;
  border-radius: 50%;
}

.reactor-rings {
  inset: 0;
  background:
    radial-gradient(circle, transparent 44%, rgba(255, 255, 255, 0.24) 44.5%, transparent 46%),
    radial-gradient(circle, transparent 57%, rgba(255, 98, 176, 0.26) 57.5%, transparent 59%),
    radial-gradient(circle, transparent 69%, rgba(76, 230, 255, 0.28) 69.5%, transparent 71%);
  filter: drop-shadow(0 0 30px rgba(76, 230, 255, 0.32));
  animation: spin 16s linear infinite;
}

.reactor-core {
  inset: 23%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(76, 230, 255, 0.95) 18%, rgba(124, 116, 255, 0.86) 55%, rgba(255, 98, 176, 0.86) 100%);
  box-shadow:
    0 0 40px rgba(76, 230, 255, 0.45),
    0 0 90px rgba(156, 123, 255, 0.24),
    inset 0 0 40px rgba(255, 255, 255, 0.55);
  animation: pulse 3.2s ease-in-out infinite;
}

.reactor-label {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.reactor-label strong {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.reactor-label small {
  display: inline-flex;
  min-width: 52px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reactor-stats {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-panel {
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(8, 14, 34, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mini-panel span {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini-panel strong {
  margin-top: 6px;
  font-size: 1rem;
}

.anomaly-layer {
  position: absolute;
  inset: 0;
}

.anomaly {
  position: absolute;
  width: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.92), rgba(255, 211, 107, 0.95) 24%, rgba(255, 98, 176, 0.7) 58%, rgba(76, 230, 255, 0.2) 100%);
  box-shadow:
    0 0 25px rgba(255, 211, 107, 0.5),
    inset 0 0 16px rgba(255, 255, 255, 0.55);
  cursor: pointer;
  animation:
    bob 2.6s ease-in-out infinite,
    blink 1.8s ease-in-out infinite;
}

.anomaly::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 211, 107, 0.26);
}

.anomaly:hover {
  transform: scale(1.06);
}

.floating-text {
  position: absolute;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.5);
  animation: floatUp 1s ease-out forwards;
  pointer-events: none;
}

.progress-block {
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 14, 34, 0.7);
}

.progress-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.progress-meter {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan));
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(255, 211, 107, 0.35);
}

.prestige-button {
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(255, 98, 176, 0.14), rgba(255, 211, 107, 0.12)),
    rgba(255, 255, 255, 0.04);
}

.prestige-button:disabled,
.buy-button:disabled,
.feature-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.systems-zone {
  padding: 22px;
}

.systems-columns {
  align-items: start;
  gap: 16px;
}

.panel-column {
  flex: 1;
  min-width: 0;
}

.section-heading {
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-list,
.achievement-grid,
.event-log {
  display: grid;
  gap: 12px;
}

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

.module-card,
.upgrade-card,
.achievement-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: var(--panel);
  border-radius: 18px;
}

.module-card,
.upgrade-card {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.module-card.affordable,
.upgrade-card.affordable {
  border-color: rgba(76, 230, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(76, 230, 255, 0.12);
}

.module-card::before,
.upgrade-card::before {
  content: "";
  position: absolute;
  inset: auto auto -20px -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  filter: blur(22px);
  opacity: 0.24;
}

.module-card::before {
  background: var(--cyan);
}

.upgrade-card::before {
  background: var(--violet);
}

.module-heading {
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.module-name,
.upgrade-name,
.achievement-name {
  margin: 0;
}

.module-count,
.upgrade-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.module-description,
.upgrade-description,
.achievement-description {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.module-meta {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: #d6ddff;
  font-size: 0.88rem;
}

.buy-button {
  min-width: 112px;
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
  font-weight: 700;
}

.bottom-grid {
  gap: 18px;
  margin-top: 18px;
}

.subpanel {
  flex: 1;
  padding: 22px;
  min-width: 0;
}

.achievement-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.achievement-card {
  min-height: 108px;
  padding: 16px;
  background: rgba(8, 14, 34, 0.72);
}

.achievement-card.unlocked {
  border-color: rgba(155, 249, 77, 0.32);
  background:
    linear-gradient(135deg, rgba(155, 249, 77, 0.08), rgba(255, 211, 107, 0.05)),
    rgba(8, 14, 34, 0.72);
}

.achievement-glow {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(155, 249, 77, 0.25);
  filter: blur(28px);
  opacity: 0;
}

.achievement-card.unlocked .achievement-glow {
  opacity: 1;
}

.event-log {
  max-height: 360px;
  overflow: auto;
  padding-right: 6px;
}

.event-log-entry {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.event-log-entry strong {
  display: block;
  margin-bottom: 6px;
}

.event-log-entry span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.event-log-entry em {
  display: inline-flex;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-style: normal;
  font-size: 0.74rem;
}

.reactor-button.pressed {
  transform: scale(0.985);
}

.reactor-stage.overdrive-active .reactor-core {
  box-shadow:
    0 0 60px rgba(255, 211, 107, 0.62),
    0 0 120px rgba(255, 98, 176, 0.3),
    inset 0 0 40px rgba(255, 255, 255, 0.6);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes blink {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-48px) scale(1.04);
  }
}

@media (max-width: 1180px) {
  .status-strip,
  .achievement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-grid,
  .bottom-grid,
  .systems-columns {
    display: grid;
  }

  .main-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .systems-columns {
    gap: 18px;
  }
}

@media (max-width: 780px) {
  .game-shell {
    width: min(100vw - 18px, 1440px);
    padding-top: 18px;
  }

  .topbar,
  .reactor-header,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .ghost-button,
  .feature-button,
  .prestige-button {
    width: 100%;
  }

  .status-strip,
  .achievement-grid,
  .reactor-stats {
    grid-template-columns: 1fr;
  }

  .module-card,
  .upgrade-card {
    grid-template-columns: 1fr;
  }

  .buy-button {
    width: 100%;
  }

  .reactor-stage {
    min-height: 460px;
  }

  .reactor-button {
    width: min(280px, 72vw);
  }

  .reactor-stats {
    position: static;
    width: 100%;
  }

  .reactor-stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px 16px;
  }

  .topbar-actions > * {
    flex: 1;
  }
}
