﻿/* 基础设定，确保全屏且无溢出 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* 保证限定在当前屏幕大小 */
    letter-spacing: 0.1em;
    font-family: system-ui, -apple-system, sans-serif;
}

/* 舞台容器：铺满整个屏幕 */
.stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 探照灯区域容器，默认占据全屏或相对大面积 */
.canvas-area-with-title {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 包裹 canvas 和滑动面板的容器，占据全部剩余空间 */
.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#revealCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: none;
}

/* ========= 毛玻璃滑动面板 ========= */
.slide-panel {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    backdrop-filter: blur(10px) saturate(100%);
    background-color: rgba(250, 245, 235, 0.103); /* 保持毛玻璃的通透效果 */
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    transition: transform 0.55s cubic-bezier(0.23, 0.98, 0.32, 1.02);
    will-change: transform;
    z-index: 20;
    overflow: hidden; /* 强制限定在屏幕内不产生内滚动 */
    pointer-events: auto;
}

.slide-panel.active {
    transform: translateY(0);
}

.panel-content {
    height: 100%;
    max-height: 100%;
    padding: 28px 30px 35px;
    display: flex;
    flex-wrap: nowrap; /* 强制不换行，保持左右结构 */
    gap: 30px;
    align-items: center; /* 确保子元素整体在垂直方向上居中 */
    justify-content: center; /* 水平也稍微居中一点 */
    overflow: hidden;
}

/* 左侧模型区域：模型出现在垂直居中位置 */
.panel-model {
    flex: 1.3;
    min-width: 240px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 0; /* 移除之前的偏下间距，帮助做到绝对垂直居中 */
}

/* 右侧文本区域：通过 translate 或 margin 往右下移动 */
.panel-text {
    flex: 1.0;
    min-width: 45vw;
    height: 120vh;
    background: transparent;
    display: block; /* 改为 block 以配合子元素绝对定位 */
    text-align: left;
    background-image: url(../img/silkworm-life/detain.svg);
    background-position: center center;
    background-size: contain;
    background-repeat: no-repeat;
    position: relative;
    /* 往右边和下面移动一些 */
    transform: translate(8%, 5%);
}

.panel-text h3 {
    position: absolute;
    top: 24%; /* 根据背景图位置上下调整 */
    left: 20%; /* 根据背景图位置左右调整 */
    font-size: 2rem;
    font-weight: 600;
    color: #2d241a;
    letter-spacing: 0.02em;
    border-left: 5px solid #d9a066;
    padding-left: 18px;
    text-shadow: 0 1px 2px rgba(255,250,210,0.5);
    margin: 0;
    rotate: 6deg;
}

#panelDescription {
    position: absolute;
    top: 36%;
    left: 20%;
    width: 65%; /* 限制宽度，防止文字溢出背景图 */
}

.panel-text p {
    display: block;
    font-size: 1.2rem;
    line-height: 1.55;
    color: #1f1a14;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(255,245,220,0.4);
    margin: 0 0 0.8em;
    rotate: 6deg;
    text-indent: 2em;
    text-align: justify;
    text-justify: inter-ideograph;
}

.panel-text p:last-child {
    margin-bottom: 0;
}

.typing-char {
    opacity: 0;
    transition: opacity 0.08s ease;
}

.typing-char.is-visible {
    opacity: 1;
}



/* 新增：收集提示区域 */
.sticker-hint {
    position: absolute;
    top: 70%; /* 放在正文的下方 */
    left: 20%;
    display: flex;
    align-items: flex-end; /* 让文字位于底部对齐 */
    gap: 2vh;
    font-size: 3vh;
    font-weight: 600;
    color: #4e342e8b;
    text-shadow: 0 1px 1px rgba(255,250,210,0.5);
}

.sticker-hint span {
    white-space: nowrap;
}

.sticker-divs {
    display: flex;
    gap: 1vw;
}

.sticker-bg {
    width: 10vh;
    height: 10vh;
    background-color: rgba(250, 245, 235, 0.4);
    border: 2px dashed rgba(160, 130, 90, 0.5);
    border-radius: 2.5vh;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    transform: scale(1);
    transform-origin: center;
}

