/* ===== BM Tahun 3 - Tablet-First Layout ===== */

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

:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --accent: #FF6B6B;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E0E6ED;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', 'Noto Sans Tamil', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ===== 顶部导航栏 ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    height: 56px;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-left h1 {
    font-size: 18px;
    color: var(--primary);
    font-weight: 700;
}

.pet-toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.pet-toggle-btn:hover {
    background: rgba(0,0,0,0.08);
}

.top-bar-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-indicator {
    font-size: 15px;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.nav-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: var(--primary-dark);
}

.nav-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

#lang-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--card-bg);
    cursor: pointer;
}

#goto-page {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}

.goto-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
}

.remember-list-btn,
.notes-nav-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.remember-list-btn:hover,
.notes-nav-btn:hover {
    background: rgba(74,144,217,0.15);
}

/* ===== 主内容区 ===== */
.main-content {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* 左侧图片面板 */
.image-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E8ECF1;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.image-panel img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: 12px;
    color: var(--text-light);
    font-size: 14px;
}

/* 右侧文字面板 */
.text-panel {
    flex: 0 0 420px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
}

.text-panel .sentences-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* 旧 text-header 保留兼容 */
.text-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.text-header h2 {
    font-size: 16px;
    color: var(--primary);
}

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

.bookmark-btn {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 5px 10px;
    font-size: 15px;
}

.bookmark-btn:hover {
    border-color: #FFD700;
}

.bookmark-btn.active {
    color: #FFD700;
    border-color: #FFD700;
    background: rgba(255,215,0,0.1);
}

#notes-page-badge {
    display: inline-block;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 2px;
}

.action-btn.has-notes {
    background: #E53935 !important;
    animation: notePulse 2s ease-in-out infinite;
}

.action-btn.has-notes #notes-page-badge {
    background: rgba(255,255,255,0.25);
}

@keyframes notePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.action-btn:hover {
    background: var(--primary-dark);
}

.stop-btn {
    background: var(--accent);
}

.sentences-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    font-size: 15px;
}

/* 段落卡片 */
.paragraph-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.paragraph-card:hover {
    box-shadow: var(--shadow);
}

