:root {
    --bg-page: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #000000;
    --text-muted: rgba(0, 0, 0, 0.6);
    --border-color: #e5e7eb;
    --btn-bg: #ffffff;
    --btn-color: #374151;
    --home-card-bg: #111827;
    --home-card-text: #ffffff;
    --home-card-muted: rgba(255, 255, 255, 0.6);
    --home-card-border: rgba(255, 255, 255, 0.2);
    --home-btn-bg: #ffffff;
    --home-btn-color: #111827;
}

[data-theme="dark"] {
    --bg-page: #111827;
    --card-bg: #1f2937;
    --text-main: #f9fafb;
    --text-muted: rgba(255, 255, 255, 0.6);
    --border-color: #374151;
    --btn-bg: #374151;
    --btn-color: #f9fafb;
    --home-card-bg: #ffffff;
    --home-card-text: #111827;
    --home-card-muted: rgba(0, 0, 0, 0.6);
    --home-card-border: rgba(0, 0, 0, 0.1);
    --home-btn-bg: #111827;
    --home-btn-color: #ffffff;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
    padding-bottom: 80px; /* 为固定footer留出空间 */
}

header {
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    transition: background-color 0.3s;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-container {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #818cf8, #a78bfa);
    border-radius: 50%;
    animation: rotateLogo 6s linear infinite;
}

.logo-main {
    position: relative;
    font-size: 24px;
    z-index: 2;
}

@keyframes rotateLogo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.header-actions {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--btn-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

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

main {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 2rem 2rem;
}

.question-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.question-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.question-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.5rem;
    line-height: 1.3;
}

.question-header span {
    color: #4f46e5;
}

[data-theme="dark"] .question-header span {
    color: #818cf8;
}

.game-container {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.card {
    width: 420px;
    height: 380px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    z-index: 10;
    transition: opacity 0.4s, transform 0.4s;
}

.right-panel {
    position: relative;
    width: 420px;
    height: 380px;
}

.right-panel .card {
    position: absolute;
    top: 0;
    left: 0;
}

.character-card {
    width: 380px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 0;
}

.color-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 0;
}

.card-image-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片加载动画 */
.card-image-bg.loading {
    background-image: none !important;
}

.card-image-bg.loading::before {
    content: '';
    width: 60px;
    height: 60px;
    border: 4px solid rgba(129, 140, 248, 0.1);
    border-top-color: rgba(129, 140, 248, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.card-image-bg.loading::after {
    content: 'Loading...';
    position: absolute;
    bottom: 40%;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 图片加载完成后的淡入效果 */
.card-image-bg.loaded {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card.hidden {
    transform: scale(0.95);
    display: block !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.hidden {
    display: none !important;
}

.control-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #408080;
}

.level-indicator {
    position: absolute;
    top: 2rem;
    left: 7rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.controls-wrapper {
    display: flex;
    gap: 0;
    height: 100%;
    align-items: center;
}

.vertical-slider {
    width: 32px;
    height: 100%;
    position: relative;
    cursor: pointer;
    touch-action: none;
}

.slider-track {
    width: 100%;
    height: 100%;
    touch-action: none;
}

#hue-track {
    background: linear-gradient(to bottom, 
        #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
}

.slider-thumb {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vertical-slider input[type="range"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
    -webkit-appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    touch-action: none;
}

.preview-area {
    flex: 1;
    background-color: #408080;
}

.action-btn {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    background: var(--btn-bg);
    color: var(--btn-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, background-color 0.3s;
    z-index: 10;
}

.action-btn:hover {
    transform: scale(1.08);
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn.secondary {
    width: 52px;
    height: 52px;
    background: #ffffff;
    color: #374151;
}

.action-btn.secondary:hover {
    transform: scale(1.08);
}

.action-btn-group {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    z-index: 10;
}

.action-btn-group .action-btn {
    position: static;
}

.result-card {
    display: flex;
    flex-direction: column;
}

.result-top,
.result-bottom {
    height: 50%;
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-top {
    background: #7a461b;
    color: #ffffff;
}

.result-bottom {
    background: #b67751;
    color: #ffffff;
}

.selection-label {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.selection-values {
    font-size: 0.85rem;
    font-weight: 600;
}

.result-score-box {
    text-align: right;
}

.result-score-box h2 {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.result-score-box p {
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.2rem;
}

.summary-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.summary-header {
    padding: 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 2rem;
    background: var(--card-bg);
}

.summary-score-box {
    text-align: left;
}

.summary-score-box h2 {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

#summary-grid-container {
    background: #111827;
    padding: 2rem;
    flex: 1;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.summary-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
}

.summary-color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.summary-score {
    position: absolute;
    bottom: 0.4rem;
    right: 0.4rem;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.summary-footer {
    background: #111827;
    padding: 0 2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.summary-footer .action-btn {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
}

footer {
    padding: 1.5rem 4rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    background: var(--card-bg);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.footer-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.footer-section {
    flex: 1;
}

.footer-left {
    display: flex;
    justify-content: flex-start;
}

.footer-center {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.9rem;
}

.footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dev-message-form {
    display: flex;
    align-items: center;
    background: rgba(129, 140, 248, 0.05);
    border: 1px solid rgba(129, 140, 248, 0.1);
    border-radius: 10px;
    padding: 0.2rem 0.2rem 0.2rem 0.8rem;
    width: 260px;
    transition: 0.2s;
}

.dev-message-form:focus-within {
    background: rgba(129, 140, 248, 0.08);
    border-color: rgba(129, 140, 248, 0.3);
}

.dev-message-form input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.8rem;
    width: 100%;
    outline: none;
}

.dev-message-form button {
    background: var(--btn-bg);
    color: var(--btn-color);
    border: none;
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.dev-message-form button:hover {
    transform: scale(1.05);
}

/* SEO Content Section */
.seo-content {
    width: 100%;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 4rem 2rem;
    margin-top: 4rem;
    transition: background-color 0.3s;
}

.seo-container {
    max-width: 900px;
    margin: 0 auto;
}

.seo-article {
    line-height: 1.8;
}

.seo-article h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    line-height: 1.3;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.seo-article h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.seo-article p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    text-align: justify;
}

.seo-article p strong {
    color: var(--text-main);
    font-weight: 600;
}

.seo-article ul {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.seo-article ul li {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.seo-article ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: 700;
    font-size: 1.2rem;
}

.seo-article ul li strong {
    color: var(--text-main);
    font-weight: 600;
}

/* Dark theme adjustments for SEO section */
[data-theme="dark"] .seo-article h2 {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .seo-article ul li::before {
    color: #818cf8;
}

@media (max-width: 900px) {
    .card, .right-panel {
        width: 340px;
        height: 300px;
    }
    
    .character-card {
        height: 340px;
    }
    
    .question-header {
        margin-bottom: 1rem;
        margin-top: 1rem;
    }
    
    .question-header h2 {
        font-size: 1.2rem;
    }
    
    .game-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    header {
        padding: 1rem 1.2rem;
    }
    
    .home-title {
        font-size: 2.8rem;
    }
    
    /* SEO Content Mobile Styles */
    .seo-content {
        padding: 3rem 1.5rem;
        margin-top: 3rem;
    }
    
    .seo-article h2 {
        font-size: 1.6rem;
        margin-bottom: 1.2rem;
    }
    
    .seo-article h3 {
        font-size: 1.3rem;
        margin-top: 2rem;
    }
    
    .seo-article p {
        font-size: 0.95rem;
        text-align: left;
    }
    
    .seo-article ul li {
        font-size: 0.95rem;
        padding-left: 1.8rem;
    }
}
