:root {
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-gray: #8E8E93;
    --ios-light-gray: #E5E5EA;
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-text: #000000;
    --dark-bg: #000000;
    --dark-card: #1C1C1E;
    --dark-text: #FFFFFF;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background: var(--ios-bg);
    color: var(--ios-text);
    min-height: 100vh;
}

body.dark-mode {
    background: var(--dark-bg);
    color: var(--dark-text);
}

.container { max-width: 900px; margin: 0 auto; padding: 12px; }

/* 导航栏 */
.navbar {
    background: var(--ios-card);
    border-bottom: 1px solid var(--ios-light-gray);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

body.dark-mode .navbar {
    background: rgba(28, 28, 30, 0.9);
    border-color: #38383A;
}

.navbar-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-title { font-size: 17px; font-weight: 600; }

.icon-btn {
    width: 32px; height: 32px;
    border: none; background: transparent;
    cursor: pointer; font-size: 18px;
    border-radius: 8px;
}

.icon-btn:hover { background: var(--ios-light-gray); }

/* 卡片 */
.card {
    background: var(--ios-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

body.dark-mode .card { background: var(--dark-card); }

.section-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }

/* 输入 */
.input-field {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--ios-light-gray);
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 10px;
}

body.dark-mode .input-field {
    background: var(--dark-card);
    border-color: #38383A;
    color: var(--dark-text);
}

/* 按钮 */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--ios-blue); color: white; }

.btn-secondary { background: var(--ios-light-gray); }

body.dark-mode .btn-secondary {
    background: #38383A;
    color: var(--dark-text);
}

.btn-danger { background: var(--ios-red); color: white; }

/* 统计 */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-item { text-align: center; padding: 12px; background: var(--ios-bg); border-radius: 12px; }

body.dark-mode .stat-item { background: #38383A; }

.stat-value { font-size: 22px; font-weight: 700; color: var(--ios-blue); }

.stat-label { font-size: 11px; color: var(--ios-gray); margin-top: 4px; }

/* 模式选择 */
.mode-selector { display: flex; gap: 8px; }

.mode-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--ios-light-gray);
    background: var(--ios-card);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

body.dark-mode .mode-btn {
    background: var(--dark-card);
    border-color: #38383A;
    color: var(--dark-text);
}

.mode-btn.active { background: var(--ios-blue); color: white; border-color: var(--ios-blue); }

/* 题目 */
.question-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.meta-tag {
    padding: 4px 10px;
    background: var(--ios-bg);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.meta-tag.type-single { background: rgba(0, 122, 255, 0.12); color: var(--ios-blue); }

.meta-tag.type-multi { background: rgba(255, 149, 0, 0.12); color: var(--ios-orange); }

.question-content {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.6;
    margin: 16px 0;
    padding: 16px;
    background: var(--ios-bg);
    border-radius: 12px;
}

body.dark-mode .question-content { background: #38383A; }

/* 选项 */
.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--ios-bg);
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

body.dark-mode .option-item { background: #38383A; }

.option-item.selected { border-color: var(--ios-blue); background: rgba(0, 122, 255, 0.08); }

.option-item.correct { border-color: var(--ios-green); background: rgba(52, 199, 89, 0.08); }

.option-item.wrong { border-color: var(--ios-red); background: rgba(255, 59, 48, 0.08); }

.option-key {
    width: 30px; height: 30px;
    min-width: 30px;
    background: var(--ios-card);
    border: 2px solid var(--ios-light-gray);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    margin-right: 12px;
}

.option-item.selected .option-key { background: var(--ios-blue); border-color: var(--ios-blue); color: white; }

.option-item.correct .option-key { background: var(--ios-green); border-color: var(--ios-green); color: white; }

.option-item.wrong .option-key { background: var(--ios-red); border-color: var(--ios-red); color: white; }

.option-text { font-size: 15px; line-height: 1.5; }

/* 结果 */
.result-banner {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    display: none;
}

.result-banner.show { display: flex; align-items: center; gap: 8px; }

.result-banner.correct { background: rgba(52, 199, 89, 0.12); color: var(--ios-green); }

.result-banner.wrong { background: rgba(255, 59, 48, 0.12); color: var(--ios-red); }

/* 解析 */
.explanation {
    margin-top: 16px;
    padding: 16px;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid var(--ios-blue);
    display: none;
}

.explanation.show { display: block; }

.explanation-title { font-weight: 700; color: var(--ios-blue); margin-bottom: 8px; }

/* 控制按钮 */
.controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.controls .btn { flex: 1; min-width: 80px; }

/* 收藏按钮 */
.favorite-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--ios-gray);
}

.favorite-btn.active { color: var(--ios-red); }

/* 加载 */
.loading { display: flex; flex-direction: column; align-items: center; padding: 60px; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--ios-light-gray);
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { margin-top: 16px; color: var(--ios-gray); font-size: 14px; }

/* 计时器 */
.timer {
    position: fixed;
    bottom: 20px;
    right: 16px;
    background: var(--ios-card);
    padding: 10px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

body.dark-mode .timer { background: var(--dark-card); }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--ios-card);
    border-radius: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
}

body.dark-mode .modal-content { background: var(--dark-card); }

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--ios-light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .modal-header { border-color: #38383A; }

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; }

.modal-body { padding: 16px; }

/* 设置 */
.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--ios-light-gray);
}

body.dark-mode .settings-option { border-color: #38383A; }

/* 开关 */
.switch { position: relative; width: 50px; height: 30px; }

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--ios-light-gray);
    border-radius: 30px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px; width: 26px;
    left: 2px; bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider { background: var(--ios-green); }

input:checked + .slider:before { transform: translateX(20px); }

/* 导航 */
.question-nav {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.nav-dot {
    aspect-ratio: 1;
    border: none;
    background: var(--ios-bg);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

body.dark-mode .nav-dot { background: #38383A; color: var(--dark-text); }

.nav-dot.current { background: var(--ios-blue); color: white; }

.nav-dot.answered { background: var(--ios-green); color: white; }

.nav-dot.wrong { background: var(--ios-red); color: white; }

/* 隐藏 */
.hidden { display: none !important; }