:root {
  --papel: #f7f1e3;
  --papel-2: #efe6d0;
  --tinta: #26221a;
  --tinta-suave: #6b6353;
  --rojo: #c2452d;
  --verde-ok: #2e7d4f;
  --mal: #c0392b;
  --linea: #d8cdb4;
  --celda: 34px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1200px 400px at 50% -100px, rgba(194,69,45,.06), transparent),
    var(--papel);
  color: var(--tinta);
  font-family: var(--serif);
  line-height: 1.6;
}

/* ---- Cabecera tipo periódico ---- */
.masthead {
  text-align: center;
  padding: 28px 16px 20px;
  border-bottom: 3px double var(--tinta);
}
.masthead-fecha {
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--rojo);
  font-weight: 700;
}
.masthead-titulo {
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  letter-spacing: -.01em;
  line-height: 1.1;
  margin-top: 6px;
}
.masthead-sub {
  color: var(--tinta-suave);
  font-style: italic;
  margin-top: 4px;
  font-size: .95rem;
}

/* ---- Zona de juego ---- */
.zona-juego { max-width: 1080px; margin: 18px auto 0; padding: 0 14px; }
.xc-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.xc-tab {
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  background: transparent; border: 1px solid var(--linea);
  border-radius: 999px; padding: 9px 16px; cursor: pointer;
  color: var(--tinta-suave); transition: all .2s ease;
}
.xc-tab:hover { border-color: var(--tinta); color: var(--tinta); transform: translateY(-1px); }
.xc-tab.activa { background: var(--tinta); color: var(--papel); border-color: var(--tinta); }

.panel-juego {
  display: grid; grid-template-columns: auto minmax(280px, 1fr);
  gap: 24px; margin-top: 16px; align-items: start;
  animation: aparecer .4s ease both;
}
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.barra-estado {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--sans); font-size: .8rem; color: var(--tinta-suave);
  margin-bottom: 10px; gap: 12px;
}
.dato { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dato-progreso { gap: 8px; }
.progreso-pista {
  width: 90px; height: 6px; border-radius: 3px;
  background: var(--papel-2); overflow: hidden; display: inline-block;
}
#progreso-barra {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--rojo), #a33322);
  transition: width .4s ease;
}

/* ---- Rejilla ---- */
.rejilla {
  display: grid; gap: 2px;
  background: var(--tinta);
  border: 3px solid var(--tinta);
  border-radius: 8px; padding: 4px;
  width: max-content; max-width: 100%;
  box-shadow: 0 10px 30px -12px rgba(38,34,26,.45), 0 2px 6px rgba(38,34,26,.15);
}
.xc-negra { width: var(--celda); height: var(--celda); background: var(--tinta); }
.xc-celda { position: relative; width: var(--celda); height: var(--celda); background: var(--papel); }
.xc-num {
  position: absolute; top: 1px; left: 3px;
  font-family: var(--sans); font-size: .55rem; font-weight: 700;
  color: var(--rojo); pointer-events: none; line-height: 1;
}
.xc-input {
  width: 100%; height: 100%; border: 0; background: transparent;
  text-align: center; font-family: var(--serif); font-weight: 700;
  font-size: calc(var(--celda) * .52); text-transform: uppercase;
  color: var(--tinta); outline: none; caret-color: var(--rojo);
  transition: background .15s ease;
}
.xc-input:focus { background: rgba(194,69,45,.14); }
.xc-input.en-pista { background: rgba(194,69,45,.07); }
.xc-input.sel { box-shadow: inset 0 0 0 2px var(--rojo); }
.xc-input.ok { background: rgba(46,125,79,.35) !important; }
.xc-input.mal { background: rgba(192,57,43,.35) !important; }

.pista-actual {
  margin-top: 10px; font-style: italic; font-size: .95rem;
  min-height: 1.6em; color: var(--tinta);
}
.pista-actual::before {
  content: "Pista"; font-family: var(--sans); font-style: normal;
  font-size: .62rem; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--papel);
  background: var(--rojo); border-radius: 3px; padding: 2px 6px;
  margin-right: 8px; vertical-align: 2px;
}

