 :root { font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: dark; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
}

.bg-grad {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1000px at 50% 10%, var(--glow-1, rgba(255,255,255,0.08)), transparent);
  opacity: 0.3;
}

.shell { width: min(1100px, 94vw); margin: 0 auto; padding: 0 0 40px; }

.hero {
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 34px 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  align-items: stretch;
  background: radial-gradient(700px at 10% 0%, rgba(255,255,255,0.08), transparent 60%), transparent;
}
.eyebrow { text-transform: uppercase; letter-spacing: 1.4px; color: var(--accent-2); font-size: 12px; margin: 0; }
h1 { margin: 8px 0 10px 0; font-size: clamp(28px, 4vw, 38px); }
.lede { color: var(--muted); line-height: 1.6; margin: 0 0 16px 0; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn.solid { background: linear-gradient(135deg, var(--accent), #ff9f66); color: #0b0b0b; box-shadow: 0 16px 32px rgba(255,122,60,0.28); }
.btn.ghost { background: rgba(255,255,255,0.05); color: var(--text); border-color: rgba(255,255,255,0.1); }
.btn:hover { transform: translateY(-1px); }

.hero-card {
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pill {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  letter-spacing: 0.3px;
  gap: 6px;
}
.pill.ghost { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
.hero-metric { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; }
.metric-label { color: var(--muted); font-size: 13px; margin: 0 0 4px 0; }
.metric-value { font-size: 20px; font-weight: 700; margin: 0; }
.muted { color: var(--muted); }
.muted.small { font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,0.45); }
.card h2 { margin: 6px 0 10px 0; font-size: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.civ-hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7,9,15,0.78);
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
  color: var(--muted, #d0d7ff);
  margin-top: 12px;
}

.civ-hero-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted, #6b7280);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
}

.civ-hero-status[data-state="online"] { color: #d9ffe9; }
.civ-hero-status[data-state="online"] .civ-hero-status-dot { background: #4ade80; }

.civ-hero-status[data-state="offline"] { color: #fee2e2; }
.civ-hero-status[data-state="offline"] .civ-hero-status-dot { background: #f97373; }

@media(max-width: 640px) {
  .civ-hero-status { font-size: 0.8rem; }
}

.civ-hero-homes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7,9,15,0.78);
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  color: var(--muted, #d0d7ff);
  margin-top: 8px;
}

.civ-hero-homes .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7de0ff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
}

@media(max-width: 640px) {
  .civ-hero-homes { font-size: 0.78rem; }
}

.civ-hero-report {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7,9,15,0.78);
  backdrop-filter: blur(12px);
  color: var(--muted, #d0d7ff);
  font-size: 0.85rem;
  display: grid;
  gap: 6px;
  width: fit-content;
}
.civ-hero-report .report-line {
  display: flex;
  gap: 6px;
  align-items: center;
}
.civ-hero-report .label {
  color: var(--muted);
  font-size: 0.82rem;
}
.civ-hero-report .grade {
  color: #eaf2ff;
  font-weight: 700;
}

.mini-panel {
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.08);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 8px;
}
.label { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }
.value { margin: 2px 0 0 0; font-weight: 700; }

.list { padding-left: 18px; }
.list li { margin: 6px 0; }

.card.wide .placeholder {
  margin-top: 12px;
  height: 180px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.1);
  background: repeating-linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04) 12px, rgba(255,255,255,0.02) 12px, rgba(255,255,255,0.02) 24px);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.embed {
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}
.embed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.embed iframe {
  width: 100%;
  height: 300px;
  border: 0;
  display: block;
}

.footer {
  width: min(1100px, 94vw);
  margin: 20px auto 30px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.links { display: flex; gap: 12px; flex-wrap: wrap; }
.links a { color: var(--accent-2); text-decoration: none; font-weight: 700; }
.links a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}

/* Planet page extras */
.planet-home-capacity {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 4px;
}
.planet-home-capacity.capacity-ok {
  color: rgba(180, 255, 210, 0.9);
}
.planet-home-capacity.capacity-high {
  color: rgba(255, 190, 120, 0.95);
}

.planet-home-card {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 7;
  width: min(320px, 88vw);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(8, 10, 18, 0.9);
  backdrop-filter: blur(12px);
  color: #eaf2ff;
  font-size: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
}
.planet-home-card[hidden] { display: none; }
.planet-home-card .planet-home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.planet-home-card .planet-home-type {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 700;
  font-size: 13px;
}
.planet-home-card .planet-home-user {
  color: #cbe9ff;
  font-weight: 700;
}
.planet-home-card .planet-home-region {
  font-size: 13px;
  color: #b6c4e5;
  margin-bottom: 8px;
}
.planet-home-card .stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 13px;
}
.planet-home-card .stat-row .bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.planet-home-card .stat-row .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8be9fd, #50fa7b);
  transition: width 200ms ease;
}
.planet-home-card .planet-activity-line {
  margin: 4px 0;
  font-size: 13px;
  color: #c7d3f1;
}
.planet-home-card .planet-home-footer {
  margin-top: 8px;
}
.planet-home-card .eco-rows {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.planet-home-card .eco-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 12px;
  color: #c7d3f1;
}
.planet-home-card .eco-row .bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.planet-home-card .eco-row .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg,#8be9fd,#50fa7b);
  transition: width 200ms ease;
}

