/* ==========================================================================
   Arcanista de Sistemas
   Paleta: negro cálido y pardos de la ilustración; el oro se reserva a la
   navegación (esferas) y el azul arcano a la magia y las acciones.
   ========================================================================== */

@font-face {
  font-family: "Grenze Gotisch";
  src: url("/assets/fonts/grenze-gotisch-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Grenze";
  src: url("/assets/fonts/grenze-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Grenze";
  src: url("/assets/fonts/grenze-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Grenze";
  src: url("/assets/fonts/grenze-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Grenze";
  src: url("/assets/fonts/grenze-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --pitch: #0c0a09;
  --soot: #1a1412;
  --umber: #42312b;
  --haze: #b89a82;
  --bone: #eadcc4;
  --gold: #d9a441;
  --gold-hi: #ffe9a6;
  --gold-lo: #7a4a12;
  --arcane: #8fc7ff;
  --arcane-deep: #2f6fd8;

  --font-display: "Grenze Gotisch", "Grenze", Georgia, serif;
  --font-text: "Grenze", Georgia, "Times New Roman", serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  background: var(--pitch);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow: hidden;
  color: var(--bone);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------- Escenario */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip; /* sin contenedor de scroll: enfocar una esfera no desplaza la escena */
  isolation: isolate;
  background: var(--pitch);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.world {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.defs {
  position: absolute;
}

/* Oscurece los bordes del mundo 3D: centra la mirada en el héroe sin coste de GPU */
.vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 78% 72% at 50% 50%, rgba(4, 3, 2, 0) 42%, rgba(4, 3, 2, 0.6) 100%);
}

/* --------------------------------------------------------------- Portada */

.cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  will-change: opacity;
}

.cover > * {
  position: absolute;
}

.cover__base {
  inset: 0;
  background: linear-gradient(180deg, #171312 0%, #2f2725 24%, #4d3f37 50%, #382b25 74%, #120d0b 100%);
}

.cover__haze {
  left: 0;
  top: 0;
  background: url("/assets/hero/cover-haze.webp") center / 100% 100% no-repeat;
  opacity: 0.82;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 22%, transparent 70%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 22%, transparent 70%);
}

.cover__vignette {
  inset: 0;
  background: radial-gradient(
    ellipse 80% 74% at 50% 44%,
    rgba(10, 7, 6, 0) 36%,
    rgba(10, 7, 6, 0.46) 72%,
    rgba(8, 6, 5, 0.9) 100%
  );
}

.cover__motes {
  inset: 0;
  width: 100%;
  height: 100%;
}

.cover__shadow {
  left: 0;
  top: 0;
  background: radial-gradient(
    ellipse 50% 50% at 50% 50%,
    rgba(5, 3, 2, 0.9) 0%,
    rgba(5, 3, 2, 0.55) 40%,
    rgba(5, 3, 2, 0) 72%
  );
}

/* Bruma en primer plano que funde las botas con el suelo */
.mist {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  height: 22%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(12, 9, 8, 0) 0%, rgba(12, 9, 8, 0.5) 52%, rgba(10, 8, 7, 0.95) 100%);
  will-change: opacity;
}

/* Onda de luz de la esfera: crece hasta cubrir la pantalla y se recoge en el héroe */
.bloom {
  position: absolute;
  inset: 0;
  z-index: 16; /* sobre la portada y el mundo; bajo el pergamino, las esferas y el título */
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}

.bloom > * {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  will-change: transform, opacity;
}

.bloom__glow,
.bloom__ring {
  width: 256px;
  height: 256px;
  transform-origin: 50% 50%;
}

.bloom__glow {
  background: radial-gradient(
    circle closest-side,
    #f4faff 0%,
    rgba(206, 230, 255, 0.97) 20%,
    rgba(150, 196, 255, 0.82) 42%,
    rgba(98, 150, 245, 0.46) 66%,
    rgba(70, 116, 226, 0.16) 84%,
    rgba(60, 100, 220, 0) 100%
  );
}

.bloom__ring {
  background: radial-gradient(
    circle closest-side,
    rgba(190, 222, 255, 0) 70%,
    rgba(190, 222, 255, 0.5) 86%,
    rgba(236, 246, 255, 0.85) 92%,
    rgba(150, 196, 255, 0) 100%
  );
}

.bloom__veil {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse 80% 80% at 50% 45%, #f1f8ff 0%, #cfe4ff 55%, #a9c9f7 100%);
}

.bloom.is-calm .bloom__glow,
.bloom.is-calm .bloom__ring {
  display: none;
}

.bloom.is-calm .bloom__veil {
  background: var(--pitch);
}

/* ------------------------------------------------------------- Personaje */

.hero {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  pointer-events: none;
  perspective: 1600px;
  perspective-origin: 52% 46%;
  will-change: transform;
}

.hero__spin {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.hero__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
}

.hero__orb {
  position: absolute;
}

.hero__flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse 62% 52% at 50% 42%, #ffffff 0%, #c6e3ff 34%, #62a6ff 74%, #2f6fd8 100%);
  -webkit-mask: url("/assets/hero/hero-1024.webp") center / 100% 100% no-repeat;
  mask: url("/assets/hero/hero-1024.webp") center / 100% 100% no-repeat;
  will-change: opacity;
}

/* -------------------------------------------------- Conjuros de la portada */

.roles {
  position: absolute;
  inset: 0;
  z-index: 14; /* por delante del personaje, por detrás de las esferas y el título */
  pointer-events: none;
}

.role {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 550;
  font-size: clamp(1.3rem, 3.6vw, 2.2rem);
  line-height: 1;
  color: #dcefff;
  text-shadow:
    0 0 8px rgba(120, 180, 255, 0.95),
    0 0 24px rgba(70, 130, 255, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.85);
  opacity: 0;
  animation: role-rise 3.9s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes role-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.9);
    filter: blur(6px);
    letter-spacing: 0.16em;
  }
  16% {
    opacity: 1;
    filter: blur(0);
    letter-spacing: 0.03em;
  }
  60% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -96px) scale(1.06);
    filter: blur(4px);
    letter-spacing: 0.05em;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- Título */

.title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  padding: 0 1rem calc(0.9rem + var(--safe-b));
  text-align: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.title__heading {
  display: grid;
  justify-items: center;
  margin: 0;
}

/* El nombre: oro labrado en relieve (filtro de luz especular del SVG), inicial
   iluminada en rojo sangre con filete de oro y un rasgo caligráfico debajo */
.title__karre {
  display: block;
  width: clamp(250px, 40vw, 560px);
  height: auto;
  margin-bottom: -0.2em;
  overflow: visible;
}

.title__karre-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 112px;
  letter-spacing: 1px;
  fill: url(#karre-gold);
  stroke: #2e1906;
  stroke-width: 1.4px;
  paint-order: stroke;
}

.title__initial {
  font-size: 146px;
  fill: url(#karre-blood);
  stroke: #e6bd62;
  stroke-width: 2.4px;
}

.title__swash {
  fill: none;
  stroke: url(#karre-line);
  stroke-width: 2.6px;
  stroke-linecap: round;
}

.title__gem {
  fill: #e6bd62;
  stroke: #2e1906;
  stroke-width: 1px;
}

.title__creds {
  display: none; /* solo en pantallas estrechas: en las anchas va a la derecha */
  margin: 0.15rem 0 0;
  font-family: var(--font-text);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: var(--haze);
  text-shadow: 0 1px 3px #000;
}

.title__name {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 5.6vw, 3.7rem);
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-wrap: balance;
  color: #e7b95a;
  background: linear-gradient(180deg, #fff3c4 6%, #f1c865 32%, #b97a22 64%, #ebc266 96%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 22px rgba(255, 140, 50, 0.2));
}

.enter {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  margin: 0;
  padding: 0.35rem 0.9rem 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--bone);
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 1.06rem;
  line-height: 1.2;
  text-shadow: 0 1px 3px #000;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.enter:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
}

.enter__chevrons {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: nudge 1.9s ease-in-out infinite;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(-2px);
    opacity: 0.5;
  }
  50% {
    transform: translateY(4px);
    opacity: 1;
  }
}

/* Versión simple: no se entra al campamento, así que no hay flechas que invitar a bajar */
.stage[data-simple] .enter {
  cursor: default;
}

.stage[data-simple] .enter__chevrons {
  display: none;
}

/* ------------------------------------------------ Portada: guía y oficio */

/* Solo con el ratón o solo con el dedo */
.stage[data-input="touch"] .for-mouse,
.stage[data-input="mouse"] .for-touch {
  display: none;
}

.guide {
  position: absolute;
  z-index: 22;
  top: calc(12px + var(--safe-t));
  left: calc(12px + var(--safe-l, 0px));
  max-width: calc(100% - 24px);
  color: var(--bone);
  font-family: var(--font-text);
}

.guide__toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(234, 220, 196, 0.35);
  border-radius: 50%;
  background: rgba(16, 12, 10, 0.72);
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  touch-action: manipulation;
}

.guide__toggle:focus-visible,
.simple__input:focus-visible + .simple__box {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

/* En pantallas estrechas el panel es una ficha que se abre con «?» */
.guide__panel {
  display: none;
  width: min(330px, calc(100vw - 24px));
  margin-top: 8px;
  padding: 16px 18px 14px;
  border: 1px solid rgba(234, 220, 196, 0.16);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26, 20, 18, 0.9), rgba(12, 10, 9, 0.84));
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.guide.is-open .guide__panel {
  display: block;
}

