:root {
  --bg: #070816;
  --bg-soft: #101127;
  --panel: rgba(14, 18, 45, 0.72);
  --panel-strong: rgba(21, 25, 62, 0.88);
  --line: rgba(255, 255, 255, 0.14);
  --line-bright: rgba(134, 240, 255, 0.42);
  --text: #f6f7ff;
  --muted: #aab3d9;
  --muted-2: #737ba3;
  --cyan: #75f7ff;
  --blue: #7aa7ff;
  --pink: #ff74d4;
  --violet: #9d7bff;
  --gold: #ffd36e;
  --green: #85ffb5;
  --danger: #ff6c87;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(117, 247, 255, 0.18), transparent 34rem),
    radial-gradient(circle at 80% 10%, rgba(255, 116, 212, 0.16), transparent 35rem),
    radial-gradient(circle at 50% 100%, rgba(157, 123, 255, 0.16), transparent 32rem),
    var(--bg);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(117, 247, 255, 0.78);
  outline-offset: 3px;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
}

.aurora {
  position: fixed;
  z-index: -2;
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  animation: drift 16s ease-in-out infinite alternate;
}

.aurora-one {
  left: -12rem;
  top: 18rem;
  background: var(--cyan);
}

.aurora-two {
  right: -14rem;
  top: 4rem;
  background: var(--pink);
  animation-delay: -7s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(0.92);
  }
  to {
    transform: translate3d(4rem, -3rem, 0) scale(1.12);
  }
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: 24px;
  font-size: 2.2rem;
  color: #0b1024;
  background:
    radial-gradient(circle at 30% 20%, #fff8c8, transparent 34%),
    linear-gradient(135deg, var(--cyan), var(--pink));
  box-shadow: 0 0 40px rgba(117, 247, 255, 0.4), inset 0 0 18px rgba(255, 255, 255, 0.55);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(2.1rem, 6vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.06rem;
}

.tagline,
.muted {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.top-actions,
.buy-mode,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  cursor: pointer;
}

.ghost-button,
.danger-button,
.mode-button,
.tab-button,
.primary-button,
.buy-button,
.upgrade-button {
  border-radius: 999px;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), opacity var(--transition), box-shadow var(--transition);
}

.ghost-button,
.danger-button,
.mode-button,
.tab-button {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.ghost-button:hover,
.mode-button:hover,
.tab-button:hover {
  transform: translateY(-2px);
  border-color: var(--line-bright);
  background: rgba(117, 247, 255, 0.11);
}

.danger-button {
  border-color: rgba(255, 108, 135, 0.42);
  color: #ffdfe7;
}

.danger-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 108, 135, 0.14);
}

.resource-grid {
  display: grid;
  grid-template-columns: 1.55fr repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.resource-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

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

.resource-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.primary-resource {
  border-color: rgba(117, 247, 255, 0.36);
  background:
    radial-gradient(circle at top right, rgba(117, 247, 255, 0.18), transparent 58%),
    rgba(255, 255, 255, 0.07);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(520px, 1.45fr);
  gap: 18px;
  align-items: start;
}

.left-column,
.right-column {
  display: grid;
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 32%, rgba(117, 247, 255, 0.08));
  mask: linear-gradient(#000, transparent 58%);
}

.panel-heading {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 8px 12px;
  border: 1px solid rgba(117, 247, 255, 0.34);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(117, 247, 255, 0.08);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-hot {
  border-color: rgba(255, 211, 110, 0.42);
  color: var(--gold);
  background: rgba(255, 211, 110, 0.1);
}

.core-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  isolation: isolate;
}

.core-button {
  position: relative;
  display: grid;
  place-items: center;
  width: min(70vw, 280px);
  height: min(70vw, 280px);
  border-radius: 999px;
  background: transparent;
  transform: translateZ(0);
  transition: transform 120ms ease, filter 120ms ease;
}

.core-button:hover {
  filter: saturate(1.18) brightness(1.08);
}

.core-button:active,
.core-button.pressed {
  transform: scale(0.96);
}

.core-ring,
.core-glow,
.core-text {
  position: absolute;
  border-radius: 999px;
}

.core-ring-one {
  inset: 0;
  border: 2px solid rgba(117, 247, 255, 0.35);
  box-shadow: 0 0 24px rgba(117, 247, 255, 0.35), inset 0 0 38px rgba(117, 247, 255, 0.18);
  animation: spin 12s linear infinite;
}

.core-ring-two {
  inset: 24px;
  border: 2px dashed rgba(255, 116, 212, 0.44);
  animation: spin 16s linear infinite reverse;
}

.core-ring-three {
  inset: 48px;
  border: 1px solid rgba(255, 211, 110, 0.5);
  box-shadow: inset 0 0 28px rgba(255, 211, 110, 0.16);
  animation: breathe 2.2s ease-in-out infinite;
}

.core-glow {
  inset: 70px;
  background:
    radial-gradient(circle at 35% 30%, #fff9ca, transparent 18%),
    radial-gradient(circle at 45% 45%, var(--cyan), transparent 35%),
    radial-gradient(circle at 55% 60%, var(--pink), transparent 56%),
    radial-gradient(circle, var(--violet), #25275b 70%);
  box-shadow:
    0 0 42px rgba(117, 247, 255, 0.78),
    0 0 88px rgba(255, 116, 212, 0.42),
    inset 0 0 30px rgba(255, 255, 255, 0.46);
  animation: pulse 1.9s ease-in-out infinite;
}

.core-text {
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 3;
  color: white;
  font-size: 1.35rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(7, 8, 22, 0.9), 0 0 24px white;
}

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

@keyframes breathe {
  50% {
    transform: scale(1.05);
    opacity: 0.72;
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.035);
    box-shadow:
      0 0 55px rgba(117, 247, 255, 0.86),
      0 0 112px rgba(255, 116, 212, 0.5),
      inset 0 0 38px rgba(255, 255, 255, 0.55);
  }
}

.floater-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.floater {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 50%;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #061021;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  box-shadow: 0 10px 30px rgba(117, 247, 255, 0.32);
  font-weight: 1000;
  transform: translate(-50%, -50%);
  animation: floatUp 900ms ease-out forwards;
  white-space: nowrap;
}

.floater.critical {
  background: linear-gradient(135deg, var(--gold), var(--pink));
  transform: translate(-50%, -50%) scale(1.18);
}

@keyframes floatUp {
  to {
    opacity: 0;
    transform: translate(var(--x), -170px) scale(0.82);
  }
}

.stat-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-stack div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.055);
}

