:root {
    --primary: #9b72e5;
    --primary-light: #c4a7ff;
    --secondary: #ff8fab;
    --dark: #2b1f3a;
    --text: #4a3b5c;
    --text-light: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(155, 114, 229, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    color: var(--text);
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    background-color: #fce4ec;
}

#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-image: url('./assets/bg.jpg');
    background-size: cover;
    background-position: center;
    filter: blur(4px) brightness(1.1);
    transform: scale(1.05);
    z-index: -2;
    transition: filter 1s ease;
    animation: bgZoom 25s infinite alternate ease-in-out;
}

#app {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Minimalist Landing Page */
.minimal-landing {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: clamp(2rem, 6vw, 3.5rem) clamp(1.2rem, 5vw, 2.5rem);
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 255, 255, 1);
    max-width: 600px;
    width: min(92%, 580px);
    box-sizing: border-box;
    text-align: center;
}

/* Elegant Typography */
.elegant-title {
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(1.6rem, 5.5vw, 2.8rem);
    line-height: 1.25;
    overflow-wrap: break-word;
    font-weight: 300;
    color: var(--dark);
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

.sub-title {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 1rem;
    letter-spacing: 4px;
}

.desc {
    font-size: clamp(0.9rem, 3vw, 1.05rem);
    color: #888;
    margin-bottom: clamp(1.5rem, 5vh, 2.5rem);
    font-weight: 300;
    letter-spacing: 1px;
}

/* Minimal Button */
.minimal-btn {
    background: transparent;
    border: 1px solid var(--dark);
    color: var(--dark);
    padding: clamp(0.85rem, 2.5vw, 1rem) clamp(1.8rem, 5vw, 3rem);
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    letter-spacing: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.minimal-btn:hover {
    background: var(--dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.minimal-btn span {
    transition: transform 0.3s ease;
}

.minimal-btn:hover span {
    transform: translateX(5px);
}

.minimal-btn.reverse {
    border-color: var(--primary);
    color: var(--primary);
}
.minimal-btn.reverse:hover {
    background: var(--primary);
    color: white;
}

/* Quiz Section */
#quiz {
    align-items: flex-start;
    padding-top: clamp(2rem, 10vh, 15vh);
}

#quiz > * {
    margin-top: 0;
}

.quiz-panel {
    max-width: 900px;
    width: min(95%, 640px);
    margin: 0 auto;
    padding: 0 1rem;
    /* Remove global panel styles for VN look */
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.progress-container {
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    width: 25%;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(155, 114, 229, 0.8);
}

.q-badge {
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#question-text {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(1.05rem, 3.5vw, 1.25rem);
    line-height: 1.6;
    color: var(--dark);
    font-weight: 600;
    text-align: center;
    
    /* Dialogue Box Style */
    background: rgba(255, 255, 255, 0.9);
    padding: clamp(1rem, 4vw, 1.5rem) clamp(1.2rem, 4vw, 2rem);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin: 1rem auto 1.5rem;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    max-width: 600px;
}

/* Small speech bubble arrow */
#question-text::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.9) transparent transparent transparent;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(155, 114, 229, 0.9), rgba(122, 82, 197, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: clamp(0.9rem, 3vw, 1.1rem) clamp(1rem, 4vw, 1.5rem);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    line-height: 1.4;
    color: white;
    width: 100%;
    min-height: 54px;
    box-sizing: border-box;
    max-width: 600px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0;
}

.opt-anim {
    animation: slideInFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.opt-anim-delay {
    animation-delay: 0.15s;
}

.opt-label {
    display: none; /* Hide A/B label for cleaner VN look */
}

.option-btn:hover {
    background: linear-gradient(135deg, rgba(175, 134, 249, 0.95), rgba(155, 114, 229, 0.95));
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.option-btn:hover .opt-label {
    background: var(--primary);
    transform: scale(1.1);
}

/* Lead Form Section */

.lead-panel {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: clamp(1.5rem, 5vw, 2.5rem) clamp(1.2rem, 4vw, 2rem);
    width: min(92%, 480px);
    margin: 0 auto;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    text-align: center;
    color: white;
    animation: floatPanel 6s infinite ease-in-out;
}

.lead-title {
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(1.35rem, 4.5vw, 1.8rem);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.lead-desc {
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    margin-bottom: clamp(1rem, 3vh, 1.8rem);
    opacity: 0.9;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.form-group select {
    width: 100%;
    padding: 0 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    min-height: 48px;
    height: 48px;
    line-height: 48px;
    box-sizing: border-box;
    color: #333;
    outline: none;
    transition: all 0.3s;
    font-family: 'Noto Sans TC', sans-serif;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-group select:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 10px rgba(155, 114, 229, 0.5);
    border-color: var(--primary);
}

.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn {
    width: 100%;
    padding: 0 1rem;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: clamp(1rem, 3vw, 1.1rem);
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(155, 114, 229, 0.5);
}

/* Minimalist Result Section */
.minimal-result {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    width: min(94%, 1100px);
    padding: clamp(1.5rem, 4vw, 3rem);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    box-sizing: border-box;
}

.result-left {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    flex: 0 0 45%;
    max-height: 560px;
    height: 55vh;
    min-height: 250px;
    border-radius: 16px;
    overflow: hidden;
}

.result-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    transition: transform 0.5s ease;
}

.result-left:hover img {
    transform: scale(1.03);
}

.result-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.result-badge {
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.elegant-subtitle {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.result-highlight {
    color: var(--dark);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1rem;
    font-size: clamp(1.25rem, 3.5vw, 1.8rem);
    line-height: 1.3;
    overflow-wrap: break-word;
}

#result-desc {
    color: #666;
    font-weight: 300;
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
    line-height: 1.7;
    margin-bottom: clamp(1rem, 3vh, 2rem);
}

.minimal-quote {
    border-left: 3px solid var(--secondary);
    padding-left: 1rem;
    margin-bottom: clamp(1.2rem, 3vh, 2rem);
}

#result-quote {
    font-family: 'Noto Serif TC', serif;
    font-style: italic;
    color: var(--dark);
    line-height: 1.6;
    font-size: clamp(1rem, 2.8vw, 1.2rem);
}

/* Screens & Transitions */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    box-sizing: border-box;
}

.screen::before,
.screen::after {
    content: '';
    margin: auto;
}

.screen > * {
    margin: 0 auto;
    flex-shrink: 0;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

@keyframes floatPanel {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

@keyframes bgZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

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

/* Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: sparkle 4s linear infinite;
}

@keyframes sparkle {
    0% { transform: translateY(0) scale(0); opacity: 0; }
    50% { transform: translateY(-20px) scale(1); opacity: 0.8; box-shadow: 0 0 10px white; }
    100% { transform: translateY(-40px) scale(0); opacity: 0; }
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.back-btn {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.back-btn.hidden {
    display: none;
}

.mute-btn {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    font-size: 1.35rem;
    cursor: pointer;
    z-index: 100;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.mute-btn:hover {
    transform: scale(1.1);
}

/* Result Actions & Views */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    width: 100%;
    margin-top: 1rem;
}

.result-actions .minimal-btn {
    min-height: 48px;
    box-sizing: border-box;
    justify-content: center;
}

.active-view {
    display: flex !important;
    animation: fadeIn 0.5s ease;
}

.hidden-view {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Product Showcase Placeholder */
.product-showcase {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
}

.product-placeholder {
    text-align: center;
    color: #888;
}

.product-placeholder h3 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

/* Product Features */
.product-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.feature-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: clamp(0.85rem, 3vw, 1rem) clamp(1rem, 3.5vw, 1.2rem);
    border-left: 4px solid var(--primary);
    text-align: left;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.25);
}

.feature-title {
    font-size: clamp(0.95rem, 3vw, 1.05rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.4rem;
    letter-spacing: 1px;
}

.feature-desc {
    font-size: clamp(0.85rem, 2.5vw, 0.9rem);
    line-height: 1.5;
    color: var(--dark);
    opacity: 0.9;
}

/* Primary CTA Button */
.cta-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: white !important;
    border: none !important;
    font-weight: 700;
    text-decoration: none;
}

.cta-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(155, 114, 229, 0.3);
}

/* Touch Feedback */
.minimal-btn:active { transform: scale(0.96); filter: brightness(0.95); }
.option-btn:active { transform: scale(0.98); filter: brightness(0.95); }
.submit-btn:not(:disabled):active { transform: scale(0.97); }
.back-btn:active { transform: scale(0.95); }
.mute-btn:active { transform: scale(0.92); }

/* =========================================
   Responsive Design (Mobile & Tablet)
   ========================================= */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .minimal-result {
        gap: 2rem;
        padding: 2rem 1.8rem;
    }
    .result-left {
        flex: 0 0 40%;
        height: 45vh;
    }
    .result-right {
        align-items: flex-start;
        text-align: left;
    }
}

@media screen and (max-width: 768px) {
    .minimal-result {
        flex-direction: column;
        gap: 1.5rem;
        padding: clamp(1.2rem, 4vw, 1.8rem);
        border-radius: 16px;
        margin: 1rem auto;
    }

    .result-left {
        width: 100%;
        height: clamp(200px, 32vh, 280px);
        min-height: 200px;
        flex: none;
    }

    .result-right {
        width: 100%;
        align-items: center;
        text-align: center;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
    }

    .result-actions .minimal-btn {
        width: 100% !important;
        padding: 0.85rem 1.5rem;
        text-align: center;
    }

    .feature-card,
    .minimal-quote {
        text-align: left; /* Keep features left-aligned for readability */
    }

    .lead-panel {
        animation: none;
    }

    .mute-btn {
        top: max(14px, env(safe-area-inset-top));
        right: max(14px, env(safe-area-inset-right));
        bottom: auto;
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
}

@media screen and (max-width: 400px) {
    .minimal-result {
        padding: 1rem;
    }
    .result-left {
        height: 180px;
        min-height: 180px;
    }
    .feature-card {
        padding: 0.75rem 0.9rem;
    }
}