.sticker-bg.sticker-pop {
    animation: stickerSpringPop 1s cubic-bezier(0.30, 1.45, 0.32, 1) both;
}

@keyframes stickerSpringPop {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }
    58% {
        opacity: 1;
        transform: scale(1.18);
    }
    78% {
        transform: scale(0.92);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 标题旁边的相位图标 */
.phase-icon {
    position: absolute;
    top: 20%; /* 与 h3 类似或稍高一点以便对齐 */
    left: 70%; /* 放在 h3 右侧，可根据实际宽度调整 */
    width: 20vh;
    height: 20vh;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    rotate: 6deg;
}

#panelModelContainer {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2vh;
}

.model-operate-tip {
    max-width: 78%;
    padding: 1vh 1.6vw;
    border-radius: 999px;
    color: #38512f;
    background: rgba(247, 255, 235, 0.78);
    border: 1px solid rgba(129, 199, 132, 0.38);
    box-shadow: 0 4px 14px rgba(61, 94, 42, 0.12);
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
    letter-spacing: 0.04em;
}

.model-operate-tip {
    margin-left: auto;
    margin-right: auto;
}

.model-operate-tip .tip-line {
    display: block;
}

.model-operate-tip .tip-line:not(:first-child) {
    padding-left: 5em;
}

model-viewer {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    background: transparent;
    border-radius: 28px;
    --poster-color: transparent;
}

.model-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    color: #3a2a1f;
    background: rgba(255,245,230,0.35);
    border-radius: 28px;
    backdrop-filter: blur(4px);
    font-weight: 500;
}

@keyframes bounceTip {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

.click-tip-anim {
    animation: bounceTip 1.5s infinite ease-in-out;
}

.close-panel-btn {
    position: absolute;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 22px;
    transform: translateX(-50%);
    cursor: pointer;
    width: 8vh;
    height: 8vh;
    background-image: url(../img/silkworm-life/closebtn.svg);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0.7vh 1.1vh rgba(55, 44, 28, 0.35));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s ease, filter 0.22s ease;
    z-index: 21;
}
.close-panel-btn:hover {
    transform: translateX(-50%) translateY(-0.3vh) scale(1.16);
    filter: drop-shadow(0 1vh 1.4vh rgba(55, 44, 28, 0.42));
}

.wrong-sprite-toast {
    position: absolute;
    transform: translate(-50%, -100%) scale(0.92);
    padding: 1vh 1.5vw;
    border-radius: 999px;
    color: #9b2d1d;
    background: rgba(255, 250, 235, 0.96);
    border: 1px solid rgba(214, 92, 66, 0.25);
    box-shadow: 0 0.8vh 2vh rgba(80, 45, 30, 0.18);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 18;
    opacity: 0;
    animation: wrongSpriteToast 1s ease forwards;
}

@keyframes wrongSpriteToast {
    0% {
        opacity: 0;
        transform: translate(-50%, -90%) scale(0.92);
    }
    18% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -112%) scale(0.98);
    }
}

/* 欢迎弹窗样式提取 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-dialog {
    background-color: #fbf9f1; /* 米白色 */
    border: 0.5vh solid #dde1af; /* 较粗的边缘 */
    outline: 0.25vh solid #689551; /* 外面一小圈描边 */
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 60vw;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #3e2723;
    margin-bottom: 15px;
}

.modal-message {
    font-size: 1rem;
    color: #4e342e;
    line-height: 1.6;
    margin-bottom: 25px;
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}

.modal-btn-green {
    background: #81c784;
    color: white;
}

.modal-btn-green:hover {
    background: #66bb6a;
}

/* 右下角进度提示区 */
.progress-indicator {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #3e2723;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 10;
    pointer-events: none;
    border: 2px solid rgba(139, 195, 74, 0.4);
    letter-spacing: 0.05em;
}

/* 右下角备案信息（一行显示，位于进度提示下方空隙） */
.research-beian {
    position: fixed;
    right: 30px;
    bottom: 0px;
    z-index: 11;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    user-select: none;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #3e2723;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(139, 195, 74, 0.4);
    letter-spacing: 0.02em;
}

.research-beian-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    line-height: 1.2;
}

