/* 全局样式 - 小学生友好版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', 'Arial', sans-serif;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.left-panel {
    width: 20%;
    flex-shrink: 0;
    min-width: 200px;
}

.center-panel {
    flex: 1;
    min-width: 0;
}

.right-panel {
    width: 300px;
    flex-shrink: 0;
}

/* 头部样式 - 现代清爽版 */
header {
    background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
    color: #333;
    padding: 15px 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    gap: 15px;
}

header::before {
    display: none;
}

header h1 {
    font-size: 1.6em;
    margin: 0;
    color: #2c3e50;
    font-weight: 700;
}

.header-left {
    flex: 1;
}

.header-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

/* 图标按钮样式 */
.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #333;
    text-decoration: none;
}

.icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background: #f8f9fa;
}

#toggle-favorites-header {
    color: #f1c40f;
    background: #fff9c4;
}

#toggle-favorites-header.active {
    background: #fbc02d;
    color: white;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

#mobile-history-toggle {
    color: #3498db;
    background: #e3f2fd;
    display: none; /* 桌面端隐藏，因为有左侧面板 */
}

@media (max-width: 768px) {
    #mobile-history-toggle {
        display: flex;
    }
}

.grade-dropdown select {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    color: #333;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.grade-dropdown select:hover {
    border-color: #b0bec5;
}

.grade-dropdown select:focus {
    outline: none;
    border-color: #42a5f5;
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.15);
}

/* 移除旧的按钮样式定义 */
.btn-favorite-header,
.btn-history-header,
.header-controls,
.header-secondary-row,
.knowledge-dropdown {
    display: none;
}

/* 移动端菜单按钮样式 */
.mobile-menu-toggle {
    display: none; /* 默认在桌面隐藏 */
    background: transparent;
    color: #333;
    font-size: 1.5em;
    padding: 5px;
    border: none;
    cursor: pointer;
}

/* 导航链接样式 */
.navigation-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.navigation-links .btn {
    text-decoration: none;
    padding: 8px 16px;
    font-size: 0.95em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: all 0.3s ease;
    border-radius: 8px;
    cursor: pointer;
    display: inline-block;
}

.navigation-links .btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    text-decoration: none;
    color: #333;
}

/* 选择区域样式 - 更可爱的按钮 */
.selection-area {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 3px solid #81c784;
}

.id-search-area {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

#question-id-input {
    padding: 10px 15px;
    font-size: 1.1em;
    border: 2px solid #81c784;
    border-radius: 10px;
    transition: all 0.3s ease;
    width: 200px;
    max-width: 200px;
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
}

#question-id-input:focus {
    border-color: #42a5f5;
    outline: none;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(66, 165, 245, 0.3);
}

.grade-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.grade-btn {
    background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
    border: 3px solid #42a5f5;
    color: #fff;
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 1.2em;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(144, 202, 249, 0.3);
    position: relative;
    overflow: hidden;
}

.grade-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.grade-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.5);
}

.grade-btn:hover::before {
    left: 100%;
}

.grade-btn.active {
    background: linear-gradient(135deg, #42a5f5 0%, #2196f3 100%);
    border-color: #1976d2;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(66, 165, 245, 0.5);
}

/* 题目区域样式 - 更友好的设计 */
.question-area {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    min-height: 200px;
    border: 3px solid #ffd54f;
    position: relative;
}

.question-area::before {
    position: absolute;
    top: -15px;
    left: -15px;
    font-size: 2em;
    background: #ff6b6b;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.5);
}

#question-text {
    font-size: 1.8em;
    margin-bottom: 25px;
    line-height: 1.6;
    color: #2d3436;
    font-weight: bold;
    text-align: center;
}

/* 答案区域样式 */
.answer-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

#answer-input {
    padding: 15px 20px;
    font-size: 1.4em;
    border: 3px solid #ffd54f;
    border-radius: 15px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
}

#answer-input:focus {
    border-color: #42a5f5;
    outline: none;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(66, 165, 245, 0.3);
}

/* 按钮样式 - 更可爱的按钮 */
.btn-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.navigation-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* 小按钮样式 - 用于SVG控制 */
.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 6px;
    margin: 0 2px;
    min-width: auto;
}

