/* ===== 全局重置 ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #e0e5ec 0%, #e0e6 50%, #e4eaf5 100%);
    color: #1d1d1f;
    margin: 0;
    padding: 20px 16px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.4s ease, color 0.3s ease;
}
#home, #app {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}
/* ===== 毛玻璃卡片 ===== */
.glass-card, #home, .app-card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    padding: 24px 20px;
    transition: background 0.3s ease, border-color 0.3s ease;
}
#home {
    padding: 28px 24px;
}
/* ===== 状态栏 ===== */
.status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    position: relative;
}
.settings-trigger {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    padding: 0;
}
.settings-trigger:hover {
    background: rgba(255,255,255,0.5);
    transform: translateY(-50%) scale(1.05);
}
.settings-trigger svg {
    width: 20px;
    height: 20px;
    fill: #1d1d1f;
}
.user-info {
    font-size: 15px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    transition: 0.2s;
}
.user-info:hover {
    background: rgba(255,255,255,0.5);
}
.logout-btn {
    display: none;
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    border: 1px solid rgba(255,59,48,0.2);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: 0.2s;
}
.logout-btn:hover {
    background: rgba(255,59,48,0.25);
}

/* ===== 标题 ===== */
h1 {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 4px 0 20px;
}

/* ===== 毛玻璃按钮 ===== */
.glass-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    margin: 10px 0;
    border: none;
    border-radius: 18px;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04), inset 0 1px 1px rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.25s ease;
}
.glass-btn .btn-icon {
    font-size: 20px;
}
.glass-btn.primary {
    background: rgba(0, 113, 227, 0.25);
    border-color: rgba(0, 113, 227, 0.2);
    color: #0071e3;
}
.glass-btn.primary:hover {
    background: rgba(0, 113, 227, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.15);
}
.glass-btn.secondary {
    background: rgba(88, 86, 214, 0.2);
    border-color: rgba(88, 86, 214, 0.15);
    color: #5856d6;
}
.glass-btn.secondary:hover {
    background: rgba(88, 86, 214, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 86, 214, 0.12);
}
.glass-btn.danger {
    background: rgba(255, 59, 48, 0.18);
    border-color: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}
.glass-btn.danger:hover {
    background: rgba(255, 59, 48, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.12);
}

/* ===== 底部链接 ===== */
.footer-links {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(0,0,0,0.06);
    padding-top: 20px;
}
.glass-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #0071e3;
    font-weight: 500;
    font-size: 15px;
    padding: 6px 16px;
    border-radius: 30px;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    transition: 0.2s;
}
.glass-link svg {
    width: 18px;
    height: 18px;
    fill: #0071e3;
}
.glass-link:hover {
    background: rgba(255,255,255,0.5);
}

/* ===== 答题卡片内 ===== */
.app-card {
    padding: 20px;
}
#top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 16px;
    position: relative;
}
h2 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 16px;
    color: #1d1d1f;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* 环形进度 */
