/* ==================== 亲戚应对模拟器 - 现代春节主题样式 ==================== */

/* ==================== CSS 变量定义 ==================== */
:root {
    /* 主色调 - 高级红金配色 */
    --color-primary: #B22222;          /* 宝石红 */
    --color-primary-light: #D42020;     /* 亮红 */
    --color-primary-dark: #8B0000;     /* 深红 */
    --color-accent: #D4AF37;           /* 香槟金 */
    --color-accent-light: #F4E4BC;     /* 浅金 */
    --color-accent-dark: #B8860B;      /* 深金 */
    
    /* 中性色 */
    --color-white: #FFFFFF;
    --color-surface: #FFFAF5;          /* 米白表面 */
    --color-surface-light: #FFF8F0;   /* 浅米色 */
    --color-text: #1A1A1A;            /* 接近黑色 */
    --color-text-secondary: #5A5A5A;  /* 次要文字 */
    --color-text-muted: #8E8E8E;     /* 柔和文字 */
    
    /* 聊天消息颜色 */
    --color-msg-relative: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%); /* 浅粉色背景 */
    --color-msg-relative-text: #B71C1C;
    --color-msg-user: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    --color-msg-user-text: var(--color-white);
    
    /* 阴影和效果 */
    --shadow-sm: 0 2px 8px rgba(178, 34, 34, 0.08);
    --shadow-md: 0 4px 20px rgba(178, 34, 34, 0.12);
    --shadow-lg: 0 8px 40px rgba(178, 34, 34, 0.16);
    --shadow-xl: 0 20px 60px rgba(178, 34, 34, 0.20);
    
    /* 毛玻璃效果 - 更亮的背景 */
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(212, 175, 55, 0.4);
    --glass-blur: blur(25px);
    --card-bg: #FFFFFF;  /* 纯白色卡片背景 */
    
    /* 圆角 */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 字体 */
    --font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;

    /* 渐变变量 */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    --gradient-gold: linear-gradient(90deg, var(--color-accent) 0%, var(--color-primary-light) 50%, var(--color-accent) 100%);
}

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, 
        #C0392B 0%, 
        #D35400 20%, 
        #E74C3C 50%, 
        #D35400 80%, 
        #C0392B 100%);
    min-height: 100vh;
    padding: 24px;
    overflow-x: hidden;
    position: relative;
    color: var(--color-text);
    line-height: 1.6;
}

/* 背景装饰 - 动态粒子效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ==================== 烟花粒子效果 ==================== */
.firework {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: fireworkExplode 1.5s ease-out forwards;
}