.guide__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--bone);
}

.guide__title::after {
  content: "";
  display: block;
  width: 70%;
  height: 1px;
  margin-top: 8px;
  background: linear-gradient(90deg, rgba(234, 220, 196, 0.5), rgba(234, 220, 196, 0));
}

.guide__lead {
  margin: 0 0 10px;
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.3;
  color: var(--haze);
}

.guide__list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  line-height: 1.3;
  color: #d8c7ad;
}

.guide__list li {
  position: relative;
  padding-left: 16px;
}

.guide__list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0.18em;
  font-size: 0.6rem;
  color: var(--haze);
}

.guide__list b {
  font-weight: 600;
  color: var(--bone);
}

/* La casilla de la versión simple */
.simple {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(234, 220, 196, 0.12);
  cursor: pointer;
}

.stage[data-simple] .guide__body {
  display: none; /* en la versión simple las instrucciones sobran: queda la casilla */
}

.stage[data-simple] .simple {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.simple__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.simple__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--haze);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
}

.simple__input:checked + .simple__box::after {
  content: "";
  width: 9px;
  height: 5px;
  border: solid var(--bone);
  border-width: 0 0 2px 2px;
  transform: translate(0, -1px) rotate(-45deg);
}

.simple__text {
  display: grid;
  gap: 2px;
  font-size: 1.02rem;
  line-height: 1.2;
  color: var(--bone);
}

.simple__text small {
  font-size: 0.8rem;
  color: var(--haze);
}

/* El oficio: en pantallas estrechas va en una línea bajo el título */
.creds {
  display: none;
}

/* Con sitio a los lados del personaje: la guía a la izquierda y el oficio a la derecha */
@media (min-aspect-ratio: 7/5) {
  .stage[data-layout="wide"] .guide {
    top: 50%;
    left: clamp(20px, 4vw, 72px);
    width: min(310px, calc(50vw - 33vh - 40px));
    transform: translateY(-50%);
  }

  .stage[data-layout="wide"] .guide__toggle {
    display: none;
  }

  .stage[data-layout="wide"] .guide__panel {
    display: block;
    width: auto;
    margin: 0;
    background: linear-gradient(180deg, rgba(26, 20, 18, 0.74), rgba(12, 10, 9, 0.58));
  }

  .stage[data-layout="wide"] .creds {
    position: absolute;
    z-index: 21;
    top: 50%;
    right: clamp(20px, 4vw, 72px);
    display: block;
    width: min(300px, calc(50vw - 33vh - 40px));
    transform: translateY(-50%);
    text-align: right;
    pointer-events: none;
  }

  .stage[data-layout="wide"] .title__creds {
    display: none;
  }
}

.stage[data-layout="compact"] .title__creds {
  display: block;
}

/* En el móvil el título se recoge para no tocar las esferas que orbitan encima */
.stage[data-layout="compact"] .title__karre {
  width: min(215px, 58vw);
}

/* En vertical, el nombre, «Karreflow», va arriba, sobre la cabeza del personaje; el
   resto, abajo (en horizontal no cabe encima: le taparía la cabeza) */
@media (orientation: portrait) {
  .stage[data-layout="compact"] .title {
    top: 0;
    align-content: end;
  }

  .stage[data-layout="compact"] .title__karre {
    position: absolute;
    top: calc(0.9rem + env(safe-area-inset-top, 0px));
    left: 50%;
    width: min(230px, 60vw);
    margin: 0;
    transform: translateX(-50%);
  }
}

.stage[data-layout="compact"] .title__name {
  font-size: clamp(1.45rem, 6.4vw, 1.9rem);
}

/* En dos líneas: los años de experiencia y, debajo, el oficio */
.stage[data-layout="compact"] .title__creds {
  font-size: 0.8rem;
  line-height: 1.35;
}

.stage[data-layout="compact"] .title__years {
  display: block;
}

.stage[data-layout="compact"] .title__sep {
  display: none;
}

.creds__years {
  display: grid;
  justify-items: end;
  margin: 0 0 14px;
  line-height: 1;
}

.creds__more {
  font-family: var(--font-text);
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--haze);
}

.creds__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 7vw, 6.4rem);
  line-height: 0.9;
  background: linear-gradient(180deg, #fbf1dc 8%, #dcc6a2 50%, #9c8062 64%, #e6d3b3 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 18px rgba(255, 190, 120, 0.12));
}

.creds__unit {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--bone);
  text-shadow: 0 1px 3px #000;
}

.creds__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid rgba(234, 220, 196, 0.16);
  list-style: none;
  font-family: var(--font-text);
  font-size: 1.06rem;
  color: #d8c7ad;
  text-shadow: 0 1px 3px #000;
}

.creds__list li {
  position: relative;
  padding-right: 18px;
}

.creds__list li::after {
  content: "✦";
  position: absolute;
  right: 0;
  top: 0.2em;
  font-size: 0.6rem;
  color: var(--haze);
}

/* Con un panel abierto sobre la portada (versión simple), la portada se aparta */
.stage[data-panel] .guide,
.stage[data-panel] .creds,
.stage[data-panel] .title,
.stage[data-panel] .roles {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* --------------------------------------------------------------- Esferas */

.orbs {
  position: static; /* sin contexto de apilamiento: cada esfera se ordena frente al personaje */
}

.orb {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  display: block;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  touch-action: none;
  -webkit-user-drag: none;
  will-change: transform, opacity;
}

.stage:not(.is-ready) .orb {
  visibility: hidden;
}

.orb.is-behind {
  pointer-events: none;
}

.orb__body {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.55));
  transition:
    transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.35),
    filter 0.26s ease;
}

.orb__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.orb__icon {
  fill: #33200a;
}

.orb__icon-hi {
  fill: #fff1bd;
  opacity: 0.5;
}

.orb__dim {
  fill: #080503;
  opacity: var(--dim, 0);
}

.orb__ring {
  stroke: #fff2c0;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.orb__label {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 5px);
  white-space: nowrap;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1;
  color: var(--bone);
  text-shadow:
    0 1px 2px #000,
    0 0 9px rgba(0, 0, 0, 0.85);
  opacity: var(--label, 1);
  pointer-events: none;
  transition: color 0.22s ease;
}

.stage[data-layout="compact"] .orb__label {
  font-size: 1.22rem;
}

@media (hover: hover) {
  .orb:hover .orb__body {
    transform: scale(1.14);
    filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 13px rgba(255, 205, 110, 0.8));
  }
  .orb:hover .orb__ring {
    opacity: 1;
  }
  .orb:hover .orb__label {
    color: var(--gold-hi);
  }
}

.orb:focus-visible .orb__body {
  transform: scale(1.14);
  filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 13px rgba(255, 205, 110, 0.8));
}

.orb:focus-visible .orb__ring {
  opacity: 1;
}

.orb:focus-visible .orb__label {
  color: var(--gold-hi);
  opacity: 1;
}

.orb:active .orb__body {
  transform: scale(0.95);
}

/* ------------------------------------------------------------------- HUD */

.hud {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.45s ease,
    visibility 0s linear 0.45s;
}

.stage[data-mode="game"] .hud {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.hud__banner {
  position: absolute;
  left: 50%;
  top: 23%;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  width: min(92vw, 44rem);
  transform: translate(-50%, 0.5rem);
  text-align: center;
  opacity: 0;
  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
}

.hud__banner.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hud__banner strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 6.4vw, 3.6rem);
  line-height: 1;
  color: #f1c865;
  text-shadow:
    0 2px 2px rgba(0, 0, 0, 0.9),
    0 0 26px rgba(0, 0, 0, 0.9);
}

.hud__banner span {
  font-size: 1.1rem;
  line-height: 1.3;
  text-shadow:
    0 1px 3px #000,
    0 0 14px rgba(0, 0, 0, 0.9);
}

.hud__hint {
  position: absolute;
  left: 50%;
  bottom: calc(1.1rem + var(--safe-b));
  width: max-content;
  max-width: calc(100vw - 14rem);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  line-height: 1.3;
  text-shadow:
    0 1px 3px #000,
    0 0 12px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.hud__hint.is-on {
  opacity: 0.92;
}

/* Cartel de ayuda: aparece si al entrar nadie toca nada en unos segundos. Arriba del
   centro, para no tapar al héroe */
.hud__nudge {
  position: absolute;
  left: 50%;
  top: 30%;
  width: min(520px, calc(100vw - 32px));
  margin: 0;
  padding: 16px 24px;
  border: 1px solid rgba(234, 220, 196, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26, 20, 18, 0.88), rgba(12, 10, 9, 0.8));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  pointer-events: none;
}

.hud__nudge.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Tarjeta «Aptitud desbloqueada»: una placa de pergamino oscuro con la runa en azul */
.unlock {
  position: absolute;
  left: 50%;
  top: 22%;
  width: min(460px, calc(100vw - 32px));
  padding: 16px 22px 18px;
  border: 1px solid rgba(234, 220, 196, 0.25);
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 168, 255, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(26, 20, 18, 0.92), rgba(12, 10, 9, 0.88));
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  color: var(--bone);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  pointer-events: none;
}

.unlock.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
  cursor: pointer;
}

.unlock__over {
  margin: 0;
  font-family: var(--font-text);
  font-size: 0.82rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #8fc7ff;
  text-shadow: 0 0 10px rgba(90, 168, 255, 0.6);
}

