/* La portada, la mesa de invocación y la lección comparten la luz del sello. */
.view-home .masthead {
  background: linear-gradient(180deg, #0c1423, #080d17);
}
.view-home .hero {
  display: grid;
  grid-template-areas: "scene";
  background: #070b16;
}
.hero-slide {
  grid-area: scene;
  z-index: 1;
  min-height: clamp(650px, 80svh, 810px);
  padding-block: 70px 155px;
}
.hero-slide.is-leaving {
  z-index: 0;
  pointer-events: none;
}
.hero .hero-art {
  width: 78%;
  isolation: isolate;
}
.hero .scene-plane {
  position: absolute;
  inset: 0;
  display: block;
  transform: scale(1.055);
}
.hero .scene-plane img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.hero .scene-back {
  transform: translate3d(var(--back-x, 0px), var(--back-y, 0px), 0) scale(1.055);
}
.hero .scene-front {
  transform: translate3d(var(--front-x, 0px), var(--front-y, 0px), 0)
    scale(1.055);
}
.astral-ring {
  position: absolute;
  top: 50%;
  left: 52%;
  width: min(63vw, 850px);
  aspect-ratio: 1;
  border: 1px solid #ead49d63;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 8px #090b180d, 0 0 0 9px #d9b56a28, inset 0 0 56px #efd18a0c;
}
.astral-ring::before,
.astral-ring::after {
  content: "";
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 3deg,
    transparent 0deg 9.55deg,
    #f5dc9c99 9.55deg 10deg
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 7px),
    black calc(100% - 6px)
  );
}
.astral-ring::after {
  inset: 9%;
  background: conic-gradient(
    from -65deg,
    transparent 0deg,
    #ecd09e6e 83deg,
    transparent 84deg 160deg,
    #eed3b173 203deg,
    transparent 204deg
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 2px),
    black calc(100% - 1px)
  );
}
.hero-shade {
  background: linear-gradient(
      90deg,
      #060a14 0%,
      #060a14f7 20%,
      #060a14be 34%,
      #060a1440 56%,
      transparent 71%
    ),
    linear-gradient(
      0deg,
      #060a14 0%,
      #060a14c2 11%,
      transparent 38%,
      transparent 82%,
      #0e112056
    );
}
.hero h1,
.hero h2 {
  font-size: clamp(57px, 5.7vw, 91px);
  line-height: 1.005;
}
.hero h1 em,
.hero h2 em,
.lesson-copy em {
  color: var(--bright);
  background: linear-gradient(145deg, #f6e4b9 10%, #dcc18a 45%, #ad833f 89%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-copy {
  pointer-events: none;
}
.hero-copy a,
.hero-copy button {
  pointer-events: auto;
}
.hero .actions {
  margin-top: 24px;
}
.hero .invoke {
  min-height: 53px;
  gap: 12px;
  border-radius: 2px;
  position: relative;
  background: linear-gradient(115deg, #f4db9d 0%, #d9b56a 56%, #b78d47 100%);
  clip-path: polygon(
    0 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
}
.hero .invoke::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid #5e421853;
  pointer-events: none;
}
.hero .invoke:hover {
  filter: brightness(1.13);
}
.hero .invoke:focus-visible {
  outline-offset: -4px;
  outline-color: #15120d;
}
.eidra-atmosphere {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
.hero-console {
  z-index: 3;
  bottom: 24px;
  border-top: 1px solid #d9b56a50;
  padding-top: 14px;
  align-items: center;
}
.scene-tabs {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.scene-tabs button {
  --cut: 8px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 4px 14px 4px 5px;
  font: 500 14px/1.1 var(--sans);
  color: #bfc2ca;
  text-align: left;
  background: #0b101eda;
  border: 1px solid #79694768;
}
.scene-tabs img {
  height: 31px;
  width: 39px;
  object-fit: cover;
  opacity: 0.7;
}
.scene-tabs button[aria-pressed="true"] {
  color: #f9dfad;
  border-color: #cda95f;
  background: #29251edb;
}
.scene-tabs button[aria-pressed="true"] img {
  opacity: 1;
}
.scene-tabs button[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  inset: auto 15% -2px;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px #e3b968af;
}
.motion-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #cfbf9e;
  min-height: 44px;
  font: 500 13px/1.15 var(--sans);
}
.motion-switch i {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #91794e;
  display: grid;
  place-items: center;
  font: 600 10px/1 var(--sans);
  font-style: normal;
}
.archive {
  position: relative;
}
.archive::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #cda458, transparent);
}
.card-stage {
  perspective: 750px;
}
.card-stage::after {
  z-index: 1;
}
.card-tile .card-stage img {
  transform: rotateY(var(--tilt-y, 0deg)) rotateX(var(--tilt-x, 0deg))
    rotateZ(-4deg);
  transition: transform 0.25s ease;
}
.card-tile:nth-child(even) .card-stage img {
  transform: rotateY(var(--tilt-y, 0deg)) rotateX(var(--tilt-x, 0deg))
    rotateZ(4deg);
}
.card-tile:is(:hover, :focus-visible) .card-stage img {
  transform: rotateY(var(--tilt-y, 0deg)) rotateX(var(--tilt-x, 0deg))
    scale(1.04);
}
.card-tile .stage-corner {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at var(--light-x, 55%) var(--light-y, 30%),
    #f9df9a35,
    transparent 58%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 1;
}
.card-tile:is(:hover, :focus-visible) .stage-corner {
  opacity: 1;
}
.card-stage .inspect {
  z-index: 2;
}
.ritual {
  --ether: #bd91ec;
  --halo: rgba(132, 68, 181, 0.39);
  padding: 0;
  color: var(--paper);
  background: #090c19;
  border: 1px solid #8c7448;
  border-radius: 10px;
  width: min(840px, 94vw);
  max-width: 94vw;
  max-height: 94dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
.ritual::backdrop {
  background: #02040bee;
  backdrop-filter: blur(5px);
}
.ritual[data-ink="water"] {
  --ether: #86e5d8;
  --halo: rgba(50, 136, 134, 0.4);
}
.ritual[data-ink="sun"] {
  --ether: #f3c575;
  --halo: rgba(174, 119, 48, 0.44);
}
.ritual-room {
  position: relative;
  isolation: isolate;
  padding: 20px 27px 24px;
  background: radial-gradient(ellipse at 50% 33%, var(--halo), transparent 55%),
    linear-gradient(145deg, #0e1526, #070a14 78%);
  text-align: center;
}
.ritual-tools {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sound-toggle,
.ritual-close {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}
.sound-toggle {
  font: 500 14px var(--sans);
  gap: 6px;
}
.sound-toggle > span:first-child {
  font-size: 22px;
}
.ritual-close {
  width: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.ritual-stage {
  --card-height: clamp(185px, 33vh, 315px);
  position: relative;
  display: grid;
  place-items: center;
  height: calc(var(--card-height) + 65px);
  isolation: isolate;
  perspective: 1100px;
}
.ritual-halo {
  position: absolute;
  width: min(95%, 470px);
  height: 95%;
  background: radial-gradient(ellipse, var(--halo) 0%, transparent 70%);
}
.ritual-orbit {
  position: absolute;
  width: min(90%, calc(var(--card-height) * 1.37));
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.8;
}
.orbit-a {
  border: 1px solid #e1bf7773;
  outline: 1px solid #d2ae5e29;
  outline-offset: 7px;
}
.orbit-b {
  background: repeating-conic-gradient(
    from -2deg,
    #edd39c9a 0 1deg,
    transparent 1deg 10deg
  );
  mask: radial-gradient(farthest-side, transparent 95%, black 96%);
}
.orbit-c {
  width: min(80%, calc(var(--card-height) * 1.2));
  border: 1px dashed var(--ether);
  opacity: 0.35;
}
.ritual-turn {
  position: relative;
  height: var(--card-height);
  aspect-ratio: 2/3;
  transform-style: preserve-3d;
}
.ritual-face,
.ritual-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}
.ritual-back {
  transform: rotateY(180deg);
}
.ritual-turn img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 9px 12px #02030ba8);
}
.ritual-sparks {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.ritual-sparks i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ether);
  opacity: 0;
  box-shadow: 0 0 8px var(--ether);
}
.ritual-caption {
  min-height: 116px;
}
.ritual-caption h2 {
  font-size: clamp(24px, 3.25vw, 46px);
  margin: 5px 0;
}
.ritual-caption p {
  color: #c8c4cf;
  font: 500 15px/1.4 var(--sans);
  letter-spacing: 0.07em;
}
.ritual-caption .text-link {
  font-size: 15px;
}
.ritual-choices {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.ritual-choices button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 3px 12px 3px 4px;
  border: 1px solid var(--line);
  color: #b7bcc6;
  font-size: 15px;
}
.ritual-choices img {
  width: 34px;
  height: 34px;
  object-fit: cover;
}
.ritual-choices button[aria-pressed="true"] {
  color: var(--bright);
  border-color: var(--gold);
}
.duel-lab {
  background: radial-gradient(ellipse at 74% 54%, #192239 0%, transparent 50%),
    var(--ink);
}
.lesson-layout {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: clamp(28px, 5vw, 85px);
  align-items: center;
}
.lesson-copy h2 {
  font-size: clamp(39px, 4.3vw, 64px);
}
.lesson-live {
  min-height: 135px;
  max-width: 440px;
  padding-block: 22px 16px;
}
.lesson-phase {
  display: block;
  font: 600 11px/1.4 var(--sans);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 9px;
}
.lesson-live p {
  font-size: 19px;
  color: #c8cbd3;
  line-height: 1.45;
}
.lesson-copy .lesson-guide {
  margin-left: 12px;
  font-size: 14px;
}
.battle-board {
  border: 1px solid #7e6c467c;
  border-radius: 12px;
  padding: 15px 21px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(135deg, #151c2b, #0c101e);
}
.battle-top,
.battle-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  color: #cbc7bb;
  font: 600 14px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.battle-top {
  border-bottom: 1px solid var(--line);
}
.battle-bottom {
  border-top: 1px solid var(--line);
}
.battle-top b,
.battle-bottom b {
  color: var(--gold);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.battle-mat {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  align-items: center;
  justify-items: center;
  min-height: 265px;
  isolation: isolate;
}
.battle-track {
  position: absolute;
  inset: 12% 6%;
  border: 1px solid #c0a36222;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(25% - 1px),
    #e3c38519 calc(25% - 1px) 25%
  );
  transform: perspective(480px) rotateX(24deg);
  z-index: -1;
}
.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.unit img {
  height: 145px;
  max-width: 100%;
  width: auto;
  filter: drop-shadow(0 9px 7px #000a);
}
.unit span {
  font: 600 13px var(--sans);
  letter-spacing: 0.1em;
  color: var(--bright);
}
.unit.rival img {
  transform: rotate(90deg) scale(0.88);
  transition: transform 0.6s cubic-bezier(0.2, 0.82, 0.22, 1), opacity 0.6s;
}
[data-phase="1"] .unit.rival img,
[data-phase="2"] .unit.rival img {
  transform: rotate(0);
}
[data-phase="2"] .unit.rival img {
  opacity: 0.18;
}
.duel-cross {
  font: 400 36px var(--serif);
  color: var(--gold);
}
.spell-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  opacity: 0;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}
.spell-play img {
  width: 100%;
  filter: drop-shadow(0 0 10px #83dcd3);
}
@media (min-width: 1100px) {
  .hero-copy > p {
    max-width: 410px;
  }
}
@media (max-width: 900px) {
  .scene-tabs button {
    padding: 3px;
  }
  .scene-tabs button span {
    display: none;
  }
  .scene-tabs img {
    width: 46px;
    height: 32px;
  }
  .lesson-layout {
    grid-template-columns: 1fr 1fr;
    gap: 25px;
  }
  .battle-mat {
    min-height: 208px;
  }
  .unit img {
    height: 100px;
  }
  .lesson-copy .lesson-guide {
    margin-left: 0;
    display: flex;
    justify-content: flex-start;
  }
}
@media (max-width: 660px) {
  .hero-slide {
    min-height: clamp(645px, 85svh, 760px);
    padding: 272px 0 104px;
  }
  .hero .hero-art {
    width: 100%;
    height: 65%;
  }
  .hero h1,
  .hero h2 {
    font-size: clamp(40px, 9vw, 56px);
  }
  .hero-shade {
    background: linear-gradient(
      0deg,
      #060a14 19%,
      #060a14fa 32%,
      #060a14b8 48%,
      #060a1422 67%,
      transparent 82%
    );
  }
  .hero .actions {
    margin-top: 18px;
    gap: 16px;
  }
  .hero .invoke {
    min-height: 47px;
    font-size: 15px;
    gap: 7px;
  }
  .hero-copy > p {
    max-width: 400px;
  }
  .hero-console {
    bottom: 13px;
    padding-top: 8px;
    gap: 5px;
  }
  .hero-pages {
    gap: 3px;
  }
  .hero-pages button {
    width: 44px;
  }
  .counter {
    display: none;
  }
  .scene-tabs {
    gap: 4px;
  }
  .scene-tabs button {
    min-width: 44px;
  }
  .scene-tabs img {
    width: 34px;
    height: 28px;
  }
  .motion-switch {
    gap: 5px;
    font-size: 11px;
  }
  .motion-switch i {
    width: 21px;
    height: 21px;
  }
  .astral-ring {
    width: 100%;
  }
  .lesson-layout {
    grid-template-columns: 1fr;
  }
  .lesson-live {
    min-height: 125px;
  }
  .battle-board {
    padding: 10px 14px;
  }
  .ritual-room {
    padding: 10px 12px 16px;
  }
  .ritual-stage {
    --card-height: clamp(170px, 29vh, 255px);
  }
  .ritual-choices {
    gap: 4px;
  }
  .ritual-choices button {
    padding: 3px 5px;
    font-size: 13px;
    gap: 4px;
  }
  .ritual-choices img {
    width: 23px;
    height: 27px;
  }
}
@media (max-width: 370px) {
  .motion-switch .motion-label {
    display: none;
  }
  .hero .actions {
    gap: 8px;
  }
  .hero .text-link {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
  ::view-transition-old(root) {
    animation: page-out 0.22s ease-in both;
  }
  ::view-transition-new(root) {
    animation: page-in 0.4s cubic-bezier(0.15, 0.8, 0.23, 1) both;
  }
  .masthead {
    view-transition-name: masthead;
  }
  .hero-copy > * {
    animation: ink-arrive 0.66s cubic-bezier(0.16, 0.83, 0.22, 1) backwards;
  }
  .hero-copy > :nth-child(2) {
    animation-delay: 0.06s;
  }
  .hero-copy > :nth-child(3) {
    animation-delay: 0.13s;
  }
  .hero-copy > :nth-child(4) {
    animation-delay: 0.2s;
  }
  .hero.is-awake .astral-ring::before,
  .ritual[open] .orbit-b {
    animation: orbit 100s linear infinite;
  }
  .hero.is-awake .astral-ring::after,
  .ritual[open] .orbit-c {
    animation: orbit 68s linear reverse infinite;
  }
  .ritual[open] {
    animation: ink-arrive 0.23s ease-out;
  }
  .art-dialog[open] img {
    animation: ink-arrive 0.33s ease-out;
  }
  [data-frame]:not([hidden]) figcaption {
    animation: ink-arrive 0.35s ease-out;
  }
  @keyframes orbit {
    to {
      transform: rotate(360deg);
    }
  }
  @keyframes ink-arrive {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  @keyframes page-out {
    to {
      opacity: 0;
      transform: scale(1.012);
    }
  }
  @keyframes page-in {
    from {
      opacity: 0;
      transform: translateY(9px);
    }
  }
}
html[data-effects="off"] *,
html[data-effects="off"] *::before,
html[data-effects="off"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html[data-effects="off"]::view-transition-group(*),
html[data-effects="off"]::view-transition-old(*),
html[data-effects="off"]::view-transition-new(*) {
  animation-duration: 0s !important;
}
@media (prefers-reduced-motion: reduce) {
  .scene-plane,
  .card-tile .card-stage img {
    transform: none !important;
  }
}

.hero .hero-art {
  mask-image: linear-gradient(90deg, transparent 0%, #000 23%);
}
.ritual-wall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.22;
  mask-image: linear-gradient(0deg, transparent 8%, #000 65%);
}
.ritual-stage .resonance {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 650px;
  pointer-events: none;
}
.resonance i {
  position: absolute;
  width: min(75%, calc(var(--card-height) * 1.35));
  aspect-ratio: 1;
  border: 1px solid var(--ether);
  opacity: 0;
  border-radius: 50%;
  box-shadow: 0 0 12px var(--halo), inset 0 0 12px var(--halo);
}
.ritual[data-ink="sun"] .resonance i {
  width: min(60%, var(--card-height));
  border-radius: 10%;
}
@media (max-width: 660px) {
  .hero .hero-art {
    mask-image: linear-gradient(0deg, transparent 0%, #000 22%);
  }
}
