:root {
    --primary-color: #4facfe;
    --secondary-color: #00f2fe;
    --text-color: #333;
    --card-bg: rgba(255, 255, 255, 0.95);
    --accent: #ff6b6b;
}

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

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

html {
    overflow-x: hidden;
    width: 100%;
}

.bg-gradient-primary {
    background: #e4c87657;
    color: black;
}

.bg-light {
    background: #e4c87657;
    overflow: hidden;
}

.bg-result {
    background: #e4c87657;
}

.bg-dark {
    background: #2c3e50;
}

.container {
    width: 100%;
    max-width: 480px; /* Mobile width */
    margin: 0 auto;
    padding: 20px 0px;
    min-height: 60vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.flex-center {
    justify-content: start;
    align-items: center;
}

.full-height {
    height: 100vh;
}

.text-center {
    text-align: center;
}

.title-main {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.btn-start, .btn-retry {
    background: white;
    border: 2px solid #eee;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: left;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px #eee;
    color: #555;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    text-decoration: none;
    transition: transform 0.2s;
}

.btn-start:active {
    transform: scale(0.95);
}

.pulse-button {
    animation: pulse 2.2s infinite;
}

@keyframes pulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.footer-logo {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    opacity: 0.8;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    flex-direction: column;

}

/* Animation Keyframes */
@keyframes zoomEffect {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

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

@keyframes titleIn {
    0% { transform: translateY(-50px) scale(0.8); opacity: 0; }
    60% { transform: translateY(10px) scale(1.1); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Enhanced Home Styles */
.hero-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: none;
    overflow: hidden;
}

.hero-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Placeholder BG - Replace with high quality image */
    background: url('../images/bg2.jpeg') center/cover no-repeat;
    opacity: 0.3;
    animation: zoomEffect 20s infinite alternate linear;
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    bottom: -20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
    animation: floatUp 15s infinite linear;
}

/* Specific Particle delays and positions */
.particle:nth-child(1) { left: 10%; width: 20px; height: 20px; animation-duration: 12s; animation-delay: 0s; }
.particle:nth-child(2) { left: 30%; width: 40px; height: 40px; animation-duration: 18s; animation-delay: 2s; }
.particle:nth-child(3) { left: 70%; width: 15px; height: 15px; animation-duration: 10s; animation-delay: 4s; }
.particle:nth-child(4) { left: 90%; width: 30px; height: 30px; animation-duration: 15s; animation-delay: 1s; }
.particle:nth-child(5) { left: 50%; width: 25px; height: 25px; animation-duration: 20s; animation-delay: 5s; }

.title-main {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 15px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.2);
    animation: titleIn 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Elastic bounce */
}

.subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
    background: rgba(0,0,0,0.1);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
}

.footer-logo {
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Intro Video Styles */
.intro-video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out;
}

#intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.skip-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    z-index: 10000;
}

/* Top Decoration */
.decoration-img {
    max-width: 100%; /* Adjust as needed */
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
}

/* Quiz Styles - Paper Cut Theme */
.quiz-container {
    max-width: 600px;
    margin-top: 20px; /* Increased top margin for fixed progress bar */
    position: relative;
    z-index: 10;
}

/* Hide Scrollbar */
.quiz-container::-webkit-scrollbar,
.question-card::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

.quiz-container,
.question-card,
body {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}


.question-card {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    /* Paper cut shadow effect */
    box-shadow: 
        1px 1px 0px #e0e0e0,
        2px 2px 0px #e0e0e0,
        3px 3px 0px #e0e0e0,
        4px 4px 0px #e0e0e0,
        5px 5px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: absolute;
    top: 20px; /* Moved up from 50px */
    left: 20px;
    right: 20px;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid #fff;
}

.hidden {
    display: none !important;
}

.question-number {
    font-size: 16px;
    color: #4facfe;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0px rgba(79, 172, 254, 0.2);
}

.question-text {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.5;
}

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

.btn-option {
    background: white;
    border: 2px solid #eee;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: left;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 2px 2px 0px #eee;
    color: #555;
    -webkit-tap-highlight-color: transparent; /* Remove default tap highlight on iOS */
    outline: none; /* Remove focus outline */
}

