/* Prueba Planeta Nueve a pantalla completa (js/p9-test.js): escenario a la izquierda, relato a la derecha. */
html.pt-open { overflow: hidden; }
#p9t {
  position: fixed; inset: 0; margin: 0; padding: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  background: var(--bg); color: var(--ink); border: 0;
}
#p9t::backdrop { background: rgb(11 11 12 / 0.9); }
#p9t .pt-in { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; max-width: 1440px; margin: 0 auto; padding: var(--s-4) var(--gutter) var(--s-4); }

/* Cabecera: dónde, distancia, cerrar */
#p9t .pt-top { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
#p9t .pt-where { flex: 1 1 auto; color: var(--ink-3); min-width: 0; }
#p9t .pt-dist { display: flex; align-items: center; gap: var(--s-1); }
#p9t .pt-dist .label { color: var(--ink-3); margin: 0 var(--s-1); }
#p9t .pt-dist button { min-height: 36px; min-width: 48px; padding: 0 var(--s-2); background: none; border: 1px solid var(--rule-strong); color: var(--ink-2); cursor: pointer; font-size: var(--fs-small); }
#p9t .pt-dist button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: rgb(217 119 75 / 0.14); }
#p9t .pt-x { min-height: 44px; padding: 0; background: none; border: 0; cursor: pointer; font-size: var(--fs-small); color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.3em; }
#p9t .pt-x:hover { color: var(--ink); }

/* Pasos */
#p9t .pt-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); margin: var(--s-3) 0 var(--s-4); }
#p9t .pt-step { position: relative; text-align: left; padding: var(--s-3) 0 var(--s-2); background: none; border: 0; border-top: 2px solid var(--rule-strong); color: var(--ink-3); font: inherit; font-size: var(--fs-small); cursor: pointer; }
#p9t .pt-step .mono { color: var(--ink-3); margin-right: var(--s-1); }
#p9t .pt-step::before { content: ""; position: absolute; left: 0; top: -2px; height: 2px; width: 0; background: var(--accent); transition: width var(--t-base) var(--ease-out); }
#p9t .pt-step.is-done { color: var(--ink-2); }
#p9t .pt-step.is-done::before, #p9t .pt-step[aria-current]::before { width: 100%; }
#p9t .pt-step[aria-current] { color: var(--ink); }
#p9t .pt-step[aria-current] .mono { color: var(--accent); }
#p9t .pt-step:disabled { cursor: default; }

/* Cuerpo */
#p9t .pt-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s-7); min-height: 0; }
#p9t .pt-stage { min-height: 0; overflow: auto; display: grid; align-content: center; gap: var(--s-4); }
#p9t .pt-copy { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: center; gap: var(--s-3); padding-right: var(--s-2); animation: pt-up 500ms var(--ease-out) both; }
#p9t .pt-copy h2 { font-weight: 400; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.6rem); line-height: var(--lh-heading); letter-spacing: -0.01em; }
#p9t .pt-copy p { color: var(--ink-2); max-width: 52ch; }
#p9t .pt-copy b { color: var(--ink); font-weight: 600; }
#p9t .pt-k { color: var(--accent); }
#p9t .pt-hint { color: var(--ink) !important; }
#p9t .pt-small { font-size: var(--fs-small); color: var(--ink-3) !important; }
#p9t .pt-fact { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-4); align-items: center; padding-block: var(--s-3); border-block: 1px solid var(--rule); }
#p9t .pt-fact span:last-child { font-size: var(--fs-small); color: var(--ink-2); }
#p9t .pt-big { font-family: var(--font-serif); font-size: var(--fs-figure); line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
#p9t .pt-big.is-zero { color: var(--ink-3); }
#p9t .pt-cta, #p9t .pt-doc { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4); border: 1px solid var(--accent); background: none; color: var(--ink); font-size: var(--fs-small); cursor: pointer; text-decoration: none; }
#p9t .pt-doc { border-color: var(--rule-strong); color: var(--ink-2); }
#p9t .pt-cta:hover, #p9t .pt-doc:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
#p9t .pt-how summary { cursor: pointer; font-size: var(--fs-small); color: var(--ink-3); list-style: none; }
#p9t .pt-how summary::-webkit-details-marker { display: none; }
#p9t .pt-how summary::after { content: " +"; font-family: var(--font-mono); }
#p9t .pt-how[open] summary::after { content: " −"; }
#p9t .pt-how p { margin-top: var(--s-2); font-size: var(--fs-small); color: var(--ink-3); }

/* Navegación */
#p9t .pt-nav { display: flex; justify-content: space-between; gap: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--rule); }
#p9t .pt-nav button { min-height: 44px; padding: 0 var(--s-4); background: none; border: 1px solid var(--rule-strong); color: var(--ink-2); font-size: var(--fs-small); cursor: pointer; }
#p9t .pt-next { margin-left: auto; border-color: var(--accent) !important; color: var(--ink) !important; }
#p9t .pt-nav button:hover { background: var(--accent); border-color: var(--accent); color: var(--bg) !important; }

