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

:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 24px 20px;
    text-align: center;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
}

.subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

/* 页面 */
.page {
    display: none;
    padding: 16px;
}

.page.active {
    display: block;
}

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

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
}

.stat-card.primary .stat-num { color: var(--primary); }
.stat-card.success .stat-num { color: var(--success); }
.stat-card.warning .stat-num { color: var(--warning); }
.stat-card.info .stat-num { color: var(--info); }

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

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 200px;
    min-width: 120px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}

/* 作业列表 */
.homework-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 批量删除栏 */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.batch-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.card-select-cb {
    width: 18px;
    height: 18px;
    accent-color: #007aff;
    cursor: pointer;
}

.batch-bar #selected-count {
    font-size: 13px;
    color: var(--gray-500);
    flex: 1;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* 选择框 */
.select-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--danger);
}

.homework-card.selecting {
    border: 2px solid var(--gray-200);
    transition: border-color 0.2s;
}

.homework-card.selecting.selected {
    border-color: var(--primary);
    background: #f0fdf4;
}

.homework-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.homework-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.homework-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.2s;
}

.homework-title:hover {
    background: var(--gray-100);
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-title-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 类型图标 */
.type-icons {
    display: flex;
    gap: 4px;
    margin-right: 6px;
}

.type-icon {
    font-size: 14px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.type-image {
    background: #dbeafe;
}

.type-pdf {
    background: #fee2e2;
}

.type-audio {
    background: #d1fae5;
}

.badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    flex-shrink: 0;
    margin-left: 8px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

.homework-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.homework-desc {
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 12px;
    line-height: 1.5;
}

.homework-actions {
    display: flex;
    gap: 8px;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: var(--primary-dark); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:active { background: #991b1b; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-danger { background: #fee2e2; color: var(--danger); }

.btn-block { width: 100%; }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* 导入页 */
.import-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.import-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.import-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.import-card h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.import-card p {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.import-card textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 13px;
    resize: none;
    margin-bottom: 12px;
}

/* 统计页 */
.stats-section {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.stats-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.stats-row {
    display: flex;
    justify-content: space-around;
}

.stats-item {
    text-align: center;
}

.stats-label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stats-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.insight-card {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--gray-700);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid var(--gray-200);
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 22px;
}

.nav-text {
    font-size: 10px;
}

/* 悬浮按钮 */
.fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.4);
    z-index: 100;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* FAB菜单 */
.fab-menu {
    position: fixed;
    bottom: 152px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 101;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    white-space: nowrap;
    transition: background 0.2s;
}

.fab-menu-item:active {
    background: var(--gray-50);
}

/* 音频提取 */
.audio-extract-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 12px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: var(--gray-500);
    text-align: center;
}

#audio-extract-player {
    width: 100%;
    margin-top: 8px;
}

/* 裁剪控件 */
.trim-controls {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.trim-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.trim-row label {
    width: 32px;
    font-size: 12px;
    color: var(--gray-600);
    flex-shrink: 0;
}

.trim-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 2px;
    outline: none;
}

.trim-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.trim-time-input {
    width: 52px;
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    flex-shrink: 0;
}

.trim-duration {
    font-size: 12px;
    color: var(--gray-500);
    text-align: center;
    margin: 8px 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-end;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* 粘贴区域 */
.paste-area {
    width: 100%;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 12px;
    background: var(--gray-50);
    text-align: left;
    outline: none;
}

.paste-area:focus {
    border-color: var(--primary);
}

.paste-area:empty:before {
    content: attr(placeholder);
    color: var(--gray-500);
}

.paste-area img {
    max-width: 100px;
    max-height: 100px;
    margin: 4px;
    border-radius: 4px;
    vertical-align: middle;
}

/* 图片预览 */
.paste-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.paste-preview:empty {
    display: none;
}

.preview-item {
    position: relative;
    display: inline-block;
}

.preview-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.preview-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* 帮助文本 */
.help-text {
    font-size: 11px;
    color: var(--gray-500);
    text-align: left;
    background: var(--gray-50);
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    line-height: 1.6;
}

/* 作业卡片图片 */
.homework-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.homework-images img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
}

.homework-images img:hover {
    transform: scale(1.05);
}

/* 图片查看弹窗 */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-viewer.show {
    display: flex;
}

.image-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* 高亮卡片 */
.import-card.highlight {
    border: 2px solid var(--primary);
    background: linear-gradient(180deg, #f0fdf4 0%, white 100%);
}

/* 拖拽区域 */
.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 30px 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
    background: var(--gray-50);
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: #f0fdf4;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-icon {
    font-size: 40px;
}

.drop-or {
    color: var(--gray-500);
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* 进度条 */
.import-progress {
    margin: 12px 0;
}

/* 导入结果 */
.import-result {
    margin-top: 12px;
    text-align: left;
}

.import-result:empty {
    display: none;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
}

.result-icon {
    flex-shrink: 0;
}

.result-text {
    flex: 1;
    color: var(--gray-700);
}

.result-images {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.result-images img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
}

/* PDF徽章 */
.homework-pdfs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.pdf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.homework-audios {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.audio-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* 视频样式 */
.homework-videos {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.video-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
}

.video-item video {
    max-width: 200px;
    max-height: 120px;
    border-radius: 6px;
}

.video-name {
    font-size: 12px;
    color: var(--gray-600);
}

.video-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #fae8ff;
    color: #86198f;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.type-video {
    background: #fae8ff;
}

/* PDF查看器 */
.pdf-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.pdf-viewer.show {
    display: flex;
}

.pdf-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1f2937;
    color: white;
}

.pdf-viewer-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.pdf-viewer-content {
    flex: 1;
    overflow: hidden;
}

/* 复习模态 */
.review-modal {
    max-width: 500px;
}

.review-modal .form-group {
    margin-bottom: 16px;
}

.review-modal label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-size: 14px;
}

