:root {
    --bg-main: #F5F7FA;
    --bg-card: #FFFFFF;
    --primary: #0078D7;
    --primary-hover: #106EBE;
    --danger: #DC3545;
    --warning: #FFC107;
    --text-main: #333333;
    --text-light: #666666;
    --border: #DDDDDD;
    --selected: #E3F2FD;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* 核心：固定页面高度，禁止整体滚动 */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* App 容器，作为子页面的“相框” */
#app {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* 核心隔离：两个界面绝对定位，互不干扰 */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background-color: var(--bg-main);
}

.view.active {
    display: flex;
}

/* ============ 主菜单样式 ============ */
#menu-view {
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px;
    overflow-y: auto; /* 菜单自己滚动 */
    -webkit-overflow-scrolling: touch;
    min-height: 0; /* 修复 iOS 内部滚动生效的关键属性 */
    text-align: center;
}

#menu-view h1 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--primary);
}

#menu-stats {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 14px;
}

.btn-group {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: var(--primary-hover); transform: scale(0.98); }
.btn-warning { background: #FFF3CD; color: #856404; }
.btn-warning:active { background: #ffe8a1; transform: scale(0.98); }
.btn-secondary { background: #E0E6ED; color: var(--text-main); }
.btn-secondary:active { background: #cbd3dc; transform: scale(0.98); }
.btn-danger { background: #F8D7DA; color: var(--danger); }
.btn-danger:active { background: #f1b0b7; transform: scale(0.98); }

/* ============ 答题界面样式 ============ */
/* 注意：这里没有 #quiz-view，它直接继承上面的 .view */

#quiz-header {
    flex-shrink: 0;
    background: var(--bg-card);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding-top: max(10px, env(safe-area-inset-top));
    z-index: 10;
}

#quiz-title { font-weight: bold; font-size: 15px; }
.tag {
    background: var(--primary);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
}
.tag-orange { background: #FD7E14; }
.timer { color: var(--danger); font-weight: bold; font-size: 16px; }

#jump-bar {
    flex-shrink: 0;
    background: #FFF;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

#jump-bar input {
    width: 60px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 16px;
}

#jump-bar button {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
}

/* 核心滚动区域：增加 min-height: 0，彻底解决错题复习等场景滑不动的问题 */
#question-scroll-area {
    flex: 1; 
    min-height: 0; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    padding-bottom: 20px; 
}

.card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.image-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}
.image-box img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 选项卡片 */
.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 16px;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    word-break: break-all;
}

.option-card:active {
    transform: scale(0.99);
}

.option-card.selected {
    background: var(--selected);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,120,215,0.3);
}

.option-card.selected .option-text {
    font-weight: bold;
    color: var(--primary);
}

.option-prefix {
    font-weight: bold;
    font-size: 18px;
    color: var(--text-light);
    min-width: 25px;
    line-height: 1.5;
}
.option-card.selected .option-prefix {
    color: var(--primary);
}

/* 底部固定操作栏：不滚动 */
#quiz-footer {
    flex-shrink: 0;
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-top: 1px solid var(--border);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 10;
}

.btn-small {
    flex: 1;
    padding: 12px 0;
    font-size: 13px;
    border: 1px solid var(--border);
    background: #F8F9FA;
    border-radius: 6px;
    margin: 0 3px;
    font-weight: bold;
    color: var(--text-main);
}
.btn-small:active { background: #e2e6ea; }
.btn-small.btn-primary { background: var(--primary); color: white; border: none; }
.btn-small.btn-primary:active { background: var(--primary-hover); }
.btn-small.btn-danger { background: var(--danger); color: white; border: none; }
.btn-small.btn-danger:active { background: #c82333; }