/* 整体页面美化 */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
}

/* ========== 导航栏样式 ========== */
.site-header {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1f2937;
}

.header-logo i {
    color: #4f46e5;
    font-size: 1.2rem;
}

.logo-text {
    font-size: 1rem;
    font-weight: 700;
}

/* PC端导航 */
.header-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    margin: 0 1.5rem;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list .category-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-list .category-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.nav-list .category-item.active {
    background: #4338ca;
    border-color: #4338ca;
    color: #fff;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}

.toggle-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: #4b5563;
    border-radius: 2px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    display: block;
    width: 18px;
    height: 2px;
    background: #4b5563;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.toggle-icon::before {
    top: -6px;
}

.toggle-icon::after {
    top: 6px;
}

.menu-toggle.active .toggle-icon {
    background: transparent;
}

.menu-toggle.active .toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
    background: #4b5563;
}

.menu-toggle.active .toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
    background: #4b5563;
}

/* 移动端下拉菜单 */
.mobile-nav {
    display: none;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav.open {
    display: block;
    max-height: 60vh;
    overflow-y: auto;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 1rem;
}

.mobile-nav-list .category-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    margin-bottom: 0.4rem;
    transition: all 0.2s ease;
}

.mobile-nav-list .category-item:last-child {
    margin-bottom: 0;
}

.mobile-nav-list .category-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.mobile-nav-list .category-item.active {
    background: #4338ca;
    border-color: #4338ca;
    color: #fff;
}

.mobile-nav-list .category-item span {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ========== 响应式断点 ========== */

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
    .header-inner {
        padding: 0 0.85rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .nav-list .category-item {
        padding: 0.3rem 0.55rem;
        font-size: 0.7rem;
    }
}

/* 大平板/小屏幕 (600px - 767px) */
@media (max-width: 767px) {
    .header-nav {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 手机 (360px - 599px) */
@media (max-width: 599px) {
    .header-inner {
        height: 50px;
        padding: 0 0.75rem;
    }
    
    .header-logo i {
        font-size: 1.1rem;
    }
    
    .menu-toggle {
        width: 32px;
        height: 32px;
    }
    
    .toggle-icon,
    .toggle-icon::before,
    .toggle-icon::after {
        width: 16px;
    }
    
    .toggle-icon::before {
        top: -5px;
    }
    
    .toggle-icon::after {
        top: 5px;
    }
    
    .mobile-nav-list {
        padding: 0.5rem 0.75rem;
    }
    
    .mobile-nav-list .category-item {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* 内容区域样式 */
.content-area {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow-y: auto;
    max-height: 100%;
}

.category-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.category-description {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* 题目卡片样式 */
.question-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.question-card .question-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.question-content {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #374151;
    font-weight: 500;
}

.difficulty-badge {
    flex: 0 0 auto;
    min-width: auto;
    margin-left: 1rem;
}

.question-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.question-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #374151;
    /* margin-bottom: 1.5rem; */
    font-weight: 500;
}

/* 选项样式 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #374151;
    text-align: center;
}

.option-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.option-item.selected {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    color: #1e40af;
    font-weight: 600;
}

.option-item.correct {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #16a34a;
    color: #166534;
}

.option-item.incorrect {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #dc2626;
    color: #991b1b;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal:not(.hidden) {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 1000px;
    max-height: 100vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* 难度标签样式 */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.05em;
}

.badge-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border: 1px solid #86efac;
}

.badge-medium {
    background: linear-gradient(135deg, #dcfce7 0%, #fed7aa 100%);
    color: #9a3412;
    border: 1px solid #fdba74;
}

.badge-danger {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #991b1b;
    border: 1px solid #f87171;
}

/* 解析面板样式 */
.analysis-panel {
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid #d1d5db;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    transition: all 0.2s ease;
    overflow: hidden;
    margin-top: 1rem;
    position: relative;
}

/* 修复解析中图片与LaTeX重叠问题 - 移除绝对定位 */
.analysis-panel img {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    display: block;
    margin: 1rem auto;
    max-width: 100%;
    height: auto;
}

/* 确保LaTeX公式不会与图片重叠 */
.analysis-panel .MathJax {
    display: inline-block;
    margin: 0.25rem 0;
    clear: both;
}

.analysis-panel h4 {
    margin: 0 0 0.5rem;
    color: #1f2937;
}

.analysis-panel .analysis-content {
    color: #334155;
}

.analysis-panel .answer-pill {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 12px;
    border-left: 4px solid #16a34a;
    background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
    font-weight: 600;
}


/* 进度条样式 */
.progress-bar {
    height: 8px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .container {
        padding: 0.5rem;
    }

    .content-area {
        padding: 1rem;
    }

    .category-header {
        margin-bottom: 0.5rem;
        padding: 0;
    }

    .category-title {
        font-size: 1.4rem;
    }

    .question-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .question-content {
        font-size: 1rem;
    }

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 0.75rem;
        border-radius: 12px;
    }

    .question-card {
        padding: 0.75rem;
        border-radius: 12px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .option-item {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .btn-primary {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
    }

    .difficulty-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .category-title {
        font-size: 1.2rem;
    }

    .category-description {
        font-size: 0.85rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 4px;
    border-radius: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose strong {
    font-weight: 600;
}

.prose em {
    font-style: italic;
}

@media (max-width: 768px) {
    .sticky {
        position: relative;
        top: 0;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.back-to-top i {
    font-size: 1.2rem;
}

table,
th,
td {
    text-align: center;
    font-size: 14px;
}
th,
td {
  border: 1px solid black;
}


/* Responsive layout refinements */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.header-inner,
.content-area,
.question-card,
.analysis-panel,
.modal-content,
.main-content {
    min-width: 0;
}

.header-inner {
    max-width: 1440px;
}

.header-nav {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.nav-list {
    flex-wrap: nowrap;
    width: max-content;
}

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem;
}

.content-area {
    max-height: none;
    overflow: visible;
}

.question-card {
    padding: 0;
}

.question-card > .p-6 {
    padding: 1.25rem;
}

.question-content,
.analysis-panel,
.analysis-content {
    overflow-wrap: anywhere;
}

.question-content img,
.analysis-panel img {
    max-width: 100% !important;
    height: auto !important;
}

.question-content table,
.analysis-panel table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
}

.modal-content {
    width: min(100% - 2rem, 1000px);
    max-height: calc(100vh - 2rem);
}

@media (max-width: 1024px) {
    .header-inner {
        padding: 0 1rem;
    }

    .logo-text {
        display: inline;
    }

    .header-nav {
        display: none;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .container {
        padding: 1rem;
    }

    .question-card:hover {
        transform: none;
    }

    .options-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .header-inner {
        height: 52px;
    }

    .container {
        padding: 0.75rem;
    }

    .content-area {
        padding: 0.75rem;
        border-radius: 12px;
    }

    .category-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .question-card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .question-card > .p-6 {
        padding: 0.75rem;
    }

    .question-card .flex.justify-between.items-start.mb-4 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .question-content {
        flex-basis: 100%;
        font-size: 1rem;
    }

    .difficulty-badge {
        margin-left: 0;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .options-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }

    .option-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-primary,
    .btn-secondary {
        min-height: 44px;
    }

    .back-to-top {
        right: 1rem;
        bottom: 1rem;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 400px) {
    .header-inner {
        padding: 0 0.75rem;
    }

    .container {
        padding: 0.5rem;
    }

    .logo-text {
        font-size: 0.9rem;
    }

    .analysis-panel {
        padding: 0.75rem;
    }
}