.unlock__name {
  margin: 6px 0 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.85rem;
  line-height: 1.05;
  color: var(--bone);
}

.unlock__title {
  margin: 0 0 10px;
  font-style: italic;
  color: var(--haze);
}

.unlock__text {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.35;
  color: #dccbb0;
}

.unlock__xp {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #8fc7ff;
}

.unlock__xp:empty {
  display: none;
}

/* En ventanas estrechas la pista sube para no pisar el botón «Portada» */
.stage[data-layout="compact"] .hud__hint {
  bottom: calc(4.4rem + var(--safe-b));
  max-width: calc(100vw - 2rem);
}

.hud__back {
  position: absolute;
  left: calc(1rem + var(--safe-l));
  bottom: calc(1rem + var(--safe-b));
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem 0.5rem 0.65rem;
  border: 1px solid rgba(217, 164, 65, 0.5);
  border-radius: 999px;
  background: rgba(14, 10, 8, 0.78);
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.hud__back:hover {
  border-color: var(--gold-hi);
  background: rgba(30, 21, 14, 0.9);
}

.hud__back:focus-visible,
.action:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
}

.hud__back svg {
  width: 20px;
  height: 20px;
  fill: var(--gold);
}

.stick,
.actions {
  display: none;
}

/* Controles táctiles: mando a la derecha, acciones a la izquierda */
.stage[data-input="touch"] .hud__hint {
  display: none;
}

.stage[data-input="touch"] .hud__back {
  left: 50%;
  transform: translateX(-50%);
}

.stage[data-input="touch"] .stick {
  position: absolute;
  right: calc(0.9rem + var(--safe-r));
  bottom: calc(1.3rem + var(--safe-b));
  display: block;
  width: 152px;
  height: 152px;
  pointer-events: auto;
  touch-action: none;
}

.stick__base {
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(234, 220, 196, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 14, 10, 0.3) 0%, rgba(20, 14, 10, 0.68) 100%);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s ease;
}

.stick.is-active .stick__base {
  border-color: rgba(234, 220, 196, 0.8);
}

.stick__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #d8c7a8 0%, #8c7558 38%, #3f3024 80%, #1e1610 100%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(255, 240, 210, 0.25);
  will-change: transform;
}

.stage[data-input="touch"] .actions {
  position: absolute;
  left: calc(0.9rem + var(--safe-l));
  bottom: calc(1.3rem + var(--safe-b));
  display: block;
  width: 156px;
  height: 152px;
}

.action {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(143, 199, 255, 0.62);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #2d5596 0%, #172b52 55%, #0a1226 100%);
  color: #d9ecff;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.6),
    inset 0 0 12px rgba(143, 199, 255, 0.25);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  transition:
    transform 0.08s ease,
    filter 0.12s ease;
}

.action svg {
  width: 58%;
  height: 58%;
  fill: currentColor;
}

.action--primary {
  left: 0;
  bottom: 0;
  width: 86px;
  height: 86px;
}

.action--secondary {
  left: 88px;
  bottom: 74px;
  width: 64px;
  height: 64px;
}

.action.is-down {
  transform: scale(0.93);
  filter: brightness(1.35);
}

.action.is-cooling svg {
  opacity: 0.45;
}

/* Con ratón: los dos conjuros como casillas abajo a la derecha, con su tecla y la espera
   del teletransporte a la vista (en táctil son los botones grandes de la izquierda) */
.stage[data-input="mouse"] .actions {
  position: absolute;
  right: calc(1.1rem + var(--safe-r));
  bottom: calc(2rem + var(--safe-b));
  display: flex;
  gap: 16px;
  pointer-events: none;
}

.stage[data-input="mouse"] .action {
  position: relative;
  left: auto;
  bottom: auto;
  width: 50px;
  height: 50px;
  cursor: default;
  pointer-events: none;
}

.action__key {
  display: none;
}

.stage[data-input="mouse"] .action__key {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  display: block;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-text);
  font-size: 0.74rem;
  line-height: 1;
  color: var(--bone);
  text-shadow:
    0 1px 2px #000,
    0 0 6px #000;
}

.action.is-ready {
  animation: action-ready 0.7s ease-out;
}

@keyframes action-ready {
  from {
    box-shadow:
      0 0 0 0 rgba(143, 199, 255, 0.85),
      inset 0 0 12px rgba(143, 199, 255, 0.6);
  }
  to {
    box-shadow:
      0 0 0 16px rgba(143, 199, 255, 0),
      inset 0 0 12px rgba(143, 199, 255, 0.25);
  }
}

.action__cooldown {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(rgba(5, 8, 16, 0.8) var(--cd, 0turn), transparent 0);
  pointer-events: none;
}

/* ------------------------------------------------------------- Pergamino */

.stage[data-panel] .hud {
  opacity: 0;
  visibility: hidden;
}

.scroll {
  position: absolute;
  inset: 0;
  z-index: 18; /* por debajo de las esferas (20+), por encima del mundo */
  display: grid;
  grid-template-rows: minmax(0, 1fr); /* el rollo nunca crece más que la pantalla: la hoja se desplaza por dentro */
  place-items: start center;
  padding: calc(104px + var(--safe-t)) 18px calc(26px + var(--safe-b));
  background: rgba(6, 4, 3, 0.74);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0.35s;
}

.scroll.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.scroll__frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 42rem);
  max-height: 100%;
  padding: 0 34px;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.8));
}

/* Los dos extremos enrollados: cilindros del mismo pergamino */
.scroll__roll {
  position: relative;
  z-index: 2;
  flex: none;
  height: 42px;
  margin: 0 -10px;
  border-radius: 8px;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40'><g fill='none' stroke='%233a240c' stroke-width='2' stroke-linecap='round' opacity='.85'><path d='M100 5v30M100 20c-12-14-30-14-40-4s2 20 12 14M100 20c12-14 30-14 40-4s-2 20-12 14M60 16c-14-8-30-2-36 8M140 16c14-8 30-2 36 8M24 24c-6 2-10 0-12-4M176 24c6 2 10 0 12-4'/><path d='M100 5l-4 6h8zM100 35l-4-6h8z' fill='%233a240c'/></g></svg>") center / 170px 34px no-repeat,
    linear-gradient(90deg, rgba(96, 46, 8, 0.7), rgba(96, 46, 8, 0) 9%, rgba(96, 46, 8, 0) 91%, rgba(96, 46, 8, 0.7)),
    repeating-linear-gradient(94deg, rgba(60, 34, 8, 0) 0 57px, rgba(60, 34, 8, 0.3) 57px 58px, rgba(255, 240, 200, 0.16) 58px 60px, rgba(60, 34, 8, 0) 60px 131px),
    linear-gradient(180deg, rgba(30, 15, 3, 0.82) 0%, rgba(255, 238, 196, 0.1) 14%, rgba(255, 240, 200, 0.4) 27%, rgba(255, 238, 196, 0) 46%, rgba(34, 17, 3, 0.4) 72%, rgba(18, 9, 2, 0.9) 100%),
    #c9ab74 url("/assets/ui/parchment.webp") center / 620px;
  box-shadow:
    inset 0 0 0 1px rgba(30, 16, 4, 0.8),
    0 6px 10px rgba(0, 0, 0, 0.55);
}

/* Casquillos de bronce labrado en los extremos del rollo */
.scroll__roll::before,
.scroll__roll::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 26px;
  height: 52px;
  margin-top: -26px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(20, 12, 3, 0.55) 0 2px, rgba(20, 12, 3, 0) 2px 7px),
    linear-gradient(180deg, #5a3f17 0%, #e9cf8f 22%, #b08a3e 45%, #6b4a18 72%, #2c1c07 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(20, 12, 3, 0.9),
    0 3px 6px rgba(0, 0, 0, 0.6);
}

.scroll__roll::before {
  left: -8px;
}

.scroll__roll::after {
  right: -8px;
}

/* Remates torneados de bronce, acabados en punta */
.scroll__knob {
  position: absolute;
  top: 50%;
  z-index: -1;
  width: 38px;
  height: 30px;
  margin-top: -15px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 68'><defs><linearGradient id='b' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23f3dca0'/><stop offset='.45' stop-color='%23a9802f'/><stop offset='1' stop-color='%23382508'/></linearGradient></defs><g fill='url(%23b)' stroke='%23160d03' stroke-width='2'><rect x='1' y='22' width='16' height='24' rx='2'/><rect x='15' y='14' width='9' height='40' rx='3'/><path d='M24 34c2-22 30-26 40-10 4 6 4 14 0 20-10 16-38 12-40-10z'/><rect x='62' y='24' width='7' height='20' rx='3'/><path d='M69 34c4-9 12-9 22 0-10 9-18 9-22 0z'/></g><path d='M30 34c8-10 22-10 30 0M30 34c8 10 22 10 30 0M45 16v36' fill='none' stroke='%23160d03' stroke-width='1.6' opacity='.7'/></svg>") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6));
}

.scroll__knob--l {
  left: -36px;
  transform: scaleX(-1);
}

.scroll__knob--r {
  right: -36px;
}

@media (min-width: 560px) {
  .scroll {
    padding-left: 34px;
    padding-right: 34px;
  }

  .scroll__roll {
    height: 48px;
  }

  .scroll__roll::before,
  .scroll__roll::after {
    width: 30px;
    height: 60px;
    margin-top: -30px;
  }

  .scroll__knob {
    width: 54px;
    height: 42px;
    margin-top: -21px;
  }

  .scroll__knob--l {
    left: -52px;
  }

  .scroll__knob--r {
    right: -52px;
  }
}

