/* 阅读器「共读」样式 (css/modules/reader_corread.css)
   柔和奶油 + 鼠尾草绿 + 蜜桃，不再依赖阅读主题的灰色半透明底 */

#reader-view-screen {
    --rc-bg1: #fffdf9;
    --rc-bg2: #f9f1e6;
    --rc-card: #ffffff;
    --rc-text: #4a3f39;
    --rc-sub: #a0928a;
    --rc-line: rgba(140, 105, 80, .14);
    --rc-me1: #bfe0cc;
    --rc-me2: #a4d0b8;
    --rc-me-text: #22372c;
    --rc-accent: #6fae92;
    --rc-accent-dk: #4f8f74;
    --rc-warm: #f1b49c;
    --rc-warm-dk: #c97a5c;
    --rc-note-bg1: #fff6ec;
    --rc-note-bg2: #ffeee0;
    --rc-note-line: #f4cdb9;
    --rc-shadow: 0 6px 22px rgba(120, 85, 60, .16);
}
html[data-ui="dark"] #reader-view-screen,
#reader-view-screen.reader-theme-dark {
    --rc-bg1: #302d33;
    --rc-bg2: #26242a;
    --rc-card: #3d3a42;
    --rc-text: #ece5df;
    --rc-sub: #a99f98;
    --rc-line: rgba(255, 255, 255, .1);
    --rc-me1: #55826b;
    --rc-me2: #476f5a;
    --rc-me-text: #f0f8f3;
    --rc-accent: #8fc9ab;
    --rc-accent-dk: #8fc9ab;
    --rc-warm: #d99a84;
    --rc-warm-dk: #e8aa93;
    --rc-note-bg1: #433633;
    --rc-note-bg2: #3b2f2d;
    --rc-note-line: #6d4d41;
    --rc-shadow: 0 6px 22px rgba(0, 0, 0, .45);
}

/* ───── 页脚按钮 ───── */
.rc-foot-btn.on { opacity: 1; }
.rc-foot-btn.on svg { stroke-width: 2.4; }
.rc-foot-btn.on::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--rc-accent);
    vertical-align: middle;
}

