/* Estilos de la web pública. Estética: prensa en papel, con un acento cálido. */

:root {
  --papel: #f6f1e7;
  --carton: #fffdf8;
  --tinta: #211f1a;
  --tinta-suave: #6f6a5e;
  --acento: #c8502e;
  --acento-texto: #b3431f; /* el acento, con contraste para letra pequeña */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4rem;
}

.tema {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acento);
  border: 1.5px solid var(--acento);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}
.tema:empty { display: none; }

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.12;
  margin: 0.6rem 0 0.35rem;
}

.meta {
  margin: 0;
  color: var(--tinta-suave);
  font-size: 0.95rem;
}

.modo-solucion {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--acento);
}
.modo-solucion:empty { display: none; }

#mensaje {
  display: none;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: #f9e3db;
  border: 2px solid var(--acento);
  border-radius: 10px;
  white-space: pre-wrap;
}
#mensaje.visible { display: block; }

.rejilla {
  display: grid;
  grid-template-columns: repeat(var(--columnas, 7), 1fr);
  gap: 2px;
  width: min(100%, 520px);
  margin-top: 2rem;
  padding: 2px;
  background: var(--tinta);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 7px 7px 0 rgba(33, 31, 26, 0.14);
}

.casilla {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--carton);
  border-radius: 2px;
}
.casilla.negra { background: var(--tinta); }

.numero {
  position: absolute;
  top: 5%;
  left: 8%;
  font-size: clamp(0.5rem, 1.8vw, 0.68rem);
  font-weight: 600;
  color: var(--tinta-suave);
  line-height: 1;
}

.letra {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1rem, 4.5vw, 1.7rem);
}

.pistas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 3rem;
  margin-top: 2.5rem;
}
@media (max-width: 640px) {
  .pistas { grid-template-columns: 1fr; }
}

.pistas h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 3px solid var(--acento);
}

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

.pistas li {
  display: flex;
  gap: 0.6rem;
  padding: 0.38rem 0;
  font-size: 0.95rem;
  border-bottom: 1px dotted rgba(33, 31, 26, 0.2);
}

.pistas .n {
  min-width: 1.6em;
  text-align: right;
  font-weight: 700;
  color: var(--acento);
  font-variant-numeric: tabular-nums;
}

footer {
  margin-top: 3.5rem;
  color: var(--tinta-suave);
  font-size: 0.85rem;
}

/* ——— interacción (jugador) ——— */

[hidden] { display: none !important; }

.rejilla { outline: none; touch-action: manipulation; }
.rejilla:focus-visible { outline: 3px solid rgba(200, 80, 46, 0.55); outline-offset: 3px; }

.casilla {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.casilla.negra { cursor: default; }
.casilla.palabra { background: #f8e7d8; }
.casilla.cursor { outline: 3px solid var(--acento); outline-offset: -3px; }
.casilla.error { background: #f9d9cd; }
.casilla.error .letra { color: var(--acento); }
.casilla.revelada .letra { color: #2e7d4f; }

.controles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  margin-top: 1.75rem;
}
.controles button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--tinta);
  border-radius: 999px;
  background: var(--carton);
  color: var(--tinta);
  cursor: pointer;
}
.controles button:hover { background: #f8e7d8; }
.controles .sutil { border-color: rgba(33, 31, 26, 0.35); color: var(--tinta-suave); }
.revelar-grupo {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tinta-suave);
}

#estado-linea { min-height: 1.2em; margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--tinta-suave); }

#completado {
  display: none;
  margin-top: 1rem;
  padding: 0.9rem 1.25rem;
  background: #2e7d4f;
  color: #fff;
  border-radius: 12px;
  font-weight: 700;
}
#completado.visible { display: block; animation: aparecer 0.35s ease; }
@keyframes aparecer {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ——— barra de pista y teclado en pantalla ——— */

#dock { margin-top: 1.25rem; max-width: 520px; }

#barra-pista {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--carton);
  border: 2px solid var(--tinta);
  border-radius: 12px;
  padding: 0.45rem 0.5rem;
}
#barra-pista button {
  border: none;
  background: none;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--acento);
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
}
#pista-texto { flex: 1; font-size: 0.92rem; line-height: 1.35; }
#pista-numero { font-weight: 700; color: var(--acento); margin-right: 0.4rem; }

