/* ===== CSS 变量与基础重置 ===== */
:root {
    --primary: #E8854A;
    --primary-dark: #D4723A;
    --bg: #FFF8F0;
    --accent: #FF6B6B;
    --text: #4A3728;
    --text-light: #8B7355;
    --card-bg: #FFFFFF;
    --shadow: rgba(232, 133, 74, 0.15);
    --radius: 16px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* ===== Scroll Snap 容器 ===== */
.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

.page {
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.page-content {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.section-title {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===== Page 1: 封面 ===== */
.page-cover {
    background: var(--bg);
}

.cover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 6px solid var(--primary);
    animation: breathe 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.speech-bubble {
    position: absolute;
    top: -50px;
    right: -80px;
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.speech-bubble.show {
    opacity: 1;
    transform: translateY(0);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--primary);
}

.title {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 8px;
    text-shadow: 3px 3px 0 var(--shadow);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 400px;
    line-height: 1.6;
}

.scroll-hint {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    animation: bounce 2s ease-in-out infinite;
}

.scroll-arrow {
    font-size: 1.5rem;
    color: var(--primary);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* ===== Page 2: 人设卡 ===== */
.page-profile {
    background: var(--bg);
}

.profile-card {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    text-align: left;
}

.rpg-panel {
    flex: 1;
    background: var(--card-bg);
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 24px var(--shadow);
}

.rpg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--primary);
}

.rpg-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.rpg-class {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-label {
    width: 60px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.stat-bar {
    flex: 1;
    height: 12px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    width: 0;
    transition: width 1s ease-out;
}

.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--shadow);
}

.info-icon {
    font-size: 1.5rem;
}

.info-item strong {
    display: block;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.tag {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.tag-animate {
    animation: tagFloat 3s ease-in-out infinite;
}

.tag-animate:nth-child(2) { animation-delay: 0.5s; }
.tag-animate:nth-child(3) { animation-delay: 1s; }
.tag-animate:nth-child(4) { animation-delay: 1.5s; }
.tag-animate:nth-child(5) { animation-delay: 2s; }
.tag-animate:nth-child(6) { animation-delay: 2.5s; }

@keyframes tagFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ===== Page 3: 性格图鉴 ===== */
.page-traits {
    background: var(--bg);
}

.traits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.trait-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 24px var(--shadow);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.trait-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.trait-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px var(--shadow);
}

.trait-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.trait-card h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.trait-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.trait-meme {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.trait-meme img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Page 4: 爱好展示 ===== */
.page-hobbies {
    background: var(--bg);
}

.hobbies-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.hobby-group-title {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.hobby-cards {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.hobby-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 180px;
    box-shadow: 0 8px 24px var(--shadow);
    transition: all 0.3s ease;
}

.hobby-card:hover {
    transform: scale(1.05);
}

.hobby-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hobby-card h4 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.hobby-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.hobby-meme {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.hobby-meme img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hobby-quote {
    background: var(--card-bg);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    text-align: left;
}

.hobby-quote p {
    font-size: 1rem;
    color: var(--text);
    font-style: italic;
}

.quote-source {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    font-style: normal;
}

.hobby-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.hobby-item {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.hobby-item:hover {
    background: var(--primary);
    color: white;
}

.hobby-item-icon {
    font-size: 1.2rem;
}

/* ===== Page 5: 结尾彩蛋 ===== */
.page-ending {
    background: var(--bg);
}

.ending-text {
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.ending-text strong {
    color: var(--primary);
    font-size: 1.5rem;
}

.ending-subtext {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.meme-carousel {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.carousel-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel-img.active {
    opacity: 1;
}

.easter-egg-hint {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--shadow);
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ===== 彩蛋：猪猪大军 ===== */
.pig-army {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.pig-emoji {
    position: absolute;
    font-size: 2rem;
    animation: pigFall linear forwards;
}

@keyframes pigFall {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 0.95rem;
        padding: 0 1rem;
    }

    .avatar {
        width: 140px;
        height: 140px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .profile-card {
        flex-direction: column;
    }

    .rpg-panel {
        order: 2;
    }

    .profile-info {
        order: 1;
    }

    .traits-grid {
        grid-template-columns: 1fr;
    }

    .hobby-cards {
        flex-direction: column;
        align-items: center;
    }

    .hobby-card {
        width: 100%;
        max-width: 250px;
    }

    .tags-container {
        gap: 8px;
    }

    .tag {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .speech-bubble {
        right: -60px;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 15px;
    }

    .title {
        font-size: 2rem;
    }

    .avatar {
        width: 120px;
        height: 120px;
        border-width: 4px;
    }

    .rpg-panel {
        padding: 1rem;
    }

    .stat-label {
        width: 50px;
        font-size: 0.75rem;
    }

    .trait-card {
        padding: 1rem;
    }

    .trait-meme {
        width: 60px;
        height: 60px;
    }

    .ending-text {
        font-size: 1.1rem;
    }

    .ending-text strong {
        font-size: 1.3rem;
    }
}

/* ===== 动画类 ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease-out;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease-out;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}
