/* ==========================================================================
   基础样式和变量 - 现代极简风格 (主游戏页面使用)
   ========================================================================== */
:root {
    /* 统一高对比度配色体系 - 移除日夜间模式切换，确保全天候清晰可读 */
    --primary-color: #2563eb;    /* 活力蓝 */
    --primary-hover: #1d4ed8;
    --secondary-color: #000000;  /* 纯黑：用于强调文字 */
    --accent-color: #dc2626;     /* 鲜明红 */
    --success-color: #059669;    /* 翡翠绿 */
    --warning-color: #d97706;    /* 暖橙色 */
    
    --background-color: #f3f4f6; /* 浅灰背景，与白色卡片形成对比 */
    --card-background: #ffffff;  /* 纯白卡片背景 */
    --text-color: #000000;       /* 正文纯黑，最大化对比度 */
    --text-light: #374151;       /* 次要文字加深为深灰，避免看不清 */
    --border-color: #9ca3af;     /* 边框加深，增强界限感 */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 字体栈优化 */
    --font-serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    
    /* 标点颜色 - 加深 */
    --punctuation-color: #4b5563;
}

/* 视觉隐藏类 */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 暗色模式适配已移除，保持统一高对比度模式 */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body:not(.admin-page-v3) {
    font-family: var(--font-sans);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s ease;
    /* 移除复杂的纹理，使用纯净背景 */
    background-image: none;
    padding-bottom: 60px;
}

/* 允许输入框选择文本 */
input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* 导航栏 */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 两端对齐更常见 */
    gap: 20px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.site-nav-left {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--secondary-color);
    font-family: var(--font-serif);
}

.site-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav a {
    text-decoration: none;
    color: var(--text-color); /* 加深链接文字颜色 */
    font-weight: 600; /* 加粗 */
    font-size: 15px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: var(--transition);
}

.site-nav a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.site-nav a.active {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(37, 99, 235, 0.1);
}

.nav-icon-btn {
    color: #000000 !important; /* 强制纯黑 */
}

.icon-calendar {
    stroke-width: 2.5px; /* 加粗线条 */
}

/* 登录模块 */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

.auth-name {
    margin-left: 8px;
    font-weight: 700;
}

.user-badge {
    font-size: 14px;
    color: #000000; /* 使用纯黑 */
    font-weight: 700; /* 加粗 */
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-auth {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-auth:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* 游戏容器装饰 */
.game-container {
    margin-top: 80px;
    margin-bottom: 25px;
    width: 90%;
    max-width: 800px;
    background: transparent;
    padding: 0;
    text-align: center;
    position: relative;
    border: none;
    box-shadow: none;
}

@media (min-width: 992px) {
    .game-container {
        max-width: 960px;
    }
}

/* 移除之前的四角装饰 */
.game-container::before {
    display: none;
}

/* 胜利圆形印章效果 */
.win-content::after {
    /* 保留但简化 */
    content: '大吉';
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: var(--font-serif);
    font-size: 32px;
    color: rgba(220, 38, 38, 0.1);
    border: 2px solid rgba(220, 38, 38, 0.1);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-15deg);
    pointer-events: none;
    user-select: none;
    font-weight: 900;
}

.game-header h1,
.game-header .game-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--secondary-color);
    margin: 0 0 8px 0;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: none;
}

.game-subtitle {
    font-family: var(--font-serif);
    color: var(--text-light);
    font-style: normal;
    font-size: 1rem;
    margin-bottom: 24px;
    opacity: 0.8;
}

/* 诗词展示区域 */
.text-display {
    background: var(--card-background);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    min-height: 200px;
    font-family: var(--font-serif);
    font-size: 20px;
    line-height: 1.8;
    text-align: left;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    position: relative;
    /* 移除渐变，使用纯色 */
    background: var(--card-background);
}

.text-line {
    display: block;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.text-line:first-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 16px;
    text-align: center;
    letter-spacing: 0.1em;
}

