/* ==================== 基础样式 ==================== */
:root {
    --primary: #C08497;
    --primary-dark: #9B6B7D;
    --primary-light: #E8C4CF;
    --bg: #FDF6F0;
    --bg-card: #FFFFFF;
    --text: #2D2D2D;
    --text-light: #8A8A8A;
    --text-muted: #BBBBBB;
    --border: #F0E6E0;
    --shadow: rgba(192, 132, 151, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --result-color: #C08497;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 页面切换 ==================== */
.page {
    display: none;
    min-height: 100vh;
    position: relative;
}

.page.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: pageIn 0.5s ease;
}

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

/* ==================== 启动页 ==================== */
#page-landing {
    justify-content: center;
    background: linear-gradient(160deg, #FDF6F0 0%, #F8E8EC 40%, #EDD5DC 100%);
    overflow: hidden;
}

.landing-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.floating-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: floatUp 12s infinite ease-in-out;
}

.p1 { width: 260px; height: 260px; background: #C08497; top: -80px; right: -60px; animation-delay: 0s; }
.p2 { width: 180px; height: 180px; background: #D4A0B0; bottom: 10%; left: -40px; animation-delay: -3s; }
.p3 { width: 120px; height: 120px; background: #E8C4CF; top: 30%; right: 10%; animation-delay: -6s; }
.p4 { width: 80px; height: 80px; background: #F4D5DE; bottom: 30%; right: -20px; animation-delay: -2s; }
.p5 { width: 200px; height: 200px; background: #C08497; bottom: -60px; left: 30%; animation-delay: -8s; }

@keyframes floatUp {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.landing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 24px;
    max-width: 480px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: gentleBounce 3s infinite ease-in-out;
}

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

.landing-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.landing-subtitle {
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: 28px;
    line-height: 1.6;
}

.landing-features {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.feature-tag {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-dark);
    border: 1px solid rgba(192,132,151,0.2);
}

.landing-note {
    margin-top: 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ==================== 按钮样式 ==================== */
.btn-primary {
    display: inline-block;
    padding: 16px 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-glow {
    animation: glow 3s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 4px 15px var(--shadow); }
    50% { box-shadow: 0 6px 30px rgba(192, 132, 151, 0.3); }
}

.btn-secondary {
    display: inline-block;
    padding: 14px 40px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 10px 24px;
    font-size: 0.9rem;
}

/* ==================== 答题页 ==================== */
#page-quiz {
    background: var(--bg);
}

.quiz-header {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 20px 24px 16px;
    background: var(--bg);
    z-index: 10;
    max-width: 520px;
}

.progress-info {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-info #question-number {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

.progress-bar-wrapper {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 5%;
}

.quiz-body {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 520px;
    padding: 20px 24px 40px;
}

.question-container {
    width: 100%;
}

.question-container.slide-out {
    animation: slideOut 0.25s ease forwards;
}

.question-container.slide-in {
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideOut {
    to { opacity: 0; transform: translateX(-30px); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.question-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 28px;
    color: var(--text);
}

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

.option-btn {
    width: 100%;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: left;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    line-height: 1.5;
    animation: optionFadeIn 0.35s ease both;
}

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

.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(192, 132, 151, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

.option-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(192,132,151,0.1), rgba(192,132,151,0.05));
    transform: scale(0.98);
}

.option-btn.not-selected {
    opacity: 0.4;
    transform: scale(0.98);
}

/* ==================== 邀请码页 ==================== */
#page-invite {
    justify-content: center;
    background: linear-gradient(160deg, #FDF6F0 0%, #F0E4E8 100%);
}

.invite-content {
    text-align: center;
    padding: 40px 28px;
    max-width: 440px;
}

.invite-icon {
    font-size: 56px;
    margin-bottom: 20px;
}

.invite-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
}

.invite-desc {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.invite-input-group {
    margin-bottom: 28px;
}

.invite-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.3s;
    outline: none;
    text-transform: uppercase;
}

.invite-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(192, 132, 151, 0.1);
}

.invite-input.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.invite-error {
    color: #E57373;
    font-size: 0.85rem;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    height: 20px;
}

.invite-error.show {
    opacity: 1;
}

.invite-hint {
    margin-top: 36px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.hint-small {
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ==================== 加载页 ==================== */
#page-loading {
    justify-content: center;
    background: var(--bg);
}

.loading-content {
    text-align: center;
    padding: 40px 24px;
}

.perfume-bottle-anim {
    position: relative;
    width: 80px;
    height: 100px;
    margin: 0 auto 32px;
}

.bottle-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 64px;
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 8px 8px 12px 12px;
    animation: bottlePulse 1.5s infinite ease-in-out;
}

.bottle-body::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--primary-dark);
    border-radius: 3px 3px 0 0;
}

.bottle-spray {
    position: absolute;
    top: 0;
    border-radius: 50%;
    background: var(--primary-light);
    opacity: 0;
    animation: spray 2s infinite;
}

.s1 { width: 8px; height: 8px; left: 30px; animation-delay: 0s; }
.s2 { width: 6px; height: 6px; left: 44px; animation-delay: 0.5s; }
.s3 { width: 10px; height: 10px; left: 36px; animation-delay: 1s; }

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

@keyframes spray {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    30% { opacity: 0.6; }
    100% { opacity: 0; transform: translateY(-50px) scale(1.5); }
}

.loading-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 28px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.loading-step {
    font-size: 0.92rem;
    color: var(--text-muted);
    transition: all 0.5s;
    position: relative;
    padding-left: 28px;
}

.loading-step::before {
    content: '○';
    position: absolute;
    left: 0;
    transition: all 0.3s;
}

.loading-step.active {
    color: var(--primary);
    font-weight: 500;
}

.loading-step.active::before {
    content: '●';
    color: var(--primary);
}

/* ==================== 报告页 ==================== */
#page-result {
    background: var(--bg);
}

.result-content {
    width: 100%;
    max-width: 520px;
    padding: 0 20px 60px;
}

.result-header-section {
    text-align: center;
    padding: 48px 20px 36px;
    background: linear-gradient(180deg, rgba(192,132,151,0.08) 0%, transparent 100%);
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 24px;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.result-type {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--result-color);
    margin-bottom: 12px;
    line-height: 1.3;
}

.result-tagline {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
}

.result-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

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

.result-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.result-card p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #555;
}

/* 特质标签 */
.traits-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.trait-tag {
    padding: 6px 16px;
    border: 1.5px solid;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
}

/* 图表 */
.chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.chart-label {
    width: 38px;
    font-size: 0.82rem;
    color: var(--text-light);
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-bg {
    flex: 1;
    height: 22px;
    background: #f5f0ed;
    border-radius: 11px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 11px;
}

.chart-bar-fill.top {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-value {
    width: 38px;
    font-size: 0.8rem;
    color: var(--text-light);
    flex-shrink: 0;
}

/* 香水推荐卡片 */
.perfumes-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.perfume-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: #faf7f5;
    border-radius: var(--radius-sm);
    animation: perfumeIn 0.5s ease both;
}

@keyframes perfumeIn {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

.perfume-icon {
    font-size: 2.4rem;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
}

.perfume-info {
    flex: 1;
    min-width: 0;
}

.perfume-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.perfume-en {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.perfume-notes {
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.perfume-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 8px;
}

.perfume-price {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--text-light);
    background: #fff;
    padding: 3px 10px;
    border-radius: 12px;
}

/* 结果操作 */
.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 32px 0 20px;
    flex-wrap: wrap;
}

.result-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ==================== 管理面板 ==================== */
#page-admin {
    background: var(--bg);
    padding: 40px 20px;
}

.admin-content {
    max-width: 600px;
    width: 100%;
}

.admin-content h2 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.admin-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.admin-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

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

.admin-row label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.admin-row input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    outline: none;
    font-family: inherit;
}

.admin-row input:focus {
    border-color: var(--primary);
}

.codes-list {
    max-height: 240px;
    overflow-y: auto;
}

.codes-title {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.code-tag {
    display: inline-block;
    padding: 5px 12px;
    margin: 3px;
    background: #f0f7f0;
    color: #4CAF50;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.code-tag.used {
    background: #fce4ec;
    color: #E57373;
    text-decoration: line-through;
}

.code-tag.new {
    background: #e3f2fd;
    color: #1976D2;
    animation: tagPop 0.3s ease;
}

@keyframes tagPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.no-codes {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(45,45,45,0.92);
    color: #fff;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
    .landing-title {
        font-size: 2rem;
    }

    .question-text {
        font-size: 1.15rem;
    }

    .option-btn {
        padding: 15px 16px;
        font-size: 0.92rem;
    }

    .result-type {
        font-size: 1.9rem;
    }

    .perfume-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .btn-primary {
        padding: 14px 44px;
        font-size: 1rem;
    }

    .invite-title {
        font-size: 1.4rem;
    }
}

@media (min-width: 768px) {
    .landing-title {
        font-size: 3rem;
    }

    .result-type {
        font-size: 2.8rem;
    }

    .perfume-card {
        padding: 24px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 2px;
}
