
        :root {
            --primary: #00a680;
            --text: #333;
            --gray: #999;
            --error: #ff4d4f;
            --bg: #f8f9fa;
            --card-bg: #fff;
            --line: #e0e0e0;
        }

        body {
            font-family: "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            height: 100vh;
            display: flex;
            flex-direction: column;
            background-color: var(--bg);
            color: var(--text);
            user-select: none;
        }

        .finish-page {
            font-family: "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }

        /* Header */
        header {
            padding: 12px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #fff;
            border-bottom: 1px solid #eee;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            z-index: 10;
            position: relative;
        }

        .status-group {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .pill {
            background: #f1f1f1;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 12px;
            color: #555;
            font-weight: 600;
        }

        .pill.mode-tag {
            color: #fff;
            background: var(--primary);
        }

        .pill.mode-tag.exam {
            background: #faad14;
        }

        /* Main App */
        #app-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: flex-start !important;
            justify-content:flex-start !important;
            padding: 20px;
            overflow-y: auto;
            position: relative;
        }

        /* Header logo wrapper */
        .logo-row { display:flex; align-items:center; gap:15px; }
        .logo-area { display:flex; align-items:center; cursor:pointer; }
        .logo-area img { height:36px; }

        /* Center the launch-screen content only */
#launch-screen { flex:1 0 auto; width:100%; display:flex; align-items:center; justify-content:center; }
        .book-item.card-cloud { border-left: 4px solid #722ed1 ; }
        .book-item.card-custom { border-left: 4px solid #00a680; }
        .card-icons { display:flex; gap:6px; align-items:center; }
        .card-icon { width:18px; height:18px; color:#888; }
        .card-icon.success { color:#27ae60; }
        .card-menu-trigger { background:none; border:none; cursor:pointer; padding:4px; display:flex; align-items:center; }
        .card-menu { position:absolute; right:8px; top:32px; background:#fff; border:1px solid #eee; border-radius:6px; box-shadow:0 8px 20px rgba(0,0,0,0.08); z-index:50; min-width:100px; }
        .card-menu .item { padding:8px 12px; cursor:pointer; font-size:13px; color:#555; }
        .card-menu .item:hover { background:#f7f7f7; color:#000; }

        .lib-empty-state {
            text-align: center;
            padding: 60px;
            color: #999;
            grid-column: 1 / -1;
        }

        /* Library Header Controls */
        .lib-controls {
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .lib-search {
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            width: 200px;
        }

        .lib-select {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            background: #fff;
        }

        /* Folder Card Styles */
        .lib-folder-card {
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            border: 1px solid #eee;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
        }

        .lib-folder-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            border-color: var(--primary);
        }

        .lib-folder-icon {
            height: 100px;
            background: #f0f9ff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 48px;
            color: #00a680;
        }

        .lib-folder-info {
            padding: 16px;
        }

        .lib-folder-title {
            font-weight: 700;
            font-size: 16px;
            color: #333;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .lib-folder-count {
            font-size: 12px;
            color: #888;
        }

        /* Detail View Styles */
        .lib-detail-header {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 24px;
        }

        .lib-back-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: #666;
            display: flex;
            align-items: center;
            font-size: 14px;
            padding: 0;
        }

        .lib-back-btn:hover {
            color: var(--primary);
        }

        .lib-detail-title {
            font-size: 24px;
            font-weight: 700;
            color: #333;
        }

        .lib-material-list {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 12px;
        }

        .lib-material-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: #fff;
            padding: 16px;
            border-radius: 8px;
            border: 1px solid #eee;
            transition: background 0.1s;
            flex-direction: column;
        }

        .lib-material-item:hover {
            background: #f9f9f9;
        }

        .lib-mat-info {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-direction: column;
        }

        .lib-mat-icon {
            width: 60px;
            height: 60px;
            background: #f0f0f0;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #888;
        }

        .lib-mat-name {
            font-weight: 600;
            color: #333;
        }

        .lib-mat-status {
            font-size: 12px;
            color: #999;
            margin-top: 2px;
        }

        .lib-mat-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        #translation-box {
            font-size: 24px;
            margin: 10px auto;
            color: #9b9b9b;
            min-height: 36px;
            text-align: center;
            transition: opacity 0.3s;
            font-weight: 300;
            font-family: "Microsoft YaHei";
        }

        #translation-box.reading-translation {
            font-size: 20px;
            margin-bottom: 5px !important;
            color: #666;
            font-weight: 500;
        }

        body.theme-dark #translation-box.reading-translation {
            color: #ddd;
        }

        .hidden {
            display: none;
        }

        .exit-btn {
            z-index: 1000;
            position: absolute;
            top: 8px;
            right: 10px;
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 6px;
            border-radius: 6px;
        }

        .exit-btn svg {
            width: 32px;
            height: 32px;
            fill: #999;
        }

        .exit-btn:hover svg {
            fill: #ff4d4f;
        }

        #progress {
            width: 100%;
            height: 6px;
            background: #eee;
            border-top: 1px solid #eee;
            border-bottom: 1px solid #eee;
        }

        #progress-fill {
            height: 100%;
            width: 0%;
            background: var(--primary);
            transition: width 0.2s;
        }

        /* Typing Engine */
        #typing-area {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 0;
            font-size: 40px;
            font-family: 'Courier New', monospace;
            line-height: 1.6;
            flex: 1;
            width: 100%;
            box-sizing: border-box;
        }

        #typing-content {
            display: flex;
            flex-wrap: nowrap;
            justify-content: center;
            align-items: flex-end;
            gap: 0;
            font-size: 40px;
            font-family: 'Courier New', monospace;
            line-height: 1.6;
            max-width: 95%;
        }

        .word-wrapper {
            border-bottom: 3px solid var(--line);
            margin: 0 12px 15px 0;
            padding: 0 2px;
            min-width: 30px;
            display: flex;
            justify-content: center;
            position: relative;
            transition: all 0.2s;
        }

        .word-wrapper.active {
            border-bottom-color: var(--primary);
        }

        .word-wrapper.error {
            border-bottom-color: var(--error);
        }

        .word-wrapper.ok {
            border-bottom-color: #27ae60;
        }

        .word-wrapper.active.ok {
            border-bottom-color: #27ae60;
        }

        .word-wrapper.incomplete {
            border-bottom-color: var(--error);
        }

        /* Alt Key Hint Overlay */
        .word-wrapper.active.show-hint::before {
            content: attr(data-word);
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            color: #ccc;
            pointer-events: none;
            z-index: 0;
            text-align: center;
        }

        .letter-slot {
            min-width: 24px;
            min-height: 28px;
            text-align: center;
            color: transparent;
            position: relative;
            z-index: 1;
            display: inline-block;
        }

        .letter-slot.typed {
            color: var(--text);
        }

        .letter-slot.typed.correct {
            color: var(--text);
        }

        .highlight-mode .letter-slot.typed.wrong {
            color: var(--error);
            font-weight: bold;
        }

        /* Cursor */
        .cursor {
            position: absolute;
            bottom: 4px;
            width: 2px;
            height: 60%;
            background: var(--primary);
            animation: blink 1s infinite;
        }

        @keyframes blink {
            50% {
                opacity: 0;
            }
        }

        /* Footer & Controls */
        footer {
            padding: 15px;
            background: #fff;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: center;
            gap: 30px;
            align-items: center;
            position: relative;
        }

        .btn-combo {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            border-radius: 20px;
            border: 1px solid #eee;
            background: #fff;
            cursor: pointer;
            color: #555;
            transition: all 0.2s;
            font-weight: 600;
            font-size: 14px;
        }

        .btn-combo svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
        }

        .btn-combo:hover {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .btn-combo.active {
            background: #e6fffa;
            border-color: #b5f5ec;
            color: var(--primary);
        }

        .next-btn {
            position: absolute;
            right: 20px;
            padding: 8px 20px;
            border-radius: 20px;
            background: #f0f0f0;
            border: none;
            cursor: pointer;
            font-weight: bold;
            color: #555;
        }

        .next-btn:hover {
            background: #e0e0e0;
        }

        /* Simple switch */
        .switch {
            position: relative;
            display: inline-block;
            width: 44px;
            height: 24px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .switch .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: #ccc;
            transition: .2s;
            border-radius: 24px;
        }

        .switch .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 2px;
            bottom: 2px;
            background: #fff;
            transition: .2s;
            border-radius: 50%;
        }

        .switch input:checked+.slider {
            background: var(--primary);
        }

        .switch input:checked+.slider:before {
            transform: translateX(20px);
        }

        /* Hint capsule */
        .hint-capsule {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            border-radius: 20px;
            border: 1px solid #eee;
            background: #fff;
            color: #555;
            font-weight: 600;
            font-size: 14px;
        }

        .hint-capsule svg {
            width: 18px;
            height: 18px;
        }

        /* Settings tabs */
        .tabs {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .tab-header {
            display: flex;
            gap: 8px;
            border-bottom: 1px solid #eee;
        }

        .tab-btn {
            padding: 8px 14px;
            border: none;
            background: #f5f5f5;
            border-radius: 10px 10px 0 0;
            cursor: pointer;
            font-weight: 600;
            color: #555;
        }

        .tab-btn.active {
            background: #e6fffa;
            color: var(--primary);
        }

        .tab-content {
            display: none;
            padding-top: 10px;
        }

        .tab-content.active {
            display: block;
        }

        /* Sidebar */
        #sidebar {
            position: fixed;
            left: 0;
            top: 0;
            bottom: 0;
            width: 340px;
            background: #fff;
            box-shadow: 5px 0 15px rgba(0, 0, 0, 0.05);
            transform: translateX(-100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 1000;
            display: flex;
            flex-direction: column;
        }

        #sidebar.open {
            transform: translateX(0);
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .book-list {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }

        .book-item {
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 8px;
            cursor: pointer;
            border: 1px solid #eee;
            transition: all 0.2s;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            background: #fff;
        }

        .book-item:hover {
            background: #f9f9f9;
            border-color: #ddd;
        }

        .book-item.vocab {
            background: #fff7e6;
            border-color: #ffe7ba;
        }

        .book-item.active {
            background: #e6fffa;
            border-color: #b5f5ec;
        }

        .book-item.sample {
            background: #f0f9ff;
            border-color: #bfe7ff;
            border-style: dashed;
        }

        .book-item.sample:hover {
            background: #e6f3ff;
            border-color: #9fd6ff;
        }

/* 👇👇👇 替换开始：让云端和自制卡片共享一套排版样式 👇👇👇 */
.book-item .card-cloud-row { display:flex; align-items:center; gap:12px; position:relative; width: 100%;}
.book-item .card-cloud-cover { flex:0 0 auto; }
.book-item .card-cloud-cover-img { width:40px; height:56px; object-fit:cover; border-radius:4px; background:#eee; display:block; }
.book-item .card-cloud-info { flex:1 1 auto; }
.book-item .card-cloud-info-meta { color:#666; font-size: 12px; margin-top: 4px; display: block;}
.book-item .card-cloud-actions { margin-left:auto; display:flex; align-items:center; gap:8px; }
/* 👆👆👆 替换结束 👆👆👆 */

        .sample-emoji {
            font-size: 26px;
            line-height: 1;
        }

        .score-badge {
            position: absolute;
            right: 10px;
            top: 10px;
            font-size: 12px;
            font-weight: bold;
            color: var(--primary);
        }

        .btn-detail {
            font-size: 11px;
            padding: 2px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: #fff;
            margin-top: 5px;
            display: inline-block;
            cursor: pointer;
        }

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

        .option-group {
            display: flex;
            gap: 10px;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: flex-start;
        }

        .option-group.disabled {
            opacity: 0.5;
            pointer-events: none;
            filter: grayscale(100%);
        }

        .option-group .option {
            padding: 8px 14px;
            border-radius: 16px;
            border: 1px solid #ddd;
            background: #fff;
            cursor: pointer;
            font-weight: 600;
            color: #555;
        }

        .option-group .option.active {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .finish-summary {
            color: #666;
        }

        .finish-info {
            color: #888;
        }

        body.theme-dark .finish-summary {
            color: #fff;
        }

        body.theme-dark .finish-info {
            color: #fff;
        }

        body.theme-dark #typing-area .letter-slot.typed,
        body.theme-dark #typing-area .letter-slot.typed.correct {
            color: #fff;
        }

        body.theme-dark #translation-box {
            color: #fff;
        }

        .theme-group {
            display: flex;
            gap: 16px;
            align-items: flex-start;
            flex-wrap: wrap;
        }

        .theme-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }

        .pill-btn {
            padding: 8px 16px;
            border-radius: 16px;
            border: 1px solid #ddd;
            background: #fff;
            cursor: pointer;
            font-weight: 600;
            color: #555;
        }

        .pill-btn.active {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .theme-thumb {
            width: 120px;
            height: 120px;
            background: #eee;
            border: 1px solid #ddd;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #999;
            font-size: 12px;
        }

        .bear {
            --fw: 320px;
            --ratio: 0.5625;
            width: var(--fw);
            height: calc(var(--fw) * var(--ratio));
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: 8px;
            z-index: 5;
            background-repeat: no-repeat;
            background-position: 0 0;
            pointer-events: none;
            will-change: background-position;
            backface-visibility: hidden;
            transform: translateX(-50%) translateZ(0);
            background-image: url('images/bear_atlas_720x405.png');
            background-size: calc(var(--fw) * 22) calc(var(--fw) * var(--ratio) * 3);
        }

        .overlay-tiles {
            display: flex;
            gap: 10px;
            flex-wrap: nowrap;
            justify-content: center;
            margin-bottom: 10px;
            margin-top: -20px;
        }

        .tile {
            padding: 12px 14px;
            border-radius: 8px;
            background: #fff7e6;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
            position: relative;
            cursor: pointer;
            transition: box-shadow .14s ease;
        }

        .tile:nth-child(2n) {
            background: #e6f7ff;
        }

        .tile:nth-child(3n) {
            background: #ffe6f1;
        }

        .reading-tiles {
            display: flex;
            gap: 0px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .reading-tile {
            padding: 12px 8px;
            border-radius: 8px;
            background: transparent;
            position: relative;
            cursor: pointer;
            transition: box-shadow .14s ease;
        }

        .reading-tile-text {
            font-size: 35px;
            font-weight: 700;
            color: #333;
        }

        .reading-tile-underline {
            position: absolute;
            left: 10px;
            right: 10px;
            bottom: 8px;
            height: 4px;
            background: #f2f2f2;
            border-radius: 2px;
            overflow: hidden;
        }

        .reading-tile-underline::after {
            content: "";
            position: absolute;
            left: 50%;
            top: 0;
            height: 100%;
            width: 0;
            transform: translateX(-50%);
            background: var(--primary);
            transition: width .24s ease-out;
        }

        .reading-tile:hover .reading-tile-underline::after {
            width: 100%;
        }

        .reading-tile.underline-sticky .reading-tile-underline::after {
            width: 100%;
        }

        .tile-text {
            font-size: 35px;
            font-weight: 700;
            color: #333;
        }

        .tile-underline {
            position: absolute;
            left: 10px;
            right: 10px;
            bottom: 8px;
            height: 4px;
            background: #27ae60;
            border-radius: 2px;
        }

        #show-result.show-result-card {
            top: 100px;
            position: absolute;
            left: 50%;
            transform: translate(-50%, -50%);
            background: #fff;
            border: 1px solid #eee;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
            border-radius: 10px;
            padding: 12px;
            margin-bottom: 12px;
        }

        .sr-exit-pill {
position: absolute;
    right: -10px;
    top: -10px;
    background: #27ae60;
    border: 1px solid #eee;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-radius: 25px;
    padding: 2px;
    font-size: 0px;
    color: #fff;
    cursor: pointer;
    z-index: 15;
            /*margin: 6px;*/
        }
        #show-result.hide-text .tile-text { visibility: hidden; color: transparent; }

        #show-result .sr-tiles {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: center;
        }

        #show-result .tile-text {
            font-size: 25px;
        }

        .sentence-instruction {
            color: #777;
            font-size: 20px;
            text-align: center;
            font-weight: 600;
        }

        .kbd {
            background: #eee;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 0 6px;
            font-size: 12px;
        }

        .check-pop {
            position: absolute;
            top: -26px;
            left: 50%;
            transform: translateX(-50%);
            color: #27ae60;
            animation: popCheck 700ms ease-out;
            pointer-events: none;
            z-index: 20;
        }

        .check-pop svg {
            width: 28px;
            height: 28px;
            stroke: currentColor;
        }

        @keyframes popCheck {
            0% {
                transform: translateX(-50%) scale(0.8);
                opacity: 0;
            }

            20% {
                transform: translateX(-50%) scale(1.1);
                opacity: 1;
            }

            100% {
                transform: translateX(-50%) scale(1);
                opacity: 0;
            }
        }

        .incomplete-pop {
            position: absolute;
            top: -22px;
            left: 50%;
            transform: translateX(-50%);
            background: #fffbe6;
            border: 1px solid #ffe58f;
            color: #d48806;
            font-size: 12px;
            padding: 2px 8px;
            border-radius: 6px;
            pointer-events: none;
            z-index: 20;
            white-space: nowrap;
            width: max-content;
            box-sizing: border-box;
        }

        .incomplete-pop::after {
            content: "";
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: -7px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 7px 7px 0 7px;
            border-color: #ffe58f transparent transparent transparent;
            z-index: 0;
        }

        .incomplete-pop::before {
            content: "";
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: -6px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 6px 6px 0 6px;
            border-color: #fffbe6 transparent transparent transparent;
            z-index: 1;
        }

        .bad-chip {
            display: inline-block;
            padding: 6px 10px;
            border-radius: 8px;
            font-weight: 700;
            font-size: 20px;
            margin: 4px;
            border: 1px solid #eee;
        }

        .bad-chip.c1 {
            background: #ffe6e6;
            color: #d4380d;
            border-color: #ffccc7;
        }

        .bad-chip.c2 {
            background: #fff1b8;
            color: #d48806;
            border-color: #ffe58f;
        }

        .bad-chip.c3 {
            background: #e6f7ff;
            color: #096dd9;
            border-color: #bae7ff;
        }

        .bad-chip.c4 {
            background: #f9f0ff;
            color: #722ed1;
            border-color: #d3adf7;
        }

        .smooth-zoom {
            animation: smoothZoom 300ms ease-out;
        }

        @keyframes smoothZoom {
            0% {
                transform: scale(0.97);
                opacity: 0;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .bottom-hint {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 16px;
            color: #bbb;
            background: transparent;
            padding: 2px 10px;
            border: none;
            border-radius: 12px;
            display: none;
        }

        #session-timer {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Courier New', monospace;
            font-size: 40px;
            color: #555;
            letter-spacing: 1px;
        }

        /* Vocab cards */
        .vocab-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 12px;
            border: 1px solid #eee;
            border-radius: 8px;
            background: #fff;
            margin-bottom: 8px;
        }

        .vocab-word {
            font-size: 22px;
            font-weight: 700;
        }

        .vocab-meta {
            color: #888;
            font-size: 12px;
        }

        .vocab-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* Start modal mode buttons */
        .mode-btns {
            display: grid;
            gap: 10px;
            grid-template-columns: repeat(2, 1fr);
        }

        .mode-btn {
            flex: 1;
            padding: 10px 12px;
            border-radius: 10px;
            border: 1px solid #eee;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            background: #f9f9f9;
        }

        .mode-btn .title {
            font-weight: 700;
        }

        .mode-btn .desc {
            color: #888;
            font-size: 12px;
        }

        .mode-btn.active {
            background: #e6fffa;
            border-color: #b5f5ec;
        }

        .mode-btn .check {
            margin-left: auto;
            opacity: 0;
        }

        .mode-btn .check svg {
            width: 28px;
            height: 28px;
            fill: var(--primary);
        }

        .mode-btn.active .check {
            opacity: 1;
        }

        .btn.active {
            background: var(--primary);
            color: #fff;
        }

        .shake-long {
            animation: shakeLong 1s ease-in-out;
        }

        @keyframes shakeLong {
            0% {
                transform: translateX(0)
            }

            10% {
                transform: translateX(-5px)
            }

            20% {
                transform: translateX(5px)
            }

            30% {
                transform: translateX(-4px)
            }

            40% {
                transform: translateX(4px)
            }

            50% {
                transform: translateX(-3px)
            }

            60% {
                transform: translateX(3px)
            }

            70% {
                transform: translateX(-2px)
            }

            80% {
                transform: translateX(2px)
            }

            90% {
                transform: translateX(-1px)
            }

            100% {
                transform: translateX(0)
            }
        }

        #toast-container {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 3000;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            pointer-events: none;
        }

        .toast-item {
            background: rgba(0, 0, 0, 0.85);
            color: #fff;
            padding: 10px 16px;
            border-radius: 8px;
            font-size: 14px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            animation: toastIn 0.3s ease-out forwards;
            pointer-events: auto;
            max-width: 80vw;
            text-align: center;
            line-height: 1.4;
        }

        .toast-item.hiding {
            animation: toastOut 0.3s ease-in forwards;
        }

        @keyframes toastIn {
            from {
                opacity: 0;
                transform: translateY(-20px) scale(0.9);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        @keyframes toastOut {
            from {
                opacity: 1;
                transform: translateY(0) scale(1);
            }

            to {
                transform: translateY(-10px) scale(0.9);
            }
        }

        .pill.ai-active {
            background: #f6ffed;
            color: #389e0d;
            border: 1px solid #b7eb8f;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            box-shadow: 0 1px 2px 0 #ccc;
        }
        .pill.ai-active:hover {
            box-shadow: none;
        }
        .pill.ai-inactive:hover {
            box-shadow: none;
        }
        .pill.ai-inactive {
            background: #fff7e6;
            color: #d46b08;
            border: 1px solid #ffd591;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            box-shadow: 0 1px 2px 0 #ccc;
        }

        #ai-config-popover {
            position: fixed;
            background: #fff;
            border: 1px solid #eee;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            border-radius: 8px;
            padding: 16px;
            z-index: 200;
            display: none;
            width: 300px;
            top: 60px;
            right: 85px;

        }

        #ai-config-popover .popover-close {
            position: absolute;
            top: 8px;
            right: 8px;
            background:none;
            padding: 4px;
            cursor: pointer;
            border: none;
        }
        #ai-config-popover .popover-close:hover {
            
            color: var(--primary);
        }

        #ai-config-popover h4 {
            margin: 0 0 10px 0;
            font-size: 14px;
            color: #333;
        }

        .word-popover {
            position: absolute;
            background: #fff;
            border: 1px solid #eee;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            padding: 12px;
            z-index: 2100;
            display: none;
            min-width: 200px;
            max-width: 320px;
            font-size: 14px;
            line-height: 1.5;
        }

        .word-popover .wp-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .word-popover .wp-word {
            font-weight: 800;
            font-size: 18px;
            color: #333;
        }

        .word-popover .wp-phon {
            color: #888;
            font-size: 12px;
        }

        .word-popover .wp-explains {
            margin-top: 6px;
            font-size: 14px;
            color: #555;
        }

        .word-popover .wp-actions {
            display: flex;
            gap: 8px;
            margin-top: 8px;
            justify-content: flex-end;
        }

        .word-popover::after,
        .word-popover::before {
            content: "";
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            border-style: solid;
        }

        .word-popover[data-pos="top"]::after {
            border-width: 8px 8px 0 8px;
            border-color: #fff transparent transparent transparent;
            bottom: -8px;
        }

        .word-popover[data-pos="top"]::before {
            border-width: 9px 9px 0 9px;
            border-color: #eee transparent transparent transparent;
            bottom: -9px;
        }

        .word-popover[data-pos="bottom"]::after {
            border-width: 0 8px 8px 8px;
            border-color: transparent transparent #fff transparent;
            top: -8px;
        }

        .word-popover[data-pos="bottom"]::before {
            border-width: 0 9px 9px 9px;
            border-color: transparent transparent #eee transparent;
            top: -9px;
        }

        /* Modals */
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            backdrop-filter: blur(3px);
        }

        .modal-content {
            background: white;
            padding: 25px;
            border-radius: 12px;
            width: 600px;
            max-width: 90%;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            max-height: 85vh;
            overflow-y: auto;
        }

        .modal-footer {
            position: sticky;
            bottom: 0;
            background: #fff;
            padding-top: 10px;
        }

        /* Details Grid */
        .detail-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            margin-top: 15px;
        }

        .detail-row {
            padding: 10px;
            background: #f9f9f9;
            border-radius: 6px;
            border-left: 4px solid #ccc;
            font-size: 14px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .detail-row.correct {
            border-left-color: var(--primary);
        }

        .detail-row.wrong {
            border-left-color: var(--error);
        }

        .w-highlight {
            color: var(--error);
            font-weight: bold;
            text-decoration: underline;
        }

        /* Form Elements */
        .btn {
            padding: 8px 20px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 14px;
            transition: 0.2s;
        }

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

        .btn-danger {
            background: #ff4d4f;
            color: white;
        }

        .btn-loading {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .spin {
            width: 16px;
            height: 16px;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        .setting-row {
            margin-bottom: 15px;
            display: flex;
            justify-content: flex-start;
            gap: 20px;
            align-items: flex-start;
            border-bottom: 1px #f2f2f2 dashed;
            padding-bottom: 8px;
        }

        input,
        select,
        textarea {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }

        #confetti-canvas {
            position: fixed;
            top: 0;
            left: 0;
            pointer-events: none;
            z-index: 9999;
        }

        .reading-area {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            padding: 20px 10px;
        }

        .reading-letter {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            font-weight: 700;
            color: #fff;
        }

        .reading-letter.c1 {
            background: #3b82f6;
        }

        .reading-letter.c2 {
            background: #ef4444;
        }

        .reading-letter.c3 {
            background: #10b981;
        }

        .reading-letter.c4 {
            background: #f59e0b;
        }

        .reading-letter.space {
            width: 16px;
            height: 40px;
            background: transparent;
        }

        #reading-controls {
            max-width: 900px;
            display: flex;
            gap: 80px;
            align-items: center;
            justify-content: center;
            padding: 10px;
        }

        #app-container {
            position: relative;
        }

        #reading-mode {
            position: relative;
        }

        #reading-body {
            position: fixed;
            left: 0;
            right: 0;
            top: var(--read-top, 120px);
            bottom: var(--read-bottom, 120px);
            overflow: hidden;
        }

        #reading-mode .lyrics-container {
            position: relative;
            height: 100%;
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        #reading-mode .lyrics-container::-webkit-scrollbar {
            display: none;
        }

        #reading-mode .lyrics-container {
            -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.35) 7%, rgba(0, 0, 0, 1) 17%, rgba(0, 0, 0, 1) 83%, rgba(0, 0, 0, 0.35) 93%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.35) 7%, rgba(0, 0, 0, 1) 17%, rgba(0, 0, 0, 1) 83%, rgba(0, 0, 0, 0.35) 93%, transparent 100%);
        }

        #reading-center-ind {
            position: absolute;
            right: 10px;
            top: 50%;
            display: flex;
            pointer-events: none;
            z-index: 10;
        }

        #reading-center-ind .info {
            display: inline-flex;
            margin-right: 0;
            gap: 6px;
            font-size: 12px;
            color: #666;
            pointer-events: none;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid var(--bd, #e5e7eb);
            background: var(--bg, #f7f7f8);
        }

        #reading-center-ind .info:hover {
            --bg: #e6fffa;
            --bd: #b5f5ec;
            border-color: var(--bd, #b5f5ec);
            background: var(--bg, #e6fffa);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        }

        #reading-center-ind .info.active {
            --bg: #e6fffa;
            --bd: #b5f5ec;
            color: #00a680;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        }

        #reading-center-ind .info .play {
            display: inline-flex;
            color: var(--primary);
        }

        body.theme-dark #reading-center-ind .info {
            color: #9aa3af;
            border-color: #374151;
            background: #1f2937;
        }

        body.theme-dark #reading-center-ind .info:hover {
            border-color: #4b5563;
            background: #2a3647;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
        }

        #reading-hover-pill {
            position: absolute;
            display: none;
            pointer-events: none;
            z-index: 20;
        }

        #reading-hover-pill .info {
            display: inline-flex;
            gap: 4px;
            font-size: 11px;
            color: #666;
            padding: 4px 8px;
            border-radius: 999px;
            border: 1px solid var(--bd, #e5e7eb);
            background: #fff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            align-items: center;
        }

        #reading-hover-pill .info svg {
            width: 16px;
            height: 16px;
        }

        #reading-hover-pill .info.active {
            border-color: #3b82f6;
            color: #3b82f6;
            background: rgba(59, 130, 246, .12);
        }

        body.theme-dark #reading-hover-pill .info {
            color: #9aa3af;
            border-color: #374151;
            background: #1f2937;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
        }

        body.theme-dark #reading-hover-pill .info.active {
            border-color: #3b82f6;
            color: #3b82f6;
            background: rgba(59, 130, 246, .18);
        }

        .rc-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            user-select: none;
            flex-direction: column;
            flex-wrap: nowrap;
        }

        .rc-circle {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        /* remove rotating radar ring */
        .rc-circle.play {
            background: rgba(59, 130, 246, .12);
            border: 2px solid #3b82f6;
            color: #3b82f6;
        }

        .rc-circle.rec {
            background: rgba(239, 68, 68, .12);
            border: 2px solid #ef4444;
            color: #ef4444;
        }

        .rc-circle.rec .rc-orbit {
            position: absolute;
            inset: 0;
            transform-origin: center;
        }

        .rc-circle.rec.recording .rc-orbit {
            animation: orbit 1.6s linear infinite;
        }

        .rc-circle.rec .rc-orbit-dot {
            position: absolute;
            width: 10px;
            height: 3px;
            border-radius: 50%;
            background: #ef4444;
            top: -6px;
            left: 50%;
            transform: translateX(-50%);
        }

        @keyframes orbit {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .rc-circle.user {
            background: rgba(16, 185, 129, .12);
            border: 2px solid #10b981;
            color: #10b981;
        }

        .rc-label {
            font-size: 14px;
            color: #a1a1a1;
        }

        .rec-lock a,
        .rec-lock button,
        .rec-lock .rc-btn,
        .rec-lock [onclick],
        .rec-lock [role="button"] {
            cursor: not-allowed !important;
        }

        .rec-lock #btn-rc-rec,
        .rec-lock #btn-rc-rec * {
            cursor: pointer !important;
        }

        .rc-btn.disabled {
            pointer-events: none;
            opacity: .5;
        }

        .rc-circle.user.disabled {
            border-color: #ccc;
            color: #999;
            background: rgba(200, 200, 200, .12);
        }

        @keyframes breathe {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.15);
            }

            100% {
                transform: scale(1);
            }
        }

        @keyframes ripple {
            0% {
                transform: scale(1);
                opacity: .6;
            }

            100% {
                transform: scale(1.5);
                opacity: 0;
            }
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .rc-circle .icon-breathe {
            animation: breathe 1.2s ease-in-out infinite;
            transform-origin: center;
        }

        .rc-progress {
            position: absolute;
            inset: 0;
            width: 44px;
            height: 44px;
            pointer-events: none;
            opacity: 0;
        }

        .rc-progress circle {
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            vector-effect: non-scaling-stroke;
            stroke-linecap: round;
            transform-origin: 50% 50%;
            transform: rotate(-90deg);
        }

        .mode-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .mode-tag svg {
            width: 16px;
            height: 16px;
        }

        .rc-step {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #9aa3af;
            cursor: pointer;
        }

        .rc-step:hover {
            color: var(--primary);
        }

        .rc-step svg {
            width: 26px;
            height: 26px;
        }

        .rc-autoplay-pop {
            position: absolute;
            top: -12px;
            left: 50%;
            transform: translate(-50%, -100%);
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 12px;
            line-height: 1;
            white-space: nowrap;
            cursor: pointer;
            transition: .2s;
            --bg: #f7f7f8;
            --fg: #9aa3af;
            --bd: #e5e7eb;
            background: var(--bg);
            color: var(--fg);
            border: 1px solid var(--bd);
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .rc-autoplay-pop:hover {
            filter: brightness(1.06);
        }

        .rc-autoplay-pop:hover:not(.active) {
            --bg: #f0f9ff;
            --fg: #3b82f6;
            --bd: #bfdbfe;
        }

        .rc-autoplay-pop.active {
            --bg: #3b82f6;
            --fg: #fff;
            --bd: #3b82f6;
        }

        .rc-autoplay-pop::before {
            content: none;
        }

        .rc-autoplay-pop::after {
            content: none;
        }

        .rc-autoplay-pop svg {
            width: 16px;
            height: 16px;
        }

        .lyrics-container {
            position: relative;
            height: 420px;
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .lyrics-container::-webkit-scrollbar {
            display: none;
        }

        .lyrics-list {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 18px;
            padding: 20px 10px;
            margin: 0 auto;
            max-width: 80%;
        }

        .lyric-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .lyric-en {
            font-size: 30px;
            line-height: 1.35;
            color: rgba(180, 180, 180, 0.6);
            transition: transform .5s ease, color .5s ease, opacity .5s ease;
            transform-origin: center;
            will-change: transform, color, opacity;
        }

        .lyric-cn {
            margin: 10px 0 10px;
            font-size: 26px;
            color: rgba(160, 160, 160, 0.6);
            transition: opacity .28s ease, color .28s ease;
        }

        .lyric-item.active .lyric-en {
            color: #333;
            transform: scale(1.17);
        }

        .lyric-item.active .lyric-cn {
            color: #888;
            opacity: 1;
            margin-top: 10px;
        }

        body.theme-dark .lyric-item.active .lyric-en {
            color: #fff;
        }

        .lyric-item.scroll-active .lyric-en {
            color: #333;
        }

        .lyric-item.scroll-active .lyric-cn {
            color: #888;
            opacity: 1;
        }

        body.theme-dark .lyric-item.scroll-active .lyric-en {
            color: #fff;
        }

        body.theme-dark .lyric-item .lyric-en {
            color: rgba(220, 220, 220, 0.35);
        }

        body.theme-dark .lyric-item .lyric-cn {
            color: rgba(200, 200, 200, 0.35);
        }

        body.theme-dark .reading-tile-text {
            color: #fff;
        }

        /* Listening Mode Styles */
        #listening-mode {
            width: 100%;
            max-width: 800px;
            margin: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 30px;
            align-self: center;
        }

        .listen-answer-area {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
            min-height: 60px;
            padding: 20px;
            border-radius: 12px;
            background: #fff;
            border: 2px dashed #ddd;
            width: 100%;
            transition: all 0.2s;
        }

        .listen-answer-area.ready {
            border-color: var(--primary);
            background: #f0fdf4;
        }

        .listen-answer-area.error {
            border-color: var(--error);
            animation: shakeLong 0.5s;
        }

        .listen-pool-area {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            justify-content: center;
            margin-top: 10px;
        }

        /* 复用 bad-chip 的配色逻辑，但在听力模式下叫 word-chip */
        .word-chip {
            font-size: 24px;
            padding: 8px 16px;
            border-radius: 12px;
            cursor: pointer;
            user-select: none;
            border: 1px solid transparent;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
            transition: transform 0.1s, opacity 0.2s;
            background: #fff;
            border-color: #eee;
            font-family: 'Courier New', monospace;
            font-weight: bold;
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            align-content: center;
            justify-content: center;
            align-items: center;
        }

        .word-chip:active {
            transform: scale(0.95);
        }

        .word-chip.used {
            opacity: 0;
            pointer-events: none;
            transform: scale(0.8);
        }

        /* 动态颜色类 (复用你原有的颜色变量) */
        .wc-1 {
            background: #e6f7ff;
            color: #096dd9;
            border-color: #91d5ff;
        }

        .wc-2 {
            background: #fff7e6;
            color: #d46b08;
            border-color: #ffd591;
        }

        .wc-3 {
            background: #f6ffed;
            color: #389e0d;
            border-color: #b7eb8f;
        }

        .wc-4 {
            background: #fff0f6;
            color: #c41d7f;
            border-color: #ffadd2;
        }

        .listen-controls {
            display: flex;
            gap: 20px;
            align-items: center;
        }

        .listen-btn-play {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: var(--primary);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 166, 128, 0.3);
            transition: transform 0.2s;
        }

        .listen-btn-play:hover {
            transform: scale(1.1);
        }

        .listen-btn-play:active {
            transform: scale(0.95);
        }

        .listen-btn-play:active {
            transform: scale(0.95);
        }

        /* --- New Library Styles --- */
        .lib-header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .lib-search-wrapper {
            flex: 1;
            display: flex;
            justify-content: center;
        }

        .lib-search-input {
            width: 100%;
            max-width: 500px;
            padding: 10px 16px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }

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

        .lib-sort-btn {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            color: #666;
        }

        .lib-exit-btn {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            color: #666;
            margin-left: 8px;
        }

        .lib-tabs {
            display: flex;
            gap: 30px;
            border-bottom: 1px solid #eee;
            margin-bottom: 20px;
        }

        .lib-tab {
            padding: 10px 0;
            cursor: pointer;
            color: #666;
            font-size: 15px;
            position: relative;
        }

        .lib-tab.active {
            color: var(--primary);
            font-weight: bold;
        }

        .lib-tab.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            width: 100%;
            height: 3px;
            background: var(--primary);
            border-radius: 3px 3px 0 0;
        }

        .lib-stat-line {
            text-align: right;
            color: #888;
            font-size: 13px;
            margin-bottom: 15px;
        }

        .lib-grid-new {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 20px;
        }

        .lib-card-new {
            background: #fff;
            border: 1px solid #eee;
            border-radius: 12px;
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
            cursor: pointer;
            position: relative;
        }

        #books-resource {
            width: 100%;
            max-width: 1400px;
            margin: 0 auto;
            padding-bottom: 40px;
        }

        .lib-card-new:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
        }

        .lib-card-cover {
            height: 200px;
            background: #f9f9f9;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            color: #ddd;
            position: relative;
        }

        .lib-card-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background: #52c41a;
            /* Green for Free */
            color: white;
            font-size: 12px;
            padding: 2px 8px;
            border-radius: 4px;
        }

        .lib-card-body {
            padding: 16px;
        }

        .lib-card-title {
            font-weight: bold;
            font-size: 16px;
            margin-bottom: 8px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .lib-card-tag {
            display: inline-block;
            color: #888;
            font-size: 12px;
            margin-bottom: 12px;
        }

        .lib-card-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #999;
            font-size: 12px;
        }

        .lib-card-pop {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* --- 笔记本编辑器样式 --- */
        #editor-container {
            border: 1px solid #27ae60;
            border-radius: 8px;
            background: #fafafa;
            /* 模拟纸张背景可选 */
            /* background-image: linear-gradient(#f1f1f1 1px, transparent 1px); background-size: 100% 40px; */
            max-height: 450px;
            overflow-y: auto;
            padding: 10px 0;
            box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02);
        }

        .notebook-row {
            display: flex;
            align-items: flex-start;
            padding: 8px 16px;
            border-bottom: 1px dashed #d6d6b3;
            /* 虚线分隔，像信纸 */
            transition: background 0.2s;
        }

        .notebook-row:hover,
        .notebook-row:focus-within {
            background: #fdfdfd;
            /* 聚焦高亮 */
        }

        /* 序号 */
        .nb-num {
            width: 30px;
            color: #818181;
            font-size: 15px;
            font-family: monospace;
            padding-top: 6px;
            flex-shrink: 0;
            text-align: right;
            margin-right: 12px;
            user-select: none;
        }

        /* 文本容器 */
        .nb-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .nb-cn-box {
            display: flex;
            gap: 6px;
            align-items: flex-start;
        }

        .nb-trans-btn {
            padding: 4px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: #fff;
            color: #555;
            cursor: pointer;
            font-size: 12px;
        }

        .nb-trans-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: #f9fffc;
        }

        /* 输入框通用样式 (去掉默认边框，像在纸上写字) */
        .nb-input {
            width: 100%;
            border: none;
            outline: none;
            font-size: 15px;
            line-height: 1.6;
            color: #333;
            background: transparent;
            padding: 0;
            resize: none;
            /* 禁止手动拉伸，我们会自动调整高度 */
            font-family: inherit;
            overflow: hidden;
        }

        .nb-input.en {
            font-weight: 500;
        }

        .nb-input.cn {
            font-size: 13px;
            color: #6e88af;
            margin-top: 2px;
            background: #fafafa;
            /* 译文稍微有点背景区分 */
            padding: 2px 4px;
            border-radius: 4px;
        }

        

        .nb-input::placeholder {
            color: #e0e0e0;
        }
    

                /* Fix for add-modal overflow */
                #add-modal .modal-content {
                    display: flex;
                    flex-direction: column;
                    overflow: hidden;
                }

                #add-modal .tabs {
                    flex: 1;
                    /* overflow-y: auto; */
                    min-height: 0;
                    margin-bottom: 10px;
                    padding-right: 5px;
                    /* Avoid scrollbar covering content */
                }

                #add-modal .modal-footer {
                    position: static;
                    flex-shrink: 0;
                    padding-top: 10px;
                    border-top: 1px solid #eee;
                }
            
        #btn-translate-all {
            border: 1px solid #ddd;
            background: #fff;
        }
        #btn-translate-all:hover {
            border-color: var(--primary);
        }
        #btn-translate-all.loading {
            border-color: var(--primary);
            box-shadow: 0 0 0 1px #b5f5ec inset;
        }
        .btn:disabled {
            cursor: not-allowed;
        }

