:root {
    --primary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #08111f;
    --sidebar-bg: #0f172a;
    --surface-white: #16233a;
    --text-main: #e5eefc;
    --text-sub: #8ea3c1;
    --border-color: rgba(148, 163, 184, 0.18);
    --highlight-bg: rgba(59, 130, 246, 0.18);
    --root-highlight: #d97706;
    --fav-color: #f59e0b;
    --panel-bg: #111b2f;
    --panel-bg-soft: #16233a;
    --panel-card: #1a2943;
    --panel-muted: #0d1728;
    --border-strong: rgba(148, 163, 184, 0.28);
    --shadow-soft: 0 18px 48px rgba(2, 6, 23, 0.28);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-main);
    background-color: var(--bg-color);
    height: 100vh;
    overflow: hidden;
}

/* Inline Loader (Replaces Overlay) */
.inline-loader {
    width: 100%;
    padding: 10px 0;
    display: flex;
    justify-content: center;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.loader-track.small {
    width: 240px;
    /* Fit within sidebar */
    height: 60px;
    /* Smaller height */
    border-bottom: 2px solid #cbd5e1;
    margin-bottom: 0;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.house-box.small {
    width: 40px;
    height: 40px;
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 2;
}

.trees-box.small {
    width: 100px;
    height: 40px;
    position: absolute;
    left: 50px;
    bottom: 0;
    z-index: 1;
}

.school-box.small {
    width: 40px;
    height: 40px;
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
}

.runner-box.small {
    width: 30px;
    height: 30px;
    position: absolute;
    left: 20px;
    /* Start after house */
    bottom: 0;
    z-index: 3;
}

/* Adjust keyframes for small runner */
@keyframes runAcrossSmall {
    0% {
        left: 20px;
        /* Start near house */
    }

    100% {
        left: calc(100% - 50px);
        /* Stop before school */
    }
}

.runner-box.small.running {
    animation: runAcrossSmall 3s linear forwards;
}

/* Internal limb animation for running effect */
@keyframes legMove {

    0%,
    100% {
        transform: rotate(-20deg);
        transform-origin: 50% 60px;
    }

    50% {
        transform: rotate(20deg);
        transform-origin: 50% 60px;
    }
}

@keyframes armMove {

    0%,
    100% {
        transform: rotate(-20deg);
        transform-origin: 50% 40px;
    }

    50% {
        transform: rotate(20deg);
        transform-origin: 50% 40px;
    }
}

.runner-svg .leg-left {
    animation: legMove 0.3s infinite alternate;
}

.runner-svg .leg-right {
    animation: legMove 0.3s infinite alternate-reverse;
}

.runner-svg .arm-left {
    animation: armMove 0.3s infinite alternate-reverse;
}

.runner-svg .arm-right {
    animation: armMove 0.3s infinite alternate;
}

.loading-text {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar-nav {
    width: 300px;
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    min-width: 220px;
    /* Added minimum width protection */
}

.app-layout.sidebar-collapsed .sidebar-nav {
    width: 80px !important;
    min-width: 80px !important;
    /* Exact width for one button + padding */
}

.brand {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 20px;
    padding-right: 15px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.app-layout.sidebar-collapsed .brand {
    justify-content: center;
    padding: 0;
    width: 100%;
    /* Ensure it takes full width to center content */
}

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

.app-layout.sidebar-collapsed .brand-actions {
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.app-layout.sidebar-collapsed .brand-text {
    display: none;
}

.app-layout.sidebar-collapsed .brand button {
    display: flex;
    /* Ensure buttons remain visible */
}

/* Keep the toggle button visible but adjusted in collapsed mode if needed, or hide brand content */
/* Per request, collapsed sidebar shows only icons. The top part has buttons. */
.app-layout.sidebar-collapsed .brand #toggleSidebarBtn {
    display: flex;
    /* Keep toggle button visible */
    margin: 0;
}

/* Hide trash button in collapsed mode if space is tight, or keep it. 
   User said: "collapsed state shows only icons, clicking icons displays content".
   The toggle button is the trigger. 
   Wait, user said "Add sidebar collapse/expand button next to blacklist (trash) button".
   In collapsed mode, maybe we just show the toggle button?
   Actually, let's keep it simple. The toggle button is inside .brand.
*/
.app-layout.sidebar-collapsed .brand div {
    /* display: flex;  Removed this generic rule as we use .brand-actions now */
    /* justify-content: center; */
    /* width: 100%; */
}

.app-layout.sidebar-collapsed .brand #trashHistoryBtn {
    display: flex;
    /* User might want to access trash */
}


.history-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.version {
    font-size: 12px;
    background: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.sidebar-input-group {
    padding: 15px 15px 5px 15px;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.app-layout.sidebar-collapsed .sidebar-input-group {
    display: none;
}

.app-layout.sidebar-collapsed .sidebar-input-group input {
    display: none;
    /* Hide input */
}

.app-layout.sidebar-collapsed .sidebar-input-group button {
    display: none;
}

.app-layout.sidebar-collapsed .sidebar-input-group button i {
    margin-right: 0;
}

.app-layout.sidebar-collapsed .sidebar-input-group button span {
    display: none;
}

.app-layout.sidebar-collapsed .sidebar-input-group:last-of-type {
    display: none;
}

.sidebar-input-group input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 0px 8px 5px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    height: 36px;
    margin-right: 5px;
    margin-left: 0;
}

.sidebar-input-group textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
    margin-right: 5px;
    margin-left: 0;
    font-family: inherit;
}

.sidebar-search-group {
    align-items: stretch;
    flex-direction: row;
}

.sidebar-search-group button {
    align-self: stretch;
}

.sidebar-search-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 20%;
    min-width: 0;
}

.sidebar-search-actions button {
    width: 100%;
    flex: 1;
}

.sidebar-search-group textarea {
    flex: 0 0 80%;
    width: 80%;
    min-width: 0;
    margin-right: 0;
}

.api-status-light {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.api-status-light:hover {
    transform: scale(1.08);
}

.api-status-light.idle,
.api-status-light.has-data,
.api-status-light.offline {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.api-status-light.success {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.api-status-light.error {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.api-status-light.loading {
    background: #f59e0b;
    animation: apiStatusPulse 1.2s ease-in-out infinite;
}

@keyframes apiStatusPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    }
    50% {
        transform: scale(1.12);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    }
}

.sidebar-input-group input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.sidebar-input-group textarea:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.sidebar-input-group button {
    background: var(--primary-color);
    border: none;
    color: #fff;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    height: 36px;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-input-group button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

#toggleDefaultAutoSaveBtn {
    background: rgba(100, 116, 139, 0.32);
    color: #e2e8f0;
}

#toggleDefaultAutoSaveBtn:hover {
    background: rgba(100, 116, 139, 0.46);
}

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

#toggleDefaultAutoSaveBtn.active:hover {
    background: #1d4ed8;
}

.nav-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    position: relative;
    /* For popover positioning context if needed, but we use fixed/absolute */
}

/* Footer Trigger (Gear Icon) */
.footer-trigger {
    display: none;
    width: 100%;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-size: 18px;
    border-radius: 8px;
    transition: all 0.2s;
}

.footer-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-layout.sidebar-collapsed .nav-footer {
    padding: 10px;
    background: transparent;
    border-top: none;
    display: flex;
    justify-content: center;
    /* Center the gear icon */
}

.app-layout.sidebar-collapsed .footer-trigger {
    display: flex;
    width: 80px;
    /* Fixed width for trigger */
    height: 40px;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
}

.app-layout.sidebar-collapsed .footer-content {
    display: none;
    /* Hidden by default in collapsed mode */
}

/* Popover Styles for Footer */
.nav-footer.popover-active .footer-content {
    display: block;
    position: absolute;
    left: 100%;
    /* Right of the sidebar */
    bottom: 10px;
    margin-left: 12px;
    /* Small gap from sidebar */
    width: 260px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

.footer-btn {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #cbd5e1;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.footer-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Auto-play Toggle Button Style - NEW */
.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Icon+Text on left, Switch on right */
    width: 100%;
    height: 50px;
    /* Increased height */
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    /* Large rounded corners */
    padding: 0 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #cbd5e1;
    font-weight: 500;
}

.setting-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Text and Icon inside setting-toggle */
.setting-toggle i {
    margin-right: 8px;
    font-size: 16px;
}

.setting-toggle span {
    flex: 1;
    font-size: 14px;
}

/* Dictionary Control Row - NEW */
.footer-row-control {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    height: 50px;
    /* Same increased height */
}

.footer-row-control .footer-btn {
    height: 100%;
    border-radius: 12px;
    /* Rounded corners */
    margin-bottom: 0;
    flex: 0 0 auto;
    /* Don't shrink */
    padding: 0 20px;
    /* More padding */
    background-color: rgba(255, 255, 255, 0.05);
    justify-content: center;
}

.footer-row-control select {
    height: 100% !important;
    border-radius: 12px !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex: 1;
}

/* Auto-read Toggle in Sentence Block - Old one */
.sentence-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: normal;
    color: #64748b;
}

.mini-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.mini-toggle-switch {
    width: 28px;
    height: 16px;
    background: #cbd5e1;
    border-radius: 8px;
    position: relative;
    transition: 0.3s;
}

.mini-toggle-switch.active {
    background: var(--primary-color);
}

.mini-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.mini-toggle-switch.active::after {
    left: 14px;
}

/* Footer Toggle Switch (Large) */
.toggle-switch {
    width: 36px;
    height: 20px;
    background: #475569;
    border-radius: 10px;
    position: relative;
    transition: 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch.active {
    background: var(--success-color);
}

.toggle-switch.active::after {
    left: 18px;
}

.resize-handle {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    transition: background 0.2s;
    z-index: 10;
    position: relative;
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--primary-color);
}

.resize-handle-panel {
    width: 6px;
    background: linear-gradient(to right, transparent 0, rgba(148, 163, 184, 0.14) 50%, transparent 100%);
}

.resize-handle-panel:hover,
.resize-handle-panel.active {
    background: linear-gradient(to right, transparent 0, rgba(59, 130, 246, 0.9) 50%, transparent 100%);
}

.nav-tabs {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding-top: 10px;
}

.nav-tabs::-webkit-scrollbar {
    width: 4px;
}

.nav-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-tabs li {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
    color: #94a3b8;
}

.nav-tabs li:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-tabs li.active {
    background-color: rgba(37, 99, 235, 0.2);
    color: #fff;
    border-left-color: var(--primary-color);
}

.nav-group-block {
    padding: 0 !important;
    margin-bottom: 4px;
    display: block !important;
    border-left: none !important;
    background: transparent !important;
}

.nav-group-toggle {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #94a3b8;
}

.nav-group-toggle:hover,
.nav-group-block.group-active .nav-group-toggle {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-group-caret {
    font-size: 12px;
    transition: transform 0.2s;
}

.nav-group-block.collapsed .nav-group-caret {
    transform: rotate(-90deg);
}

.nav-group-list {
    list-style: none;
    padding: 0 0 0 12px;
    margin: 2px 0 0;
}

.nav-group-block.collapsed .nav-group-list {
    display: none;
}

.nav-group-list li {
    padding-left: 12px;
}

.app-layout.sidebar-collapsed .nav-group-toggle {
    justify-content: center;
    padding: 10px 0;
}

.app-layout.sidebar-collapsed .nav-group-title span,
.app-layout.sidebar-collapsed .nav-group-caret,
.app-layout.sidebar-collapsed .nav-group-list {
    display: none !important;
}

.app-layout.sidebar-collapsed .nav-tabs li {
    padding: 10px 0;
    /* Center content */
    justify-content: center;
    border-left: none;
    /* Remove border or keep it? */
}

.tab-content-left {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.app-layout.sidebar-collapsed .tab-content-left {
    justify-content: center;
    width: 100%;
    flex: none;
}

.tab-content-left i {
    width: 24px;
    margin-right: 8px;
    text-align: center;
}

.app-layout.sidebar-collapsed .tab-content-left i {
    margin-right: 0;
    font-size: 18px;
}

.app-layout.sidebar-collapsed .tab-content-left span {
    display: none;
}

.tab-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.app-layout.sidebar-collapsed .tab-actions {
    display: none;
    /* Hide actions in collapsed mode */
}

.nav-tabs li:hover .tab-actions,
.nav-tabs li.active .tab-actions {
    opacity: 1;
}

.tab-mini-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #64748b;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.tab-mini-btn:hover {
    background: var(--danger-color);
    color: #fff;
}

/* Footer Grid Styles (New) */
.footer-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-grid-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.footer-grid-btn i {
    font-size: 16px;
    margin-bottom: 2px;
}

.footer-grid-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.footer-grid-btn.import-btn:hover {
    color: #3b82f6;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.footer-grid-btn.export-btn:hover {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.footer-grid-btn.danger-btn:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.word-list-panel {
    width: 280px;
    min-width: 220px;
    max-width: 520px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-strong);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 5;
    box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.24);
}

