/* ==================== 变量定义 ==================== */
:root {
    /* 主色调 - 古铜金配深红 */
    --primary: #8b4513;
    --primary-dark: #5c2d0e;
    --primary-light: #a0522d;
    
    /* 辅助色 - 墨绿与金色 */
    --secondary: #2d5a3d;
    --secondary-light: #3d7a52;
    --gold: #c9a962;
    --gold-light: #d4b978;
    --gold-dark: #a68a4d;
    
    /* 中性色 */
    --ink: #2c2416;
    --paper: #f5f0e6;
    --paper-dark: #e8dcc8;
    
    /* 功能色 */
    --success: #4a7c4e;
    --error: #a94442;
    --warning: #d4a84b;
    --purple: #6b5b95;
    
    /* 渐变 */
    --gradient-antique: linear-gradient(135deg, #8b4513 0%, #5c2d0e 100%);
    --gradient-gold: linear-gradient(135deg, #c9a962 0%, #a68a4d 100%);
    --gradient-paper: linear-gradient(180deg, #f5f0e6 0%, #e8dcc8 100%);
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(44, 36, 22, 0.2);
    --shadow-md: 0 4px 12px rgba(44, 36, 22, 0.3);
    --shadow-lg: 0 8px 24px rgba(44, 36, 22, 0.4);
    --shadow-inset: inset 0 2px 4px rgba(44, 36, 22, 0.2);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* 过渡 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

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

body {
    font-family: 'Noto Serif SC', 'SimSun', serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ==================== 工具类 ==================== */
.hidden {
    display: none !important;
}

/* ==================== 启动画面 ==================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: var(--ink);
}

.splash-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at center, rgba(139, 69, 19, 0.3) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a962' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.splash-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 1s ease-out;
}

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

.splash-emblem {
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
}

.emblem-svg {
    width: 100%;
    height: 100%;
}

.splash-title {
    font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
    font-size: 4rem;
    color: var(--gold);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5rem;
}

.splash-subtitle {
    font-size: 1.2rem;
    color: var(--paper-dark);
    margin-bottom: 2rem;
    opacity: 0.8;
}

.splash-quote {
    background: rgba(201, 169, 98, 0.1);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.splash-quote p {
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.splash-quote span {
    font-size: 0.9rem;
    color: var(--paper-dark);
    opacity: 0.7;
}

.splash-footer {
    margin-top: 2rem;
    color: var(--paper-dark);
    opacity: 0.5;
    font-size: 0.85rem;
}

/* ==================== 按钮样式 ==================== */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--ink);
    box-shadow: var(--shadow-md), 0 0 20px rgba(201, 169, 98, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(201, 169, 98, 0.5);
}

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

.btn-secondary {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
}

.btn-secondary:hover {
    background: rgba(201, 169, 98, 0.1);
    transform: translateY(-2px);
}

/* ==================== 主菜单 ==================== */
.main-menu {
    min-height: 100vh;
    background: 
        linear-gradient(180deg, rgba(139, 69, 19, 0.1) 0%, transparent 30%),
        var(--gradient-paper);
    padding: 2rem;
}

.menu-back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: rgba(201, 169, 98, 0.2);
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.menu-back-btn:hover {
    background: rgba(201, 169, 98, 0.3);
    transform: translateY(-2px);
}

.menu-back-btn:active {
    transform: translateY(0);
}

.menu-header {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.menu-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 0L60 40L100 50L60 60L50 100L40 60L0 50L40 40Z' fill='%23c9a962' fill-opacity='0.05'/%3E%3C/svg%3E");
    animation: patternFloat 30s linear infinite;
}

@keyframes patternFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-100px); }
}

.game-title {
    font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    position: relative;
}

.game-subtitle {
    color: var(--paper);
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
}

/* ==================== 关卡网格 ==================== */
.level-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
    justify-content: center;
}

.level-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    width: 320px;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.level-card-image {
    width: 100%;
    height: auto;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--paper-dark) 0%, var(--paper) 100%);
}

.level-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal);
}

.level-card:hover .level-card-image img {
    transform: scale(1.05);
}