.research-beian-link:hover {
    text-decoration: underline;
}

.research-beian-sep {
    opacity: 0.7;
}

.research-beian-icon {
    height: 14px;
    width: auto;
    display: inline-block;
}

#foundCount {
    color: #4caf50;
    font-size: 1.4rem;
    margin: 0 4px;
}

/* 笔记本的右侧区域特殊处理 */
@media (max-width: 1000px) {
    .slide-panel {
        overflow-y: auto; /* 小屏幕恢复内部滚动 */
    }
    .canvas-wrapper {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .panel-model {
        min-height: auto;
    }
    #panelModelContainer, model-viewer, .model-placeholder {
        height: auto !important;
        aspect-ratio: 1 / 1;
    }
    .panel-content {
        padding: 22px 20px 30px;
        gap: 22px;
        flex-direction: column; /* 垂直排列 */
        height: auto; /* 取消固高限制 */
        max-height: none;
        overflow: visible;
    }
    .close-panel-btn {
        width: 7vh;
        height: 7vh;
        top: auto;
        right: auto;
        bottom: 14px;
        left: 50%;
        transform: translateX(-50%);
    }
    .progress-indicator {
        bottom: 20px;
        /* right: 20px; */
        font-size: 1rem;
        /* padding: 8px 16px; */
    }
    #foundCount {
        font-size: 1.2rem;
    }
}

@media (max-height: 700px) {
    .panel-model {
        min-height: auto;
    }
    #panelModelContainer, model-viewer, .model-placeholder {
        height: auto !important;
        aspect-ratio: 1 / 1;
    }
    .panel-text h3 {
        margin-bottom: 10px;
    }
}


/* ==== 笔记本翻页动画及排版 ==== */
.page-shell {
    width: 95%;        /* 增加宽度 */
    height: 80%;       /* 降低高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    transform: translateY(0vh);
}

.transform-content {
    position: relative;
    width: 95%;       
    height: 100%;
    min-height: 400px; /* 降低最低高度限制 */
    border-radius: 20px;
    perspective: 6500px;
    perspective-origin: 30% 50%;

}
/* 右侧切换层，四个按钮 */
.switch-zone-right {
    position: absolute;
    top: 0;
    right: -2.5vw;
    width: 15%;
    height: 100%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    border-left: 1px dashed rgba(78, 110, 58, 0.28);
}

.switch-item {
    width: 90%;
    height: 18%;
    border-radius: 18px;
    transition: all 0.28s ease, box-shadow 0.28s ease;
    cursor: pointer;
}

.switch-item:hover,
.switch-item.active {
    transform: translateX(30px);
    filter:
        drop-shadow(3px 3px 3px rgba(110, 110, 110, 0.411));
        transition: all 0.28s ease;
}
/* 侧边栏按钮背景 */
.item-1 { 
        background-image: url(../img/silkworm-life/right1.png);
     background-size: contain;
    background-repeat: no-repeat;}
.item-2 { 
    background-image: url(../img/silkworm-life/right2.png);
     background-size: contain;
    background-repeat: no-repeat;}
.item-3 { 
    background-image: url(../img/silkworm-life/right3.png);
     background-size: contain;
    background-repeat: no-repeat;}
.item-4 { 
    background-image: url(../img/silkworm-life/right4.png);
     background-size: contain;
    background-repeat: no-repeat;}


/* 内容的背景图层与 page1 层共享基础尺寸样式 */
.page-layer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: left center;
    transform-style: preserve-3d;
    width: 95%;
    height: 100%;
    z-index: 2;
    /* background-color: #fff; */
    background-size: cover;
    background-position: center;
    border-right: 1px solid rgba(76, 104, 58, 0.2);
    box-shadow: 3px 3px 8px rgba(41, 69, 31, 0.24);
    display: none; /* 默认全部隐藏 */
    /* padding: 10px; */
    padding-left: 50px;
}

/* 页面内容布局容器 */
.content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;

}

/* 页面内图片/文字盒子的绝对定位 */
.phase2-1, .phase2-2, .phase2-3, .phase2-4,
.phase3-1, .phase3-2, .phase3-3, .phase3-4,
.phase4-1, .phase4-2, .phase4-3, .phase4-4 {
    position: absolute;
    z-index: 5;
    display: inline-block; /* 让 div 初始宽度由内容决定 */
}

