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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* 顶部导航 */
.header {
    background: #1a73e8;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header h1 {
    font-size: 18px;
    font-weight: 500;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.mode-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
}

/* 容器布局 */
.container {
    display: flex;
    min-height: calc(100vh - 52px);
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 16px;
    overflow-y: auto;
    transition: transform 0.3s;
}

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

.sidebar-section h3 {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-btn {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
}

.mode-btn.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
}

.filter-btn.active {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #1a73e8;
}

/* 考试设置 */
.exam-settings {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.setting-item {
    margin-bottom: 10px;
}

.setting-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.setting-item select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.start-exam-btn {
    width: 100%;
    padding: 10px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.start-exam-btn:hover {
    background: #1557b0;
}

/* 题目导航网格 */
.question-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-item:hover {
    border-color: #1a73e8;
}

.nav-item.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.nav-item.answered {
    background: #e8f5e9;
    border-color: #4caf50;
}

.nav-item.wrong {
    background: #ffebee;
    border-color: #f44336;
}

.nav-item.correct {
    background: #e8f5e9;
    border-color: #4caf50;
}

/* 题型分组边框 */
.nav-item.type-single { border-left: 3px solid #1565c0; }
.nav-item.type-multi { border-left: 3px solid #7b1fa2; }
.nav-item.type-judge { border-left: 3px solid #e65100; }
.nav-item.type-short { border-left: 3px solid #00838f; }
.nav-item.type-practical { border-left: 3px solid #2e7d32; }

/* 统计信息 */
.stats {
    font-size: 13px;
    color: #666;
}

.stats div {
    margin-bottom: 4px;
}

.stats span {
    font-weight: 600;
    color: #333;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* 考试倒计时 */
.exam-timer {
    margin-bottom: 16px;
}

.timer-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.timer-progress {
    height: 100%;
    background: #1a73e8;
    transition: width 1s linear;
    width: 100%;
}

.timer-progress.warning {
    background: #ff9800;
}

.timer-progress.danger {
    background: #f44336;
}

.timer-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.timer-text strong {
    font-size: 18px;
    color: #333;
}

.submit-exam-btn {
    padding: 8px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.submit-exam-btn:hover {
    background: #d32f2f;
}

/* 题目区域 */
.question-area {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    overflow-y: auto;
}

.question-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #999;
    font-size: 16px;
}

.question-header {
    margin-bottom: 16px;
}

.question-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.meta-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f0f0f0;
    color: #666;
}

.meta-tag.type-single { background: #e3f2fd; color: #1565c0; }
.meta-tag.type-multi { background: #f3e5f5; color: #7b1fa2; }
.meta-tag.type-judge { background: #fff3e0; color: #e65100; }
.meta-tag.type-short { background: #e8f5e9; color: #2e7d32; }
.meta-tag.type-practical { background: #fce4ec; color: #c62828; }

.question-text {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
}

/* 选项 */
.options-list {
    margin-top: 16px;
}

.option-item {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    line-height: 1.5;
}

.option-item:hover {
    border-color: #1a73e8;
    background: #f8f9fa;
}

.option-item.selected {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.option-item.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.option-item.wrong {
    border-color: #f44336;
    background: #ffebee;
}

.option-item.disabled {
    cursor: default;
    pointer-events: none;
}

/* 判断题按钮 */
.judge-options {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.judge-btn {
    flex: 1;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-size: 20px;
    text-align: center;
    transition: all 0.2s;
}

.judge-btn:hover {
    border-color: #1a73e8;
}

.judge-btn.selected {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.judge-btn.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.judge-btn.wrong {
    border-color: #f44336;
    background: #ffebee;
}

/* 简答题输入 */
.short-answer-area {
    margin-top: 16px;
}

.short-answer-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.short-answer-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

.check-answer-btn {
    margin-top: 10px;
    padding: 8px 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.check-answer-btn:hover {
    background: #1557b0;
}

/* 答案反馈 */
.answer-feedback {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.answer-feedback.correct {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.answer-feedback.wrong {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
}

.feedback-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.feedback-answer {
    margin-top: 6px;
}

/* 实操题代码块 */
.code-block {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* 底部操作栏 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.nav-btn {
    padding: 10px 24px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    border-color: #1a73e8;
    color: #1a73e8;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-counter {
    font-size: 14px;
    color: #666;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

.result-content {
    margin-bottom: 20px;
}

.result-score {
    text-align: center;
    margin-bottom: 20px;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
    color: #1a73e8;
}

.score-total {
    font-size: 16px;
    color: #666;
}

.result-details {
    font-size: 14px;
    line-height: 2;
}

.result-details .row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.modal-btn.primary {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.modal-btn:hover {
    opacity: 0.9;
}

/* 文档来源信息 */
.source-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 12px 0;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.source-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.source-section {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0f0f0;
    color: #555;
    padding: 4px 10px;
    border-radius: 12px;
}

/* 实操题编辑器 */
.practical-editor {
    margin-top: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.editor-lang {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.environment-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
    font-size: 13px;
    color: #555;
    flex-wrap: wrap;
}

.environment-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: #1a73e8;
    font-weight: 600;
}

.environment-desc {
    line-height: 1.5;
}

.environment-sql .environment-tag {
    background: #e8f5e9;
    color: #2e7d32;
}

.environment-python .environment-tag {
    background: #eef4ff;
    color: #1a73e8;
}

.environment-text .environment-tag {
    background: #fff3e0;
    color: #ef6c00;
}

.environment-chart .environment-tag {
    background: #fce4ec;
    color: #c2185b;
}

.environment-flowchart .environment-tag {
    background: #ede7f6;
    color: #5e35b1;
}

.run-code-btn {
    padding: 6px 16px;
    background: #34a853;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.run-code-btn:hover {
    background: #2d8e47;
}

.code-editor {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #1e1e1e;
    color: #d4d4d4;
    tab-size: 4;
}

.code-editor:focus {
    outline: none;
}

.code-output {
    padding: 16px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    color: #333;
}

pre.output-success,
pre.output-error {
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: transparent;
    border: none;
}

.output-success, pre.output-success {
    color: #2e7d32;
}

.output-error, pre.output-error {
    color: #c62828;
}

.output-hint {
    color: #666;
    font-style: italic;
}

.reference-answer {
    margin-top: 16px;
    padding: 16px;
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
}

.reference-answer h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

/* 实操题左右布局 */
.practical-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.practical-main {
    flex: 1;
    min-width: 0;
}

/* 右侧可折叠答案面板 */
.practical-answer-panel {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
}

.answer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e65100;
    font-weight: 500;
    transition: background 0.2s;
    user-select: none;
}

.answer-toggle:hover {
    background: #ffecb3;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.answer-content {
    margin-top: 8px;
    padding: 16px;
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
}

.answer-content h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.practical-answer-panel.show .answer-content {
    display: block;
}

@media (max-width: 900px) {
    .practical-layout {
        flex-direction: column;
    }
    .practical-answer-panel {
        width: 100%;
        position: static;
    }
}

/* 遮罩层（侧边栏打开时） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
    display: block;
}

/* ========= 响应式：移动触屏适配 ========= */
@media (max-width: 768px) {
    /* —— 顶部导航 —— */
    .header {
        padding: 8px 12px;
        position: -webkit-sticky;
        position: sticky;
    }

    .header h1 {
        font-size: 15px;
    }

    .menu-toggle {
        font-size: 22px;
        padding: 8px 10px;
        margin-left: -4px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mode-badge {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* —— 侧边栏抽屉式 —— */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        z-index: 50;
        transform: translateX(-100%);
        border-right: none;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        border-radius: 0 12px 12px 0;
        padding-top: 48px;
        padding-bottom: 80px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* —— 主内容区全屏 —— */
    .main-content {
        padding: 12px;
        min-height: calc(100vh - 52px);
    }

    /* —— 考试倒计时 —— */
    .exam-timer {
        margin-bottom: 12px;
        position: -webkit-sticky;
        position: sticky;
        top: 52px;
        z-index: 30;
        background: #f5f5f5;
        padding: 4px 0;
    }

    .timer-text {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .timer-text strong {
        font-size: 22px;
        text-align: center;
    }

    .submit-exam-btn {
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
        min-height: 48px;
    }

    /* —— 题目区域 —— */
    .question-area {
        padding: 16px 12px;
        margin-bottom: 8px;
        border-radius: 16px;
        font-size: 16px;
    }

    .question-text {
        font-size: 16px;
        line-height: 1.7;
    }

    .question-meta {
        gap: 6px;
    }

    .meta-tag {
        font-size: 12px;
        padding: 4px 10px;
    }

    .source-info {
        font-size: 12px;
    }

    /* —— 选择题选项（加大触摸目标） —— */
    .option-item {
        padding: 16px 16px;
        margin-bottom: 10px;
        font-size: 16px;
        line-height: 1.6;
        min-height: 52px;
        display: flex;
        align-items: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .option-item:active {
        background: #e8f0fe;
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* —— 判断题按钮 —— */
    .judge-options {
        gap: 12px;
    }

    .judge-btn {
        padding: 24px 16px;
        font-size: 24px;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .judge-btn:active {
        transform: scale(0.96);
        transition: transform 0.1s;
    }

    /* —— 简答题 —— */
    .short-answer-input {
        font-size: 16px; /* ≥16px 防止 iOS 自动缩放 */
        min-height: 100px;
        padding: 12px;
    }

    .check-answer-btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        margin-top: 12px;
    }

    /* —— 底部操作栏（拇指友好） —— */
    .action-bar {
        padding: 8px 0 12px 0;
        position: -webkit-sticky;
        position: sticky;
        bottom: 0;
        background: linear-gradient(to bottom, transparent, #f5f5f5 15%);
        z-index: 20;
    }

    .nav-btn {
        padding: 14px 20px;
        font-size: 16px;
        min-width: 100px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .nav-btn:active:not(:disabled) {
        background: #e8f0fe;
        transform: scale(0.96);
    }

    .question-counter {
        font-size: 15px;
    }

    /* —— 弹窗（底部弹起） —— */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        border-radius: 20px 20px 0 0;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 20px));
        -webkit-animation: slideUp 0.25s ease-out;
        animation: slideUp 0.25s ease-out;
    }

    .modal h2 {
        font-size: 18px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }

    .score-number {
        font-size: 56px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        text-align: center;
    }

    /* —— 题目导航（可横向滚动） —— */
    .question-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        max-height: 220px;
        padding: 4px 0 12px 0;
    }

    .nav-item {
        width: 44px;
        height: 44px;
        font-size: 14px;
        border-radius: 8px;
        aspect-ratio: auto;
        flex: 0 0 44px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .nav-item:active {
        transform: scale(0.9);
        transition: transform 0.1s;
    }

    /* —— 设置项 —— */
    .setting-item select {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 44px;
    }

    .start-exam-btn {
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        margin-top: 8px;
    }

    .clear-progress-btn {
        width: 100%;
        padding: 10px 16px;
        border: 1px solid #dadce0;
        background: #fff;
        border-radius: 8px;
        font-size: 13px;
        color: #666;
        cursor: pointer;
        transition: all 0.2s;
        font-family: inherit;
    }

    .clear-progress-btn:hover {
        background: #fce8e6;
        border-color: #d93025;
        color: #d93025;
    }

    /* —— 按钮通用扩大 —— */
    .mode-btn {
        padding: 14px 14px;
        font-size: 15px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .filter-btn {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* —— 侧边栏各区块间距 —— */
    .sidebar-section {
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }

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

    .sidebar-section h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .stats {
        font-size: 14px;
    }

    /* —— 代码编辑器 —— */
    .code-editor {
        font-size: 13px;
        min-height: 150px;
    }

    .run-code-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    .practical-editor .editor-header {
        padding: 8px 12px;
    }

    /* —— 答案反馈 —— */
    .answer-feedback {
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
    }

    .reference-answer {
        padding: 14px;
        border-radius: 10px;
    }

    .code-block {
        font-size: 12px;
        padding: 12px;
    }
}

/* 弹窗由下向上滑入动画 */
@-webkit-keyframes slideUp {
    from { -webkit-transform: translateY(100%); transform: translateY(100%); }
    to { -webkit-transform: translateY(0); transform: translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* 安全区域适配（iPhone X+） */
@supports (padding: env(safe-area-inset-bottom)) {
    .action-bar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .modal {
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .sidebar {
        padding-top: calc(48px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* 横屏手机 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 6px 12px;
    }
    .main-content {
        padding: 8px 12px;
    }
    .question-area {
        padding: 12px;
    }
    .judge-btn {
        min-height: 60px;
        padding: 16px;
    }
}

/* 更大平板屏 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .question-nav {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 底部备案信息 */
.footer {
    text-align: center;
    padding: 16px 20px;
    font-size: 13px;
    color: #999;
    border-top: 1px solid #e0e0e0;
    margin-top: 24px;
}

.footer a {
    color: #999;
    text-decoration: none;
}

.footer a:hover {
    color: #1a73e8;
    text-decoration: underline;
}