.level-card-body {
    padding: 1.25rem;
}

.level-number {
    font-size: 0.8rem;
    color: var(--gold-dark);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.level-card-title {
    font-size: 1.3rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.level-card-desc {
    font-size: 0.9rem;
    color: var(--primary);
    opacity: 0.8;
    line-height: 1.5;
}

.level-card-footer {
    padding: 1rem 1.25rem;
    background: var(--paper-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.level-stars {
    display: flex;
    gap: 0.25rem;
}

.level-stars span {
    font-size: 1.2rem;
    color: #ddd;
}

.level-stars span.earned {
    color: var(--gold);
}

.level-status {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: var(--secondary);
    color: white;
}

.level-status.completed {
    background: var(--success);
}

.level-status.locked {
    background: #999;
}

/* ==================== 工具按钮链接 ==================== */
.menu-tools {
    max-width: 1200px;
    margin: 0 auto 1rem;
    display: flex;
    justify-content: center;
}

.tool-btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-antique);
    color: var(--gold);
    border: 2px solid var(--gold);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.tool-btn-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(201, 169, 98, 0.4);
    background: var(--gold);
    color: var(--ink);
}

.tool-icon {
    font-size: 1.3rem;
}

/* ==================== 统计面板 ==================== */
.menu-footer {
    max-width: 1200px;
    margin: 0 auto;
}

.stats-panel {
    background: var(--ink);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--paper-dark);
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
}

/* ==================== 游戏容器 ==================== */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gradient-paper);
}

.game-header {
    background: var(--gradient-antique);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 169, 98, 0.2);
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-back-btn:hover {
    background: rgba(201, 169, 98, 0.3);
    transform: translateY(-2px);
}

.header-back-btn:active {
    transform: translateY(0);
}

.level-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.level-badge {
    background: var(--gold);
    color: var(--ink);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.level-name {
    color: var(--paper);
    font-size: 1.2rem;
    font-weight: 600;
}

.game-stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--paper);
    font-size: 1.1rem;
}

.stat-icon {
    font-size: 1.3rem;
}

/* ==================== 游戏主内容区 ==================== */
.game-main {
    flex: 1;
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* ==================== 题目包装器 ==================== */
.question-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* ==================== 角色容器 ==================== */
.character-container {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 160px;
}

.character-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s;
}

.character-img:hover {
    transform: scale(1.1);
}

.character-bubble {
    background: white;
    border-radius: 16px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    position: relative;
    box-shadow: var(--shadow-md);
    max-width: 150px;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--ink);
}

.character-bubble::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.character-bubble.hidden {
    display: none;
}

/* 角色动画 */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-15px) scale(1.1); }
    50% { transform: translateY(0) scale(0.95); }
    75% { transform: translateY(-8px) scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-5deg); }
    40% { transform: translateX(8px) rotate(5deg); }
    60% { transform: translateX(-6px) rotate(-3deg); }
    80% { transform: translateX(6px) rotate(3deg); }
}

@keyframes jump {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.character-img.bounce {
    animation: bounce 0.6s ease;
}

.character-img.shake {
    animation: shake 0.5s ease;
}

.character-img.jump {
    animation: jump 0.8s ease;
}

.question-content {
    flex: 1;
    min-width: 0;
}

/* ==================== 章节介绍区 ==================== */
.chapter-intro {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--gold);
}

.level-nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--paper-dark);
}

.level-nav-buttons .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.chapter-intro h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chapter-intro h2 .icon {
    font-size: 2rem;
}

.chapter-intro p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--ink);
    margin-bottom: 1rem;
}

.chapter-intro blockquote {
    background: rgba(201, 169, 98, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--primary);
}

.media-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.media-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.media-btn:hover {
    background: var(--secondary-light);
    transform: translateY(-2px);
}

