/* Página de Puzzles: el puzzle de cualquier día a la izquierda y el calendario de los resueltos a la derecha;
   debajo, los temas (puzzles largos por niveles). */
.doc:has(> .pz) { max-width: none; }  /* a todo el ancho, como Papers */

.pz { max-width: 1180px; margin: 0 auto; padding: 8px 0 60px; }
.pz .k { font: 500 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.pz .k.acc { color: var(--accent-ink); }
.pz-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------- cabecera y cuenta atrás */
.pz-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 22px; }
.pz-head h1 { margin: 18px 0 6px; font-size: 52px; font-weight: 400; line-height: 1.1; }
.pz-head p { margin: 0; max-width: 640px; text-wrap: pretty; font-size: 18.5px; line-height: 1.5; color: var(--ink-2); }
.pz-clock { text-align: right; }
.pz-clock b { display: block; margin-top: 4px; font: 400 44px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--accent-ink); }

/* ------------------------------------------------------------- juego + calendario */
.pz-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: stretch;  /* el calendario, a la altura del juego (Adrián, 2026-11-10) */ }
/* app.css le da grid-area: daily (de la portada); aquí crearía pistas implícitas. */
.pz-main > .daily-slot { grid-area: auto; min-height: 480px; }

/* Día pasado: título con la fecha y, a la derecha, la vuelta a hoy. */
.pz .game-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 0 0 6px; }
.pz .game-head h2 { margin: 0; }
.pz .daily-slot .game-back {
  min-height: 0; padding: 5px 10px; border: 1px solid var(--accent); background: none; color: var(--accent-ink);
  font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.pz .daily-slot .game-back:hover { background: var(--accent); color: var(--card); border-color: var(--accent); }

/* ------------------------------------------------------------- calendario */
.pz-cal { display: flex; flex-direction: column; padding: 16px 18px 14px; border: 1px solid var(--rule); background:
    repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--accent) 5%, transparent) 9px 10px), var(--card); }
.pz-cal-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.pz-cal-head h2 { margin: 0; text-align: center; font: italic 400 26px/1.2 var(--font); }
.pz-arrow { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: none; color: var(--ink-2); cursor: pointer; }
.pz-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.pz-arrow:disabled { opacity: .35; cursor: default; }
.pz-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz-arrow .icon { width: 14px; height: 14px; }

.pz-week, .pz-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pz-week { margin-bottom: 6px; text-align: center; font: 500 10.5px var(--mono); letter-spacing: .14em; color: var(--ink-3); }

.pz-d { position: relative; aspect-ratio: 1; display: grid; place-items: center; margin: 0; padding: 0;
  font: 500 10.5px var(--mono); color: var(--ink-3); background: none; border: 1px dashed var(--line); border-radius: 50%; }
button.pz-d { cursor: pointer; }
button.pz-d:not(.is-sealed):hover { border-style: solid; border-color: var(--accent); color: var(--accent-ink); }
.pz-d:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.pz-d.is-off { border-color: transparent; opacity: .35; }
.pz-d.is-today { border: 1.5px solid var(--accent); color: var(--accent-ink); animation: pz-pulse 2.4s ease-in-out infinite; }
@keyframes pz-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); } }
/* Con hoy elegido basta el aro; el pulso queda para señalar hoy desde un día pasado. */
.pz-d.is-today[aria-current="true"] { animation: none; }

/* Día elegido: aro de tinta alrededor. */
.pz-d[aria-current="true"]::after { content: ""; position: absolute; inset: -4px; border: 1.5px solid var(--ink); border-radius: 50%; pointer-events: none; }
.pz-d[aria-current="true"]:not(.is-sealed) { color: var(--ink); font-weight: 600; }

