:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2230;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #3b6fd8;
  --accent-ink: #ffffff;
  --accent-soft: #e8effc;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --bad: #c0392b;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --panel: #1c2028;
    --text: #e6e9ef;
    --muted: #9aa3b5;
    --line: #2c323d;
    --accent: #6d97ee;
    --accent-ink: #0e1420;
    --accent-soft: #1f2a40;
    --ok: #4cc283;
    --warn: #e0a24a;
    --bad: #ee7a6d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
.wide { width: 100%; padding: 10px; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.brand img { width: 26px; height: 26px; }
.brand.big { font-size: 28px; justify-content: center; }
.brand.big img { width: 40px; height: 40px; }

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.boot img { width: 28px; }

/* 로그인 */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; }
.tagline { text-align: center; color: var(--muted); margin: 10px 0 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.tab { border: 0; border-radius: 0; padding: 8px; background: transparent; }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
form input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.hint { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.msg { min-height: 1.4em; font-size: 14px; margin: 10px 0 0; }
.msg.error { color: var(--bad); }

.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.agree input { display: inline; width: auto; margin: 3px 0 0; }
.agree a, .side-foot a, .legal a { color: var(--accent); }
.auth-links { text-align: center; margin: 8px 0 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; }
.linkish:hover { color: var(--accent); }
.side-foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.side-foot .linkish { font-size: 12px; }

/* 약관·방침 페이지 */
.doc-page { overflow-y: auto; }
.legal { max-width: 720px; margin: 0 auto; padding: 28px 16px 64px; }
.legal .brand { text-decoration: none; color: var(--text); margin-bottom: 20px; }
.legal h1 { font-size: 24px; margin: 8px 0 4px; }
.legal h2 { font-size: 17px; margin: 26px 0 8px; }
.legal li { margin-bottom: 6px; }

/* 앱 틀 */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.field-select { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.field-select select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); max-width: 140px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

.layout { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 53px); }
.side { border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; background: var(--panel); }
.detail { --pb: 60px; overflow-y: auto; padding: 28px clamp(16px, 4vw, 48px) var(--pb); }

.drop { display: block; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px 10px; cursor: pointer; margin-bottom: 12px; }
.drop strong { display: block; color: var(--accent); }
.drop span { font-size: 12px; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.search { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.list li:hover { background: var(--bg); }
.list li.active { background: var(--accent-soft); border-color: var(--accent); }
.list .t { font-weight: 600; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list .m { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; }
.badge.working { color: var(--warn); }
.badge.failed { color: var(--bad); }
.badge.scanned { color: var(--muted); }
.empty { color: var(--muted); text-align: center; font-size: 14px; margin-top: 24px; }

/* 상세 */
.placeholder { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); }
.placeholder img { width: 56px; margin: 0 auto 10px; opacity: .5; }
.back { display: none; margin-bottom: 12px; }
.paper-title { font-size: 24px; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.3px; }
.paper-meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px; background: var(--accent-soft); }
.banner.failed { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.tldr { font-size: 17px; font-weight: 600; border-left: 4px solid var(--accent); padding: 4px 0 4px 14px; margin: 0 0 24px; }
.detail h2 { font-size: 17px; margin: 26px 0 8px; }
.detail p { margin: 0 0 8px; }
.detail ul { margin: 0; padding-left: 20px; }
.detail li { margin-bottom: 4px; }
.lines { white-space: pre-line; }
.hyp { width: 100%; border-collapse: collapse; font-size: 14px; }
.hyp td { border-top: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
.hyp td:first-child { font-weight: 700; white-space: nowrap; }
.hyp td:last-child { white-space: nowrap; color: var(--muted); }
.terms dt { font-weight: 700; margin-top: 10px; }
.terms dd { margin: 2px 0 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px); z-index: 20; }

.side-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.side-tools .search { margin-bottom: 0; flex: 1; min-width: 0; }
.small-btn { font-size: 12px; padding: 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 20px; }
.dtab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 12px; color: var(--muted); }
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.note h2 { font-size: 17px; margin: 26px 0 8px; }
.note h3 { font-size: 15px; margin: 18px 0 6px; }
.note-make { margin-top: 8px; }
.note-make .sub { display: block; font-size: 11px; font-weight: 400; opacity: .85; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0 16px; }
.detail { position: relative; }
.qa-log { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.qa-log .q { align-self: flex-end; max-width: 85%; background: var(--accent-soft); border-radius: 12px 12px 2px 12px; padding: 8px 12px; white-space: pre-wrap; }
.qa-log .a { max-width: 100%; line-height: 1.7; }
.qa-log #qaClear { align-self: flex-start; }
.cite { font-size: 11px; padding: 0 5px; margin: 0 1px; border-radius: 4px; vertical-align: 2px; background: var(--accent-soft); color: var(--accent); border-color: transparent; }
/* 상세 영역의 아래 여백만큼 내려 붙여야 입력창이 화면 맨 아래에 고정된다 */
.qa-form { position: sticky; bottom: calc(-1 * var(--pb)); display: flex; gap: 8px; background: var(--bg); padding: 8px 0 calc(var(--pb) + 8px); margin-bottom: calc(-1 * var(--pb)); }
.qa-form textarea { flex: 1; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.src-pop { position: absolute; z-index: 6; width: min(360px, calc(100% - 16px)); max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18); font-size: 14px; }
.src-pop p { margin: 4px 0 0; }
.qa-log .a h2 { font-size: 15px; margin: 12px 0 4px; }
.qa-log .a p { margin: 0 0 8px; }

/* 태그 */
.tagbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tchip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.tchip span { opacity: .7; }
.tchip.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tagrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 14px; }
.tagrow .tx { border: 0; background: none; padding: 0 0 0 2px; color: inherit; font-size: 13px; line-height: 1; }
.tag-input { width: 90px; font-size: 12px; padding: 2px 8px; border: 1px dashed var(--line); border-radius: 999px; background: transparent; }
.tag-input:focus { width: 140px; outline: none; border-color: var(--accent); }
.tag-sug { font-size: 12px; color: var(--muted); }
.tag-sug .linkish { font-size: 12px; text-decoration: none; color: var(--accent); }

/* 비교표 */
#cmpBtn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.list li { position: relative; }
.list .pick { position: absolute; left: 10px; top: 13px; margin: 0; }
.list li:has(.pick) { padding-left: 32px; }
.list li.picked { background: var(--accent-soft); }
.cmp-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 4px; background: var(--panel); border-top: 1px solid var(--line); font-size: 13px; }
.cmp-bar span { margin-right: auto; color: var(--muted); }
.col-toggles { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.col-toggles .tchip { cursor: pointer; }
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.cmp { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; text-align: left; min-width: 140px; max-width: 320px; }
.cmp th { position: sticky; top: 0; background: var(--panel); font-weight: 700; white-space: nowrap; }
.cmp td:first-child, .cmp th:first-child { position: sticky; left: 0; background: var(--panel); min-width: 220px; font-weight: 600; }
.synthesis { margin-top: 24px; }
.pref { font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }

/* 원문 읽기 */
.reader-bar { position: sticky; top: -28px; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--bg); padding: 8px 0; margin-bottom: 8px; }
.reader-bar .hint { font-size: 12px; color: var(--muted); }
.reader-bar .zoom { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
#dragMode.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pages { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pg { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); flex-shrink: 0; }
.pg canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(59, 111, 216, .3); }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
.regs { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.reg { position: absolute; pointer-events: auto; background: transparent; border: 2px solid transparent; border-radius: 4px; padding: 0; cursor: pointer; }
.reg:hover, .reg:focus-visible { border-color: var(--accent); background: rgba(59, 111, 216, .06); }
.reg .tag { position: absolute; top: -22px; left: -2px; display: none; font-size: 11px; white-space: nowrap; background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 4px; }
.reg:hover .tag, .reg:focus-visible .tag { display: block; }
.reg.equation:hover { border-style: dashed; }
.pages.drag-on .pg { cursor: crosshair; }
.pages.drag-on .textLayer, .pages.drag-on .regs { pointer-events: none; }
.dragbox { position: absolute; z-index: 5; border: 2px dashed var(--accent); background: rgba(59, 111, 216, .1); }
.sel-tool { position: absolute; z-index: 7; display: flex; gap: 2px; background: var(--text); border-radius: 8px; padding: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.sel-tool button { background: transparent; color: var(--bg); border: 0; font-size: 13px; padding: 4px 10px; }
.sel-tool button:hover { background: rgba(127,127,127,.3); }
.explain-pop { position: absolute; z-index: 8; max-height: 420px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 32px rgba(0,0,0,.22); font-size: 14px; }
.pop-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pop-body { padding: 10px 14px 12px; line-height: 1.7; }
.pop-body p { margin: 0 0 8px; }

/* 휴대폰: 목록과 상세를 한 화면씩 */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; }
  .detail { --pb: 48px; padding: 16px 16px var(--pb); }
  .layout.show-detail .side { display: none; }
  .layout:not(.show-detail) .detail { display: none; }
  .back { display: inline-block; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar .brand span { display: none; }
  .top-right { flex-wrap: nowrap; gap: 6px; }
  .field-select { font-size: 0; gap: 0; }
  .field-select select { font-size: 13px; max-width: 110px; }
  .pill { font-size: 11px; padding: 3px 8px; }
  #logoutBtn { font-size: 13px; padding: 4px 8px; }
  .drop span { display: none; }
  .paper-title { font-size: 20px; }
  .reader-bar { top: -16px; }
  .reader-bar .hint { display: none; }
}

/* ================= 읽기 화면 ================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn.small { width: 28px; height: 28px; font-size: 16px; }
#readerView { height: 100vh; }
.rv { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.rv-top { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 40px; }
.rv-back { font-weight: 600; white-space: nowrap; }
#rvLeftBtn { display: none; }
.rv-title { flex: 1 1 200px; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-tools { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.rv-tools .zoom { display: inline-flex; align-items: center; gap: 4px; }
.rv-tools #rvZoom { min-width: 42px; text-align: center; }
.rv-page { min-width: 70px; text-align: right; }
#rvDrag.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rv-actions { display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 40px; z-index: 30; min-width: 190px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column; }
.menu button { border: 0; text-align: left; padding: 9px 10px; border-radius: 6px; background: transparent; }
.menu button:hover { background: var(--bg); }
.menu button.danger { color: var(--bad); }

.rv-body { flex: 1; min-height: 0; display: flex; }
.rv-left { flex: 0 0 232px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 20px; }
.side-h { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 6px; padding: 0 8px; }
.toc { display: flex; flex-direction: column; gap: 1px; }
.toc-i { border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; line-height: 1.4; color: var(--text); }
.toc-i:hover { background: var(--accent-soft); color: var(--accent); }
.toc-i.lv2 { padding-left: 20px; font-size: 13px; color: var(--muted); }
.toc-i.lv3 { padding-left: 32px; font-size: 12.5px; color: var(--muted); }
.toc-i.fig { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hl-i { display: block; text-align: left; border: 0; border-left: 3px solid; border-radius: 0; background: transparent; padding: 3px 8px; margin: 0 0 6px 8px; font-size: 12.5px; line-height: 1.5; color: var(--text); width: calc(100% - 8px); }
.hl-i:hover { background: var(--bg); }

.rv-center { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 20px 16px 80px; position: relative; }
.rv-center .pages { gap: 16px; }
.hls { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: multiply; }
.hlbox { position: absolute; border-radius: 2px; opacity: .85; }
.hlbox.flash, .reg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.reg.flash { border-color: var(--accent); }

.rv-panel { flex: 0 0 400px; min-width: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
.sheet-handle { display: none; }
.rv-tabs { margin: 0; padding: 4px 8px 0; flex: 0 0 auto; }
.rv-tabs .count { font-size: 11px; color: var(--muted); font-weight: 400; }
.rv-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 20px; }
.rv-panel-body h2 { font-size: 16px; }
.rv-cards { display: flex; flex-direction: column; gap: 10px; }
.rv-cards:not(:empty) { margin-bottom: 16px; }
.ex-card { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); border-radius: 12px; padding: 10px 12px 12px; font-size: 14px; line-height: 1.7; }
.ex-head { display: flex; justify-content: space-between; align-items: center; color: var(--accent); }
.ex-quote { margin: 4px 0 6px; padding-left: 8px; border-left: 3px solid #F2C94C; color: var(--muted); font-size: 13px; }
.ex-body p { margin: 0 0 6px; }
.ex-actions { display: flex; gap: 6px; margin-top: 6px; }
.ps-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.ps-h { font-size: 12px; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }
.ps-tldr { font-weight: 600; font-size: 15px; line-height: 1.7; margin: 0; }
.ps-p { font-size: 14px; line-height: 1.7; }
.ps-chips { margin: 10px 0 14px; }
.acc { border: 1px solid var(--line); border-radius: 12px; }
.acc details { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.acc details:last-child { border-bottom: 0; }
.acc summary { font-weight: 700; font-size: 14px; cursor: pointer; }
.acc p, .acc ul, .acc dl, .acc table { font-size: 14px; line-height: 1.7; margin: 8px 0 2px; }
.rv-ask { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.rv-ask textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); line-height: 1.5; }
.rv-ask button { height: 40px; }
.empty-qa { text-align: center; padding: 20px 4px; }
.sugs { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.sug { text-align: left; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; }
.src-inline { margin: -4px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--bg); font-size: 13px; line-height: 1.6; }
.src-inline p { margin: 4px 0 0; }
.memos { display: flex; flex-direction: column; gap: 12px; }
.memo { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.memo-top { display: flex; align-items: center; gap: 8px; }
.memo-top .icon-btn { margin-left: auto; }
.memo-colors { display: inline-flex; gap: 4px; margin-left: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.cdot { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.cdot.on { border-color: var(--text); }
.memo-quote { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 0; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.memo-note { width: 100%; box-sizing: border-box; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--bg); font-size: 13.5px; line-height: 1.6; }
.sel-tool.fixed { position: fixed; z-index: 40; }
.sel-tool .dot { margin-right: 5px; vertical-align: -1px; }

@media (max-width: 1180px) {
  .rv-left { position: fixed; z-index: 25; left: 0; top: 53px; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .rv-left.open { transform: none; }
  #rvLeftBtn { display: inline-flex; }
  .rv-panel { flex-basis: 360px; }
}
@media (max-width: 800px) {
  .rv-top { gap: 6px; padding: 6px 8px; }
  .rv-back span, .rv-tools #rvDrag, .rv-tools .zoom, #rvCite { display: none; }
  .rv-actions #rvDocx { display: none; }
  .rv-center { padding: 10px 8px 52vh; }
  .rv-panel { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 50vh; border-left: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.18); transition: height .2s; }
  .rv-panel.min { height: 104px; }
  .rv-panel.min .rv-panel-body { display: none; }
  .sheet-handle { display: block; flex: 0 0 auto; border: 0; background: transparent; padding: 8px 0 2px; }
  .sheet-handle span { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto; }
  .rv-tabs .dtab { flex: 1; padding: 8px 4px; }
}