/* El cuerpo crece de 0 a su altura: el rollo de abajo baja al desenrollarse */
.scroll__body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 0fr;
  min-height: 0;
  margin: -16px 0;
  transition: grid-template-rows 0.95s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.scroll.is-open .scroll__body {
  grid-template-rows: 1fr;
}

.scroll__sheet {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: calc(2.1rem + 16px) clamp(1.2rem, 6vw, 3.2rem) calc(1.7rem + 16px);
  color: #2a1a0c;
  /* Pergamino real (papel arrugado) con los bordes oscurecidos por el tiempo */
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g transform='translate(0 0) scale(1 1)' fill='none' stroke='%233a240c' stroke-width='1.8' stroke-linecap='round' opacity='.8'><path d='M8 94C8 52 20 22 62 10'/><path d='M22 54c-13-4-15-19-4-23 9-3 15 5 10 11'/><path d='M44 21c2-13 17-15 21-4 3 9-5 15-11 10'/><path d='M10 76c9 2 15-3 16-11'/><path d='M30 34c-1-9 4-15 12-16'/><path d='M13 72q11-9 19-2-11 7-19 2zM33 31q4-13 15-13-4 11-15 13zM58 11q9-8 19-3-9 8-19 3zM8 92q-5-10 1-18 5 9-1 18z' fill='%233a240c' stroke='none'/><circle cx='70' cy='20' r='2' fill='%233a240c'/><circle cx='20' cy='86' r='1.6' fill='%233a240c'/><circle cx='78' cy='12' r='1.3' fill='%233a240c'/></g></svg>") left 14px top 26px / clamp(64px, 16%, 110px) no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g transform='translate(100 0) scale(-1 1)' fill='none' stroke='%233a240c' stroke-width='1.8' stroke-linecap='round' opacity='.8'><path d='M8 94C8 52 20 22 62 10'/><path d='M22 54c-13-4-15-19-4-23 9-3 15 5 10 11'/><path d='M44 21c2-13 17-15 21-4 3 9-5 15-11 10'/><path d='M10 76c9 2 15-3 16-11'/><path d='M30 34c-1-9 4-15 12-16'/><path d='M13 72q11-9 19-2-11 7-19 2zM33 31q4-13 15-13-4 11-15 13zM58 11q9-8 19-3-9 8-19 3zM8 92q-5-10 1-18 5 9-1 18z' fill='%233a240c' stroke='none'/><circle cx='70' cy='20' r='2' fill='%233a240c'/><circle cx='20' cy='86' r='1.6' fill='%233a240c'/><circle cx='78' cy='12' r='1.3' fill='%233a240c'/></g></svg>") right 14px top 26px / clamp(64px, 16%, 110px) no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g transform='translate(0 100) scale(1 -1)' fill='none' stroke='%233a240c' stroke-width='1.8' stroke-linecap='round' opacity='.8'><path d='M8 94C8 52 20 22 62 10'/><path d='M22 54c-13-4-15-19-4-23 9-3 15 5 10 11'/><path d='M44 21c2-13 17-15 21-4 3 9-5 15-11 10'/><path d='M10 76c9 2 15-3 16-11'/><path d='M30 34c-1-9 4-15 12-16'/><path d='M13 72q11-9 19-2-11 7-19 2zM33 31q4-13 15-13-4 11-15 13zM58 11q9-8 19-3-9 8-19 3zM8 92q-5-10 1-18 5 9-1 18z' fill='%233a240c' stroke='none'/><circle cx='70' cy='20' r='2' fill='%233a240c'/><circle cx='20' cy='86' r='1.6' fill='%233a240c'/><circle cx='78' cy='12' r='1.3' fill='%233a240c'/></g></svg>") left 14px bottom 26px / clamp(64px, 16%, 110px) no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g transform='translate(100 100) scale(-1 -1)' fill='none' stroke='%233a240c' stroke-width='1.8' stroke-linecap='round' opacity='.8'><path d='M8 94C8 52 20 22 62 10'/><path d='M22 54c-13-4-15-19-4-23 9-3 15 5 10 11'/><path d='M44 21c2-13 17-15 21-4 3 9-5 15-11 10'/><path d='M10 76c9 2 15-3 16-11'/><path d='M30 34c-1-9 4-15 12-16'/><path d='M13 72q11-9 19-2-11 7-19 2zM33 31q4-13 15-13-4 11-15 13zM58 11q9-8 19-3-9 8-19 3zM8 92q-5-10 1-18 5 9-1 18z' fill='%233a240c' stroke='none'/><circle cx='70' cy='20' r='2' fill='%233a240c'/><circle cx='20' cy='86' r='1.6' fill='%233a240c'/><circle cx='78' cy='12' r='1.3' fill='%233a240c'/></g></svg>") right 14px bottom 26px / clamp(64px, 16%, 110px) no-repeat,
    radial-gradient(circle 5px at 31% 37%, rgba(112, 56, 12, 0.6) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(circle 3px at 34% 40%, rgba(112, 56, 12, 0.55) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(circle 2px at 29% 41%, rgba(112, 56, 12, 0.5) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(circle 4px at 72% 68%, rgba(112, 56, 12, 0.5) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(circle 2.5px at 75% 71%, rgba(112, 56, 12, 0.5) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(circle 3px at 84% 30%, rgba(112, 56, 12, 0.45) 0 55%, rgba(112, 56, 12, 0) 100%),
    radial-gradient(ellipse 18% 9% at 22% 30%, rgba(150, 84, 20, 0.3), rgba(150, 84, 20, 0) 70%),
    radial-gradient(ellipse 14% 7% at 78% 22%, rgba(150, 84, 20, 0.26), rgba(150, 84, 20, 0) 70%),
    radial-gradient(ellipse 20% 8% at 64% 78%, rgba(150, 84, 20, 0.24), rgba(150, 84, 20, 0) 70%),
    radial-gradient(ellipse 9% 4% at 30% 62%, rgba(120, 60, 12, 0.3), rgba(120, 60, 12, 0) 70%),
    linear-gradient(90deg, rgba(116, 56, 8, 0.78), rgba(116, 56, 8, 0) 10%, rgba(116, 56, 8, 0) 90%, rgba(116, 56, 8, 0.78)),
    radial-gradient(ellipse 120% 90% at 50% 50%, rgba(60, 34, 8, 0) 55%, rgba(52, 28, 6, 0.45) 100%),
    #c9ab74 url("/assets/ui/parchment.webp") center top / 620px;
  /* Sombra que proyectan los rollos sobre la hoja */
  box-shadow:
    inset 0 34px 22px -16px rgba(26, 13, 3, 0.85),
    inset 0 -34px 22px -16px rgba(26, 13, 3, 0.85);
  user-select: text;
  -webkit-user-select: text;
  scrollbar-color: #7a5a2c transparent;
}

.scroll__close {
  position: absolute;
  top: 24px;
  right: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #3a2210;
  cursor: pointer;
  touch-action: manipulation;
}

.scroll__close svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.scroll__close:hover {
  color: #7a1c14;
}

.scroll__title {
  margin: 0 2.4rem 0.2rem 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  line-height: 1;
  color: #3a2008;
}

.scroll__title::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 0.5rem;
  background: linear-gradient(90deg, rgba(74, 44, 12, 0.95), rgba(74, 44, 12, 0));
}

.scroll__lead {
  margin: 0 0 1.2rem;
  font-size: 1.14rem;
  line-height: 1.35;
}

.scroll__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.95rem 1.4rem;
  container-type: inline-size; /* el sello se pone al lado del mensaje solo si cabe de verdad */
}

/* Por defecto, cada parte ocupa la hoja entera (el sello, debajo del mensaje) */
.scroll__form > * {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.field span {
  font-family: var(--font-display);
  font-weight: 550;
  font-size: 1.32rem;
  line-height: 1.1;
  color: #3a2008;
}

.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(58, 34, 12, 0.55);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: rgba(46, 26, 8, 0.1);
  box-shadow: inset 0 2px 5px rgba(40, 22, 6, 0.3);
  color: #24150a;
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 1.18rem;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}

.field textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.field input:focus-visible,
.field textarea:focus-visible,
.scroll__send:focus-visible,
.scroll__close:focus-visible,
.bird:focus-visible {
  outline: 2px solid #7a1c14;
  outline-offset: 2px;
}

/* El sello: un puzle de nueve piezas que hay que recomponer antes de enviar */
.seal {
  display: grid;
  justify-items: start;
  gap: 0.3rem;
  width: min(15rem, 100%, 56vh); /* cabe en móviles estrechos y en apaisado */
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.seal legend {
  padding: 0;
  font-family: var(--font-display);
  font-weight: 550;
  font-size: 1.32rem;
  line-height: 1.1;
  color: #3a2008;
}

.seal__hint {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.3;
}

/* El tablero va impreso en el propio pergamino: sin fondo oscuro, con un filete de tinta */
.seal__board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-top: 0.2rem;
  border: 1.5px solid rgba(58, 34, 12, 0.7);
  border-radius: 2px;
  background: rgba(120, 78, 30, 0.06);
  box-shadow:
    0 0 0 3px rgba(240, 222, 188, 0.35),
    0 0 0 4px rgba(58, 34, 12, 0.35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.4s ease;
}

.seal__tile {
  position: absolute;
  left: 0;
  top: 0;
  width: 33.3334%;
  height: 33.3334%;
  padding: 0;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  background-color: transparent;
  cursor: grab;
  touch-action: none;
  transition:
    transform 0.22s cubic-bezier(0.3, 0.7, 0.2, 1),
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.seal__tile canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply; /* la tinta se funde con el papel */
}

/* El filete de cada pieza va por encima de su dibujo */
.seal__tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(58, 34, 12, 0.55);
  pointer-events: none;
}

.seal__tile.is-picked {
  z-index: 2;
  box-shadow: 0 0 12px rgba(122, 28, 20, 0.45);
}

.seal__tile.is-picked::after {
  box-shadow: inset 0 0 0 3px rgba(122, 28, 20, 0.85);
}

.seal__tile.is-dragging {
  z-index: 3;
  cursor: grabbing;
  transition: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.65);
}

.seal__tile.is-dragging::after {
  box-shadow: inset 0 0 0 2px rgba(122, 28, 20, 0.85);
}

.seal__tile:focus-visible {
  z-index: 2;
  outline: 3px solid #7a1c14;
  outline-offset: -3px;
}

.seal__board.is-solved {
  box-shadow:
    0 0 0 3px rgba(240, 222, 188, 0.35),
    0 0 0 4px rgba(122, 28, 20, 0.6),
    0 0 16px rgba(160, 110, 40, 0.35);
}

.seal__board.is-solved .seal__tile {
  cursor: default;
}

.seal__board.is-solved .seal__tile::after {
  box-shadow: none;
}

/* Si el pergamino es ancho, el sello va junto al mensaje para no alargar la hoja; si no,
   debajo (la consulta mira el ancho del propio formulario, no el de la ventana) */
@container (min-width: 34rem) {
  .scroll__form > .field--message {
    grid-column: 1;
  }

  .scroll__form > .seal {
    grid-column: 2;
  }

  .field--message textarea {
    min-height: 15rem;
  }
}

.scroll__trap {
  position: absolute;
  left: -200vw;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.scroll__status {
  min-height: 1.4em;
  margin: 0;
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.35;
  color: #6b1a12;
}

.scroll__send {
  justify-self: start;
  padding: 0.55rem 1.5rem 0.6rem;
  border: 2px solid #b98a2e;
  border-radius: 3px;
  background: linear-gradient(180deg, #7d1f17 0%, #4a0e0a 100%);
  color: #f4d98a;
  text-shadow: 0 1px 0 #000;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.42rem;
  line-height: 1;
  box-shadow: 0 3px 0 #2a0705;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    filter 0.15s ease;
}

.scroll__send:hover {
  filter: brightness(1.12);
}

.scroll__send:disabled {
  filter: grayscale(0.7) brightness(0.8);
  cursor: wait;
}

.scroll__send:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #2a0705;
}

.scroll__birds {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 2px solid rgba(58, 34, 12, 0.4);
}

/* En móviles estrechos los cuatro rótulos no caben en fila: dos y dos */
@media (max-width: 430px) {
  .scroll__birds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0.9rem;
  }
}

.bird {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.1rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #2a1a0c;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.18s ease,
    color 0.18s ease;
}

.bird svg {
  width: clamp(44px, 12vw, 64px);
  height: clamp(44px, 12vw, 64px);
  fill: currentColor;
}

.bird:not(:disabled):hover {
  color: #7a1c14;
  transform: translateY(-3px);
}

.bird:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .scroll__body,
  .seal__tile {
    transition: none;
  }
}

