/* SpaceOrbitals Idle — sunset/magenta space theme */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-1: #2e0a1e;
  --bg-2: #1e0a2e;
  --bg-3: #0a0a1e;
  --fg: #ffe0e0;
  --fg-dim: #aa8888;
  --fg-mute: #776666;
  --orange: #ff8800;
  --magenta: #ff00ff;
  --cyan: #00d4ff;
  --gold: #ffd54a;
  --green: #58e08a;
  --red: #ff5577;
  --panel-bg: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 136, 0, 0.25);
  --panel-border-hot: rgba(255, 0, 255, 0.45);
  --gradient: linear-gradient(90deg, #ff8800, #ff00ff);
  --gradient-bg: linear-gradient(135deg, #2e0a1e 0%, #1e0a2e 50%, #0a0a1e 100%);
  --shadow-glow: 0 0 24px rgba(255, 136, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --pad: 1rem;
}

html, body {
  height: 100%;
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------- Landing overlay ---------- */
.landing {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
  background: radial-gradient(ellipse at top, rgba(255, 136, 0, 0.15), transparent 60%),
              radial-gradient(ellipse at bottom, rgba(255, 0, 255, 0.15), transparent 60%),
              var(--gradient-bg);
  overflow: auto;
}
.landing-inner {
  max-width: 520px;
  width: 100%;
  text-align: center;
}
.landing-badge {
  display: inline-block;
  background: var(--gradient);
  color: #000;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}
.landing-title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1.05;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.landing-sub {
  color: var(--fg-dim);
  font-size: 1.05rem;
  line-height: 1.4;
  margin-bottom: 1.75rem;
}
.landing-meta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.25rem 0;
  color: var(--fg-dim);
  font-size: 0.9rem;
}
.landing-meta strong {
  color: var(--orange);
  font-weight: 700;
  display: block;
  font-size: 1.5rem;
  margin-bottom: 0.1rem;
}
.landing-save {
  color: var(--fg-mute);
  font-size: 0.82rem;
  margin-top: 1.25rem;
}
.landing-cross {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
}
.landing-cross a { color: var(--orange); text-decoration: none; border-bottom: 1px dotted var(--orange); }
.landing-cross a:hover { color: var(--magenta); border-bottom-color: var(--magenta); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--fg);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s, border-color 0.15s, box-shadow 0.2s;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover:not(:disabled) {
  background: rgba(255, 136, 0, 0.12);
  border-color: rgba(255, 136, 0, 0.5);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--gradient);
  color: #000;
  border: none;
  font-size: 1.15rem;
  padding: 0.85rem 2.2rem;
  box-shadow: var(--shadow-glow);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 32px rgba(255, 136, 0, 0.55); }
.btn-lg { font-size: 1.2rem; padding: 0.9rem 2.4rem; }
.btn-secondary {
  background: linear-gradient(90deg, rgba(255, 136, 0, 0.25), rgba(255, 0, 255, 0.25));
  border-color: var(--panel-border-hot);
  color: var(--fg);
}
.btn-secondary:hover:not(:disabled) { background: linear-gradient(90deg, rgba(255, 136, 0, 0.4), rgba(255, 0, 255, 0.4)); }
.btn-ghost { background: rgba(255, 255, 255, 0.03); padding: 0.5rem 0.8rem; font-size: 0.85rem; }
.btn-danger { color: var(--red); border-color: rgba(255, 85, 119, 0.3); }
.btn-danger:hover { background: rgba(255, 85, 119, 0.1); border-color: rgba(255, 85, 119, 0.6); }

/* ---------- HUD ---------- */
.hud {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(10, 5, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.hud-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: center;
}
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat-label {
  font-size: 0.7rem;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-stardust .stat-value { color: var(--gold); }
.stat-multi .stat-value { color: var(--cyan); }
.hud-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Game layout ---------- */
.game {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  padding: 1rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .game { grid-template-columns: 1fr; }
}

/* ---------- Launch area ---------- */
.launch-area {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 480px;
  overflow: hidden;
}
.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px #fff;
  animation: twinkle 3s infinite ease-in-out;
}
.star-1 { top: 12%; left: 8%; animation-delay: 0s; }
.star-2 { top: 25%; right: 15%; animation-delay: 0.5s; }
.star-3 { top: 60%; left: 12%; animation-delay: 1s; }
.star-4 { top: 78%; right: 8%; animation-delay: 1.5s; }
.star-5 { top: 8%; left: 50%; animation-delay: 2s; width: 2px; height: 2px; }
.star-6 { top: 45%; right: 35%; animation-delay: 2.3s; width: 4px; height: 4px; }
.star-7 { top: 88%; left: 35%; animation-delay: 0.8s; }
.star-8 { top: 32%; left: 28%; animation-delay: 1.8s; width: 2px; height: 2px; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}
.comet {
  position: absolute;
  top: 15%;
  left: -10%;
  width: 2px;
  height: 2px;
  background: var(--magenta);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--magenta), -20px 0 6px rgba(255, 136, 0, 0.6), -40px 0 4px rgba(255, 0, 255, 0.3);
  animation: comet 12s linear infinite;
  animation-delay: 4s;
  opacity: 0;
}
@keyframes comet {
  0% { transform: translate(0, 0); opacity: 0; }
  5% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(120vw, 40vh); opacity: 0; }
}

.launch-btn {
  position: relative;
  z-index: 1;
  width: clamp(140px, 30vw, 200px);
  height: clamp(140px, 30vw, 200px);
  border-radius: 50%;
  background: var(--gradient);
  border: 4px solid rgba(255, 255, 255, 0.15);
  color: #000;
  font-size: clamp(3.5rem, 10vw, 5rem);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(255, 136, 0, 0.5), inset 0 0 30px rgba(255, 0, 255, 0.3);
  transition: transform 0.08s ease, box-shadow 0.2s;
  margin-top: 2rem;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.launch-btn:hover { box-shadow: 0 0 60px rgba(255, 136, 0, 0.7), inset 0 0 40px rgba(255, 0, 255, 0.4); }
.launch-btn:active { transform: scale(0.94); }
.launch-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid var(--orange);
  opacity: 0;
  pointer-events: none;
}
.launch-btn.clicked .launch-pulse { animation: pulse 0.45s ease-out; }
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}
.launch-emoji { display: block; line-height: 1; }
.launch-hint {
  position: relative;
  z-index: 1;
  margin-top: 1.25rem;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

/* ---------- Planets row ---------- */
.planets {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.5rem;
  width: 100%;
  flex-wrap: wrap;
}
.planet {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s, box-shadow 0.3s;
  cursor: default;
}
.planet.unlocked {
  background: var(--planet-color, #555);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 16px var(--planet-color, #555);
  animation: planetPulse 4s ease-in-out infinite;
}
.planet.unlocked:hover { transform: scale(1.1) translateY(-4px); }
.planet.locked { filter: grayscale(0.8) opacity(0.4); }
.planet-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.92);
  color: var(--fg);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  border: 1px solid var(--panel-border);
}
.planet:hover .planet-tooltip { opacity: 1; }
@keyframes planetPulse {
  0%, 100% { box-shadow: 0 0 12px var(--planet-color, #555); }
  50% { box-shadow: 0 0 22px var(--planet-color, #555); }
}

/* ---------- Side panel ---------- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.panel-title {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  color: var(--orange);
  font-weight: 700;
}
.panel-hint {
  color: var(--fg-dim);
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.panel-prestige {
  border-color: var(--panel-border-hot);
  background: linear-gradient(180deg, rgba(255, 0, 255, 0.05), var(--panel-bg));
}
.panel-prestige .panel-title { color: var(--magenta); }
.prestige-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Upgrades ---------- */
.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.upgrade-list::-webkit-scrollbar { width: 6px; }
.upgrade-list::-webkit-scrollbar-track { background: transparent; }
.upgrade-list::-webkit-scrollbar-thumb { background: rgba(255, 136, 0, 0.3); border-radius: 3px; }
.upgrade {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
}
.upgrade:hover:not(.locked) {
  background: rgba(255, 136, 0, 0.08);
  border-color: rgba(255, 136, 0, 0.4);
}
.upgrade:active:not(.locked) { transform: scale(0.98); }
.upgrade.locked { opacity: 0.45; cursor: not-allowed; }
.upgrade-icon { font-size: 1.5rem; text-align: center; }
.upgrade-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--fg);
  display: block;
  margin-bottom: 0.1rem;
}
.upgrade-desc {
  font-size: 0.75rem;
  color: var(--fg-dim);
  display: block;
  line-height: 1.3;
}
.upgrade-cost {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.upgrade-owned {
  font-size: 0.7rem;
  color: var(--green);
  display: block;
  text-align: right;
  margin-top: 0.1rem;
}
.upgrade.locked .upgrade-cost { color: var(--fg-mute); }
.upgrade.affordable { border-color: rgba(88, 224, 138, 0.4); background: rgba(88, 224, 138, 0.06); }

/* ---------- Stats list ---------- */
.stats-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  font-size: 0.85rem;
}
.stats-list dt { color: var(--fg-dim); }
.stats-list dd { color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
  align-items: center;
}
.toast {
  background: rgba(10, 5, 20, 0.95);
  border: 1px solid var(--panel-border);
  color: var(--fg);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.25s ease-out, toastOut 0.35s ease-in 2.6s forwards;
  max-width: 90vw;
  text-align: center;
}
.toast.success { border-color: rgba(88, 224, 138, 0.5); }
.toast.warn { border-color: rgba(255, 213, 74, 0.5); }
.toast.error { border-color: rgba(255, 85, 119, 0.5); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

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

/* Mobile tweaks */
@media (max-width: 600px) {
  .hud { padding: 0.6rem 0.75rem; }
  .stat-value { font-size: 0.95rem; }
  .launch-area { min-height: 380px; padding: 1rem; }
  .game { padding: 0.6rem; gap: 0.6rem; }
  .panel { padding: 0.85rem; }
  .upgrade-list { max-height: 360px; }
}
