/* This style is placed above the page stylesheet. Without the state flag the
   real document stays usable, including when JavaScript is disabled. */
#home-loader { display: none; }
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) {
  overflow: hidden;
  scrollbar-gutter: stable;
}
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) body { overflow: hidden; }
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) body > :not(#home-loader, script),
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) body > :not(#home-loader, script) * {
  /* A child with its own visibility rule must not flash through the loader.
     Visibility leaves the real hero and cards measurable for the reveal. */
  visibility: hidden !important;
  pointer-events: none !important;
  animation-play-state: paused !important;
}
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) body > :not(#home-loader, script) *::before,
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) body > :not(#home-loader, script) *::after { animation-play-state: paused !important; }
:is(html[data-home-load="progress"], html[data-home-load="skeleton"]) #home-loader {
  position: fixed;
  z-index: 2147480000;
  inset: 0;
  display: block;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  overscroll-behavior: none;
}
#home-loader {
  --loading-backdrop: radial-gradient(ellipse at 50% 31%, #fff5e5 0%, transparent 53%), linear-gradient(147deg,#f9edff,#f8f2fc 52%,#ece2f7);
  --loading-panel: #fffaf5;
  --loading-line: #cfb4de;
  --loading-ink: #49284d;
  --loading-muted: #77587a;
  --loading-track: #ead9f2;
  --loading-honey: linear-gradient(180deg,#ffe5a2 0%,#f8ba63 48%,#d87d38 100%);
  --loading-fill: #e4d2ed;
  --loading-sheen: #fffaf7ad;
  --loading-glass: #fbf3fd;
  --loading-stage: linear-gradient(135deg,#edd5e8 0%,#ebdbf3 45%,#e2cee8 100%);
  background: var(--loading-backdrop);
  color: var(--loading-ink);
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}
html[data-theme="dark"] #home-loader {
  --loading-backdrop: radial-gradient(ellipse at 50% 35%, #43304a 0%, transparent 52%), linear-gradient(150deg,#251a33,#2d2039 65%,#25182c);
  --loading-panel: #3b2b43;
  --loading-line: #785887;
  --loading-ink: #fff0f3;
  --loading-muted: #e0bfdf;
  --loading-track: #51385d;
  --loading-honey: linear-gradient(180deg,#f9d88d 0%,#e4a451 58%,#b86731 100%);
  --loading-fill: #533f60;
  --loading-sheen: #d9b4e661;
  --loading-glass: #30243d;
  --loading-stage: linear-gradient(135deg,#4c3650 0%,#473453 48%,#3a2c4d 100%);
}
#home-loader, #home-loader * { box-sizing: border-box; }

/* Anchor the card to the viewport midpoint in both phases. Using 50vw keeps
   it centered even when the page reserves room for a vertical scrollbar. */
.home-loader-progress {
  position: absolute;
  top: 50%;
  left: 50vw;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(356px, calc(100% - 40px));
  padding: 18px 21px 19px;
  border: 1px solid var(--loading-line);
  border-radius: 23px;
  background: var(--loading-panel);
  box-shadow: inset 0 1px #ffffff6b, 0 12px 34px #71488022;
}
.home-loader-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  margin-bottom: 12px;
}
#home-loading-caption {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
}
#home-loading-percent {
  color: var(--loading-muted);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#home-loading-percent:empty { display: none; }
.home-loader-track {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: var(--loading-track);
}
#home-loading-progress {
  display: block;
  width: 100%;
  height: 11px;
  border: 0;
  border-radius: 999px;
  appearance: none;
  accent-color: #cc854e;
  background: var(--loading-track);
}
#home-loading-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--loading-track);
}
#home-loading-progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--loading-honey);
  box-shadow: inset 0 1px #fff8dba8;
}
#home-loading-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--loading-honey);
}
#home-loading-progress:indeterminate::-webkit-progress-value { background: transparent; }
#home-loading-progress:indeterminate::-moz-progress-bar { background: transparent; }
.home-loader-track:has(progress:indeterminate)::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 999px;
  background: var(--loading-honey);
  content: "";
  animation: home-loader-unknown-progress .86s linear infinite;
}
@keyframes home-loader-unknown-progress {
  from { transform: translateX(-27%); }
  to { transform: translateX(274%); }
}
/* Stand-in blocks stay inert. The split stage uses the same landscape and
   portrait breakpoints as the home hero, with copy and CTAs in the same order. */