.list-content {
    flex: 1;
    overflow-y: auto;
}

.word-card {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    cursor: pointer;
    transition: background 0.2s;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.word-card.active {
    background-color: var(--highlight-bg);
    border-left: 5px solid var(--primary-color);
}

.word-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
}

.word-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.word-text-en {
    font-weight: 700;
    color: var(--text-main);
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.word-text-cn {
    font-size: 12px;
    color: #94a3b8;
    /* Gray */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30%;
    text-align: right;
}

.word-phonetic-text {
    font-size: 12px;
    color: #64748b;
    font-family: monospace;
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
}

.word-action-icons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.word-icon-btn {
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.word-icon-btn:hover {
    color: var(--primary-color);
}

.word-icon-btn.is-active {
    color: #0f766e;
}

.word-icon-btn-danger:hover {
    color: #ef4444;
}

/* Clean up old styles */
.word-card-header,
.word-card-footer,
.word-text,
.word-trans,
.word-phonetic {
    display: none;
}

.append-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.append-btn {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    font-size: 13px;
    transition: 0.2s;
}

.append-btn:hover {
    background: #1d4ed8;
}

.difficulty-select {
    width: 70px;
    padding: 0 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 12px;
    outline: none;
}

/* Main Content Styles (Existing) */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.main-stage {
    background-color: var(--panel-bg-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.stage-header {
    padding: 20px 40px;
    background: linear-gradient(180deg, rgba(26, 41, 67, 0.98), rgba(18, 28, 48, 0.96));
    border-bottom: 1px solid var(--border-strong);
    flex-shrink: 0;
}

.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    /* Center content horizontally */
}

.media-viewport {
    width: min(100%, 800px);
    max-width: 800px;
    aspect-ratio: 16/9;
    min-height: 240px;
    background: linear-gradient(135deg, #0f172a 0%, #16233a 100%);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    display: flex;
    align-self: center;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    box-shadow: var(--shadow-soft);
}

.media-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    cursor: zoom-in;
}

.media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #111b2f 0%, #1a2943 100%);
}

.media-placeholder svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 17, 31, 0.78);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-main);
    z-index: 20;
}

