/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ff6b9d;
    --primary-dark: #e84a7f;
    --primary-light: #ffe4ec;
    --secondary: #c084fc;
    --bg: #fff5f8;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #fed7e2;
    --success: #48bb78;
    --shadow: 0 8px 30px rgba(255, 107, 157, 0.2);
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
    will-change: opacity, transform;
    backface-visibility: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 首页 */
#homePage {
    text-align: center;
    padding: 60px 20px;
}

.hero {
    margin-bottom: 60px;
}

.hero-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.hero h1 {
    font-size: 2.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

.btn-large {
    padding: 18px 60px;
    font-size: 1.2rem;
    border-radius: 50px;
}

/* 美甲作品展示 */
.gallery-section {
    margin-top: 60px;
}

.gallery-title {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    will-change: transform;
    backface-visibility: hidden;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    will-change: transform;
    backface-visibility: hidden;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 20px;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* 按钮 */
.btn-primary, .btn-secondary, .btn-success {
    padding: 14px 35px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backface-visibility: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--bg);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

/* 答题页 */
#quizPage {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-header {
    margin-bottom: 30px;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 5%;
}

.progress-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
}

.quiz-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.question-text {
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 30px;
    line-height: 1.6;
}

.category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    font-weight: normal;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 18px 25px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 15px;
    text-align: left;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
    backface-visibility: hidden;
}

.option-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateX(5px);
}

.option-btn.selected {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.quiz-footer button {
    flex: 1;
}

/* 生成页 */
.generating-content {
    text-align: center;
    padding: 80px 20px;
}

.spinner-large {
    width: 80px;
    height: 80px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.generating-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--text);
}

.generating-desc {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 50px;
}

/* 结果页 */
.result-header {
    text-align: center;
    padding: 40px 20px;
}

.result-header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.result-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.image-container {
    min-height: 350px;
    border-radius: 15px;
    overflow: hidden;
    background: linear-gradient(135deg, #fff5f8 0%, #ffe4e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-placeholder {
    text-align: center;
    color: var(--text-light);
}

.loading-placeholder .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.result-image {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.analysis-content {
    color: var(--text);
    line-height: 1.8;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.result-actions button {
    flex: 1;
    min-width: 150px;
    max-width: 180px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--text);
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .quiz-content {
        padding: 25px;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .option-btn {
        padding: 15px 20px;
        font-size: 1rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions button {
        max-width: none;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .gallery-title {
        font-size: 1.5rem;
    }
}