.progress-ring {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.progress-ring svg {
    transform: rotate(-90deg);
}
.progress-ring .bg {
    fill: none;
    stroke: rgba(0,0,0,0.06);
    stroke-width: 3;
}
.progress-ring .fg {
    fill: none;
    stroke: #34c759;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body.theme-dark .progress-ring .bg { stroke: rgba(255,255,255,0.1); }
body.theme-dark .progress-ring .fg { stroke: #66d9a0; }

/* 组内进度条 */
.group-progress {
    width: 100%;
    height: 3px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    margin: 12px 0 4px;
    overflow: hidden;
}
.group-progress .bar {
    height: 100%;
    background: linear-gradient(90deg, #34c759, #0071e3);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 0%;
}
body.theme-dark .group-progress { background: rgba(255,255,255,0.08); }

.opt {
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 14px;
    padding: 14px 18px;
    margin: 8px 0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #1d1d1f;
    position: relative;
    overflow: hidden;
}
.opt:active {
    transform: scale(0.97);
}
.opt .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(0,113,227,0.15);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
}
@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}
.opt.correct {
    background: rgba(52,199,89,0.2);
    border-color: rgba(52,199,89,0.4);
    color: #1e7e34;
    font-weight: 600;
    transform: scale(1.02);
}
.opt.wrong {
    background: rgba(255,59,48,0.15);
    border-color: rgba(255,59,48,0.3);
    color: #b3261e;
    font-weight: 600;
    transform: scale(0.98);
}

/* ===== 左下角导航按钮 ===== */
.glass-trigger {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06), inset 0 1px 1px rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: 0.2s;
}
.glass-trigger:active {
    transform: scale(0.92);
}
.glass-trigger svg {
    width: 24px;
    height: 24px;
    fill: #3a3a3c;
}

/* ===== 题号网格 ===== */
.folder-overlay {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(6px);
    z-index: 1000;
    opacity:0;
    pointer-events:none;
    transition: opacity 0.3s ease;
}
.folder-overlay.active {
    opacity:1;
    pointer-events:auto;
}
.grid-folder {
    position: fixed;
    bottom:0; left:0; width:100%; height:65vh;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(32px);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    border: 1px solid rgba(255,255,255,0.3);
    z-index: 1001;
    padding: 20px 20px 30px;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}
.grid-folder.active {
    transform: translate3d(0, 0, 0);
}
.folder-drag-handle {
    width: 40px;
    height: 5px;
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
    margin: 0 auto 16px;
}
.folder-grid-content {
    flex:1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding-bottom: 10px;
}
.qbtn {
    aspect-ratio:1;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    cursor: pointer;
    transition: 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.qbtn:active {
    transform: scale(0.9);
}
.qbtn.grid-correct {
    background: rgba(52,199,89,0.7) !important;
    color: #fff !important;
    border-color: transparent !important;
}
.qbtn.grid-wrong {
    background: rgba(255,59,48,0.7) !important;
    color: #fff !important;
    border-color: transparent !important;
}
.qbtn.grid-active {
    border: 2px solid #0071e3 !important;
    color: #0071e3 !important;
    background: rgba(0,113,227,0.1) !important;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalFadeIn {
    from { opacity:0; transform: scale(0.95) translateY(20px); }
    to { opacity:1; transform: scale(1) translateY(0); }
}
.modal-card {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-radius: 32px;
    padding: 28px 24px 24px;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 24px 64px rgba(0,0,0,0.08);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}
.modal-close {
    background: none;
    border: none;
    font-size: 26px;
    color: #86868b;
    cursor: pointer;
    padding: 0 8px;
}
.modal-info {
    font-size: 15px;
    color: #1d1d1f;
    margin-bottom: 18px;
}
.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.preset-btn {
    padding: 12px 0;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: 0.2s;
}
.preset-btn:hover {
    background: rgba(255,255,255,0.5);
}
.preset-btn.active {
    background: #0071e3;
    color: #fff;
    border-color: #0071e3;
    box-shadow: 0 4px 16px rgba(0,113,227,0.2);
}
.custom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.custom-row span {
    font-size: 15px;
    color: #1d1d1f;
}
#customQuantity {
    flex:1;
    min-width: 80px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    font-size: 15px;
    outline: none;
}
#customQuantity:focus {
    border-color: #0071e3;
}
.custom-confirm {
    padding: 10px 18px;
    background: rgba(0,113,227,0.15);
    color: #0071e3;
    border: 1px solid rgba(0,113,227,0.2);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.custom-confirm:hover {
    background: rgba(0,113,227,0.25);
}
.modal-preview {
    font-size: 14px;
    color: #86868b;
    padding: 10px 12px;
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    min-height: 30px;
    margin-bottom: 12px;
}
.modal-start-btn {
    width: 100%;
    padding: 16px;
    background: rgba(52,199,89,0.2);
    color: #2db84e;
    border: 1px solid rgba(52,199,89,0.2);
    border-radius: 18px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    backdrop-filter: blur(4px);
}
.modal-start-btn:hover {
    background: rgba(52,199,89,0.35);
    transform: scale(1.01);
}

/* ===== 设置面板 ===== */
.settings-card {
    max-width: 360px;
}
.settings-body {
    padding: 4px 0;
}
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.setting-item:last-child {
    border-bottom: none;
}
.setting-label {
    font-size: 15px;
    color: #1d1d1f;
}
#settingsBgPicker {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: none;
}
#settingsBgPicker::-webkit-color-swatch-wrapper {
    padding: 0;
}
#settingsBgPicker::-webkit-color-swatch {
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 50%;
}
#delaySelect {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    font-size: 14px;
    color: #1d1d1f;
    outline: none;
}
#delaySelect:focus {
    border-color: #0071e3;
}
/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: #34c759;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}
body.theme-dark .toggle-slider { background: #555; }
body.theme-dark .toggle-slider::before { background: #e0e0e0; }

/* 🆕 主题选项按钮 */
.theme-option-btn.active {
    border-color: #0071e3 !important;
    background: rgba(0,113,227,0.1) !important;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}
body.theme-dark .theme-option-btn {
    color: #e0e0e0 !important;
    border-color: rgba(255,255,255,0.08) !important;
}
body.theme-dark .theme-option-btn.active {
    border-color: #4dabf7 !important;
    background: rgba(77,171,247,0.15) !important;
    box-shadow: 0 0 0 3px rgba(77,171,247,0.15);
}

/* ===== 滑块样式 ===== */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(0,0,0,0.12);
    outline: none;
    transition: 0.2s;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0071e3;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,113,227,0.25);
    transition: 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0071e3;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0,113,227,0.25);
}
body.theme-dark input[type="range"] {
    background: rgba(255,255,255,0.15);
}
body.theme-dark input[type="range"]::-webkit-slider-thumb {
    background: #4dabf7;
}
body.theme-dark input[type="range"]::-moz-range-thumb {
    background: #4dabf7;
}