/* ==================== 题目卡片 ==================== */
.question-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.question-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--gold);
    color: var(--ink);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.2rem;
    color: var(--ink);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.question-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ==================== 选项按钮 ==================== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-btn {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--paper-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.option-btn:hover:not(.disabled) {
    border-color: var(--gold);
    background: rgba(201, 169, 98, 0.1);
}

.option-btn.correct {
    background: rgba(74, 124, 78, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.option-btn.incorrect {
    background: rgba(169, 68, 66, 0.2);
    border-color: var(--error);
    color: var(--error);
}

.option-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* 选择题选项字母标识 */
.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ==================== 判断题样式 ==================== */
.judge-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.judge-btn {
    padding: 1.5rem;
    font-size: 1.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.judge-btn .icon {
    font-size: 2.5rem;
}

/* ==================== 填空题样式 ==================== */
.fill-blank-input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--paper-dark);
    border-radius: var(--radius-md);
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.fill-blank-input:focus {
    outline: none;
    border-color: var(--gold);
}

/* ==================== 排序题样式 ==================== */
.sort-list {
    list-style: none;
}

.sort-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all var(--transition-fast);
}

.sort-item:active {
    cursor: grabbing;
}

.sort-item.dragging {
    opacity: 0.5;
    background: rgba(201, 169, 98, 0.2);
}

.sort-handle {
    color: var(--gold);
    font-size: 1.5rem;
}

.sort-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
}

.sort-text {
    flex: 1;
}

/* ==================== 连线题样式 ==================== */
.match-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: start;
}

.match-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-item {
    padding: 1rem;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.match-item:hover {
    border-color: var(--gold);
}

.match-item.selected {
    background: rgba(201, 169, 98, 0.2);
    border-color: var(--gold);
}

.match-item.matched {
    background: rgba(74, 124, 78, 0.2);
    border-color: var(--success);
}

.match-line {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--gold);
}

.match-hint {
    text-align: center;
    color: var(--primary);
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* ==================== 进度条 ==================== */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--ink);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
}

.progress-fill {
    flex: 1;
    height: 8px;
    background: var(--paper-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-right: 1rem;
}

.progress-fill::after {
    content: '';
    display: block;
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 4px;
    width: 0%;
    transition: width var(--transition-normal);
}

.progress-text {
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 50px;
}

/* ==================== 弹窗样式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 36, 22, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--paper);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 1.5rem;
    background: var(--gradient-antique);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
    color: var(--gold);
    font-size: 1.5rem;
    text-align: center;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    background: var(--paper-dark);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ink);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ==================== 结果弹窗 ==================== */
.result-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-stat {
    text-align: center;
}

.result-label {
    display: block;
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
}

.result-star {
    display: flex;
    gap: 0.5rem;
}

.result-star span {
    font-size: 2.5rem;
    color: #ddd;
}

.result-star span.earned {
    color: var(--gold);
    animation: starPop 0.5s ease;
}

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

.result-message {
    text-align: center;
    color: var(--primary);
    font-size: 1rem;
    line-height: 1.6;
}

/* ==================== 视频弹窗 ==================== */
.video-content {
    max-width: 800px;
    position: relative;
}

.video-content h3 {
    color: var(--gold);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-source {
    text-align: center;
    color: var(--primary);
    font-size: 0.85rem;
    margin-top: 1rem;
    opacity: 0.7;
}

/* ==================== 图片画廊 ==================== */
.gallery-content {
    max-width: 700px;
}

.gallery-content h3 {
    color: var(--gold);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.8rem;
    text-align: center;
}

.gallery-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.gallery-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.gallery-btn:hover {
    background: var(--secondary-light);
}

/* ==================== 反馈动画 ==================== */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 3rem;
    border-radius: var(--radius-lg);
    font-size: 1.5rem;
    font-weight: 700;
    z-index: 500;
    animation: feedbackPop 0.8s ease forwards;
}

.feedback.correct {
    background: var(--success);
    color: white;
}

.feedback.incorrect {
    background: var(--error);
    color: white;
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-30px);
    }
}

/* ==================== 时间紧迫提示 ==================== */
.time-warning {
    animation: timeWarn 0.5s ease infinite;
}

