:root {
    --bg-app: #0f1115;
    --bg-sidebar: #161b22;
    --bg-sidebar-secondary: #0d1117;
    --bg-content: #0d1117;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-color: #58a6ff;
    --accent-hover: #1f6feb;
    --hover-bg: #21262d;
    --active-bg: #1f6feb22;

    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: 1px solid rgba(48, 54, 61, 0.5);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-zh: 'Noto Sans SC', sans-serif;
}

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

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

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebars */
.sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.series-list {
    width: 250px;
    background-color: var(--bg-sidebar);
    flex-shrink: 0;
}

.episode-list {
    width: 300px;
    background-color: var(--bg-sidebar-secondary);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    height: 70px;
    display: flex;
    align-items: center;
}

.sidebar-header h2,
.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* List Items */
.list-item {
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.list-item.active {
    background-color: var(--active-bg);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

.file-size {
    font-size: 11px;
    margin-left: auto;
    opacity: 0.5;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-content);
    min-width: 0;
}

.content-header {
    height: 70px;
    padding: 0 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(5px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-header h1 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Markdown Container */
.markdown-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    color: var(--text-primary);
    line-height: 1.8;
    font-family: var(--font-zh), var(--font-main);
    font-size: 16px;
}

@media (max-width: 768px) {
    .markdown-body {
        padding: 20px;
    }
}

/* Markdown Elements */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    border-bottom: none;
    color: var(--text-primary);
    margin-top: 1.5em;
    margin-bottom: 1em;
    line-height: 1.4;
    font-weight: 600;
}

.markdown-body h1 {
    font-size: 1.6em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5em;
}

.markdown-body h2 {
    font-size: 1.3em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

.markdown-body p {
    margin-bottom: 1.2em;
    word-break: break-word;
    /* Safer word wrap */
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
}

.markdown-body th,
.markdown-body td {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.markdown-body th {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

.markdown-body tr:nth-child(2n) {
    background-color: rgba(255, 255, 255, 0.02);
}

.markdown-body blockquote {
    color: var(--text-secondary);
    border-left: 4px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    padding: 1em 1em 1em 1.5em;
    margin: 1.5em 0;
    border-radius: 0 4px 4px 0;
}

.markdown-body hr {
    height: 1px;
    background-color: var(--border-color);
    border: 0;
    margin: 2em 0;
}

.markdown-body code {
    background-color: rgba(110, 118, 129, 0.2);
    border-radius: 6px;
    padding: 0.2em 0.4em;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace;
    font-size: 90%;
}

/* Highlights */
.user-highlight {
    background-color: rgba(255, 215, 0, 0.25);
    border-bottom: 2px solid #ffd700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-highlight:hover {
    background-color: rgba(255, 215, 0, 0.45);
    position: relative;
    z-index: 1;
}

.user-highlight:hover::after {
    content: "点击移除";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #1f2328;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
}

/* Spoiler Mode */
.spoiler {
    filter: blur(8px);
    user-select: none;
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.spoiler:hover {
    filter: blur(4px);
    opacity: 1;
}

.spoiler.revealed {
    filter: none;
    user-select: text;
    cursor: text;
    background: transparent;
    opacity: 1;
}

/* Floating Action Button */
.fab-copy {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 1000;
    border: none;
    transition: transform 0.2s;
}

.fab-copy:hover {
    transform: scale(1.1);
    background-color: var(--accent-hover);
}

.fab-copy:active {
    transform: scale(0.95);
}

.fab-copy svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.fab-copy::after {
    content: "复制高亮";
    position: absolute;
    right: 70px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.fab-copy:hover::after {
    opacity: 1;
}

/* Nav Buttons */
.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nav-btn:hover:not(:disabled) {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.content-footer {
    padding: 20px 60px 40px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.footer-nav-btn {
    flex: 1;
    padding: 15px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.footer-nav-btn:hover {
    background: var(--bg-sidebar-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    opacity: 0.5;
}