/* ------------------------------------------------------------ Accesorios */

.noscript {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 100;
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--soot);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .enter__chevrons {
    animation: none;
  }
  .orb__body,
  .hud__banner {
    transition: none;
  }
}

/* ------------------------------------------------- Zonas: fundido e indicaciones */

.fade {
  position: absolute;
  inset: 0;
  z-index: 15; /* tapa el mundo y la portada; por debajo de esferas, pergaminos e interfaz */
  background: #040302;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.42s ease;
}

.fade.is-on {
  opacity: 1;
}

.hud__prompt {
  position: absolute;
  left: 50%;
  bottom: calc(76px + var(--safe-b));
  margin: 0;
  padding: 0.4rem 0.95rem 0.45rem;
  border: 1px solid rgba(217, 164, 65, 0.6);
  border-radius: 4px;
  background: rgba(12, 9, 7, 0.82);
  color: var(--bone);
  font-family: var(--font-text);
  font-size: 1.02rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

.hud__prompt.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hud__prompt kbd {
  margin-right: 0.3em;
  padding: 0 0.4em;
  border: 1px solid rgba(217, 164, 65, 0.75);
  border-radius: 3px;
  color: var(--gold);
  font-family: inherit;
}

.stage[data-input="touch"] .hud__prompt {
  left: calc(18px + var(--safe-l));
  bottom: calc(176px + var(--safe-b));
  transform: translateY(8px);
}

.stage[data-input="touch"] .hud__prompt.is-on {
  transform: none;
}

.action.is-context {
  box-shadow:
    0 0 0 3px rgba(240, 199, 90, 0.85),
    0 0 20px rgba(240, 199, 90, 0.55);
}

/* ------------------------------------------------- Cuaderno de la crónica (Bio) */

/* Cerrado no debe ocupar sitio: su `display` anularía el atributo `hidden` y,
   aunque invisible, se quedaría con los clics del juego. */
.book[hidden] {
  display: none;
}

.book {
  position: absolute;
  inset: 0;
  z-index: 18; /* por debajo de las esferas (20+), por encima del mundo */
  display: grid;
  place-items: center;
  padding: calc(96px + var(--safe-t)) 12px calc(14px + var(--safe-b));
  overflow: hidden;
  background: radial-gradient(ellipse 70% 70% at 50% 55%, rgba(10, 7, 5, 0.55), rgba(4, 3, 2, 0.9));
  opacity: 0;
  transition: opacity 0.35s ease;
}

.book.is-open {
  opacity: 1;
}

.book__source {
  display: none;
}

.book__frame {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  transform: translateY(26px) scale(0.94);
  transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.book.is-open .book__frame {
  transform: none;
}

.book__volume {
  --page-w: min(400px, calc((100vw - 190px) / 2), calc((100vh - 250px) * 0.72));
  --page-h: calc(var(--page-w) / 0.72);
  position: relative;
  width: calc(var(--page-w) * 2);
  height: var(--page-h);
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
}

.book--single .book__volume {
  --page-w: min(390px, calc(100vw - 70px), calc((100vh - 260px) * 0.72));
  width: var(--page-w);
}

.book__right {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  perspective: 2600px;
}

.book--single .book__right {
  left: 0;
  width: 100%;
}

/* Cuero de las tapas: granate oscuro, con su grano y un hilo dorado gofrado */
.book__board,
.leaf--cover .leaf__face--front {
  background:
    radial-gradient(ellipse 70% 60% at 35% 30%, rgba(255, 210, 150, 0.09), rgba(0, 0, 0, 0) 70%),
    repeating-linear-gradient(37deg, rgba(0, 0, 0, 0.05) 0 2px, rgba(255, 255, 255, 0.02) 2px 4px),
    radial-gradient(ellipse 120% 120% at 50% 50%, #5a1e17 30%, #3a120e 100%);
}

.book__board {
  position: absolute;
  inset: -9px -11px -9px -3px;
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.7),
    inset 0 0 0 2px rgba(0, 0, 0, 0.45),
    inset 0 0 0 6px rgba(170, 128, 58, 0.3);
}

/* Guardas: el papel viejo pegado por dentro de las tapas, tostado y manchado, con las
   vueltas del cuero alrededor y el pliegue del lomo (imagen de scripts/build_endpaper.py,
   con la proporción de la hoja). La delantera tiene el lomo a la derecha; la trasera es
   la misma imagen en espejo. */
.book__endpaper {
  position: absolute;
  inset: 0;
  background: #a17645 url("/assets/bio/guarda.webp") center / 100% 100% no-repeat;
}

.book__endpaper--back {
  transform: scaleX(-1);
}

.leaf {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.leaf.is-turned {
  transform: rotateY(-180deg);
}

.leaf.is-gone {
  visibility: hidden;
}

.leaf__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.leaf__face--back {
  transform: rotateY(180deg);
}

.leaf--cover .leaf__face--front {
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    inset 0 0 0 10px rgba(0, 0, 0, 0),
    inset 0 0 0 11px rgba(214, 170, 84, 0.55),
    inset 0 0 0 16px rgba(0, 0, 0, 0),
    inset 0 0 0 17px rgba(214, 170, 84, 0.3),
    inset 6px 0 14px rgba(0, 0, 0, 0.55);
}

.leaf--cover .leaf__face--back {
  border-radius: 8px 2px 2px 8px;
}

.leaf--page .leaf__face {
  inset: 5px 7px 5px 0;
  background: #d9c59b url("/assets/ui/parchment.webp") center / cover;
}

/* Pliegue junto al lomo y bordes oscurecidos por el tiempo */
.leaf--page .leaf__face::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(60, 36, 12, 0.4), rgba(60, 36, 12, 0) 9%),
    radial-gradient(ellipse 85% 80% at 55% 50%, rgba(80, 50, 20, 0) 60%, rgba(80, 50, 20, 0.35) 100%);
}

.leaf--page .leaf__face--back::before {
  background:
    linear-gradient(270deg, rgba(60, 36, 12, 0.4), rgba(60, 36, 12, 0) 9%),
    radial-gradient(ellipse 85% 80% at 45% 50%, rgba(80, 50, 20, 0) 60%, rgba(80, 50, 20, 0.35) 100%);
}

/* Sombra que cruza la hoja mientras gira */
.leaf.is-turning .leaf__face::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  animation: leaf-shade 0.72s ease-in-out;
}