@keyframes timeWarn {
    0%, 100% { color: var(--warning); }
    50% { color: var(--error); }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .question-wrapper {
        flex-direction: column;
    }
    
    .character-container {
        position: relative;
        top: 0;
        flex-direction: row;
        width: 100%;
        justify-content: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .character-img {
        width: 100px;
        height: 100px;
    }
    
    .character-bubble {
        margin-top: 0;
        flex: 1;
        max-width: none;
    }
    
    .character-bubble::before {
        display: none;
    }
    
    .level-card-image {
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 768px) {
    .splash-screen {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .splash-content {
        padding: 1.5rem 1rem 3rem;
    }

    .splash-title {
        font-size: 2.5rem;
        letter-spacing: 0.25rem;
    }
    
    .splash-emblem {
        width: 120px;
        height: 120px;
    }

    .game-title {
        font-size: 2rem;
    }
    
    .level-grid {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-back-btn {
        order: -1;
        margin-bottom: 0.5rem;
    }
    
    .game-stats {
        width: 100%;
        justify-content: center;
    }
    
    .game-main {
        padding: 1rem;
        padding-bottom: 60px;
    }
    
    .chapter-intro,
    .question-card {
        padding: 1.25rem;
    }
    
    .judge-options {
        grid-template-columns: 1fr;
    }
    
    .match-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .match-line {
        transform: rotate(90deg);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        flex-direction: column;
        gap: 1rem;
    }
    
    .splash-quote {
        padding: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .splash-screen,
    .game-header,
    .progress-bar,
    .modal,
    .media-links,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .game-main {
        max-width: 100%;
    }
}

/* ==================== 模式选择按钮 ==================== */
.mode-selection {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 2.5rem;
    background: rgba(201, 169, 98, 0.1);
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    color: var(--gold);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 180px;
}

.mode-btn:hover {
    background: var(--gold);
    color: var(--ink);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(201, 169, 98, 0.4);
}

.mode-icon {
    font-size: 2.5rem;
}

.mode-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.mode-desc {  
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ==================== 知识图谱视图 ==================== */
.graph-view {
    min-height: 100vh;
    position: relative;
}

.graph-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--gradient-antique);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
    box-shadow: va  r(--shadow-md);
}

.graph-header h1 {
    font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
    font-size: 1.5rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 169, 98, 0.2);
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.back-btn:hover {
    background: rgba(201, 169, 98, 0.3);
    transform: translateY(-2px);
}

.header-tools {
    display: flex;
    gap: 0.5rem;
}

.header-spacer {
    width: 80px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(201, 169, 98, 0.2);
    color: var(--gold);
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: rgba(201, 169, 98, 0.4);
    transform: scale(1.05);
}

.tool-btn.active {
    background: var(--gold);
    color: var(--ink);
}

/* ==================== 图谱画布 ==================== */
.graph-canvas {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: 
        radial-gradient(ellipse at 30% 30%, rgba(201, 169, 98, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(139, 69, 19, 0.05) 0%, transparent 50%),
        var(--paper);
    cursor: grab;
}

.graph-canvas:active {
    cursor: grabbing;
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

.nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto;
}

/* ==================== 图谱节点 ==================== */
.graph-node {
    position: absolute;
    width: 180px;
    padding: 0;
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    /* 节点使用left/top定位，CSS统一处理居中 */
    transform: translate(-50%, -50%);
    z-index: 10;
    border: 3px solid transparent;
    overflow: hidden;
}

.graph-node:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.graph-node.active {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(201, 169, 98, 0.3), var(--shadow-lg);
    z-index: 100;
}

.graph-node.dragging {
    cursor: grabbing;
    opacity: 0.9;
    z-index: 1000;
}

.graph-node.hide-labels .node-year,
.graph-node.hide-labels .node-figures {
    display: none;
}

/* 节点头部 */
.node-era {
    display: block;
    padding: 0.3rem 0.8rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--paper-dark);
    color: var(--ink);
    text-align: center;
}

.node-content {
    padding: 0.8rem;
}

.node-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin-top: 0.3rem;
    line-height: 1.3;
    text-align: center;
}

.node-year {
    font-size: 0.7rem;
    color: var(--primary);
    text-align: center;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.node-figures {
    font-size: 0.7rem;
    color: var(--ink);
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.node-result {
    text-align: center;
    margin-top: 0.6rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0,0,0,0.05);
}

/* 节点连接指示器 */
.node-connections {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
}

.connection-dot {
    width: 12px;
    height: 12px;
    background: var(--gold);
    border-radius: 50%;
    border: 2px solid var(--paper);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.graph-node:hover .connection-dot,
.graph-node.active .connection-dot {
    opacity: 1;
}

/* ==================== 连接线样式 ==================== */
.connection-line {
    stroke-width: 3;
    fill: none;
    opacity: 0.7;
    transition: opacity 0.2s, stroke-width 0.2s;
}

.connection-line:hover {
    opacity: 1;
    stroke-width: 5;
}

.connection-timeline {
    stroke: var(--gold);
}

.connection-similar {
    stroke: var(--success);
}

.connection-inheritance {
    stroke: var(--purple);
}

.connection-contrast {
    stroke: var(--error);
}

/* 连接线箭头 */
.connection-arrow {
    fill: currentColor;
}

/* 连接线标签 */
.connection-label {
    font-size: 11px;
    fill: var(--ink);
    opacity: 0.8;
    font-family: 'Noto Serif SC', serif;
    font-weight: 500;
}

.connection-label-bg {
    fill: var(--paper);
    opacity: 0.9;
}

/* SVG层可点击 */
.connections-layer {
    pointer-events: auto;
}

/* 连接线箭头适配 */
@media (max-width: 768px) {
    .connection-line {
        stroke-width: 3;
        opacity: 0.8;
    }
    
    .connection-line:hover {
        stroke-width: 4;
        opacity: 1;
    }
    
    .connection-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .connection-line {
        stroke-width: 3;
        opacity: 0.9;
    }
    
    .connection-label {
        font-size: 9px;
    }
}

/* ==================== 详情面板 ==================== */
.detail-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 420px;
    height: calc(100vh - 60px);
    background: var(--paper);
    box-shadow: -4px 0 20px rgba(44, 36, 22, 0.3);
    z-index: 500;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform var(--transition-normal);
}

.detail-panel.hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.detail-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--paper-dark);
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--ink);
    transition: all var(--transition-fast);
    z-index: 10;
}

.detail-close:hover {
    background: var(--primary);
    color: var(--paper);
}

/* 详情头部 */
.detail-header {
    padding: 2rem;
    padding-right: 4rem;
    background: var(--gradient-antique);
    border-bottom: 3px solid var(--gold);
}

.detail-era {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--gold);
    color: var(--ink);
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.detail-header h2 {
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.detail-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.detail-figures span {
    padding: 0.3rem 0.8rem;
    background: rgba(201, 169, 98, 0.3);
    color: var(--paper);
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--gold);
}

/* 详情内容 */
.detail-body {
    padding: 1.5rem 2rem;
}

.detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--paper-dark);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-section p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--ink);
    text-align: justify;
}