/* 1. 针对“详情弹窗”的专属尺寸调整 */
#finish-modal .modal-content {
    width: 900px;           /* 宽度从默认600改大到900 */
    max-width: 95vw;        /* 手机端也不撑破屏幕 */
    height: 85vh;           /* 高度占屏幕的 85% */
    display: flex;
    flex-direction: column; /* 竖向布局 */
    padding: 0;             /* 清除默认内边距，为了更好控制滚动 */
}

/* 弹窗头部和底部 (保持固定，不随内容滚动) */
#finish-modal h3 {
    padding: 20px 25px 0 25px;
    margin: 0 0 10px 0;
    font-size: 22px;
}
#finish-score {
    padding: 0 25px 15px 25px;
    border-bottom: 1px solid #eee;
}
#finish-modal .modal-content > div:last-child { 
    /* 底部按钮区 */
    padding: 15px 25px 20px 25px;
    border-top: 1px solid #eee;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* 2. 内容滚动区 */
#finish-detail {
    flex: 1;                /* 自动撑满剩余高度 */
    overflow-y: auto;       /* 只有中间列表区域滚动 */
    padding: 0;
    background: #fdfdfd;    /* 微微的背景色区别 */
    max-height: none !important; 
    height: auto !important;
}

/* 3. 列表布局 */
.chapter-detail-list {
    display: flex;
    flex-direction: column;
}

.chapter-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* 左右比例 */
    gap: 30px;              /* 增加左右间距 */
    padding: 20px 25px;     /* 增加上下内边距，更宽松 */
    border-bottom: 1px solid #f0f0f0;
    align-items: baseline;  /* 文字基线对齐 */
}

.chapter-row:nth-child(even) {
    background-color: #fafafa;
}

.chapter-row:hover {
    background-color: #f0f9ff;
}

/* 4. 英文大字体优化 */
.col-en {
    color: #222;
    font-family: "Georgia", "Times New Roman", serif; /* 换成衬线体，更有书卷气，或者删掉这行用默认黑体 */
    font-size: 22px;        /* 🔥 核心修改：加大字号 */
    font-weight: 500;       /* 稍微加粗 */
    line-height: 1.5;       /* 增加行高 */
    letter-spacing: 0.3px;
}

/* 5. 中文样式搭配 */
.col-cn {
    color: #666;
    font-size: 16px;        /* 中文也稍微大一点 */
    line-height: 1.6;
}

/* 生词高亮样式 */
.vocab-highlight {
    color: #d46b08;
    background-color: #fff7e6;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    border-bottom: 2px solid #ffd591; /* 加粗下划线 */
    cursor: help;
}