.phase1-deco,
.phase2-deco,
.phase3-deco,
.phase4-deco {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    /* padding: 0; */
}

.conditional-title-deco {
    display: none;
}

.conditional-title-deco.is-visible {
    display: block;
}

.conditional-title-deco.deco-enter {
    animation: decoCompleteBounceIn 0.58s cubic-bezier(0.22, 1.18, 0.3, 1) both;
}

@keyframes decoCompleteBounceIn {
    0% {
        opacity: 0;
        transform: scale(1.2);
    }
    52% {
        opacity: 1;
        transform: scale(0.96);
    }
    76% {
        transform: scale(1.04);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.phase1-deco-1 {
    top: 0%;
    left: -3%;
    width: 60%;
    height: 60%;
    background-image: url(../img/silkworm-life/paster/p1.1.svg);
    background-position: left 0;
}

.phase1-deco-1-text {
    top: 12%;
    left: 8%;
    width: 48%;
    height:40%;
    background-image: url(../img/silkworm-life/paster/p1.1-t.svg);
    background-position: left top;
}

.phase1-deco-2 {
    top: 5%;
    right: 15%;
    width: 24%;
    height: 12%;
    background-image: url(../img/silkworm-life/paster/p1.2.svg);
transition: all 0.5s;

}

.phase1-deco-2-text {
   top: 13%;
    right: 5%;
    width: 33%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p1.2-t.svg);

}

.phase1-deco-3 {
    bottom: 3%;
   right: 0;
    width: 55%;
    height: 55%;
    background-image: url(../img/silkworm-life/paster/p1.3.svg);
    background-position: right 0;

}

.phase1-deco-3-text {
   bottom: 17%;
   right: 3%;
    width: 35%;
    height: 26%;
    background-image: url(../img/silkworm-life/paster/p1.3-t.svg);

}

.phase2-deco-1 {
    top: -5%;
    left: 1%;
    width: 50%;
    height: 50%;
    background-image: url(../img/silkworm-life/paster/p2.1.svg);

}

.phase2-deco-1-text {
    top: 11%;
    left: 6%;
    width: 33%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p2.1-t.svg);
    background-position: center 0;

}

.phase2-deco-2 {
    top: 22%;
    left: 36%;
    width: 20%;
    height: 23%;
    background-image: url(../img/silkworm-life/paster/p2.2.svg);
}

.phase2-deco-3 {
    top: 0%;
    right: 20%;
    width: 23%;
    height:20%;
    background-image: url(../img/silkworm-life/paster/p2.3.svg);
}

.phase2-deco-3-text {
   top: 8%;
    right: 0%;
    width: 40%;
    height: 45%;
    background-image: url(../img/silkworm-life/paster/p2.3-t.svg);
}

.phase2-deco-4 {
    bottom: 0%;
    right: -8%;
    width: 55%;
    height: 55%;
    background-image: url(../img/silkworm-life/paster/p2.4.svg);

}

.phase2-deco-4-text {
    bottom: 3%;
    right: 1%;
    width: 33%;
    height: 33%;
    background-image: url(../img/silkworm-life/paster/p2.4-t.svg);

}

.phase2-deco-complete {
     bottom: 28%;
    right: 20%;
    width: 15%;
    height: 15%;
    background-image: url(../img/silkworm-life/paster/p2.svg);

}

.phase3-deco-1 {
   top: -3%;
    left: 15%;
    width: 58%;
    height: 58%;
    background-image: url(../img/silkworm-life/paster/p3.1.svg);

}

.phase3-deco-1-text {
    top: 13%;
    left: 34%;
    width: 28%;
    height: 28%;
    background-image: url(../img/silkworm-life/paster/p3.1-t.svg);
}

.phase3-deco-2 {
    top: 25%;
    left: 47%;
    width: 30%;
    height: 22%;
    background-image: url(../img/silkworm-life/paster/p3.2.svg);

}