/* Espera */
#p9t .pt-wait { position: relative; width: min(320px, 70%); aspect-ratio: 1; justify-self: center; }
#p9t .pt-wait span { position: absolute; inset: 0; border: 1px solid var(--rule-strong); border-radius: 50%; }
#p9t .pt-wait span:nth-child(2) { inset: 22%; }
#p9t .pt-wait span:nth-child(3) { inset: 47%; background: var(--accent); border: 0; box-shadow: 0 0 40px rgb(217 119 75 / 0.6); }
#p9t .pt-wait span:nth-child(1)::after, #p9t .pt-wait span:nth-child(2)::after { content: ""; position: absolute; top: -4px; left: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
#p9t .pt-wait span:nth-child(1) { animation: pt-spin 9s linear infinite; }
#p9t .pt-wait span:nth-child(2) { animation: pt-spin 3s linear infinite; }

/* 1. Órbita */
#p9t .pt-orbit { width: 100%; max-height: 64vh; height: auto; overflow: visible; }
#p9t .pt-orbit text { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
#p9t .pt-orbit .o-sky { stroke: var(--rule-strong); stroke-width: 1px; }
#p9t .pt-orbit .o-star { fill: var(--ink-2); }
#p9t .pt-orbit .o-orb { fill: none; stroke: var(--rule-strong); stroke-width: 1px; stroke-dasharray: 2 4; }
#p9t .pt-orbit .o-arc { fill: none; stroke: var(--ink-2); stroke-width: 2px; }
#p9t .pt-orbit .o-sun { fill: #f3c27a; filter: drop-shadow(0 0 10px rgb(243 194 122 / 0.8)); }
#p9t .pt-orbit .o-l { stroke-width: 1px; stroke-dasharray: 3 3; }
#p9t .pt-orbit .o-la { stroke: var(--ink-3); }
#p9t .pt-orbit .o-lb { stroke: var(--accent); }
#p9t .pt-orbit .o-ea { fill: var(--ink-3); }
#p9t .pt-orbit .o-eb { fill: #7fb2ff; filter: drop-shadow(0 0 6px rgb(127 178 255 / 0.8)); }
#p9t .pt-orbit .o-tl { fill: var(--ink-2); }
#p9t .pt-orbit .o-pl { fill: var(--ink); filter: drop-shadow(0 0 8px rgb(235 232 225 / 0.6)); }
#p9t .pt-orbit .o-sa { fill: none; stroke: var(--ink-3); stroke-width: 1.5px; }
#p9t .pt-orbit .o-sb { fill: none; stroke: var(--accent); stroke-width: 2px; }
#p9t .pt-orbit .o-jump line { stroke: var(--accent); stroke-width: 1.5px; }
#p9t .pt-orbit .o-jump text { fill: var(--accent); font-size: 13px; }
#p9t .pt-orbit .o-jump, #p9t .pt-orbit .o-tb { transition: opacity 400ms var(--ease-out); }
#p9t .pt-orbit .o-note { font-size: 9px; }

/* 2 y 3. Las dos pasadas */
#p9t .pt-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
#p9t .pt-f { margin: 0; display: grid; gap: var(--s-2); }
#p9t .pt-f figcaption { font-size: var(--fs-small); color: var(--ink-2); }
#p9t .pt-f figcaption .label { color: var(--ink-3); margin-right: var(--s-1); }
#p9t .pt-img { position: relative; aspect-ratio: 1; max-height: 56vh; overflow: hidden; border: 1px solid var(--rule-strong); background: var(--surface); }
#p9t .pt-img img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: auto; filter: contrast(1.08); }
#p9t .pt-img .pt-fake.is-in { animation: pt-fade 900ms var(--ease-out) 700ms both; }
#p9t .pt-img svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#p9t .pt-m circle { fill: none; stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; }
#p9t .pt-m text { font-family: var(--font-mono); font-size: 6px; opacity: 0; }
#p9t .pt-hide .pt-m { transform-box: fill-box; transform-origin: center; animation: pt-pop 500ms var(--ease-out) var(--d) both; }
#p9t .pt-m.is-found circle { stroke: var(--accent); }
#p9t .pt-m.is-found text { fill: var(--accent); opacity: 1; }
#p9t .pt-m.is-lost circle { stroke: var(--ink-3); stroke-dasharray: 3 3; }
#p9t .pt-m.is-lost text { fill: var(--ink-3); opacity: 1; }
#p9t .pt-search .pt-m.is-found circle, #p9t .pt-search .pt-m.is-lost circle { animation: pt-mark 400ms var(--ease-out) var(--d) both; }
#p9t .pt-search .pt-m text { animation: pt-fade 300ms var(--ease-out) var(--d) both; }
#p9t .pt-ghost { fill: none; stroke: var(--ink-2); stroke-width: 1.5px; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; animation: pt-fade 600ms var(--ease-out) var(--d) both; }
#p9t .pt-scan { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--accent); box-shadow: 0 0 18px 4px rgb(217 119 75 / 0.55); animation: pt-scan 1.9s var(--ease-in-out) 0.3s both; }
#p9t .pt-out { position: absolute; left: var(--s-2); right: var(--s-2); bottom: var(--s-2); margin: 0; padding: var(--s-1) var(--s-2); background: rgb(11 11 12 / 0.82); font-family: var(--font-mono); font-size: 12px; color: var(--ink); animation: pt-up 500ms var(--ease-out) var(--d) both; }
#p9t .pt-arrow { display: inline-block; color: var(--accent); animation: pt-nudge 1.4s var(--ease-in-out) infinite; }
#p9t .pt-ctl { display: grid; gap: var(--s-2); order: 2; }
#p9t .pt-ctl input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
#p9t .pt-scale { display: flex; justify-content: space-between; color: var(--ink-3); }
#p9t .pt-read { display: flex; align-items: baseline; gap: var(--s-3); margin: var(--s-2) 0 0; font-size: var(--fs-small); color: var(--ink-2); }
#p9t .pt-read .pt-big { font-size: clamp(2rem, 1.4rem + 2vw, 3.2rem); }
#p9t .pt-key { font-family: var(--font-mono); }
#p9t .pt-key.is-found { color: var(--accent); }
#p9t .pt-key.is-lost { color: var(--ink-3); }

