:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --accent: #f59e0b;
  --accent-2: #10b981;
  --accent-3: #ec4899;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e9d5ff;
  --shadow: 0 12px 30px rgba(124, 58, 237, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #fff8f0 0%, #fef3c7 45%, #ede9fe 100%);
  overflow-x: hidden;
}

.bg-shapes .shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.shape-1 { width: 220px; height: 220px; background: #f472b6; top: 8%; left: -40px; }
.shape-2 { width: 180px; height: 180px; background: #34d399; bottom: 10%; right: -30px; }
.shape-3 { width: 140px; height: 140px; background: #60a5fa; top: 45%; right: 12%; }

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
  position: relative;
}

.logo {
  font-family: "Fredoka", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
  min-width: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle.hidden {
  display: none !important;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--primary-dark);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav.hidden { display: none; }

.container {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem;
}

.card {
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  animation: pop 0.35s ease;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3 {
  font-family: "Fredoka", sans-serif;
  margin-top: 0;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.1;
  color: var(--primary-dark);
}

.login-card {
  text-align: center;
}

.hero-title-landing {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 45%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(124, 58, 237, 0.2));
}

.login-promo-text {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.promo-word {
  font-weight: 700;
}

.promo-word.promo-read { color: #7c3aed; }
.promo-word.promo-quiz { color: #d97706; }
.promo-word.promo-rank { color: #059669; }

.login-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn-google-hero {
  font-size: 1.15rem;
  padding: 1rem 1.75rem;
  min-width: min(100%, 280px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  border: 2px solid #e5e7eb;
  font-weight: 800;
}

.btn-google-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.subtitle { color: var(--muted); font-size: 1.05rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #a855f7);
  color: white;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

.btn-google {
  background: white;
  color: #374151;
  border: 2px solid #e5e7eb;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  color: #78350f;
}

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
  border: 2px dashed var(--border);
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.name-form-actions {
  justify-content: center;
}

.btn-text-link {
  display: block;
  margin: 0.25rem auto 0;
  padding: 0.25rem 0.5rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text-link:hover {
  color: var(--primary-dark);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: #ede9fe;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
}

.story-title {
  color: var(--accent-3);
  font-size: 1.6rem;
}

.paragraph {
  font-size: 1.08rem;
  line-height: 1.7;
  margin: 0 0 1rem;
}

.question-block {
  border: 2px solid #fde68a;
  background: #fffbeb;
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.question-block legend {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.2rem;
  cursor: pointer;
}

.option input { accent-color: var(--primary); transform: scale(1.15); }

.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  background: #f5f3ff;
  border: 2px solid transparent;
}

.ranking-item.me {
  border-color: var(--accent-2);
  background: #ecfdf5;
}

.rank-num {
  font-family: "Fredoka", sans-serif;
  font-size: 1.2rem;
  color: var(--primary);
  min-width: 2rem;
}

.points-pill {
  background: var(--accent);
  color: #78350f;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.ranking-name {
  flex: 1;
  min-width: 0;
}

.ranking-scores {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  margin-left: 1rem;
}

.points-today-pill {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.points-total-pill {
  background: var(--accent);
  color: #78350f;
  font-weight: 800;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  min-width: 2.5rem;
  text-align: center;
  white-space: nowrap;
}

.input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  font: inherit;
  font-size: 1rem;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.result-box {
  text-align: center;
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid #6ee7b7;
}

.result-box h2 { color: #047857; margin-bottom: 0.25rem; }

.points-breakdown {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.chip {
  background: white;
  border: 2px solid #a7f3d0;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.error-banner {
  background: #fef2f2;
  color: #b91c1c;
  border: 2px solid #fecaca;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.user-chip {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .logo {
    font-size: 1.25rem;
  }

  .nav-toggle:not(.hidden) {
    display: flex;
  }

  .nav:not(.hidden) {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem 1.25rem 1.25rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 12px 24px rgba(124, 58, 237, 0.12);
  }

  .nav.nav-open {
    display: flex;
  }

  .nav .user-chip {
    text-align: center;
    padding-bottom: 0.25rem;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 0.25rem;
  }

  .nav .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .card { padding: 1.1rem; }
  .ranking-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .ranking-scores {
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* Palabras complejas con definición */
.word-help {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  color: #7c3aed;
  text-decoration: underline;
  text-decoration-color: #c084fc;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
  border-radius: 4px;
}

.word-help:hover,
.word-help:focus-visible {
  color: #5b21b6;
  text-decoration-color: #7c3aed;
  background: #f5f3ff;
  outline: 2px solid #c4b5fd;
  outline-offset: 2px;
}

.vocab-hint {
  background: #f5f3ff;
  border: 2px dashed #c4b5fd;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: #5b21b6;
  margin: 0 0 0.5rem;
}

.word-help-sample {
  color: #7c3aed;
  text-decoration: underline;
  text-decoration-color: #c084fc;
  text-decoration-thickness: 2px;
  font-weight: 700;
}

.vocab-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.vocab-modal.hidden {
  display: none;
}

.vocab-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 27, 75, 0.45);
}

.vocab-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  background: white;
  border: 3px solid #c4b5fd;
  border-radius: 20px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 20px 50px rgba(91, 33, 182, 0.25);
  animation: pop 0.25s ease;
}

.vocab-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
}

.vocab-modal-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a855f7;
}

.vocab-modal-word {
  margin: 0.25rem 0 0.75rem;
  font-family: "Fredoka", sans-serif;
  font-size: 1.5rem;
  color: #5b21b6;
}

.vocab-modal-def {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #374151;
}

body.vocab-modal-open {
  overflow: hidden;
}