/* ───── 头像小标 ───── */
.rc-chip {
    position: absolute;
    right: 12px;
    top: 74px;
    width: 40px; height: 40px;
    border-radius: 50%;
    z-index: 250;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--rc-me1), var(--rc-warm));
    box-shadow: 0 3px 12px rgba(120, 85, 60, .28);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.rc-chip-av, .rc-char-av, .rc-msg-av, .rc-sheet-av, .rc-note-av, .rc-cm-av {
    display: inline-block;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #e7dccf;
    flex-shrink: 0;
}
.rc-av-letter {
    display: inline-flex; align-items: center; justify-content: center;
    color: #6b5a4e;
    font-weight: 700;
    background-image: linear-gradient(135deg, #fbe9dc, #e6f1ea);
}
.rc-chip-av { width: 34px; height: 34px; font-size: 15px; border: 2px solid #fff; box-sizing: border-box; }
.rc-chip-dot {
    position: absolute;
    right: 0; bottom: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #7fd1a0;
    border: 2px solid #fff;
}
.rc-chip.busy::before {
    content: '';
    position: absolute; inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--rc-accent);
    animation: rc-pulse 1.4s ease-in-out infinite;
}
@keyframes rc-pulse {
    0%   { transform: scale(.92); opacity: .9; }
    70%  { transform: scale(1.2); opacity: 0; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* ───── 小浮泡 ───── */
.rc-bubble {
    position: absolute;
    right: 58px;
    top: 79px;
    max-width: min(56%, 190px);
    padding: 6px 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffffff, var(--rc-note-bg1));
    color: #4a3f39;
    font-size: 12.5px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    border: 1px solid var(--rc-note-line);
    box-shadow: 0 3px 12px rgba(120, 85, 60, .16);
    z-index: 250;
    opacity: 0;
    transform: translateY(-4px) scale(.97);
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    white-space: pre-wrap;
    word-break: break-word;
}
.rc-bubble.show { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
html[data-ui="dark"] .rc-bubble,
.reader-theme-dark .rc-bubble { background: linear-gradient(135deg, #46403f, #3b2f2d); color: #ece5df; }

/* ───── 通用浮层 ───── */
.rc-overlay {
    position: absolute;
    inset: 0;
    z-index: 450;
    display: none;
    background: rgba(60, 40, 30, .36);
    align-items: flex-end;
    justify-content: center;
}
.rc-overlay.show { display: flex; }
.rc-composer { background: transparent; }

.rc-x {
    background: none; border: none;
    color: var(--rc-sub);
    font-size: 20px; line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
}
.rc-btn {
    border: 1px solid var(--rc-line);
    background: var(--rc-card);
    color: var(--rc-text);
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 12px;
    cursor: pointer;
}
.rc-btn.primary {
    background: linear-gradient(135deg, #8cc5a9, var(--rc-accent));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(40, 80, 60, .25);
    box-shadow: 0 3px 10px rgba(111, 174, 146, .35);
}
.rc-btn.ghost { background: transparent; }
.rc-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }

.rc-quote {
    margin: 0 0 8px;
    padding: 6px 10px;
    border-left: 3px solid var(--rc-warm);
    background: var(--rc-note-bg1);
    border-radius: 0 8px 8px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--rc-sub);
    word-break: break-word;
}

.rc-input-row { display: flex; gap: 8px; align-items: center; }
.rc-input {
    flex: 1; min-width: 0;
    border: 1.5px solid var(--rc-line);
    background: var(--rc-card);
    color: var(--rc-text);
    border-radius: 14px;
    padding: 10px 13px;
    font-size: 14px;
    outline: none;
}
.rc-input:focus { border-color: var(--rc-accent); }
.rc-input::placeholder { color: var(--rc-sub); }

/* ───── 邀请 / 设置卡片 ───── */
.rc-card {
    width: 100%;
    max-height: 82%;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--rc-bg1), var(--rc-bg2));
    color: var(--rc-text);
    border-radius: 24px 24px 0 0;
    box-shadow: var(--rc-shadow);
}
.rc-card-head, .rc-sheet-head, .rc-comp-head {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 16px 8px;
    font-weight: 700;
}
.rc-card-head { justify-content: space-between; font-size: 17px; }
.rc-card-body { padding: 4px 16px 8px; overflow-y: auto; }
.rc-card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 16px 20px; }
.rc-label { font-size: 12.5px; color: var(--rc-sub); margin: 14px 0 8px; font-weight: 600; }
.rc-hint { font-size: 12px; color: var(--rc-sub); margin: 8px 0 4px; line-height: 1.55; }
.rc-empty { padding: 26px 14px; text-align: center; font-size: 13px; color: var(--rc-sub); line-height: 1.7; }

.rc-char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.rc-char {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 10px 4px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: var(--rc-card);
    color: var(--rc-text);
    box-shadow: 0 2px 8px rgba(120, 85, 60, .08);
    cursor: pointer;
}
.rc-char.sel { border-color: var(--rc-accent); background: linear-gradient(180deg, var(--rc-card), var(--rc-note-bg1)); }
.rc-char-av { width: 46px; height: 46px; font-size: 19px; }
.rc-char-name { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rc-seg { display: flex; border-radius: 14px; overflow: hidden; background: var(--rc-card); box-shadow: inset 0 0 0 1.5px var(--rc-line); }
.rc-seg button {
    flex: 1; padding: 9px 0;
    border: none; background: transparent;
    color: var(--rc-text);
    font-size: 14px; cursor: pointer;
}
.rc-seg button.sel { background: linear-gradient(135deg, #8cc5a9, var(--rc-accent)); color: #fff; font-weight: 700; }

.rc-switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 12px; font-size: 13px; color: var(--rc-text);
}
.rc-switch-row input { width: 18px; height: 18px; accent-color: var(--rc-accent); }

/* ───── 共读聊天室 sheet ───── */
.rc-sheet-panel {
    width: 100%; height: 74%;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--rc-bg1), var(--rc-bg2));
    color: var(--rc-text);
    border-radius: 24px 24px 0 0;
    box-shadow: var(--rc-shadow);
    position: relative;
}
.rc-sheet-panel::before {
    content: '';
    position: absolute; top: 6px; left: 50%;
    width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px;
    background: var(--rc-line);
}
.rc-sheet-head {
    padding: 18px 10px 12px 16px;
    background: linear-gradient(135deg, rgba(191, 224, 204, .55), rgba(241, 180, 156, .4));
    border-radius: 24px 24px 0 0;
}
.rc-sheet-av { width: 40px; height: 40px; font-size: 16px; border: 2px solid #fff; box-sizing: border-box; }
.rc-sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.rc-sheet-title b { font-size: 15.5px; color: var(--rc-text); }
.rc-sheet-title small { font-size: 11.5px; color: var(--rc-sub); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-list { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 12px; }
.rc-sheet .rc-input-row { padding: 10px 14px 18px; border-top: 1px solid var(--rc-line); }

.rc-msg { display: flex; gap: 7px; max-width: 82%; }
.rc-msg.me { align-self: flex-end; flex-direction: column; align-items: flex-end; }
.rc-msg.ta { align-self: flex-start; align-items: flex-start; }
.rc-msg-av { width: 26px; height: 26px; font-size: 11px; align-self: flex-end; }
.rc-bub {
    padding: 7px 13px;
    border-radius: 18px;
    font-size: 14px; line-height: 1.55;
    background: var(--rc-card);
    color: var(--rc-text);
    box-shadow: 0 2px 8px rgba(120, 85, 60, .1);
    white-space: pre-wrap; word-break: break-word;
}
.rc-msg.me .rc-bub {
    background: linear-gradient(135deg, var(--rc-me1), var(--rc-me2));
    color: var(--rc-me-text);
}
.rc-msg.me .rc-quote { max-width: 100%; }

/* 批注卡片（点击跳转） */
.rc-note {
    align-self: stretch;
    padding: 11px 13px 9px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--rc-note-bg1), var(--rc-note-bg2));
    border: 1px solid var(--rc-note-line);
    box-shadow: 0 3px 10px rgba(201, 122, 92, .12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.rc-note:active { transform: scale(.985); }
.rc-note-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rc-warm-dk); font-weight: 700; }
.rc-note-top em { margin-left: auto; font-style: normal; font-weight: 500; color: var(--rc-sub); font-size: 11.5px; }
.rc-note-av { width: 20px; height: 20px; font-size: 10px; }
.rc-note-quote {
    margin: 8px 0 6px;
    padding-left: 9px;
    border-left: 3px solid var(--rc-warm);
    font-size: 12.5px; line-height: 1.5;
    color: var(--rc-sub);
}
.rc-note-text { margin-top: 7px; font-size: 14.5px; line-height: 1.65; color: var(--rc-text); word-break: break-word; }
.rc-note-quote + .rc-note-text { margin-top: 0; }
.rc-note-me {
    margin: 2px 0 6px;
    padding: 5px 10px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--rc-me1), var(--rc-me2));
    color: var(--rc-me-text);
    font-size: 13px; line-height: 1.5;
    width: fit-content; max-width: 92%;
    margin-left: auto;
}
.rc-note-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.rc-note-go { font-size: 12px; font-weight: 700; color: var(--rc-accent-dk); }
.rc-note-reply {
    border: 1px solid var(--rc-note-line);
    background: var(--rc-card);
    color: var(--rc-warm-dk);
    font-size: 12px; font-weight: 700;
    padding: 4px 14px;
    border-radius: 14px;
    cursor: pointer;
}