.detail-section ul {
    list-style: none;
    padding: 0;
}

.detail-section li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.detail-section li::before {
    content: '◆';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 0.6rem;
    top: 0.35rem;
}

/* 相关改革连接 */
.detail-connections {
    padding: 1.5rem 2rem;
    background: var(--paper-dark);
}

.detail-connections h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#detail-connections-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.connection-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--paper);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.connection-item:hover {
    border-color: var(--gold);
    transform: translateX(-5px);
}

.connection-arrow {
    width: 30px;
    height: 30px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.connection-info {
    flex: 1;
}

.connection-name {
    font-weight: 600;
    color: var(--ink);
    font-size: 0.95rem;
}

.connection-note {
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0.8;
    margin-top: 0.2rem;
}

/* ==================== 图例 ==================== */
.legend {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-md);
    z-index: 100;
    border: 2px solid var(--paper-dark);
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--ink);
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-line {
    width: 40px;
    height: 3px;
    border-radius: 2px;
}

.legend-line.timeline {
    background: var(--gold);
}

.legend-line.inheritance {
    background: var(--purple, #6b5b95);
    background-image: repeating-linear-gradient(
        90deg,
        var(--purple, #6b5b95),
        var(--purple, #6b5b95) 8px,
        transparent 8px,
        transparent 12px
    );
}

.legend-line.similar {
    background: var(--success);
    background-image: repeating-linear-gradient(
        90deg,
        var(--success),
        var(--success) 8px,
        transparent 8px,
        transparent 12px
    );
}

.legend-line.contrast {
    background: var(--error);
    background-image: repeating-linear-gradient(
        90deg,
        var(--error),
        var(--error) 6px,
        transparent 6px,
        transparent 10px
    );
}

.legend-node {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid;
}

.legend-node.success {
    border-color: var(--success);
    background: rgba(74, 124, 78, 0.3);
}

.legend-node.partial {
    border-color: var(--warning);
    background: rgba(212, 168, 75, 0.3);
}

.legend-node.failed {
    border-color: var(--error);
    background: rgba(169, 68, 66, 0.3);
}

/* ==================== 连接线详情弹窗 ==================== */
.connection-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 50px rgba(44, 36, 22, 0.4);
    min-width: 300px;
    max-width: 380px;
    width: 90%;
    z-index: 2000;
    animation: popupIn 0.3s ease;
    overflow: hidden;
    border: 2px solid var(--gold);
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.connection-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    color: white;
}

.popup-type {
    font-size: 1.1rem;
    font-weight: 700;
}

.popup-close {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.connection-popup-body {
    padding: 1.2rem;
}

.popup-nodes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--paper-dark);
}

.popup-node {
    padding: 0.5rem 0.8rem;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    max-width: 120px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-arrow {
    font-size: 1.3rem;
    color: var(--gold);
    font-weight: bold;
}

.popup-description {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--ink);
    text-align: center;
    padding: 1rem;
    background: rgba(201, 169, 98, 0.1);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--gold);
}