@keyframes leaf-shade {
  50% {
    opacity: 1;
  }
}

/* La tapa delantera: título, emblema del infinito e iniciales */
.book__cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: calc(var(--page-w) * 0.05);
  color: #d4ae5c;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.7),
    0 0 10px rgba(214, 170, 84, 0.25);
}

.book__cover-title {
  font-family: var(--font-display);
  font-size: calc(var(--page-w) * 0.14);
  line-height: 1;
}

.book__cover-emblem {
  display: grid;
  place-items: center;
  width: calc(var(--page-w) * 0.2);
  height: calc(var(--page-w) * 0.2);
  border: 2px solid rgba(214, 170, 84, 0.7);
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0), inset 0 0 0 5px rgba(214, 170, 84, 0.35);
}

.book__cover-emblem span {
  transform: rotate(-45deg);
  font-size: calc(var(--page-w) * 0.12);
  line-height: 1;
}

.book__cover-name {
  font-family: var(--font-display);
  font-size: calc(var(--page-w) * 0.06);
  letter-spacing: 0.2em;
}

/* Pestañas de colores en el canto: cada una abre el cuaderno por su parte */
.book__tabs {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 100%;
  display: grid;
  gap: 6px;
}

.book__tab {
  width: 96px;
  padding: 0.42rem 0.5rem 0.42rem 1.2rem;
  border: 0;
  border-radius: 0 6px 6px 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.15)),
    var(--tab);
  color: #ecdcb6;
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-align: left;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transform: translateX(-14px);
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.book__tab:hover,
.book__tab.is-current {
  transform: translateX(0);
  filter: brightness(1.15);
}

.book__tab:focus-visible,
.book__turn:focus-visible,
.book__close:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

.book--single .book__tabs {
  top: 12px;
  gap: 4px;
}

.book--single .book__tab {
  width: 30px;
  padding: 0.55rem 0.2rem 0.55rem 0.42rem;
  font-size: 0.74rem;
  writing-mode: vertical-rl;
  text-align: center;
  transform: translateX(-8px);
}

.book--single .book__tab:hover,
.book--single .book__tab.is-current {
  transform: translateX(0);
}

/* Cinta de seda que asoma por abajo */
.book__ribbon {
  position: absolute;
  z-index: 0;
  left: calc(50% + 38px);
  bottom: -54px;
  width: 14px;
  height: 72px;
  background: linear-gradient(90deg, #5a0f0b, #8a1d16 50%, #5a0f0b);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}

.book--single .book__ribbon {
  left: 38px;
}

.book__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 30px;
  color: var(--bone);
  font-family: var(--font-text);
  font-size: 1rem;
}

.book__folio {
  min-width: 10.5em;
  text-align: center;
}

.book__turn,
.book__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(217, 164, 65, 0.6);
  border-radius: 50%;
  background: rgba(20, 14, 10, 0.85);
  color: var(--gold);
  cursor: pointer;
  touch-action: manipulation;
}

.book__turn svg,
.book__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.book__turn:disabled {
  opacity: 0.35;
  cursor: default;
}

.book__close {
  position: absolute;
  z-index: 3;
  top: -54px;
  right: 0;
}

/* Las páginas */
.page {
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 9% 10% 11%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  color: #2b1a0b;
  font-family: var(--font-text);
  font-size: clamp(13.5px, calc(var(--page-w) * 0.041), 16.5px);
  line-height: 1.45;
}

.page p {
  margin: 0 0 0.75em;
}

.page::after {
  content: attr(data-folio);
  display: block;
  margin-top: 0.4em;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.9em;
  color: rgba(60, 36, 12, 0.6);
}

.page--blank::after {
  content: none;
}

.page__title {
  margin: 0 0 0.85em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid rgba(110, 29, 20, 0.35);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.32em;
  line-height: 1.1;
  color: #6e1d14;
}

.page__title span {
  display: inline-block;
  margin-right: 0.45em;
  color: #8a6420;
}

.initial {
  float: left;
  margin: 0.04em 0.12em 0 0;
  font-family: var(--font-display);
  font-size: 3.3em;
  line-height: 0.85;
  color: #7a1c14;
  text-shadow: 1px 1px 0 rgba(214, 170, 84, 0.65);
}

.page--title {
  display: grid;
  /* El retrato se queda con todo el alto que deja el texto (entre el 35 y el 40 % de la hoja) */
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  justify-items: center;
  align-content: center;
  padding-top: 6%;
  text-align: center;
}

/* `.page p` pesa más que las clases sueltas: aquí se fijan los márgenes de la portada */
.page--title .page__over {
  margin: 0 0 0.3em;
}

.page--title .page__born {
  margin: 0.35em 0 0.2em;
}

.page--title .page__motto {
  margin: 0.15em 0 0;
}

.page__over {
  margin: 0 0 0.3em;
  font-family: var(--font-display);
  color: #6e1d14;
  letter-spacing: 0.03em;
}

.page__portrait {
  display: block;
  width: auto;
  height: calc(100% - 0.55em); /* 0.55em: sus márgenes */
  max-width: 84%;
  object-fit: contain;
  margin: 0.1em 0 0.45em;
  mix-blend-mode: multiply;
  filter: sepia(0.2) contrast(1.05);
}

.page__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.62em;
  line-height: 1.05;
  color: #2b1a0b;
}

.page__born {
  margin: 0.35em 0 0.2em;
  font-size: 0.92em;
}

.page__motto {
  margin: 0.15em 0 0;
  font-style: italic;
  color: #6e1d14;
}

.page ul {
  margin: 0 0 0.8em;
  padding: 0;
  list-style: none;
}

.page__route li,
.page__notes li {
  position: relative;
  margin-bottom: 0.5em;
  padding-left: 1.3em;
}

.page__route li::before,
.page__notes li::before {
  position: absolute;
  left: 0;
  color: #8a6420;
}

.page__route li::before {
  content: "✦";
}

.page__notes li {
  margin-bottom: 0.75em;
}

.page__notes li::before {
  content: "❦";
  color: #6e1d14;
}

/* Página de los caminos: la lista algo más prieta para que quepan las banderas */
.page--caminos .page__route li {
  margin-bottom: 0.28em;
}

.page .page__more {
  margin-bottom: 0.4em;
}

.page .page__label {
  margin: 0 0 0.3em;
  font-family: var(--font-display);
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a6420;
}

/* Países visitados: banderas en color, pero gastadas, como sellos pegados en el papel.
   El sepia y el multiplicar las entonan con el pergamino; el grano y el borde tostado
   las envejecen. */
.page__flags {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.36em 0.5em;
  margin: 0 0 0.7em;
}

.page__flags li {
  position: relative;
  border-radius: 1.5px;
  transform: rotate(-0.8deg);
}

.page__flags li:nth-child(3n) {
  transform: rotate(1.1deg);
}

.page__flags li:nth-child(4n + 2) {
  transform: rotate(0.3deg);
}

.page__flags svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: 1.5px;
  filter: sepia(0.42) saturate(0.68) contrast(0.9) brightness(0.97);
  mix-blend-mode: multiply;
  opacity: 0.86;
  box-shadow:
    0 0 0 0.6px rgba(60, 36, 12, 0.5),
    0.6px 0.8px 1.2px rgba(60, 36, 12, 0.25);
}

.page__flags li:nth-child(5n + 1) svg {
  opacity: 0.78;
}

.page__flags li::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1.5px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='60'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.32 0 0 0 0 0.22 0 0 0 0 0.1 0 0 0 0.9 -0.18'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E")
      0 0 / 100% 100%,
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 52%, rgba(92, 58, 22, 0.42) 100%);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.page__route strong {
  font-family: var(--font-display);
  font-weight: 600;
  color: #6e1d14;
}

.page__creed {
  font-style: italic;
}

.page--quote {
  display: grid;
  align-content: center;
  text-align: center;
}

.page--quote .page__title {
  text-align: left;
}

.page--quote blockquote {
  margin: 0 0 1em;
  font-size: 1.12em;
  font-style: italic;
}

.page--quote footer {
  margin-top: 0.6em;
  font-family: var(--font-display);
  font-style: normal;
  color: #6e1d14;
}

.page--quote footer::before {
  content: "— ";
}

/* Sello de lacre con el ∞ (imagen de scripts/build_seal.py, que ya trae su sombra sobre
   el papel). El lacre llena el 92 % del cuadro. */
.page__seal {
  width: 6.5em;
  aspect-ratio: 1;
  margin: 0.1em auto 0;
  background: url("/assets/bio/sello-cera.webp") center / contain no-repeat;
}

/* En ventanas bajas de escritorio (1920×1080 al 150 %, por ejemplo) la letra se queda en
   su mínimo (13,5 px) mientras la página sigue encogiendo: el sello cede para que la
   página VII no saque barra. */
@media (max-height: 640px) and (min-width: 768px) {
  .page__seal {
    width: 5.25em;
  }
}

.page--exlibris {
  display: grid;
  align-content: center;
  text-align: center;
}

.page__exlibris {
  font-family: var(--font-display);
  font-size: 1.8em;
  color: #6e1d14;
}

@media (prefers-reduced-motion: reduce) {
  .leaf,
  .book__frame,
  .fade {
    transition: none;
  }
}

