:root {
  --brand: #ff6b35;
  --brand-dark: #e2551f;
  --brand-soft: #ffe4d6;
  --teal: #2c7a7b;
  --violet: #6b4fa0;
  --ink: #1f2a2e;
  --ink-soft: #5b6b70;
  --bg: #fdfbf6;
  --surface: #ffffff;
  --surface-alt: #f4efe3;
  --line: #e6e0d0;
  --success: #2f9e63;
  --success-bg: #e6f6ec;
  --danger: #e23d3d;
  --danger-bg: #fdeaea;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 42, 46, 0.05), 0 8px 20px -10px rgba(31, 42, 46, 0.18);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 480px; margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.15rem; color: var(--ink);
}
.topbar .brand .logo-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--brand); display: inline-block; }
.topbar nav { display: flex; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font); font-weight: 700; font-size: 0.95rem;
  padding: 11px 20px;
  border-radius: 999px;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-flat { border-radius: var(--radius-md); box-shadow: none; padding: 18px; }

/* ---------- Tema Espacial (articulo equipable de la tienda) ---------- */
.profile-header-box {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: background 0.2s;
}
.profile-header-box.space-theme {
  background:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 15px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 150px 60px, #fff, transparent),
    radial-gradient(1px 1px at 210px 25px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 260px 70px, #fff, transparent),
    radial-gradient(1px 1px at 320px 20px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40px 80px, #fff, transparent),
    radial-gradient(1px 1px at 380px 55px, #fff, transparent),
    linear-gradient(180deg, #0b0f2b 0%, #1b1044 55%, #2e1461 100%);
  background-repeat: repeat;
  background-size: 420px 100px, 420px 100px, 420px 100px, 420px 100px, 420px 100px, 420px 100px, 420px 100px, 420px 100px, 100% 100%;
  color: #fff;
}
.profile-header-box.space-theme .text-soft { color: rgba(255, 255, 255, 0.75); }
.profile-header-box.space-theme .chip { background: rgba(255, 255, 255, 0.15); color: #fff; }
.profile-header-box.space-theme .chip-points { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: 0.95rem;
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  margin-bottom: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field-error { color: var(--danger); font-size: 0.82rem; margin: -10px 0 14px; }

/* ---------- Badges / chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface-alt); color: var(--ink-soft);
}
.chip-points { background: var(--brand-soft); color: var(--brand-dark); }
.chip-success { background: var(--success-bg); color: var(--success); }

/* ---------- Alerts / toast ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.text-soft { color: var(--ink-soft); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ---------- Loading ---------- */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 48px 0; }

/* ---------- Bottom tab nav (dashboard) ---------- */
.tabbar {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tabbar button {
  font-family: var(--font); font-weight: 700; font-size: 0.9rem;
  background: none; border: none; cursor: pointer;
  padding: 12px 16px;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabbar button.active { color: var(--ink); border-bottom-color: var(--brand); }

/* ---------- Landing page ---------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 16ch; margin: 0 auto 16px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 52ch; margin: 0 auto 28px; }
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 40px 0 64px; }
@media (max-width: 760px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-grid .card h3 { font-size: 1.05rem; }
.feature-icon { font-size: 1.8rem; margin-bottom: 10px; }

footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- Quiz play ---------- */
.progress-bar { height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress-bar > div { height: 100%; background: var(--brand); transition: width 0.2s; }
.option {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; background: var(--surface);
}
.option:hover { background: var(--surface-alt); }
.option.selected { border-color: var(--brand); background: var(--brand-soft); }
.option.correct { border-color: var(--success); background: var(--success-bg); }
.option.wrong { border-color: var(--danger); background: var(--danger-bg); }
.option .letter { font-weight: 800; color: var(--ink-soft); }
.option.correct .letter { color: var(--success); }
.option.wrong .letter { color: var(--danger); }
.option input { display: none; }

.result-box { border-radius: var(--radius-md); padding: 16px; margin: 16px 0; }
.result-box.correct { background: var(--success-bg); }
.result-box.incorrect { background: var(--surface-alt); }

/* ---------- Shop grid ---------- */
.shop-item { text-align: center; }
.shop-item .icon { font-size: 2.4rem; margin-bottom: 8px; }