.paragraph-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.para-read-btn,
.para-fav-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.para-read-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.para-fav-btn.saved {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.paragraph-ms .sentence-line {
    margin-bottom: 6px;
}

/* 句子样式类型 */
.sentence-line.sentence-heading .word {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
}

.sentence-line.sentence-subheading .word {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.sentence-line.sentence-body .word {
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
}

/* 段落翻译 */
.paragraph-translation {
    margin-top: 8px;
    padding: 8px 10px;
    background: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
    display: none;
    line-height: 1.5;
}

.paragraph-translation.show {
    display: block;
}

.paragraph-translation.loading small {
    color: var(--text-light);
    font-style: italic;
}

/* 旧 sentence-card 样式保留兼容 */
.sentence-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.sentence-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.sentence-card.reading {
    border-color: var(--primary);
    background: #EBF3FC;
}

.sentence-ms {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.sentence-ms .word {
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 3px;
    transition: background 0.15s;
}

.sentence-ms .word:hover {
    background: var(--primary);
    color: white;
}

.sentence-ms .word.reading-word {
    background: var(--accent);
    color: white;
}

.sentence-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sentence-actions .translate-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sentence-actions .translate-btn:hover {
    background: var(--primary);
    color: white;
}

.sentence-actions .translate-btn.active {
    background: var(--primary);
    color: white;
}

.sentence-actions .read-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sentence-actions .read-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sentence-actions .sentence-add-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.sentence-actions .sentence-add-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sentence-actions .sentence-add-btn.saved {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.show-trans-btn.active {
    background: var(--accent) !important;
}

/* 翻译文本 */
.sentence-translation {
    margin-top: 8px;
    padding: 8px 10px;
    background: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
    display: none;
}

.sentence-translation.visible,
.sentence-translation.show {
    display: block;
}

.sentence-translation.loading small {
    color: var(--text-light);
    font-style: italic;
}

/* 单词弹出框 */
.word-popup {
    position: fixed;
    z-index: 1000;
}

.word-popup-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    min-width: 200px;
    max-width: 300px;
    position: relative;
}

.popup-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
}

.popup-word {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    padding-right: 20px;
}

.popup-translation {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

.popup-read-btn {
    margin-top: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}

/* 页码选择器（移动端） */
.page-selector-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-selector-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    max-width: 500px;
}

.page-selector-grid button {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    font-size: 13px;
    cursor: pointer;
}

.page-selector-grid button:hover {
    background: var(--primary);
    color: white;
}

.page-selector-grid button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.history-btn {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 5px 10px;
    font-size: 15px;
}

.history-btn:hover {
    border-color: var(--primary);
    background: rgba(74,144,217,0.08);
}

/* 书签列表项 */
.bookmark-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.bookmark-item:hover {
    background: #EBF3FC;
}

.bookmark-goto {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    font-family: inherit;
    flex: 1;
}

.bookmark-page {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.bookmark-date {
    font-size: 11px;
    color: var(--text-light);
}

.bookmark-remove {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.bookmark-remove:hover {
    color: #D32F2F;
}

/* 历史弹窗 */
.history-popup {
    position: fixed;
    top: 56px;
    right: 10px;
    width: 380px;
    max-height: 70vh;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.history-popup-header h4 {
    font-size: 15px;
    color: var(--primary);
    font-weight: 700;
}

.history-popup-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
}

.history-popup-close:hover {
    color: var(--accent);
}

.history-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:hover {
    background: #EBF3FC;
}

.history-item.current {
    background: rgba(74,144,217,0.1);
    border-left: 3px solid var(--primary);
}

.history-item-index {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 700;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.history-item-page {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    min-width: 60px;
}

.history-item-date {
    font-size: 11px;
    color: var(--text-light);
    flex: 1;
}

.empty-hint {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
    font-size: 14px;
}

/* ===== 宠物 ===== */
.pet-mascot {
    position: fixed;
    top: 60px;
    right: 15px;
    width: 80px;
    height: 80px;
    z-index: 150;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.pet-mascot:hover {
    transform: scale(1.1);
}

.pet-image {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.pet-speech-bubble {
    position: fixed;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    z-index: 151;
    max-width: 180px;
    text-align: center;
}

.pet-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: var(--card-bg);
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg);
}

.notes-page-list {
    margin-top: 10px;
}

.empty-hint {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
    font-size: 14px;
}

/* ===== 主页菜单 ===== */
.menu-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.menu-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: menuGlow 15s ease-in-out infinite;
}

@keyframes menuGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

.menu-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    padding: 40px 36px 28px;
    width: 480px;
    max-width: 90vw;
    animation: cardSlideUp 0.5s ease-out;
}

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

.menu-header {
    text-align: center;
    margin-bottom: 28px;
}

.menu-header h1 {
    font-size: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    margin-bottom: 6px;
}

.menu-subtitle {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.menu-btn:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(74,144,217,0.15);
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: white;
}

.menu-btn.primary:hover {
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.menu-btn.primary strong {
    color: white;
}

.menu-btn.primary small {
    color: rgba(255,255,255,0.8);
}

.menu-btn-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.menu-btn.primary .menu-btn-icon {
    background: rgba(255,255,255,0.2);
}

.menu-btn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-btn-text strong {
    font-size: 15px;
    color: var(--text);
    font-weight: 700;
}

.menu-btn-text small {
    font-size: 12px;
    color: var(--text-light);
}

.menu-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.pet-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-light);
    user-select: none;
    padding: 4px 0;
}

.pet-toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pet-toggle-label input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.pet-toggle-label input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-text {
    font-weight: 500;
}

/* ===== Teruskan Membaca 弹窗 ===== */
.continue-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fadeIn 0.2s ease;
}

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

.continue-popup-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px;
    width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    text-align: center;
}

.continue-popup-content h4 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 12px;
}

.continue-popup-content p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.continue-popup-content p strong {
    color: var(--text);
    font-size: 20px;
}

.continue-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.continue-popup-btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.continue-popup-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.continue-popup-btn.primary:hover {
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.continue-popup-btn {
    background: var(--bg);
    color: var(--text-light);
    border: 1px solid var(--border);
}

.continue-popup-btn:hover {
    background: var(--border);
}

/* ===== 侧面板 ===== */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-print-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
    transition: color 0.2s;
}

.panel-print-btn:hover {
    color: var(--primary);
}

/* 打印样式 - 只打印 Perlu Diingat 内容 */
@media print {
    body * {
        visibility: hidden !important;
    }
    #remember-panel, #remember-panel * {
        visibility: visible !important;
    }
    #remember-panel {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }
    .side-panel-header {
        border-bottom: 2px solid #333;
    }
    .panel-close, .panel-print-btn, .remember-filters, #remember-view-toggle {
        display: none !important;
    }
    .side-panel-body {
        overflow: visible !important;
        padding: 10px 0 !important;
    }
    .remember-item {
        page-break-inside: avoid;
        border-bottom: 1px solid #ddd;
        padding: 8px 0;
    }
    .remember-item:last-child {
        border-bottom: none;
    }
}

.side-panel-header h3 {
    font-size: 16px;
    color: var(--primary);
    font-weight: 700;
}

.panel-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
    transition: color 0.2s;
}

.panel-close:hover {
    color: var(--accent);
}

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

.side-panel-body textarea {
    width: 100%;
    height: 140px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.side-panel-body textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* 记住单词列表 */
.remember-sort-hint,
.notes-sentences-hint {
    padding: 6px 10px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 8px;
}

.remember-list,
.notes-sentence-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.remember-item,
.notes-sentence-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: move;
    transition: background 0.15s;
}

