/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 简洁配色 */
    --primary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --lighter: #f8f9fa;
    --border: #dfe6e9;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --white: #ffffff;
    
    /* 阴影 */
    --shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    
    /* 动画 */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 顶部栏 */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 60px;
    height: 60px;
    display: block;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.stat-text {
    font-size: 0.875rem;
    color: var(--text-light);
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
}

/* 主容器 */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* 题目卡片 */
.question-card {
    background: var(--white);
    border-radius: 16px;
    padding: 4rem;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
    animation: fadeIn 0.6s var(--ease);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 题号 */
.question-number {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
}

.question-number .number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}

/* 题目显示 */
.question-display {
    margin-bottom: 3rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-text {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text);
    line-height: 1.6;
    text-align: center;
    max-width: 700px;
}

/* 答案显示 */
.answer-display {
    display: none;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--lighter);
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    animation: slideDown 0.4s var(--ease);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.answer-display.show {
    display: block;
}

.answer-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.answer-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
}

/* 输入区 */
.input-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.answer-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s var(--ease);
    font-family: inherit;
    background: var(--white);
}

.answer-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.answer-input::placeholder {
    color: var(--text-light);
}

.btn-submit {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--white);
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    white-space: nowrap;
}

.btn-submit:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

/* 操作按钮 */
.actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.btn {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    background: var(--white);
    font-family: inherit;
}

.btn-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-secondary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent);
    color: var(--white);
}

.btn-ghost {
    color: var(--text-light);
    border-color: var(--border);
}

.btn-ghost:hover {
    border-color: var(--text);
    color: var(--text);
}

/* 历史记录 */
.history-section {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    animation: fadeIn 0.6s var(--ease) 0.2s both;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-text {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    border-radius: 6px;
}

.btn-text:hover {
    background: var(--lighter);
    color: var(--text);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--lighter);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.history-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--lighter);
    border-radius: 8px;
    transition: all 0.3s var(--ease);
    animation: slideIn 0.3s var(--ease);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item:hover {
    background: var(--light);
}

.history-question {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.history-badge {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
}

.history-badge.correct {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.history-badge.wrong {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.history-badge.view {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent);
}

.history-answer {
    font-size: 0.875rem;
    color: var(--text-light);
    padding-left: 1.75rem;
}

/* 加载状态 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s var(--ease);
}

.modal.show {
    display: flex;
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--ease);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--lighter);
    color: var(--text);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}

.modal-close:hover {
    background: var(--light);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.hint-info {
    background: var(--lighter);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.hint-info p {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text);
}

.hint-info p:last-child {
    margin-bottom: 0;
}

.hint-info strong {
    color: var(--accent);
    font-weight: 600;
}

.hint-tip {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* 消息提示 */
.toast {
    display: none;
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    font-weight: 500;
    animation: slideDown 0.3s var(--ease);
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--accent);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
    }

    .logo-icon {
        width: 50px;
        height: 50px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .stats-bar {
        gap: 1.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .container {
        padding: 2rem 1.5rem;
    }

    .question-card {
        padding: 2rem 1.5rem;
    }

    .question-text {
        font-size: 1.5rem;
    }

    .input-section {
        flex-direction: column;
    }

    .btn-submit {
        width: 100%;
    }

    .actions {
        grid-template-columns: 1fr;
    }

    .answer-text {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .question-text {
        font-size: 1.25rem;
    }

    .answer-input {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .btn-submit {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }

    .modal-content {
        padding: 2rem 1.5rem;
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选中文本颜色 */
::selection {
    background: var(--accent);
    color: var(--white);
}