/* ---- Columna de pistas y acciones ---- */
.col-pistas { min-width: 0; }
.acciones { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.acciones button {
  font-family: var(--sans); font-size: .74rem; font-weight: 600;
  padding: 10px 13px; min-height: 44px; border-radius: 8px;
  border: 1px solid var(--linea); background: #fffdf7;
  cursor: pointer; color: var(--tinta);
  transition: all .18s ease; letter-spacing: .02em;
}
.acciones button:hover { border-color: var(--tinta); transform: translateY(-1px); box-shadow: 0 4px 10px -4px rgba(38,34,26,.3); }
.acciones button.primario { background: var(--verde-ok); border-color: var(--verde-ok); color: #fff; }
.acciones button.primario:hover { background: #256741; }
.acciones button.peligro { color: var(--mal); border-color: rgba(192,57,43,.4); }
.tit-pistas {
  font-family: var(--sans); font-size: .72rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--rojo);
  border-bottom: 2px solid var(--tinta); padding-bottom: 4px; margin: 12px 0 6px;
}
.lista-pistas { list-style: none; columns: 2; column-gap: 20px; }
.xc-pista {
  break-inside: avoid; font-size: .88rem; padding: 5px 8px;
  border-radius: 6px; cursor: pointer; transition: background .15s ease;
}
.xc-pista:hover { background: var(--papel-2); }
.xc-pista:focus-visible { outline: 2px solid var(--rojo); }
.xc-pista-num { font-weight: 700; color: var(--rojo); margin-right: 4px; }
.xc-pista.activa { background: rgba(194,69,45,.12); box-shadow: inset 3px 0 0 var(--rojo); }
.xc-pista.hecha { color: var(--tinta-suave); text-decoration: line-through; text-decoration-color: rgba(107,99,83,.5); }

.ayuda-teclado {
  text-align: center; font-family: var(--sans); font-size: .74rem;
  color: var(--tinta-suave); margin-top: 14px;
}

/* ---- Contenido editorial ---- */
.texto { max-width: 720px; margin: 40px auto 0; padding: 0 18px; }
.texto h2 {
  font-size: 1.45rem; margin: 26px 0 10px;
  border-bottom: 1px solid var(--linea); padding-bottom: 6px;
}
.texto p, .texto li { font-size: .98rem; color: #3b362b; }
.texto ol { padding-left: 22px; margin: 10px 0; }
.texto li { margin: 6px 0; }
details {
  border: 1px solid var(--linea); border-radius: 8px;
  background: #fffdf7; padding: 12px 16px; margin: 8px 0;
}
summary { cursor: pointer; font-weight: 700; font-size: .95rem; }
details p { margin-top: 8px; }

.cta-final {
  max-width: 720px; margin: 36px auto; padding: 26px 22px;
  text-align: center; background: var(--tinta); color: var(--papel);
  border-radius: 12px;
}
.cta-final h2 { font-size: 1.4rem; margin-bottom: 6px; }
.cta-final p { color: #cfc7b4; font-size: .95rem; }
.boton-cta {
  display: inline-block; margin-top: 14px; padding: 12px 26px;
  background: var(--rojo); color: #fff; text-decoration: none;
  border-radius: 999px; font-family: var(--sans); font-weight: 600;
  font-size: .85rem; letter-spacing: .05em; transition: all .2s ease;
}
.boton-cta:hover { background: #a33322; transform: translateY(-2px); box-shadow: 0 8px 18px -6px rgba(194,69,45,.6); }

.pie {
  border-top: 3px double var(--tinta); text-align: center;
  padding: 20px 16px 30px; font-family: var(--sans); font-size: .78rem;
  color: var(--tinta-suave);
}
.pie nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.pie a { color: var(--tinta); text-decoration: none; border-bottom: 1px solid var(--linea); }
.pie a:hover { border-color: var(--rojo); color: var(--rojo); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--tinta); color: var(--papel); font-family: var(--sans);
  font-size: .85rem; padding: 11px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50;
  box-shadow: 0 10px 25px -8px rgba(0,0,0,.4);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.exito { background: var(--verde-ok); }
.toast.error { background: var(--mal); }
.toast.aviso { background: #8a6d1f; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  :root { --celda: 30px; }
  .panel-juego { grid-template-columns: 1fr; }
  .col-tablero { display: flex; flex-direction: column; align-items: center; }
  .barra-estado { width: 100%; }
  .lista-pistas { columns: 1; }
}
@media (max-width: 420px) {
  :root { --celda: 26px; }
  .xc-num { font-size: .48rem; left: 2px; }
  .rejilla { gap: 1px; padding: 3px; border-width: 2px; }
}