.loading-spinner i {
    font-size: 24px;
    color: var(--primary-color);
}

.media-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 17, 31, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
}

.error-content i {
    font-size: 32px;
}

.reload-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

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

.ai-mini-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    transition: 0.2s;
    opacity: 0;
    /* Hidden by default */
}

.media-viewport:hover .ai-mini-btn {
    opacity: 1;
}

.ai-mini-btn:hover {
    background: var(--primary-color);
}

.word-image-preview-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(6px);
    z-index: 2600;
}

.word-image-preview-modal.active {
    display: flex;
}

.word-image-preview-dialog {
    width: min(92vw, 1200px);
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-image-preview-image {
    max-width: 100%;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    background: #08111f;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.content-block {
    width: 100%;
    max-width: 800px;
    background: var(--panel-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
}

.phonetic {
    min-height: 28px;
}

.phonetic-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.phonetic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.22);
    color: #cbd5e1;
    line-height: 1.3;
}

.phonetic-chip-label {
    font-size: 12px;
    color: #93c5fd;
    font-weight: 600;
}

.phonetic-chip-text {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.block-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dictionary-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
}

.dict-item {
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
}

.dict-pos {
    font-weight: 600;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    align-self: flex-start;
}

.dict-def {
    flex: 1;
}

.highlight-block {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(26, 41, 67, 0.98) 100%);
    border-left: 4px solid var(--root-highlight);
}