/* Apply hover effects only on devices that support hover (not touch) */
@media (hover: hover) {
    .btn-option:hover {
        background: #f0f9ff;
        border-color: #4facfe;
        color: #007bff;
        transform: translate(-2px, -2px);
        box-shadow: 4px 4px 0px #4facfe;
    }
}

.btn-option:active {
    transform: translate(0, 0);
    box-shadow: 0px 0px 0px #4facfe;
    /* Optional: active state style for touch feedback */
    background: #f0f9ff;
    border-color: #4facfe;
}

/* Bottom Scene Animation */
.bottom-scene {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40vh; /* Increased height area */
    pointer-events: none;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: visible; /* Allow overflow */
}

.earth-container {
    position: absolute;
    bottom: -85%; /* Only show top part (approx 1/8) */
    width: 100vw; /* Wider earth */
    max-width: 500px;
    aspect-ratio: 1;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
    border-radius: 50%; /* Ensure round shape for rotation */
}

.earth-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover to fill circle */
    border-radius: 50%;
    animation: earthBreath 4s infinite ease-in-out alternate;
}

@keyframes earthBreath {
    0% { transform: scale(1); }
    100% { transform: scale(1.02); }
}

.character-container {
    position: absolute;
    bottom: 5%; /* Position on top of the visible earth slice */
    width: 150px;
    height: 150px;
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth spring-like transition */
    transform-origin: bottom center;
}

/* Hidden state for smooth transition */
.character-container.hidden-state {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
}

.character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.2));
}

/* Deprecated animation classes removed to prevent conflicts */


/* Progress Bar Paper Cut - Fixed Top */
.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    transition: width 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* Result Card */
.result-card {
    width: 320px;
    height: 568px; /* Approx 16:9 ratio for mobile screen */
    background: white;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    /* Gradient Background for the card itself */
    background: linear-gradient(180deg, #fff 0%, #f0f7ff 100%);
    display: flex;
    flex-direction: column;
}

.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    /* background: url('https://source.unsplash.com/random/800x600/?nature,water') center/cover; */
    background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
    /* Use a nice placeholder or geometric pattern if image fails */
    background-color: var(--primary-color);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.result-card .header h3 {
    text-align: center;
    color: #555;
    font-size: 0.9rem;
    margin-top: 10px;
    letter-spacing: 1px;
}

.persona-section {
    text-align: center;
    margin-top: 40px;
}

.persona-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 5px;
    line-height: 1.2;
}

.persona-subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: bold;
}

.divider {
    width: 40px;
    height: 4px;
    background: var(--accent);
    margin: 20px auto;
    border-radius: 2px;
}

.persona-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    padding: 0 10px;
}

.badge-section {
    text-align: center;
}

.badge-circle {
    width: 100px;
    height: 100px;
    border: 3px solid #f1c40f;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: #f1c40f;
    font-weight: bold;
    transform: rotate(-10deg);
    box-shadow: 0 5px 15px rgba(241, 196, 15, 0.3);
    background: rgba(255,255,255,0.9);
}

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.qr-placeholder .qr-box {
    width: 60px;
    height: 60px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #888;
}

.footer .slogan {
    margin-left: 15px;
    font-size: 0.8rem;
    color: #888;
}

/* Generated Image Display */
#final-image-container {
    text-align: center;
    padding-top: 20px;
}

#generated-image {
    max-width: 90%;
    height: auto;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 20px;
}

.tip-text {
    color: black;
    margin-bottom: 15px;
    opacity: 0.8;
}

.full-height-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: overlayFadeIn 0.3s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

#loading-gen p {
    color: #555;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes overlayFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.margin-top-large {
    margin-top: 50px;
}

/* Modern Result Card Styles Refactored */
:root {
    --card-width: 340px;
    --card-height: 550px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
}

.result-card-modern {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #333;
    margin: 0 auto;
    background: white; /* Fallback */
}

/* Background with Gradient */
.card-glass-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    z-index: 0;
}

.card-glass-bg::before {
    content: '';
    position: absolute;
    top: -60px;
    left: -40px;
    width: 240px;
    height: 240px;
    background: rgba(79, 172, 254, 0.15);
    border-radius: 50%;
    filter: blur(50px);
}

.card-glass-bg::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: -40px;
    width: 280px;
    height: 280px;
    background: rgba(0, 242, 254, 0.15);
    border-radius: 50%;
    filter: blur(50px);
}

.card-inner-layout {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 24px;
}

