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

html {
    transition: background 0.5s ease;
}

/* ========================================
   基础样式 - Base Styles
   ======================================== */

body { 
    min-height: 100vh; 
    display: flex; 
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background 0.5s ease;
}

.box { 
    width: 100%; 
    max-width: 400px; 
    padding: 20px;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
    transition: all 0.5s ease;
}

/* ========================================
   顶部功能区 - Top Bar
   ======================================== */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    transition: background 0.5s ease;
}

/* ========================================
   主题选择器 - Theme Selector
   ======================================== */

.theme-selector {
    position: relative;
}

.theme-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.theme-selector-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.theme-selector-icon {
    font-size: 16px;
}

.theme-selector-text {
    font-size: 12px;
}

/* 主题下拉菜单 */
.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 140px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.theme-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #333;
}

.theme-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

.theme-option.active {
    background: rgba(102, 126, 234, 0.15);
    font-weight: 600;
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.theme-option:hover .theme-dot {
    transform: scale(1.1);
}

.theme-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* ========================================
   动画开关 - Animation Toggle
   ======================================== */

.animation-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.animation-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.animation-toggle:active {
    transform: translateY(0);
}

.animation-toggle.disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#animation-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.animation-toggle.disabled #animation-icon {
    opacity: 0.5;
    filter: grayscale(100%);
}

.animation-text {
    font-size: 12px;
}

/* 禁用动画时的全局样式 */
body.animations-disabled .animate-on-load,
body.animations-disabled .animate-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

body.animations-disabled .particle-canvas {
    display: none !important;
}

body.animations-disabled * {
    animation: none !important;
    transition: none !important;
}

/* ========================================
   Logo区域 - Logo Section
   ======================================== */

.logo-section {
    margin-bottom: 20px;
}

.logo { 
    width: 70%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

h1 { 
    color: #333; 
    margin-bottom: 10px;
    font-size: 24px;
    transition: color 0.5s ease;
}

.subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    transition: color 0.5s ease;
}