.etymology-box {
    background: rgba(217, 119, 6, 0.14);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    color: #fde68a;
    margin-bottom: 15px;
}

.etymology-label,
.etymology-root,
.etymology-desc {
    display: block;
}

.etymology-label {
    font-size: 12px;
    color: #fcd34d;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.etymology-root {
    font-size: 22px;
    font-weight: 700;
    color: #fef08a;
    line-height: 1.2;
}

.etymology-desc {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(254, 240, 138, 0.88);
}

.related-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.related-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.28);
}

.related-card:hover {
    border-color: rgba(96, 165, 250, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.38);
}

.related-card-word {
    display: block;
    color: #f8fafc;
    font-size: 15px;
    line-height: 1.35;
    margin-bottom: 6px;
}

.related-card-meaning {
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.5;
}

.related-card-empty {
    cursor: default;
}

.related-card-empty:hover {
    transform: none;
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.28);
}

.sentence-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e2e8f0;
}

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

.s-content {
    font-size: 15px;
    color: #334155;
    margin-bottom: 4px;
}

.sentence-line-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.sentence-line-text {
    flex: 1;
    min-width: 0;
    line-height: 1.7;
}

.sentence-context-btn {
    margin-top: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #2563eb;
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.sentence-context-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.s-translation {
    font-size: 13px;
    color: #64748b;
}

.sentence-audio-btn {
    color: #94a3b8;
    cursor: pointer;
    margin-left: 6px;
    font-size: 13px;
}

.sentence-audio-btn:hover {
    color: var(--primary-color);
}

.clickable-word {
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
    border-bottom: 1px dotted transparent;
    border-radius: 4px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    padding: 0 2px;
}

.clickable-word:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.sentence-word-token.is-speaking {
    background: rgba(250, 204, 21, 0.36);
    box-shadow: inset 0 -1px 0 rgba(250, 204, 21, 0.5);
    color: inherit;
}

.wiki-text {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.wiki-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* Blacklist View */
.blacklist-container {
    flex: 1;
    padding: 40px;
    background: var(--panel-bg-soft);
    overflow-y: auto;
}

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

.blacklist-header h2 {
    font-size: 24px;
    color: #1e293b;
}

.blacklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.blacklist-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.blacklist-item-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bl-meta {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blacklist-item-actions {
    display: flex;
    align-items: center;
}

.bl-word {
    font-weight: 600;
    color: #64748b;
}

.btn-outline-danger {
    background: #fff;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: #fff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-restore {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #64748b;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-restore:hover {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* Empty State Animation Styles */
.empty-state-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    padding-bottom: 100px;
    /* Adjust visual center */
}

.svg-animation-wrapper {
    width: 300px;
    height: 200px;
    position: relative;
}

/* Keyframes for Bobbing Animation */
@keyframes bob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        transform: translate(10px, -20px) rotate(5deg);
        opacity: 0;
    }
}

.character-group {
    animation: bob 3s ease-in-out infinite;
}

.character-group.delayed {
    animation-delay: 1.5s;
}

.subtitle-float {
    animation: float 4s linear infinite;
}

/* Word List Panel Styling Updates */
.list-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.list-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #475569;
}

