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

:root {
  --bg: #050213;
  --violet: #8b5cf6;
  --magenta: #ff2d95;
  --cyan: #22e6ff;
  --gold: #ffc94d;
  --text: #f4f1ff;
  --muted: #b3a8d9;
}

html, body { height: 100%; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
body.app-mode { overflow: hidden; }
body.app-mode #landing, body.app-mode #sticky-cta { display: none; }

/* ---------- fondo estelar ---------- */
.cosmos-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(139,92,246,.22), transparent 60%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(255,45,149,.14), transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(34,230,255,.07), transparent 60%),
    var(--bg);
}
.stars { position: absolute; inset: -50%; background-repeat: repeat; }
.s1 {
  background-image: radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 110px, #cfe8ff, transparent),
    radial-gradient(1.5px 1.5px at 160px 60px, #ffd9f2, transparent),
    radial-gradient(1px 1px at 220px 150px, #fff, transparent);
  background-size: 260px 200px;
  animation: drift 120s linear infinite;
  opacity: .8;
}
.s2 {
  background-image: radial-gradient(1px 1px at 50px 80px, #9ecbff, transparent),
    radial-gradient(1px 1px at 130px 20px, #fff, transparent),
    radial-gradient(2px 2px at 200px 120px, #c4b5fd, transparent);
  background-size: 320px 260px;
  animation: drift 200s linear infinite reverse;
  opacity: .55;
}
.s3 {
  background-image: radial-gradient(1.5px 1.5px at 70px 40px, #fff, transparent),
    radial-gradient(1px 1px at 180px 90px, #a5f3fc, transparent);
  background-size: 420px 340px;
  animation: twinkle 4s ease-in-out infinite alternate, drift 300s linear infinite;
  opacity: .6;
}
@keyframes drift { to { transform: translate(260px, 200px); } }
@keyframes twinkle { from { opacity: .25; } to { opacity: .75; } }

/* ---------- pantallas ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.screen.active { display: flex; animation: warpIn .6s cubic-bezier(.2,.9,.3,1); }
@keyframes warpIn {
  from { opacity: 0; transform: scale(.92); filter: blur(8px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}

.card {
  width: min(520px, 94vw);
  background: rgba(14, 8, 38, .72);
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: 24px;
  padding: 40px 36px;
  backdrop-filter: blur(18px);
  box-shadow: 0 0 80px rgba(139, 92, 246, .25), inset 0 1px 0 rgba(255,255,255,.06);
  text-align: center;
}

.brand {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: .35em;
  font-size: 13px;
  color: var(--cyan);
  margin-bottom: 22px;
  text-shadow: 0 0 18px rgba(34,230,255,.8);
}
h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 800; line-height: 1.25; }
.grad {
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--muted); font-size: 15px; margin: 16px 0 28px; line-height: 1.6; }

form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(139,92,246,.4);
  border-radius: 14px;
  padding: 15px 18px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border .2s, box-shadow .2s;
  color-scheme: dark;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,230,255,.18); }

.btn-primary {
  margin-top: 24px;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  border: none; border-radius: 16px;
  padding: 17px 28px;
  font-family: inherit; font-weight: 700; font-size: 16px;
  color: #fff; cursor: pointer;
  box-shadow: 0 0 30px rgba(255,45,149,.5);
  transition: transform .15s, box-shadow .2s;
  animation: pulse 2.4s ease-in-out infinite;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 50px rgba(255,45,149,.75); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 26px rgba(255,45,149,.45); }
  50% { box-shadow: 0 0 46px rgba(139,92,246,.8); }
}
.rocket { display: inline-block; transition: transform .2s; }
.btn-primary:hover .rocket { transform: translateX(5px); }

/* ---------- quiz ---------- */
.quiz-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 16px; }
#quiz-fill {
  height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border-radius: 6px;
  transition: width .45s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 0 12px rgba(34,230,255,.8);
}
.quiz-step { font-size: 12px; letter-spacing: .25em; color: var(--muted); margin-bottom: 10px; }
.quiz h2 { font-size: 22px; margin-bottom: 24px; }
.quiz-opts { display: flex; flex-direction: column; gap: 12px; }
.quiz-opts button {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(139,92,246,.35);
  border-radius: 14px;
  padding: 16px 20px;
  color: var(--text); font-family: inherit; font-size: 15px;
  cursor: pointer; text-align: left;
  transition: all .18s;
}
.quiz-opts button:hover {
  border-color: var(--cyan);
  background: rgba(34,230,255,.1);
  transform: translateX(6px);
  box-shadow: 0 0 24px rgba(34,230,255,.25);
}

/* ---------- loading ---------- */
.loading { text-align: center; }
.loading h2 { font-weight: 400; font-size: 18px; color: var(--muted); margin-top: 36px; min-height: 28px; }
.orb {
  width: 110px; height: 110px; margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff, var(--cyan) 25%, var(--violet) 55%, var(--magenta) 80%, transparent 100%);
  filter: blur(2px);
  animation: orbPulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 80px rgba(139,92,246,.9), 0 0 160px rgba(255,45,149,.5);
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); filter: blur(3px) hue-rotate(40deg); }
}

/* ---------- mundo ---------- */
#screen-world { padding: 0; }
#world-container { position: absolute; inset: 0; }
#world-container canvas { display: block; }

.hud {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 28px;
  pointer-events: none;
}
.hud-top { text-align: left; }
.hud-label { font-size: 11px; letter-spacing: .4em; color: var(--cyan); text-shadow: 0 0 14px rgba(34,230,255,.9); }
#planet-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(30px, 5vw, 52px); font-weight: 700;
  text-shadow: 0 0 30px rgba(139,92,246,.8);
  margin: 6px 0 2px;
}
#planet-owner { color: var(--muted); font-size: 14px; }
.traits { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.traits span {
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(10,5,30,.55);
  backdrop-filter: blur(8px);
}

.hud-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  pointer-events: auto;
}
.hud-actions .btn-primary { margin-top: 0; animation: none; padding: 14px 22px; font-size: 14px; }
.btn-premium {
  background: rgba(255,201,77,.1);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 14px 22px;
  color: var(--gold);
  font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255,201,77,.25);
  transition: all .2s;
}
.btn-premium:hover { background: rgba(255,201,77,.22); box-shadow: 0 0 40px rgba(255,201,77,.5); }
.btn-premium .tag { font-size: 10px; letter-spacing: .15em; opacity: .9; }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 16px;
  padding: 14px 22px;
  color: var(--muted);
  font-family: inherit; font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.btn-ghost:hover { border-color: #fff; color: #fff; }

.hint {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  font-size: 12px; letter-spacing: .2em; color: rgba(255,255,255,.45);
  animation: hintFade 3s ease 2s forwards;
  pointer-events: none;
}
@keyframes hintFade { to { opacity: 0; } }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(3,1,12,.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(420px, 90vw);
  background: rgba(20, 10, 48, .92);
  border: 1px solid var(--gold);
  border-radius: 24px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 0 90px rgba(255,201,77,.35);
  display: flex; flex-direction: column; gap: 14px;
  animation: warpIn .4s cubic-bezier(.2,.9,.3,1);
}
.modal-card h3 { font-size: 22px; color: var(--gold); }
.modal-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }

@media (max-width: 640px) {
  .hud { padding: 18px; }
  .hud-actions { flex-direction: column; }
  .hud-actions button { width: 100%; }
}