.phase3-deco-3 {
    top: 25%;
    left: 3%;
    width: 60%;
    height: 65%;
    background-image: url(../img/silkworm-life/paster/p3.3.svg);
    z-index: 3;

}

.phase3-deco-3-text {
    top: 45%;
    left: 18%;
    width: 28%;
    height:28%;
    background-image: url(../img/silkworm-life/paster/p3.3-t.svg);
}

.phase3-deco-4 {
    bottom: 10%;
    left: 3%;
    width: 19%;
    height: 22%;
    background-image: url(../img/silkworm-life/paster/p3.4.svg);

}

.phase3-deco-5 {
    bottom: 15%;
    right: -3%;
    width: 38%;
    height: 65%;
    background-image: url(../img/silkworm-life/paster/p3.5.svg);

}

.phase3-deco-5-text {
    bottom: 27%;
    right: 0%;
    width: 26%;
    height: 40%;
    background-image: url(../img/silkworm-life/paster/p3.5-t.svg);
}

.phase3-deco-complete {
    top: 30%;
    right: 30%;
    width: 15%;
    height: 15%;
    background-image: url(../img/silkworm-life/paster/p3.svg);
}

.phase4-deco-1 {
    top: 0%;
    left: 13%;
    width: 22%;
    height: 16%;
    background-image: url(../img/silkworm-life/paster/p4.1.svg);
}

.phase4-deco-1-text {
    top: 12%;
    left: 0%;
    width: 52%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p4.1-t.svg);
}

.phase4-deco-2 {
    top: -4%;
    right: -2%;
    width: 40%;
    height: 53%;
    background-image: url(../img/silkworm-life/paster/p4.2.svg);
}

.phase4-deco-2-text {
    top: 3%;
    right: 0%;
    width: 30%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p4.2-t.svg);

}

.phase4-deco-3 {
    bottom: 3%;
    right: 3%;
    width: 65%;
    height: 45%;
    background-image: url(../img/silkworm-life/paster/p4.3.svg);

}

.phase4-deco-3-text {
    bottom: 10%;
    right: 8%;
    width: 40%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p4.3-t.svg);

}

.phase4-deco-extra {
    bottom: 30%;
    left: 8%;
    width: 35%;
    height: 30%;
    background-image: url(../img/silkworm-life/paster/p4-deco.svg);
}

.phase4-deco-complete {
    bottom: 13%;
    right: 48%;
    width: 16%;
    height: 12%;
    background-image: url(../img/silkworm-life/paster/p4.svg);

}

/* 统一设置 div 内图片宽度为 100%，让图片跟随 div 缩放 */
.content div img {
    width: 100%;
    height: auto;
    display: block;
}

/* 页面背景图配置 */
.page1-layer { background-image: url(../img/silkworm-life/book1.jpg); }
.page2-layer { background-image: url(../img/silkworm-life/book2.jpg); }
.page3-layer { background-image: url(../img/silkworm-life/book3.jpg); }
.page4-layer { background-image: url(../img/silkworm-life/book4.jpg); }