/* 字符块 */
.hidden-char, .visible-char, .punctuation-char, .guessed-by-user, .revealed-by-system, .revealed-by-hint, .revealed-auto {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin: 3px;
    border-radius: 6px;
    font-size: 22px;
    font-weight: 600;
    vertical-align: middle;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    border: 1px solid transparent;
}

.hidden-char {
    background-color: #345678; /* 用户指定颜色 */
    color: transparent;
    box-shadow: none;
    border-color: #9ca3af; /* 加深边框 */
}

.visible-char {
    background-color: transparent;
    color: var(--text-color);
    border-color: transparent;
    font-weight: 600; /* 加粗 */
}

.guessed-by-user {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.revealed-by-hint {
    background-color: var(--warning-color);
    color: white;
    box-shadow: var(--shadow-sm);
    border-color: var(--warning-color);
}

.revealed-auto {
    background-color: #9ca3af;
    color: white;
    border-color: #9ca3af;
}

.punctuation-char {
    background: transparent;
    color: var(--text-light);
    width: auto;
    min-width: 20px;
    font-weight: 400;
}

@keyframes revealScale {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 仅对“本次新揭示”的字符执行动画，避免历史已揭示字符重复闪烁 */
.newly-guessed {
    animation: revealScale 0.4s ease-out;
}
/* 底部统计栏 */
.bottom-stats {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding: 0 10px;
}

.completion-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
    background: transparent;
    padding: 0;
    border: none;
}

.completion-icon {
    font-size: 16px;
    color: var(--primary-color);
}

.completion-label {
    font-weight: 400;
}

.completion-value {
    font-weight: 600;
    color: var(--text-color);
    font-family: var(--font-sans);
}

.completion-note {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 4px;
}

/* 侧边栏与布局 */
.game-main-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (min-width: 992px) {
    .game-main-layout {
        flex-direction: row;
        text-align: left;
        gap: 48px;
        align-items: flex-start; /* 关键修复：防止子元素高度被撑满 */
    }
    .game-primary-area {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    .text-display {
        flex: 1;
        margin-bottom: 0;
    }
    .bottom-stats {
        margin-top: 20px;
        padding: 0;
    }
    .game-sidebar {
        width: 320px;
        /* 防止侧边栏被主区域撑开高度 */
        flex-shrink: 0; 
    }
}

/* 统计与输入 */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: var(--card-background);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.stats-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stats-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    font-family: var(--font-sans); /* 改用无衬线字体更现代 */
    line-height: 1.2;
}

.stats-actions {
    grid-column: span 2;
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

.action-button {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.action-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.input-group {
    display: flex;
    gap: 12px;
}

#letterInput {
    flex: 1;
    padding: 12px;
    font-size: 18px;
    border: 2px solid #9ca3af; /* 加深边框，提高输入框可见度 */
    border-radius: var(--border-radius);
    text-align: center;
    background: #ffffff;
    transition: var(--transition);
    color: var(--text-color);
    font-weight: 500;
}

#letterInput:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.guess-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 50px; /* 与输入框对齐 */
}

.guess-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background-color: var(--primary-hover);
    filter: none;
}

.guess-button:active {
    transform: translateY(0);
}

/* 已猜字母列表 */
.guessed-letters {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 24px;
}

.guessed-letters h3 {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 16px 0;
    font-weight: 600;
    font-family: var(--font-sans);
}

.letter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start; /* 左对齐更整齐 */
}

.letter-item {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: #e5e7eb; /* 加深背景色 */
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-color);
    border: 1px solid #d1d5db; /* 增加边框 */
    font-weight: 600; /* 加粗字体 */
}

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

.win-message.show {
    display: flex;
}

.win-content {
    background: var(--card-background);
    padding: 40px 32px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    border: 1px solid var(--border-color);
}

.win-emoji {
    font-size: 48px;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.win-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 24px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.win-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: #f9fafb;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.win-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
}