.review-modal select,
.review-modal input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

.review-modal select:focus,
.review-modal input:focus {
    border-color: var(--primary);
    outline: none;
}

.review-stats {
    display: flex;
    justify-content: space-around;
    margin: 16px 0;
}

.review-stat {
    text-align: center;
}

.review-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.review-stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.review-history {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    margin: 12px 0;
}

.review-history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.review-history-item:last-child {
    border-bottom: none;
}

.review-quality {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.review-quality-0 { background: #ef4444; }
.review-quality-1 { background: #f97316; }
.review-quality-2 { background: #eab308; }
.review-quality-3 { background: #10b981; }
.review-quality-4 { background: #3b82f6; }
.review-quality-5 { background: #8b5cf6; }


#pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-badge {
    cursor: pointer;
}

.pdf-badge:hover {
    opacity: 0.8;
}

/* 打卡弹窗内容 */
.checkin-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.checkin-images img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid var(--gray-200);
}

.checkin-images img:hover {
    border-color: var(--primary);
}

.checkin-pdfs {
    margin-bottom: 12px;
}

.checkin-audios {
    margin-bottom: 12px;
}

.checkin-audios audio {
    width: 100%;
}

.audio-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-bottom: 8px;
}

.audio-name {
    font-size: 12px;
    color: var(--gray-600);
}

.homework-audios {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* 分类按钮 */
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: var(--primary);
}

.category-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ========== iPad 优化 ========== */

/* iPad 基础适配 */
@media only screen and (min-width: 768px) and (max-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) {
    /* 增大触摸目标 */
    .btn {
        min-height: 44px;
        padding: 12px 24px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 16px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        min-height: 44px;
    }
    
    .nav-btn {
        padding: 12px 8px;
        min-height: 48px;
    }
    
    .category-btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .select-checkbox {
        width: 24px;
        height: 24px;
    }
    
    /* 改善卡片间距 */
    .homework-card {
        padding: 20px;
    }
    
    .homework-actions {
        gap: 12px;
    }
    
    /* 弹窗居中显示（iPad 大屏） */
    .modal {
        align-items: center;
        justify-content: center;
    }
    
    .modal-content {
        max-width: 500px;
        max-height: 80vh;
        border-radius: 16px;
        margin: 0 20px;
    }
    
    /* 表单输入优化 */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* 防止 iOS 缩放 */
        padding: 14px 16px;
    }
    
    /* 视频播放器优化 */
    .video-item {
        position: relative;
    }
    
    .video-item video {
        max-width: 160px;
        max-height: 100px;
        border-radius: 8px;
    }
    
    /* 图片查看器优化 */
    .image-viewer img {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    /* PDF 查看器优化 */
    .pdf-viewer-content {
        height: 70vh;
    }
}

/* iPad 横屏优化 */
@media only screen and (min-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {
    /* 统计卡片网格优化 */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px 12px;
    }
    
    .stat-num {
        font-size: 28px;
    }
    
    /* 作业列表两列布局 */
    .homework-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* 导入页两列布局 */
    .import-section {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* 复习列表两列布局 */
    #review-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* 底部导航优化 */
    .bottom-nav {
        padding: 12px 0;
    }
    
    .nav-icon {
        font-size: 26px;
    }
    
    .nav-text {
        font-size: 12px;
    }
}

/* iPad 竖屏优化 */
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) {
    .page {
        padding: 20px;
    }
    
    .stats-grid {
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px 10px;
    }
    
    .homework-list {
        gap: 16px;
    }
    
    .homework-card {
        padding: 18px;
    }
}

/* iPad Pro 大屏优化 */
@media only screen and (min-width: 1194px) and (-webkit-min-device-pixel-ratio: 2) {
    .modal-content {
        max-width: 600px;
    }
    
    .homework-list {
        max-width: 900px;
        margin: 0 auto;
    }
    
    .import-section {
        max-width: 900px;
        margin: 0 auto;
    }
    
    #review-list {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* 触摸反馈优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .filter-btn:active {
        transform: scale(0.95);
    }
    
    .nav-btn:active {
        opacity: 0.7;
    }
    
    .homework-card:active {
        background: var(--gray-50);
    }
    
    .fab:active {
        transform: scale(0.9);
    }
    
    /* 防止 iOS 300ms 延迟 */
    * {
        touch-action: manipulation;
    }
}

/* iPad 安全区域适配 */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .header {
        padding-top: max(24px, env(safe-area-inset-top));
    }
}

/* 悬浮按钮位置优化（iPad） */
@media only screen and (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    .fab {
        bottom: 100px;
        right: 24px;
        width: 60px;
        height: 60px;
        font-size: 32px;
    }
    .fab-menu {
        bottom: 164px;
        right: 24px;
    }
}

/* 批量操作栏优化 */
@media only screen and (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    .batch-bar {
        padding: 12px 16px;
        gap: 16px;
    }
    
    .batch-select-all {
        font-size: 14px;
    }
}

/* 音频播放器优化 */
@media only screen and (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    audio {
        height: 40px;
    }
    
    .audio-item {
        padding: 12px;
    }
}

/* 投屏按钮优化 */
@media only screen and (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    .video-item div[style*="display:flex"] {
        gap: 12px;
    }
    
    .video-item .btn {
        white-space: nowrap;
    }
}

/* 防止 iPad 弹窗背景滚动 */
.modal.show {
    overflow: hidden;
}

/* 改善拖拽区域触摸体验 */
.drop-zone {
    min-height: 120px;
}

/* 粘贴区域触摸优化 */
.paste-area {
    min-height: 180px;
}

/* 全屏视频播放器 */
.fullscreen-video-player {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 3000;
    display: flex;
    flex-direction: column;
}

.fullscreen-video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 14px;
}

.fullscreen-video-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* 投屏按钮样式 */
.cast-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.cast-btn:active {
    opacity: 0.8;
}

/* 视频投屏提示 */
.video-cast-tip {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* 图片旋转按钮 */
.image-wrapper {
    position: relative;
    display: inline-block;
}

.image-rotate-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.image-wrapper:hover .image-rotate-btn {
    opacity: 1;
}

.image-rotate-btn:active {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

/* iPad 触摸时始终显示旋转按钮 */
@media (hover: none) and (pointer: coarse) {
    .image-rotate-btn {
        opacity: 1;
    }
}

/* 打卡弹窗图片旋转按钮 */
.checkin-images .image-wrapper {
    position: relative;
}

.checkin-images .image-rotate-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
}

/* ====== 播放列表样式 ====== */
.playlist-now-playing {
    text-align: center;
    margin-bottom: 8px;
}

.playlist-now-title {
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-now-meta {
    font-size: 12px;
    color: #86868b;
    margin-top: 4px;
}

.playlist-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.playlist-ctrl-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.playlist-ctrl-btn:hover {
    background: #e0e0e0;
}

.playlist-play-btn {
    width: 56px;
    height: 56px;
    background: #007aff;
    color: #fff;
    font-size: 24px;
}

.playlist-play-btn:hover {
    background: #0066d6;
}

.playlist-mode-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.2s;
}

.playlist-mode-btn:hover {
    background: #e0e0e0;
}

.playlist-mode-btn.active {
    background: #007aff;
    color: #fff;
}

.playlist-mode-text {
    font-size: 12px;
    color: #86868b;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
    transition: background 0.2s;
}

.playlist-item:hover {
    background: #f8f8f8;
}

.playlist-item.playing {
    background: #007aff08;
    border-left: 3px solid #007aff;
}

.playlist-item-index {
    font-size: 14px;
    color: #86868b;
    min-width: 24px;
    text-align: center;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item-meta {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
}

.playlist-item-duration {
    font-size: 12px;
    color: #86868b;
}

.playlist-item-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #ff3b3015;
    color: #ff3b30;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-item-remove:hover {
    background: #ff3b3030;
}

.playlist-empty {
    text-align: center;
    padding: 60px 20px;
    color: #86868b;
}

.playlist-empty .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ====== 熏听系统样式 ====== */

/* Tab 切换 */
.listening-tabs {
    display: flex;
    gap: 0;
    margin: 12px 0;
    background: #f2f2f7;
    border-radius: 10px;
    padding: 3px;
}

.listening-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: all 0.2s;
}

.listening-tab.active {
    background: white;
    color: #1c1c1e;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* 播放次数和复习标签 */
.playlist-play-count {
    display: inline-block;
    font-size: 12px;
    color: #86868b;
    margin-left: 6px;
    font-weight: 400;
}

.playlist-review-tag {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    margin-left: 6px;
    vertical-align: middle;
}

/* 日历 */
.listening-calendar {
    background: white;
    border-radius: 10px;
    padding: 6px 10px;
    margin: 8px 0;
}

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

.cal-arrow {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f2f2f7;
    font-size: 14px;
    color: #1c1c1e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-arrow:hover {
    background: #e5e5ea;
}

.cal-month {
    font-size: 16px;
    font-weight: 600;
    color: #1c1c1e;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 2px;
}

.cal-weekday {
    font-size: 12px;
    color: #86868b;
    font-weight: 500;
    padding: 1px 0;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.cal-day {
    aspect-ratio: 4/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    color: #1c1c1e;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.cal-day.empty {
    cursor: default;
}

.cal-day:not(.empty):hover {
    background: #f2f2f7;
}

.cal-day.today {
    border: 2px solid #007aff;
    font-weight: 600;
}

.cal-day.selected {
    background: #007aff;
    color: white;
}

.cal-day.selected .cal-dot {
    background: white !important;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin-top: 2px;
}

.cal-dot.active {
    background: #007aff;
}

.cal-dot.active-many {
    background: #007aff;
    width: 7px;
    height: 7px;
}

/* 日期详情 */
.listening-date-detail {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin: 12px 0;
}

.cal-empty-hint {
    text-align: center;
    padding: 24px 16px;
    color: #86868b;
    font-size: 14px;
}

.date-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.date-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1e;
}

.date-detail-list {
    display: flex;
    flex-direction: column;
}

.date-detail-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f2f2f7;
    gap: 10px;
    cursor: pointer;
}

.date-detail-item:last-child {
    border-bottom: none;
}

.date-detail-cb {
    width: 18px;
    height: 18px;
    accent-color: #007aff;
    flex-shrink: 0;
}

.date-detail-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-detail-meta {
    font-size: 12px;
    color: #86868b;
}

.date-detail-count {
    font-size: 12px;
    color: #86868b;
    margin-left: 4px;
}

.date-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.date-detail-actions .btn {
    flex: 1;
}

/* 自定义清单 */
.listening-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1e;
    margin: 16px 0 8px;
}