.rc-typing { display: inline-flex; gap: 4px; padding: 11px 14px; }
.rc-typing i {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--rc-accent); opacity: .4;
    animation: rc-blink 1.2s infinite;
}
.rc-typing i:nth-child(2) { animation-delay: .2s; }
.rc-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes rc-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ───── 说给TA听 小输入框 ───── */
.rc-comp-card {
    width: 100%;
    margin-bottom: 52px;
    padding: 4px 14px 14px;
    background: linear-gradient(180deg, var(--rc-bg1), var(--rc-bg2));
    color: var(--rc-text);
    border-radius: 20px;
    box-shadow: var(--rc-shadow);
    max-width: calc(100% - 20px);
}
.rc-comp-head { padding: 10px 0 8px; font-size: 14px; }
.rc-comp-head > span:not(.rc-msg-av) { flex: 1; }
.rc-composer.show { padding-bottom: 8px; }

/* ───── 跳转后的段落高亮 ───── */
@keyframes rc-flash {
    0%   { background: rgba(241, 180, 156, .75); box-shadow: 0 0 0 6px rgba(241, 180, 156, .75); }
    60%  { background: rgba(241, 180, 156, .4);  box-shadow: 0 0 0 6px rgba(241, 180, 156, .4); }
    100% { background: transparent;              box-shadow: 0 0 0 6px transparent; }
}
#reader-text-content p.rc-flash { animation: rc-flash 2.6s ease-out; border-radius: 6px; }

