:root {
  --hall-blue: #2f9cf4;
  --hall-blue-bright: #8fd3ff;
  --hall-blue-deep: #092b4d;
  --hall-silver: #dbe8f2;
  --hall-ink: #02070d;
}

html:has(.legends-page) {
  min-width: 320px;
  background: var(--hall-ink);
  scrollbar-color: var(--hall-blue) #030a12;
}

.legends-page {
  min-height: 760vh;
  overflow-x: hidden;
  background: var(--hall-ink);
  color: #eef7ff;
}

.legends-page.hall-modal-open,
.legends-page.hall-archive-open,
.legends-page.hall-is-loading {
  overflow: hidden;
}

.legends-topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 200;
  border-bottom-color: rgba(47, 156, 244, 0.28);
  background: linear-gradient(180deg, rgba(1, 6, 12, 0.98), rgba(1, 6, 12, 0.88));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.legends-topbar .nav a:hover,
.legends-topbar .nav a.is-active {
  background: rgba(47, 156, 244, 0.2);
  color: #fff;
}

.legend-hall {
  position: relative;
}

.hall-stage {
  position: fixed;
  z-index: 1;
  inset: 76px 0 0;
  min-height: 360px;
  overflow: hidden;
  isolation: isolate;
  background: #07131f;
}

.hall-canvas,
.hall-atmosphere {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hall-canvas {
  z-index: 1;
  display: block;
  touch-action: pan-y;
  cursor: default;
}

.hall-canvas.is-hovering-frame {
  cursor: pointer;
}

.hall-atmosphere {
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, transparent 0 54%, rgba(3, 12, 22, 0.12) 82%, rgba(1, 7, 13, 0.34) 100%),
    linear-gradient(90deg, rgba(2, 10, 18, 0.12), transparent 18% 82%, rgba(2, 10, 18, 0.12));
  box-shadow: inset 0 0 78px rgba(0, 0, 0, 0.28);
}

.hall-intro {
  position: absolute;
  z-index: 20;
  left: clamp(22px, 4.5vw, 72px);
  top: clamp(22px, 6vh, 72px);
  width: min(610px, calc(100% - 44px));
  padding: 18px 22px 20px;
  border-left: 3px solid var(--hall-blue);
  background: linear-gradient(90deg, rgba(3, 15, 28, 0.88), rgba(3, 15, 28, 0.2) 76%, transparent);
  text-align: left;
  text-shadow: 0 5px 30px #000;
  pointer-events: none;
  will-change: opacity, transform;
}

.hall-intro > p:first-child,
.hall-focus-story > p:first-child,
.hall-archive-head span {
  margin: 0 0 7px;
  color: var(--hall-blue-bright);
  font-size: clamp(0.6rem, 1.1vw, 0.76rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hall-intro h1 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 6vw, 5.8rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.hall-intro h1 em {
  color: var(--hall-blue-bright);
  font-weight: 400;
}

.hall-intro-copy {
  margin: 12px 0 0;
  color: rgba(224, 240, 252, 0.7);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.76rem, 1.5vw, 1rem);
  font-style: italic;
  letter-spacing: 0.035em;
}

.hall-hud {
  position: absolute;
  z-index: 80;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 38px) 20px;
  pointer-events: none;
}

.hall-archive-button,
.hall-return-button {
  width: max-content;
  border: 1px solid rgba(143, 211, 255, 0.55);
  border-radius: 999px;
  padding: 9px 15px;
  background: rgba(3, 16, 29, 0.78);
  color: #e5f5ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  pointer-events: auto;
}

.hall-scroll-cue {
  justify-self: end;
  color: rgba(229, 245, 255, 0.72);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}

.hall-scroll-cue i {
  display: block;
  width: 1px;
  height: 24px;
  margin: 7px auto 0;
  background: linear-gradient(var(--hall-blue-bright), transparent);
  animation: hall-scroll-pulse 1.7s ease-in-out infinite;
}

