/* home-scenario 样式 */
.home-scenario {
    position: relative; /* 作为绝对定位子元素的包含块，配合 overflow 生效 */
    width: 100vw; /* 视窗宽度 */
    height: 100vh; /* 视窗高度 */
    background-color: transparent; /* 背景完全透明 */
    overflow: hidden; /* 防止内容溢出 */
    pointer-events: none;
}

.home-ending {
    position: relative; /* 作为绝对定位子元素的包含块，配合 overflow 生效 */
    width: 100vw; /* 视窗宽度 */
    height: 100vh; /* 视窗高度 */
    background-color: transparent; /* 背景完全透明 */
    overflow: hidden; /* 防止内容溢出 */
}

/* 固定在底部，仅露出上方一小块（可调高度） */
.ground {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100vw;                 /* 与视口同宽 */
    height: var(--ground-visible-height, 220px); /* 只露出的可视高度，按需调整 */
    z-index: 900;                  /* 位于内容下方，但仍可见 */
    pointer-events: none;          /* 禁用鼠标事件 */
}

/* 图片采用固定像素尺寸，允许超出容器，由容器裁剪 */
.ground img {
    position: absolute;          /* 在容器内自由定位 */
    left: 50%;                   /* 水平居中 */
    transform: translateX(-50%); /* 保持图片中心对齐容器中心并顺时针旋转90度 */
    width: var(--ground-image-width, 3000px); /* 固定像素宽度（像素），不随视口变化 */
    max-width: none;             /* 防止被全局 img{max-width:100%} 影响 */
    height: auto;                /* 按比例缩放高度 */
    top: var(--ground-image-top, -10px);    /* 通过负值上移，露出上沿一小块 */
    display: block;
    transition: transform 1s ease-out;
}

.ground.scenario-1-active img {
    transform: translateX(-50%) rotate(0deg);
}

.ground.scenario-2-active img {
    transform: translateX(-50%) rotate(-90deg);
}

.ground.scenario-3-active img {
    transform: translateX(-50%) rotate(-180deg);
}

.ground.scenario-4-active img {
    transform: translateX(-50%) rotate(-270deg);
}

/* ================= Click hints (new component) ================= */
/* 基础容器：左上角、白底黑字、矩形框，默认不可见（由场景激活时触发入场动画） */
.home-scenario .click-hint,
.home-ending .click-hint {
    position: absolute;
    top: 90px;
    left: -5px;
    z-index: 2500;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    max-width: min(86vw, 720px);
    padding: 10px 12px 10px 14px;
    background: #ffffff;
    color: #111111;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    pointer-events: auto;
    /* 入场前的初始状态 */
    opacity: 0;
    transform: translateX(-24px);
}

/* 文本区域 */
.home-scenario .click-hint__text,
.home-ending .click-hint__text {
    line-height: 1.35;
    font-size: 14px;
    font-weight: 600;
}

/* 关闭按钮（div + SVG），放在最右侧 */
.home-scenario .click-hint__close,
.home-ending .click-hint__close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    border-left: 2px solid #D4EEAE;
    margin-left: 4px;
    outline: none;
}
.home-scenario .click-hint__close:hover,
.home-ending .click-hint__close:hover {
    background: rgba(0,0,0,0.06);
}
.home-scenario .click-hint__close:active,
.home-ending .click-hint__close:active {
    transform: scale(0.96);
}
.home-scenario .click-hint__close:focus-visible,
.home-ending .click-hint__close:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}
.home-scenario .click-hint__close svg,
.home-ending .click-hint__close svg {
    width: 16px;
    height: 16px;
    color: #111111;
}