@keyframes fireworkExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 烟花容器 */
.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* 不同颜色的烟花 */
.firework.red { background: #FF0000; box-shadow: 0 0 10px #FF0000, 0 0 20px #FF0000; }
.firework.gold { background: #FFD700; box-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700; }
.firework.orange { background: #FF6B00; box-shadow: 0 0 10px #FF6B00, 0 0 20px #FF6B00; }
.firework.pink { background: #FF69B4; box-shadow: 0 0 10px #FF69B4, 0 0 20px #FF69B4; }
.firework.purple { background: #9B59B6; box-shadow: 0 0 10px #9B59B6, 0 0 20px #9B59B6; }
.firework.white { background: #FFFFFF; box-shadow: 0 0 10px #FFFFFF, 0 0 20px #FFFFFF; }

/* 春节装饰背景 */
.lantern {
    position: fixed;
    font-size: 3rem;
    animation: lanternSwing 4s ease-in-out infinite;
    z-index: 1;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.6));
    top: 30px;
}

.lantern-left {
    left: 30px;
    animation-delay: 0s;
}

.lantern-right {
    right: 30px;
    animation-delay: 2s;
}

@keyframes lanternSwing {
    0%, 100% { 
        transform: rotate(-8deg) translateY(0);
    }
    50% { 
        transform: rotate(8deg) translateY(-5px);
    }
}

/* 装饰性福字 */
.lantern::after {
    content: '福';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}

/* 容器 */
.container {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* ==================== 标题区域 ==================== */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 48px 32px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-xl);
    border: 2px solid var(--glass-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--color-accent) 0%, 
        var(--color-primary-light) 50%, 
        var(--color-accent) 100%);
    background-size: 200% 100%;
    animation: goldShine 3s linear infinite;
}

@keyframes goldShine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    background: linear-gradient(135deg, 
        var(--color-primary) 0%, 
        var(--color-primary-light) 50%, 
        var(--color-accent-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: none;
    position: relative;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    font-weight: 400;
    letter-spacing: 1px;
}

/* ==================== 屏幕切换 ==================== */
.screen {
    display: none;
    animation: screenFadeIn 0.5s var(--transition-normal);
}

.screen.active {
    display: block;
    animation: screenSlideUp 0.5s var(--transition-normal);
}

@keyframes screenFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==================== 难度选择区域 ==================== */
.section-title {
    text-align: center;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: var(--color-white);
    margin-bottom: 32px;
    font-weight: 600;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* 难度卡片 - 现代设计 */
.difficulty-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--color-accent) 50%, 
        transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.difficulty-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: rgba(212, 175, 55, 0.3);
}

.difficulty-card:hover::before {
    opacity: 1;
}

.difficulty-card:active {
    transform: translateY(-4px) scale(1.01);
}

.card-emoji {
    font-size: 3.5rem;
    margin-bottom: 16px;
    display: inline-block;
    transition: transform var(--transition-normal);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.difficulty-card:hover .card-emoji {
    transform: scale(1.1) rotate(5deg);
}

.card-title {
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

.difficulty-stars {
    font-size: 1.2rem;
    margin-bottom: 12px;
    letter-spacing: 4px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

.difficulty-stars span {
    transition: transform var(--transition-fast);
    display: inline-block;
    margin: 0 2px;
}

.difficulty-card:hover .difficulty-stars span {
    animation: starPop 0.5s ease forwards;
}

.difficulty-card:hover .difficulty-stars span:nth-child(1) { animation-delay: 0s; }
.difficulty-card:hover .difficulty-stars span:nth-child(2) { animation-delay: 0.1s; }
.difficulty-card:hover .difficulty-stars span:nth-child(3) { animation-delay: 0.2s; }
.difficulty-card:hover .difficulty-stars span:nth-child(4) { animation-delay: 0.3s; }
.difficulty-card:hover .difficulty-stars span:nth-child(5) { animation-delay: 0.4s; }
.difficulty-card:hover .difficulty-stars span:nth-child(6) { animation-delay: 0.5s; }

@keyframes starPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.card-desc {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.card-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFB347 50%, #FFD700 100%);
    color: #8B0000;
    border: 2px solid #FFD700;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.card-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    transition: left 0.5s;
}

.card-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.6);
    border-color: #FFF4B0;
}

.card-btn:hover::before {
    left: 100%;
}

.card-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
}

/* ==================== 聊天界面 ==================== */

/* 聊天头部 */
.chat-header {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-sm);
}

.relative-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.relative-emoji {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #FFF8F0 0%, #FFE4E1 100%);
    padding: 8px;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--color-accent-light);
}

.relative-name {
    font-size: 1.2rem;
    color: var(--color-text);
    margin-bottom: 4px;
    font-weight: 600;
}