@keyframes hall-scroll-pulse {
  0%, 100% { opacity: 0.25; transform: scaleY(0.5); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

.hall-loading {
  position: absolute;
  z-index: 150;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 48%, rgba(76, 31, 15, 0.42), transparent 29%),
    #020406;
  opacity: 1;
  transition: opacity 0.45s ease;
}

.hall-loading[hidden] { display: none; }
.hall-loading.is-complete { opacity: 0; pointer-events: none; }

.hall-loading-inner {
  display: grid;
  justify-items: center;
  color: #ead7b1;
  text-align: center;
  text-shadow: 0 4px 24px #000;
}

.hall-loading-inner span {
  margin-bottom: 10px;
  color: #c49752;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.hall-loading-inner strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.hall-loading-inner i {
  width: min(240px, 54vw);
  height: 2px;
  margin-top: 24px;
  overflow: hidden;
  background: rgba(196, 151, 82, 0.18);
}

.hall-loading-inner i::after {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #e1b96f, transparent);
  content: "";
  animation: hall-loading-sweep 1.35s ease-in-out infinite;
}

@keyframes hall-loading-sweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(350%); }
}

.hall-error {
  position: absolute;
  z-index: 160;
  left: 50%;
  bottom: 76px;
  padding: 10px 14px;
  border: 1px solid rgba(143, 211, 255, 0.28);
  border-radius: 999px;
  background: rgba(2, 12, 22, 0.86);
  color: rgba(229, 245, 255, 0.74);
  font-size: 0.72rem;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.hall-error strong,
.hall-error span { display: block; }
.hall-focus[hidden] { display: none; }

.hall-focus {
  position: fixed;
  z-index: 300;
  inset: 76px 0 0;
  pointer-events: none;
}

.hall-focus-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(0, 4, 9, 0.08);
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: zoom-out;
  pointer-events: auto;
}

.hall-focus.is-visible .hall-focus-backdrop { opacity: 1; }

.hall-focus-story {
  position: absolute;
  left: 59%;
  top: 50%;
  width: min(490px, 36vw);
  max-height: calc(100dvh - 126px);
  overflow: auto;
  padding: clamp(24px, 3.7vw, 48px);
  border: 1px solid rgba(143, 211, 255, 0.34);
  background:
    linear-gradient(145deg, rgba(8, 30, 51, 0.97), rgba(2, 10, 19, 0.98)),
    #061525;
  color: #eef7ff;
  opacity: 0;
  transform: translate(34px, -50%);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), inset 0 0 60px rgba(47, 156, 244, 0.06);
  transition: opacity 0.4s ease 0.25s, transform 0.48s ease 0.22s;
  pointer-events: auto;
}

.hall-focus.is-visible .hall-focus-story {
  opacity: 1;
  transform: translate(0, -50%);
}

.hall-focus-story h2 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 4.2vw, 4.2rem);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.hall-focus-story > span {
  display: block;
  margin-top: 12px;
  color: var(--hall-blue-bright);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hall-focus-rule {
  width: 74px;
  height: 2px;
  margin: 24px 0;
  background: var(--hall-blue);
}

.hall-focus-story > p:not(:first-child) {
  color: rgba(226, 240, 250, 0.76);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.96rem, 1.4vw, 1.12rem);
  line-height: 1.7;
}

.hall-return-button { margin-top: 18px; }

.hall-archive {
  position: fixed;
  z-index: 410;
  top: 76px;
  right: 0;
  bottom: 0;
  width: min(560px, 92vw);
  overflow: auto;
  padding: clamp(24px, 4vw, 48px);
  border-left: 1px solid rgba(47, 156, 244, 0.32);
  background: linear-gradient(155deg, #0b2d4b, #030b14 78%);
  color: #eef7ff;
  transform: translateX(102%);
  transition: transform 0.44s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -28px 0 70px rgba(0, 0, 0, 0.55);
}

.hall-archive.is-open { transform: translateX(0); }

.hall-archive-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(143, 211, 255, 0.22);
}