/* ───── 段评面板里的角色批注（共读开启时） ───── */
.rc-active .reader-comment-quote {
    border-left-color: var(--rc-warm);
    background: var(--rc-note-bg1);
    opacity: 1;
    color: var(--rc-sub);
    border-radius: 0 10px 10px 0;
}
.reader-comment-item.rc-char-comment {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--rc-note-bg1), var(--rc-note-bg2));
    border: 1px solid var(--rc-note-line);
    box-shadow: 0 3px 10px rgba(201, 122, 92, .12);
}
.reader-comment-item.rc-char-comment .reader-comment-user {
    display: flex; align-items: center; gap: 6px;
    color: var(--rc-warm-dk);
    font-weight: 700;
}
.reader-comment-item.rc-char-comment .reader-comment-content { color: var(--rc-text); font-size: 14.5px; line-height: 1.65; margin-top: 6px; }
.reader-comment-item.rc-char-comment .reader-comment-time { color: var(--rc-sub); opacity: 1; }
.rc-cm-av { width: 22px; height: 22px; font-size: 11px; }
.rc-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--rc-me1), var(--rc-me2));
    color: var(--rc-me-text);
    font-size: 10.5px;
    font-weight: 500;
    vertical-align: middle;
}

/* 共读开启时，段评面板整体也换成柔和配色（不再是灰色半透明） */
.rc-active .reader-comment-panel {
    background: linear-gradient(180deg, var(--rc-bg1), var(--rc-bg2));
    border-radius: 24px 24px 0 0;
    box-shadow: var(--rc-shadow);
}
.rc-active .reader-comment-header { color: var(--rc-text); border-bottom-color: var(--rc-line); }
.rc-active .reader-comment-input-area { background: transparent; border-top-color: var(--rc-line); }
.rc-active #reader-comment-input {
    background: var(--rc-card);
    color: var(--rc-text);
    border: 1.5px solid var(--rc-line);
    border-radius: 14px;
}
.rc-active #reader-comment-input:focus { border-color: var(--rc-accent); outline: none; }
.rc-active #reader-comment-send {
    background: linear-gradient(135deg, #8cc5a9, var(--rc-accent));
    color: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(111, 174, 146, .35);
}

.rc-gear { display: inline-flex; align-items: center; justify-content: center; }
.rc-gear svg { display: block; }

/* 面板里"正在回你"的卡片 */
.rc-typing-card .rc-typing { padding: 8px 2px 2px; }

/* 阅读正文不允许系统选字/弹出系统菜单：长按只出我们自己的工具栏 */
#reader-text-content,
#reader-text-content * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* ───── 同步阅读摘要到聊天 ───── */
.rc-sync-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--rc-line);
    background: var(--rc-note-bg1);
}
.rc-sync-stat { font-size: 12px; color: var(--rc-sub); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sync-btn {
    flex-shrink: 0;
    border: none;
    background: linear-gradient(135deg, #8cc5a9, var(--rc-accent));
    color: #fff;
    font-size: 12.5px; font-weight: 700;
    padding: 6px 14px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(111, 174, 146, .35);
    cursor: pointer;
}
.rc-sync-btn:disabled { opacity: .55; box-shadow: none; }

.rc-sync-card {
    align-self: stretch;
    padding: 10px 13px 8px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(191, 224, 204, .55), rgba(191, 224, 204, .25));
    border: 1px solid rgba(111, 174, 146, .45);
    cursor: pointer;
}
.rc-sync-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--rc-accent-dk); }
.rc-sync-top em { font-style: normal; font-weight: 500; color: var(--rc-sub); }
.rc-sync-text {
    margin-top: 6px;
    font-size: 13.5px; line-height: 1.6;
    color: var(--rc-text);
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    white-space: pre-wrap; word-break: break-word;
}
.rc-sync-card.open .rc-sync-text { -webkit-line-clamp: unset; display: block; }
.rc-sync-more { margin-top: 5px; text-align: right; font-size: 11px; color: var(--rc-sub); }

.rc-switch-sub { margin: 2px 0 2px; font-size: 11.5px; line-height: 1.5; color: var(--rc-sub); }