.planet-home-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.planet-system-line {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted, #d0d7ff);
  opacity: 0.9;
}

.planet-system-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 16, 28, 0.78);
  backdrop-filter: blur(12px);
  color: #cbe9ff;
  font-size: 0.78rem;
}
.planet-system-badge[hidden] { display: none; }

.planet-eco-panel {
  position: fixed;
  top: 320px;
  right: 14px;
  z-index: 6;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10,16,24,0.82);
  backdrop-filter: blur(12px);
  color: #eaf2ff;
  font-size: 13px;
  min-width: 220px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.planet-eco-panel[hidden]{display:none;}
.planet-eco-panel .title { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.planet-eco-panel .line { display:flex; align-items:center; gap:8px; margin:3px 0; }
.planet-eco-panel .bar { flex:1; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow:hidden; }
.planet-eco-panel .fill { height:100%; width:0%; background: linear-gradient(90deg,#8be9fd,#50fa7b); transition: width 200ms ease; }
.planet-eco-panel .label { width:80px; color: rgba(215,222,247,0.85); }
.planet-eco-panel .pill {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  font-size:12px;
  color:#eaf2ff;
  margin-bottom:4px;
}

#growth-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  display: none; /* toggled by JS */
  align-items: center;
  justify-content: center;
}
#growth-overlay[hidden] { display: none; }
#growth-canvas {
  width: min(900px, 92vw);
  height: min(520px, 70vh);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 48px rgba(0,0,0,0.55);
  background: #0b0f17;
}
#growth-garden {
  position: absolute;
  width: min(900px, 92vw);
  height: min(520px, 70vh);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 18px 48px rgba(0,0,0,0.55);
  background: rgba(5,15,30,0.96);
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 12px;
}
.growth-plant, .growth-fungi, .growth-fauna {
  position: absolute;
  transform-origin: center bottom;
  animation: garden-bob 3s ease-in-out infinite;
}
.growth-plant .stem {
  width: 4px; border-radius: 999px;
  background: #6ccd7f; margin: 0 auto;
}
.growth-plant .cap {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(145deg, #ffe48f, #ffb347);
  margin: -6px auto 0;
}
.growth-fungi .stem {
  width: 5px; border-radius: 999px;
  background: #e8d6b2; margin: 0 auto;
}
.growth-fungi .cap {
  width: 16px; height: 10px; border-radius: 16px 16px 12px 12px;
  background: linear-gradient(145deg, #ff8b8b, #ff6f6f);
  margin: -4px auto 0;
}
.growth-fauna {
  width: 14px; height: 10px;
  background: #ffc992;
  border-radius: 8px 8px 10px 10px;
}
.growth-fauna::before, .growth-fauna::after {
  content: '';
  position: absolute;
  top: -6px;
  width: 6px; height: 8px;
  background: #2b2f36;
  border-radius: 3px 3px 1px 1px;
}
.growth-fauna::before { left: 1px; }
.growth-fauna::after  { right: 1px; }
@keyframes garden-bob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.growth-sprite {
  width: 32px;
  height: 32px;
  margin: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.growth-overlay-debug { outline: 2px solid magenta; }
#growth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #eaf2ff;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}
#growth-close:hover { background: rgba(255,255,255,0.18); }
#growth-hud {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.45);
  color: #eaf2ff;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

.home-interior-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 1000; /* above HUD/theme controls */
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-interior-overlay[hidden] { display: none; }
.home-interior-content {
  width: min(1400px, 95vw);
  height: min(820px, 90vh);
  background: rgba(10, 14, 20, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-interior-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #eaf2ff;
  font-weight: 600;
}
#interior-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #eaf2ff;
  cursor: pointer;
  padding: 4px 10px;
}
.home-interior-meta {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--muted, #cfd5ff);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#interior-frame {
  flex: 1;
  border: none;
  background: #0d1118;
  width: 100%;
  height: 100%;
}

/* shop overlay reuse */
#shop-frame {
  flex: 1;
  border: none;
  background: #0d1118;
  width: 100%;
  height: 100%;
}

.planet-activity-badge {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  background: radial-gradient(circle at 0 0,
              rgba(255, 255, 255, 0.35),
              rgba(144, 238, 255, 0.12) 40%,
              transparent 70%);
  border: 1px solid rgba(144, 238, 255, 0.4);
  text-transform: uppercase;
  white-space: nowrap;
}

.planet-region-health-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 4px;
}
.planet-region-health-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.planet-region-health-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #3be58a;
  transition: width 0.35s ease-out;
}

.planet-region-myco-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
}
.planet-region-myco-label {
  color: rgba(220, 230, 255, 0.75);
}
.planet-region-myco-val {
  color: rgba(170, 240, 255, 0.9);
}

#home-hover {
  position: fixed;
  top: 0; left: 0;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(12,16,24,0.78);
  backdrop-filter: blur(10px);
  color: #eaf2ff;
  font-size: 12px;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: opacity 120ms ease, transform 120ms ease;
}
#home-hover.is-visible {
  opacity: 1;
  transform: translate(-50%, -110%);
}
