/* ===================== NeusiPlanetas — Espacio Profundo ===================== */

:root{
  --bg-deep: #05010f;
  --bg-mid: #0b0f2b;
  --bg-card: #12163a;
  --purple: #8b5cf6;
  --purple-glow: #a78bfa;
  --blue: #38bdf8;
  --yellow: #facc15;
  --yellow-glow: #fde68a;
  --pink: #f472b6;
  --green: #4ade80;
  --red: #f87171;
  --text: #f4f2ff;
  --text-dim: #b9b6d6;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-neon: 0 0 24px rgba(139, 92, 246, 0.45);
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, var(--bg-mid) 0%, var(--bg-deep) 65%);
  color: var(--text);
  font-family: 'Lexend', system-ui, sans-serif;
  overflow-x: hidden;
}

h1, h2, h3{ font-weight: 800; margin: 0; }
p{ margin: 0; }

button{ font-family: inherit; cursor: pointer; border: none; }
input{ font-family: inherit; }

/* ---------- Starfield ---------- */
.stars-bg{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.star{
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation-name: twinkle;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
@keyframes twinkle{
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---------- Layout ---------- */
#app{
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.screen{
  display: none;
  width: 100%;
  max-width: 720px;
  animation: fadeIn 0.4s ease;
}
.screen.screen-active{ display: block; }

@keyframes fadeIn{
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card{
  background: linear-gradient(160deg, var(--bg-card), #0d1030);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-neon);
  padding: 36px 28px;
  text-align: center;
}

/* ---------- Welcome screen ---------- */
.welcome-card{ max-width: 460px; margin: 0 auto; }
.welcome-planet{ width: 140px; height: 140px; margin: 0 auto 8px; }
.title{
  font-size: 2.4rem;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 1px;
}
.subtitle{ color: var(--text-dim); margin-top: 6px; font-size: 1.1rem; }

.field-label{
  display: block;
  margin-top: 26px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 1rem;
}
.text-input{
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(139, 92, 246, 0.5);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 1.2rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.text-input:focus{
  border-color: var(--yellow);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.4);
}

.record-line{
  margin-top: 18px;
  color: var(--yellow-glow);
  font-size: 1rem;
}

/* ---------- Buttons ---------- */
.btn{
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:active{ transform: scale(0.96); }

.btn-big{
  width: 100%;
  margin-top: 24px;
  padding: 16px 20px;
  font-size: 1.25rem;
}

.btn-primary{
  background: linear-gradient(90deg, var(--yellow), #fbbf24);
  color: #241a00;
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.55);
}
.btn-primary:hover{ filter: brightness(1.08); }

.btn-secondary{
  background: linear-gradient(90deg, var(--purple), #7c3aed);
  color: #fff;
  box-shadow: 0 0 22px rgba(139, 92, 246, 0.55);
}
.btn-secondary:hover{ filter: brightness(1.1); }

.btn-icon{
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:active{ transform: scale(0.9); }

/* ---------- Game screen ---------- */
.game-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(18, 22, 58, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.header-left{
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.player-greeting{ font-weight: 700; color: var(--text); font-size: 1rem; }

.stars-row{
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 1.3rem;
  max-width: 240px;
}
.star-slot{ opacity: 0.25; transition: opacity 0.2s, transform 0.25s; }
.star-slot.filled{ opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 6px var(--yellow)); }

.planet-stage{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  margin: 18px 0;
}
.planet-visual{ width: 200px; height: 200px; }

.question-box{
  background: rgba(18, 22, 58, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}
.question-text{
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.4;
}

.answers-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.answer-btn{
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(139, 92, 246, 0.45);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: 64px;
}
.answer-btn:hover{ border-color: var(--blue); background: rgba(56, 189, 248, 0.12); }
.answer-btn:active{ transform: scale(0.97); }
.answer-btn.correct{
  background: rgba(74, 222, 128, 0.25);
  border-color: var(--green);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.5);
}
.answer-btn.incorrect{
  background: rgba(248, 113, 113, 0.25);
  border-color: var(--red);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.5);
}
.answer-btn[disabled]{ pointer-events: none; }

/* ---------- Results screen ---------- */
.results-card{ max-width: 460px; margin: 0 auto; }
.results-emoji{ font-size: 4rem; margin-bottom: 6px; }
.results-title{ font-size: 1.8rem; color: var(--yellow-glow); }
.results-message{
  margin-top: 14px;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- Modal ---------- */
.modal-overlay{
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(2, 1, 10, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden]{ display: none; }
.modal-card{
  background: linear-gradient(160deg, #1a1440, #0d0a26);
  border: 2px solid var(--purple-glow);
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.6);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 28px 24px;
  text-align: center;
  animation: popIn 0.28s ease;
}
@keyframes popIn{
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.modal-planet{ width: 110px; height: 110px; margin: 0 auto 10px; }
.modal-title{ font-size: 1.6rem; color: var(--pink); }
.modal-correct{
  margin-top: 10px;
  font-weight: 700;
  color: var(--green);
  font-size: 1.05rem;
}
.modal-explanation{
  margin-top: 12px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* ---------- Planet SVG animations ---------- */
.planet-float{ animation: floaty 4.5s ease-in-out infinite; }
@keyframes floaty{
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-14px); }
}
.planet-spin{
  animation: spin 14s linear infinite;
  transform-origin: center;
}
@keyframes spin{
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.ring-spin{
  animation: ringspin 22s linear infinite;
  transform-origin: center;
}
@keyframes ringspin{
  from { transform: rotate(-15deg); }
  to { transform: rotate(345deg); }
}
.sol-glow{ animation: solpulse 2.4s ease-in-out infinite; }
@keyframes solpulse{
  0%, 100% { filter: drop-shadow(0 0 18px rgba(255, 190, 60, 0.75)); }
  50% { filter: drop-shadow(0 0 34px rgba(255, 210, 90, 0.95)); }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px){
  .answers-grid{ grid-template-columns: 1fr; }
  .title{ font-size: 1.9rem; }
  .planet-visual{ width: 150px; height: 150px; }
  .card{ padding: 26px 18px; }
  .question-text{ font-size: 1.15rem; }
  .game-header{ justify-content: center; }
  .header-left{ align-items: center; text-align: center; flex-basis: 100%; order: -1; }
}

@media (max-width: 380px){
  .stars-row{ font-size: 1.05rem; max-width: 200px; }
}