.btn-small:hover {
    transform: translateY(-1px);
}

/* SVG控制按钮样式 */
.svg-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 10px 0;
}

.svg-controls .btn-small {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
}

.svg-controls .btn-small:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #64b5f6 0%, #42a5f5 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #42a5f5 0%, #2196f3 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
}

/* 结果区域样式 - 更生动的反馈 */
.result {
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    font-weight: bold;
    display: none;
    font-size: 1.3em;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: popIn 0.5s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 1px, transparent 1px);
    background-size: 10px 10px;
}

.result.correct {
    background: linear-gradient(135deg, #a8e6cf 0%, #3fc1c9 100%);
    color: #155724;
    border: 3px solid #4ecdc4;
    box-shadow: 0 6px 20px rgba(168, 230, 207, 0.5);
}

.result.correct::after {
    content: '🎉';
    font-size: 2em;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

.result.incorrect {
    background: linear-gradient(135deg, #ffafbd 0%, #ffc3a0 100%);
    color: #721c24;
    border: 3px solid #ff6b6b;
    box-shadow: 0 6px 20px rgba(255, 175, 189, 0.5);
}

.result.incorrect::after {
    content: '💡';
    font-size: 2em;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

/* 解题过程样式 */
.analysis {
    background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
    padding: 20px;
    border-radius: 15px;
    border-left: 6px solid #ff6b6b;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(251, 194, 235, 0.3);
}

.analysis h4 {
    margin-bottom: 15px;
    color: #ff6b6b;
    font-size: 1.3em;
    text-align: center;
}

/* 统计区域样式 - 一行紧凑显示 */
.stats {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 8px 15px;
    border-radius: 10px;
    margin-top: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    text-align: center;
    border: 1px solid #ffd166;
    font-size: 14px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.5);
}

.stat-item::before {
    font-size: 1.2em;
}

.stat-correct::before {
    content: '✅';
}

.stat-incorrect::before {
    content: '❌';
}

.stat-item span {
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.stat-correct span {
    color: #00b894;
}

.stat-incorrect span {
    color: #ff6b6b;
}

/* 题目头部样式 - 更可爱的设计 */
.question-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #ffd166;
}

.question-id-container {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
}

.question-id {
    font-size: 1.3em;
    font-weight: bold;
    color: #ff8e53;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 10px;
    border: 2px solid #ff8e53;
    min-width: 120px;
    text-align: center;
}

.btn-favorite {
    background: linear-gradient(135deg, #ffd54f 0%, #ffca28 100%);
    color: #2d3436;
    border: 2px solid #ffb300;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 3px 12px rgba(255, 213, 79, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 100px;
}

.btn-favorite::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-favorite:hover {
    background: linear-gradient(135deg, #ffca28 0%, #ffb300 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 202, 40, 0.5);
}

.btn-favorite:hover::before {
    left: 100%;
}

.btn-favorite.favorited {
    background: linear-gradient(135deg, #f48fb1 0%, #f06292 100%);
    color: white;
    border-color: #ec407a;
}

.btn-favorite.favorited .favorite-icon {
    color: #ffd166;
}

/* 收藏区域样式 - 移动端侧边栏风格 */
.mobile-favorites-panel {
    display: none;
    position: fixed;
    top: 0;
    left: -100%; /* 从左侧滑出 */
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.mobile-favorites-panel.active {
    left: 0;
    display: block;
}

.mobile-favorites-panel .favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ab47bc;
}

.mobile-favorites-panel .favorites-header h3 {
    color: #8e24aa;
    margin: 0;
    font-size: 1.3em;
}

.mobile-favorites-panel .close-favorites {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-favorites-panel .close-favorites:hover {
    background: #ff4757;
    transform: scale(1.1);
}

.mobile-favorites-panel .favorites-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.favorite-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e1bee7;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    line-height: 1.4;
}

.favorite-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.favorite-id {
    font-weight: bold;
    color: #8e24aa;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    border-radius: 4px;
}

.favorite-remove {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.favorite-remove:hover {
    background: #ff4757;
}

.favorite-question {
    font-size: 1em;
    color: #333;
    margin-bottom: 8px;
}

.favorites-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-danger {
    background: linear-gradient(135deg, #ef5350 0%, #e53935 100%);
    color: white;
    border: 2px solid #d32f2f;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff9a9e 100%);
}

.stat-correct span {
    color: #28a745;
}

.stat-incorrect span {
    color: #e17055;
}

/* 题目历史区域样式 - 左侧面板专用 */
.left-panel .history-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 15px;
    padding: 15px;
    border: 2px solid #90caf9;
    box-shadow: 0 4px 15px rgba(144, 202, 249, 0.3);
    transition: all 0.3s ease;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.left-panel .history-section.collapsed {
    height: 40px;
    overflow: hidden;
}

.left-panel .history-section h3 {
    color: #1565c0;
    margin-bottom: 15px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.left-panel .history-section h3::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.left-panel .history-section.collapsed h3::after {
    transform: rotate(-90deg);
}

.left-panel .history-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    max-height: none;
}

.left-panel .history-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e3f2fd;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    line-height: 1.3;
}

.left-panel .history-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.left-panel .history-item.active {
    background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
    color: white;
    border-color: #388e3c;
}

.left-panel .history-empty {
    text-align: center;
    color: #757575;
    font-style: italic;
    padding: 20px;
    font-size: 0.9em;
}

.left-panel .history-info {
    border-top: 1px solid #e3f2fd;
    padding-top: 10px;
    font-size: 0.85em;
    color: #546e7a;
    flex-shrink: 0;
}

.left-panel .history-position {
    text-align: center;
    font-weight: bold;
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
}

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu .btn {
    width: 100%;
    text-align: center;
}

/* 顶部第二行控制区 */
.header-secondary-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
    flex-wrap: wrap;
    z-index: 2;
    position: relative;
}

/* 移动端历史面板 */
.mobile-history-panel {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.mobile-history-panel.active {
    right: 0;
    display: block;
}

.mobile-history-panel .history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #90caf9;
}

.mobile-history-panel .history-header h3 {
    color: #1565c0;
    margin: 0;
    font-size: 1.3em;
}

.mobile-history-panel .close-history {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-history-panel .close-history:hover {
    background: #ff4757;
    transform: scale(1.1);
}

.mobile-history-panel .history-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.mobile-history-panel .history-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e3f2fd;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    line-height: 1.4;
}

.mobile-history-panel .history-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-history-panel .history-item.current {
    background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
    color: white;
    border-color: #388e3c;
}

.mobile-history-panel .history-info {
    border-top: 2px solid #90caf9;
    padding-top: 15px;
    font-size: 0.9em;
    color: #546e7a;
}

.mobile-history-panel .history-position {
    text-align: center;
    font-weight: bold;
}

/* 遮罩层 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}

.mobile-overlay.active {
    display: block;
}

/* 响应式设计 - 移动端优先 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 12px 15px;
        gap: 10px;
    }

    .header-left {
        order: 1;
        flex: 1;
    }

    .header-right {
        order: 2;
        flex: 1;
        justify-content: flex-end;
    }

    .header-center {
        order: 3;
        flex: 100%;
        width: 100%;
        margin-top: 5px;
    }
    
    header h1 {
        font-size: 1.4em;
        margin-bottom: 0;
        width: auto;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: 1px solid #eee;
    }
    
    .navigation-links {
        display: none;
    }
    
    .mobile-menu {
        width: 100%;
    }
    
    .grade-dropdown select {
        min-width: 100px;
        font-size: 0.9em;
        padding: 6px 10px;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        display: none;
    }
    
    .center-panel {
        width: 100%;
    }
    
    .selection-area {
        padding: 15px;
    }
    
    .smart-id-input-container {
        gap: 10px;
    }
    
    #smart-question-id-input {
        width: 60%;
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px;
    }
    
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        margin-top: 10px;
    }
    
    .action-buttons .btn {
        min-width: calc(50% - 4px);
        font-size: 0.9em;
        padding: 10px;
    }
    
    .question-area {
        padding: 20px 15px;
    }
    
    #question-text {
        font-size: 1.3em;
        line-height: 1.5;
        padding: 10px;
    }
    
    #answer-input {
        font-size: 1.2em;
        padding: 15px;
        width: 100%;
    }
    
    .btn-container {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .btn-container .btn {
        width: 100%;
        min-width: auto;
        padding: 14px;
        font-size: 1em;
        touch-action: manipulation; /* 优化触摸响应 */
    }
    
    /* 确保导航按钮在同一行 */
    .btn-container.navigation-buttons,
    .navigation-buttons {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 12px;
        display: flex !important;
    }
    
    .btn-container.navigation-buttons .btn,
    .navigation-buttons .btn {
        flex: 1 !important;
        width: auto !important;
        min-width: 0 !important;
    }
    
    .stats {
        flex-direction: row;
        justify-content: space-around;
        padding: 12px;
        font-size: 0.9em;
        gap: 15px;
    }
    
    .stat-item {
        font-size: 0.9em;
    }
}

#favorite-btn {
    background: linear-gradient(135deg, #ffd54f 0%, #ffca28 100%);
    color: #2d3436;
    border: 2px solid #ffb300;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: bold;
    min-width: 80px;
}

#favorite-btn:hover {
    background: linear-gradient(135deg, #ffca28 0%, #ffb300 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 202, 40, 0.3);
}

#view-favorites {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: 2px solid #6c757d;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: bold;
    text-decoration: none;
    min-width: 80px;
    text-align: center;
}

#view-favorites:hover {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.current-id-display {
    font-size: 12px;
    color: #6c757d;
    background: #e9ecef;
    padding: 8px 11px;
    border-radius: 8px;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
    transition: all 0.3s ease;
}

.current-id-display.has-id {
    background: #4a6fa5;
    color: white;
    font-weight: 500;
}

/* 年级选择器折叠样式 */
.grade-selector-container {
    position: relative;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.grade-selector-container.collapsed {
    height: 40px;
    overflow: hidden;
}

.grade-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #4a6fa5 0%, #6d8cc0 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.grade-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.grade-selector-container.collapsed .grade-toggle {
    background: linear-gradient(135deg, #6d8cc0 0%, #4a6fa5 100%);
}

.grade-selector-container.collapsed .toggle-arrow {
    transform: rotate(-90deg);
}

.toggle-arrow {
    transition: transform 0.3s ease;
}

/* 标题折叠样式 */
header {
    position: relative;
    transition: all 0.3s ease;
}

header.collapsed {
    height: 40px;
    overflow: hidden;
}

header.collapsed h1 {
    font-size: 1.2em;
    margin: 0;
    cursor: pointer;
    display: inline-block;
    background: linear-gradient(135deg, #4a6fa5 0%, #6d8cc0 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

header.collapsed h1:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

header.collapsed h1::after {
    content: ' ▼';
    font-size: 0.8em;
    opacity: 0.7;
}

header:not(.collapsed) h1 {
    transition: all 0.3s ease;
}

/* 成功提示样式 */
.success-toast {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10000;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.3);
    border: 2px solid #155724;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.success-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast-icon {
    font-size: 2.5em;
    animation: bounce 0.6s ease infinite;
}

.toast-text {
    flex: 1;
}

.toast-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 5px;
}

.toast-message {
    font-size: 1em;
    opacity: 0.9;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Toast提示样式 */

/* 统一 Action Buttons 区域样式 */
.action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
}

/* 统一按钮和显示框的基础样式 */
.action-buttons .btn,
.action-buttons .current-id-display {
    height: 40px;
    padding: 0 15px;
    border-radius: 20px; /* 圆角统一 */
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent; /* 预留边框 */
    margin: 0; /* 移除可能的 margin */
}

/* 收藏按钮 - 覆盖ID选择器 */
.action-buttons #favorite-btn {
    background: white;
    color: #fbc02d;
    border-color: #fbc02d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: auto;
}

.action-buttons #favorite-btn:hover {
    background: #fff9c4;
    transform: translateY(-2px);
}

/* 重置按钮 - 覆盖类选择器 */
.action-buttons #reset-questions {
    background: white;
    color: #4caf50;
    border-color: #4caf50;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.action-buttons #reset-questions:hover {
    background: #e8f5e9;
    transform: translateY(-2px);
}

/* ID 显示框 */
.action-buttons .current-id-display {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    border-style: solid;
    min-width: 100px; /* 稍微宽一点 */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.action-buttons .current-id-display.has-id {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}