/* Día resuelto: el sello de lacre, cada uno con su giro. */
.pz-d svg { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); transform: rotate(var(--r, 0deg)); transition: scale .15s; }
.pz-d.is-sealed { border: 0; color: #fff; animation: none; }
.pz-d.is-sealed span { position: relative; font: italic 600 14px var(--font); }
button.pz-d.is-sealed:hover svg { scale: 1.06; }
/* El sello cae al ganar: scale va aparte de transform, así se conserva el giro. */
.pz-d.is-stamping > * { animation: pz-stamp .5s cubic-bezier(.25, .7, .35, 1) backwards; }
.pz-d.is-stamping > span { animation-delay: .08s; }
@keyframes pz-stamp { 0% { opacity: 0; scale: 1.7; } 60% { opacity: 1; scale: .93; } 100% { opacity: 1; scale: 1; } }

.pz-score { display: flex; align-items: center; gap: 8px; margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.pz-score svg { width: 18px; height: 18px; flex: none; }
.pz-score b { margin-left: auto; font: 400 30px/1 var(--font); font-variant-numeric: lining-nums; color: var(--accent-ink); }

/* ------------------------------------------------------------- temas (site/js/themes.js) */
.pz-themes { margin-top: 56px; }
.pz-themes-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.pz-themes-head h2 { margin: 0; font: 400 34px/1.15 var(--font); }
.pz-themes-head p { margin: 0; font-size: 17.5px; font-style: italic; color: var(--ink-2); }

.th { padding-top: 22px; }
.th + .th { margin-top: 40px; border-top: 1px solid var(--line); }
.th-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px 40px; margin-bottom: 18px; }
.th-intro .k, .th-level > .k, .th-built .k { display: block; margin: 0; }
.th-intro h3 { margin: 4px 0 6px; font: italic 400 34px/1.1 var(--font); }
.th-lede { margin: 0; max-width: 70ch; text-wrap: pretty; font-size: 17.5px; line-height: 1.5; color: var(--ink-2); }
.th-lede a { text-underline-offset: 3px; }

/* Niveles: el mismo sello que el calendario; el siguiente por resolver lleva el aro lacre, como hoy. */
.th-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.th-marks { display: flex; align-items: center; list-style: none; margin: 0; padding: 4px; }
.th-marks li { display: flex; align-items: center; }
.th-marks li + li::before { content: ""; width: 16px; border-top: 1px solid var(--line); }
.th-mark { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--ink-3); border-radius: 50%; background: none; color: var(--ink-2); font: 500 11px var(--mono); cursor: pointer; }
.th-mark.is-open { border: 1.5px solid var(--accent); color: var(--accent-ink); }
.th-mark:hover:not(:disabled):not(.is-done) { border-color: var(--accent); color: var(--accent-ink); }
.th-mark:disabled { border-style: dashed; border-color: var(--line); color: var(--ink-3); opacity: .7; cursor: default; }
.th-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.th-mark[aria-current="step"]::after { content: ""; position: absolute; inset: -5px; border: 1.5px solid var(--ink); border-radius: 50%; pointer-events: none; }
.th-mark.is-done { border: 0; color: #fff; }
.th-mark svg { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); transform: rotate(var(--r, 0deg)); transition: scale .15s; }
.th-mark span { position: relative; }
.th-mark.is-done span { font: italic 600 15px var(--font); }
.th-mark.is-done:hover svg { scale: 1.06; }
.th-mark.is-stamping > * { animation: pz-stamp .5s cubic-bezier(.25, .7, .35, 1) backwards; }
.th-mark.is-stamping > span { animation-delay: .08s; }
.th-restart { padding: 2px 0; border: 0; background: none; color: var(--ink-3); cursor: pointer;
  font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; }