/* ------------------------------------------------------------- Habilidades */
/* La ventana mágica que proyecta el grimorio en primera persona: un arco apuntado de luz
   azul, un velo de niebla y texto que flota; el mundo se sigue viendo detrás. Primero, las ramas
   en dos columnas, que se iluminan al pasar por encima; al elegir una, todo se
   desvanece, las ramas suben a una barra como el menú de una web y aparece la elegida
   con su icono animado y sus saberes. Abajo queda sitio para el grimorio. */

.arcane {
  position: absolute;
  inset: 0;
  z-index: 18; /* por debajo de las esferas (20+), por encima del mundo */
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: start center;
  padding: calc(clamp(92px, 14vh, 132px) + var(--safe-t)) 16px clamp(120px, 25vh, 230px);
  pointer-events: none;
  perspective: 1100px;
}

.arcane[hidden] {
  display: none;
}

.arcane__frame {
  --line: #7cc4ff;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: 100%; /* el marco no se desplaza: lo hace .arcane__scroll, por dentro */
  color: #e2edff;
  font-family: var(--font-text);
  text-shadow:
    0 0 8px rgba(100, 160, 255, 0.7),
    0 0 1px rgba(200, 225, 255, 0.85);
  background: radial-gradient(ellipse 72% 64% at 50% 44%, rgba(14, 32, 72, 0.4), rgba(8, 18, 40, 0.16) 68%, rgba(0, 0, 0, 0));
  pointer-events: auto;
  /* Nace del grimorio: sube desde abajo, desplegándose de pie a clave */
  opacity: 0;
  transform: translateY(46px) scale(0.92, 0.6);
  transform-origin: 50% 100%;
  clip-path: inset(100% -40px -40px -40px);
  transition:
    opacity 0.6s ease,
    transform 1s cubic-bezier(0.2, 0.8, 0.2, 1),
    clip-path 1.2s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.arcane.is-open .arcane__frame {
  opacity: 1;
  transform: none;
  clip-path: inset(-40px -40px -40px -40px);
  animation: arcane-float 7s ease-in-out 1.3s infinite;
}

@keyframes arcane-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* El marco: un arco apuntado de luz, como una ventana gótica, con el ∞ en la clave; los
   lados y el pie, de la misma luz, con un rombo en el centro del pie. La luz respira. */
.arcane__arch {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 48px;
  overflow: visible;
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(84, 168, 255, 0.95));
  pointer-events: none;
  animation: arcane-breathe 4.5s ease-in-out infinite;
}

.arcane__arch path {
  vector-effect: non-scaling-stroke;
}

.arcane__frame::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 47px;
  /* Los lados siguen justo al trazo del arco (x = 1 de 200 en su viewBox): sin escalón
     en la unión, sea cual sea el ancho */
  left: calc(0.5% - 0.75px);
  right: calc(0.5% - 0.75px);
  bottom: 0;
  border: 1.5px solid var(--line);
  border-top: 0;
  border-radius: 0 0 26px 26px; /* el pie, redondeado: nada de esquinas de pantalla */
  box-shadow:
    0 0 6px rgba(84, 168, 255, 0.55),
    inset 0 0 6px rgba(84, 168, 255, 0.3);
  pointer-events: none;
  animation: arcane-breathe 4.5s ease-in-out infinite;
}

.arcane__frame::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: -5px;
  width: 9px;
  height: 9px;
  margin-left: -5px;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  background: #0c1a30;
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(84, 168, 255, 0.9);
  pointer-events: none;
}

.arcane__sigil {
  position: absolute;
  z-index: 2;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1;
  color: #eef6ff;
  text-shadow:
    0 0 10px rgba(84, 168, 255, 1),
    0 0 2px #fff;
  pointer-events: none;
}

@keyframes arcane-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.62;
  }
}

/* Un velo de niebla azulada que deriva despacio y motas de luz que suben: la magia que
   sostiene la ventana (no tapa: el mundo se sigue viendo detrás) */
.arcane__veil {
  position: absolute;
  z-index: 0;
  inset: 24px 0 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

.arcane__veil::before {
  content: "";
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(closest-side at 30% 38%, rgba(130, 180, 255, 0.16), rgba(130, 180, 255, 0.05) 60%, transparent),
    radial-gradient(closest-side at 72% 58%, rgba(110, 160, 240, 0.12), rgba(110, 160, 240, 0.04) 60%, transparent),
    radial-gradient(closest-side at 50% 82%, rgba(150, 195, 255, 0.1), rgba(150, 195, 255, 0.03) 60%, transparent);
  /* sin desenfoque: la capa se pinta una vez y el compositor solo la mueve */
  will-change: transform;
  animation: arcane-mist 16s ease-in-out infinite alternate;
}

/* Motas que suben, en dos capas a distinto paso. Se mueven con transform (sin repintar):
   cada capa sube justo una tesela por vuelta y el velo recorta lo que sobra. */
.arcane__veil::after,
.arcane__motes {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(100% + 170px);
  background-image: radial-gradient(circle, rgba(210, 230, 255, 0.85) 0 1px, transparent 1.7px);
  background-size: 150px 170px;
  opacity: 0.45;
  will-change: transform;
  animation: arcane-motes 16s linear infinite;
}

.arcane__motes {
  height: calc(100% + 113px);
  background-image: radial-gradient(circle, rgba(170, 210, 255, 0.6) 0 1px, transparent 1.7px);
  background-size: 97px 113px;
  background-position: 40px 60px;
  animation-name: arcane-motes-near;
}

@keyframes arcane-mist {
  from {
    transform: translate(-4%, 2%) rotate(0deg);
  }
  to {
    transform: translate(4%, -3%) rotate(7deg);
  }
}

@keyframes arcane-motes {
  to {
    transform: translateY(-170px);
  }
}

@keyframes arcane-motes-near {
  to {
    transform: translateY(-113px);
  }
}

.arcane__scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 196, 255, 0.45) transparent;
  z-index: 1;
  /* El visor arranca bajo los hombros del arco y la barra queda dentro de las líneas;
     los bordes se funden para que el texto no se corte en seco ni cruce el pie */
  margin: 36px 6px 0;
  padding: 10px 28px 20px;
  -webkit-mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 16px), transparent);
  transition: opacity 0.3s ease;
}

/* Lo que se desvanece al elegir (todo, la primera vez; luego, solo la rama mostrada) */
.arcane__scroll.is-fading,
.arcane__detail.is-fading {
  opacity: 0;
}

.arcane__close {
  position: absolute;
  z-index: 3;
  top: 52px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(124, 196, 255, 0.55);
  border-radius: 50%;
  background: rgba(6, 16, 36, 0.3);
  color: #d6ecff;
  cursor: pointer;
  box-shadow:
    0 0 0 3px rgba(124, 196, 255, 0.14),
    0 0 10px rgba(84, 168, 255, 0.45);
}

.arcane__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.arcane__close:hover,
.arcane__close:focus-visible {
  color: #fff;
  box-shadow: 0 0 16px rgba(120, 190, 255, 0.85);
  outline: none;
}

.arcane__head {
  text-align: center;
}

.arcane__over,
.arcane__hint,
.arcane__foot {
  margin: 0;
}

.arcane__over {
  font-size: 0.98rem;
  font-style: italic;
  letter-spacing: 0.03em;
  color: #b8d2f0;
}

.arcane__title {
  margin: 2px 0 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.6vw, 2.6rem);
  line-height: 1.05;
  color: #eef7ff;
  text-shadow:
    0 0 12px rgba(84, 168, 255, 0.95),
    0 0 2px #fff;
}

.arcane__hint {
  font-size: 0.86rem;
  font-style: italic;
  color: #a9cbea;
}

.arcane.is-open .arcane__over,
.arcane.is-open .arcane__title,
.arcane.is-open .arcane__hint,
.arcane.is-open .arcane__foot {
  animation: arcane-in 0.7s ease both;
}

.arcane.is-open .arcane__title {
  animation-delay: 0.25s;
}

.arcane.is-open .arcane__hint {
  animation-delay: 0.45s;
}

.arcane.is-open .arcane__foot {
  animation-delay: 0.9s;
}

@keyframes arcane-in {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

/* Las ramas: dos columnas de títulos que se iluminan al pasar por encima */
.arcane__menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 30px;
  margin: 20px 0 12px;
}

.arcane__cat {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 15px 12px 13px;
  border: 0;
  /* un renglón de luz que se apaga hacia los lados, como el de un manuscrito */
  background: linear-gradient(90deg, rgba(124, 196, 255, 0), rgba(124, 196, 255, 0.36), rgba(124, 196, 255, 0)) bottom / 100% 1px no-repeat;
  color: inherit;
  font: inherit;
  text-align: left;
  text-shadow: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    color 0.25s ease,
    text-shadow 0.25s ease,
    background-color 0.25s ease;
}

.arcane.is-open:not(.is-detail) .arcane__cat {
  animation: arcane-in 0.6s ease both;
}

.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(1) { animation-delay: 0.35s; }
.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(2) { animation-delay: 0.42s; }
.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(3) { animation-delay: 0.49s; }
.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(4) { animation-delay: 0.56s; }
.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(5) { animation-delay: 0.63s; }
.arcane.is-open:not(.is-detail) .arcane__cat:nth-child(6) { animation-delay: 0.7s; }

.arcane__num {
  min-width: 2.1em;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: #9fd6ff;
  opacity: 0.85;
}