/* Top Section */
.card-top-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    bottom: 100px; /* Leave space for bottom section */
    padding: 30px 25px 10px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 5;
    overflow: hidden; /* Prevent overflow affecting layout */
}

.brand-tag {
    font-size: 0.8rem;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.persona-display {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.persona-title-main {
    font-size: 2rem;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.2;
    letter-spacing: 1px;
}

.persona-divider {
    width: 50px;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-bottom: 15px;
}

.persona-description {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    background: rgba(255,255,255,0.6);
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.8);
    width: 100%;
    z-index: 5;
}

/* Badge / Seal Section */
.badge-container {
    position: absolute;
    top: 5%;
    left: 5px;
    margin-top: -30px; /* Half of height (120px) to center vertically */
    z-index: 20; /* Highest layer within the card */
    pointer-events: none;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

.seal-image {
    width: 120px;
    height: 120px;
    transform: rotate(-15deg);
    opacity: 0.95;
    mix-blend-mode: multiply; /* Realistic stamp effect */
}

/* Fallback for blend mode if needed */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .seal-image {
        mix-blend-mode: normal;
        opacity: 0.9;
    }
}

/* Bottom Section */
.card-bottom-section {
    flex: 4;
    position: relative;
    padding: 10px 25px 25px 25px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 2;
}

.qr-info {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 5px;
    z-index: 2;
}

.qr-box-modern {
    width: 85px;
    height: 85px;
    background: #fff;
    padding: 3px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-code-mock {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #bdc3c7;
    font-size: 0.7rem;
    border-radius: 8px;
    border: 2px dashed #dfe6e9;
}

.slogan-modern p {
    font-size: 0.75rem;
    color: #7f8c8d;
    line-height: 1.4;
    font-weight: 500;
}

/* Character Simple Display */
.character-simple-wrapper {
    position: absolute;
    right: 0px;
    bottom: 25px;
    width: 200px;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.character-simple-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(4px 4px 8px rgba(0,0,0,0.25));
    z-index: 1;
}
/* 隐藏称号弹窗样式 */
        .legendary-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            z-index: 2000;
            display: flex;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(3px);
            animation: fadeIn 0.5s;
        }

        .legendary-modal-content {
            background: linear-gradient(135deg, #fff 0%, #fef9e6 100%);
            border: 2px solid #ffd700;
            border-radius: 20px;
            padding: 30px;
            width: 80%;
            max-width: 320px;
            text-align: center;
            box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
            position: relative;
            animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .legendary-modal-close {
            position: absolute;
            top: 10px;
            right: 15px;
            background: none;
            border: none;
            font-size: 28px;
            color: #999;
            cursor: pointer;
            line-height: 1;
            padding: 0;
        }
        
        .legendary-modal-title {
            font-size: 1.2rem;
            color: #d35400;
            font-weight: bold;
            display: block;
            margin-bottom: 15px;
            letter-spacing: 1px;
        }

        .legendary-number {
            font-size: 3rem;
            font-weight: 800;
            color: #f19902;
            text-shadow: 2px 2px 0px rgba(255, 215, 0, 0.2);
            font-family: 'Arial', sans-serif;
            display: block;
            margin: 10px 0;
            line-height: 1;
        }
        
        .legendary-text {
            color: #555;
            font-size: 1rem;
            line-height: 1.5;
        }
        
        .legendary-highlight {
            color: #f19902;
            font-weight: bold;
        }

        /* 缩小后的星星图标 */
        .legendary-star-icon {
            position: fixed;
            top: 20px;
            left: 20px;
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #ffd700, #ffb900);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            box-shadow: 0 4px 15px rgba(218, 165, 32, 0.5);
            z-index: 1000;
            cursor: pointer;
            animation: float-star 3s ease-in-out infinite;
            border: 2px solid #fff;
            transition: transform 0.2s;
        }
        
        .legendary-star-icon:active {
            transform: scale(0.9);
        }

        @keyframes float-star {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        @keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 隐藏称号输入框样式 */
.legendary-input {
    padding: 10px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    font-size: 1rem;
    width: 60%;
    margin-right: 5px;
    outline: none;
    color: #333;
    margin-bottom: 10px;
}

.legendary-input:focus {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.legendary-submit-btn {
    padding: 10px 15px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.legendary-submit-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}