/* ==========================================================================
   Letras Encadenadas — style.css
   Identidad: juego casual, morado + amarillo, tipografía redondeada,
   botones grandes, mobile-first. Sin librerías ni fuentes remotas.
   ========================================================================== */

:root {
  --grape: #5b21b6;      /* morado principal */
  --grape-dark: #3b0f7a;
  --grape-2: #7c3aed;
  --violet-soft: #ede9fe;
  --yellow: #ffd60a;     /* amarillo vivo */
  --yellow-dark: #f5b700;
  --pink: #ff5da2;
  --mint: #34d399;
  --ink: #241447;        /* texto oscuro violáceo */
  --ink-soft: #6b5b93;
  --paper: #fbfaff;
  --card: #ffffff;
  --line: #e7e0f5;
  --danger: #e11d48;
  --ok: #059669;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 10px 30px rgba(91, 33, 182, .14);
  --shadow-sm: 0 4px 14px rgba(91, 33, 182, .12);
  --font: "Baloo 2", "Trebuchet MS", "Segoe UI", "Comic Sans MS", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 90% -10%, rgba(124,58,237,.12), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, rgba(255,214,10,.14), transparent 55%),
    var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 18px; }

img { max-width: 100%; height: auto; }

a { color: var(--grape-2); }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251,250,255,.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 3px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 12px; height: 66px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.35rem; text-decoration: none; color: var(--grape);
  letter-spacing: -.02em;
}
.brand .logo {
  font-size: 1.5rem; filter: drop-shadow(0 2px 0 var(--yellow));
}
.brand b { color: var(--grape-2); }
.nav-toggle {
  margin-left: auto; display: none; font-size: 1.5rem; line-height: 1;
  background: var(--yellow); color: var(--ink); border: none;
  border-radius: 12px; padding: 6px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.nav-links { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem;
  padding: 8px 12px; border-radius: 12px;
}
.nav-links a:hover { background: var(--violet-soft); color: var(--grape); }
.nav-links a[aria-current="page"] { background: var(--grape); color: #fff; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 66px;
    flex-direction: column; background: var(--card); padding: 10px 18px 16px;
    border-bottom: 3px solid var(--line); box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 1.05rem; }
}

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 800; font-size: 1.05rem;
  padding: 14px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--yellow); color: var(--ink);
  box-shadow: 0 5px 0 var(--yellow-dark); text-decoration: none;
  transition: transform .06s ease, box-shadow .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--yellow-dark); }
.btn.primary { background: var(--grape); color: #fff; box-shadow: 0 5px 0 var(--grape-dark); }
.btn.primary:active { box-shadow: 0 1px 0 var(--grape-dark); }
.btn.ghost {
  background: transparent; color: var(--grape); box-shadow: none;
  border: 2px solid var(--line);
}
.btn.ghost:active { transform: translateY(2px); }
.btn.small { font-size: .92rem; padding: 10px 16px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 3px solid var(--pink); outline-offset: 2px;
}

/* ---------------- Hero ---------------- */
.hero { padding: 44px 0 10px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--violet-soft); color: var(--grape);
  font-weight: 800; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .05em; padding: 6px 14px; border-radius: 999px;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.08; margin: .5em 0 .3em;
  letter-spacing: -.02em; color: var(--grape-dark);
}
.hero h1 em { color: var(--pink); font-style: normal; }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; margin: 0 0 20px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Panel del juego ---------------- */
.panel {
  background: var(--card); border: 3px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow);
}
.game-section { padding: 8px 0 6px; }

.le-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 14px;
}
.le-head h2 { margin: 0; font-size: 1.4rem; color: var(--grape-dark); }

