﻿:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-2: #0b1220;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #38bdf8;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --header-height: 74px;
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

body.mobile-menu-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* NAVBAR */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.site-header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.navbar {
  max-width: var(--container);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-brand {
  font-weight: 700;
  white-space: nowrap;
}

.navbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.navbar-nav a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.navbar-nav a:hover {
  color: var(--text);
}

.navbar-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

/* SELECTOR */
.selector {
  position: relative;
}

.selected {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font: inherit;
}

.selected img,
.options button img {
  width: 20px;
  height: 14px;
  object-fit: cover;
}

.options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: none;
}

.options.open {
  display: block;
}

.options button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font: inherit;
}

.options button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* HAMBURGUESA */
.floating-menu-btn {
  position: fixed;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 1280;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}

.floating-menu-btn:hover {
  background: var(--primary-hover);
}

.floating-menu-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-menu-btn span {
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
}

.floating-menu-btn-left {
  top: 16px;
  left: 16px;
}

/* PANEL */
.mobile-panel {
  position: fixed;
  top: 0;
  height: 100vh;
  width: min(360px, 88vw);
  background: var(--bg-soft);
  transition: transform 0.28s ease;
  z-index: 1300;
  box-shadow: var(--shadow);
}

.mobile-panel-left {
  left: 0;
  transform: translateX(-100%);
}

.mobile-panel.open.mobile-panel-left,
.mobile-panel.open {
  transform: translateX(0);
}

.mobile-panel-inner {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-close-btn {
  border: 0;
  background: transparent;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-nav a {
  color: var(--muted);
}

.mobile-label {
  margin: 0 0 10px;
  color: var(--muted);
}

.selector-mobile .options {
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  width: 100%;
  min-width: 0;
  max-height: min(320px, 52vh);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1400;
}


.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  z-index: 1290;
}

.mobile-overlay[hidden] {
  display: none !important;
}

/* HERO MÁS COMPACTO SOLO PARA FLASHCARDS */
.flashcards-hero.hero {
  padding: 40px 20px 20px;
  min-height: auto;
}

.flashcards-hero .hero-brand {
  gap: 12px;
}

.flashcards-hero .hero-brand h1 {
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
}

.flashcards-hero .hero-copy {
  font-size: 15px;
  margin-bottom: 8px;
}

.flashcards-hero .intro-card {
  margin-top: 16px;
}

/* PAGE */
.page-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: stretch;
}

.hero-brand,
.hero-side,
.intro-card,
.stats,
.deck-stage {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-brand,
.hero-side,
.intro-card,
.stats,
.deck-stage {
  padding: 24px;
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(34px, 5vw, 54px);
}

.hero-copy,
.section-copy {
  color: var(--muted);
  line-height: 1.65;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}

.score-chip,
.progress-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  text-align: center;
}

.score-chip span,
.progress-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.score-chip strong,
.progress-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.container {
  margin-top: 26px;
  display: grid;
  gap: 28px;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
}

.intro-card h2,
.section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3vw, 34px);
}

/* MAZO */
.deck-stage {
  display: grid;
  gap: 22px;
}

.deck-stack {
  position: relative;
  min-height: 470px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-layer {
  position: absolute;
  width: min(100%, 760px);
  min-height: 420px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.card-layer.card-back {
  pointer-events: none;
}

.card-layer.card-back-1 {
  transform: translateY(10px) scale(0.98);
  opacity: 0.7;
}

.card-layer.card-back-2 {
  transform: translateY(20px) scale(0.96);
  opacity: 0.5;
}

.card-layer.card-back-3 {
  transform: translateY(30px) scale(0.94);
  opacity: 0.35;
}

.card-layer.card-front {
  z-index: 5;
  padding: 28px;
  display: grid;
  gap: 24px;
}

.card-layer.card-finished {
  position: relative;
  max-width: 760px;
  min-height: 300px;
  padding: 28px;
  display: grid;
  align-items: center;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  flex-wrap: wrap;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.card-index {
  color: var(--muted);
  font-size: 14px;
}

.card-word {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  margin: 0;
}

.card-help {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.answer-field {
  display: grid;
  gap: 8px;
}

.answer-field label {
  color: var(--muted);
  font-size: 14px;
}

.answer-field input {
  width: 100%;
  border: 2px solid rgba(203, 213, 225, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.answer-field input::placeholder {
  color: #64748b;
}

.answer-field input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
}

.answer-field input.correct {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
}

.answer-field input.incorrect {
  border-color: #f97316;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  cursor: pointer;
}

.answer-field input.reveal {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  font-weight: 700;
  cursor: pointer;
}

.answer-feedback {
  min-height: 24px;
  color: var(--muted);
}

.answer-feedback.ok {
  color: #22c55e;
}

.answer-feedback.error {
  color: #f97316;
}

/* BOTONES */
.botones {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.botones button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.botones button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* STATS */
.stats.hidden,
.review-section.hidden {
  display: none;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}

.results-grid,
.exercise-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
}

.stat-box h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.stat-box p {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.stats-actions,
.exercise-stats-actions {
  margin-top: 22px;
}

/* REVIEW */
.review-section {
  margin-top: 28px;
}

.review-heading {
  margin-bottom: 16px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.review-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  cursor: default;
}

.review-item.correct {
  border-color: rgba(34, 197, 94, 0.5);
}

.review-item.incorrect {
  border-color: rgba(249, 115, 22, 0.55);
  cursor: pointer;
}

.review-item.incorrect:hover {
  background: rgba(255, 255, 255, 0.05);
}

.review-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.review-number {
  color: var(--muted);
  font-size: 13px;
}

.review-word {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.review-meaning {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.review-answers {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.review-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  align-items: center;
}

.review-label {
  color: var(--muted);
  font-size: 12px;
}

.review-value {
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.92rem;
  line-height: 1.3;
  word-break: break-word;
}

.review-value.good {
  border-color: rgba(34, 197, 94, 0.5);
  color: #22c55e;
}

.review-value.bad {
  border-color: rgba(249, 115, 22, 0.55);
  color: #f97316;
}

.review-value.reveal {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.card-layer.card-front.is-leaving {
  opacity: 0;
  transform: translateX(80px) rotate(4deg) scale(0.98);
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .results-grid,
  .exercise-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .intro-card {
    flex-direction: column;
    align-items: start;
  }

  .review-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 979px) {
  .navbar-actions {
    display: none;
  }

  .floating-menu-btn {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .floating-menu-btn:not(.visible) {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 980px) {
  .floating-menu-btn,
  .mobile-panel,
  .mobile-overlay {
    display: none !important;
  }

  .site-header.header-hidden {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .flashcards-hero.hero {
    padding: 28px 16px 12px;
  }

  .flashcards-hero .hero-brand h1 {
    font-size: 24px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 22px 16px 80px;
  }

  .results-grid,
  .exercise-stats-grid {
    grid-template-columns: 1fr;
  }

  .deck-stack {
    min-height: 560px;
  }

  .card-layer {
    min-height: 500px;
  }
}