.listening-custom-lists {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-list-empty {
    text-align: center;
    padding: 32px 16px;
    color: #86868b;
    font-size: 14px;
}

.custom-list-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
}

.custom-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.custom-list-name {
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1e;
}

.custom-list-actions {
    display: flex;
    gap: 4px;
}

.custom-list-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-list-btn:hover {
    background: #f2f2f7;
}

.custom-list-items {
    display: flex;
    flex-direction: column;
}

.custom-list-empty-hint {
    text-align: center;
    padding: 16px;
    color: #c7c7cc;
    font-size: 13px;
}

.custom-list-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f2f2f7;
    gap: 8px;
}

.custom-list-item:last-child {
    border-bottom: none;
}

.custom-list-item-name {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-list-item-date {
    font-size: 12px;
    color: #86868b;
}

.custom-list-item-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: #f2f2f7;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-list-item-btn:hover {
    background: #e5e5ea;
}

.custom-list-item-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.custom-list-item-btn.remove {
    color: #ff3b30;
    background: #ff3b3015;
}

.custom-list-item-btn.remove:hover {
    background: #ff3b3030;
}

.custom-list-rename-input {
    font-size: 15px;
    font-weight: 600;
    border: 1px solid #007aff;
    border-radius: 6px;
    padding: 4px 8px;
    outline: none;
}