/* ===== Toast 提示 ===== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.toast-item {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
}
.toast-item.out {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
    from { opacity:0; transform: translateY(-20px) scale(0.95); }
    to { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity:1; transform: translateY(0) scale(1); }
    to { opacity:0; transform: translateY(-20px) scale(0.95); }
}

/* ===== 引导气泡 ===== */
.tooltip-bubble {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,113,227,0.9);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0,113,227,0.3);
    animation: tooltipIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tooltip-bubble::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(0,113,227,0.9);
}
.tooltip-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.tooltip-close:hover {
    background: rgba(255,255,255,0.3);
}
@keyframes tooltipIn {
    from { opacity:0; transform: translateX(-50%) translateY(20px); }
    to { opacity:1; transform: translateX(-50%) translateY(0); }
}

/* ===== 快捷键 KBD ===== */
kbd {
    display: inline-block;
    background: rgba(0,0,0,0.06);
    padding: 0 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #1d1d1f;
    min-width: 20px;
    text-align: center;
}
body.theme-dark kbd {
    background: rgba(255,255,255,0.08);
    color: #e0e0e0;
}

/* ===== 主题覆盖 ===== */
body.theme-dark {
    background: linear-gradient(135deg, #0f0f1a, #1a1a2e, #16213e) !important;
    color: #e0e0e0;
}
body.theme-dark #home,
body.theme-dark .app-card {
    background: rgba(30,30,60,0.6);
    border-color: rgba(255,255,255,0.08);
}
body.theme-dark .settings-trigger {
    background: rgba(40,40,80,0.4);
    border-color: rgba(255,255,255,0.08);
}
body.theme-dark .settings-trigger svg { fill: #ccc; }
body.theme-dark .glass-btn.primary {
    background: rgba(0,113,227,0.2);
    color: #4dabf7;
}
body.theme-dark .glass-btn.secondary {
    background: rgba(88,86,214,0.2);
    color: #a5a0ff;
}
body.theme-dark .glass-btn.danger {
    background: rgba(255,59,48,0.2);
    color: #ff6b6b;
}
body.theme-dark .glass-btn.danger:hover {
    background: rgba(255,59,48,0.35);
}
body.theme-dark .opt {
    background: rgba(50,50,80,0.4);
    color: #e0e0e0;
    border-color: rgba(255,255,255,0.08);
}
body.theme-dark .opt.correct {
    background: rgba(52,199,89,0.25);
}
body.theme-dark .opt.wrong {
    background: rgba(255,59,48,0.2);
}
body.theme-dark .modal-card {
    background: rgba(30,30,60,0.7);
    border-color: rgba(255,255,255,0.08);
}
body.theme-dark .preset-btn {
    background: rgba(50,50,80,0.4);
    color: #e0e0e0;
}
body.theme-dark .preset-btn.active {
    background: #0071e3;
}
body.theme-dark .modal-start-btn {
    background: rgba(52,199,89,0.2);
    color: #66d9a0;
}
body.theme-dark .modal-start-btn:hover {
    background: rgba(52,199,89,0.35);
}
body.theme-dark .modal-close { color: #aaa; }
body.theme-dark .setting-item { border-color: rgba(255,255,255,0.06); }
body.theme-dark .setting-label { color: #e0e0e0; }
body.theme-dark #settingsBgPicker::-webkit-color-swatch { border-color: rgba(255,255,255,0.1); }
body.theme-dark #delaySelect {
    background: rgba(40,40,80,0.4);
    color: #e0e0e0;
    border-color: rgba(255,255,255,0.08);
}
body.theme-dark input[type="range"] { background: rgba(255,255,255,0.12); }

body.theme-eye {
    background: linear-gradient(135deg, #f5e6d3, #f0dcc8, #f5e6d3) !important;
    color: #3d2a1a;
}
body.theme-eye #home,
body.theme-eye .app-card {
    background: rgba(245,235,220,0.7);
}
body.theme-custom {
    background: var(--custom-bg) !important;
}
body.bg-image {
    background: var(--custom-bg-image) !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    opacity: var(--bg-opacity, 1);
}
body.bg-image::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    backdrop-filter: blur(calc(var(--bg-blur, 0) * 1px));
    -webkit-backdrop-filter: blur(calc(var(--bg-blur, 0) * 1px));
    background: var(--custom-bg-image) !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    opacity: var(--bg-opacity, 1);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }
body.theme-dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* ============================================================
   🆕 多端适配优化
   ============================================================ */

/* --- 平板 / 小屏笔记本（640px ~ 1024px）双栏布局 --- */
@media (min-width: 640px) and (max-width: 1024px) {
    #home, #app {
        max-width: 100%;
        padding: 0 20px;
    }
    #app .app-card {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 20px;
        padding: 20px;
        align-items: start;
    }
    #app .app-card #top {
        grid-column: 1 / -1;
    }
    #app .app-card h2 {
        grid-column: 2;
        margin-top: 0;
    }
    #app .app-card .opt {
        grid-column: 2;
    }
    #app .app-card .group-progress {
        grid-column: 2;
    }
    .grid-sidebar {
        grid-column: 1;
        grid-row: 2 / span 10;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-right: 12px;
        border-right: 1px solid rgba(0,0,0,0.06);
        max-height: 400px;
        overflow-y: auto;
    }
    .grid-sidebar .qbtn-mini {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255,255,255,0.3);
        border: 1px solid rgba(255,255,255,0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 600;
        color: #1d1d1f;
        cursor: pointer;
        transition: 0.15s;
        flex-shrink: 0;
    }
    .grid-sidebar .qbtn-mini.correct { background: rgba(52,199,89,0.6); color: #fff; border-color: transparent; }
    .grid-sidebar .qbtn-mini.wrong { background: rgba(255,59,48,0.6); color: #fff; border-color: transparent; }
    .grid-sidebar .qbtn-mini.active { border-color: #0071e3; box-shadow: 0 0 0 2px rgba(0,113,227,0.2); }
    .grid-sidebar .qbtn-mini:hover { transform: scale(1.05); }
    body.theme-dark .grid-sidebar { border-color: rgba(255,255,255,0.06); }
    body.theme-dark .grid-sidebar .qbtn-mini {
        background: rgba(50,50,80,0.4);
        color: #ccc;
        border-color: rgba(255,255,255,0.06);
    }
    .glass-trigger { display: none; }
}

/* --- 桌面端（> 1024px）三栏布局 --- */
@media (min-width: 1024px) {
    body {
        padding: 32px 40px;
    }
    #home, #app {
        max-width: 900px;
    }
    #home {
        padding: 36px 32px;
    }
    #app .app-card {
        display: grid;
        grid-template-columns: 160px 1fr 180px;
        gap: 24px;
        padding: 28px 32px;
        align-items: start;
    }
    #app .app-card #top {
        grid-column: 1 / -1;
    }
    #app .app-card h2 {
        grid-column: 2;
        margin-top: 0;
    }
    #app .app-card .opt {
        grid-column: 2;
    }
    #app .app-card .group-progress {
        grid-column: 2;
    }
    #app .app-card .glass-btn {
        grid-column: 2;
        margin: 6px 0;
    }
    .grid-sidebar {
        grid-column: 1;
        grid-row: 2 / span 12;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding-right: 16px;
        border-right: 1px solid rgba(0,0,0,0.06);
        max-height: 450px;
        overflow-y: auto;
    }
    .grid-sidebar .qbtn-mini {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: rgba(255,255,255,0.3);
        border: 1px solid rgba(255,255,255,0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 600;
        color: #1d1d1f;
        cursor: pointer;
        transition: 0.15s;
        flex-shrink: 0;
        box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    }
    .grid-sidebar .qbtn-mini:hover { transform: scale(1.06); background: rgba(255,255,255,0.5); }
    .grid-sidebar .qbtn-mini.correct { background: rgba(52,199,89,0.65); color: #fff; border-color: transparent; }
    .grid-sidebar .qbtn-mini.wrong { background: rgba(255,59,48,0.65); color: #fff; border-color: transparent; }
    .grid-sidebar .qbtn-mini.active { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,0.15); }
    .stats-panel {
        grid-column: 3;
        grid-row: 2 / span 10;
        padding-left: 16px;
        border-left: 1px solid rgba(0,0,0,0.06);
        font-size: 14px;
        color: #86868b;
    }
    .stats-panel .stat-item {
        padding: 8px 0;
        border-bottom: 1px solid rgba(0,0,0,0.04);
        display: flex;
        justify-content: space-between;
    }
    .stats-panel .stat-item:last-child { border-bottom: none; }
    .stats-panel .stat-value { font-weight: 600; color: #1d1d1f; }
    .stats-panel .shortcut-hint {
        margin-top: 12px;
        padding: 12px;
        background: rgba(255,255,255,0.2);
        border-radius: 12px;
        font-size: 12px;
        color: #86868b;
        line-height: 1.8;
    }
    .stats-panel .shortcut-hint kbd {
        background: rgba(0,0,0,0.04);
        padding: 0 4px;
        border-radius: 3px;
        font-size: 11px;
    }
    body.theme-dark .grid-sidebar { border-color: rgba(255,255,255,0.06); }
    body.theme-dark .grid-sidebar .qbtn-mini {
        background: rgba(50,50,80,0.4);
        color: #ccc;
        border-color: rgba(255,255,255,0.06);
    }
    body.theme-dark .grid-sidebar .qbtn-mini:hover { background: rgba(50,50,80,0.6); }
    body.theme-dark .stats-panel { border-color: rgba(255,255,255,0.06); }
    body.theme-dark .stats-panel .stat-value { color: #e0e0e0; }
    body.theme-dark .stats-panel .shortcut-hint { background: rgba(255,255,255,0.04); }
    body.theme-dark .stats-panel .shortcut-hint kbd { background: rgba(255,255,255,0.06); color: #ccc; }
    .glass-trigger { display: none; }
}

/* --- 小屏手机（< 360px） --- */
@media (max-width: 360px) {
    body {
        padding: 12px 10px;
    }
    #home {
        padding: 16px 14px;
    }
    .app-card {
        padding: 14px 12px;
    }
    .glass-btn {
        padding: 12px;
        font-size: 14px;
        border-radius: 14px;
        margin: 6px 0;
    }
    .glass-btn .btn-icon {
        font-size: 16px;
    }
    h1 {
        font-size: 20px;
    }
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .preset-btn {
        padding: 10px 0;
        font-size: 14px;
    }
    .modal-card {
        padding: 20px 16px 18px;
    }
    .modal-title {
        font-size: 17px;
    }
    .opt {
        padding: 12px 14px;
        font-size: 14px;
    }
    .glass-trigger {
        width: 48px;
        height: 48px;
        left: 12px;
        bottom: 12px;
    }
    .glass-trigger svg {
        width: 20px;
        height: 20px;
    }
    .grid-folder {
        padding: 14px 12px 20px;
    }
    .folder-grid-content {
        gap: 8px;
    }
    .qbtn {
        font-size: 13px;
    }
    .settings-trigger {
        width: 32px;
        height: 32px;
    }
    .settings-trigger svg {
        width: 18px;
        height: 18px;
    }
    .status-bar {
        padding-left: 36px;
    }
}
/* ===== 章节导航栏 ===== */
.chapter-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}
.chapter-nav::-webkit-scrollbar {
    height: 3px;
}
.chapter-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 10px;
}
.chapter-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.chapter-btn:hover {
    background: rgba(255,255,255,0.5);
}
.chapter-btn.active {
    background: #0071e3;
    color: #fff;
    border-color: #0071e3;
    box-shadow: 0 2px 8px rgba(0,113,227,0.2);
}
body.theme-dark .chapter-btn {
    background: rgba(50,50,80,0.3);
    border-color: rgba(255,255,255,0.06);
    color: #aaa;
}
body.theme-dark .chapter-btn.active {
    background: #0071e3;
    color: #fff;
}
/* ===== 章节导航栏 ===== */
.chapter-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 8px;
    flex-wrap: nowrap;
    scrollbar-width: thin;
}
.chapter-nav::-webkit-scrollbar { height: 3px; }
.chapter-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }
.chapter-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chapter-btn:hover { background: rgba(255,255,255,0.5); }
.chapter-btn.active { background: #0071e3; color: #fff; border-color: #0071e3; box-shadow: 0 2px 8px rgba(0,113,227,0.2); }
body.theme-dark .chapter-btn { background: rgba(50,50,80,0.3); border-color: rgba(255,255,255,0.06); color: #aaa; }
body.theme-dark .chapter-btn.active { background: #0071e3; color: #fff; }
/* ===== 滑动切换动画 ===== */
#quizContent {
    transition: none; /* 由类控制 */
}
/* 滑出左 */
.slide-out-left {
    animation: slideOutLeft 0.25s ease forwards;
}
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-60px); opacity: 0; }
}
/* 滑出右 */
.slide-out-right {
    animation: slideOutRight 0.25s ease forwards;
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(60px); opacity: 0; }
}
/* 滑入左（新卡片从左侧出现） */
.slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}
@keyframes slideInLeft {
    from { transform: translateX(-60px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
/* 滑入右（新卡片从右侧出现） */
.slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInRight {
    from { transform: translateX(60px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 保留原来的淡入淡出（用于无方向跳转） */
.card-fade {
    animation: cardFade 0.18s ease forwards;
}
@keyframes cardFade {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}
/* ============================================================
   🖥️ 电脑端宽屏适配（充分利用屏幕空间）
   ============================================================ */

/* 平板及小屏笔记本（宽度 ≥ 768px） */
@media (min-width: 768px) {
    #home, #app {
        max-width: 720px;
    }
    #home {
        padding: 32px 28px;
    }
    .app-card {
        padding: 28px 24px;
    }
    .opt {
        padding: 16px 20px;
        font-size: 16px;
    }
    h2 {
        font-size: 20px;
    }
    .glass-btn {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* 桌面端（宽度 ≥ 1024px）—— 充分利用宽屏 */
@media (min-width: 1024px) {
    #home, #app {
        max-width: 900px;   /* 可根据喜好调整，例如 1000px 或 85% */
    }
    #home {
        padding: 40px 36px;
    }
    .app-card {
        padding: 32px 36px;
    }
    .opt {
        padding: 18px 24px;
        font-size: 17px;
    }
    h2 {
        font-size: 22px;
    }
    .glass-btn {
        padding: 16px 24px;
        font-size: 17px;
    }
    .glass-trigger {
        width: 64px;
        height: 64px;
        left: 32px;
        bottom: 32px;
    }
    .glass-trigger svg {
        width: 28px;
        height: 28px;
    }
    .chapter-nav {
        gap: 10px;
    }
    .chapter-btn {
        padding: 8px 18px;
        font-size: 14px;
    }
}

/* 超大屏（> 1400px）—— 可以更宽，但限制最大宽度避免阅读疲劳 */
@media (min-width: 1400px) {
    #home, #app {
        max-width: 1100px;
    }
    #home {
        padding: 48px 40px;
    }
    .app-card {
        padding: 38px 40px;
    }
}
/* ============================================================
   🖥️ 电脑端强制宽屏适配
   ============================================================ */

@media (min-width: 1024px) {
    #home, #app, .app-card {
        max-width: 100% !important;   /* 取消宽度限制 */
        width: 100% !important;
        padding: 32px 40px !important;
    }
    #app .app-card {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* 双栏布局，充分利用空间 */
        gap: 30px !important;
        align-items: start !important;
    }
    #app .app-card #top {
        grid-column: 1 / -1 !important;
    }
    #app .app-card h2 {
        grid-column: 1 !important;
    }
    #app .app-card .opt {
        grid-column: 1 !important;
    }
    .opt {
        padding: 18px 24px !important;
        font-size: 17px !important;
    }
    h2 {
        font-size: 22px !important;
    }
    /* 右侧统计面板 */
    .stats-panel {
        display: block !important;
        grid-column: 2 !important;
        grid-row: 2 / span 10 !important;
        padding: 16px 20px !important;
        background: rgba(255,255,255,0.3) !important;
        border-radius: 16px !important;
        border: 1px solid rgba(255,255,255,0.2) !important;
    }
    .stats-panel .stat-item {
        padding: 10px 0 !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        display: flex !important;
        justify-content: space-between !important;
        font-size: 15px !important;
    }
    .stats-panel .stat-item:last-child {
        border-bottom: none !important;
    }
    .stats-panel .stat-value {
        font-weight: 600 !important;
        color: #0071e3 !important;
    }
    .glass-trigger {
        left: 32px !important;
        bottom: 32px !important;
        width: 60px !important;
        height: 60px !important;
    }
    .glass-btn {
        padding: 16px 24px !important;
        font-size: 17px !important;
    }
}
