/* =============================================
 * 素材背诵工具 - 全局样式 v3
 * ============================================= */

/* --- CSS 变量 --- */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #4338CA;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --bg: #ffffff;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --nav-height: 56px;
    --header-height: 48px;
    --font-base: 16px;
    --transition: all 0.2s ease;
}

/* --- 深色模式变量 --- */
[data-theme="dark"] {
    --text: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-tertiary: #6B7280;
    --bg: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #374151;
    --border: #374151;
    --border-light: #4B5563;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* --- 基础重置 --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: var(--font-base);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
    background: none;
    color: inherit;
}

textarea { resize: none; }
button { cursor: pointer; }

.hidden { display: none !important; }

/* =============================================
 * 登录页面
 * ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-icon {
    color: var(--primary);
    margin-bottom: 16px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 4px;
}

.login-desc {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-wrap { position: relative; }

.login-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: #FAFAFA;
}

.login-input:focus {
    border-color: var(--primary);
    background: white;
}

.login-btn {
    width: 100%;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
}

.login-btn:active {
    transform: scale(0.98);
    background: var(--primary-dark);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 18px;
}

/* =============================================
 * 应用主框架
 * ============================================= */
.app-container {
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 12px);
    position: relative;
    background: var(--bg);
}

.page {
    padding: 12px 16px 20px;
    animation: pageIn 0.25s ease;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    height: var(--header-height);
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

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

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
}

.icon-btn:active {
    background: var(--bg-tertiary);
    color: var(--primary);
    border-color: var(--primary-light);
}

/* =============================================
 * 快捷筛选按钮（素材页顶部）
 * ============================================= */