.win-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.win-label {
    color: var(--text-color); /* 加深文字颜色，提高对比度 */
    font-weight: 500;
}

.win-value {
    color: var(--text-color); /* 加深文字颜色 */
    font-weight: 700;
    font-family: var(--font-sans);
}

.win-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.win-close-btn:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

/* 历史题目弹窗与日历 - 统一浅色主题 */
.history-modal-content {
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* 独立背景：纯色微渐变，区别于胜利弹窗 */
    background: linear-gradient(135deg, #f5f1e8 0%, #f0e9dd 100%);
    border: 1px solid #d8c9b5;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    /* 固定尺寸，防止加载时抖动 */
    min-height: 480px;
    min-width: 480px;
    overflow: hidden;
    /* 确保内部内容撑满 */
    position: relative;
}



/* 日历容器确保尺寸稳定 */
.history-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}


.calendar-nav {
    padding: 20px 20px 15px;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid #e8e0d2;
}

.calendar-divider {
    height: 1px;
    background: #e8e0d2;
    margin: 0 20px;
}



.calendar-selectors {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.calendar-select {
    padding: 8px 12px;
    border: 1px solid #d4c5b3;
    border-radius: 3px;
    background: #ffffff;
    color: #3a2e22;
    font-family: var(--font-sans);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-select:hover {
    border-color: #b8a995;
    background: #f8f4ed;
}

.calendar-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(47, 82, 143, 0.1);
}



.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 25px;
    padding: 0 20px;
}

.calendar-date {
    aspect-ratio: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    color: #5a4a3a; /* 深褐色文字，与背景更协调 */
    background: #f8f4ed; /* 与弹窗背景同色系但略深 */
    border: 1px solid #e0d6c8;
    transition: var(--transition);
    font-weight: 500;
}



.calendar-date:hover:not(.future-date) {
    background: #e8e0d2;
    color: #3a2e22;
    border-color: #c9b9a5;
    transform: translateY(-1px);
}



.calendar-date.current-month {
    background: #f0e9dd;
    font-weight: 600;
    color: #3a2e22;
    border-color: #d4c5b3;
}



.calendar-date.today {
    background: var(--success-color) !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(45, 106, 79, 0.3);
    border-color: var(--success-color);
}



.calendar-date.future-date {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f1e8;
    color: #a89a8a;
    border-color: #e0d6c8;
}



.calendar-date.other-month {
    background: #f5f1e8;
    color: #a89a8a;
    border-color: #e8e0d2;
}



/* 日期数字样式优化 */
.date-num {
    font-family: var(--font-sans);
    font-weight: inherit;
    display: block;
    line-height: 1;
}

/* 有题目标记 */
.question-marker {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.8;
}

.calendar-date.has-question {
    position: relative;
    border-color: #d4c5b3;
    background: #f8f4ed;
}



.calendar-date.has-question:hover:not(.future-date) {
    background: #e8e0d2;
    border-color: #c9b9a5;
}



/* 选中状态（高亮当前题目） - 增加优先级以覆盖深色模式 */
.calendar-date.selected {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 10px rgba(47, 82, 143, 0.4);
    transform: scale(1.05);
    z-index: 2;
}

.calendar-date.selected .date-num {
    font-weight: bold;
}

.calendar-date.selected .question-marker {
    background-color: #fff; /* 选中状态下小圆点变为白色 */
}

/* 移动端适配 */
@media (max-width: 600px) {
    .game-container {
        margin-top: 60px;
        width: 95%;
        padding: 20px;
    }

    .game-header h1 {
        font-size: 1.8rem;
    }

    .text-display {
        padding: 15px;
        font-size: 18px;
    }

    .hidden-char, .visible-char, .punctuation-char, .guessed-by-user, .revealed-by-system, .revealed-by-hint, .revealed-auto {
        width: 32px;
        height: 32px;
        font-size: 18px;
        margin: 2px;
    }
}