/* CTA arrow variant (note style) */
.home-scenario .click-hint__cta,
.home-ending .click-hint__cta {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    border-left: 2px solid rgba(0,0,0,0.15);
    margin-left: 4px;
    outline: none;
}
.home-scenario .click-hint__cta:hover,
.home-ending .click-hint__cta:hover { background: rgba(0,0,0,0.06); }
.home-scenario .click-hint__cta:active,
.home-ending .click-hint__cta:active { transform: scale(0.96); }
.home-scenario .click-hint__cta:focus-visible,
.home-ending .click-hint__cta:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
.home-scenario .click-hint__cta svg,
.home-ending .click-hint__cta svg { width: 18px; height: 18px; color: #111111; }

/* 当前场景激活时执行从左到右的入场动画 */
.home-scenario.active .click-hint:not(.click-hint--hidden),
.home-ending.active .click-hint:not(.click-hint--hidden) {
    animation: click-hint-enter 520ms ease-out forwards;
}

@keyframes click-hint-enter {
    0% { opacity: 0; transform: translateX(-24px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* 用户点击关闭后隐藏并禁用交互（保持状态，切换回来也不再显示） */
.home-scenario .click-hint.click-hint--hidden {
    opacity: 0 !important;
    transform: translateX(-16px) !important;
    pointer-events: none !important;
}

/* =========================== Scene Navigator =========================== */
.scene-nav {
    position: fixed;
    left: 50%;
    bottom: 50px; /* 离底部一点距离，避免遮挡 */
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 2000; /* 置顶于地面图层之上 */
    pointer-events: auto;
}

.scene-arrow {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #bdbdbd; /* 默认灰色 */
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

/* 用字符替代箭头 */
.scene-arrow:hover { color: #ffffff; }
.scene-arrow:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    border-radius: 6px;
}

.scene-dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.scene-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #bdbdbd; /* 灰色 */
    border: none;
    cursor: pointer;
    transition: background-color .2s ease;
}
.scene-dot[aria-selected="true"],
.scene-dot:hover {
    background-color: #ffffff; /* 高亮或 hover 白色 */
}

/* 小屏适配：略微增大点击面积 */
@media (max-width: 600px) {
    .scene-arrow { width: 44px; height: 44px; font-size: 26px; }
    .scene-dot { width: 12px; height: 12px; }
}

/* ========================================scenario 样式======================================== */
.element {
    width: 100%;
    height: auto;
}

.skipbutton {
    position: fixed;
    top: 90px;
    right: 20px;
    padding: 8px 16px;
    border: 3px solid #6B5841;
    border-radius: 10px;
    background-color: transparent;
    color: #6B5841;
    cursor: pointer;
    z-index: 3000;
    font-weight: 1000;
    font-family: sans-serif;
}

.skipbutton:hover {
    background-color: rgba(107, 88, 65, 0.1);
}

/* When skipped, remove all transitions and delays */
.home-scenario.skip-animation *,
.home-ending.skip-animation * {
    transition: none !important;
}

/* =================scenario-1-title 样式================== */
/* Animation initial states */
#scenario-1 .scenario-1-background { transform: translateY(-100%); transition: transform 1s ease-out; }
#scenario-1 .title-house { opacity: 0; transform: rotateX(90deg); transition: transform 1s ease-out; transform-origin: center bottom; }
#scenario-1 .title-tree { opacity: 0; transform: rotateX(90deg); transition: transform 1s ease-out; transform-origin: center bottom; }
#scenario-1 .title-cloud-1, #scenario-1 .title-cloud-2, #scenario-1 .title-cloud-3, #scenario-1 .title-cloud-4 { transform: translateY(-200%); transition: transform 1s ease-out; }
#scenario-1 .title-bush { transform: translateX(100%); transition: transform 1s ease-out; }
#scenario-1 .title-pinetree { transform: translateX(-100%); transition: transform 1s ease-out; }
#scenario-1 .mask, #scenario-1 .title-heading { opacity: 0; transition: opacity 1s ease-in; }

/* Animation active states */
#scenario-1.active .scenario-1-background { transform: translateY(0); }
#scenario-1.active .title-house { opacity: 1; transform: rotateX(0); transition-delay: 1.5s; }
#scenario-1.active .title-tree { opacity: 1; transform: rotateX(0); transition-delay: 1.5s; }
#scenario-1.active .title-cloud-1 { transform: translateY(0); transition-delay: 2.5s; }
#scenario-1.active .title-cloud-2 { transform: translateY(0); transition-delay: 3s; }
#scenario-1.active .title-cloud-3 { transform: translateY(0); transition-delay: 2.5s; }
#scenario-1.active .title-cloud-4 { transform: translateY(0); transition-delay: 3s; }
#scenario-1.active .title-bush { transform: translateX(0); transition-delay: 4s; }
#scenario-1.active .title-pinetree { transform: translateX(0); transition-delay: 4s; }
#scenario-1.active .mask { opacity: 1; transition-delay: 5s; }
#scenario-1.active .title-heading { opacity: 1; transition-delay: 5s; }

.scenario-1-background {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
}

.title-heading {
    position: absolute;
    bottom: 260px;
    left: calc(50% - 370px);
    z-index: 2000;
    width: 700px;
    height: auto;
    opacity: 1;
}

.mask {
    position: absolute;
    background-color: rgba(211, 211, 211, 0.25); /* 浅灰色，透明度0.5 */
    width: 100vw;
    height: 100vh;
    z-index: 1150;
}

.title-house {
    position: absolute;
    bottom: 30px;
    left: calc(50% - 750px);
    z-index: 800;
    width: 600px;
    height: auto;
}

.title-tree {
    position: absolute;
    bottom: 80px;
    left: calc(50% + 300px);
    z-index: 1100;
    width: 450px;
    height: auto;
}

.title-bush {
    position: absolute;
    bottom: -30px;
    left: calc(50% + 450px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.title-pinetree {
    position: absolute;
    bottom: -50px;
    left: calc(50% - 940px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.title-cloud-1 {
    position: absolute;
    top: 110px;
    left: calc(50% - 740px);
    width: 300px;
    height: auto;
}

.title-cloud-2 {
    position: absolute;
    top: 80px;
    left: calc(50% - 340px);
    width: 200px;
    height: auto;
}

.title-cloud-3 {
    position: absolute;
    top: 110px;
    left: calc(50% + 40px);
    width: 300px;
    height: auto;
}

.title-cloud-4 {
    position: absolute;
    top: 30px;
    left: calc(50% + 540px);
    width: 300px;
    height: auto;
}

.cloud-above {
    z-index: 1200;
}

.cloud-below {
    z-index: 500;
}

/* =================scenario-2 样式================== */
/* Animation initial states for scenario-2 */
#scenario-2 .scenario-2-background { transform: translateY(-100%); transition: transform 1s ease-out; }
#scenario-2 .page1-building-left,
#scenario-2 .page1-building-right { opacity: 0; transform: rotateX(90deg); transition: all 1s ease-out; transform-origin: center bottom; }
#scenario-2 .page1-building-middle { opacity: 1; transition: all 1s ease-out; transform-origin: center bottom; }
#scenario-2 .page1-chimney { transform: translateY(100%); transition: transform 1s ease-out; }
#scenario-2 .page1-factory { opacity: 0; transform: rotateX(90deg); transition: all 1s ease-out; transform-origin: center bottom; }
#scenario-2 .page1-smoke-1,
#scenario-2 .page1-smoke-2,
#scenario-2 .page1-smoke-3,
#scenario-2 .page1-smoke-4 { opacity: 0; transition: opacity 1.5s ease-in; }
#scenario-2 .page1-background-building,
#scenario-2 .page1-witheredsunflower { transform: translateY(150%); transition: transform 1s ease-out; }
#scenario-2 .page1-pollutedpinetree { transform: translateX(-100%); transition: transform 1s ease-out; }
#scenario-2 .page1-pollutedbush,
#scenario-2 .page1-tallbuilding { transform: translateX(100%); transition: transform 1s ease-out; }
#scenario-2 .page1-npc-oldman { opacity: 0; transform: translateX(-50px); transition: all 1s ease-in; }
#scenario-2 .page1-npc-bubbles { opacity: 0; transition: opacity 1.5s ease-in; }

/* Animation active states for scenario-2 */
#scenario-2.active .scenario-2-background { transform: translateY(0); }
#scenario-2.active .page1-building-left,
#scenario-2.active .page1-building-right { opacity: 1; transform: rotateX(0); transition-delay: 1s; }
#scenario-2.active .page1-building-middle { opacity: 0; transform: rotateX(-90deg); transition: transform 1s ease-in, opacity 0.5s ease-in; transition-delay: 2s; }
#scenario-2.active .page1-background-building { transform: translateY(0); transition-delay: 1.5s; }
#scenario-2.active .page1-chimney { transform: translateY(0); transition-delay: 2.5s; }
#scenario-2.active .page1-factory { opacity: 1; transform: rotateX(0); transition-delay: 2.5s; }
#scenario-2.active .page1-smoke-1,
#scenario-2.active .page1-smoke-2,
#scenario-2.active .page1-smoke-3,
#scenario-2.active .page1-smoke-4 { opacity: 1; transition-delay: 3.0s; }
#scenario-2.active .page1-witheredsunflower { transform: translateY(0); transition-delay: 3.5s; }
#scenario-2.active .page1-pollutedpinetree { transform: translateX(0); transition-delay: 3.5s; }
#scenario-2.active .page1-pollutedbush,
#scenario-2.active .page1-tallbuilding { transform: translateX(0); transition-delay: 3.5s; }
#scenario-2.active .page1-npc-oldman { opacity: 1; transform: translateX(0); transition-delay: 4.5s; }
#scenario-2.active .page1-npc-bubbles { opacity: 1; transition-delay: 5s; }

.scenario-2-background {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
}

.page1-building-left {
    position: absolute;
    bottom: 15px;
    left: calc(50% - 700px);
    z-index: 800;
    width: 600px;
    height: auto;
}

.page1-building-right {
    position: absolute;
    bottom: -60px;
    left: calc(50% + 100px);
    z-index: 800;
    width: 700px;
    height: auto;
}

.page1-building-middle {
    position: absolute;
    bottom: 175px;
    left: calc(50% - 70px);
    z-index: 800;
    width: 150px;
    height: auto;
}

.page1-factory {
    position: absolute;
    bottom: 200px;
    left: calc(50% - 105px);
    z-index: 800;
    width: 210px;
    height: auto;
    pointer-events: auto;
}

.page1-pollutedpinetree {
    position: absolute;
    bottom: -50px;
    left: calc(50% - 935px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.page1-tallbuilding {
    position: absolute;
    bottom: -70px;
    left: calc(50% + 600px);
    z-index: 1200;
    width: 300px;
    height: auto;
}

.page1-pollutedbush {
    position: absolute;
    bottom: -40px;
    left: calc(50% + 400px);
    z-index: 1200;
    width: 400px;
    height: auto;
    pointer-events: auto;
}

.page1-background-building {
    position: absolute;
    bottom: 250px;
    left: calc(50% - 600px);
    z-index: 700;
    width: 1300px;
    height: auto;
}

.page1-chimney {
    position: absolute;
    bottom: 100px;
    left: calc(50% - 650px);
    z-index: 500;
    width: 1200px;
    height: auto;
}

.page1-witheredsunflower {
    position: absolute;
    bottom: -12px;
    left: calc(50% - 500px);
    z-index: 1200;
    width: 200px;
    height: auto;
    transform: rotate(10deg);
    pointer-events: auto;
}

.page1-npc-oldman {
    position: absolute;
    bottom: 150px;
    left: calc(50% - 350px);
    z-index: 1200;
    width: 200px;
    height: auto;
}

.page1-npc-bubbles {
    position: absolute;
    bottom: 370px;
    left: calc(50% - 200px);
    z-index: 1200;
    width: 120px;
    height: auto;
    pointer-events: auto;
}


.page1-smoke-1 {
    position: absolute;
    bottom: 350px;
    left: calc(50% + 70px);
    z-index: 1300;
    width: 50px;
    height: auto;
}

.page1-smoke-2 {
    position: absolute;
    bottom: 480px;
    left: calc(50% + 35px);
    z-index: 1300;
    width: 130px;
    height: auto;
}

.page1-smoke-3 {
    position: absolute;
    bottom: 610px;
    left: calc(50% - 630px);
    z-index: 1300;
    width: 200px;
    height: auto;
}

.page1-smoke-4 {
    position: absolute;
    bottom: 550px;
    left: calc(50% + 540px);
    z-index: 1300;
    width: 200px;
    height: auto;
}

/* =================scenario-3 样式================== */
/* Animation initial states for scenario-3 */
#scenario-3 .scenario-3-background { transform: translateY(-100%); transition: transform 1s ease-out; }
#scenario-3 .page2-gate { opacity: 0; transform: translateY(100%); transition: all 1s ease-out; }
#scenario-3 .page2-background-building { opacity: 0; transform: translateY(200%); transition: all 1s ease-out; }
#scenario-3 .page2-rock-left { transform: translateX(-100%); transition: transform 1s ease-out; }
#scenario-3 .page2-rock-right { transform: translateX(100%); transition: transform 1s ease-out; }
#scenario-3 .page2-npc-oldman { opacity: 0; transform: translateX(-50px); transition: all 1s ease-in; }
#scenario-3 .page2-npc-daoshi { opacity: 0; transform: translateX(50px); transition: all 1s ease-in; }
#scenario-3 .page2-danlu { opacity: 0; transition: opacity 1.5s ease-in; }

/* Animation active states for scenario-3 */
#scenario-3.active .scenario-3-background { transform: translateY(0); transition-delay: 1s; }
#scenario-3.active .page2-gate { opacity: 1; transform: translateY(0); transition-delay: 2s; }
#scenario-3.active .page2-background-building { opacity: 1; transform: translateY(0); transition-delay: 3s; }
#scenario-3.active .page2-rock-left { transform: translateX(0); transition-delay: 4s; }
#scenario-3.active .page2-rock-right { transform: translateX(0); transition-delay: 4s; }
#scenario-3.active .page2-npc-oldman { opacity: 1; transform: translateX(0); transition-delay: 5s; }
#scenario-3.active .page2-npc-daoshi { opacity: 1; transform: translateX(0); transition-delay: 5s; }
#scenario-3.active .page2-danlu { opacity: 1; transition-delay: 5.5s; }

.scenario-3-background {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
}

.page2-gate {
    position: absolute;
    bottom: 20px;
    left: calc(50% - 960px);
    z-index: 800;
    width: 1900px;
    height: auto;
}

.page2-background-building {
    position: absolute;
    bottom: 400px;
    left: calc(50% - 720px);
    z-index: 600;
    width: 1400px;
    height: auto;
}

.page2-rock-right {
    position: absolute;
    bottom: 0px;
    left: calc(50% + 450px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.page2-rock-left {
    position: absolute;
    bottom: -20px;
    left: calc(50% - 940px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.page2-npc-oldman {
    position: absolute;
    bottom: 150px;
    left: calc(50% - 400px);
    z-index: 1200;
    width: 200px;
    height: auto;
}

.page2-npc-daoshi {
    position: absolute;
    bottom: 150px;
    left: calc(50% + 200px);
    z-index: 1200;
    width: 200px;
    height: auto;
    pointer-events: auto;
}

.page2-danlu {
    position: absolute;
    bottom: 130px;
    left: calc(50% - 100px);
    z-index: 1200;
    width: 170px;
    height: auto;
    pointer-events: auto;
}

/* =================scenario-4 样式================== */
/* Animation initial states for scenario-4 */
#scenario-4 .scenario-4-background-before,
#scenario-4 .scenario-4-background-after { transition: opacity 2s ease-out; }
#scenario-4 .page3-building-left,
#scenario-4 .page3-building-right,
#scenario-4 .page3-tower { opacity: 0; transform: rotateX(90deg); transition: all 1s ease-out; transform-origin: center bottom; }
#scenario-4 .page3-background-building { transform: translateY(250%); transition: transform 1s ease-out; }
#scenario-4 .page3-healthypinetree { transform: translateX(-100%); transition: transform 1s ease-out; }
#scenario-4 .page3-tallbuilding,
#scenario-4 .page3-healthybush { transform: translateX(100%); transition: transform 1s ease-out; }
#scenario-4 .page3-cloud-1,
#scenario-4 .page3-cloud-2,
#scenario-4 .page3-cloud-3,
#scenario-4 .page3-cloud-4 { transform: translateY(-200%); transition: transform 1s ease-out; }
#scenario-4 .page3-sunflower { transform: translateY(100%); transition: transform 1s ease-out; opacity: 0; }

/* Animation active states for scenario-4 */
#scenario-4.active .scenario-4-background-before { opacity: 0; transition-delay: 1s; }
#scenario-4.active .scenario-4-background-after { opacity: 1; transition-delay: 1s; }
#scenario-4.active .page3-building-left,
#scenario-4.active .page3-building-right,
#scenario-4.active .page3-tower { opacity: 1; transform: rotateX(0); transition-delay: 2s; }
#scenario-4.active .page3-background-building { transform: translateY(0); transition-delay: 3s; }
#scenario-4.active .page3-healthypinetree { transform: translateX(0); transition-delay: 4s; }
#scenario-4.active .page3-tallbuilding,
#scenario-4.active .page3-healthybush { transform: translateX(0); transition-delay: 4s; }
#scenario-4.active .page3-cloud-1,
#scenario-4.active .page3-cloud-2,
#scenario-4.active .page3-cloud-3,
#scenario-4.active .page3-cloud-4 { transform: translateY(0); transition-delay: 5s; }
#scenario-4.active .page3-sunflower { transform: translateY(0); opacity: 1; transition-delay: 5s; }

.scenario-4-background-before {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
    opacity: 1;
}

.scenario-4-background-after {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
    opacity: 0;
}

.page3-building-left {
    position: absolute;
    bottom: 15px;
    left: calc(50% - 700px);
    z-index: 800;
    width: 600px;
    height: auto;
}

.page3-building-right {
    position: absolute;
    bottom: -60px;
    left: calc(50% + 100px);
    z-index: 800;
    width: 700px;
    height: auto;
}

.page3-tower {
    position: absolute;
    bottom: 175px;
    left: calc(50% - 70px);
    z-index: 800;
    width: 150px;
    height: auto;
    pointer-events: auto;
}

.page3-background-building {
    position: absolute;
    bottom: 250px;
    left: calc(50% - 650px);
    z-index: 700;
    width: 1300px;
    height: auto;
}

.page3-healthypinetree {
    position: absolute;
    bottom: -50px;
    left: calc(50% - 935px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.page3-tallbuilding {
    position: absolute;
    bottom: -70px;
    left: calc(50% + 600px);
    z-index: 1200;
    width: 300px;
    height: auto;
}

.page3-healthybush {
    position: absolute;
    bottom: -40px;
    left: calc(50% + 400px);
    z-index: 1200;
    width: 400px;
    height: auto;
}

.page3-sunflower {
    position: absolute;
    bottom: -50px;
    left: calc(50% - 500px);
    z-index: 1200;
    width: 800px;
    height: auto;
    pointer-events: auto;
}

.page3-cloud-1 {
    position: absolute;
    top: 110px;
    left: calc(50% - 740px);
    width: 300px;
    height: auto;
    z-index: 500;
}

.page3-cloud-2 {
    position: absolute;
    top: 80px;
    left: calc(50% - 340px);
    width: 200px;
    height: auto;
    z-index: 500;
}

.page3-cloud-3 {
    position: absolute;
    top: 110px;
    left: calc(50% + 40px);
    width: 300px;
    height: auto;
    z-index: 500;
}

.page3-cloud-4 {
    position: absolute;
    top: 30px;
    left: calc(50% + 540px);
    width: 300px;
    height: auto;
    z-index: 500;
}

/* =================ending 样式================== */
/* Animation initial states for home-ending */
.home-ending .ending-background { transform: translateY(-100%); transition: transform 1s ease-out; }
.home-ending .ending-heading-main,
.home-ending .ending-heading-explanation1,
.home-ending .ending-heading-explanation2,
.home-ending .ending-heading-explanation3 {
    opacity: 0;
    transform: rotateX(90deg);
    transition: all 1s ease-out;
    transform-origin: center bottom;
}
.home-ending .ending-figure-wetlab,
.home-ending .ending-figure-project,
.home-ending .ending-figure-model,
.home-ending .ending-figure-hp,
.home-ending .ending-figure-team {
    opacity: 0;
    transition: opacity 1s ease-in;
}

/* Animation active states for home-ending */
.home-ending.active .ending-background { transform: translateY(0); transition-delay: 0.5s; }
.home-ending.active .ending-heading-main,
.home-ending.active .ending-heading-explanation1,
.home-ending.active .ending-heading-explanation2,
.home-ending.active .ending-heading-explanation3 {
    opacity: 1;
    transform: rotateX(0);
    transition-delay: 2s;
}
.home-ending.active .ending-figure-wetlab,
.home-ending.active .ending-figure-project,
.home-ending.active .ending-figure-model,
.home-ending.active .ending-figure-hp,
.home-ending.active .ending-figure-team {
    opacity: 1;
    transition-delay: 3s;
}

.ending-background {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 1; /* 背景图层，位于最底层 */
}

.ending-heading-main {
    position: absolute;
    bottom: 430px;
    left: calc(50% - 390px);
    z-index: 2000;
    width: 750px;
    height: auto;
    opacity: 1;
}

.ending-heading-explanation1 {
    position: absolute;
    bottom: 370px;
    left: calc(50% - 450px);
    z-index: 2000;
    width: 280px;
    height: auto;
    opacity: 1;
}

.ending-heading-explanation2 {
    position: absolute;
    bottom: 370px;
    left: calc(50% - 150px);
    z-index: 2000;
    width: 390px;
    height: auto;
    opacity: 1;
}

.ending-heading-explanation3 {
    position: absolute;
    bottom: 370px;
    left: calc(50% + 260px);
    z-index: 2000;
    width: 130px;
    height: auto;
    opacity: 1;
}

.ending-figure-wetlab {
    position: absolute;
    bottom: 90px;
    left: calc(50% - 620px);
    z-index: 110000;
    width: 200px;
    height: auto;
}

.ending-figure-project {
    position: absolute;
    bottom: 130px;
    left: calc(50% - 350px);
    z-index: 110000;
    width: 200px;
    height: auto;
}

.ending-figure-model {
    position: absolute;
    bottom: 150px;
    left: calc(50% - 100px);
    z-index: 110000;
    width: 200px;
    height: auto;
}

.ending-figure-hp {
    position: absolute;
    bottom: 130px;
    left: calc(50% + 170px);
    z-index: 110000;
    width: 200px;
    height: auto;
}



.ending-figure-team {
    position: absolute;
    bottom: 90px;
    left: calc(50% + 450px);
    z-index: 110000;
    width: 200px;
    height: auto;
}

/* ================= Ending Figures Hover Bounce + Tooltip ================= */
/* 基础：加相对定位方便生成伪元素 */
.ending-figure-wetlab,
.ending-figure-project,
.ending-figure-model,
.ending-figure-hp,
.ending-figure-team {
    position: absolute; /* 已有，重复无碍确保优先级 */
    will-change: transform;
    cursor: pointer; /* 让用户知道可交互（即使目前有些还不是链接）*/
}

/* 统一的弹跳动画：向上 10px 然后回到原位 */
@keyframes ending-figure-bounce {
    0% { transform: translateY(0); }
    35% { transform: translateY(-12px); }
    55% { transform: translateY(0); }
    75% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.ending-figure-wetlab:hover,
.ending-figure-project:hover,
.ending-figure-model:hover,
.ending-figure-hp:hover,
.ending-figure-team:hover {
    animation: ending-figure-bounce 520ms cubic-bezier(.28,.84,.42,1);
}

/* 公共 tooltip 基础：利用 ::after */
.ending-figure-wetlab::after,
.ending-figure-project::after,
.ending-figure-model::after,
.ending-figure-hp::after,
.ending-figure-team::after {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translate(-50%, -14px);
    padding: 6px 10px 6px 12px;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 600;
    color: #fff;
    background: #580658;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    content: '';
    transition: opacity .25s ease, transform .25s ease;
}

/* 小三角 */
.ending-figure-wetlab::before,
.ending-figure-project::before,
.ending-figure-model::before,
.ending-figure-hp::before,
.ending-figure-team::before {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translate(-50%, -4px);
    width: 0; height: 0;
    border: 6px solid transparent;
    border-top: none;
    border-bottom-color: rgba(0,0,0,0.75);
    opacity: 0;
    content: '';
    transition: opacity .25s ease, transform .25s ease;
    z-index: 3000;
    pointer-events: none;
}

/* Hover / focus 显示 tooltip */
.ending-figure-wetlab:hover::after,
.ending-figure-project:hover::after,
.ending-figure-model:hover::after,
.ending-figure-hp:hover::after,
.ending-figure-team:hover::after,
.ending-figure-wetlab:hover::before,
.ending-figure-project:hover::before,
.ending-figure-model:hover::before,
.ending-figure-hp:hover::before,
.ending-figure-team:hover::before {
    opacity: 1;
}

.ending-figure-wetlab:hover::after,
.ending-figure-project:hover::after,
.ending-figure-model:hover::after,
.ending-figure-hp:hover::after,
.ending-figure-team:hover::after {
    transform: translate(-50%, -22px);
}

/* 各自的文案 */
.ending-figure-wetlab:hover::after { content: 'go to wet lab'; }
.ending-figure-project:hover::after { content: 'go to project'; }
.ending-figure-model:hover::after { content: 'go to model'; }
.ending-figure-hp:hover::after { content: 'go to human practices'; }
.ending-figure-team:hover::after { content: 'go to team'; }

/* 触摸设备优化：在较小屏幕减少上移距离，避免遮挡 */
@media (max-width: 640px) {
    .ending-figure-wetlab::after,
    .ending-figure-project::after,
    .ending-figure-model::after,
    .ending-figure-hp::after,
    .ending-figure-team::after {
        font-size: 12px;
        transform: translate(-50%, -10px);
    }
    .ending-figure-wetlab:hover::after,
    .ending-figure-project:hover::after,
    .ending-figure-model:hover::after,
    .ending-figure-hp:hover::after,
    .ending-figure-team:hover::after {
        transform: translate(-50%, -18px);
    }
}

/* ================= Interactive Element Styles ================= */
.interactive-element .element {
    cursor: pointer;
    /* A white stroke using drop-shadow. */
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.95))
            drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
    transition: filter 0.3s ease;
    will-change: filter;
}

.interactive-element:hover .element {
    /* Brighter and thicker stroke on hover */
    filter: drop-shadow(0 0 28px white) drop-shadow(0 0 14px white);
}

/* ================= Modal (Reusable) ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: grid;
    align-items: start;            /* place a bit lower */
    justify-items: center;
    padding-top: 16vh;              /* move down slightly */
    padding-bottom: 6vh;           /* keep from touching bottom */
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 4000;
    backdrop-filter: blur(2px);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: min(960px, 92vw);
    height: min(560px, 80vh);
    /* Parchment background stretched to fill */
    background-color: #FFF3CD;     /* fallback color */
    background-image: url("https://static.igem.wiki/teams/5570/homepage/background/background-parchment.webp");
    background-position: center;
    background-size: calc(100% + 2px) calc(100% + 2px); /* slight overflow to soften edges */
    background-repeat: no-repeat;
    border: none;                  /* remove white border */
    outline: none;                 /* remove focus outline border */
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0,0,0,.35); /* only soft outer shadow */
    display: grid;
    grid-template-columns: 4fr 6fr;   /* image:text = 3:7 */
    overflow: hidden;
    position: relative;
    transform: translateY(12px) scale(.98);
    opacity: 0;
    transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal:focus { outline: none; }

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 48px;              /* enlarged hit area */
    height: 48px;             /* enlarged hit area */
    border-radius: 10px;
    background: transparent;  /* only show the X */
    color: #333;              /* X color */
    border: none;             /* remove border */
    font-size: 28px;          /* bigger × icon */
    line-height: 1;
    display: flex;            /* center the icon */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;              /* ensure on top of overlays */
    text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    transition: background .2s ease, transform .1s ease;
}
.modal-close:hover { background: transparent; transform: scale(1.06); }
.modal-close:active { transform: scale(0.96); }

.modal-left {
    position: relative;
    display: flex;                 /* center smaller image */
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 400px at 40% 60%, rgba(255,255,255,0.15), transparent 60%),
                linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
}
.modal-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px 240px at 30% 30%, rgba(150, 200, 255, 0.08), transparent 70%);
    pointer-events: none;
}
.modal-image {
    width: 300px;                    /* shrink image */
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
    filter: saturate(0.95) contrast(1.05);
}

.modal-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;       /* keep parchment visible */
    position: relative;            /* enable overlay for readability */
}
.modal-right::before {
    content: '';
    position: absolute;
    inset: 12px;                   /* inner margin */
    background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.65));
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.45);
    backdrop-filter: blur(1px);
    pointer-events: none;          /* non-interactive */
    z-index: 0;                    /* behind content */
}
.modal-content {
    max-width: 460px;
    color: #000;                   /* text in black */
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    position: relative;            /* above ::before panel */
    z-index: 1;
}
/* Optional bottom-right CTA inside modal-right */
.modal-cta {
    position: absolute;
    right: 20px;
    bottom: 16px;
    z-index: 1; /* above readability panel */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.55);
    color: #1a1a1a;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.modal-cta:hover,
.modal-cta:focus {
    outline: none;
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.modal-cta .cta-arrow { flex: 0 0 auto; }
.modal-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin-bottom: 12px;
    color: #111;                   /* darker text for title */
    text-shadow: none;
}
.modal-lines p {
    margin: 10px 0;
    font-size: 20px;
    line-height: 2;
    color: #000;                   /* paragraph text black */
    opacity: 0;
    transform: translateY(8px);
    filter: blur(2px);
    transition: opacity .45s ease, transform .45s ease, filter .45s ease;
}
.modal-lines p.show {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

@media (max-width: 840px) {
    .modal { grid-template-columns: 1fr; height: min(80vh, 580px); }
    .modal-right { padding: 22px; }
    .modal-right::before { inset: 10px; }
    .modal-content { max-width: 90%; }
}

/* ================= Story Captions (bottom subtitles) ================= */
/* 基础：位于场景底部居中、黑色半透明背景、淡入淡出 */
.home-scenario .story-caption {
    position: absolute;
    left: 50%;
    bottom: var(--story-caption-bottom, 130px); /* 预留底部导航/地面空间，可按需调整 */
    transform: translate(-50%, 0);
    z-index: 1800; /* 低于 .scene-nav(2000) 避免遮挡 */
    max-width: min(86vw, 960px);
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.66);
    color: #ffffff;
    border-radius: 12px;
    font-size: 18px;
    line-height: 1.5;
    text-align: center;
    opacity: 0; /* 初始隐藏 */
    pointer-events: none; /* 字幕不拦截交互 */
}

/* 可见状态：使用变量控制延迟与时长，自动淡入-保持-淡出 */
.home-scenario .story-caption.is-visible {
    animation: story-caption-fade var(--caption-duration, 4s) ease-in-out var(--caption-delay, 0s) both;
}

@keyframes story-caption-fade {
    0% { opacity: 0; transform: translate(-50%, 8px); }
    5% { opacity: 1; transform: translate(-50%, 0); }
    95% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, 6px); }
}

@media (max-width: 600px) {
    .home-scenario .story-caption {
        bottom: var(--story-caption-bottom, 120px);
        font-size: 15px;
        padding: 9px 14px;
    }
}