.count-badge {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: #64748b;
}

/* Popover */
.word-popover {
    display: none;
    position: fixed;
    /* Fixed relative to viewport */
    width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 15px;
    z-index: 1000;
}

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

.pop-word {
    font-weight: 700;
    font-size: 16px;
}

.pop-phonetic {
    font-size: 12px;
    color: #94a3b8;
    font-family: monospace;
    margin-bottom: 8px;
}

.pop-body {
    font-size: 14px;
    color: #475569;
    margin-bottom: 15px;
    line-height: 1.4;
}

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

.pop-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

.word-context-menu {
    display: none;
    position: fixed;
    width: 132px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    border-radius: 8px;
    padding: 6px;
    z-index: 1001;
}

.word-context-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

.word-context-item:hover {
    background: #eff6ff;
    color: var(--primary-color);
}

/* Add Button in popover */
#popAddBtn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#popAddBtn:hover {
    background: #1d4ed8;
}

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

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 80vh;
}

.modal-card h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}

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

.modal-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
    color: #475569;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

/* Custom Alert Styles */
.custom-alert-bubble {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 3000;
}

.custom-alert-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.custom-alert-msg {
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
}

/* Export Options Styles */
.export-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.export-option-item:hover {
    background: #f8fafc;
}

.export-option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.export-option-item span {
    font-size: 14px;
    color: #334155;
}

