/* The closing palace uses painted stone around the original carpet. */
.hall {
  bottom: 0;
  background-color: #10191e;
  background-image: linear-gradient(90deg, #03090e42, #03090e10 35%, #03090e10 65%, #03090e42), url(assets/royal-palace-floor-v1.jpg);
  background-size: 100% 100%, max(1440px, 100vw) auto;
  background-position: center, center top;
  background-repeat: no-repeat, repeat-y;
}
.hall::before { bottom: var(--carpet-stop, 0px); }

/* Keep the roadmap sentinel grounded beside the carpet. */
#yol > .oath-guard {
  position: relative;
  isolation: isolate;
  justify-self: center;
  width: min(100%, 350px, 40vh);
  margin: 0;
  pointer-events: none;
}
.oath-guard::before {
  content: '';
  position: absolute;
  inset: auto 4% 4% 4%;
  height: 22%;
  z-index: -1;
  background: radial-gradient(ellipse, #ad793b3b, transparent 68%);
  animation: seal-light 7s ease-in-out infinite;
}
#yol .oath-guard img {
  width: 100%;
  height: auto;
  max-height: none;
  filter: drop-shadow(0 3px 3px #0006);
}

/* Reserve floor below the dais so its landing meets the walker's foot line at page end. */
footer.royal-ending {
  --ceremony-height: clamp(200px, 28vh, 250px);
  --foot-depth: calc(36vh - clamp(60px, 12vh, 110px));
  display: block;
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 34px 0 max(12px, calc(var(--foot-depth) - var(--ceremony-height) / 2 - 32px));
  background: linear-gradient(transparent 55%, #04090d80);
  color: #b8bdaf;
}
footer.royal-ending::before {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: -116px;
  left: 50%;
  width: min(64%, 800px);
  height: calc(var(--ceremony-height) + 150px);
  translate: -50% 0;
  background: radial-gradient(ellipse 20% 39% at 50% 43%, #ffc47766, #bc753135 55%, transparent),
    radial-gradient(ellipse 49% 42% at 50% 56%, #e3aa632b, transparent);
}
.ending-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--road) minmax(0, 1fr); gap: clamp(30px, 4vw, 65px);
  max-width: 1480px; margin: 0 auto; padding: 0 64px; align-items: center; text-align: left; }
.ending-intro { justify-self: end; width: 100%; max-width: 350px; }
.ending-intro h2 {
  margin: 0;
  font: 500 clamp(25px, 2.4vw, 38px)/1.25 var(--display);
  letter-spacing: -.025em;
  text-wrap: wrap;
  color: #ead8af;
}
.ending-dais {
  --dais-width: calc(var(--road) + 108px);
  --dais-height: calc(var(--dais-width) * 2 / 3);
  position: relative;
  height: var(--ceremony-height);
  pointer-events: none;
}
footer.royal-ending .ending-dais img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--dais-width);
  height: auto;
  max-width: none;
  translate: -50% -50%;
  border-radius: 0;
  box-shadow: none;
}
.ending-dais::before, .ending-dais::after {
  content: '';
  position: absolute;
  left: 50%;
  translate: -50% -50%;
}
/* The contact shadow and reflected light follow the front edge of the existing platform art. */
.ending-dais::before {
  top: calc(50% + var(--dais-height) * .31);
  width: calc(var(--dais-width) * 1.12);
  height: clamp(28px, 6vh, 58px);
  background: radial-gradient(ellipse, #02060be6, #03080b80 48%, transparent 73%);
}
.ending-dais::after {
  top: calc(50% + var(--dais-height) * .227);
  width: calc(var(--dais-width) * .91);
  height: 9px;
  background: radial-gradient(ellipse 50% 18% at center, #f5bf7180, transparent),
    radial-gradient(ellipse, #e3954d42, transparent 72%);
}
.ending-invite { justify-self: start; width: 100%; max-width: 340px; padding-left: 8px; }
.ending-invite > p:first-child { margin-bottom: 17px; font: 500 clamp(21px, 2vw, 29px) var(--display); letter-spacing: -.02em; color: #e2d3b6; }
.ending-actions { display: inline-grid; justify-items: center; gap: 16px; max-width: 100%; }
.ending-play { min-width: 185px; min-height: 45px; justify-content: space-between; gap: 35px; padding: 0 19px;
  font: 700 11px var(--body); letter-spacing: .11em; }
.ending-play > span:last-child { font-size: 18px; font-weight: 400; }
.ending-back { display: inline-flex; align-items: center; gap: 12px; color: #af9c77; text-decoration: none; font: 10px/1.6 var(--body); }
.ending-back:hover { color: #ead6a2; }
.ending-signature { margin: 17px 20px 0; text-align: center; color: #baa779; font: 500 10px var(--display); letter-spacing: .18em; }

/* The two static pixel crowds leave a clear path down the center. */
.ending-audience {
  position: absolute;
  z-index: -1;
  inset: auto 0 0;
  height: clamp(68px, 21vh, 185px);
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(transparent, #070e1280 69%, #04090dd1);
}
.ending-crowd {
  position: absolute;
  bottom: 0;
  left: 0;
  width: min(36%, 520px, 57vh);
  height: auto;
  image-rendering: pixelated;
}
.ending-crowd:last-child { left: auto; right: 0; }
@keyframes seal-light { 50% { opacity: .55; } }
@media (min-width: 901px) and (max-width: 1100px) {
  .ending-grid { padding: 0 68px; gap: 26px; }
  .ending-actions { display: grid; }
  .ending-play { min-width: 0; width: 100%; gap: 15px; }
  .ending-intro h2 { font-size: 25px; }
  .ending-invite { padding-left: 0; }
  .ending-dais { --dais-width: calc(var(--road) + 42px); }
}
@media (max-width: 900px) {
  #yol > .oath-guard { order: 0; width: min(64vw, 240px); }
  footer.royal-ending { padding: 48px 24px 24px; }
  .ending-grid { display: flex; flex-direction: column; gap: 14px; padding: 0; text-align: center; }
  .ending-intro, .ending-invite { max-width: 420px; margin: 0 auto; padding: 0; }
  .ending-intro h2 { font-size: 32px; }
  .ending-dais { display: none; }
  .ending-invite > p:first-child { font-size: 25px; }
  .ending-play { min-width: 210px; }
  .ending-signature { margin-top: 34px; }
  footer.royal-ending::before { top: 0; width: 100%; height: 100%; opacity: .52; }
  .ending-audience { height: 60px; opacity: .82; }
  .ending-crowd { width: min(39%, 168px); }
}
