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

body {
    font-family: "Comic Sans MS", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8f0 50%, #e6f7ff 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: linear-gradient(180deg, #fff 0%, #fff5f7 100%);
    box-shadow: 4px 0 20px rgba(255, 150, 180, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    border-right: 3px dashed #ffd1dc;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 3px solid #ffe0ec;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
}

.sidebar-header h2 {
    font-size: 20px;
    color: white;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 组别节点 */
.group-node {
    margin-bottom: 12px;
}

.group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
    user-select: none;
    background: #fff5f7;
    border: 2px solid transparent;
}

.group-title:hover {
    background: #ffe0ec;
    border-color: #ffb6c1;
    transform: scale(1.02);
}

.group-title-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid #ff6b9d;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transition: transform 0.3s;
}

.group-node.expanded > .group-title .group-icon {
    transform: rotate(90deg);
}

.group-name {
    font-size: 16px;
    color: #4a4a4a;
    font-weight: 600;
}

.group-count {
    font-size: 14px;
    color: #ff6b9d;
    font-weight: 500;
}

.group-children {
    display: none;
    padding-left: 20px;
    margin-top: 6px;
}

.group-node.expanded > .group-children {
    display: block;
}

/* 子题目项 */
.quiz-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin: 4px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
    color: #5a5a5a;
    background: white;
    border: 2px solid #ffe0ec;
}

.quiz-item:hover {
    background: linear-gradient(135deg, #ffd1dc 0%, #ffe4e9 100%);
    color: #d6336c;
    border-color: #ff6b9d;
    transform: translateX(4px);
}

.quiz-item.active {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8fab 100%);
    color: white;
    border-color: #ff4081;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
    font-weight: 600;
}

.quiz-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-item-icon {
    font-size: 16px;
}

.quiz-item-title {
    font-weight: 600;
}

/* 侧边栏折叠按钮 */
.sidebar-toggle {
    position: fixed;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 80px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(255, 154, 158, 0.3);
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8fab 100%);
    width: 28px;
}

.sidebar.collapsed ~ .sidebar-toggle {
    left: 0;
}

/* 主内容调整 */
.header,
.bottom-nav,
.main-container {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .header,
.sidebar.collapsed ~ .bottom-nav,
.sidebar.collapsed ~ .main-container {
    margin-left: 0;
}

/* 响应式 - 侧边栏 */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .sidebar.collapsed {
        transform: translateX(-240px);
    }

    .sidebar-toggle {
        left: 240px;
    }

    .header,
    .bottom-nav,
    .main-container {
        margin-left: 0;
    }
}

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, #ff6b9d 0%, #ffa07a 50%, #ffd93d 100%);
    color: white;
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.25);
}

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

.back-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(-3px);
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.15);
}

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

.timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
}

.timer-icon {
    font-size: 22px;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.font-size-control span {
    font-size: 15px;
    opacity: 0.95;
    font-weight: 500;
}

.font-sizes {
    display: flex;
    gap: 6px;
}

.font-size-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.font-size-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.font-size-btn.active {
    background: white;
    color: #ff6b9d;
    font-weight: 700;
    transform: scale(1.1);
}

.submit-btn {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
    border: 3px solid white;
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.submit-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.5);
}