@keyframes popIn {
        0% {
            opacity: 0;
            transform: scale(0.7) translateY(30px);
        }
        80% {
            opacity: 1;
            transform: scale(1.08) translateY(-8px);
        }
        100% {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }


/* 默认显示第一页 */
.page-layer.active {
    display: block;
    z-index: 10;
}

/* 正在翻页执行动画的页面 */
.page-layer.flipping {
    display: block !important;
    z-index: 11;
    animation: bg-layer-flip-test 0.8s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bg-layer-flip-test {
    0% {
        transform: translateX(-50%) rotateY(0deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) rotateY(-120deg);
        opacity: 0;
    }
}
/* 左侧的笔记本装饰 */
.left-decoration-layer {
    position: absolute;
    /* top: 6%; */
    left: -0.5%;
    width: 10%;
    height: 100%;
    z-index: 100;
    border-radius: 14px;
    background-image: url(../img/silkworm-life/book.png);
    background-size: cover;

}





/* ==== 笔记本专用隔离面板样式 ==== */
.book-panel-content {
    display: none; /* 默认由 JS 控制显隐 */
    width: 100%;
    height: 100%;
    /* margin: 0; padding: 0; by default */
    align-items: stretch;
    padding-left: 60px; /* 特殊的左边距 */
    /* background-color: #fff; */
}

/* 左侧占70%，右侧占30% */
.book-panel-left {
    flex: 0 0 75%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.book-panel-right {
    flex: 0 0 20%;
    margin-left: auto;
    background-color: #faf0b6;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-panel-right-inner {
    width: 95%;
    height: 100%;
    margin-left: 10%;
    background-color: #fefef3;
    /* border-radius: 20px; */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* justify-content: center; */
    gap: 6vh;
    justify-content: center;
     box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    .btn{
        position: absolute;
         transform: translateX(-50%); 
         width: 6vh; 
         cursor: pointer; 
         z-index: 10;
        scale: 1;
        transition: all 0.28s ease;

    }

    .up{
        bottom: 5vh;
         left: 50%; 
        transform: translateX(-50%) rotate(180deg);
    }
    .down{
        top: 5vh; 
        left: 50%;
        transform: translateX(-50%) rotate(0deg);
    }

    .btn:hover {
        filter: drop-shadow(0px 0px 3px rgba(149, 215, 165, 0.564));
        scale: 1.1;
        transition: all 0.28s ease;
    }
}

.sticker-box {
    width: 13vh;
    height: 13vh;
    background-color: rgba(160, 200, 100, 0.2);
    border: 0.3vh solid #82b978;
    border-radius: 0.9vw;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.sticker-box img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.sticker-area {
       position: absolute;
       width: 100%; 
       height: 100%; /* Height is defined by the sticker-container wrapper */
       display: flex; 
       flex-direction: column;
       justify-content: space-evenly;
       align-items: center;
       transition: top 0.4s ease;
       background-color: transparent; /* Changed from white so it blends */
       padding: 2vh 0; /* Add some breathing room top/bottom inside the area */
       gap: 3vh; /* Provide a guaranteed gap between sticker boxes */
}

.sticker-area.area-1{
       top: 0; 
       left: 0; 
}

.sticker-area.area-2{
    top: 100%;
    left: 0;
}
.sticker-area.area-3{
    top: 100%;
    left: 0;
}
.sticker-area.area-4{
    top: 100%;
    left: 0;
}

/* ========= 贴纸拖拽与放置区域（新增） ========= */

/* 贴纸拖拽状态 */
.sticker-box {
    cursor: grab;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sticker-box:active {
    cursor: grabbing;
}

.sticker-box.is-dragging-source {
    opacity: 0.4;
}

.sticker-box.sticker-used {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* 拖拽时的浮动克隆体 */
.sticker-ghost {
    filter: drop-shadow(0 0.8vh 1.2vh rgba(0,0,0,0.28));
    border-radius: 0.9vw;
    pointer-events: none;
    transform-origin: center center;
}

/* 笔记本页面内的放置区域 */
.drop-zone {
    position: absolute;
    width: 12vh;
    height: 12vh;
    background-color: transparent;
    border-width: 0;
    border-style: solid;
    border-color: transparent;
    border-radius: 1vh;
    transition: background-color 0.18s ease, border-color 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}

.drop-zone.zone-visible {
    border-width: 2px;
    border-style: dashed;
    pointer-events: auto;
}

.drop-zone.zone-visible.drop-active {
    background-color: inherit;
    border-color: inherit;
}

.drop-zone.zone-visible.drop-target-valid {
    background-color: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.6);
}

/* .drop-zone.drop-target-invalid {
    background-color: rgba(244, 67, 54, 0.35);
    border-color: rgba(244, 67, 54, 0.7);
    animation: shake 0.4s ease;
} */
/* 贴纸区域颜色区分 */
.drop-zone-ip {
   background-color: transparent;
    border-color: transparent;
}

.drop-zone-title {
     background-color: transparent;
    border-color: transparent;
}

.drop-zone-deco {
    background-color: transparent;
    border-color: transparent;
}

.drop-zone-free {
    background-color: transparent;
    border-color: transparent;
    
    display: none;
}

.drop-zone.zone-visible.drop-zone-ip {
   background-color: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.5);
}

.drop-zone.zone-visible.drop-zone-title {
     background-color: rgba(175, 76, 116, 0.15);
    border-color: rgba(175, 76, 96, 0.5);
}

.drop-zone.zone-visible.drop-zone-deco {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.5);
}

.drop-zone.zone-visible.drop-zone-free {
    background-color: rgba(76, 170, 175, 0.15);
    border-color: rgba(76, 127, 175, 0.5);
}


/* 已放置到笔记本上的贴纸 */
.placed-sticker {
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
}

.placed-sticker img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.placed-sticker.free-placed-sticker {
    position: absolute;
    width: 12vh;
    height: 12vh;
    z-index: 8;
    cursor: grab;
    overflow: visible;
}

.placed-sticker.free-placed-sticker:active {
    cursor: grabbing;
}

.placed-sticker.zone-free-placed-sticker {
    position: absolute;
    width: 9vh;
    height: 9vh;
    z-index: 8;
    overflow: visible;
}

.area4-sticker-editor {
    position: absolute;
    inset: -0.8vh;
    border: 0.18vh solid rgba(84, 112, 54, 0.72);
    border-radius: 0.8vh;
    pointer-events: none;
    z-index: 13;
}

.area4-sticker-editor::before {
    content: "";
    position: absolute;
    inset: 0.25vh;
    border: 0.1vh dashed rgba(151, 187, 112, 0.72);
    border-radius: 0.55vh;
}

.area4-editor-handle {
    position: absolute;
    pointer-events: auto;
    user-select: none;
}

.area4-scale-handle {
    top: -1.1vh;
    right: -1.1vh;
    width: 2.4vh;
    height: 2.4vh;
    border-radius: 50%;
    background: #f6fff0;
    border: 0.18vh solid rgba(84, 112, 54, 0.88);
    box-shadow: 0 0.35vh 0.7vh rgba(49, 66, 30, 0.18);
    cursor: nwse-resize;
}

.area4-rotate-handle {
    top: -3.4vh;
    left: 50%;
    width: 2.8vh;
    height: 2.8vh;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #f6fff0;
    border: 0.18vh solid rgba(84, 112, 54, 0.88);
    box-shadow: 0 0.35vh 0.7vh rgba(49, 66, 30, 0.18);
    cursor: grab;
}

.area4-rotate-handle::before {
    content: "⟳";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45vh;
    font-weight: 700;
    color: #355028;
}

.area4-rotate-handle:active {
    cursor: grabbing;
}

/* drop-zone 自定义调整区：后续直接在这里改每页的 top/left/right/bottom/width/height 即可 */
#page1 .drop-zone-ip {
    left: 0%;
    bottom: 3%;
    width: 55%;
    height: 50%;
}

#page1 .drop-zone-deco {
    top: 0%;
    left: 15%;
    width: 15%;
    height: 20%;
}

#page2 .drop-zone-ip {
    left: 2%;
    bottom: 5%;
    width: 60%;
    height: 55%;
}

#page2 .drop-zone-title {
   bottom: 3%;
    right: 0%;
    width: 37%;
    height: 40%;
}

/* #page2 .drop-zone-deco {
left: 2%;
    bottom: 5%;
    width: 13%;
    height: 20%;
} */

#page3 .drop-zone-ip {
    right: 3%;
    bottom: 5%;
    width: 75%;
    height: 25%;
}

#page3 .drop-zone-title {
    top: 8%;
    left: 28%;
    width: 39%;
    height: 35%;
}

#page3 .drop-zone-deco {
    top: 50%;
    left: 50%;
    width: 20%;
    height: 15%;
}

#page4 .drop-zone-ip {
    left: 3%;
    bottom: 7%;
    width: 40%;
    height: 50%;
}

#page4 .drop-zone-title {
    bottom: 5%;
    right: 8%;
    width: 46%;
    height: 43%;
}

#page4 .drop-zone-deco {
    top: 12%;
    left: 28%;
    width: 25%;
    height: 18%;
}

/* 错误提示 Toast */
.sticker-error-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 253, 245, 0.98);
    color: #c62828;
    padding: 18px 36px;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.23, 0.98, 0.32, 1.02);
    border: 2px solid rgba(198, 40, 40, 0.2);
}

.sticker-error-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
