/* Material Design 3 - CSS Variables */
:root {
    /* Primary Colors - Based on Material 3 */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    /* Secondary Colors */
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    
    /* Tertiary Colors */
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
    
    /* Error Colors */
    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;
    
    /* Surface Colors */
    --md-sys-color-surface: #FEF7FF;
    --md-sys-color-on-surface: #1D1B20;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    
    /* Background */
    --md-sys-color-background: #FEF7FF;
    --md-sys-color-on-background: #1D1B20;
    
    /* Success Colors (Custom) */
    --md-sys-color-success: #2E7D32;
    --md-sys-color-success-container: #C8E6C9;
    
    /* Elevation */
    --md-sys-elevation-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-4: 0px 6px 10px 4px rgba(0, 0, 0, 0.15), 0px 2px 3px rgba(0, 0, 0, 0.3);
    
    /* Typography */
    --md-sys-typescale-display-large-size: 57px;
    --md-sys-typescale-headline-large-size: 32px;
    --md-sys-typescale-headline-medium-size: 28px;
    --md-sys-typescale-title-large-size: 22px;
    --md-sys-typescale-body-large-size: 16px;
    --md-sys-typescale-body-medium-size: 14px;
    
    /* Shape */
    --md-sys-shape-corner-none: 0px;
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    
    /* Motion */
    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --md-sys-motion-duration-short: 200ms;
    --md-sys-motion-duration-medium: 300ms;
    --md-sys-motion-duration-long: 400ms;
}

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

body {
    font-family: 'Roboto', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 100px auto;
    text-align: center;
    background: var(--md-sys-color-surface);
    padding: 48px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-2);
}

h1 {
    color: var(--md-sys-color-on-surface);
    margin-bottom: 40px;
    font-size: var(--md-sys-typescale-headline-large-size);
    font-weight: 400;
    letter-spacing: 0;
}

.button-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Material 3 Filled Button */
.main-btn {
    padding: 10px 24px;
    min-height: 40px;
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: 500;
    letter-spacing: 0.1px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    cursor: pointer;
    transition: box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard),
                background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    position: relative;
    overflow: hidden;
    box-shadow: var(--md-sys-elevation-1);
}

.main-btn:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.main-btn:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.08);
}

.main-btn:active {
    box-shadow: var(--md-sys-elevation-1);
}

/* 题库选择 */
.bank-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bank-btn {
    padding: 20px;
    font-size: var(--md-sys-typescale-body-large-size);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.bank-btn:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

/* Material 3 Card for Banks */
.bank-card {
    padding: 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.bank-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--md-sys-color-primary);
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.bank-card:hover {
    box-shadow: var(--md-sys-elevation-2);
    border-color: var(--md-sys-color-primary);
}

.bank-card:hover::before {
    opacity: 0.08;
}

.bank-card h3 {
    margin-bottom: 8px;
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    position: relative;
    z-index: 1;
}

.bank-card p {
    margin: 0;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
    position: relative;
    z-index: 1;
}

/* 答题页面 */
.quiz-container {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 20px auto;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 24px;
    box-shadow: var(--md-sys-elevation-1);
}

.left-panel {
    width: 280px;
    padding-right: 24px;
}

.right-panel {
    flex: 1;
}

.mode-section, .progress-section {
    margin-bottom: 32px;
}

h3 {
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 400;
}

#mode-select {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--md-sys-typescale-body-large-size);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

#mode-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 11px 15px;
}

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

.q-num {
    padding: 8px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    text-align: center;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    font-size: var(--md-sys-typescale-body-medium-size);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

.q-num:hover {
    background: var(--md-sys-color-surface-variant);
    box-shadow: var(--md-sys-elevation-1);
}

.q-num.unanswered {
    background: var(--md-sys-color-surface);
}

.q-num.correct {
    background: var(--md-sys-color-success);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-success);
}

.q-num.incorrect {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    border-color: var(--md-sys-color-error);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

#question-number {
    font-size: var(--md-sys-typescale-title-large-size);
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

/* Material 3 Text Button */
.back-btn {
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    cursor: pointer;
    color: var(--md-sys-color-primary);
    font-weight: 500;
    font-size: var(--md-sys-typescale-body-large-size);
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    position: relative;
    overflow: hidden;
}

.back-btn:hover {
    background: rgba(103, 80, 164, 0.08);
}

.question-text {
    font-size: var(--md-sys-typescale-body-large-size);
    margin-bottom: 24px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* Material 3 Option Cards */
.option {
    padding: 16px 20px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-medium);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
    font-size: var(--md-sys-typescale-body-large-size);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    position: relative;
    overflow: hidden;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--md-sys-color-primary);
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.option:hover::before {
    opacity: 0.08;
}

.option.selected {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px 19px;
}

.option.correct {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-success);
    border-color: var(--md-sys-color-success);
}

.option.incorrect {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border-color: var(--md-sys-color-error);
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

/* Material 3 Info Card */
.explanation {
    background: var(--md-sys-color-tertiary-container);
    border-left: 4px solid var(--md-sys-color-tertiary);
    padding: 16px;
    margin: 20px 0;
    border-radius: var(--md-sys-shape-corner-medium);
    display: none;
    white-space: pre-line;
    line-height: 1.6;
    color: var(--md-sys-color-on-tertiary-container);
}

.explanation.show {
    display: block;
    animation: slideIn var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navigation {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
}

.navigation button {
    padding: 10px 24px;
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: 500;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    box-shadow: var(--md-sys-elevation-1);
    position: relative;
    overflow: hidden;
}

.navigation button:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.navigation button:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.08);
}

.navigation button:disabled {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    cursor: not-allowed;
    opacity: 0.38;
    box-shadow: none;
}

/* Material 3 Modal Dialog */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--md-sys-color-surface);
    margin: 10% auto;
    padding: 24px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    width: 90%;
    max-width: 560px;
    position: relative;
    box-shadow: var(--md-sys-elevation-3);
    animation: modalSlideIn var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

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

.close {
    color: var(--md-sys-color-on-surface-variant);
    float: right;
    font-size: 28px;
    font-weight: 400;
    cursor: pointer;
    line-height: 1;
    transition: color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.close:hover {
    color: var(--md-sys-color-on-surface);
}

.modal-content h2 {
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-headline-medium-size);
    font-weight: 400;
    margin-bottom: 16px;
}

.modal-content ul {
    list-style-position: inside;
    line-height: 2;
    margin-top: 16px;
    color: var(--md-sys-color-on-surface-variant);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .quiz-container {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        border-right: none;
        padding-right: 0;
        padding-bottom: 24px;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }
    
    .button-group {
        flex-direction: column;
    }

    .container {
        margin: 40px auto;
        padding: 32px 24px;
    }

    h1 {
        font-size: 24px;
    }
}

/* 状态提示卡片 */
.stats-card {
    text-align: center;
    margin-top: 24px;
    padding: 20px;
    background: var(--md-sys-color-success-container);
    border-radius: var(--md-sys-shape-corner-large);
    color: var(--md-sys-color-success);
    box-shadow: var(--md-sys-elevation-1);
}

/* Ripple Effect (可选) */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}