.remember-item-content {
    flex: 1;
    min-width: 0;
}

.remember-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

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

.remember-note-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.remember-note-btn:hover {
    background: var(--primary);
    color: white;
}

.remember-read-btn,
.remember-trans-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.remember-read-btn:hover {
    background: #4CAF50;
    color: white;
}

.remember-trans-btn:hover,
.remember-trans-btn.active {
    background: var(--primary);
    color: white;
}

.remember-item-translation {
    margin-top: 6px;
    padding: 6px 10px;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
}

.remember-note-display {
    margin-top: 6px;
    padding: 6px 10px;
    background: #FFF8E1;
    border-radius: 6px;
    font-size: 12px;
    color: #5D4037;
    line-height: 1.4;
    border-left: 3px solid #FFB300;
}

.remember-note-editor {
    margin-top: 6px;
}

.remember-note-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
    background: white;
    transition: border-color 0.2s;
}

.remember-note-input:focus {
    outline: none;
    border-color: var(--primary);
}

.remember-note-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.remember-note-save {
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.remember-note-save:hover {
    background: var(--primary-dark);
}

.remember-note-cancel {
    padding: 4px 12px;
    background: var(--bg);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.remember-note-cancel:hover {
    background: var(--border);
}

.remember-item:hover,
.notes-sentence-item:hover {
    background: #EBF3FC;
}

.remember-item.dragging,
.notes-sentence-item.dragging {
    opacity: 0.5;
    background: var(--primary);
}

.notes-sentence-item {
    cursor: move;
}

.drag-handle {
    color: var(--text-light);
    font-size: 14px;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.remember-word {
    flex: 1;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
}

.remember-word:hover {
    text-decoration: underline;
}

.notes-sentence-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
}

.remember-remove,
.notes-sentence-remove {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.remember-remove:hover,
.notes-sentence-remove:hover {
    color: #D32F2F;
}

.notes-current-page {
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    color: var(--primary);
    font-weight: 600;
}

.notes-add-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 12px;
    transition: background 0.2s;
}

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

.notes-editor {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.notes-editor-page {
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 600;
}

.notes-editor textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: white;
}

.notes-editor textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.notes-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notes-editor-save {
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.notes-editor-save:hover {
    background: var(--primary-dark);
}

.notes-editor-cancel {
    padding: 6px 16px;
    background: var(--bg);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.notes-editor-cancel:hover {
    background: var(--border);
}

.notes-sort-hint {
    padding: 4px 8px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.notes-page-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notes-page-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: move;
    transition: background 0.15s;
    border-left: 3px solid var(--border);
}

.notes-page-item.current {
    border-left-color: var(--primary);
    background: #EBF3FC;
}

.notes-page-item:hover {
    background: #EBF3FC;
}

.notes-page-item.dragging {
    opacity: 0.5;
    background: var(--primary);
}

.notes-page-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(74,144,217,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.notes-page-preview {
    flex: 1;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
    min-width: 0;
    word-break: break-word;
}

.notes-page-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.notes-page-edit {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.notes-page-edit:hover {
    background: var(--primary);
    color: white;
}

.notes-page-remove {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.2s;
}

.notes-page-remove:hover {
    color: #D32F2F;
}

/* ===== 标签弹窗 ===== */
.tag-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-popup-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.tag-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tag-popup-header h4 {
    font-size: 16px;
    color: var(--primary);
    font-weight: 700;
}

.tag-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.tag-popup-word {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 16px;
    word-break: break-word;
}

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

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.tag-checkbox:hover {
    background: #EBF3FC;
}

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

.tag-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-custom-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tag-custom-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.tag-custom-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.tag-add-custom {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 700;
}

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

.tag-save-btn {
    flex: 1;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.tag-save-btn:hover {
    background: var(--primary-dark);
}

.tag-cancel-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.tag-cancel-btn:hover {
    background: var(--border);
}

/* ===== 筛选标签 ===== */
.remember-filters {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--primary);
}

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

.tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-chip.active .tag-dot {
    background: white !important;
}

/* ===== 标签显示 ===== */
.remember-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    color: white;
    font-weight: 600;
}

/* ===== 笔记视图切换 ===== */
.notes-view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.notes-view-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    color: var(--text-light);
}

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

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

/* ===== 单词弹出框 ===== */
.word-popup {
    position: fixed;
    z-index: 1000;
}

.word-popup-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    min-width: 220px;
    max-width: 320px;
    position: relative;
    border: 1px solid var(--border);
}

.popup-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
}

.popup-word {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    padding-right: 20px;
}

.popup-translation {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 10px;
}

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

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.popup-btn.remember-btn {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.popup-btn.remember-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

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

/* ===== 响应式 ===== */
@media (max-width: 900px) or (orientation: portrait) {
    .main-content {
        flex-direction: column;
    }

    .image-panel {
        flex: 0 0 45vh;
        min-height: 250px;
    }

    .text-panel {
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}