input[type="password"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

input[type="password"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

.msg {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.msg.error { 
    background: #ffebee; 
    color: #c62828; 
    display: block;
}

.msg.success { 
    background: #e8f5e9; 
    color: #2e7d32; 
    display: block;
}

.msg.loading {
    background: #e3f2fd;
    color: #1565c0;
    display: block;
}

.links {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    transition: border-color 0.5s ease;
}

.links a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.links a:hover {
    text-decoration: underline;
    color: #764ba2;
}

/* ========================================
   文章区域 - Articles Section
   ======================================== */

.articles-section {
    margin: 25px 0;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    transition: border-color 0.5s ease;
}

.articles-title {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.article-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #333;
    font-size: 13px;
}

.article-item:hover {
    transform: translateX(5px);
    background: linear-gradient(145deg, #e9ecef 0%, #dee2e6 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-icon {
    font-size: 16px;
}

.article-text {
    flex: 1;
    text-align: left;
}

/* 各主题的文章区域样式 */
body.theme-retro .articles-section {
    border-top-color: #d4c4a8;
    border-bottom-color: #d4c4a8;
}
body.theme-retro .articles-title { color: #8b7355; }
body.theme-retro .article-item {
    background: linear-gradient(145deg, #faf0e6 0%, #f5e6d3 100%);
    color: #5d4e37;
}
body.theme-retro .article-item:hover {
    background: linear-gradient(145deg, #f5e6d3 0%, #ede0d4 100%);
}

body.theme-eye-care .articles-section {
    border-top-color: #c5d5c5;
    border-bottom-color: #c5d5c5;
}
body.theme-eye-care .articles-title { color: #4a6741; }
body.theme-eye-care .article-item {
    background: linear-gradient(145deg, #f0f7f0 0%, #e8f5e9 100%);
    color: #2e4a2c;
}
body.theme-eye-care .article-item:hover {
    background: linear-gradient(145deg, #e8f5e9 0%, #dcedc8 100%);
}

body.theme-ocean .articles-section {
    border-top-color: #b3e0f2;
    border-bottom-color: #b3e0f2;
}
body.theme-ocean .articles-title { color: #0288d1; }
body.theme-ocean .article-item {
    background: linear-gradient(145deg, #e1f5fe 0%, #b3e5fc 100%);
    color: #01579b;
}
body.theme-ocean .article-item:hover {
    background: linear-gradient(145deg, #b3e5fc 0%, #81d4fa 100%);
}

body.theme-deep .articles-section {
    border-top-color: #4a6278;
    border-bottom-color: #4a6278;
}
body.theme-deep .articles-title { color: #3498db; }
body.theme-deep .article-item {
    background: linear-gradient(145deg, #34495e 0%, #2c3e50 100%);
    color: #ecf0f1;
}
body.theme-deep .article-item:hover {
    background: linear-gradient(145deg, #2c3e50 0%, #34495e 100%);
}

body.theme-dark .articles-section {
    border-top-color: #3a3a4f;
    border-bottom-color: #3a3a4f;
}
body.theme-dark .articles-title { color: #8b9dc3; }
body.theme-dark .article-item {
    background: linear-gradient(145deg, #2a2a3f 0%, #1e1e2f 100%);
    color: #e0e0e0;
}
body.theme-dark .article-item:hover {
    background: linear-gradient(145deg, #32324a 0%, #2a2a3f 100%);
}

.qrcode-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    transition: border-color 0.5s ease;
}

.qrcode-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    transition: color 0.5s ease;
}

.qrcode-img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.qrcode-img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.beian {
    margin-top: 20px;
    font-size: 12px;
    color: #999;
    transition: color 0.5s ease;
}

.beian p {
    margin: 5px 0;
}

.beian a {
    color: #999;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.beian a:hover {
    text-decoration: underline;
    color: #667eea;
}

.beian-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* ========================================
   Toast弹窗 - App Toast
   ======================================== */

.app-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    z-index: 10003;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 180px;
    justify-content: center;
}

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

.toast-icon {
    font-size: 18px;
}

.toast-text {
    white-space: nowrap;
}

/* 禁用动画时 */
body.animations-disabled .app-toast {
    transition: none !important;
}

/* ========================================
   粒子背景 - Particle Canvas
   ======================================== */

.particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* ========================================
   主题切换遮罩 - Theme Overlay
   ======================================== */

.theme-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.5s ease;
}

.theme-overlay.active {
    opacity: 1;
}

/* ========================================
   Toast提示 - Toast Message
   ======================================== */

.toast-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    z-index: 10002;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

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

/* ========================================
   滚动触发动画 - Scroll Animations
   ======================================== */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   主题样式 - Theme Styles
   ======================================== */

/* 明亮主题 (默认) */
body.theme-light {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.theme-light .container {
    background: white;
}

/* 复古主题 */
body.theme-retro {
    background: linear-gradient(135deg, #d4a574 0%, #8b7355 100%);
}

body.theme-retro .container {
    background: linear-gradient(145deg, #faf0e6 0%, #f5e6d3 100%);
}

body.theme-retro h1 { color: #5d4e37; }
body.theme-retro .subtitle { color: #8b7355; }
body.theme-retro input[type="password"] {
    background: #faf0e6;
    border-color: #d4c4a8;
}
body.theme-retro input[type="password"]:focus {
    border-color: #8b7355;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}
body.theme-retro .links a { color: #8b7355; }
body.theme-retro .links a:hover { color: #5d4e37; }
body.theme-retro .qrcode-text { color: #8b7355; }
body.theme-retro .beian { color: #a08060; }
body.theme-retro .beian a { color: #a08060; }
body.theme-retro .beian a:hover { color: #8b7355; }
body.theme-retro .links,
body.theme-retro .qrcode-section {
    border-top-color: #d4c4a8;
}

/* 护眼主题 */
body.theme-eye-care {
    background: linear-gradient(135deg, #4a6741 0%, #8fbc8f 100%);
}

body.theme-eye-care .container {
    background: linear-gradient(145deg, #f5f5dc 0%, #e8f5e9 100%);
}

body.theme-eye-care h1 { color: #2e4a2c; }
body.theme-eye-care .subtitle { color: #4a6741; }
body.theme-eye-care input[type="password"] {
    background: #f0f7f0;
    border-color: #c5d5c5;
}
body.theme-eye-care input[type="password"]:focus {
    border-color: #4a6741;
    box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.1);
}
body.theme-eye-care .links a { color: #4a6741; }
body.theme-eye-care .links a:hover { color: #2e4a2c; }
body.theme-eye-care .qrcode-text { color: #4a6741; }
body.theme-eye-care .beian { color: #6a8a65; }
body.theme-eye-care .beian a { color: #6a8a65; }
body.theme-eye-care .beian a:hover { color: #4a6741; }
body.theme-eye-care .links,
body.theme-eye-care .qrcode-section {
    border-top-color: #c5d5c5;
}

/* 海天主题 */
body.theme-ocean {
    background: linear-gradient(135deg, #006994 0%, #00a8cc 100%);
}

body.theme-ocean .container {
    background: linear-gradient(145deg, #e0f7fa 0%, #b3e5fc 100%);
}

body.theme-ocean h1 { color: #01579b; }
body.theme-ocean .subtitle { color: #0288d1; }
body.theme-ocean input[type="password"] {
    background: #e1f5fe;
    border-color: #b3e0f2;
}
body.theme-ocean input[type="password"]:focus {
    border-color: #0288d1;
    box-shadow: 0 0 0 3px rgba(2, 136, 209, 0.1);
}
body.theme-ocean .links a { color: #0288d1; }
body.theme-ocean .links a:hover { color: #01579b; }
body.theme-ocean .qrcode-text { color: #0288d1; }
body.theme-ocean .beian { color: #0277bd; }
body.theme-ocean .beian a { color: #0277bd; }
body.theme-ocean .beian a:hover { color: #0288d1; }
body.theme-ocean .links,
body.theme-ocean .qrcode-section {
    border-top-color: #b3e0f2;
}

/* 深邃主题 */
body.theme-deep {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

body.theme-deep .container {
    background: linear-gradient(145deg, #2c3e50 0%, #34495e 100%);
}

body.theme-deep h1 { color: #ecf0f1; }
body.theme-deep .subtitle { color: #bdc3c7; }
body.theme-deep input[type="password"] {
    background: #34495e;
    border-color: #4a6278;
    color: #ecf0f1;
}
body.theme-deep input[type="password"]:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}
body.theme-deep input[type="password"]::placeholder {
    color: #7f8c8d;
}
body.theme-deep .links a { color: #3498db; }
body.theme-deep .links a:hover { color: #5dade2; }
body.theme-deep .qrcode-text { color: #bdc3c7; }
body.theme-deep .beian { color: #7f8c8d; }
body.theme-deep .beian a { color: #7f8c8d; }
body.theme-deep .beian a:hover { color: #95a5a6; }
body.theme-deep .links,
body.theme-deep .qrcode-section {
    border-top-color: #4a6278;
}

/* 暗黑主题 */
body.theme-dark {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #2d1b4e 100%);
}

body.theme-dark .container {
    background: linear-gradient(145deg, #1e1e2f 0%, #2a2a3f 100%);
}

body.theme-dark h1 { color: #ffffff; }
body.theme-dark .subtitle { color: #a0a0b0; }
body.theme-dark input[type="password"] {
    background: #2a2a3f;
    border-color: #3a3a4f;
    color: #ffffff;
}
body.theme-dark input[type="password"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
body.theme-dark input[type="password"]::placeholder {
    color: #5a5a6f;
}
body.theme-dark .links a { color: #8b9dc3; }
body.theme-dark .links a:hover { color: #a8b9e0; }
body.theme-dark .qrcode-text { color: #a0a0b0; }
body.theme-dark .beian { color: #5a5a6f; }
body.theme-dark .beian a { color: #5a5a6f; }
body.theme-dark .beian a:hover { color: #8b9dc3; }
body.theme-dark .links,
body.theme-dark .qrcode-section {
    border-top-color: #3a3a4f;
}

/* 各主题的顶部栏样式 */
body.theme-retro .top-bar { background: rgba(93, 78, 55, 0.05); }
body.theme-eye-care .top-bar { background: rgba(46, 74, 44, 0.05); }
body.theme-ocean .top-bar { background: rgba(1, 87, 155, 0.05); }
body.theme-deep .top-bar { background: rgba(236, 240, 241, 0.05); }
body.theme-dark .top-bar { background: rgba(255, 255, 255, 0.05); }

/* 各主题的Toast样式 */
body.theme-retro .toast-message {
    background: linear-gradient(135deg, #8b7355 0%, #d4a574 100%);
}
body.theme-eye-care .toast-message {
    background: linear-gradient(135deg, #4a6741 0%, #8fbc8f 100%);
}
body.theme-ocean .toast-message {
    background: linear-gradient(135deg, #0288d1 0%, #00a8cc 100%);
}
body.theme-deep .toast-message {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}
body.theme-dark .toast-message {
    background: linear-gradient(135deg, #4a5568 0%, #667eea 100%);
}

/* ========================================
   响应式优化 - Responsive
   ======================================== */

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    .top-bar {
        padding: 8px;
    }

    .theme-selector-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .theme-selector-icon {
        font-size: 14px;
    }

    .animation-toggle {
        padding: 6px 12px;
        font-size: 12px;
    }

    #animation-icon {
        font-size: 14px;
    }

    .theme-dropdown {
        left: 0;
        right: auto;
    }

    .logo {
        width: 60%;
    }

    h1 {
        font-size: 22px;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .particle-canvas {
        display: none;
    }
}