.relative-difficulty {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.back-btn {
    background: linear-gradient(135deg, #F5F5F5 0%, #E0E0E0 100%);
    color: var(--color-text-secondary);
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.back-btn:hover {
    background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-accent) 100%);
    color: var(--color-primary-dark);
    transform: translateX(-4px);
}

/* 聊天消息区域 */
.chat-messages {
    background: linear-gradient(180deg,
        #FFFAFA 0%,
        #FFF8F8 50%,
        #FFF6F6 100%);
    height: 480px;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-left: 1px solid rgba(212, 175, 55, 0.15);
    border-right: 1px solid rgba(212, 175, 55, 0.15);
}

/* 消息气泡样式 */
.message {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 20px;
    animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    word-wrap: break-word;
    font-size: 1rem;
    line-height: 1.6;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.relative {
    align-self: flex-start;
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    color: var(--color-msg-relative-text);
    border-bottom-left-radius: 6px;
    box-shadow: 0 4px 15px rgba(178, 34, 34, 0.15);
    border: 1px solid rgba(178, 34, 34, 0.2);
}

.message.relative:hover {
    box-shadow: 0 6px 20px rgba(178, 34, 34, 0.2);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-msg-user-text);
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 15px rgba(178, 34, 34, 0.3);
    border: 1px solid rgba(178, 34, 34, 0.2);
}

.message.user:hover {
    box-shadow: 0 6px 20px rgba(178, 34, 34, 0.4);
}

.message.system {
    align-self: center;
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 50%, #FFF8E1 100%);
    color: #E65100;
    font-size: 0.9rem;
    text-align: center;
    max-width: 85%;
    padding: 14px 24px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(230, 81, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.4);
    letter-spacing: 0.5px;
}

.message-content {
    line-height: 1.6;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 6px;
    text-align: right;
}

/* 正在输入提示 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--color-msg-relative);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    max-width: 200px;
    box-shadow: var(--shadow-sm);
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 10px;
    height: 10px;
    background: var(--color-msg-relative-text);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.typing-text {
    font-size: 0.85rem;
    color: var(--color-msg-relative-text);
    font-style: italic;
    font-weight: 500;
}

/* 聊天输入区域 */
.chat-input-area {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.chat-input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #E0E0E0;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--color-white);
    color: var(--color-text);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(178, 34, 34, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-input:hover {
    border-color: #C0C0C0;
}

.chat-input::placeholder {
    color: #6B7280;
}

.send-btn {
    background: linear-gradient(135deg, 
        var(--color-primary) 0%, 
        var(--color-primary-light) 100%);
    color: white;
    border: 2px solid transparent;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(178, 34, 34, 0.3);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    transition: left 0.5s;
}

.send-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(178, 34, 34, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.send-btn:hover::before {
    left: 100%;
}

.send-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(178, 34, 34, 0.4);
}

.send-btn:disabled {
    background: linear-gradient(135deg, #CCCCCC 0%, #BBBBBB 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ==================== 弹窗样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, 
        var(--color-accent) 0%, 
        var(--color-primary-light) 50%, 
        var(--color-accent) 100%);
}

#result-title {
    font-size: 2rem;
    background: linear-gradient(135deg, 
        var(--color-primary) 0%, 
        var(--color-primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-weight: 700;
}

#result-message {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
    line-height: 1.7;
}

.result-stats {
    background: linear-gradient(135deg, 
        var(--color-surface-light) 0%, 
        var(--color-surface) 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.result-stats p {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.result-stats span {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.2rem;
}

.modal-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 16px 36px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 1px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, 
        var(--color-primary) 0%, 
        var(--color-primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(178, 34, 34, 0.3);
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(178, 34, 34, 0.4);
}

.modal-btn.secondary {
    background: linear-gradient(135deg, #F5F5F5 0%, #EEEEEE 100%);
    color: var(--color-text-secondary);
}

.modal-btn.secondary:hover {
    background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-accent) 100%);
    color: var(--color-primary-dark);
}

/* ==================== 加载动画 ==================== */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
}

.loading.active {
    display: flex;
    animation: loadingFadeIn 0.3s ease-out;
}

@keyframes loadingFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

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

.loading p {
    font-size: 1.1rem;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ==================== 滚动条美化 ==================== */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(178, 34, 34, 0.3);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(178, 34, 34, 0.5);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .header {
        padding: 36px 24px;
        margin-bottom: 24px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .lantern {
        font-size: 2.5rem;
        top: 16px;
    }
    
    .lantern-left {
        left: 16px;
    }
    
    .lantern-right {
        right: 16px;
    }
    
    .difficulty-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .difficulty-card {
        padding: 24px 20px;
    }
    
    .card-emoji {
        font-size: 3rem;
    }
    
    .chat-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .relative-info {
        flex-direction: column;
    }
    
    .back-btn {
        width: 100%;
        padding: 12px;
    }
    
    .chat-messages {
        height: 400px;
        padding: 16px;
    }
    
    .message {
        max-width: 85%;
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .chat-input-area {
        flex-direction: column;
        padding: 16px;
    }
    
    .chat-input {
        width: 100%;
        padding: 14px 20px;
    }
    
    .send-btn {
        width: 100%;
        padding: 14px;
    }
    
    .modal-content {
        padding: 36px 24px;
    }
    
    #result-title {
        font-size: 1.6rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 28px 20px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .difficulty-card {
        padding: 20px 16px;
    }
    
    .card-emoji {
        font-size: 2.5rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .chat-messages {
        height: 350px;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .lantern {
        display: none;
    }
}

/* ==================== 深色模式支持 ==================== */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, 
            #5D1515 0%, 
            #6B0000 50%, 
            #5D1515 100%);
    }
    
    .header,
    .difficulty-card,
    .chat-header,
    .chat-input-area {
        background: rgba(30, 30, 30, 0.9);
    }
    
    .chat-messages {
        background: linear-gradient(180deg, 
            #1A1A1A 0%, 
            #222222 50%, 
            #1A1A1A 100%);
    }
}

/* ==================== 动画增强 ==================== */

/* 页面加载完成后的入场动画 */
@keyframes pageEntrance {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.container {
    animation: pageEntrance 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 按钮点击波纹效果 */
.card-btn::after,
.send-btn::after,
.modal-btn.primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.card-btn:active::after,
.send-btn:active::after,
.modal-btn.primary:active::after {
    width: 300px;
    height: 300px;
}

/* 卡片选中效果 */
.difficulty-card.selected {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* 消息数字角标 */
.message-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* 春节装饰元素 */
.spring-decoration {
    position: fixed;
    pointer-events: none;
    opacity: 0.1;
    font-size: 2rem;
    z-index: 0;
    animation: floatDecoration 15s linear infinite;
}

.spring-decoration:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.spring-decoration:nth-child(2) { right: 15%; top: 30%; animation-delay: -3s; }
.spring-decoration:nth-child(3) { left: 20%; bottom: 20%; animation-delay: -6s; }
.spring-decoration:nth-child(4) { right: 25%; bottom: 30%; animation-delay: -9s; }

@keyframes floatDecoration {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-20px) rotate(10deg);
        opacity: 0.1;
    }
}

/* ==================== 设置面板 ==================== */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1000;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: var(--shadow-xl);
    background: var(--gradient-primary);
    border-color: var(--color-accent);
}

.settings-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
}

.settings-panel.active {
    display: block;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.settings-content {
    padding: 24px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--glass-border);
}

.settings-header h3 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin: 0;
}

.close-settings {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--color-text-muted);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings:hover {
    background: var(--color-primary);
    transform: rotate(90deg);
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h4 {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 16px;
    font-weight: 600;
}

.settings-option {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.5);
    transition: all var(--transition-fast);
}

.settings-option:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    margin-right: 12px;
    transition: all var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-text {
    font-size: 1rem;
    color: var(--color-text);
}

/* Radio Toggle */
.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-label input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

.toggle-label:hover .toggle-text {
    color: var(--color-primary);
}

/* Select */
.settings-select {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-select:hover,
.settings-select:focus {
    border-color: var(--color-primary);
    outline: none;
}

/* ==================== 深色模式 ==================== */
body.dark-mode {
    background: linear-gradient(135deg,
        #1a0a0a 0%,
        #2d0a0a 25%,
        #3d1414 50%,
        #2d0a0a 75%,
        #1a0a0a 100%);
    color: #f0f0f0;
}

body.dark-mode .header {
    background: #2a2a2a;
    border-color: rgba(212, 175, 55, 0.4);
}

body.dark-mode .difficulty-card {
    background: #2a2a2a;
    border-color: rgba(212, 175, 55, 0.4);
}

body.dark-mode .card-title,
body.dark-mode .card-desc {
    color: #f0f0f0;
}

body.dark-mode .chat-header {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(212, 175, 55, 0.2);
}

body.dark-mode .chat-messages {
    background: linear-gradient(180deg,
        #1e1e1e 0%,
        #222222 50%,
        #262626 100%);
    border-color: rgba(212, 175, 55, 0.2);
}

body.dark-mode .chat-input-area {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(212, 175, 55, 0.2);
}

body.dark-mode .chat-input {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(212, 175, 55, 0.3);
    color: #f0f0f0;
}

body.dark-mode .chat-input::placeholder {
    color: #888;
}

body.dark-mode .chat-input:focus {
    border-color: var(--color-accent);
    background: rgba(60, 60, 60, 1);
}

body.dark-mode .message.system {
    background: linear-gradient(135deg, #2a2a2a 0%, #333333 100%);
    color: #aaa;
}

body.dark-mode .settings-btn {
    background: rgba(40, 40, 40, 0.95);
    border-color: rgba(212, 175, 55, 0.3);
}

body.dark-mode .settings-panel {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(212, 175, 55, 0.3);
}

body.dark-mode .settings-option {
    background: rgba(60, 60, 60, 0.5);
}

body.dark-mode .settings-option:hover {
    background: rgba(60, 60, 60, 0.8);
}

body.dark-mode .settings-select {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(212, 175, 55, 0.3);
    color: #f0f0f0;
}

body.dark-mode .modal-content {
    background: rgba(30, 30, 30, 0.98);
    color: #f0f0f0;
}

body.dark-mode .result-stats {
    background: rgba(60, 60, 60, 0.5);
}

/* ==================== 性能优化与兼容性增强 ==================== */

/* 1. 为动画元素添加性能提示 */
.difficulty-card,
.card-emoji,
.lantern,
.message,
.header {
    will-change: transform;
}

/* 2. 优化背景动画，开启GPU加速 */
body::before {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* 3. 为不支持backdrop-filter的浏览器提供fallback */
@supports not (backdrop-filter: blur(20px)) {
    .difficulty-card,
    .chat-header,
    .chat-input-area,
    .header,
    .modal-content {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* 4. 移动端性能优化 */
@media (max-width: 768px) {
    /* 禁用部分动画以提升性能 */
    .difficulty-card:hover .card-emoji {
        transform: none;
    }

    .difficulty-card:hover .difficulty-stars span {
        animation: none;
    }

    /* 简化背景效果 */
    body::before {
        display: none;
    }
}

/* 5. 添加prefers-reduced-motion支持（无障碍） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 6. 优化渐变文字可访问性 */
.title {
    /* Fallback for browsers that don't support background-clip: text */
    color: var(--color-primary);
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
    .title {
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
}

/* 7. 添加焦点状态以提升键盘导航体验（无障碍） */
.card-btn:focus,
.send-btn:focus,
.back-btn:focus,
.difficulty-card:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* 8. 优化hover效果，只使用translateY以提升性能 */
.difficulty-card:hover {
    transform: translateY(-8px);
}

/* ==================== API Key 模态框样式 ==================== */

.api-key-description {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.api-key-instructions {
    background: linear-gradient(135deg, var(--color-surface-light) 0%, var(--color-surface) 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.api-key-instructions h3 {
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-bottom: 16px;
    font-weight: 600;
}

.api-key-instructions ol {
    text-align: left;
    padding-left: 20px;
    color: var(--color-text);
    line-height: 1.8;
}

.api-key-instructions li {
    margin-bottom: 8px;
}

.api-key-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.api-key-link:hover {
    color: var(--color-primary-light);
    text-decoration: underline;
}

.api-key-input-area {
    margin-bottom: 32px;
}

.api-key-input-area label {
    display: block;
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 12px;
    font-weight: 600;
}

.api-key-input {
    width: 100%;
    padding: 16px 24px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--color-white);
    color: var(--color-text);
    font-family: 'Courier New', monospace;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.api-key-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(178, 34, 34, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.api-key-input:hover {
    border-color: #C0C0C0;
}

.api-key-input.error {
    border-color: #DC3545;
    animation: shake 0.5s ease-in-out;
}

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

.api-key-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 深色模式下的API key模态框 */
body.dark-mode .api-key-modal .modal-content {
    background: rgba(30, 30, 30, 0.98);
    color: #f0f0f0;
}

body.dark-mode .api-key-description {
    color: #ccc;
}

body.dark-mode .api-key-instructions {
    background: rgba(60, 60, 60, 0.5);
    border-color: rgba(212, 175, 55, 0.3);
}

body.dark-mode .api-key-instructions h3 {
    color: var(--color-accent);
}

body.dark-mode .api-key-instructions ol {
    color: #e0e0e0;
}

body.dark-mode .api-key-link {
    color: var(--color-accent);
}

body.dark-mode .api-key-input-area label {
    color: #e0e0e0;
}

body.dark-mode .api-key-input {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(212, 175, 55, 0.3);
    color: #f0f0f0;
}

body.dark-mode .api-key-input::placeholder {
    color: #888;
}

body.dark-mode .api-key-input:focus {
    border-color: var(--color-accent);
    background: rgba(60, 60, 60, 1);
}

body.dark-mode .api-key-hint {
    color: #aaa;
}

/* ==================== 评分模态框样式 ==================== */

.rating-description {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.rating-stars-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.rating-stars {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.star {
    font-size: 3rem;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    filter: grayscale(1);
}

.star:hover,
.star.active {
    color: #FFD700;
    filter: grayscale(0);
    transform: scale(1.1);
}

.star:hover {
    animation: starPulse 0.5s ease-in-out;
}

@keyframes starPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

.rating-text {
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 600;
    min-height: 24px;
}

.rating-feedback {
    background: linear-gradient(135deg, var(--color-surface-light) 0%, var(--color-surface) 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.rating-feedback h3 {
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-bottom: 16px;
    font-weight: 600;
    text-align: center;
}

.rating-comments {
    position: relative;
    min-height: 80px;
}

.rating-comment {
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.rating-comment.active {
    opacity: 1;
    transform: translateY(0);
}

.rating-comment h4 {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.rating-comment p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.rating-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.rating-actions .modal-btn {
    min-width: 140px;
}

/* 深色模式下的评分模态框 */
body.dark-mode #rating-modal .modal-content {
    background: rgba(30, 30, 30, 0.98);
    color: #f0f0f0;
}

body.dark-mode .rating-description {
    color: #ccc;
}

body.dark-mode .rating-feedback {
    background: rgba(60, 60, 60, 0.5);
    border-color: rgba(212, 175, 55, 0.3);
}

body.dark-mode .rating-feedback h3 {
    color: var(--color-accent);
}

body.dark-mode .rating-comment h4 {
    color: var(--color-accent);
}

body.dark-mode .rating-comment p {
    color: #ccc;
}

body.dark-mode .star {
    color: #555;
}

body.dark-mode .star:hover,
body.dark-mode .star.active {
    color: #FFD700;
}