.export-option-item i {
    width: 20px;
    text-align: center;
    color: #64748b;
}

/* Dictionary Search View Styles */
.dictionary-search-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--panel-bg-soft);
    overflow: hidden;
}

.dict-search-header {
    background: var(--panel-card);
    border-bottom: 1px solid var(--border-strong);
    padding: 0 20px;
    flex-shrink: 0;
}

.dict-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid transparent;
}

.dict-tab {
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    position: relative;
    top: 2px;
}

.dict-tab:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.dict-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

.dict-search-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
}

.dict-tab-content {
    display: none;
    flex: 1;
}

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

#dictImageContent.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dict-result-container {
    background: var(--panel-card);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.daily-english-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 32px;
    background: var(--panel-bg-soft);
    overflow: auto;
}

.daily-english-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.daily-english-header-copy h2 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 26px;
}

.daily-english-header-copy p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.daily-english-toolbar,
.daily-english-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.daily-english-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.daily-select-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(26, 41, 67, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 13px;
    min-height: 42px;
}

.daily-select-chip span {
    color: #64748b;
    white-space: nowrap;
}

.daily-select-chip select {
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    min-width: 108px;
}

.daily-toolbar-btn {
    border: 1px solid var(--border-color);
    background: rgba(26, 41, 67, 0.9);
    color: var(--text-main);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.daily-toolbar-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.daily-toolbar-btn.is-active {
    border-color: #fb923c;
    color: #fb923c;
}

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

.daily-toolbar-btn.primary:hover {
    color: #fff;
    background: #1d4ed8;
}

.daily-english-input-wrap {
    background: var(--panel-card);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.daily-english-prompt {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    background: rgba(8, 17, 31, 0.72);
}

.daily-english-prompt:focus,
.bilingual-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bilingual-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 420px;
}

.bilingual-columns.is-swapped .bilingual-pane:first-child {
    order: 2;
}

.bilingual-columns.is-swapped .bilingual-pane:last-child {
    order: 1;
}

.bilingual-pane {
    background: var(--panel-card);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    border: 1px solid var(--border-color);
}

.bilingual-pane.is-hidden {
    display: none;
}

.bilingual-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-main);
    font-weight: 600;
}

.bilingual-textarea {
    width: 100%;
    flex: 1;
    min-height: 340px;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    background: rgba(8, 17, 31, 0.72);
}

.bilingual-editor-shell {
    position: relative;
    flex: 1;
    display: flex;
    min-height: 340px;
}

.bilingual-editor-shell .bilingual-textarea {
    position: relative;
    background: transparent;
    z-index: 2;
}