#teclado { display: none; margin-top: 0.5rem; }
.fila-teclas { display: flex; gap: 5px; margin-bottom: 6px; }
.fila-teclas button {
  flex: 1;
  height: 46px;
  padding: 0;
  border: 1.5px solid rgba(33, 31, 26, 0.35);
  border-radius: 7px;
  background: var(--carton);
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.fila-teclas button:active { background: #f8e7d8; }
.fila-teclas .ancha { flex: 1.6; font-size: 1.1rem; }

.pistas li { cursor: pointer; border-radius: 6px; }
.pistas li.activa { background: #f8e7d8; }

@media (max-width: 820px) {
  body { padding-bottom: 260px; }
  #dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    margin: 0;
    padding: 0.5rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom));
    background: var(--papel);
    border-top: 2px solid var(--tinta);
    box-shadow: 0 -4px 14px rgba(33, 31, 26, 0.12);
    z-index: 10;
  }
  #teclado { display: block; max-width: 560px; margin: 0.5rem auto 0; }
}

/* ——— portada ——— */

.volver {
  display: inline-block;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tinta-suave);
  text-decoration: none;
}
.volver:hover { color: var(--acento); }

/* La letra de la cabecera y las fichas. Solo la usa la portada: los juegos, también
   los incrustados en un shot, siguen con la suya. Licencia en fuentes/OFL.txt. */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fuentes/newsreader.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fuentes/newsreader-cursiva.woff2") format("woff2");
}

.cabecera-portada { margin-bottom: 1rem; }
.dia {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
  min-height: 1.8rem;
  margin: 0;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--tinta);
  font-size: 0.85rem;
}
.hoy-toca { color: var(--acento-texto); }
.hoy-toca a { color: inherit; font-weight: 700; text-underline-offset: 2px; }
.cabecera-nombre {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
}
.cabecera-portada .logo {
  flex: none;
  width: clamp(40px, 8vw, 56px);
  height: clamp(40px, 8vw, 56px);
  border-radius: 20%;
}
.cabecera-portada h1 {
  margin: 0;
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.lema {
  margin: 0.6rem 0 0;
  padding-bottom: 0.7rem;
  border-bottom: 3px double var(--tinta);
  color: var(--tinta-suave);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.35;
  text-wrap: balance;
}

.fichas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
  align-items: start;
  margin-top: 2rem;
}

.ficha {
  background: var(--carton);
  border: 2px solid var(--tinta);
  border-radius: 14px;
  padding: 1rem 1.1rem 0.7rem;
  box-shadow: 5px 5px 0 rgba(33, 31, 26, 0.16);
}
.ficha-cabecera {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.ficha h2 {
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.1rem;
}
.regla { margin: 0; color: var(--tinta-suave); font-size: 0.85rem; line-height: 1.35; }

/* Cada juego dibujado con su propio lenguaje visual. */
.motivo {
  flex: none;
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--tinta);
  stroke-width: 1.5;
}
.motivo .lleno { fill: var(--acento); stroke: none; }
.motivo .tinta { fill: var(--tinta); stroke: none; }
.motivo .carton { fill: var(--carton); stroke: none; }
.motivo .sobre-papel { fill: var(--carton); }
.motivo .punteado { stroke: var(--tinta-suave); stroke-dasharray: 2 2.4; }
.motivo .anillo { stroke: var(--acento); stroke-width: 2.5; }
.motivo text {
  fill: var(--tinta);
  stroke: none;
  font-size: 9.5px;
  font-weight: 700;
  text-anchor: middle;
}
.motivo text.sobre-lleno { fill: #fff; }

.entrega {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.55rem 0.1rem;
  color: var(--tinta);
  text-decoration: none;
}
.entrega:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
.entrega-texto {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}
.entrega-fecha { font-size: 0.9rem; font-weight: 700; }
.entrega:hover .entrega-fecha { color: var(--acento-texto); }
.entrega-gancho {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  color: var(--tinta-suave);
  font-size: 0.82rem;
  line-height: 1.3;
}
.entrega.destacada {
  padding: 0.7rem 0.8rem;
  background: var(--papel);
  border-radius: 10px;
}
.jugar {
  flex: none;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--acento);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}
.entrega:hover .jugar { background: var(--acento-texto); }
.flecha { flex: none; color: var(--tinta-suave); font-size: 1.2rem; line-height: 1; }

.entregas { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.entregas li + li { border-top: 1px solid rgba(33, 31, 26, 0.12); }

.mas { border-top: 1px solid rgba(33, 31, 26, 0.12); }
.mas summary {
  padding: 0.6rem 0.1rem;
  color: var(--tinta-suave);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.mas summary:hover { color: var(--acento-texto); }
.mas .entregas { margin-top: 0; }

.proximo { margin: 0.45rem 0.1rem 0.35rem; color: var(--tinta-suave); font-size: 0.82rem; }

/* Lo que lleva hecho el lector: forma además de color, como las fichas de Descifra. */
.estado {
  margin-top: 0.25rem;
  padding: 0.08rem 0.55rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.estado.hecho { background: var(--acento); color: #fff; }
.estado.a-medias { border-color: var(--acento-texto); color: var(--acento-texto); }
.estado.fallado { border: 1.5px dotted var(--tinta-suave); color: var(--tinta-suave); }
