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

html, body {
    height: 100%;
    background: #fff;
    color: #000;
    font-family: -apple-system, "Segoe UI", "Noto Sans SC", sans-serif;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

.app {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* ===== Main column (lecture + bottom controls) ===== */
.main-column {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: flex-basis 0.25s ease;
}

/* ===== Middle area: 4/5 ===== */
.middle-area {
    flex: 4 1 0;
    min-height: 0;
    padding: 0;
}

/* Content box */
.content-box {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Title section at the top of the box */
.title-section {
    position: relative;
    padding: 16px 26px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.title-bar {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.library-btn {
    background: none;
    border: 1px solid #ddd;
    color: #aaa;
    padding: 2px 12px;
    font-size: 12px;
    border-radius: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.library-btn:active {
    border-color: #999;
    color: #666;
}

.current-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    line-height: 1.6;
}

/* Scrollable content area */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 26px;
}

/* Lecture section - one lecture per page; playback continues across, view auto-flips */
.lecture-section {
    display: none;
}
.lecture-section.active {
    display: block;
}

/* Paragraphs - normal article layout */
.paragraph {
    margin-bottom: 14px;
    text-indent: 2em;
    text-align: justify;
    color: #bbb;
    font-size: 15px;
    line-height: 1.9;
}

.paragraph.section-start {
    margin-top: 22px;
}

/* Headings inside playable lectures: ## / ### markdown 段落直接渲染为标题，不读 */
.lecture-section .lecture-heading {
    color: #000;
    font-weight: 600;
    text-indent: 0;
    line-height: 1.4;
    margin: 18px 0 10px;
}
.lecture-section h1.lecture-heading { font-size: 22px; }
.lecture-section h2.lecture-heading { font-size: 19px; }
.lecture-section h3.lecture-heading { font-size: 17px; }
.lecture-section h4.lecture-heading,
.lecture-section h5.lecture-heading,
.lecture-section h6.lecture-heading { font-size: 15px; }

/* 整篇 markdown 渲染（仅显示不读：00-目录、大纲等） */
.lecture-section .lecture-markdown {
    color: #555;
    font-size: 15px;
    line-height: 1.9;
    text-indent: 0;
}
.lecture-section .lecture-markdown h1,
.lecture-section .lecture-markdown h2,
.lecture-section .lecture-markdown h3,
.lecture-section .lecture-markdown h4 {
    color: #000;
    font-weight: 600;
    margin: 16px 0 8px;
}
.lecture-section .lecture-markdown h1 { font-size: 22px; }
.lecture-section .lecture-markdown h2 { font-size: 19px; }
.lecture-section .lecture-markdown h3 { font-size: 17px; }
.lecture-section .lecture-markdown h4 { font-size: 15px; }
.lecture-section .lecture-markdown p { margin: 8px 0; }
.lecture-section .lecture-markdown ul,
.lecture-section .lecture-markdown ol {
    margin: 8px 0 8px 1.6em;
    padding: 0;
}
.lecture-section .lecture-markdown li { margin: 2px 0; }
.lecture-section .lecture-markdown blockquote {
    margin: 8px 0;
    padding: 4px 12px;
    border-left: 3px solid #d0d0d0;
    color: #777;
    background: #f5f5f5;
    border-radius: 0 4px 4px 0;
}
.lecture-section .lecture-markdown code {
    background: rgba(0,0,0,0.06);
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.9em;
}
.lecture-section .lecture-markdown hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 14px 0;
}

/* Sentences - inline in paragraphs by default */
.sentence {
    cursor: pointer;
    transition: color 0.3s;
}

.sentence.played {
    color: #888;
}

/* Playing sentence: only color differs */
.sentence.playing {
    color: #000;
}

/* ===== Title panel dropdown ===== */
.title-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 16px 16px;
    z-index: 10;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.title-panel.expanded {
    max-height: 200px;
    opacity: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.title-panel nav {
    padding: 12px 0;
}

.title-panel a {
    display: block;
    text-align: left;
    font-size: 15px;
    color: #aaa;
    text-decoration: none;
    padding: 8px 24px;
    line-height: 1.6;
    transition: color 0.2s;
    cursor: pointer;
}

.title-panel a.active {
    color: #000;
    font-weight: 500;
}

/* Toolbar inside the dropdown title-panel */
.title-panel-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px 0;
}

.outline-pin-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #ddd;
    color: #888;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.outline-pin-btn:active,
.outline-pin-btn:hover {
    border-color: #999;
    color: #333;
}

/* ===== Outline sidebar (left, when pinned) ===== */
.outline-sidebar {
    display: none;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    background: #fafafa;
    overflow: hidden;
}

.app.outline-pinned .outline-sidebar {
    display: flex;
}

/* When pinned, dropdown panel is redundant — suppress it */
.app.outline-pinned .title-panel {
    display: none;
}

.app.outline-pinned .title-bar {
    cursor: default;
}

.outline-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.outline-sidebar-title {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.outline-unpin-btn {
    background: none;
    border: 1px solid #ddd;
    color: #888;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.outline-unpin-btn:active,
.outline-unpin-btn:hover {
    border-color: #999;
    color: #333;
}

#outline-side {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

#outline-side a {
    display: block;
    text-align: left;
    font-size: 14px;
    color: #888;
    text-decoration: none;
    padding: 8px 16px;
    line-height: 1.5;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

#outline-side a:hover {
    background: #f0f0f0;
    color: #333;
}

#outline-side a.active {
    color: #000;
    font-weight: 500;
    background: #fff;
    border-left-color: #333;
}

#outline-side::-webkit-scrollbar {
    width: 6px;
}
#outline-side::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

/* ===== Book Select Mode ===== */
.book-carousel {
    display: none;
}

.app.book-select-mode .title-section {
    display: none;
}

.app.book-select-mode .outline-sidebar {
    display: none;
}

.app.book-select-mode .content-scroll {
    display: none;
}

.app.book-select-mode .book-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 16px;
    padding: 24px 12px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.book-cover {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.35s ease;
    padding: 20px 16px;
    overflow: hidden;
}

.book-cover .book-title {
    font-weight: 700;
    color: #333;
    line-height: 1.5;
    word-break: break-word;
}

/* Center book - largest */
.book-cover.center {
    width: 45%;
    height: 75%;
    font-size: 20px;
    opacity: 1;
    border-color: #ccc;
}

/* Side books - smaller */
.book-cover.side {
    width: 25%;
    height: 55%;
    font-size: 14px;
    opacity: 0.5;
    border-color: #e8e8e8;
}

.book-cover.center:active {
    border-color: #999;
}

.book-cover.side:hover {
    opacity: 0.7;
}

.book-cover:has(.book-cover-img) {
    padding: 0;
}

.book-cover.center:has(.book-cover-img) {
    width: auto;
    max-width: 50%;
}

.book-cover.side:has(.book-cover-img) {
    width: auto;
    max-width: 22%;
}

.book-cover-img {
    height: 100%;
    width: auto;
    max-width: 100%;
    display: block;
    border-radius: 11px;
    object-fit: contain;
}

/* ===== Agent panel (floating bottom 1/3, or right side in split mode) ===== */
.agent-panel {
    display: none;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    position: relative;
}

.agent-panel-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 0;
    flex-shrink: 0;
}

/* Sessions drawer (overlays the agent panel from the left) */
.agent-sessions-drawer {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 5;
    flex-direction: column;
    border-radius: inherit;
}
.agent-sessions-drawer.open { display: flex; }
.agent-sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}
.agent-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.agent-session-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #fafafa;
    transition: background 0.15s;
}
.agent-session-item:hover { background: #f7f7f7; }
.agent-session-item.active { background: #eef4ff; }
.agent-session-item-main {
    flex: 1;
    min-width: 0;
}
.agent-session-item-title {
    font-size: 13px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-session-item-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.agent-session-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.agent-session-item:hover .agent-session-item-actions { opacity: 1; }
.agent-session-item-actions button {
    background: none;
    border: 1px solid #e0e0e0;
    color: #888;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
}
.agent-session-item-actions button:hover { color: #333; border-color: #bbb; }
.agent-sessions-empty {
    text-align: center;
    color: #999;
    padding: 32px 16px;
    font-size: 13px;
}

.agent-panel-btn {
    background: none;
    border: 1px solid #e8e8e8;
    color: #aaa;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-panel-btn:active {
    border-color: #999;
    color: #666;
}

.agent-panel-btn .icon-collapse {
    display: none;
}

.app.agent-split .agent-panel-btn .icon-expand {
    display: none;
}

.app.agent-split .agent-panel-btn .icon-collapse {
    display: block;
}

.agent-band {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
}

.agent-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.agent-messages::-webkit-scrollbar {
    display: none;
}

.agent-input-area {
    flex-shrink: 0;
    padding: 8px 20px 16px;
}

/* ----- Floating mode (default when agent open) ----- */
.app.agent-floating .agent-panel {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 33.33vh;
    height: 33.33dvh;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.08);
    z-index: 30;
}

/* ----- Split mode (right 1/3 column, lecture takes left 2/3) ----- */
.app.agent-split .main-column {
    flex: 2 1 0;
}

.app.agent-split .agent-panel {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    border-left: 1px solid #e8e8e8;
}

/* Hide mic entry button while panel is open in either mode */
.app.agent-floating .agent-mic-btn,
.app.agent-split .agent-mic-btn {
    display: none;
}

.agent-input-box {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    padding: 8px 12px;
    background: #fff;
}

.agent-plus-btn {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-plus-btn:active {
    border-color: #999;
}

.agent-input-box input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: transparent;
    min-width: 0;
}

.agent-input-box input[type="text"]::placeholder {
    color: #bbb;
}

.agent-input-box button {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 4px 16px;
    font-size: 13px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.agent-input-box button:active {
    border-color: #999;
}

/* Mode toggle button (text <-> voice) */
.agent-mode-btn {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-mode-btn:active {
    border-color: #999;
}

.agent-mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 0;
}

.agent-mode-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    fill: none;
}

/* Press-to-talk button */
.agent-voice-btn {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #e8e8e8 !important;
    color: #555 !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    border-radius: 14px !important;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 0.15s, color 0.15s;
}

.agent-voice-btn.recording {
    background: #333 !important;
    color: #fff !important;
    border-color: #333 !important;
}

.agent-voice-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Live ASR hint above the input box */
.agent-voice-hint {
    display: none;
    margin-top: 8px;
    padding: 8px 14px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    min-height: 1.5em;
    max-height: 4.5em;
    overflow-y: auto;
}

.agent-voice-hint.active {
    display: block;
}

/* Agent message styles */
.agent-msg {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.7;
}

.agent-msg.user {
    text-align: right;
}

.agent-msg.user .agent-msg-bubble {
    display: inline-block;
    background: #f5f5f5;
    border-radius: 14px;
    padding: 8px 14px;
    max-width: 80%;
    text-align: left;
    color: #333;
}

.agent-msg.assistant .agent-msg-text {
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-msg.tool-use {
    font-size: 12px;
    color: #999;
    padding-left: 8px;
    border-left: 2px solid #e8e8e8;
}

.agent-msg.tool-result {
    font-size: 12px;
    color: #999;
    padding-left: 8px;
    border-left: 2px solid #e8e8e8;
    margin-top: -8px;
}

.agent-msg.tool-result.error {
    color: #c44;
    border-left-color: #c44;
}

.agent-msg.system {
    text-align: center;
    font-size: 12px;
    color: #bbb;
}

/* AskUserQuestion 卡片 */
.agent-msg.ask-question {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ask-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 14px;
}

.ask-header {
    font-size: 11px;
    color: #999;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.ask-question-text {
    font-size: 14px;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.5;
}

.ask-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ask-option-btn {
    text-align: left;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
}

.ask-option-btn:hover:not(:disabled) {
    background: #f3f3f3;
    border-color: #d0d0d0;
}

.ask-option-btn.selected {
    background: #eef4ff;
    border-color: #4a7fdc;
}

.ask-option-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.ask-option-label {
    font-size: 13px;
    font-weight: 500;
}

.ask-option-desc {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.ask-other {
    margin-top: 8px;
}

.ask-other-input {
    width: 100%;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.ask-other-input:focus {
    border-color: #4a7fdc;
}

.ask-submit-btn {
    margin-top: 8px;
    background: #4a7fdc;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.ask-submit-btn:disabled {
    background: #b8c8e8;
    cursor: default;
}

/* ===== Bottom area: 1/3 ===== */
.bottom-area {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.play-btn:active {
    border-color: #999;
}

/* Sound control */
.sound-wrap {
    position: relative;
}

.sound-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sound-toggle:active {
    border-color: #999;
    color: #666;
}

.sound-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: -8px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 14px 16px;
    display: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

.sound-panel.open {
    display: block;
}

.sound-panel-section {
    margin-bottom: 12px;
}

.sound-panel-section:last-child {
    margin-bottom: 0;
}

.sound-panel-label {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 6px;
}

.speed-options,
.tts-options {
    display: flex;
    gap: 4px;
}

.speed-options button,
.tts-options button {
    background: none;
    border: 1px solid #e8e8e8;
    color: #aaa;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.speed-options button.active,
.tts-options button.active {
    color: #000;
    font-weight: 500;
    border-color: #ccc;
}

/* ===== Title bar right section ===== */
.title-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-badge {
    font-size: 12px;
    color: #999;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
}

.user-badge:empty {
    display: none;
}

.admin-link {
    font-size: 12px;
    color: #06f;
    text-decoration: none;
    padding: 2px 6px;
    border: 1px solid #06f;
    border-radius: 4px;
    margin-right: 6px;
}
.admin-link:hover { background: #06f; color: #fff; }

/* ===== Auth Overlay ===== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    width: 300px;
    padding: 32px 28px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

.auth-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 24px;
}

.auth-box input[type="text"],
.auth-box input[type="password"] {
    display: block;
    width: 100%;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.auth-box input:focus {
    border-color: #bbb;
}

.auth-submit {
    display: block;
    width: 100%;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.auth-submit:active {
    background: #555;
}

.auth-switch {
    font-size: 12px;
    color: #bbb;
    cursor: pointer;
    margin-bottom: 8px;
}

.auth-switch span {
    color: #666;
    text-decoration: underline;
}

.auth-skip {
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-skip:hover {
    color: #999;
}

.auth-error {
    font-size: 12px;
    color: #c44;
    margin-top: 8px;
    min-height: 16px;
}

/* ===== Book Select Container ===== */
.book-select-container {
    display: none;
    flex-direction: column;
    height: 100%;
}

.app.book-select-mode .book-select-container {
    display: flex;
}

.book-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 12px 24px 0;
    flex-shrink: 0;
}

.book-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #bbb;
    font-size: 13px;
    font-family: inherit;
    padding: 6px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.book-tab.active {
    color: #333;
    border-bottom-color: #333;
}

.book-tab:not(.active):hover {
    color: #888;
}

.book-tabs.public-only .book-tab[data-source="workspace"] {
    display: none;
}

/* ===== Agent entry mic (bottom bar) ===== */
.agent-mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.agent-mic-btn:active {
    border-color: #999;
    color: #666;
}

.agent-mic-btn.disabled {
    opacity: 0.5;
}

/* ===== Subtitle entry inside sound panel ===== */
.display-options {
    display: flex;
    gap: 4px;
}

.display-options button {
    background: none;
    border: 1px solid #e8e8e8;
    color: #666;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.display-options button:active {
    border-color: #999;
}

.subtitle-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 50;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.subtitle-overlay.active {
    display: flex;
}

.subtitle-text {
    position: absolute;
    top: 83.3%;
    transform: translateY(-50%);
    width: 100%;
    padding: 0 32px;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #222;
    line-height: 1.8;
}

.subtitle-back {
    position: absolute;
    bottom: 32px;
    left: 24px;
    background: none;
    border: none;
    color: #bbb;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.subtitle-back:active {
    color: #666;
}

/* ===== Hide scrollbars ===== */
.content-scroll::-webkit-scrollbar,
.title-panel::-webkit-scrollbar {
    display: none;
}

.content-scroll,
.title-panel {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== Lecture image / draft blocks ===== */
.lecture-image {
    margin: 18px 0;
    text-align: center;
}
.lecture-image img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    display: inline-block;
}
.lecture-image figcaption {
    margin-top: 6px;
    color: #888;
    font-size: 13px;
}

/* 图片草稿（伪图片占位）：虚线框 + 内嵌 markdown 渲染，固定 16:9 小卡片 */
.lecture-draft {
    width: 24em;            /* 约 24 个汉字宽 */
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: 18px auto;      /* 居中，类似一张图片 */
    border: 1.5px dashed #c8c8c8;
    border-radius: 8px;
    background: #fafafa;
    color: #555;
    font-size: 12px;        /* 比正文小一档 */
    line-height: 1.5;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    position: relative;     /* 让 .lecture-draft-actions 绝对定位 */
}
.lecture-draft[data-state="image"] {
    border-style: solid;    /* 已生成图后实线框，更像真图 */
}
.lecture-draft-img {
    flex: 1;
    width: 100%;
    height: 100%;
}
.lecture-draft-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.lecture-draft-actions {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    z-index: 10;
}
.lecture-draft-actions button {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 50%;
    color: #444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: background 0.15s, opacity 0.15s;
    opacity: 0.55;       /* 默认半透明，悬浮整张草稿卡时变实 */
}
.lecture-draft:hover .lecture-draft-actions button {
    opacity: 1;
}
.lecture-draft-actions button:hover:not(:disabled) {
    background: #fff;
    color: #000;
}
.lecture-draft-actions button[hidden] { display: none; }
.lecture-draft-actions button:disabled {
    cursor: wait;
}
/* 生成中：草稿卡上整体遮罩 + 一个旋转图标 */
.lecture-draft.is-generating::after {
    content: '⏳';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 5;
    animation: lecture-draft-pulse 1.2s ease-in-out infinite;
}
@keyframes lecture-draft-pulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}
.lecture-draft-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    text-indent: 0;
    color: #555;
}
.lecture-draft-body :first-child { margin-top: 0; }
.lecture-draft-body :last-child { margin-bottom: 0; }
.lecture-markdown :first-child { margin-top: 0; }
.lecture-markdown :last-child { margin-bottom: 0; }
.lecture-draft-body h1,
.lecture-draft-body h2,
.lecture-draft-body h3,
.lecture-draft-body h4 {
    font-size: 1.05em;
    margin: 0.4em 0 0.2em;
    color: #333;
    font-weight: 600;
}
.lecture-draft-body p {
    margin: 0.3em 0;
}
.lecture-draft-body ul,
.lecture-draft-body ol {
    margin: 0.3em 0 0.3em 1.4em;
    padding: 0;
}
.lecture-draft-body li {
    margin: 0.1em 0;
}
.lecture-draft-body blockquote {
    margin: 0.3em 0;
    padding: 0.2em 0.7em;
    border-left: 2px solid #d0d0d0;
    color: #777;
    background: #f3f3f3;
    border-radius: 0 4px 4px 0;
}
.lecture-draft-body hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 0.5em 0;
}
.lecture-draft-body table {
    border-collapse: collapse;
    margin: 0.4em 0;
    font-size: 0.95em;
    width: 100%;
}
.lecture-draft-body th,
.lecture-draft-body td {
    border: 1px solid #d8d8d8;
    padding: 0.15em 0.4em;
    text-align: left;
}
.lecture-draft-body th {
    background: #efefef;
    font-weight: 600;
}
.lecture-draft-body code {
    background: rgba(0,0,0,0.06);
    padding: 0 0.3em;
    border-radius: 3px;
    font-size: 0.9em;
}
.lecture-draft-body pre {
    background: #f0f0f0;
    padding: 0.4em 0.6em;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 0.3em 0;
}
.lecture-draft-body pre code {
    background: transparent;
    padding: 0;
}
.lecture-draft-body img {
    max-width: 100%;
    border-radius: 4px;
}

/* 句子里的内联 markdown：让 marked.parseInline 输出的元素继承句子样式 */
.sentence em,
.sentence strong,
.sentence code,
.sentence a {
    color: inherit;
}
.sentence code {
    background: rgba(0,0,0,0.06);
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.9em;
}