.home-loader-skeleton { display: none; }
html[data-home-load="skeleton"] .home-loader-skeleton {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}
.home-loader-shell { width: min(1376px, calc(100% - 48px)); margin-inline: auto; }
.home-loader-chrome {
  background: var(--loading-glass);
  border-bottom: 1px solid var(--loading-line);
}
.home-loader-chrome-inner {
  display: grid;
  grid-template-columns: clamp(136px, 12.4vw, 179px) minmax(0,1fr) clamp(150px, 15vw, 216px) 58px;
  align-items: center;
  gap: 12px;
  min-height: 75px;
}
.home-loader-nav { display: flex; align-items: center; gap: clamp(10px, 1.4vw, 22px); }
.home-loader-nav i { width: 8%; height: 13px; }
.home-loader-nav i:nth-child(3n+2) { width: 11%; }
.home-loader-nav i:first-child { width: 49px; height: 33px; }
.home-loader-brand { height: 45px; }
.home-loader-search, .home-loader-account { height: 37px; }
.home-loader-page { padding-top: 24px; }
.home-loader-hero {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3;
  border: 1px solid var(--loading-line);
  border-radius: min(36px, 4.7vw);
  background: var(--loading-glass);
}
.home-loader-hero .home-loader-scene {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--loading-stage);
}
.home-loader-story {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: start;
  width: min(700px, 54%);
  padding: clamp(65px, 5.2vw, 75px) 0 15px clamp(38px, 6vw, 94px);
  --loading-fill: #dcbfe0;
}
html[data-theme="dark"] .home-loader-story { --loading-fill: #604769; }
.home-loader-title { width: min(401px, 100%); height: clamp(88px, 7.65vw, 112px); }
.home-loader-subtitle { width: min(237px, 68%); height: clamp(19.8px, 2.17vw, 31px); margin: 7px 0 14px; }
.home-loader-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 11px;
  width: min(100%, clamp(282px, 28vw, 392px));
}
.home-loader-shortcuts i { height: 54px; border-radius: 20px; }
.home-loader-entries {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
}
.home-loader-entries i { min-height: 88px; border-radius: 20px; }
.home-loader-entries i:nth-child(1) { --loading-fill: #cfe7d8; }
.home-loader-entries i:nth-child(2) { --loading-fill: #f5dfbb; }
.home-loader-entries i:nth-child(3) { --loading-fill: #efd3e2; }
.home-loader-entries i:nth-child(4) { --loading-fill: #dce5c8; }
.home-loader-entries i:nth-child(5) { --loading-fill: #e2cfe9; }
html[data-theme="dark"] .home-loader-entries i:nth-child(1) { --loading-fill: #394d48; }
html[data-theme="dark"] .home-loader-entries i:nth-child(2) { --loading-fill: #594347; }
html[data-theme="dark"] .home-loader-entries i:nth-child(3) { --loading-fill: #573b50; }
html[data-theme="dark"] .home-loader-entries i:nth-child(4) { --loading-fill: #474b40; }
html[data-theme="dark"] .home-loader-entries i:nth-child(5) { --loading-fill: #4e3b5f; }
.home-loader-fill.home-loader-lottery { height: clamp(106px, 12vw, 168px); margin-top: 23px; border-radius: 23px; }

/* Shimmer moves a pale band across each block. Nothing is presented as a
   percentage until the native progress element has a real value. */
.home-loader-fill {
  position: relative;
  display: block;
  overflow: hidden;
  min-width: 0;
  border-radius: 14px;
  background: var(--loading-fill);
}
.home-loader-fill::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 56%;
  background: linear-gradient(110deg,transparent 5%,var(--loading-sheen) 53%,transparent 95%);
  content: "";
  animation: home-loader-shimmer 1.16s ease-in-out infinite;
  animation-delay: -.21s;
}
@keyframes home-loader-shimmer {
  from { transform: translateX(-112%); }
  to { transform: translateX(188%); }
}

@media (max-width: 1120px) {
  .home-loader-chrome-inner {
    grid-template-columns: 1fr clamp(120px, 24vw, 206px) 56px;
    gap: 7px 12px;
    min-height: 108px;
    padding-block: 8px;
  }
  .home-loader-brand { width: min(160px,100%); }
  .home-loader-nav { grid-column: 1/-1; grid-row: 2; gap: 12px; }
  .home-loader-nav i { max-width: 82px; }
  .home-loader-nav i:first-child { height: 28px; }
}
@media (max-width: 1080px) {
  .home-loader-hero { aspect-ratio: auto; border-radius: 28px; }
  .home-loader-hero .home-loader-scene {
    position: relative;
    aspect-ratio: 3;
    border-radius: 0;
  }
  .home-loader-story { width: 100%; justify-items: center; padding: 17px 16px 22px; }
  .home-loader-title { width: min(405px, 100%); height: clamp(78px, 12vw, 112px); }
  .home-loader-subtitle { margin: 5px 0 16px; }
  .home-loader-shortcuts { width: min(440px,100%); }
}
@media (max-width: 760px) {
  .home-loader-shell { width: calc(100% - 28px); }
  .home-loader-chrome-inner {
    grid-template-columns: minmax(0,1fr) clamp(80px,30.5vw,200px) 49px;
    gap: 7px 8px;
    min-height: 134px;
  }
  .home-loader-brand { width: min(129px,100%); height: 36px; }
  .home-loader-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px 8px; }
  .home-loader-nav i { width: 100%; max-width: unset; height: 31.5px; }
  .home-loader-nav i:nth-child(3n+2), .home-loader-nav i:first-child { width: 100%; height: 31.5px; }
  .home-loader-search, .home-loader-account { height: 35px; }
  .home-loader-page { padding-top: 13px; }
  .home-loader-hero { border-radius: 26px; }
  .home-loader-hero .home-loader-scene { aspect-ratio: 4 / 5; }
  .home-loader-story { padding-inline: clamp(13px, 4.3vw, 24px); }
  .home-loader-title { width: min(269px, 85%); height: clamp(68px, 19vw, 90px); }
  .home-loader-subtitle { width: min(165px, 64%); }
  .home-loader-shortcuts { gap: 9px; }
  .home-loader-entries { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
  .home-loader-entries i { min-height: 72px; }
  .home-loader-entries i:last-child { grid-column: 1/-1; }
}
@media (max-width: 347px) {
  .home-loader-chrome-inner { min-height: 130px; }
}

/* Restore click and focus as soon as reveal starts. A short paint-only fade
   aligns the handoff without scaling or moving the original page. */
html[data-home-load="reveal"] body > :is(header, main, footer) {
  animation: home-loader-reveal 120ms ease-out both;
}
@keyframes home-loader-reveal {
  from { opacity: .6; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .home-loader-fill::after { display: none; }
  .home-loader-track:has(progress:indeterminate)::after { animation: none; width: 100%; opacity: .38; }
  html[data-home-load="reveal"] body > :is(header, main, footer) { animation: none; }
}

/* If a decoded illustration fails, preserve its slot and supply readable
   text on the existing brand/hero. Other interactive areas keep working. */
img[data-home-image-failed] { visibility: hidden !important; }
.brand-plaque img[data-home-image-failed] { display: none !important; }
.brand-plaque .home-logo-fallback {
  padding-inline: 8px;
  overflow: hidden;
  max-width: 100%;
  color: #fff0c3;
  font-size: clamp(12px, 1.22vw, 16px);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#home-view .jelly-hero[data-home-scene-failed] .hero-scene {
  background: radial-gradient(ellipse at 67% 35%,#ffe7cf80,transparent 56%),linear-gradient(145deg,#f5d8e6,#dbc8f0);
}
html[data-theme="dark"] #home-view .jelly-hero[data-home-scene-failed] .hero-scene {
  background: radial-gradient(ellipse at 64% 33%,#563b56,transparent 63%),linear-gradient(145deg,#2e213b,#39264a);
}
#home-view .jelly-hero .home-asset-fallback {
  position: absolute;
  z-index: 3;
  inset: auto 18px 18px auto;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #caa8d9;
  background: #fff7eefa;
  color: #56345a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
html[data-theme="dark"] #home-view .jelly-hero .home-asset-fallback {
  border-color: #826296;
  background: #3e2c4c;
  color: #ffedf5;
}
@media (max-width: 1080px) {
  #home-view .jelly-hero .home-asset-fallback {
    inset: clamp(46px, 14vw, 143px) auto auto 50%;
    transform: translateX(-50%);
  }
}
@media (max-width: 760px) {
  #home-view .jelly-hero .home-asset-fallback { top: clamp(132px, 52vw, 390px); }
}
