/* OWNER: Rol 1 — Inicio, selector de niveles y cromo compartido. Se carga siempre. */

/* Clases con display propio (ej. .steps { display: flex }) anulan [hidden]: lo forzamos. */
[hidden] { display: none !important; }

#app[aria-busy="true"] { cursor: progress; }

/* ---- Inicio ---- */
.start {
  min-height: calc(100vh - 220px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; padding: 24px 0;
}
/* Capa negra translúcida a pantalla completa entre el fondo animado y el texto, para que se lea.
   Va justo encima del canvas .starry-bg (mismo z-index, aparece después en el orden de pintado). */
.start::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  /* Más oscuro al centro (título y texto) y abajo (pie); en los bordes deja ver el fondo animado.
     Medido con muestreo de píxeles: el texto pequeño pasó de 2.3:1 a más de 4.5:1. */
  background:
    radial-gradient(ellipse 62% 56% at 50% 52%, rgba(3, 6, 16, 0.78) 0%, rgba(3, 6, 16, 0.66) 62%, rgba(3, 6, 16, 0.5) 100%),
    linear-gradient(to top, rgba(3, 6, 16, 0.72) 0%, transparent 22%);
}
.start-kicker { margin: 0; color: var(--accent-2); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.start-title { font-size: clamp(2.2rem, 8vw, 4rem); line-height: 1.05; margin: 0; }
.start-tagline { margin: 0 auto 12px; }
.btn-xl { font-size: 1.2rem; padding: 14px 40px; border-radius: 999px; }
/* Con partida guardada: Continuar (grande) y Reiniciar al lado; el aviso de dónde se retoma va debajo. */
.start-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.start-saved { flex-basis: 100%; margin: 0; font-size: 0.9rem; color: #cfe8ff; }
/* Botón secundario: vidrio esmerilado con borde y texto perla sobre el fondo estrellado. */
.start .btn-ghost {
  color: #f1f5f9;
  background: rgba(248, 250, 252, 0.08);
  border-color: rgba(241, 245, 249, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 0.05s, background 0.2s, border-color 0.2s;
}
.start .btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}
.start-resources-title { margin: 24px 0 0; font-size: 0.85rem; }
.start-resources { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.start-resources li { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; color: var(--muted); }

.start-orbit { position: relative; width: 150px; height: 150px; margin-bottom: 8px; }
.start-orbit::before { content: ""; position: absolute; inset: 0; border: 1px dashed rgba(255, 255, 255, 0.85); border-radius: 50%; }
.start-planet {
  position: absolute; inset: 45px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #bdd9fe, #7eb5fb 35%, #4f86f7 70%, #3a6ee0);
  box-shadow: 0 0 40px rgba(91, 140, 255, 0.55), inset -6px -8px 14px rgba(20, 40, 120, 0.35);
}
/* Destello de luz: elipse blanca difuminada e inclinada, como un reflejo y no un punto perfecto. */
.start-planet::after {
  content: ""; position: absolute; top: 14%; left: 16%; width: 42%; height: 24%;
  border-radius: 50%; transform: rotate(-35deg);
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.35) 45%, transparent 70%);
  filter: blur(3px);
}
.start-sat { position: absolute; inset: 0; animation: orbit 6s linear infinite; }
.start-sat::after {
  content: ""; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: radial-gradient(circle, #fff 0 25%, #a5f3fc 60%);
  box-shadow: 0 0 10px 2px rgba(165, 243, 252, 0.9);
}
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .start-sat { animation: none; } }

/* Textos claros en el inicio para que se lean sobre el fondo animado. */
.start { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.start .start-kicker { color: #cfe8ff; }
.start .start-tagline,
.start .start-resources-title { color: #eef2ff; }
.start .start-resources li { color: #e6ebff; text-shadow: none; }
.start .btn { text-shadow: none; }
.start .btn-primary { background: #2463eb; border-color: #2463eb; color: #fff; } /* texto blanco: 5.5:1 (el oscuro daba 3.7:1) */
.start .btn-primary:hover:not(:disabled) { background: #1d4fd8; border-color: #1d4fd8; }
body:has(.start) .app-footer { color: #e6ebff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }

/* Fondo WebGL del inicio (js/canvas/starry-bg.js). Va detrás de todo el contenido. */
.starry-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; }

/* ---- Selector de niveles ---- */
.levels-project { font-weight: 600; color: var(--accent-2); }
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--gap); margin-top: 20px; }
.level-card { display: flex; flex-direction: column; gap: 6px; min-height: 230px; transition: transform 0.1s, border-color 0.2s; }
.level-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent-2); }
.level-card h3, .level-card p { margin: 0; }
.level-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.8rem; }
.level-num { color: var(--accent-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.level-status { border-radius: 999px; padding: 2px 10px; background: var(--surface-2); color: var(--muted); }
.level-card.is-available .level-status { background: var(--accent); color: #fff; }
.level-card.is-done .level-status { background: rgba(74, 222, 128, 0.15); color: var(--ok); }
.level-card.is-done { border-color: rgba(74, 222, 128, 0.45); }
.level-icon { font-size: 2rem; line-height: 1; margin: 6px 0; }
.level-resource { margin-top: auto; color: var(--muted); }

/* ---- Enlaces a los simuladores 3D (inicio y selector de niveles) ---- */
.explore { margin: 20px auto 0; max-width: 760px; text-align: center; }
.explore-title { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.explore-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.explore-link {
  display: flex; align-items: center; gap: 12px; text-align: left; text-decoration: none;
  min-width: 250px; padding: 12px 16px; border-radius: var(--radius);
  color: var(--text); background: rgba(14, 21, 48, 0.78); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.explore-link:hover { border-color: var(--accent-2); background: rgba(22, 32, 74, 0.9); }
.explore-link:active { transform: translateY(1px); }
.explore-link:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.explore-icon { flex: none; color: var(--accent-2); }
.explore-link span { display: grid; gap: 2px; }
.explore-link b { font-size: 0.95rem; }
.explore-link small { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
#screen-levels .explore { margin-top: 28px; }