/* 4. Veredicto */
#p9t .pt-verdict { width: 100%; height: auto; max-height: 64vh; overflow: visible; }
#p9t .pt-verdict text { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
#p9t .pt-verdict .v-ax { fill: var(--ink-2); }
#p9t .pt-verdict .v-grid { stroke: var(--rule); stroke-width: 1px; }
#p9t .pt-verdict .v-base, #p9t .pt-verdict .v-tick { stroke: var(--rule-strong); stroke-width: 1px; }
#p9t .pt-verdict .v-area { fill: rgb(217 119 75 / 0.16); animation: pt-fade 700ms var(--ease-out) 700ms both; }
#p9t .pt-verdict .v-curve { fill: none; stroke: var(--accent); stroke-width: 2.5px; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: pt-draw 1.2s var(--ease-out) 200ms forwards; }
#p9t .pt-verdict .v-p9 rect { fill: rgb(127 178 255 / 0.1); stroke: rgb(127 178 255 / 0.55); stroke-dasharray: 3 3; }
#p9t .pt-verdict .v-p9 text { fill: #a9c8ff; font-size: 12px; }
#p9t .pt-verdict .v-p9 .v-sub { font-size: 9px; fill: var(--ink-3); }
#p9t .pt-verdict .v-p9 { animation: pt-fade 700ms var(--ease-out) 1.3s both; }
#p9t .pt-verdict .v-lim line { stroke: var(--ink); stroke-width: 1px; }
#p9t .pt-verdict .v-lim text { fill: var(--ink); }
#p9t .pt-verdict .v-lim { animation: pt-fade 500ms var(--ease-out) 1.1s both; }
#p9t .pt-verdict .v-gap path { stroke: var(--ink); stroke-width: 1.5px; marker-end: none; stroke-dasharray: 4 3; }
#p9t .pt-verdict .v-gap text { fill: var(--ink); font-size: 12px; }
#p9t .pt-verdict .v-gap { animation: pt-fade 600ms var(--ease-out) 2.1s both; }
#p9t .pt-verdict .v-ref circle { fill: var(--rule-strong); }
#p9t .pt-verdict .v-ref.is-vis circle { fill: var(--accent); }
#p9t .pt-verdict .v-ref.is-vis text { fill: var(--ink); }
#p9t .pt-verdict .v-ref { animation: pt-fade 500ms var(--ease-out) var(--d) both; }

@keyframes pt-spin { to { transform: rotate(360deg); } }
@keyframes pt-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes pt-fade { from { opacity: 0; } }
@keyframes pt-pop { 0% { opacity: 0; transform: scale(2.4); } 60% { opacity: 1; } 100% { transform: scale(1); } }
@keyframes pt-mark { from { stroke: var(--ink); stroke-dasharray: none; } }
@keyframes pt-scan { from { left: 0; opacity: 1; } 92% { opacity: 1; } to { left: 100%; opacity: 0; } }
@keyframes pt-draw { to { stroke-dashoffset: 0; } }
@keyframes pt-nudge { 50% { transform: translate(calc(var(--dx) * 4px), calc(var(--dy) * 4px)); } }

@media (prefers-reduced-motion: reduce) {
  #p9t *, #p9t *::before, #p9t *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 900px) {
  #p9t .pt-in { grid-template-rows: auto auto auto auto; height: auto; min-height: 100%; }
  #p9t { overflow-y: auto; }
  #p9t .pt-body { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  #p9t .pt-stage, #p9t .pt-copy { overflow: visible; align-content: start; }
  #p9t .pt-steps { gap: var(--s-1); }
  #p9t .pt-step { font-size: var(--fs-label); }
  #p9t .pt-where { flex-basis: 100%; }
  #p9t .pt-nav { position: sticky; bottom: 0; background: var(--bg); padding-bottom: var(--s-3); }
}
@media (max-width: 520px) {
  #p9t .pt-pair { gap: var(--s-2); }
  #p9t .pt-step .mono { display: block; }
  #p9t .pt-out { font-size: 10px; }
}
