/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Serif SC', serif; /* 充满杂志感和轻复古气息的衬线体 */
    background-color: #FAF6EE; /* 温柔的奶黄色背景，纸浆质感 */
    color: #4A4A4A;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative; /* 配合绝对定位 */
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
    /* overflow: hidden; 我们不在这里隐藏溢出内容，改为在具体page层隐藏 */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 页面切换动画类 */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease;
    overflow: hidden;
}

.page.active {
    opacity: 1;
    transform: translateY(0);
    z-index: 10;
    pointer-events: auto;
}

/* 结果页特殊处理：允许竖向滚动防止移动端顶部截断 */
#page-result.page {
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 40px;
    -webkit-overflow-scrolling: touch;
}

.page.hidden {
    opacity: 0;
    transform: translateY(10px);
    z-index: 0;
    pointer-events: none;
}

/* 首页杂志风边框与装饰 */
.editorial-border {
    position: relative;
    width: 90%;
    height: 85%;
    border: 1px solid #C4BBA5;
    padding: 40px 20px;
    text-align: center;
    background: #FFFDFC;
    box-shadow: 2px 4px 15px rgba(0,0,0,0.03);
}

.stamp {
    width: 40px;
    height: 40px;
    border: 2px dashed #D68F80;
    position: absolute;
    top: 20px;
    right: 20px;
    transform: rotate(15deg);
    opacity: 0.6;
}
.stamp::after {
    content: "POST";
    font-size: 10px;
    color: #D68F80;
    line-height: 36px;
    font-family: sans-serif;
    letter-spacing: 2px;
}

.sub-title {
    font-size: 12px;
    letter-spacing: 4px;
    color: #9E9689;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-family: sans-serif;
}

.main-title {
    font-size: 32px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 30px;
    color: #332E2C;
}

.intro-text {
    font-size: 14px;
    color: #7A7266;
    margin-bottom: 40px;
    letter-spacing: 1px;
}

.btn-start, .btn-restart {
    background: #4A4A4A;
    color: #FFFDFC;
    border: none;
    padding: 15px 40px;
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s ease;
    border-radius: 2px;
}
.btn-start:active, .btn-restart:active {
    transform: scale(0.98);
    background: #333;
}

.ticket-element {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #E8E3DA;
    padding: 5px 20px;
    font-size: 10px;
    color: #7A7266;
    letter-spacing: 3px;
    font-family: monospace;
}

/* 测试页进度条与问题 */
.question-container {
    width: 90%;
    background: #FFFDFC;
    padding: 40px 30px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    position: relative;
    z-index: 5;
}

.progress-bar {
    width: 100%;
    height: 2px;
    background: #EAE6DF;
    margin-bottom: 40px;
    position: relative;
}

.progress {
    height: 100%;
    background: #D68F80;
    width: 20%;
    transition: width 0.4s ease;
}

.question-number {
    font-size: 18px;
    color: #D68F80;
    margin-bottom: 15px;
    font-style: italic;
    font-family: Georgia, serif;
}