/* 页面容器（用于帮助页和排行榜） */
.page-container {
    width: 90%;
    max-width: 800px;
    margin: 80px auto 40px;
    background: var(--card-background);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

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

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary-color);
    font-family: var(--font-serif);
}

.seo-content {
    width: 90%;
    max-width: 900px;
    margin: 24px auto 0;
    background: var(--card-background);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.seo-content-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.seo-toggle {
    flex: 0 0 auto;
    background: #fafafa;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.seo-toggle:hover {
    background: #f3f4f6;
}

.seo-content-body {
    margin-top: 8px;
    overflow: hidden;
    max-height: 600px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.seo-content--collapsible.is-collapsed .seo-content-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.seo-content h2 {
    font-size: 18px;
    color: var(--text-color);
    margin: 0 0 12px 0;
    font-weight: 700;
    font-family: var(--font-serif);
}

.seo-content h3 {
    font-size: 16px;
    color: var(--text-color);
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.seo-content p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

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

.help-section h2,
.help-section h3,
.help-section h4 {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.help-section p, .help-section ul {
    color: var(--text-light);
    font-size: 16px;
    line-height: 1.6;
}

/* 排行榜表格 */
.lb-table {
    width: 100%;
    border-collapse: collapse;
}

.lb-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-color);
    font-weight: 600;
}

.lb-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
}

.lb-table tr:hover td {
    background-color: rgba(0,0,0,0.02);
}

.mono {
    font-family: monospace;
    font-weight: 500;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .page-container {
        width: 95%;
        padding: 20px;
        margin-top: 70px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .lb-table {
        font-size: 14px;
    }
    
    .lb-table th, .lb-table td {
        padding: 8px;
    }
}

.passphrase-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 40px;
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}

.passphrase-container h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-family: var(--font-serif);
}

.passphrase-input-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.passphrase-input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
}

.passphrase-input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(47, 82, 143, 0.1);
}

/* 加载指示器 */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(64, 115, 158, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    background: var(--card-background);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   管理员后台专属样式 (V3 重构) - 完全隔离
   ========================================================================== */

.admin-page-v3 {
    background-color: #f0f2f5 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh !important;
    padding-bottom: 0 !important;
    align-items: stretch !important;
    color: #333 !important;
}

.admin-page-v3 * {
    box-sizing: border-box;
}

/* 侧边栏 */
.admin-sidebar {
    width: 260px;
    background: #ffffff;
    color: #333;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
    border-right: 1px solid #f0f0f0;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
}

.sidebar-title {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: #1a1a1a;
    font-family: var(--font-serif);
}

.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: #595959;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-item .icon {
    font-size: 18px;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.menu-item:hover {
    color: #1a1a1a;
    background: #f5f5f5;
}

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

.menu-item.active {
    background: #e6f4ff;
    color: #1890ff;
}

.menu-item.active .icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.user-badge {
    font-size: 14px;
    color: #8c8c8c;
    background: #fafafa;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #e8e8e8;
}

.logout-btn {
    background: transparent;
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.logout-btn:hover {
    background: #fff1f0;
}

/* 主内容区 */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f7fa;
    min-width: 0;
}

.main-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    position: sticky;
    top: 0;
    z-index: 90;
}

.main-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.last-updated {
    font-size: 13px;
    color: #8c8c8c;
}