.quick-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-filter-btn {
    flex: 1;
    height: 36px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

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

/* =============================================
 * 底部导航栏
 * ============================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    height: var(--nav-height);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

[data-theme="dark"] .bottom-nav {
    background: rgba(17,24,39,0.92);
    border-top-color: var(--border);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 0;
    color: var(--text-tertiary);
    transition: var(--transition);
    font-size: 10px;
    background: none;
}

.nav-item svg { transition: var(--transition); }

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

.nav-item.active svg {
    stroke: var(--primary);
}

/* =============================================
 * 筛选栏
 * ============================================= */
.filter-bar, .recite-filter-bar, .play-filter-bar {
    margin-bottom: 12px;
}

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

.filter-select {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='%236B7280'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.tag-filter { position: relative; }

.tag-filter-btn {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tag-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    padding: 8px;
    display: none;
}

.tag-dropdown.show { display: block; }

.tag-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.tag-option:hover { background: var(--bg-secondary); }

.tag-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 32px 0 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.search-clear {
    position: absolute;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.search-clear.show {
    opacity: 1;
    pointer-events: all;
}

.search-history-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-history-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 46px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 40;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.search-history-dropdown.show { display: block; }

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:hover { background: var(--bg-secondary); }

.history-keyword {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-delete {
    color: var(--text-tertiary);
    padding: 3px 8px;
    font-size: 12px;
    flex-shrink: 0;
    border-radius: 4px;
}

.history-delete:active { background: var(--bg-tertiary); }

.history-clear-all {
    text-align: center;
    padding: 9px;
    color: var(--text-tertiary);
    font-size: 12px;
    border-top: 1px solid var(--border-light);
    cursor: pointer;
}

/* =============================================
 * 素材管理页面
 * ============================================= */
.material-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.material-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px 14px;
    position: relative;
    transition: var(--transition);
    border: 1px solid transparent;
}

.material-item.selected {
    background: #EEF2FF;
    border-color: var(--primary-light);
}

[data-theme="dark"] .material-item.selected {
    background: rgba(79,70,229,0.15);
    border-color: var(--primary);
}

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

.mat-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mat-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.mat-text {
    font-size: 15px;
    line-height: 1.6;
    word-break: break-all;
    flex: 1;
}

.mat-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.mat-actions button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.mat-actions button:active { background: var(--bg-tertiary); }
.mat-actions .btn-edit:active { color: var(--primary); }
.mat-actions .btn-highlight:active { color: var(--warning); }
.mat-actions .btn-delete:active { color: var(--danger); }

.mat-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-left: 28px;
}

.mat-category {
    font-size: 11px;
    color: var(--primary);
    background: rgba(79,70,229,0.1);
    padding: 2px 8px;
    border-radius: 100px;
}

.mat-tag {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 100px;
}

.mat-status {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

/* 状态标签 - 可点击切换 */
.status-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    border: 1px solid transparent;
}

.status-badge:active {
    transform: scale(0.92);
}

.status-badge.mastered {
    background: rgba(16,185,129,0.15);
    color: var(--success);
    border-color: rgba(16,185,129,0.3);
}

.status-badge.favorite {
    background: rgba(245,158,11,0.15);
    color: var(--warning);
    border-color: rgba(245,158,11,0.3);
}

.status-badge.inactive {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border-color: var(--border);
    opacity: 0.7;
}

.status-badge.inactive:active {
    opacity: 1;
}

/* 批量操作栏 */
.batch-action-bar {
    position: fixed;
    bottom: calc(var(--nav-height) + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: calc(768px - 32px);
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
    animation: slideUp 0.2s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.batch-action-bar span {
    font-size: 14px;
    font-weight: 500;
}

.batch-action-btns {
    display: flex;
    gap: 10px;
}

.batch-action-btns button {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.batch-action-btns .btn-cancel {
    background: rgba(255,255,255,0.2);
    color: white;
}

.batch-action-btns .btn-confirm {
    background: white;
    color: var(--primary);
}

.load-more {
    text-align: center;
    padding: 18px 0;
}

.load-more-btn {
    padding: 9px 26px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.load-more-btn:active {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 4px;
}

.empty-state .empty-tip {
    font-size: 13px;
    opacity: 0.7;
}

/* =============================================
 * 背诵页面
 * ============================================= */
.recite-options, .play-options {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.play-options-second {
    margin-top: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.mode-select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 10 6' fill='%236B7280'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.recite-count {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    padding: 4px 0;
}

/* 圆形开始背诵按钮 */
.start-recite-wrap {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.start-recite-btn {
    width: 100%;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.start-recite-btn.circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(79,70,229,0.4);
    font-size: 0;
}

.start-recite-btn.circle:active {
    transform: scale(0.93);
    background: var(--primary-dark);
}

/* 播放按钮 */
.start-play-btn {
    width: 100%;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    margin-top: 12px;
    transition: var(--transition);
}

.start-play-btn:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

/* 背诵卡片区域 */
.recite-card-area {
    animation: pageIn 0.3s ease;
}

.recite-progress {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.recite-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 28px 22px;
    min-height: 160px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}

.card-content {
    font-size: 18px;
    line-height: 2;
    text-align: center;
    word-break: break-all;
}

/* 挖空效果 */
.blank-char {
    display: inline-block;
    width: 1.8em;
    height: 1.8em;
    line-height: 1.8em;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin: 0 1px;
    vertical-align: middle;
    border-bottom: 2px solid var(--primary-light);
    color: transparent;
    transition: color 0.2s;
    cursor: pointer;
}

.blank-char.revealed {
    color: var(--text);
    background: rgba(79,70,229,0.1);
    border-bottom-color: var(--primary);
}

.normal-char {
    display: inline-block;
    min-width: 0.5em;
    line-height: 2;
}

.card-answer {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.card-answer.hidden { display: none; }

.recite-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.recite-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 46px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.recite-btn:active { transform: scale(0.97); }

.recite-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text);
}

.recite-btn.warning {
    background: rgba(245,158,11,0.12);
    color: var(--warning);
    border-color: rgba(245,158,11,0.25);
}

.recite-btn.warning.active {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.recite-btn.success {
    background: rgba(16,185,129,0.12);
    color: var(--success);
    border-color: rgba(16,185,129,0.25);
}

.recite-btn.success.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.recite-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-btn:active {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.exit-recite-btn {
    width: 100%;
    height: 42px;
    color: var(--text-tertiary);
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.exit-recite-btn:active {
    color: var(--danger);
    background: rgba(239,68,68,0.08);
}

/* =============================================
 * 播放页面
 * ============================================= */
.play-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 80px;
}

.play-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.play-item:active, .play-item.playing {
    background: #EEF2FF;
    border-left-color: var(--primary);
}

[data-theme="dark"] .play-item.playing {
    background: rgba(79,70,229,0.15);
}

.play-num {
    font-size: 12px;
    color: var(--text-tertiary);
    min-width: 24px;
    text-align: center;
}

.play-item-text {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.play-item-status {
    font-size: 11px;
    flex-shrink: 0;
}

/* 迷你播放器 */
.mini-player {
    position: fixed;
    bottom: calc(var(--nav-height) + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: calc(768px - 24px);
    background: var(--primary);
    color: white;
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
    box-shadow: 0 4px 16px rgba(79,70,229,0.4);
    animation: slideUp 0.25s ease;
}

.mini-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
    padding-right: 10px;
}

.mini-status {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.mini-text {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.95;
}

.mini-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mini-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.15s;
}

.mini-btn:active { background: rgba(255,255,255,0.2); }

.mini-btn.play-pause {
    background: rgba(255,255,255,0.25);
}

/* 全屏播放器 */
.full-player {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: pageIn 0.2s ease;
}

.full-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    height: 52px;
}

.full-player-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.full-player-title {
    font-size: 16px;
    font-weight: 600;
}

.full-player-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    font-size: 22px;
    line-height: 1.8;
    text-align: center;
    overflow-y: auto;
    word-break: break-all;
}

.full-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 20px 0;
}

.ctrl-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.ctrl-btn:active {
    transform: scale(0.93);
    background: var(--bg-tertiary);
}

.ctrl-btn.play-pause-large {
    width: 64px;
    height: 64px;
    background: var(--primary);
    color: white;
}

.ctrl-btn.play-pause-large:active { background: var(--primary-dark); }

.full-player-speed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 0 32px;
    font-size: 14px;
    color: var(--text-secondary);
}

.speed-select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

/* =============================================
 * 设置页面
 * ============================================= */
.stats-section, .settings-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    text-align: center;
    padding: 16px 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.stat-card:active {
    transform: scale(0.97);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,0.15);
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

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

.setting-label {
    font-size: 15px;
    flex-shrink: 0;
}

.setting-select {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 10 6' fill='%236B7280'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 26px;
    min-width: 120px;
}

/* 设置页文本输入 */
.setting-input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    min-width: 0;
}

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

.font-size-control {
    display: flex;
    align-items: center;
    gap: 14px;
}

.font-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 14px;
}

.font-btn:active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.08);
}

.font-size-val {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 44px;
    text-align: center;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker input[type="color"] {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
    background: var(--bg);
}

.color-val {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
}

.backup-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.backup-btn {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
    background: var(--bg);
}

.backup-btn:active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.06);
}

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

.backup-btn.primary:active {
    background: var(--primary-dark);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    color: var(--danger);
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.2);
}