.arcane__name {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  letter-spacing: 0.02em;
}

/* Un trazo de luz que crece desde el centro bajo la rama señalada */
.arcane__cat::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -1px;
  height: 2px;
  background: radial-gradient(closest-side, rgba(185, 222, 255, 0.95), rgba(185, 222, 255, 0));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s ease;
}

.arcane__cat:hover,
.arcane__cat:focus-visible {
  color: #fff;
  text-shadow:
    0 0 14px rgba(120, 190, 255, 1),
    0 0 2px #fff;
  background-color: rgba(90, 170, 255, 0.08);
  outline: none;
}

.arcane__cat:hover::after,
.arcane__cat:focus-visible::after,
.arcane__cat[aria-pressed="true"]::after {
  transform: scaleX(1);
}

/* Elegida una rama: las ramas suben a una barra, como el menú de una web */
.arcane.is-detail .arcane__head {
  display: none;
}

.arcane.is-detail .arcane__menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 4px;
  margin: 0 36px 6px;
  padding-bottom: 8px;
  /* La raya de debajo se desvanece en las puntas, sin cortes secos */
  background: linear-gradient(90deg, rgba(124, 196, 255, 0), rgba(124, 196, 255, 0.34) 18%, rgba(124, 196, 255, 0.34) 82%, rgba(124, 196, 255, 0)) bottom / 100% 1px no-repeat;
}

.arcane.is-detail .arcane__cat {
  padding: 6px 12px;
  background: none;
}

/* Entre rama y rama de la barra, una estrellita de cuatro puntas */
.arcane.is-detail .arcane__cat + .arcane__cat::before {
  content: "✦";
  position: absolute;
  left: -3px;
  top: 50%;
  transform: translate(-50%, -52%);
  font-size: 0.55rem;
  color: rgba(150, 200, 255, 0.55);
  text-shadow: none;
}

.arcane.is-detail .arcane__cat::after {
  left: 10px;
  right: 10px;
  bottom: 0;
}

.arcane.is-detail .arcane__num {
  display: none;
}

.arcane.is-detail .arcane__name {
  font-size: 0.95rem;
}

.arcane__cat[aria-pressed="true"] {
  color: #fff;
  text-shadow:
    0 0 12px rgba(120, 190, 255, 1),
    0 0 2px #fff;
}

.arcane__menu.is-in .arcane__cat {
  animation: arcane-in 0.45s ease both;
}

.arcane__menu.is-in .arcane__cat:nth-child(2) { animation-delay: 0.04s; }
.arcane__menu.is-in .arcane__cat:nth-child(3) { animation-delay: 0.08s; }
.arcane__menu.is-in .arcane__cat:nth-child(4) { animation-delay: 0.12s; }
.arcane__menu.is-in .arcane__cat:nth-child(5) { animation-delay: 0.16s; }
.arcane__menu.is-in .arcane__cat:nth-child(6) { animation-delay: 0.2s; }

.arcane__detail {
  display: none;
  transition: opacity 0.3s ease;
}

.arcane.is-detail .arcane__detail {
  display: block;
}

.arcane__skill[hidden] {
  display: none;
}

.arcane__lead {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 14px 0 14px;
}

.arcane__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.05;
  color: #fff;
  text-shadow:
    0 0 14px rgba(84, 168, 255, 0.95),
    0 0 2px #fff;
}

.arcane__icon {
  flex: none;
  width: 128px;
  color: #8fd0ff;
}

.arcane__icon svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(100, 180, 255, 0.95));
}

.arcane__icon .solid {
  fill: currentColor;
  stroke: none;
}

.arcane__icon .faint {
  opacity: 0.4;
}

.arcane__skill.is-in .arcane__icon {
  animation: arcane-icon 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.arcane__skill.is-in .arcane__heading {
  animation: arcane-in 0.55s ease 0.08s both;
}

@keyframes arcane-icon {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-8deg);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.arcane__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 30px;
}

.arcane__group {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  color: #acd2f7;
}

.arcane__group::after {
  content: "";
  display: inline-block;
  width: 44px;
  height: 1px;
  margin-left: 10px;
  vertical-align: middle;
  background: linear-gradient(90deg, rgba(150, 200, 255, 0.65), rgba(150, 200, 255, 0));
}

.arcane__list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.arcane__groups--single {
  display: block;
}

.arcane__groups--single .arcane__list {
  columns: 2;
  column-gap: 30px;
}

.arcane__list li {
  position: relative;
  margin-bottom: 6px;
  padding-left: 17px;
  line-height: 1.3;
  break-inside: avoid;
}

.arcane__list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0.05em;
  font-size: 0.72em;
  color: #a9d4ff;
  text-shadow: 0 0 6px rgba(100, 180, 255, 0.9);
}

.arcane__skill.is-in .arcane__group,
.arcane__skill.is-in .arcane__list li {
  animation: arcane-item 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 38ms + 160ms);
}

@keyframes arcane-item {
  from {
    opacity: 0;
    transform: translateX(-8px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.arcane__foot {
  margin-top: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-style: italic;
  color: #a9cbea;
}

@media (max-width: 640px) {
  .arcane {
    padding: calc(120px + var(--safe-t)) 10px clamp(110px, 22vh, 190px);
  }

  .arcane__scroll {
    margin: 32px 4px 0;
    padding: 8px 12px 14px;
  }

  .arcane__close {
    top: 44px;
  }

  .arcane__menu {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 12px;
  }

  .arcane__cat {
    padding: 11px 10px 10px;
  }

  .arcane.is-detail .arcane__menu {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    margin: 0 40px 6px 0;
    scrollbar-width: none;
  }

  .arcane.is-detail .arcane__cat {
    flex: none;
  }

  .arcane__lead {
    gap: 12px;
  }

  .arcane__icon {
    width: 92px;
  }

  .arcane__groups--single .arcane__list {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcane__frame,
  .arcane.is-open .arcane__frame {
    animation: none;
    transform: none;
    filter: none;
    transition: opacity 0.2s ease;
  }

  .arcane__arch,
  .arcane__frame::before,
  .arcane__veil::before,
  .arcane__veil::after,
  .arcane__motes {
    animation: none;
  }

  .arcane.is-open .arcane__over,
  .arcane.is-open .arcane__title,
  .arcane.is-open .arcane__hint,
  .arcane.is-open .arcane__foot,
  .arcane.is-open:not(.is-detail) .arcane__cat,
  .arcane__menu.is-in .arcane__cat,
  .arcane__skill.is-in .arcane__icon,
  .arcane__skill.is-in .arcane__heading,
  .arcane__skill.is-in .arcane__group,
  .arcane__skill.is-in .arcane__list li {
    animation: none;
  }
}

/* -------------------------------------------------- Rótulos de las runas (Aptitudes) */

.rune-tips {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Con ratón: tarjeta sobre la runa señalada, con su nombre y lo que hace */
.rune-card {
  position: absolute;
  max-width: min(17rem, 72vw);
  padding: 0.55rem 0.85rem 0.62rem;
  border: 1px solid rgba(120, 180, 255, 0.32);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(10, 16, 30, 0.92), rgba(5, 9, 18, 0.94));
  box-shadow:
    0 0 18px rgba(60, 130, 255, 0.22),
    0 6px 18px rgba(0, 0, 0, 0.55);
  color: #d6e6ff;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px)) scale(0.96);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.rune-card.is-on {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 12px)) scale(1);
}

.rune-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.15;
  color: #e4f0ff;
  text-shadow: 0 0 8px rgba(120, 180, 255, 0.75);
}

.rune-card span {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-text);
  font-size: 0.88rem;
  line-height: 1.35;
  color: #b9cbe6;
}

/* En táctil: el nombre nace sobre su runa, sube un poco y se desvanece (como los oficios
   de la portada, en pequeño) */
.rune-flash {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 3.3vw, 1rem);
  font-weight: 550;
  line-height: 1;
  color: #dcefff;
  text-shadow:
    0 0 6px rgba(120, 180, 255, 0.95),
    0 0 16px rgba(70, 130, 255, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.85);
  opacity: 0;
  animation: rune-flash 2.6s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes rune-flash {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.92);
    filter: blur(4px);
    letter-spacing: 0.12em;
  }
  18% {
    opacity: 1;
    filter: blur(0);
    letter-spacing: 0.03em;
  }
  62% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rune-card {
    transition: opacity 0.2s ease;
  }

  .rune-flash {
    animation-name: rune-flash-still;
  }

  @keyframes rune-flash-still {
    0%,
    100% {
      opacity: 0;
      transform: translate(-50%, 0);
    }
    20%,
    70% {
      opacity: 1;
      transform: translate(-50%, 0);
    }
  }
}

/* -------------------------------------------------- Letrero de la daga antigua */

/* Una tablilla de madera oscura con letra de pergamino, sobre la daga de la mesa */
.quest-sign {
  position: absolute;
  max-width: min(15rem, 70vw);
  padding: 0.45rem 0.8rem 0.5rem;
  border: 1px solid rgba(201, 162, 106, 0.55);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(42, 29, 18, 0.94), rgba(24, 16, 10, 0.95));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  color: #e8d8b8;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.3s ease;
}

.quest-sign.is-on {
  opacity: 1;
}

.quest-sign strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.15;
  color: #f0e2c4;
}

.quest-sign span {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-text);
  font-size: 0.86rem;
  font-style: italic;
  line-height: 1.3;
  color: #cdb68e;
}