.stat-stack span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-stack strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.progress-bar {
  height: 12px;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.progress-bar span,
.card-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--gold));
  box-shadow: 0 0 18px rgba(117, 247, 255, 0.4);
  transition: width 240ms ease;
}

.primary-button,
.buy-button,
.upgrade-button {
  width: 100%;
  padding: 13px 16px;
  color: #071024;
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  box-shadow: 0 14px 38px rgba(117, 247, 255, 0.18);
  font-weight: 1000;
}

.primary-button:hover,
.buy-button:hover,
.upgrade-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(255, 116, 212, 0.25);
}

.primary-button:disabled,
.buy-button:disabled,
.upgrade-button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.event-log {
  display: grid;
  gap: 9px;
  min-height: 144px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log li {
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  line-height: 1.4;
}

.shop-panel {
  min-height: 700px;
}

.shop-heading {
  align-items: center;
}

.mode-button.active,
.tab-button.active {
  border-color: rgba(117, 247, 255, 0.64);
  color: var(--cyan);
  background: rgba(117, 247, 255, 0.14);
  box-shadow: 0 0 24px rgba(117, 247, 255, 0.12);
}

.tabs {
  position: relative;
  margin-bottom: 18px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.tab-button {
  flex: 1 1 140px;
}

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

.shop-list,
.upgrade-grid,
.achievement-grid {
  display: grid;
  gap: 12px;
}

.shop-card,
.upgrade-card,
.achievement-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(117, 247, 255, 0.08), transparent 46%),
    rgba(255, 255, 255, 0.055);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.shop-card:hover,
.upgrade-card:hover,
.achievement-card:hover {
  transform: translateY(-2px);
  border-color: rgba(117, 247, 255, 0.34);
}

.shop-card.locked,
.upgrade-card.locked {
  filter: saturate(0.65);
}

.shop-card.purchasable,
.upgrade-card.purchasable {
  border-color: rgba(133, 255, 181, 0.36);
  background:
    radial-gradient(circle at top right, rgba(133, 255, 181, 0.1), transparent 48%),
    rgba(255, 255, 255, 0.065);
}

.shop-card-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

.shop-icon,
.upgrade-icon,
.achievement-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 1.4rem;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.05);
}

.card-description {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.46;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.card-stats div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
}

.card-stats span,
.upgrade-meta span,
.achievement-card span {
  display: block;
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-stats strong,
.upgrade-meta strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-progress {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

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

.upgrade-card.installed {
  border-color: rgba(255, 211, 110, 0.45);
  background:
    radial-gradient(circle at top right, rgba(255, 211, 110, 0.16), transparent 48%),
    rgba(255, 255, 255, 0.065);
}

.upgrade-top,
.achievement-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.upgrade-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.upgrade-meta div {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
}

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

.achievement-card {
  min-height: 150px;
}

.achievement-card.earned {
  border-color: rgba(255, 211, 110, 0.5);
  background:
    radial-gradient(circle at top right, rgba(255, 211, 110, 0.16), transparent 48%),
    rgba(255, 255, 255, 0.065);
}

.achievement-card.locked-achievement {
  opacity: 0.72;
}

.achievement-icon {
  color: var(--gold);
}

.achievement-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px);
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82em;
  font-weight: 800;
  text-align: center;
}

.shimmer {
  animation: shimmer 700ms ease;
}

@keyframes shimmer {
  0% {
    box-shadow: 0 0 0 rgba(117, 247, 255, 0);
  }
  42% {
    box-shadow: 0 0 40px rgba(117, 247, 255, 0.34);
  }
  100% {
    box-shadow: 0 0 0 rgba(117, 247, 255, 0);
  }
}

@media (max-width: 1120px) {
  .resource-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .primary-resource {
    grid-column: 1 / -1;
  }

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

  .shop-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  .hero,
  .brand-block,
  .panel-heading,
  .shop-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    gap: 14px;
  }

  .top-actions,
  .buy-mode {
    width: 100%;
  }

  .top-actions button,
  .buy-mode button {
    flex: 1 1 auto;
  }

  .resource-grid,
  .stat-stack,
  .card-stats,
  .upgrade-grid,
  .achievement-grid {
    grid-template-columns: 1fr;
  }

  .core-stage {
    min-height: 280px;
  }

  .core-button {
    width: 250px;
    height: 250px;
  }

  .footer-note {
    flex-direction: column;
  }
}

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