/* 加入自定义清单弹窗选择 */
.custom-list-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-list-pick-btn {
    padding: 12px 16px;
    border: 1px solid #e5e5ea;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-list-pick-btn:hover {
    background: #f2f2f7;
}

.custom-list-pick-btn.new-list {
    border-style: dashed;
    color: #007aff;
    text-align: center;
}

/* 复习阈值设置 */
.review-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}
.stat-card.warning {
    background: #fff3e0;
}

.stat-card.warning .stat-num {
    color: #ff9500;
}

/* ====== 每日打卡 ==================== */
.daily-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #e9e9eb;
}

.daily-arrow {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f2f2f7;
    font-size: 20px;
    color: #1c1c1e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.daily-arrow:hover {
    background: #e5e5ea;
}

.daily-date {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #1c1c1e;
    cursor: pointer;
}

.daily-today {
    padding: 6px 14px;
    border: 1px solid #007aff;
    border-radius: 16px;
    background: transparent;
    color: #007aff;
    font-size: 14px;
    cursor: pointer;
}

.daily-today:hover {
    background: #007aff;
    color: white;
}

.daily-btns {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
}

.daily-list {
    padding: 0 16px 100px;
}

.daily-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    padding: 16px 0 8px;
}

.daily-section-title.done {
    color: #34c759;
}

.daily-task-item {
    display: flex;
    align-items: center;
    padding: 14px;
    margin-bottom: 8px;
    background: white;
    border-radius: 12px;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.daily-task-item.done {
    opacity: 0.5;
}

.daily-check-btn {
    width: 26px;
    height: 26px;
    border: 2px solid #e5e5ea;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #34c759;
    flex-shrink: 0;
}

.daily-check-btn.checked {
    background: #34c759;
    border-color: #34c759;
    color: white;
}

.daily-task-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.daily-task-title {
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-task-meta {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
}

.daily-review-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: #ff9500;
    color: white;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.daily-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #c7c7cc;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.daily-remove-btn:hover {
    background: #ff3b3015;
    color: #ff3b30;
}