.logout-btn:active {
    background: rgba(239,68,68,0.12);
}

/* =============================================
 * 弹窗模态框
 * ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% - 32px);
    max-width: 480px;
    max-height: 85vh;
    background: var(--bg);
    border-radius: 16px;
    z-index: 160;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalIn 0.2s ease forwards;
}

.modal.show { display: flex; }

.batch-mark-modal {
    max-width: 640px;
    max-height: 92vh;
    width: calc(100% - 16px);
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.modal-close:active {
    background: var(--bg-tertiary);
    color: var(--text);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.modal-tip {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.modal-btn {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    margin-top: 12px;
    transition: var(--transition);
}

.modal-btn:active { transform: scale(0.98); }

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

.modal-btn.primary:active { background: var(--primary-dark); }

/* 批量导入 */
.batch-textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.batch-textarea:focus { border-color: var(--primary); }

.batch-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}

.batch-select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.batch-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    min-height: 42px;
}

.batch-tag-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 13px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.batch-tag-option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 分类/标签管理列表 */
.add-item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.add-input {
    flex: 1;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

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

.add-btn {
    height: 42px;
    padding: 0 18px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.add-btn:active { background: var(--primary-dark); }

.item-list {
    max-height: 320px;
    overflow-y: auto;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 8px;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
}

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

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

.item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.item-actions button {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.item-actions button:active { background: var(--bg-tertiary); }
.item-actions .btn-edit-item:active { color: var(--primary); }
.item-actions .btn-del-item:active { color: var(--danger); }

/* =============================================
 * 重点标记网格
 * ============================================= */
.highlight-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.hl-btn {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    transition: var(--transition);
}

.hl-btn:active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.06);
}

.hl-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    margin-left: auto;
}

.hl-btn.primary:active { background: var(--primary-dark); }

.highlight-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.hl-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 36px;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.1s;
    background: var(--bg);
    touch-action: none;
}

.hl-char:active { transform: scale(0.92); }

.hl-char.selected {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
    font-weight: 600;
}

.hl-char.punctuation {
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

.hl-char.punctuation.selected {
    background: #d97706;
    color: white;
    border-color: #d97706;
}

/* =============================================
 * 批量标记页面
 * ============================================= */
.batch-mark-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 4px;
}

.batch-mark-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid var(--border-light);
}

.batch-mark-item .bm-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-mark-item .bm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.batch-mark-item .bm-grid .hl-char {
    min-width: 28px;
    height: 32px;
    font-size: 14px;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 22px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--text);
    z-index: 300;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    white-space: nowrap;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================
 * 响应式适配
 * ============================================= */
@media (min-width: 768px) {
    .app-container {
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
    }

    .material-item { padding: 16px 18px; }

    .recite-card {
        padding: 32px 28px;
        min-height: 200px;
    }

    .card-content { font-size: 20px; }

    .full-player-content { font-size: 26px; }

    .batch-mark-modal {
        width: calc(100% - 40px);
    }
}

@media (max-width: 360px) {
    .page { padding: 10px 12px; }

    .stats-grid { grid-template-columns: repeat(3, 1fr); }

    .recite-actions { flex-wrap: wrap; }

    .recite-btn { flex: 1 1 30%; }

    .start-recite-btn.circle {
        width: 56px;
        height: 56px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border);
}