/* ==================== 帮助弹窗内容 ==================== */
.help-content {
    padding: 2rem;
    max-width: 400px;
}

.help-content h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.help-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    font-size: 1.2rem;
}

/* ==================== 提示浮层 ==================== */
.hint-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ink);
    color: var(--gold);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 3000;
}

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

/* ==================== 节点动画 ==================== */
@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.graph-node.appearing {
    animation: nodeAppear 0.5s ease forwards;
}

/* ==================== 图谱响应式 ==================== */

/* 平板适配（768px - 1024px） */
@media (max-width: 1024px) {
    .graph-node {
        width: 150px;
        padding: 0.8rem;
    }
    
    .node-title {
        font-size: 0.9rem;
    }
    
    .node-era {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }
    
    .node-year {
        font-size: 0.7rem;
    }
    
    .figure-tag {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
    
    .node-result {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    .legend {
        padding: 0.6rem 0.8rem;
    }
    
    .legend-title {
        font-size: 0.75rem;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
    
    /* 移动端连线标签显示 */
    .connection-label,
    .connection-label-bg {
        display: block;
    }
    
    .connection-popup {
        max-width: 90%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

/* 手机适配（768px以下） */
@media (max-width: 768px) {
    .graph-header h1 {
        font-size: 1rem;
    }
    
    .graph-header {
        padding: 0 0.5rem;
        height: 50px;
    }
    
    .back-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .header-tools {
        gap: 0.25rem;
    }
    
    .tool-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .graph-canvas {
        top: 50px;
    }
    
    .graph-node {
        width: 130px;
        padding: 0.6rem;
    }
    
    .node-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .node-title {
        font-size: 0.85rem;
    }
    
    .node-era {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }
    
    .node-year {
        font-size: 0.65rem;
    }
    
    .node-figures {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .figure-tag {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }
    
    .node-result {
        font-size: 0.65rem;
        padding: 0.25rem 0.4rem;
    }
    
    .detail-panel {
        width: 85%;
        max-width: 350px;
        top: 50px;
        height: calc(100vh - 50px);
    }
    
    .legend {
        bottom: 0.8rem;
        left: 0.8rem;
        padding: 0.5rem 0.7rem;
    }
    
    .legend-title {
        font-size: 0.7rem;
        margin-bottom: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.65rem;
    }
    
    .legend-line {
        width: 25px;
        height: 2px;
    }
}

/* 小屏手机适配（480px以下） */
@media (max-width: 480px) {
    .graph-header {
        height: 45px;
        padding: 0 0.5rem;
    }
    
    .graph-header h1 {
        font-size: 0.9rem;
    }
    
    .back-btn span {
        display: none;
    }
    
    .back-btn {
        padding: 0.35rem 0.5rem;
        min-width: 30px;
    }
    
    .tool-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .graph-canvas {
        top: 45px;
    }
    
    .graph-node {
        width: 260px;
        padding: 0.7rem;
        transform: translateX(-50%) !important;
        left: 50% !important;
    }
    
    .graph-node:hover {
        transform: translateX(-50%) scale(1.03) !important;
    }
    
    .node-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    
    .node-title {
        font-size: 1rem;
    }
    
    .node-era {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
    }
    
    .node-year {
        font-size: 0.7rem;
    }
    
    .node-figures {
        margin-top: 0.4rem;
        padding-top: 0.4rem;
    }
    
    .figure-tag {
        font-size: 0.6rem;
        padding: 0.1rem 0.25rem;
    }
    
    .node-result {
        font-size: 0.6rem;
        padding: 0.25rem 0.4rem;
    }
    
    .detail-panel {
        width: 100%;
        max-width: none;
        top: 45px;
        height: calc(100vh - 45px);
        border-radius: 0;
    }
    
    .detail-header {
        padding: 1.2rem;
    }
    
    .detail-body {
        padding: 1rem 1.2rem;
    }
    
    .detail-section h3 {
        font-size: 0.9rem;
    }
    
    .detail-section p,
    .detail-section li {
        font-size: 0.85rem;
    }
    
    .detail-connections {
        padding: 1rem 1.2rem;
    }
    
    .connection-item {
        padding: 0.5rem 0.75rem;
    }
    
    .connection-name {
        font-size: 0.85rem;
    }
    
    .connection-note {
        font-size: 0.75rem;
    }
    
    .connection-arrow {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .legend {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.4rem 0.6rem;
    }
    
    .legend-title {
        font-size: 0.65rem;
    }
    
    .legend-item {
        font-size: 0.6rem;
        gap: 0.5rem;
    }
    
    .legend-line {
        width: 20px;
    }
}

/* ==================== 图文史料视图 ==================== */
.document-view {
    min-height: 100vh;
    position: relative;
    background: var(--gradient-paper);
}

.doc-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--gradient-antique);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.doc-nav .back-btn {
    flex-shrink: 0;
}

.doc-nav h1 {
    flex: 1;
    text-align: center;
    font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
    font-size: 1.5rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.doc-header-tools {
    display: flex;
    gap: 0.5rem;
}

/* 筛选栏 */
.doc-filters {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--paper);
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    z-index: 900;
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.1);
}

.doc-filter-btn {
    padding: 0.5rem 1rem;
    background: var(--paper-dark);
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.doc-filter-btn:hover {
    border-color: var(--gold);
    background: rgba(201, 169, 98, 0.1);
}

.doc-filter-btn.active {
    background: var(--gold);
    color: var(--ink);
    border-color: var(--gold);
}

/* 图文史料画廊 */
.doc-gallery-container {
    padding-top: 150px;
    padding-bottom: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.doc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 1.5rem;
}

.doc-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.doc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.doc-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--paper-dark);
}

.doc-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.doc-card:hover .doc-card-image img {
    transform: scale(1.05);
}

.doc-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 36, 22, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gold);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.doc-card:hover .doc-card-overlay {
    opacity: 1;
}

.doc-view-icon {
    font-size: 2rem;
}

.doc-card-info {
    padding: 1rem;
}

.doc-card-reform {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: var(--gold);
    color: var(--ink);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.doc-card-title {
    font-size: 1.1rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.doc-card-excerpt {
    font-size: 0.85rem;
    color: var(--primary);
    line-height: 1.5;
    opacity: 0.8;
}

.doc-empty {
    text-align: center;
    padding: 3rem;
    color: var(--primary);
    font-size: 1.1rem;
}

/* 史料卡片弹窗 */
.doc-card-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 36, 22, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.doc-card-modal.hidden {
    display: none;
}

.doc-card-content {
    background: var(--paper);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.doc-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(44, 36, 22, 0.8);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.doc-modal-close:hover {
    background: var(--primary);
}

/* 弹窗图片区域 */
.doc-modal-image {
    width: 100%;
    height: 50vh;
    max-height: 400px;
    overflow: hidden;
    background: var(--ink);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 弹窗文字区域 */
.doc-modal-text {
    padding: 1.5rem;
    background: var(--paper);
}

/* 标题区 */
.doc-modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--paper-dark);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.doc-modal-reform {
    padding: 0.35rem 0.85rem;
    background: var(--primary);
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.doc-modal-title {
    font-size: 1.5rem;
    color: var(--ink);
    font-weight: 700;
}

/* 内容主体区域 */
.doc-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* 通用卡片样式 */
.doc-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(44, 36, 22, 0.1);
    border: 1px solid var(--paper-dark);
}

.doc-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--paper-dark);
}

.doc-section-icon {
    font-size: 1.25rem;
}

.doc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.05em;
}

.doc-card-content {
    padding: 0;
}

/* 原文史料卡片 */
.doc-original-card {
    background: linear-gradient(135deg, #fdfbf7 0%, #f8f4eb 100%);
    border-left: 4px solid var(--primary);
}

.doc-original-text {
    font-size: 1.05rem;
    color: var(--ink);
    line-height: 1.8;
    font-style: normal;
}

/* 白话注解卡片 */
.doc-annotation-card {
    background: linear-gradient(135deg, #f5f9f6 0%, #eef5f0 100%);
    border-left: 4px solid var(--secondary);
}

.doc-annotation-text {
    font-size: 1rem;
    color: #4a4a4a;
    line-height: 1.9;
}

/* 弹窗导航按钮 */
.doc-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-100%);
    width: 50px;
    height: 50px;
    border: none;
    background: var(--gold);
    color: var(--ink);
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.doc-modal-nav:hover {
    background: var(--gold-dark);
    transform: translateY(-100%) scale(1.1);
}

.doc-modal-prev {
    left: -25px;
}

.doc-modal-next {
    right: -25px;
}

.doc-modal-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 36, 22, 0.8);
    color: var(--gold);
    padding: 0.4rem 1rem;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* 帮助弹窗 */
.doc-help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 36, 22, 0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.doc-help-modal.hidden {
    display: none;
}

.doc-help-content {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    position: relative;
}

.doc-help-content h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.doc-help-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doc-help-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
}

.doc-help-icon {
    font-size: 1.5rem;
}

/* 响应式适配 */
@media (max-width: 1024px) {
    .doc-gallery {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .doc-nav {
        height: 50px;
        padding: 0 0.5rem;
    }

    .doc-nav .back-btn {
        font-size: 0.85rem;
        padding: 0.35rem 0.6rem;
    }

    .doc-nav h1 {
        font-size: 1rem;
    }

    .doc-filters {
        top: 55px;
        padding: 0.5rem 0.75rem;
    }
    
    .doc-filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .doc-gallery-container {
        padding-top: 130px;
    }
    
    .doc-gallery {
        grid-template-columns: 1fr;
        padding: 0.75rem 1rem;
        gap: 1rem;
    }
    
    .doc-card-modal {
        padding: 0;
    }
    
    .doc-card-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .doc-modal-text {
        max-height: 50vh;
        padding: 1rem;
    }
    
    .doc-modal-title {
        font-size: 1.2rem;
    }
    
    .doc-modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .doc-modal-prev {
        left: 0.5rem;
    }
    
    .doc-modal-next {
        right: 0.5rem;
    }
    
    .doc-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .doc-modal-image {
        height: 40vh;
        max-height: 300px;
    }
    
    .doc-modal-title {
        font-size: 1.2rem;
    }
    
    .doc-card {
        padding: 1rem;
    }
}