/* 主内容区 */
.main-container {
    flex: 1;
    display: flex;
    gap: 24px;
    padding: 24px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* 左侧答题卡 */
.answer-sheet {
    width: 360px;
    background: linear-gradient(180deg, #fff9e6 0%, #fff 100%);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 24px rgba(255, 200, 100, 0.2);
    height: fit-content;
    position: sticky;
    top: 24px;
    border: 3px solid #ffe4b5;
}

.sheet-title {
    font-size: 22px;
    font-weight: 700;
    color: #ff8c42;
    margin-bottom: 12px;
    text-align: center;
}

.sheet-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 2px dashed #ffd4a3;
    justify-content: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #5a5a5a;
    font-weight: 500;
}

.stat-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.stat-icon.correct {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.stat-icon.wrong {
    background: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.stat-icon.unanswered {
    background: #d4d4d8;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.question-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s;
    position: relative;
    border: 2px solid #ffe4b5;
    background: white;
    color: #8b7355;
}

.question-cell:hover {
    border-color: #ffa500;
    color: #ff8c42;
    transform: scale(1.1);
}

.question-cell.correct {
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    border-color: #22c55e;
    color: #15803d;
}

.question-cell.wrong {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #ef4444;
    color: #b91c1c;
}

.question-cell.current {
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    border-color: #f59e0b;
    color: #92400e;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transform: scale(1.1);
}

.question-cell .status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.question-cell.correct .status-dot {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.question-cell.wrong .status-dot {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.submit-exam-btn {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ffa07a 100%);
    color: white;
    border: 3px solid white;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}

.submit-exam-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.4);
}

/* 右侧题目区 */
.question-panel {
    flex: 1;
    background: linear-gradient(180deg, #fff 0%, #fef9f9 100%);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 8px 24px rgba(200, 200, 255, 0.15);
    border: 3px solid #e8d5ff;
}

.question-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 3px dashed #e8d5ff;
}

.question-number {
    font-size: 24px;
    color: #6b21a8;
    font-weight: 700;
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    padding: 6px 14px;
    border-radius: 10px;
}

.question-type {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.question-content {
    font-size: 20px;
    color: #3a3a3a;
    line-height: 2;
    margin-bottom: 36px;
    font-weight: 500;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    border: 3px solid #e8d5ff;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
    color: #4a4a4a;
    background: white;
}

.option-item:hover {
    border-color: #a78bfa;
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    transform: translateX(6px);
}

.option-item.selected {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    color: #5b21b6;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.option-item.correct {
    border-color: #22c55e;
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    color: #15803d;
    font-weight: 600;
}

.option-item.wrong {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #b91c1c;
}

.option-label {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin-right: 18px;
    flex-shrink: 0;
    border: 3px solid #d4bfff;
    color: #a78bfa;
    transition: all 0.3s;
    background: white;
}

.option-item.selected .option-label {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-color: #7c3aed;
    color: white;
    transform: scale(1.1);
}

.option-item.correct .option-label {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
    color: white;
}

.option-item.wrong .option-label {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #dc2626;
    color: white;
}

/* 答案反馈 */
.answer-feedback {
    background: linear-gradient(135deg, #fff9e6 0%, #fff4d6 100%);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 24px;
    border: 2px dashed #ffd93d;
}

.feedback-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    font-size: 17px;
}

.feedback-row:last-child {
    margin-bottom: 0;
}

.feedback-label {
    color: #6b7280;
    min-width: 110px;
    font-weight: 600;
}

.feedback-answer {
    font-weight: 700;
    font-size: 20px;
}

.feedback-answer.correct {
    color: #16a34a;
}

.feedback-answer.wrong {
    color: #dc2626;
}

/* 解析部分 */
.analysis-section {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 16px;
    padding: 26px;
    border: 3px solid #7dd3fc;
    box-shadow: 0 4px 12px rgba(125, 211, 252, 0.2);
}

.analysis-title {
    font-size: 20px;
    font-weight: 700;
    color: #0284c7;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-content {
    font-size: 17px;
    color: #0c4a6e;
    line-height: 2;
}

/* 底部导航 */
.bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 36px;
    background: linear-gradient(180deg, #fff 0%, #faf5ff 100%);
    box-shadow: 0 -4px 16px rgba(200, 200, 255, 0.15);
    border-top: 3px dashed #e8d5ff;
}

.nav-btn {
    padding: 14px 36px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.nav-btn.prev {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
    border-color: #f9a8d4;
}

.nav-btn.prev:hover:not(:disabled) {
    background: linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 207, 232, 0.4);
}

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

.nav-btn.next {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.nav-btn.next:hover:not(:disabled) {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

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

/* 响应式 */
@media (max-width: 968px) {
    .main-container {
        flex-direction: column;
    }

    .answer-sheet {
        width: 100%;
        position: static;
    }
}

.hidden {
    display: none !important;
}

/* 欢迎页面 */
.welcome-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    text-align: center;
    padding: 60px 20px;
}

.welcome-icon {
    font-size: 100px;
    margin-bottom: 28px;
    animation: bounce 2s infinite;
}

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

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    color: #6b21a8;
    margin-bottom: 16px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.welcome-desc {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 36px;
}

.welcome-hint {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 20px;
    padding: 30px 50px;
    border: 3px dashed #f59e0b;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(245, 158, 11, 0); }
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 17px;
    color: #b45309;
    font-weight: 700;
}

.hint-icon {
    font-size: 28px;
}

@media (max-width: 600px) {
    .header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-title {
        font-size: 20px;
    }

    .question-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .question-content {
        font-size: 17px;
    }

    .option-item {
        font-size: 16px;
        padding: 14px 16px;
    }
}

/* 字号设置 */
body.font-small .question-content { font-size: 16px; }
body.font-small .option-item { font-size: 15px; }
body.font-small .analysis-content { font-size: 14px; }

body.font-large .question-content { font-size: 22px; }
body.font-large .option-item { font-size: 20px; }
body.font-large .analysis-content { font-size: 18px; }