.th-restart:hover { color: var(--accent-ink); }
.th-restart:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* El nivel: mismo marco que el recuadro del puzzle diario. */
.th-level { padding: 20px 24px 16px; background: var(--surface); border: 1px solid var(--line); }
.th-level h4 { margin: 4px 0; font: italic 400 28px/1.15 var(--font); outline: none; }
.th-ask { margin: 0 0 18px; max-width: 64ch; text-wrap: pretty; font-size: 18px; line-height: 1.45; color: var(--ink-2); }
.th-work { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.th-bench, .th-out { min-width: 0; }
.th-circ { padding: 14px; background: var(--card); border: 1px solid var(--line); }

/* Circuito: SVG con un botón transparente encima de cada hilo. */
.th-stage { position: relative; margin: 0 auto; }
.th-stage svg { display: block; width: 100%; height: auto; }
.th-wire { position: absolute; left: 0; width: 100%; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.th-stage.is-armed .th-wire:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.th-wire:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.th-stage text { dominant-baseline: central; text-anchor: middle; }
.th-stage .th-w { stroke: var(--ink-2); stroke-width: 1.2; }
.th-stage .th-v { stroke: var(--ink); stroke-width: 1.2; }
.th-stage .th-guide { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 4; }
.th-stage .th-in { font: 400 16px var(--font); fill: var(--ink-2); text-anchor: end; }
.th-stage .th-g rect { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.th-stage .th-g text { font: 500 13px var(--mono); fill: var(--ink); }
.th-stage .th-g.is-acc rect { stroke: var(--accent); }
.th-stage .th-g.is-acc text { font-size: 11px; letter-spacing: .06em; fill: var(--accent-ink); }
.th-stage .th-g.is-fixed rect { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.th-stage .th-g.is-fixed text { font-size: 10.5px; letter-spacing: .08em; fill: var(--ink-3); }
.th-stage .th-tag { font: 500 9px var(--mono); fill: var(--ink-3); }
.th-stage .th-dot { fill: var(--ink); }
.th-stage .th-dot.is-acc { fill: var(--accent); }
.th-stage .th-plus circle { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.th-stage .th-plus path { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.th-stage .th-pick { fill: none; stroke: var(--accent); stroke-width: 1.5; }

.th-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.th-pal { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.th-gate { min-width: 44px; height: 40px; padding: 0 10px; border: 1px solid var(--rule); background: none;
  color: var(--ink); font: 500 13px var(--mono); letter-spacing: .04em; cursor: pointer; }
.th-gate.is-acc { border-color: var(--accent); color: var(--accent-ink); font-size: 11.5px; letter-spacing: .08em; }
.th-gate:hover { border-color: var(--accent); }
.th-gate[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.th-btn { height: 40px; padding: 0 12px; border: 1px solid var(--line); background: none; color: var(--ink-2);
  font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.th-btn:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.th-btn:disabled { opacity: .4; cursor: default; }
.th-gate:focus-visible, .th-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.th-hint { margin: 10px 0 0; min-height: 1.5em; font-size: 15px; font-style: italic; color: var(--ink-3); }

/* Lectura de resultados. */
.th-out-title { display: block; margin: 2px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.th-bars { display: grid; gap: 9px; }
.th-bar { display: grid; grid-template-columns: 3.4em minmax(0, 1fr) 3em; align-items: center; gap: 10px; }
.th-bl, .th-pc { font: 400 13px var(--mono); color: var(--ink-2); }
.th-pc { text-align: right; font-variant-numeric: tabular-nums; }
.th-tr { position: relative; height: 12px; background: var(--card); border: 1px solid var(--line); }
.th-tr i { display: block; height: 100%; background: var(--ink-2); transition: width .25s ease; }
.th-tr b { position: absolute; top: -5px; bottom: -5px; margin-left: -1px; border-left: 2px solid var(--accent); }
.th-bars.is-match .th-tr i { background: var(--accent); }
.th-kets { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 4px 12px; margin: 14px 0 0; }
.th-kets dt { font: 500 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.th-kets dt.is-target::before { content: ""; display: inline-block; height: 10px; margin-right: 6px; border-left: 2px solid var(--accent); vertical-align: -1px; }
.th-kets dd { margin: 0; font-size: 16.5px; color: var(--ink); overflow-wrap: anywhere; }
.th-tab { width: 100%; border-collapse: collapse; font-size: 16px; }
.th-tab th { padding: 0 4px 6px; text-align: left; border-bottom: 1px solid var(--line);
  font: 500 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.th-tab td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: baseline; overflow-wrap: anywhere; }
.th-tab td:first-child { font: 400 13px var(--mono); color: var(--ink-2); }
.th-tab td small { display: block; margin-top: 2px; font: 400 11px var(--mono); color: var(--ink-3); }
.th-tab .th-ok { width: 1.6em; text-align: right; }
.th-tab tr.is-ok td { color: var(--accent-ink); }
.th-status { margin: 10px 0 0; min-height: 1.5em; font-size: 15px; font-style: italic; color: var(--ink-3); }
.th-status.is-ok { color: var(--accent-ink); }

/* Lo construido, y la puerta en que se convierte. */
.th-built { margin-top: 20px; padding: 2px 0 2px 16px; border-left: 2px solid var(--accent); }
.th-built p:not(.k) { margin: 6px 0 0; max-width: 70ch; font-size: 17px; line-height: 1.5; }
.th-chip { display: inline-block; padding: 0 7px; border: 1px solid var(--accent); color: var(--accent-ink);
  font: 500 11px/1.7 var(--mono); letter-spacing: .06em; vertical-align: 1px; }

/* Anterior / siguiente. */
.th-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.th-step { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; max-width: 48%;
  padding: 7px 12px; border: 1px solid var(--line); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.th-step.is-next { align-items: flex-end; text-align: right; border-color: var(--rule); }
.th-step small { font: 500 9.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.th-step em { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: italic 17px var(--font); }
.th-step:hover:not(:disabled) { border-color: var(--accent); }
.th-step:disabled { opacity: .4; cursor: default; }
.th-step.is-blank { visibility: hidden; }
.th-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .pz-d.is-today, .pz-d.is-stamping > *, .th-mark.is-stamping > * { animation: none; }
  .pz-d svg, .th-mark svg, .th-tr i { transition: none; }
}
@media (max-width: 1000px) {
  .pz-main { grid-template-columns: minmax(0, 1fr); }
  .pz-main > .daily-slot { min-height: 0; }
  .pz-cal { max-width: 480px; }
}
@media (max-width: 860px) {
  .th-work { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 760px) {
  .pz-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .pz-head h1 { font-size: 42px; }
  .pz-clock { text-align: left; }
  .th-head { grid-template-columns: minmax(0, 1fr); }
  .th-progress { align-items: flex-start; }
}
@media (max-width: 520px) {
  .pz-head h1 { font-size: 36px; }
  .pz-clock b { font-size: 34px; }
  .pz-cal { padding: 14px 12px 12px; }
  .pz-cal-head h2 { font-size: 22px; }
  .pz-week, .pz-days { gap: 5px; }
  .pz-themes { margin-top: 44px; }
  .pz-themes-head h2 { font-size: 28px; }
  .th-intro h3 { font-size: 28px; }
  .th-lede { font-size: 16.5px; }
  .th-level { padding: 16px 14px 14px; }
  .th-level h4 { font-size: 24px; }
  .th-ask { font-size: 17px; }
  .th-circ { padding: 8px; }
  .th-marks li + li::before { width: 10px; }
}