.content-container {
    padding: 24px;
    flex: 1;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.stat-label {
    color: #8c8c8c;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: -0.5px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.icon-blue { background: #e6f4ff; color: #1890ff; }
.icon-green { background: #f6ffed; color: #52c41a; }
.icon-amber { background: #fffbe6; color: #faad14; }
.icon-purple { background: #f9f0ff; color: #722ed1; }

/* 图表与今日诗词 */
.dashboard-middle-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-chart-card, .today-poem-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.04);
}

.dashboard-chart-card h3, .today-poem-card .card-header h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.today-poem-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.today-poem-card .card-header h3 {
    margin: 0;
}

.poem-preview-box {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

.today-poem-preview h4 {
    color: #1a1a1a;
    font-size: 18px !important;
}

.today-poem-preview div {
    color: #595959;
}

.card-actions {
    display: flex;
    gap: 12px;
}

.card-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 表格样式 */
.admin-panel {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1a1a1a;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

.filter-group select, .search-input {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.filter-group select:focus, .search-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.search-input {
    min-width: 250px;
    margin-right: 12px;
}

.bulk-actions {
    background: #e6f4ff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #91caff;
    display: flex;
    align-items: center;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th {
    background: #fafafa;
    padding: 16px;
    text-align: left;
    color: #595959;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.admin-table th:first-child {
    border-top-left-radius: 8px;
}

.admin-table th:last-child {
    border-top-right-radius: 8px;
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s;
}

.admin-table tbody tr:hover td {
    background-color: #fafafa;
}

.question-row.selected td {
    background-color: #e6f4ff !important;
}

/* 状态标签 */
.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-published { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.status-scheduled { background: #e6f4ff; color: #1890ff; border: 1px solid #91caff; }
.status-draft { background: #f5f5f5; color: #8c8c8c; border: 1px solid #d9d9d9; }

/* 日历 */
.admin-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.weekday {
    background: #fafafa;
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #595959;
}

.admin-calendar-day {
    min-height: 120px;
    padding: 12px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    background: white;
    transition: background-color 0.2s;
    cursor: pointer;
    position: relative;
}

.admin-calendar-day:nth-child(7n) {
    border-right: none;
}

.admin-calendar-day:hover {
    background: #fcfcfc;
}

.admin-calendar-day.other-month {
    background: #fafafa;
    color: #bfbfbf;
}

.admin-calendar-day.today {
    background: #e6f4ff;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.day-num {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.other-month .day-num {
    color: #bfbfbf;
}

.today-badge {
    font-size: 10px;
    background: #1890ff;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
}

.day-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-tag {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    color: #595959;
    width: 100%;
    box-sizing: border-box;
}

.event-tag.published {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}

.event-tag.scheduled {
    background: #e6f4ff;
    border-color: #91caff;
    color: #0958d9;
}

.event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    font-weight: 500;
}

.event-status {
    font-size: 10px;
    opacity: 0.8;
}

.no-event {
    font-size: 12px;
    color: #bfbfbf;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

.day-actions {
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    justify-content: center;
}

.admin-calendar-day:hover .day-actions {
    opacity: 1;
}

.day-action-btn {
    background: white;
    border: 1px solid #d9d9d9;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    color: #595959;
    cursor: pointer;
    transition: all 0.2s;
}

.day-action-btn:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.day-action-btn.add-btn {
    background: #fafafa;
    border-style: dashed;
}

.day-action-btn.add-btn:hover {
    background: #e6f4ff;
    border-color: #1890ff;
    border-style: solid;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #f0f0f0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 4px;
}

.btn-primary {
    background: #1890ff;
    color: white;
    border-color: #1890ff;
    box-shadow: 0 2px 0 rgba(24,144,255,0.1);
}

.btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.btn-outline {
    background: white;
    border-color: #d9d9d9;
    color: #595959;
}

.btn-outline:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.btn-secondary {
    background: #f0f0f0;
    color: #1a1a1a;
    border-color: transparent;
}

.btn-secondary:hover {
    background: #e6e6e6;
}

.btn-danger {
    background: #fff1f0;
    color: #ff4d4f;
    border-color: #ffa39e;
}

.btn-danger:hover {
    background: #ff4d4f;
    color: white;
}

.btn-amber {
    background: #fffbe6;
    color: #faad14;
    border-color: #ffe58f;
}

.btn-amber:hover {
    background: #faad14;
    color: white;
}

/* 模态窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.admin-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 0.69, 0.1, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1a1a1a;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #8c8c8c;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #ff4d4f;
}

.admin-form {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
    padding: 24px;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #595959;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.form-group textarea {
    min-height: 300px;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-serif);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}