.bilingual-focus-overlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    color: transparent;
}

.bilingual-focus-overlay.is-active {
    border-color: rgba(251, 146, 60, 0.85);
}

.bilingual-focus-mark {
    background: rgba(255, 235, 59, 0.3);
    border-radius: 6px;
    color: inherit;
}

.bilingual-focus-mark.is-target {
    outline: 1px dashed rgba(255, 235, 59, 0.95);
    outline-offset: 2px;
}

.bilingual-pane.is-focus-mode .bilingual-focus-overlay {
    color: var(--text-main);
    z-index: 3;
}

.bilingual-pane.is-focus-mode .bilingual-textarea {
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: transparent;
}

.bilingual-pane.is-hidden+.bilingual-pane,
.bilingual-pane:first-child:last-child {
    grid-column: 1 / -1;
}

.daily-english-chatbar {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--panel-card);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
}

.daily-english-chat-input {
    flex: 1;
    min-width: 260px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    background: rgba(8, 17, 31, 0.72);
}

.daily-english-chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

@media (max-width: 960px) {
    .bilingual-columns {
        grid-template-columns: 1fr;
    }

    .daily-select-chip {
        width: 100%;
        justify-content: space-between;
    }
}

.dict-word-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.dict-word-title {
    font-size: 36px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.dict-word-tags {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.dict-tag {
    padding: 4px 10px;
    background: #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #64748b;
}

.dict-phonetic-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dict-phonetic {
    font-family: monospace;
    color: #64748b;
    font-size: 16px;
}

#displayPhonetic {
    display: inline-block;
    max-width: min(60vw, 720px);
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
}

.dict-definition-section {
    margin-bottom: 25px;
}

.dict-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.dict-meaning-item {
    margin-bottom: 12px;
    padding-left: 15px;
    border-left: 3px solid #e2e8f0;
    padding-bottom: 12px;
}

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

.dict-pos {
    font-weight: 600;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
    margin-right: 8px;
}

.dict-definition {
    color: #334155;
    line-height: 1.6;
    margin-top: 5px;
}

.dict-examples {
    margin-top: 10px;
}

.dict-example-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.dict-example-en {
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 4px;
}

.dict-example-cn {
    color: #64748b;
    font-size: 13px;
}

.dict-related-words {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.dict-related-word {
    padding: 4px 10px;
    background: #eff6ff;
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.dict-related-word:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Image Translation Styles */
.image-translate-upload {
    max-width: 800px;
    margin: 0 auto;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.upload-area i {
    font-size: 48px;
    color: #94a3b8;
    margin-bottom: 15px;
    display: block;
}

.upload-area p {
    color: #64748b;
    margin: 8px 0;
    font-size: 14px;
}

.upload-hint {
    font-size: 12px !important;
    color: #94a3b8 !important;
}

#imagePreviewContainer {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#imagePreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.image-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.append-lock-btn {
    flex: 0 0 auto;
    min-width: 118px;
    background: #334155;
}

.append-lock-btn.is-locked {
    background: #0f766e;
}

.btn-translate,
.btn-clear {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.btn-translate:hover {
    background: #1d4ed8;
}

.btn-clear {
    background: #e2e8f0;
    color: #64748b;
}

.btn-clear:hover {
    background: #cbd5e1;
}

.translate-result {
    background: var(--panel-card);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: var(--shadow-soft);
    min-height: 100px;
    border: 1px solid var(--border-color);
}

.translate-result.loading {
    text-align: center;
    color: #64748b;
}

.translate-result-text {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
}

.image-translate-tip {
    margin-top: 15px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 6px;
    color: #856404;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#contentView .stage-header .stage-actions,
#contentView .stage-header .word-title-group,
#contentView .scrollable-content,
.dictionary-search-container,
.dict-search-content,
.daily-english-header-copy p,
.dict-word-title,
.dict-definition,
.translate-result-text,
.dictionary-content,
.s-content,
.wiki-text,
.bl-word,
.list-stat,
.modal-card h3,
.modal-select,
.custom-alert-msg {
    color: var(--text-main);
}

.inline-loader,
.media-error,
.empty-state-container {
    background: var(--panel-bg-soft);
}

.list-header,
.count-badge,
.word-popover,
.modal-card,
.custom-alert-box,
.blacklist-item,
.upload-area,
#imagePreviewContainer,
.dict-example-item {
    background: var(--panel-card);
    border-color: var(--border-color);
    color: var(--text-main);
}

.count-badge {
    color: var(--text-sub);
}

.word-text-cn,
.word-phonetic-text,
.word-icon-btn,
.dict-phonetic,
.dict-tag,
.dict-example-cn,
.bl-meta,
.daily-english-header-copy p,
.daily-select-chip span {
    color: var(--text-sub);
}

.word-card:hover {
    background: rgba(59, 130, 246, 0.08);
}

.word-card.active {
    box-shadow: inset 4px 0 0 var(--primary-color);
}

.difficulty-select,
.reload-btn,
.btn-outline-danger,
.btn-restore,
.modal-select,
.daily-select-chip,
.daily-toolbar-btn,
.daily-english-prompt,
.bilingual-textarea,
.daily-english-chat-input {
    border-color: var(--border-color);
}

.difficulty-select,
.reload-btn,
.modal-select,
.btn-restore {
    background: rgba(26, 41, 67, 0.9);
    color: var(--text-main);
}

.reload-btn:hover,
.btn-restore:hover {
    background: rgba(59, 130, 246, 0.16);
}

.dict-tab {
    color: var(--text-sub);
}

.dict-tab:hover {
    background: rgba(59, 130, 246, 0.08);
}

.dict-word-header,
.dict-section-title {
    border-bottom-color: var(--border-color);
    color: var(--text-main);
}

.dict-pos,
.dict-related-word {
    background: rgba(59, 130, 246, 0.14);
}

.upload-area,
#imagePreviewContainer {
    background: var(--panel-card);
}

.upload-area:hover {
    background: rgba(59, 130, 246, 0.08);
}

#displayWord,
#displayPhonetic,
#displayCategory,
#favBtn,
#contentView .btn-delete,
#dictImageContent > div > button,
#dictImageContent > div > p {
    color: var(--text-main) !important;
}

#displayCategory {
    background: rgba(59, 130, 246, 0.14) !important;
}

#favBtn,
#contentView .btn-delete {
    background: rgba(26, 41, 67, 0.92) !important;
    border-color: var(--border-color) !important;
}

#dictImageContent > div > button {
    background: linear-gradient(145deg, #1a2943, #131f35) !important;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35) !important;
}

#dictImageContent > div > p,
#contentView .stage-header span[style*='#94a3b8'],
.list-stat span[style*='#94a3b8'] {
    color: var(--text-sub) !important;
}

/* AI Dictionary Details Styles */
.dict-details {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.dict-details summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-main);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.dict-details summary::-webkit-details-marker {
    display: none;
}

.dict-details[open] summary i {
    transform: rotate(0deg);
}

.dict-details summary i {
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
    color: var(--text-sub);
}

.dict-details-content {
    padding-left: 20px;
    padding-top: 8px;
    color: var(--text-main);
    line-height: 1.6;
}

.dict-group {
    margin-bottom: 12px;
}

.dict-group.inline-group {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: flex-start;
}

.dict-group-pos {
    color: #10b981;
    font-weight: bold;
    font-style: italic;
    font-size: 14px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.dict-group-meanings {
    padding-left: 10px;
}

.dict-sub-title {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.dict-group-words {
    color: #3b82f6;
    line-height: 1.5;
}

.dict-associated-words {
    color: var(--text-main);
    line-height: 1.6;
}

.dict-phrase-item {
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
}

.dict-phrase-en {
    color: #3b82f6;
    font-style: italic;
    font-weight: 500;
}

.dict-phrase-cn {
    color: var(--text-main);
}