.le-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  background: var(--violet-soft); border-radius: 14px; padding: 8px 14px;
  text-align: center; min-width: 74px;
}
.stat b { display: block; font-size: 1.35rem; color: var(--grape); line-height: 1; }
.stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; }
.stat.stat--best { background: #fff6cf; }
.stat.stat--best b { color: var(--yellow-dark); }

/* Letra objetivo grande */
.le-target {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--grape), var(--grape-2));
  color: #fff; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px;
}
.le-target .hint-label { font-weight: 700; opacity: .9; }
.le-letter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 16px; flex: 0 0 auto;
  background: var(--yellow); color: var(--grape-dark);
  font-size: 2rem; font-weight: 900; box-shadow: 0 4px 0 var(--yellow-dark);
}
.le-timer-wrap { margin-left: auto; text-align: right; }
.le-timer {
  font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums;
}
.le-timer--low .le-timer { color: var(--yellow); animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

/* Cadena de palabras */
.le-chain {
  list-style: none; margin: 0 0 14px; padding: 8px;
  max-height: 240px; overflow-y: auto;
  background: var(--paper); border: 2px dashed var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 6px;
}
.le-chain:empty::before {
  content: "Aquí aparecerán las palabras de la cadena…";
  color: var(--ink-soft); font-style: italic; padding: 10px; display: block;
}
.le-word {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; font-size: 1.05rem; font-weight: 700;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.le-word--you { background: #eafaf1; align-self: flex-end; }
.le-word--cpu { background: var(--violet-soft); align-self: flex-start; }
.le-word .le-who { font-size: 1.1rem; }
.le-word .le-last {
  color: var(--pink); text-transform: uppercase; padding: 0 2px;
  background: #fff0f7; border-radius: 6px;
}

/* Formulario de entrada */
.le-form { display: flex; gap: 10px; flex-wrap: wrap; }
.le-form input[type="text"] {
  flex: 1 1 200px; min-width: 0;
  font-family: inherit; font-size: 1.2rem; font-weight: 700;
  padding: 14px 18px; border: 3px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink);
}
.le-form input:focus { border-color: var(--grape-2); }
.le-shake { animation: shake .35s; border-color: var(--danger) !important; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.le-msg { min-height: 1.4em; margin: 12px 0 4px; font-weight: 800; }
.le-msg--win { color: var(--ok); }
.le-msg--lose { color: var(--danger); }

.le-controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--line);
}
.le-switch {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer;
  color: var(--ink-soft); font-size: .95rem;
}
.le-note { color: var(--ink-soft); font-size: .85rem; text-align: center; margin: 12px 0 0; }

/* ---------------- Secciones de contenido ---------------- */
main { padding-bottom: 40px; }
section { margin: 34px 0; }
.section-title { margin-bottom: 16px; }
.section-title h2 { font-size: 1.7rem; color: var(--grape-dark); margin: 0; }

h2 { color: var(--grape-dark); letter-spacing: -.01em; }
h3 { color: var(--grape); }

.prose { max-width: 72ch; }
.prose p, .prose li { color: #37275e; font-size: 1.06rem; }
.prose h2 { margin-top: 1.6em; font-size: 1.5rem; }
.prose h3 { margin-top: 1.3em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: .4em 0; }
.lead-in { font-size: 1.2rem; color: var(--ink-soft); }

.card-grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.card {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); transition: transform .12s ease, border-color .12s ease;
}
a.card:hover { transform: translateY(-3px); border-color: var(--grape-2); }
.card .emoji { font-size: 2rem; margin-bottom: 6px; }
.card h3 { margin: 4px 0 6px; }
.card p { margin: 0; color: var(--ink-soft); }

/* Bloque de reglas / pasos numerados */
.steps { list-style: none; counter-reset: step; padding: 0; display: grid; gap: 12px; }
.steps li {
  counter-increment: step; position: relative;
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 16px 62px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grape); color: #fff; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}

/* FAQ */
.faq details {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 4px 18px; margin-bottom: 12px;
}
.faq summary { font-weight: 800; cursor: pointer; padding: 12px 0; color: var(--grape-dark); }
.faq details[open] summary { color: var(--grape); }

/* Banner CTA colorido */
.cta-banner {
  background: linear-gradient(135deg, var(--grape), var(--pink));
  color: #fff; border-radius: var(--radius-lg); padding: 26px; text-align: center;
  box-shadow: var(--shadow);
}
.cta-banner h2 { color: #fff; margin: 0 0 8px; }
.cta-banner p { color: rgba(255,255,255,.92); margin: 0 0 16px; }

/* ---------------- ADSLOT ---------------- */
.adslot {
  margin: 22px 0; min-height: 92px; border: 2px dashed var(--line);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: .82rem; font-weight: 700; background: #fff;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--grape-dark); color: #e9e2ff; margin-top: 40px; padding: 36px 0 16px;
}
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1.4fr 1fr 1fr; }
.site-footer .brand { color: #fff; }
.site-footer .brand b { color: var(--yellow); }
.site-footer p { color: #c9bdf0; font-size: .95rem; }
.site-footer h4 { color: var(--yellow); margin: 0 0 8px; font-size: .95rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin: 6px 0; }
.footer-links a { color: #d9cff7; text-decoration: none; font-size: .95rem; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.copyright {
  border-top: 1px solid rgba(255,255,255,.15); margin-top: 22px; padding-top: 14px;
  color: #b3a4e0; font-size: .82rem;
}
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------------- Cookie banner + toast ---------------- */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  display: none; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 3px solid var(--grape); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.cookie-banner.show { display: flex; }
.cookie-banner p { margin: 0; flex: 1 1 240px; font-size: .9rem; color: var(--ink); }
.cookie-banner .actions { display: flex; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 700; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 70; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Utilidades */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.dim { color: var(--ink-soft); }
.breadcrumb { font-size: .85rem; color: var(--ink-soft); margin: 18px 0 0; }
.breadcrumb a { color: var(--grape-2); text-decoration: none; }
