/*
 * Portrait visual reconstruction — three independent presentation systems.
 *
 * The React state, content stores, entry counts and event handlers remain
 * shared.  This file changes only the portrait composition selected by the
 * `portrait` query parameter.
 */

/* These layers exist only to redraw the portrait versions. Keep them out of
   the landscape composition entirely, including immediately after rotation. */
@media not all and (orientation: portrait), (min-width: 821px) {
  .portrait-stage-architecture,
  .portrait-home-reconstruction,
  .portrait-statement-reconstruction,
  .portrait-heritage-nav,
  .portrait-archive-nav {
    display: none !important;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  html[data-portrait-scheme] {
    --portrait-safe-top: max(env(safe-area-inset-top, 0px), 0px);
    --portrait-safe-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
    --portrait-nav-height: 112px;
    --portrait-stage-top: calc(var(--portrait-safe-top) + var(--portrait-nav-height) + 8px);
    overflow-x: clip !important;
    scroll-behavior: auto !important;
    scroll-snap-type: none !important;
    overscroll-behavior-y: none;
  }

  html[data-portrait-scheme] body,
  html[data-portrait-scheme] .site-shell,
  html[data-portrait-scheme] .screen-stack {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }

  html[data-portrait-scheme] .screen-stack {
    position: relative !important;
    display: block !important;
    transform: none;
    transform-origin: 50% 0;
    backface-visibility: hidden;
  }

  html[data-portrait-scheme].is-portrait-dragging,
  html[data-portrait-scheme].is-portrait-page-turning {
    overscroll-behavior: none;
  }

  html[data-portrait-scheme].is-portrait-dragging body {
    user-select: none;
    -webkit-user-select: none;
  }

  html[data-portrait-scheme] .screen-stack > .screen-stage,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-1,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-2,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-3,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-4,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-5,
  html[data-portrait-scheme] .screen-stack > .screen-stage.screen-6 {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 100% !important;
    height: 100svh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: var(--portrait-stage-top) max(8px, env(safe-area-inset-right, 0px))
      max(8px, var(--portrait-safe-bottom)) max(8px, env(safe-area-inset-left, 0px)) !important;
    place-items: stretch !important;
    overflow: hidden !important;
    scroll-snap-align: none !important;
    scroll-snap-stop: normal !important;
    transform: none !important;
    touch-action: pan-x pinch-zoom;
  }

  html[data-portrait-scheme]
    .screen-stack
    > .screen-stage
    > .screen-viewport-content {
    position: relative !important;
    inset: auto !important;
    z-index: 3 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    transform: translateZ(0) !important;
    backface-visibility: hidden;
  }

  html[data-portrait-scheme]
    :is(
      .identity-gateway-portal__content,
      .identity-gateway-portal__service-directory,
      .identity-gateway-portal__physiology-gallery-body,
      .identity-gateway-portal__physiology-text-dialog-body,
      .more-exclusive-services__bilingual-rows,
      .more-exclusive-services__node-scroll-region,
      .more-service-detail__content,
      .more-services-editor__tab-shell,
      .heart-scroll-panel__conversation,
      .lifetime-chat-panel__conversation,
      .temporary-service-panel__conversation
    ) {
    touch-action: pan-y pinch-zoom;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[data-portrait-scheme]
    .screen-stage.is-portrait-page-entering
    > .screen-viewport-content {
    animation: portrait-scene-settle 520ms cubic-bezier(.22, .72, .16, 1) both;
  }

  @keyframes portrait-scene-settle {
    0% {
      opacity: 0.72;
      filter: saturate(0.82) brightness(0.86);
      transform: scale(0.975) translateZ(0) !important;
    }
    100% {
      opacity: 1;
      filter: none;
      transform: scale(1) translateZ(0) !important;
    }
  }

  /* Three genuinely different navigation structures. */
  html[data-portrait-scheme]
    .imperial-nav--line
    :is(
      .nav-artwork,
      .nav-links,
      .compact-nav,
      .full-nav-travel-angel,
      .login-entry-story,
      .expanded-subtitle-link
    ) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html[data-portrait-scheme]
    .imperial-nav.imperial-nav--line,
  html[data-portrait-scheme]
    .imperial-nav.imperial-nav--line.is-compact,
  html[data-portrait-scheme]
    .imperial-nav.imperial-nav--line:not(.is-compact) {
    position: fixed !important;
    z-index: 9000 !important;
    top: calc(var(--portrait-safe-top) + 4px) !important;
    right: max(6px, env(safe-area-inset-right, 0px)) !important;
    left: max(6px, env(safe-area-inset-left, 0px)) !important;
    width: auto !important;
    height: var(--portrait-nav-height) !important;
    min-height: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    aspect-ratio: auto !important;
    transform: none !important;
  }

  html[data-portrait-scheme]
    :is(.portrait-line-nav, .portrait-heritage-nav, .portrait-archive-nav) {
    display: none !important;
  }

  /* Scheme 1 navigation: the desktop gemstone thread split into two rails. */
  html[data-portrait-scheme="heritage"] {
    --portrait-nav-height: 116px;
  }

  html[data-portrait-scheme="heritage"]
    .imperial-nav.imperial-nav--line {
    border: 1px solid rgba(145, 92, 24, 0.58) !important;
    border-radius: 18px 5px 18px 5px !important;
    background:
      linear-gradient(90deg, rgba(41, 111, 98, 0.12), transparent 14% 86%, rgba(41, 111, 98, 0.12)),
      linear-gradient(180deg, rgba(255, 255, 250, 0.99), rgba(239, 232, 207, 0.985)) !important;
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.76),
      0 8px 22px rgba(44, 73, 61, 0.18) !important;
  }

  html[data-portrait-scheme="heritage"] .portrait-heritage-nav {
    position: absolute;
    inset: 5px 7px;
    display: grid !important;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
  }

  .portrait-heritage-nav__rail {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
  }

  .portrait-heritage-nav__rail::before {
    position: absolute;
    z-index: 0;
    top: 50%;
    height: 4px;
    content: "";
    transform: translateY(-50%);
    background:
      linear-gradient(180deg, #fff6cf 0 22%, #a66e20 23% 52%, #d8b864 53% 76%, #fffbea 77%);
    box-shadow: 0 1px 4px rgba(113, 71, 18, 0.28);
  }

  .portrait-heritage-nav__rail--first::before {
    right: 8%;
    left: 0;
    border-radius: 8px 0 0 8px;
  }

  .portrait-heritage-nav__rail--second::before {
    right: 0;
    left: 8%;
    border-radius: 0 8px 8px 0;
  }

  .portrait-heritage-nav__item {
    position: relative;
    z-index: 1;
    display: inline-flex;
    min-width: 0;
    height: 48px;
    align-items: center;
    justify-content: center;
    gap: clamp(3px, 1vw, 6px);
    padding: 4px 5px;
    border: 0;
    background: transparent;
    color: #392619;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
    font-size: clamp(13px, 3.55vw, 17px);
    font-weight: 720;
    letter-spacing: 0.025em;
    white-space: nowrap;
  }

  .portrait-heritage-nav__item > span:not(.portrait-heritage-nav__winged) {
    padding: 3px 2px;
    background: rgba(247, 243, 226, 0.96);
  }

  .portrait-heritage-nav__item > i {
    display: block;
    width: clamp(11px, 3vw, 14px);
    aspect-ratio: 1;
    border: 1px solid #d9b761;
    border-radius: 50%;
    background:
      radial-gradient(circle at 34% 28%, white 0 8%, transparent 9%),
      radial-gradient(circle at 43% 39%, #ff8f77 0 14%, #c72618 34%, #720805 68%, #2e0201 100%);
    box-shadow: 0 0 7px rgba(169, 38, 24, 0.46);
  }

  .portrait-heritage-nav__item.is-active {
    color: #0c665d;
    text-shadow: 0 0 8px rgba(27, 130, 117, 0.24);
  }

  .portrait-heritage-nav__item.is-active > i {
    background:
      radial-gradient(circle at 34% 28%, white 0 8%, transparent 9%),
      radial-gradient(circle at 43% 39%, #d9fff6 0 14%, #49ac9c 34%, #17625a 68%, #072f2d 100%);
    box-shadow: 0 0 11px rgba(38, 139, 125, 0.64);
  }

  .portrait-heritage-nav__winged {
    position: relative;
    display: block;
    width: clamp(33px, 9.5vw, 44px);
    aspect-ratio: 210 / 75;
    background: rgba(247, 243, 226, 0.96);
  }

  .portrait-heritage-nav__winged img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  /* Scheme 2 navigation: the original gemstone line, only reflowed. */
  html[data-portrait-scheme="reflow"] {
    --portrait-nav-height: 108px;
  }

  html[data-portrait-scheme="reflow"]
    .imperial-nav.imperial-nav--line {
    border: 1px solid rgba(174, 126, 45, 0.52) !important;
    border-radius: 7px 16px 7px 16px !important;
    background: linear-gradient(180deg, rgba(255, 255, 251, 0.985), rgba(246, 240, 219, 0.97)) !important;
    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.76),
      0 5px 16px rgba(73, 50, 17, 0.13) !important;
  }

  html[data-portrait-scheme="reflow"] .portrait-line-nav--reflow {
    display: grid !important;
  }

  /* Scheme 3 navigation: editorial archive index, without gemstones. */
  html[data-portrait-scheme="celestial"] {
    --portrait-nav-height: 94px;
  }

  html[data-portrait-scheme="celestial"]
    .imperial-nav.imperial-nav--line {
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(8, 8, 8, 0.985) !important;
    box-shadow: 0 1px 0 #8f1f18, 0 12px 28px rgba(0, 0, 0, 0.38) !important;
  }

  html[data-portrait-scheme="celestial"] .portrait-archive-nav {
    position: absolute;
    inset: 0;
    display: grid !important;
    grid-template-columns: minmax(78px, 23%) 1fr;
    color: #f1eee5;
  }

  .portrait-archive-nav__identity {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 11px 9px 10px;
    border-right: 1px solid rgba(240, 237, 226, 0.22);
    text-align: left;
  }

  .portrait-archive-nav__identity small {
    color: #b6afa3;
    font-family: Arial, sans-serif;
    font-size: 8px;
    letter-spacing: 0.14em;
  }

  .portrait-archive-nav__identity b {
    font-family: "Noto Serif SC", serif;
    font-size: clamp(15px, 4.2vw, 19px);
    letter-spacing: 0.08em;
  }

  .portrait-archive-nav__chapters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
  }

  .portrait-archive-nav__item {
    position: relative;
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 5px 4px;
    border: 0;
    border-right: 1px solid rgba(240, 237, 226, 0.12);
    border-bottom: 1px solid rgba(240, 237, 226, 0.12);
    border-radius: 0;
    background: transparent;
    color: #d8d4ca;
    text-align: left;
  }

  .portrait-archive-nav__item small {
    color: #8d877e;
    font-family: Arial, sans-serif;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .portrait-archive-nav__item span {
    overflow: hidden;
    font-family: "Noto Sans SC", sans-serif;
    font-size: clamp(10px, 2.7vw, 13px);
    font-weight: 620;
    letter-spacing: 0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portrait-archive-nav__item.is-active {
    background: #eee9de;
    color: #101010;
  }

  .portrait-archive-nav__item.is-active::after {
    position: absolute;
    right: 5px;
    bottom: 4px;
    width: 10px;
    height: 2px;
    background: #a92820;
    content: "";
  }

  .portrait-archive-nav__item.is-primary:not(.is-active) {
    color: #ffddd7;
  }

  /* Scheme-specific chapter architecture. */
  .portrait-stage-architecture {
    position: absolute;
    z-index: 5;
    top: calc(var(--portrait-stage-top) + 8px);
    right: 12px;
    left: 12px;
    height: 42px;
    pointer-events: none;
  }

  .portrait-stage-architecture__heritage,
  .portrait-stage-architecture__archive {
    display: none;
  }

  html[data-portrait-scheme="heritage"]
    .portrait-stage-architecture__heritage {
    display: flex;
    align-items: center;
  }

  .portrait-stage-architecture__heritage-line {
    width: 42px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #a97523);
  }

  .portrait-stage-architecture__heritage-seal {
    display: grid;
    width: 28px;
    aspect-ratio: 1;
    margin: 0 9px;
    place-items: center;
    border: 1px solid rgba(155, 102, 28, 0.7);
    background: rgba(251, 247, 228, 0.88);
    color: #8e2a20;
    font-family: "Noto Serif SC", serif;
    font-size: 15px;
  }

  .portrait-stage-architecture__heritage-copy {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #31534b;
  }

  .portrait-stage-architecture__heritage-copy small {
    color: #8e7c61;
    font-family: Arial, sans-serif;
    font-size: 8px;
    letter-spacing: 0.16em;
  }

  .portrait-stage-architecture__heritage-copy b {
    font-family: "Noto Serif SC", serif;
    font-size: 15px;
    letter-spacing: 0.12em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-stage-architecture__archive {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    color: #dad5cb;
  }

  .portrait-stage-architecture__archive > span {
    display: flex;
    align-items: baseline;
    gap: 4px;
  }

  .portrait-stage-architecture__archive small,
  .portrait-stage-architecture__archive em {
    color: #8f8980;
    font-family: Arial, sans-serif;
    font-size: 8px;
    font-style: normal;
    letter-spacing: 0.14em;
  }

  .portrait-stage-architecture__archive b {
    color: #f0ece2;
    font-family: Arial, sans-serif;
    font-size: 18px;
    font-weight: 500;
  }

  .portrait-stage-architecture__archive > i {
    height: 1px;
    background: rgba(224, 218, 205, 0.24);
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  /* Scheme 2 — exact original objects, given a disciplined portrait reflow. */
  html[data-portrait-scheme="reflow"],
  html[data-portrait-scheme="reflow"] body,
  html[data-portrait-scheme="reflow"] .site-shell,
  html[data-portrait-scheme="reflow"] .screen-stack {
    background: #f4f1e7 !important;
    color-scheme: light;
  }

  html[data-portrait-scheme="reflow"] .screen-stack > .screen-stage {
    place-items: center !important;
    background:
      linear-gradient(180deg,rgba(255,255,251,.96),rgba(241,238,226,.96)) !important;
  }

  html[data-portrait-scheme="reflow"]
    .screen-stack > .screen-stage:not(.screen-5):not(.screen-6)
    > .screen-viewport-content {
    width: calc(100vw - 12px) !important;
    height: auto !important;
    max-height: calc(100dvh - var(--portrait-stage-top) - 22px) !important;
    aspect-ratio: 16 / 9 !important;
    align-self: center !important;
    border: 1px solid rgba(168,139,89,.28) !important;
    border-radius: 2px !important;
    background: #f8f6ed !important;
    box-shadow: 0 14px 28px rgba(54,47,34,.14) !important;
  }

  html[data-portrait-scheme="reflow"]
    .screen-stack > .screen-stage:not(.screen-5):not(.screen-6)
    > .screen-viewport-content > .screen-artwork {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"]
    :is(.portrait-home-reconstruction, .portrait-statement-reconstruction) {
    display: none !important;
  }

  html[data-portrait-scheme="reflow"] .screen-5 > .screen-viewport-content,
  html[data-portrait-scheme="reflow"] .screen-6 > .screen-viewport-content {
    border: 1px solid rgba(137,171,201,.48) !important;
    border-radius: 8px !important;
    background: #f8f6ed !important;
    box-shadow: 0 14px 30px rgba(38,72,102,.12) !important;
  }

  html[data-portrait-scheme="reflow"] .screen-6 .login-composition {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"] .screen-6 .login-composition__base {
    position: absolute !important;
    inset: 0 0 auto !important;
    width: 100% !important;
    height: 31% !important;
    object-fit: cover !important;
    object-position: 50% 10% !important;
    filter: none !important;
  }

  html[data-portrait-scheme="reflow"] .login-card-layer {
    position: absolute !important;
    inset: 29% 8px 44px !important;
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: repeat(2,minmax(0,1fr));
    gap: 6px;
    width: auto !important;
    height: auto !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"] .login-card-slot {
    position: relative !important;
    inset: auto !important;
    align-self: center;
    justify-self: center;
    width: auto !important;
    height: 91% !important;
    aspect-ratio: .274 !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"] .login-card-spinner {
    width: 100% !important;
    height: 100% !important;
  }

  html[data-portrait-scheme="reflow"] .login-composition__footer-notices {
    position: absolute !important;
    right: 8px !important;
    bottom: 7px !important;
    left: 8px !important;
    display: flex !important;
    justify-content: space-around;
    width: auto !important;
    height: 28px !important;
    color: #174735 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"] .login-composition__footer-notice {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    min-height: 0 !important;
    font-size: 9px !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"]
    :is(.section-five-palace,.section-five-dream-kingdom) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  html[data-portrait-scheme="reflow"]
    .section-five-dream-kingdom__browse-choice {
    max-width: calc(100% - 10px) !important;
    max-height: calc(100% - 10px) !important;
    transform: scale(.78) !important;
  }

  html[data-portrait-scheme="reflow"]
    .section-five-dream-kingdom__node-shortcuts {
    transform: scale(.78) !important;
    transform-origin: center !important;
  }

  html[data-portrait-scheme="reflow"]
    :is(
      .identity-gateway-portal,
      .first-visit-portal,
      .temporary-service-portal,
      .heart-service-portal,
      .lifetime-service-portal,
      .more-exclusive-services,
      .more-service-detail,
      .more-services-editor
    ) {
    color-scheme: light;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  /* Scheme 1 — the animation is preserved, while its auditorium becomes a
     quiet jade-and-ink chamber that belongs to the first two chapters. */
  html[data-portrait-scheme="heritage"] .screen-3 > .screen-viewport-content {
    border: 1px solid rgba(146, 95, 25, 0.5) !important;
    border-radius: 28px 5px 28px 5px !important;
    background: #06110f !important;
    box-shadow:
      inset 0 0 0 4px rgba(231, 220, 179, 0.12),
      0 18px 38px rgba(27, 61, 53, 0.22) !important;
  }

  html[data-portrait-scheme="heritage"]
    .cognition-section-composition--cinematic {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit;
    overflow: hidden;
  }

  html[data-portrait-scheme="heritage"]
    :is(.cognition-cinema-playback, .cognition-cinema-final-dialog) {
    border: 1px solid rgba(207, 167, 83, 0.5) !important;
    border-radius: 18px 3px 18px 3px !important;
    background:
      linear-gradient(135deg, rgba(8, 24, 20, 0.96), rgba(17, 39, 33, 0.94)) !important;
    box-shadow: inset 4px 0 0 rgba(182, 126, 34, 0.72) !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(.cognition-cinema-skip-prompt, .cognition-cinema-choice-actions) {
    right: 14px !important;
    left: 14px !important;
    width: auto !important;
  }

  /* Scheme 1 — the two browse modes become stacked ceremonial passages. */
  html[data-portrait-scheme="heritage"]
    .screen-5 > .screen-viewport-content {
    border: 1px solid rgba(145, 92, 24, 0.52) !important;
    border-radius: 28px 5px 28px 5px !important;
    background:
      radial-gradient(circle at 82% 18%, rgba(255,255,255,.82), transparent 26%),
      linear-gradient(155deg, #f7f2df, #deebe0 58%, #ede1c4) !important;
    box-shadow: 0 18px 38px rgba(29, 72, 62, 0.18) !important;
  }

  html[data-portrait-scheme="heritage"] .section-five-palace,
  html[data-portrait-scheme="heritage"] .section-five-dream-kingdom {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-choice {
    position: absolute !important;
    inset: 52px 14px 14px !important;
    z-index: 20 !important;
    display: grid !important;
    grid-template-rows: auto auto 1fr;
    align-content: stretch;
    gap: 12px;
    width: auto !important;
    height: auto !important;
    padding: 24px 15px 16px !important;
    border: 1px solid rgba(163, 111, 31, 0.5) !important;
    border-radius: 24px 4px 24px 4px !important;
    background:
      linear-gradient(90deg, rgba(24, 102, 88, 0.08), transparent 18% 82%, rgba(24, 102, 88, 0.08)),
      rgba(255, 253, 243, 0.93) !important;
    box-shadow: inset 0 0 0 4px rgba(255,255,255,.62) !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(
      .section-five-dream-kingdom__browse-choice-angel,
      .section-five-dream-kingdom__browse-choice-magic-rain
    ) {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-choice-title-rule {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    align-items: center;
    gap: 9px;
    color: #9a6a23 !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-choice h2 {
    position: relative !important;
    inset: auto !important;
    margin: 0 !important;
    color: #184f47 !important;
    font-family: "Noto Serif SC", serif !important;
    font-size: clamp(29px, 8.7vw, 43px) !important;
    letter-spacing: .14em !important;
    line-height: 1.15 !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-choice h2 span {
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-relics {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-relic {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border: 1px solid rgba(151, 99, 26, 0.5) !important;
    border-radius: 22px 4px 22px 4px !important;
    background: linear-gradient(140deg, #fbf7e7, #dceadf) !important;
    box-shadow: inset 5px 0 0 rgba(31, 111, 97, 0.58), 0 9px 18px rgba(38,82,70,.12) !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__timegate {
    position: absolute !important;
    inset: 0 !important;
    display: grid !important;
    place-items: center;
    width: 100% !important;
    height: 100% !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(
      .section-five-dream-kingdom__timegate-space,
      .section-five-dream-kingdom__timegate-stars
    ) {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__timegate-core {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    width: calc(100% - 48px) !important;
    height: auto !important;
    padding-left: 14px;
    color: #1d5148 !important;
    text-align: left;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .section-five-dream-kingdom__timegate-core small {
    color: #967441 !important;
    font-size: 9px !important;
    letter-spacing: .16em !important;
  }

  html[data-portrait-scheme="heritage"] .section-five-dream-kingdom__timegate-core b {
    margin: 8px 0 4px;
    font-family: "Noto Serif SC", serif !important;
    font-size: clamp(28px, 8vw, 40px) !important;
  }

  html[data-portrait-scheme="heritage"] .section-five-dream-kingdom__timegate-core em {
    color: #625b4d !important;
    font-size: clamp(12px, 3.3vw, 15px) !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__timegate-threshold {
    right: 18px !important;
    bottom: 14px !important;
    left: auto !important;
    color: #9b2f24 !important;
  }

  /* Scheme 1 — eight nodes are a jade seal register, not a squeezed star map. */
  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcuts {
    position: absolute !important;
    inset: 52px 10px 10px !important;
    z-index: 18 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 7px;
    width: auto !important;
    height: auto !important;
    padding: 16px 10px 10px !important;
    border: 1px solid rgba(156, 103, 27, 0.46);
    border-radius: 22px 4px 22px 4px;
    background: rgba(248, 245, 231, 0.94) !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__celestial-chart {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-item {
    position: relative !important;
    inset: auto !important;
    z-index: 2 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border: 1px solid rgba(39, 104, 92, 0.35) !important;
    border-radius: 15px 3px 15px 3px !important;
    background: linear-gradient(145deg, rgba(255,255,250,.96), rgba(221,235,224,.9)) !important;
    box-shadow: inset 3px 0 0 rgba(169, 114, 31, .52) !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-item.is-current {
    border-color: rgba(157, 94, 22, .74) !important;
    background: linear-gradient(145deg, #fff4ce, #d7eee0) !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut {
    position: absolute !important;
    inset: 0 !important;
    display: grid !important;
    grid-template-columns: 48px 1fr;
    align-items: center;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(
      .section-five-dream-kingdom__node-birth-trail,
      .section-five-dream-kingdom__node-shortcut-orbit,
      .section-five-dream-kingdom__node-constellation,
      .section-five-dream-kingdom__planning-energy-mist,
      .section-five-dream-kingdom__description-runner-arrow
    ) {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-crystal {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 38px !important;
    height: 38px !important;
    margin-left: 7px;
    place-items: center;
    border: 1px solid rgba(146, 92, 24, .62) !important;
    border-radius: 4px !important;
    background: #f8f1d9 !important;
    color: #8e2e23 !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-crystal > :is(i, b) {
    opacity: 1 !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-crystal b {
    position: relative !important;
    inset: auto !important;
    color: #8d2b20 !important;
    font-family: "Noto Serif SC", serif !important;
    font-size: 15px !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-hit {
    position: absolute !important;
    inset: -8px -130px -8px -8px !important;
    width: auto !important;
    height: auto !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-copy {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 7px;
    color: #31564e !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-copy small {
    color: #967b4f !important;
    font-size: 9px !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__node-shortcut-copy b {
    font-size: clamp(10px, 2.7vw, 13px) !important;
    line-height: 1.25 !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__recommendation-seal {
    top: 4px !important;
    right: 4px !important;
    transform: scale(.72) !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__central-more-tunnel {
    position: relative !important;
    inset: auto !important;
    grid-column: 1 / -1;
    grid-row: 5;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    place-items: center;
    border: 1px solid rgba(153, 95, 24, .56) !important;
    border-radius: 15px 3px 15px 3px !important;
    background: linear-gradient(90deg, #e4eee2, #fbf0cc, #e4eee2) !important;
    box-shadow: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__central-more-tunnel-depth {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__central-more-tunnel-copy {
    position: relative !important;
    inset: auto !important;
    color: #20564c !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__description-spotlight-layer {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"]
    .section-five-dream-kingdom__browse-switch {
    top: 8px !important;
    right: 10px !important;
    left: auto !important;
    width: auto !important;
    height: 38px !important;
    padding: 5px 12px !important;
    border: 0 !important;
    border-bottom: 1px solid #a97628 !important;
    border-radius: 0 !important;
    background: rgba(249,246,232,.9) !important;
    box-shadow: none !important;
    color: #28564d !important;
    transform: none !important;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  /* -------------------------------------------------------------------- */
  /* Scheme 1 — Imperial jade gallery, rebuilt for a vertical ceremony.   */
  /* -------------------------------------------------------------------- */
  html[data-portrait-scheme="heritage"] {
    --heritage-ink: #173f39;
    --heritage-muted: #7e735f;
    --heritage-gold: #a87322;
    --heritage-red: #9e2d22;
    --heritage-jade: #dbe9dd;
    --heritage-paper: #f8f4e4;
    background: #e8ebdf !important;
    color-scheme: light;
  }

  html[data-portrait-scheme="heritage"] body,
  html[data-portrait-scheme="heritage"] .site-shell,
  html[data-portrait-scheme="heritage"] .screen-stack {
    background: #e8ebdf !important;
  }

  html[data-portrait-scheme="heritage"]
    .screen-stack
    > .screen-stage {
    background:
      radial-gradient(circle at 84% 20%, rgba(255, 255, 255, 0.92), transparent 28%),
      linear-gradient(155deg, #f8f4e5 0%, #e2ece2 54%, #eee5cc 100%) !important;
  }

  html[data-portrait-scheme="heritage"]
    .screen-stack
    > .screen-stage::before {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    background:
      linear-gradient(90deg, rgba(27, 92, 81, 0.12) 0 1px, transparent 1px) 18px 0 / calc(100% - 36px) 100% no-repeat,
      linear-gradient(180deg, rgba(168, 115, 34, 0.14), transparent 18% 82%, rgba(168, 115, 34, 0.12)) !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
    content: "";
    pointer-events: none;
  }

  html[data-portrait-scheme="heritage"]
    .screen-stack
    > .screen-stage::after {
    position: absolute !important;
    z-index: 1 !important;
    inset: var(--portrait-stage-top) 8px max(8px, var(--portrait-safe-bottom)) !important;
    display: block !important;
    border: 1px solid rgba(155, 104, 31, 0.46);
    border-radius: 26px 7px 26px 7px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.64), transparent 13% 87%, rgba(255, 255, 255, 0.48)),
      transparent !important;
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.48),
      0 18px 38px rgba(42, 75, 62, 0.14);
    opacity: 1 !important;
    content: "";
    pointer-events: none;
  }

  html[data-portrait-scheme="heritage"]
    .screen-stack
    > .screen-stage
    > .screen-viewport-content {
    border: 0 !important;
    border-radius: 24px 6px 24px 6px !important;
    background: rgba(249, 247, 235, 0.52) !important;
    box-shadow: none !important;
  }

  .portrait-home-reconstruction,
  .portrait-statement-reconstruction {
    display: none;
  }

  html[data-portrait-scheme="heritage"]
    .portrait-home-reconstruction--heritage,
  html[data-portrait-scheme="heritage"]
    .portrait-statement-reconstruction--heritage {
    display: flex;
  }

  html[data-portrait-scheme="heritage"]
    :is(.screen-1, .screen-2)
    .screen-artwork,
  html[data-portrait-scheme="heritage"]
    .screen-1
    :is(.home-lifetime-login-entry, .home-text-management-entry) {
    display: none !important;
  }

  .portrait-home-reconstruction--heritage {
    position: absolute;
    inset: 0;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(70px, 10dvh, 98px) clamp(22px, 7vw, 48px) clamp(24px, 5dvh, 46px);
    overflow: hidden;
    color: var(--heritage-ink);
  }

  .portrait-home-reconstruction__jade-field {
    position: absolute;
    top: clamp(48px, 7dvh, 76px);
    right: clamp(-92px, -17vw, -54px);
    display: grid;
    width: min(76vw, 360px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(167, 116, 38, 0.48);
    border-radius: 50%;
    background:
      radial-gradient(circle at 39% 34%, rgba(255, 255, 255, 0.96), transparent 12%),
      radial-gradient(circle, rgba(222, 237, 225, 0.92) 0 36%, transparent 36.5% 44%, rgba(226, 237, 222, 0.8) 44.5% 66%, transparent 66.5% 72%, rgba(203, 222, 209, 0.5) 72.5% 100%);
    box-shadow:
      inset 0 0 42px rgba(84, 130, 112, 0.18),
      0 28px 60px rgba(55, 88, 73, 0.16);
    transform: rotate(-7deg);
  }

  .portrait-home-reconstruction__jade-field > i {
    position: absolute;
    inset: 15%;
    border: 1px solid rgba(170, 118, 39, 0.4);
    border-radius: 50%;
  }

  .portrait-home-reconstruction__jade-field > i:nth-child(2) {
    inset: 35%;
  }

  .portrait-home-reconstruction__jade-field > b {
    display: grid;
    width: 52px;
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid #a93628;
    color: #a93628;
    font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
    font-size: 13px;
    line-height: 1.05;
    text-align: center;
    transform: rotate(7deg);
  }

  .portrait-home-reconstruction__heritage-copy {
    position: relative;
    z-index: 2;
    margin-bottom: clamp(22px, 4dvh, 38px);
  }

  .portrait-home-reconstruction__heritage-copy small {
    display: block;
    margin-bottom: 14px;
    color: #56483a;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(15px, 4.2vw, 21px);
    letter-spacing: 0.1em;
  }

  .portrait-home-reconstruction__heritage-copy small::after {
    display: block;
    width: 74px;
    height: 1px;
    margin-top: 12px;
    background: linear-gradient(90deg, #a97225, transparent);
    content: "";
  }

  .portrait-home-reconstruction__heritage-copy h1 {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
    color: #172c27;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(40px, 12.8vw, 66px);
    font-weight: 760;
    letter-spacing: 0.055em;
    line-height: 1.08;
  }

  .portrait-home-reconstruction__heritage-copy h1 span {
    height: 18px;
    margin-left: 0.8em;
    color: var(--heritage-red);
    font-size: 24px;
    line-height: 18px;
  }

  .portrait-home-reconstruction__heritage-copy p {
    margin: 18px 0 0;
    color: #5d5142;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(17px, 4.8vw, 23px);
    letter-spacing: 0.08em;
  }

  .portrait-home-reconstruction__primary {
    position: relative;
    z-index: 3;
    display: flex;
    min-height: 70px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    padding: 13px 18px;
    border: 1px solid rgba(151, 95, 28, 0.76);
    border-radius: 2px 16px 2px 16px;
    background: linear-gradient(135deg, #8f241b, #b13c2a 58%, #7e1915);
    box-shadow:
      inset 0 0 0 2px rgba(255, 221, 161, 0.24),
      0 13px 24px rgba(84, 33, 18, 0.2);
    color: #fff2d1;
    text-align: left;
  }

  .portrait-home-reconstruction__primary small {
    color: rgba(255, 242, 209, 0.68);
    font-family: Arial, sans-serif;
    font-size: 9px;
    letter-spacing: 0.15em;
  }

  .portrait-home-reconstruction__primary span {
    font-family: "Noto Serif SC", serif;
    font-size: clamp(16px, 4.5vw, 22px);
    font-weight: 700;
    letter-spacing: 0.07em;
  }

  .portrait-home-reconstruction__management {
    position: absolute;
    z-index: 4;
    top: 16px;
    right: 16px;
    padding: 8px 11px;
    border: 1px solid rgba(149, 101, 31, 0.46);
    border-radius: 999px;
    background: rgba(249, 246, 231, 0.82);
    color: #735a33;
    font-family: "Noto Serif SC", serif;
    font-size: 12px;
  }

  .portrait-statement-reconstruction--heritage {
    position: absolute;
    inset: 0;
    flex-direction: column;
    gap: clamp(14px, 2.4dvh, 24px);
    padding: clamp(62px, 9dvh, 88px) clamp(18px, 5vw, 34px) 24px;
    color: var(--heritage-ink);
  }

  .portrait-statement-reconstruction--heritage > header {
    padding: 18px 18px 20px;
    border-top: 2px solid rgba(161, 108, 29, 0.62);
    border-bottom: 1px solid rgba(49, 103, 91, 0.26);
    background: rgba(255, 253, 244, 0.62);
  }

  .portrait-statement-reconstruction--heritage header small {
    color: #75654d;
    font-family: "Noto Serif SC", serif;
    font-size: 14px;
    letter-spacing: 0.13em;
  }

  .portrait-statement-reconstruction--heritage header h2 {
    margin: 10px 0 8px;
    color: #18483e;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(34px, 9.6vw, 50px);
    letter-spacing: 0.04em;
    line-height: 1.08;
  }

  .portrait-statement-reconstruction--heritage header p,
  .portrait-statement-reconstruction--heritage article p {
    margin: 0;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.75;
  }

  .portrait-statement-reconstruction--heritage article {
    display: grid;
    flex: 1 1 0;
    grid-template-columns: 62px 1fr;
    align-items: center;
    gap: 15px;
    min-height: 0;
    padding: 16px;
    border: 1px solid rgba(162, 115, 43, 0.4);
    border-radius: 18px 3px 18px 3px;
    background:
      linear-gradient(135deg, rgba(255, 255, 250, 0.82), rgba(216, 234, 219, 0.62));
    box-shadow: 0 11px 24px rgba(48, 87, 72, 0.1);
  }

  .portrait-statement-reconstruction--heritage article > span {
    display: grid;
    width: 58px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(160, 106, 31, 0.62);
    border-radius: 50%;
    background: rgba(249, 243, 220, 0.88);
    color: var(--heritage-red);
    font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
    font-size: 30px;
  }

  .portrait-statement-reconstruction--heritage article h3 {
    margin: 0 0 8px;
    color: #9d2b20;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(24px, 7vw, 34px);
    letter-spacing: 0.05em;
  }

  /* Wisdom is rebuilt as a vertical triptych with two explicit entrances. */
  html[data-portrait-scheme="heritage"] .screen-4 .wisdom-route-composition {
    position: absolute !important;
    inset: 0 !important;
    overflow: hidden !important;
    background:
      radial-gradient(circle at 86% 18%, rgba(204, 230, 215, 0.72), transparent 28%),
      linear-gradient(160deg, rgba(251, 249, 238, 0.9), rgba(229, 236, 221, 0.9));
  }

  html[data-portrait-scheme="heritage"]
    .screen-4
    :is(.wisdom-route-composition__base, .wisdom-route-overlay) {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-route-copy-layer {
    position: absolute !important;
    z-index: 3 !important;
    top: 58px !important;
    right: 16px !important;
    bottom: 132px !important;
    left: 16px !important;
    display: grid !important;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 10px;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-route-copy {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-columns: minmax(108px, 34%) 1fr;
    align-items: center;
    gap: 12px;
    width: auto !important;
    height: auto !important;
    padding: 14px !important;
    border: 1px solid rgba(157, 108, 35, 0.36);
    border-radius: 16px 3px 16px 3px;
    background: rgba(255, 254, 247, 0.72);
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-route-copy h3 {
    margin: 0 !important;
    font-size: clamp(20px, 5.8vw, 29px) !important;
    line-height: 1.22 !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-route-copy p {
    margin: 0 !important;
    font-size: clamp(12px, 3.25vw, 15px) !important;
    line-height: 1.55 !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-route-copy p span {
    display: inline !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(.wisdom-teacher-trigger, .wisdom-private-trigger) {
    position: absolute !important;
    z-index: 8 !important;
    top: auto !important;
    bottom: 22px !important;
    display: grid !important;
    width: calc(50% - 24px) !important;
    height: 88px !important;
    place-items: center;
    border: 1px solid rgba(159, 106, 30, 0.52) !important;
    border-radius: 16px 3px 16px 3px !important;
    background: linear-gradient(145deg, #faf6e4, #dceadf) !important;
    box-shadow: 0 9px 18px rgba(39, 77, 64, 0.12) !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-teacher-trigger {
    left: 16px !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-private-trigger {
    right: 16px !important;
  }

  html[data-portrait-scheme="heritage"] .wisdom-teacher-trigger::before {
    content: "我·老师·绝世智者";
  }

  html[data-portrait-scheme="heritage"] .wisdom-private-trigger::before {
    content: "我·私人·顶级客卿";
  }

  html[data-portrait-scheme="heritage"]
    :is(.wisdom-teacher-trigger, .wisdom-private-trigger)::before {
    color: #31574e;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(14px, 3.8vw, 18px);
    font-weight: 720;
    letter-spacing: 0.04em;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  /* Scheme 1 — four identities become four carved jade doors. The existing
     stop-and-enter interaction still owns every door. */
  html[data-portrait-scheme="heritage"] .screen-6 > .screen-viewport-content {
    border: 1px solid rgba(145, 92, 24, .54) !important;
    border-radius: 28px 5px 28px 5px !important;
    background:
      radial-gradient(circle at 80% 16%, rgba(255,255,255,.84), transparent 27%),
      linear-gradient(155deg, #f8f3e2, #dbe9dd 58%, #eadfc2) !important;
    box-shadow: 0 18px 38px rgba(29,72,62,.18) !important;
  }

  html[data-portrait-scheme="heritage"] .login-composition {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-composition__base {
    display: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-composition::before {
    position: absolute;
    top: 58px;
    right: 18px;
    left: 18px;
    padding: 18px 12px 15px;
    border-top: 1px solid rgba(155,102,29,.48);
    border-bottom: 1px solid rgba(155,102,29,.48);
    color: #1f5048;
    content: "四道身份之门";
    font-family: "Noto Serif SC", serif;
    font-size: clamp(27px, 8vw, 40px);
    letter-spacing: .15em;
    text-align: center;
  }

  html[data-portrait-scheme="heritage"] .login-card-layer {
    position: absolute !important;
    inset: 154px 14px 62px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: auto !important;
    height: auto !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-card-slot {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    place-items: center;
    border: 1px solid rgba(149,96,23,.56) !important;
    border-radius: 22px 4px 22px 4px !important;
    background:
      linear-gradient(145deg, rgba(255,255,250,.96), rgba(216,233,219,.94)) !important;
    box-shadow: inset 5px 0 0 rgba(32,105,92,.56), 0 10px 20px rgba(34,76,65,.13) !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-card-slot::before {
    display: grid;
    width: 62px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(145,91,23,.64);
    background: #f8efd3;
    color: #922e24;
    content: "门";
    font-family: "Noto Serif SC", serif;
    font-size: 28px;
  }

  html[data-portrait-scheme="heritage"] .login-card-slot::after {
    position: absolute;
    right: 7px;
    bottom: 10px;
    left: 7px;
    color: #25574e;
    content: "身份入口";
    font-family: "Noto Serif SC", serif;
    font-size: clamp(12px,3.2vw,15px);
    font-weight: 700;
    letter-spacing: .05em;
    text-align: center;
  }

  html[data-portrait-scheme="heritage"] .login-card-slot--first-visit::before { content: "叩"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--first-visit::after { content: "初访 · 叩关"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--lifetime::before { content: "尊"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--lifetime::after { content: "顶级 · 终生客户"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--temporary::before { content: "临"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--temporary::after { content: "临时 · 客户"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--heart::before { content: "心"; }
  html[data-portrait-scheme="heritage"] .login-card-slot--heart::after { content: "心语 · 客户"; }

  html[data-portrait-scheme="heritage"] .login-card-spinner {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-card-form {
    position: absolute !important;
    inset: 0 !important;
    z-index: 4 !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    padding: 18px 12px !important;
    place-content: center;
    gap: 12px;
    border-radius: inherit;
    background: rgba(248,244,227,.96) !important;
    color: #24564e !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-card-form button {
    min-height: 44px;
    border: 1px solid #9e6e28 !important;
    border-radius: 12px 3px 12px 3px !important;
    background: linear-gradient(135deg,#f9f0d2,#d5e8dc) !important;
    color: #184d45 !important;
  }

  html[data-portrait-scheme="heritage"] .login-composition__footer-notices {
    position: absolute !important;
    right: 14px !important;
    bottom: 12px !important;
    left: 14px !important;
    display: flex !important;
    justify-content: space-between;
    gap: 4px;
    width: auto !important;
    height: auto !important;
    color: #6f6757 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="heritage"] .login-composition__footer-notice {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 10px !important;
  }

  /* Scheme 1 deep pages keep the same information, with manuscript framing. */
  html[data-portrait-scheme="heritage"]
    :is(
      .identity-gateway-portal,
      .first-visit-portal,
      .temporary-service-portal,
      .heart-service-portal,
      .lifetime-service-portal,
      .more-exclusive-services,
      .more-service-detail,
      .more-services-editor
    ) {
    background:
      radial-gradient(circle at 85% 13%, rgba(255,255,255,.84), transparent 24%),
      linear-gradient(155deg,#f8f3e2,#dfeae0 58%,#ece1c6) !important;
    color: #244a43 !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(
      .identity-gateway-portal__panel,
      .first-visit-portal__access-shell,
      .first-visit-portal__arrival-card,
      .temporary-service-portal__stage,
      .heart-service-portal__stage,
      .lifetime-service-portal__stage,
      .more-exclusive-services__directory-shell,
      .more-service-detail__panel,
      .wisdom-private-feature-page
    ) {
    border: 1px solid rgba(150,96,23,.48) !important;
    border-radius: 24px 4px 24px 4px !important;
    background: rgba(252,249,235,.95) !important;
    box-shadow: inset 4px 0 0 rgba(35,109,96,.42), 0 18px 38px rgba(29,72,62,.16) !important;
  }

  html[data-portrait-scheme="heritage"]
    :is(
      .identity-gateway-portal__service-directory button,
      .more-exclusive-services__node-selector-trigger,
      .more-exclusive-services__node-keys button,
      .section-five-dream-kingdom__node-service-entry
    ) {
    border: 1px solid rgba(42,111,99,.36) !important;
    border-radius: 14px 3px 14px 3px !important;
    background: linear-gradient(135deg,rgba(255,255,250,.95),rgba(222,235,224,.9)) !important;
    color: #24564d !important;
    box-shadow: inset 3px 0 0 rgba(165,108,27,.48) !important;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  /* -------------------------------------------------------------------- */
  /* Scheme 3 — a private editorial archive, built from a new visual core. */
  /* -------------------------------------------------------------------- */
  html[data-portrait-scheme="celestial"] {
    --archive-black: #0a0a09;
    --archive-paper: #ebe7dc;
    --archive-paper-2: #d9d3c6;
    --archive-red: #aa2b22;
    --archive-muted: #8d887e;
    background: var(--archive-black) !important;
    color-scheme: dark;
  }

  html[data-portrait-scheme="celestial"] body,
  html[data-portrait-scheme="celestial"] .site-shell,
  html[data-portrait-scheme="celestial"] .screen-stack {
    background: var(--archive-black) !important;
  }

  html[data-portrait-scheme="celestial"] .screen-stack > .screen-stage {
    background:
      linear-gradient(90deg, transparent 0 5.8%, rgba(238,232,220,.08) 5.9% 6%, transparent 6.1%),
      linear-gradient(180deg,#10100f,#070706) !important;
  }

  html[data-portrait-scheme="celestial"] .screen-stack > .screen-stage::before,
  html[data-portrait-scheme="celestial"] .screen-stack > .screen-stage::after {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .screen-stack > .screen-stage > .screen-viewport-content {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-portrait-scheme="celestial"] .screen-1 .screen-artwork,
  html[data-portrait-scheme="celestial"] .screen-2 .screen-artwork,
  html[data-portrait-scheme="celestial"]
    :is(.home-lifetime-login-entry,.home-text-management-entry) {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive {
    position: absolute;
    inset: 48px 6px 6px;
    z-index: 9;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) auto auto;
    border-top: 1px solid rgba(235,231,220,.34);
    border-bottom: 1px solid rgba(235,231,220,.34);
    color: var(--archive-paper);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive > header {
    display: flex;
    justify-content: space-between;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: #8f8980;
    font-family: Arial,sans-serif;
    font-size: 9px;
    letter-spacing: .14em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction__archive-title {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    padding: 20px 12px;
    border-bottom: 1px solid rgba(235,231,220,.18);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction__archive-title > span {
    color: var(--archive-red);
    font-family: Arial,sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .28em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction__archive-title h1 {
    margin: 18px 0 12px;
    max-width: 330px;
    font-family: "Noto Serif SC",serif;
    font-size: clamp(52px,16vw,76px);
    font-weight: 520;
    letter-spacing: .03em;
    line-height: 1.04;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction__archive-title p {
    width: 76%;
    margin: 0;
    color: #aba59b;
    font-size: clamp(14px,3.8vw,17px);
    line-height: 1.75;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive dl {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    margin: 0;
    border-bottom: 1px solid rgba(235,231,220,.18);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive dl > div {
    min-width: 0;
    padding: 12px 8px;
    border-right: 1px solid rgba(235,231,220,.14);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive dt {
    color: var(--archive-muted);
    font-size: 10px;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive dd {
    margin: 7px 0 0;
    overflow: hidden;
    color: var(--archive-paper);
    font-size: clamp(11px,3vw,14px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive .portrait-home-reconstruction__primary {
    position: relative;
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border: 0;
    border-radius: 0;
    background: var(--archive-paper);
    color: #11110f;
    text-align: left;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive .portrait-home-reconstruction__primary small {
    font-family: Arial,sans-serif;
    font-size: 8px;
    letter-spacing: .14em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive .portrait-home-reconstruction__primary span {
    font-size: clamp(13px,3.5vw,17px);
    font-weight: 700;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-home-reconstruction--archive .portrait-home-reconstruction__management {
    position: absolute;
    right: 8px;
    top: 52px;
    border: 0;
    border-bottom: 1px solid var(--archive-red);
    border-radius: 0;
    background: transparent;
    color: #a9a399;
    font-size: 10px;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive {
    position: absolute;
    inset: 48px 6px 6px;
    z-index: 9;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) auto auto auto;
    color: var(--archive-paper);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive header {
    display: flex;
    justify-content: space-between;
    padding: 12px 8px;
    border-top: 1px solid rgba(235,231,220,.34);
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: var(--archive-muted);
    font: 9px Arial,sans-serif;
    letter-spacing: .13em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive h2 {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    padding: 16px 8px;
    border-bottom: 1px solid rgba(235,231,220,.18);
    font-family: "Noto Serif SC",serif;
    font-size: clamp(58px,18vw,86px);
    font-weight: 480;
    line-height: 1.05;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive h2 em {
    color: var(--archive-red);
    font-size: .52em;
    font-style: normal;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction__archive-lead {
    margin: 0;
    padding: 18px 8px;
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: #bbb5ab;
    font-size: clamp(14px,3.9vw,17px);
    line-height: 1.7;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction__archive-rule {
    display: grid;
    grid-template-columns: 35% 1fr;
    gap: 12px;
    padding: 15px 8px;
    border-bottom: 1px solid rgba(235,231,220,.18);
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction__archive-rule small {
    color: var(--archive-red);
    font: 9px Arial,sans-serif;
    letter-spacing: .12em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction__archive-rule p {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive footer {
    padding: 18px 8px;
    background: var(--archive-paper);
    color: #11110f;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive footer small {
    display: block;
    margin-bottom: 8px;
    color: #706b62;
    font: 8px Arial,sans-serif;
    letter-spacing: .18em;
  }

  html[data-portrait-scheme="celestial"]
    .portrait-statement-reconstruction--archive footer strong {
    font-family: "Noto Serif SC",serif;
    font-size: clamp(20px,5.8vw,28px);
    font-weight: 520;
  }

  /* Scheme 3 animation room: content and sequence unchanged. */
  html[data-portrait-scheme="celestial"] .screen-3 > .screen-viewport-content {
    margin: 0 6px !important;
    width: calc(100% - 12px) !important;
    border-top: 1px solid rgba(235,231,220,.28) !important;
    border-bottom: 1px solid rgba(235,231,220,.28) !important;
    background: #000 !important;
  }

  html[data-portrait-scheme="celestial"]
    .cognition-section-composition--cinematic {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    overflow: hidden;
  }

  html[data-portrait-scheme="celestial"]
    :is(.cognition-cinema-playback,.cognition-cinema-final-dialog) {
    border: 0 !important;
    border-top: 1px solid rgba(235,231,220,.4) !important;
    border-bottom: 1px solid rgba(235,231,220,.4) !important;
    border-radius: 0 !important;
    background: rgba(9,9,8,.96) !important;
    box-shadow: inset 4px 0 0 var(--archive-red) !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(.cognition-cinema-skip-prompt,.cognition-cinema-choice-actions) {
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
  }

  /* Scheme 3 wisdom: an editorial triptych, not the former celestial route. */
  html[data-portrait-scheme="celestial"]
    :is(.wisdom-route-composition__base,.wisdom-route-overlay,.wisdom-route-gem) {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-composition {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #0a0a09 !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-composition::before {
    position: absolute;
    top: 58px;
    right: 14px;
    left: 14px;
    padding: 12px 0;
    border-top: 1px solid rgba(235,231,220,.34);
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: var(--archive-paper);
    content: "智慧引入 / PRIVATE INTELLIGENCE";
    font: 11px Arial,sans-serif;
    letter-spacing: .13em;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-copy-layer {
    position: absolute !important;
    inset: 116px 14px 124px !important;
    z-index: 5 !important;
    display: grid !important;
    grid-template-rows: repeat(3,minmax(0,1fr));
    gap: 1px;
    background: rgba(235,231,220,.2);
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-copy {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-columns: minmax(96px,31%) 1fr;
    align-items: center;
    gap: 13px;
    width: auto !important;
    height: auto !important;
    padding: 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #11110f !important;
    color: var(--archive-paper) !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-copy h3 {
    margin: 0 !important;
    color: var(--archive-paper) !important;
    font-family: "Noto Serif SC",serif !important;
    font-size: clamp(20px,5.5vw,27px) !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-copy p {
    margin: 0 !important;
    color: #aaa49a !important;
    font-size: clamp(11px,3vw,14px) !important;
    line-height: 1.55 !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-route-copy p span {
    display: inline !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(.wisdom-teacher-trigger,.wisdom-private-trigger) {
    position: absolute !important;
    z-index: 8 !important;
    top: auto !important;
    bottom: 18px !important;
    display: grid !important;
    width: calc(50% - 21px) !important;
    height: 88px !important;
    place-items: center;
    border: 0 !important;
    border-top: 1px solid rgba(235,231,220,.38) !important;
    border-bottom: 1px solid rgba(235,231,220,.2) !important;
    border-radius: 0 !important;
    background: #151513 !important;
    box-shadow: none !important;
  }

  html[data-portrait-scheme="celestial"] .wisdom-teacher-trigger { left: 14px !important; }
  html[data-portrait-scheme="celestial"] .wisdom-private-trigger { right: 14px !important; }
  html[data-portrait-scheme="celestial"] .wisdom-teacher-trigger::before { content:"01 / 我的老师"; }
  html[data-portrait-scheme="celestial"] .wisdom-private-trigger::before { content:"02 / 私人客卿"; }

  html[data-portrait-scheme="celestial"]
    :is(.wisdom-teacher-trigger,.wisdom-private-trigger)::before {
    color: var(--archive-paper);
    font: 600 clamp(12px,3.5vw,16px) "Noto Sans SC",sans-serif;
    letter-spacing: .05em;
  }

  /* Scheme 3 browse choice: two access files. */
  html[data-portrait-scheme="celestial"]
    :is(.section-five-palace,.section-five-dream-kingdom) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    background: #0a0a09 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-choice {
    position: absolute !important;
    inset: 50px 8px 8px !important;
    z-index: 20 !important;
    display: grid !important;
    grid-template-rows: auto auto minmax(0,1fr);
    gap: 0;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-top: 1px solid rgba(235,231,220,.34) !important;
    border-radius: 0 !important;
    background: #0a0a09 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(.section-five-dream-kingdom__browse-choice-angel,.section-five-dream-kingdom__browse-choice-magic-rain) {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-choice-title-rule {
    position: relative !important;
    inset: auto !important;
    padding: 12px 8px;
    color: var(--archive-muted) !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-choice h2 {
    position: relative !important;
    inset: auto !important;
    margin: 0 !important;
    padding: 20px 8px 24px;
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: var(--archive-paper) !important;
    font-family: "Noto Serif SC",serif !important;
    font-size: clamp(40px,12vw,58px) !important;
    font-weight: 500 !important;
    letter-spacing: .08em !important;
    line-height: 1.08 !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-choice h2 span {
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-relics {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-rows: repeat(2,minmax(0,1fr));
    gap: 1px;
    width: auto !important;
    height: auto !important;
    background: rgba(235,231,220,.2);
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-relic {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #131311 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-relic--direct {
    background: var(--archive-paper) !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__timegate {
    position: absolute !important;
    inset: 0 !important;
    display: grid !important;
    place-items: center;
    width: 100% !important;
    height: 100% !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(.section-five-dream-kingdom__timegate-space,.section-five-dream-kingdom__timegate-stars) {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__timegate-core {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    width: calc(100% - 36px) !important;
    height: auto !important;
    flex-direction: column;
    align-items: flex-start;
    color: var(--archive-paper) !important;
    text-align: left;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-relic--direct .section-five-dream-kingdom__timegate-core {
    color: #11110f !important;
  }

  html[data-portrait-scheme="celestial"] .section-five-dream-kingdom__timegate-core small {
    color: var(--archive-red) !important;
    font: 9px Arial,sans-serif !important;
    letter-spacing: .16em !important;
  }

  html[data-portrait-scheme="celestial"] .section-five-dream-kingdom__timegate-core b {
    margin: 9px 0 5px;
    font-family: "Noto Serif SC",serif !important;
    font-size: clamp(32px,9vw,44px) !important;
    font-weight: 520 !important;
  }

  html[data-portrait-scheme="celestial"] .section-five-dream-kingdom__timegate-core em {
    color: inherit !important;
    font-size: 13px !important;
    opacity: .68;
  }

  html[data-portrait-scheme="celestial"] .section-five-dream-kingdom__timegate-threshold {
    right: 18px !important;
    bottom: 14px !important;
    left: auto !important;
    color: var(--archive-red) !important;
  }

  /* Scheme 3 direct mode: eight records plus one separate more record. */
  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcuts {
    position: absolute !important;
    inset: 50px 8px 8px !important;
    z-index: 18 !important;
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: repeat(5,minmax(0,1fr));
    gap: 1px;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    border-top: 1px solid rgba(235,231,220,.35);
    background: rgba(235,231,220,.18) !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__celestial-chart,
  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__description-spotlight-layer {
    display: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-item {
    position: relative !important;
    inset: auto !important;
    z-index: 2 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #121210 !important;
    box-shadow: none !important;
    color: var(--archive-paper) !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-item.is-current {
    background: var(--archive-paper) !important;
    color: #11110f !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut {
    position: absolute !important;
    inset: 0 !important;
    display: grid !important;
    grid-template-columns: 42px 1fr;
    align-items: center;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(
      .section-five-dream-kingdom__node-birth-trail,
      .section-five-dream-kingdom__node-shortcut-orbit,
      .section-five-dream-kingdom__node-constellation,
      .section-five-dream-kingdom__planning-energy-mist,
      .section-five-dream-kingdom__description-runner-arrow
    ) { display:none !important; }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-crystal {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 42px !important;
    height: 100% !important;
    place-items: center;
    border: 0 !important;
    border-right: 1px solid rgba(235,231,220,.2) !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--archive-red) !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-crystal b {
    position: relative !important;
    inset: auto !important;
    color: inherit !important;
    font-family: "Noto Serif SC",serif !important;
    font-size: 15px !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-hit {
    position: absolute !important;
    inset: -4px -150px -4px -4px !important;
    width: auto !important;
    height: auto !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-copy {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 6px;
    color: inherit !important;
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-copy small {
    color: var(--archive-red) !important;
    font: 8px Arial,sans-serif !important;
    letter-spacing: .08em;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__node-shortcut-copy b {
    color: inherit !important;
    font-size: clamp(10px,2.65vw,13px) !important;
    line-height: 1.2 !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__recommendation-seal {
    top: 3px !important;
    right: 3px !important;
    transform: scale(.65) !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__central-more-tunnel {
    position: relative !important;
    inset: auto !important;
    grid-column: 1/-1;
    grid-row: 5;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    place-items: center;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--archive-paper) !important;
    box-shadow: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__central-more-tunnel-depth { display:none !important; }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__central-more-tunnel-copy {
    position: relative !important;
    inset: auto !important;
    color: #11110f !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"]
    .section-five-dream-kingdom__browse-switch {
    top: 6px !important;
    right: 8px !important;
    left: auto !important;
    width: auto !important;
    height: 36px !important;
    padding: 4px 10px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--archive-red) !important;
    border-radius: 0 !important;
    background: #0a0a09 !important;
    box-shadow: none !important;
    color: var(--archive-paper) !important;
    transform: none !important;
  }

  /* Scheme 3 login: four classified identity files. */
  html[data-portrait-scheme="celestial"] .login-composition {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #0a0a09 !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"] .login-composition__base { display:none !important; }

  html[data-portrait-scheme="celestial"] .login-composition::before {
    position: absolute;
    top: 58px;
    right: 12px;
    left: 12px;
    padding: 13px 0;
    border-top: 1px solid rgba(235,231,220,.34);
    border-bottom: 1px solid rgba(235,231,220,.18);
    color: var(--archive-paper);
    content: "IDENTITY ACCESS / 四类客户档案";
    font: 10px Arial,sans-serif;
    letter-spacing: .13em;
  }

  html[data-portrait-scheme="celestial"] .login-card-layer {
    position: absolute !important;
    inset: 124px 12px 54px !important;
    display: grid !important;
    grid-template-rows: repeat(4,minmax(0,1fr));
    gap: 1px;
    width: auto !important;
    height: auto !important;
    background: rgba(235,231,220,.2);
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"] .login-card-slot {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    place-items: center start;
    padding-left: 62px;
    border: 0 !important;
    border-radius: 0 !important;
    background: #121210 !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
  }

  html[data-portrait-scheme="celestial"] .login-card-slot::before {
    position: absolute;
    inset: 0 auto 0 0;
    display: grid;
    width: 50px;
    place-items: center;
    border: 0;
    border-right: 1px solid rgba(235,231,220,.2);
    border-radius: 0;
    background: transparent;
    color: var(--archive-red);
    content: "01";
    font: 18px Arial,sans-serif;
  }

  html[data-portrait-scheme="celestial"] .login-card-slot::after {
    position: relative;
    inset: auto;
    color: var(--archive-paper);
    content: "初访 · 叩关";
    font-family: "Noto Serif SC",serif;
    font-size: clamp(20px,5.8vw,28px);
    letter-spacing: .05em;
  }

  html[data-portrait-scheme="celestial"] .login-card-slot--lifetime::before { content:"02"; }
  html[data-portrait-scheme="celestial"] .login-card-slot--lifetime::after { content:"顶级 · 终生客户"; }
  html[data-portrait-scheme="celestial"] .login-card-slot--temporary::before { content:"03"; }
  html[data-portrait-scheme="celestial"] .login-card-slot--temporary::after { content:"临时 · 客户"; }
  html[data-portrait-scheme="celestial"] .login-card-slot--heart::before { content:"04"; }
  html[data-portrait-scheme="celestial"] .login-card-slot--heart::after { content:"心语 · 客户"; }

  html[data-portrait-scheme="celestial"] .login-card-spinner {
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    opacity:0 !important;
    transform:none !important;
  }

  html[data-portrait-scheme="celestial"] .login-card-form {
    position:absolute !important;
    inset:0 !important;
    z-index:4 !important;
    display:grid !important;
    width:100% !important;
    height:100% !important;
    grid-template-columns:1fr auto;
    align-items:center;
    gap:8px;
    padding:12px 14px 12px 62px !important;
    background:var(--archive-paper) !important;
    color:#11110f !important;
    transform:none !important;
  }

  html[data-portrait-scheme="celestial"] .login-card-form__status {
    position:relative !important;
    inset:auto !important;
    margin:0 !important;
    color:#11110f !important;
    font-size:12px !important;
    transform:none !important;
  }

  html[data-portrait-scheme="celestial"] .login-card-form button {
    position:relative !important;
    inset:auto !important;
    min-width:86px;
    min-height:42px;
    border:0 !important;
    border-bottom:2px solid var(--archive-red) !important;
    border-radius:0 !important;
    background:#11110f !important;
    color:var(--archive-paper) !important;
    transform:none !important;
  }

  html[data-portrait-scheme="celestial"] .login-composition__footer-notices {
    position:absolute !important;
    right:12px !important;
    bottom:10px !important;
    left:12px !important;
    display:flex !important;
    justify-content:space-between;
    width:auto !important;
    height:auto !important;
    color:var(--archive-muted) !important;
    transform:none !important;
  }

  html[data-portrait-scheme="celestial"] .login-composition__footer-notice {
    position:relative !important;
    inset:auto !important;
    width:auto !important;
    min-height:0 !important;
    border:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    font:9px Arial,sans-serif !important;
    transform:none !important;
  }

  /* Scheme 3 deep pages become the same classified archive. */
  html[data-portrait-scheme="celestial"]
    :is(
      .identity-gateway-portal,
      .first-visit-portal,
      .temporary-service-portal,
      .heart-service-portal,
      .lifetime-service-portal,
      .more-exclusive-services,
      .more-service-detail,
      .more-services-editor
    ) {
    background:#0a0a09 !important;
    color:var(--archive-paper) !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(
      .identity-gateway-portal__panel,
      .first-visit-portal__access-shell,
      .first-visit-portal__arrival-card,
      .first-visit-portal__composer-writing,
      .temporary-service-portal__stage,
      .heart-service-portal__stage,
      .lifetime-service-portal__stage,
      .more-exclusive-services__directory-shell,
      .more-service-detail__panel,
      .section-five-dream-kingdom__node-info,
      .wisdom-private-feature-page,
      .heart-scroll-panel__frame,
      .lifetime-service-workspace__frame,
      .temporary-service-workspace__frame
    ) {
    border:0 !important;
    border-top:1px solid rgba(235,231,220,.32) !important;
    border-bottom:1px solid rgba(235,231,220,.2) !important;
    border-radius:0 !important;
    background:#121210 !important;
    box-shadow:inset 4px 0 0 var(--archive-red) !important;
    color:var(--archive-paper) !important;
  }

  html[data-portrait-scheme="celestial"]
    :is(
      .identity-gateway-portal__service-directory button,
      .more-exclusive-services__node-selector-trigger,
      .more-exclusive-services__node-keys button,
      .section-five-dream-kingdom__node-service-entry,
      .first-visit-portal button,
      .temporary-service-portal button,
      .heart-service-portal button,
      .lifetime-service-portal button
    ) {
    border:0 !important;
    border-bottom:1px solid rgba(235,231,220,.18) !important;
    border-radius:0 !important;
    background:#151513 !important;
    box-shadow:none !important;
    color:var(--archive-paper) !important;
  }

  html[data-portrait-scheme="celestial"] :is(input,textarea,select) {
    border:0 !important;
    border-bottom:1px solid rgba(235,231,220,.34) !important;
    border-radius:0 !important;
    background:#090908 !important;
    color:var(--archive-paper) !important;
  }

  /* User-specified rule: return/close controls are plain text, without circles
     or framed pills, in every portrait scheme. */
  html[data-portrait-scheme]
    :is(
      .identity-gateway-portal__close,
      .identity-gateway-portal__physiology-return,
      .more-exclusive-services__close,
      .more-service-detail__close,
      .section-five-dream-kingdom__node-info-back,
      .section-five-dream-kingdom__node-info-close,
      .wisdom-private-feature-page__back,
      .first-visit-portal__close,
      .temporary-service-portal__close,
      .heart-service-portal__close,
      .lifetime-service-portal__close
    ) {
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    filter:none !important;
  }
}

@media (orientation: portrait) and (max-width: 380px) {
  html[data-portrait-scheme] {
    --portrait-nav-height: 104px;
  }

  html[data-portrait-scheme="celestial"] {
    --portrait-nav-height: 90px;
  }

  .portrait-stage-architecture {
    right:8px;
    left:8px;
  }

  .portrait-stage-architecture__heritage-copy small {
    display:none;
  }
}