.hall-archive-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 500;
}

.hall-archive-head button {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(143, 211, 255, 0.46);
  border-radius: 50%;
  place-items: center;
  background: transparent;
  color: var(--hall-blue-bright);
  font-size: 1.65rem;
  cursor: pointer;
}

.hall-archive-section {
  padding: 28px 0;
  border-bottom: 1px solid rgba(143, 211, 255, 0.15);
}

.hall-archive-section h3 {
  margin: 0 0 15px;
  color: var(--hall-blue-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 500;
}

.hall-archive-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hall-archive-list button,
.hall-archive-empty {
  width: 100%;
  border: 1px solid rgba(143, 211, 255, 0.14);
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  text-align: left;
}

.hall-archive-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
}

.hall-archive-list button:hover {
  border-color: rgba(143, 211, 255, 0.4);
  background: rgba(47, 156, 244, 0.09);
}

.hall-archive-list strong,
.hall-archive-list span { display: block; }
.hall-archive-list strong { font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.hall-archive-list span { color: rgba(226, 240, 250, 0.58); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.11em; text-transform: uppercase; }
.hall-archive-list i { color: var(--hall-blue-bright); font-style: normal; }
.hall-archive-empty { color: rgba(226, 240, 250, 0.62); line-height: 1.6; }

.hall-asset-credit {
  margin: 22px 24px 26px;
  padding-top: 16px;
  border-top: 1px solid rgba(143, 211, 255, 0.13);
  color: rgba(226, 240, 250, 0.4);
  font-size: 0.64rem;
  line-height: 1.55;
}

.hall-asset-credit a { color: rgba(143, 211, 255, 0.7); }
.hall-asset-credit a:hover { color: #d8f1ff; }

.hall-archive-shade {
  position: fixed;
  z-index: 400;
  inset: 76px 0 0;
  width: 100%;
  border: 0;
  background: rgba(0, 4, 9, 0.68);
  backdrop-filter: blur(5px);
}

.hall-scroll-track { height: 760vh; pointer-events: none; }

@media (max-width: 1040px) {
  .hall-focus-story { left: 57%; width: 40vw; }
}

@media (max-width: 760px) {
  .legends-page { min-height: 880vh; }
  .hall-intro { left: 14px; top: 16px; width: calc(100% - 28px); padding: 13px 15px 15px; }
  .hall-intro > p:first-child {
    font-size: clamp(0.47rem, 2.15vw, 0.62rem);
    letter-spacing: 0.17em;
    white-space: nowrap;
  }
  .hall-intro h1 {
    font-size: clamp(2rem, 10.5vw, 3.35rem);
    letter-spacing: -0.065em;
  }
  .hall-intro-copy {
    max-width: 100%;
    font-size: clamp(0.54rem, 2.45vw, 0.68rem);
    line-height: 1.35;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
  .hall-hud { grid-template-columns: 1fr 1fr; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .hall-scroll-cue { align-self: center; }
  .hall-focus-story {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 39dvh;
    padding: 20px;
    transform: translateY(26px);
  }
  .hall-focus.is-visible .hall-focus-story { transform: translateY(0); }
  .hall-focus-story h2 { font-size: clamp(1.85rem, 9vw, 2.9rem); }
  .hall-focus-rule { margin: 14px 0; }
  .hall-focus-story > p:not(:first-child) { margin-bottom: 0; font-size: 0.9rem; line-height: 1.5; }
  .hall-return-button { margin-top: 12px; }
}

@media (max-width: 480px) {
  .hall-archive-button,
  .hall-scroll-cue { font-size: 0.58rem; }
  .hall-hud { gap: 9px; padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .hall-focus-backdrop,
  .hall-focus-story,
  .hall-archive { transition-duration: 0.01ms !important; }
  .hall-scroll-cue i { animation: none; }
  .hall-loading,
  .hall-loading-inner i::after { transition-duration: 0.01ms !important; animation: none; }
}
