:root {
    --primary: #4338ca;
    --primary-light: #6366f1;
    --primary-dark: #312e81;
    --secondary: #06b6d4;
    --background: #ffffff;
    --surface: #f8fafc;
    --card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--surface);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0;
}

header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
}

header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    font-size: clamp(0.95rem, 2vw, 1.125rem);
    color: var(--text-secondary);
    text-align: center;
    font-weight: 400;
}

main {
    padding: 3rem 1.5rem;
    min-height: calc(100vh - 200px);
}

.category-section {
    margin-bottom: 4rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.category-section h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

.category-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
}

.subcategory-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.subcategory-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.subcategory-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.subcategory-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

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

.subcategory-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.subcategory-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex: 1;
    min-height: 3em;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    position: relative;
    overflow: hidden;
    margin-top: auto;
    text-decoration: none;
}

.btn-primary::after {
    content: '→';
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.btn-primary:active {
    transform: scale(0.98);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--background);
    margin: 2rem auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-xl);
}

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

.close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.close:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

#modalTitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-right: 3rem;
}

.qr-container {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

#qrImage {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.modal-tips {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.exam-selection-content, .year-selection-content {
    max-width: 600px;
}

.exam-type-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.exam-type-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.exam-type-card:hover {
    border-color: var(--primary);
    background: var(--background);
    transform: scale(1.05);
}

.exam-type-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.exam-type-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.exam-type-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    min-height: 40px;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    z-index: 1;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

#yearModalTitle {
    width: 100%;
    text-align: center;
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
    padding: 0 100px;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.year-group {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.year-group:hover {
    border-color: var(--primary);
    background: var(--background);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.year-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.year-group-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

footer {
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 640px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    main {
        padding: 2rem 1rem;
    }
    
    .subcategories {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .subcategory-card {
        padding: 1.5rem;
    }
    
    .exam-type-selection {
        grid-template-columns: 1fr;
    }
    
    .year-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        padding: 1.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .subcategories {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #6366f1;
        --primary-light: #818cf8;
        --primary-dark: #4338ca;
        --secondary: #22d3ee;
        --background: #0f172a;
        --surface: #1e293b;
        --card: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --border: #334155;
    }
    
    header {
        background: rgba(15, 23, 42, 0.8);
    }
    
    .close:hover {
        background: var(--primary);
    }
    
    .subcategory-card {
        background: var(--card);
    }
}

/* 打印优化 */
@media print {
    header, footer, .btn-primary {
        display: none;
    }
    
    .subcategory-card {
        break-inside: avoid;
    }
}

/* 动画优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}