.question-text {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 30px;
    color: #332E2C;
    line-height: 1.5;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-btn {
    background: transparent;
    border: 1px solid #EAE6DF;
    padding: 15px 20px;
    text-align: left;
    font-size: 15px;
    color: #555;
    cursor: pointer;
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s;
    border-radius: 2px;
}

.option-btn:active, .option-btn.selected {
    background: #FAF6EE;
    border-color: #D68F80;
    color: #D68F80;
    font-weight: 600;
}

/* 激活码输入框与题目导航样式 */
.activation-box {
    margin-bottom: 20px;
}

.activation-input {
    width: 200px;
    padding: 12px 15px;
    border: 1px solid #EAE6DF;
    background: #FFFDFC;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    color: #4A4A4A;
    outline: none;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.activation-input:focus {
    border-color: #D68F80;
    box-shadow: 0 0 8px rgba(214, 143, 128, 0.2);
}

.activation-input::placeholder {
    color: #C4BBA5;
    font-weight: 300;
}

.question-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding: 0 10px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #9E9689;
    font-size: 13px;
    font-family: inherit;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color 0.3s;
}

.nav-btn:hover {
    color: #D68F80;
}

.nav-btn:disabled {
    color: #EAE6DF;
    cursor: not-allowed;
}

.deco-tape {
    position: absolute;
    width: 60px;
    height: 15px;
    background: rgba(234, 225, 208, 0.6);
    transform: rotate(45deg);
}
.tape-top-right {
    top: -5px;
    right: -25px;
}

/* 加载动画 */
.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plane-icon {
    font-size: 40px;
    color: #D68F80;
    animation: fly 2s linear infinite;
}
@keyframes fly {
    0% { transform: translate(-20px, 20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(20px, -20px); opacity: 0; }
}
.loading-text {
    margin-top: 20px;
    font-size: 14px;
    color: #9E9689;
    letter-spacing: 1px;
}

/* 结果页海报拼贴风 */
.poster-container {
    width: 90%;
    background: #FFFDFC;
    padding: 15px;
    box-shadow: 2px 4px 25px rgba(0,0,0,0.06);
    position: relative;
    border: 1px solid #EAE6DF;
    margin-top: 30px; /* 顶部留出更多空间给贴纸溢出 */
    z-index: 10;
    overflow: visible;
}

.photo-frame {
    position: relative;
    padding: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    z-index: 10;
    overflow: visible; /* 允许贴纸溢出照片框边缘 */
}

.photo-frame img {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
    filter: sepia(0.1) contrast(1.1); /* 轻微复古滤镜 */
    display: block;
}

.photo-tape {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 80px;
    height: 25px;
    background: rgba(240, 235, 225, 0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 15;
}

.result-content {
    padding: 10px 10px 30px 10px;
    text-align: center;
}

.res-tag {
    font-size: 10px;
    letter-spacing: 3px;
    color: #9E9689;
    font-family: sans-serif;
    margin-bottom: 10px;
}

.res-title {
    font-size: 28px;
    font-weight: 400;
    color: #D68F80;
    margin-bottom: 15px;
}

.res-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: justify;
    text-align-last: center;
}

.keywords span {
    display: inline-block;
    background: #FAF6EE;
    padding: 4px 12px;
    font-size: 11px;
    color: #7A7266;
    margin: 0 4px;
    border-radius: 20px;
    font-family: sans-serif;
}

.btn-save {
    margin-top: 20px;
    margin-bottom: 15px;
    background: transparent;
    color: #D68F80;
    border: 1px solid #D68F80;
    padding: 10px 28px;
    font-size: 13px;
    letter-spacing: 2px;
    cursor: pointer;
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s ease;
    border-radius: 2px;
}
.btn-save:active {
    background: #D68F80;
    color: #fff;
    transform: scale(0.98);
}
.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.postmark {
    position: absolute;
    bottom: 20px;
    right: -10px;
    width: 60px;
    height: 60px;
    border: 1px solid #C4BBA5;
    border-radius: 50%;
    opacity: 0.3;
}

/* 满屏的贴纸层，放置在最外级，不受父级overflow限制 */
#global-stickers {
    display: none;
}

/* 局部贴纸层：跟随结果页和卡片 */
.stickers-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20; /* 放在卡片上一层 */
    overflow: visible;
}

.sticker-item {
    position: absolute;
    font-size: 32px; /* 字体调大更像贴纸 */
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.15)); /* 增加自然投影 */
    transition: transform 0.3s ease;
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    /* 给贴纸加个白色包边假装是真贴纸 */
    background: #FFFEFC;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.8), 0 2px 5px rgba(0,0,0,0.08); /* 强化手账贴纸的边缘感 */
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    100% { opacity: 1; transform: scale(1) var(--final-transform); }
}

/* 右下角邮票风格装饰 */
.stamp-photo-decoration {
    position: absolute;
    bottom: -24px;
    right: -4px;
    z-index: 30;
    width: 66px;
    height: 78px;
    padding: 4px 4px 17px;
    background: #fffcea;
    transform: rotate(8deg);
    filter: drop-shadow(1px 3px 8px rgba(0,0,0,0.28));
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.3s both;
    --final-transform: rotate(8deg);
    /* 邮票锯齿边缘（perforation）*/
    -webkit-mask:
        radial-gradient(circle, transparent 4.5px, #000 5px) -6px -6px / 12px 12px,
        linear-gradient(#000, #000) 6px 6px / calc(100% - 12px) calc(100% - 12px) no-repeat;
    -webkit-mask-composite: destination-over;
    mask:
        radial-gradient(circle, transparent 4.5px, #000 5px) -6px -6px / 12px 12px,
        linear-gradient(#000, #000) 6px 6px / calc(100% - 12px) calc(100% - 12px) no-repeat;
    mask-composite: add;
}

.stamp-photo-decoration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: sepia(0.2) contrast(1.08);
}

.stamp-label {
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 6px;
    letter-spacing: 2px;
    color: #9E9689;
    font-family: sans-serif;
    line-height: 1;
}