/* Weaver · 划线批注样式（选词浮窗 / 新建弹层 / 批注楼弹层） */

/* ---- 划线标记（颜色用 --mark-color，applyMarks 按批注 color 注入） ---- */
.note-mark {
  background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--mark-color, #f0c45a) 55%, transparent) 55%);
  border-radius: 2px;
  cursor: pointer;
  color: inherit;
  transition: background .15s ease;
}
.note-mark:hover { background: linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--mark-color, #f0c45a) 80%, transparent) 45%); }
.note-mark.active {
  background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--mark-color, #f0c45a) 85%, transparent) 40%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mark-color, #f0c45a) 25%, transparent);
}

/* ---- 选词浮窗（色板 + 仅划线/写批注） ---- */
.quote-bubble {
  position: fixed; z-index: 110;
  padding: 6px;
  background: var(--color-primary, #a16b3b);
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; gap: 6px;
}
.qb-colors, .qn-colors { display: flex; align-items: center; gap: 6px; }
.cls-swatch {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; background: var(--c);
  box-sizing: border-box; flex: 0 0 auto;
}
.cls-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.qb-actions { display: flex; gap: 6px; }
.qb-btn {
  border: none; background: var(--color-primary, #a16b3b);
  color: #fff; font-size: 13px; padding: 7px 14px;
  border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.qb-btn:active { filter: brightness(.9); }
.qb-line { background: rgba(255, 255, 255, .16); }

/* 新建批注弹层（浅色底）内的色板选中态改用主色环 */
.qn-colors { padding-top: 2px; }
.note-compose .cls-swatch.on { border-color: var(--color-primary, #a16b3b); box-shadow: none; }

/* ---- 弹层通用 ---- */
.note-modal {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(30, 24, 16, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.note-modal.hidden { display: none; }
.note-box {
  width: min(520px, 100%);
  max-height: 86vh; overflow-y: auto;
  background: #fffdf8; border-radius: 14px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  position: relative;
}
.qn-close {
  position: absolute; top: 8px; right: 12px;
  border: none; background: none; color: #8a8174;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.qn-close:active { color: var(--color-primary, #a16b3b); }

/* ---- 新建批注弹层 ---- */
.note-compose .note-box { display: flex; flex-direction: column; gap: 12px; }
.qn-quote {
  font-size: 14px; line-height: 1.7; color: #8a5a2c;
  background: #f7efdf; border-left: 3px solid var(--color-primary, #a16b3b);
  padding: 10px 12px; border-radius: 0 8px 8px 0;
  max-height: 90px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.qn-input, .qn-reply-input {
  width: 100%; border: 1px solid #e6ddcd; border-radius: 8px;
  background: #fff; color: #3a342c; padding: 10px 12px;
  font-family: inherit; font-size: 14px; line-height: 1.7; resize: none; outline: none;
}
.qn-input:focus, .qn-reply-input:focus { border-color: var(--color-primary, #a16b3b); }
.qn-submit {
  align-self: flex-end; border: none; border-radius: 8px;
  background: var(--color-primary, #a16b3b); color: #fff;
  padding: 9px 22px; font-size: 14px; cursor: pointer;
}
.qn-submit:disabled { opacity: .5; }
.qn-submit:active { filter: brightness(.9); }

/* ---- 批注楼弹层 ---- */
.qn-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 6px; }
.qn-count { font-size: 13px; color: #8a8174; }
.qn-sort { display: flex; border: 1px solid #e6ddcd; border-radius: 8px; overflow: hidden; }
.qn-sortbtn {
  border: none; background: #fffdf8; color: #8a8174;
  padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.qn-sortbtn + .qn-sortbtn { border-left: 1px solid #e6ddcd; }
.qn-sortbtn.active { background: var(--color-primary, #a16b3b); color: #fff; }

.qn-list { display: flex; flex-direction: column; margin-top: 4px; }
.qn-floor {
  padding: 12px 2px 12px 6px;
  border-bottom: 1px dashed #e6ddcd;
}
.qn-head { font-size: 13px; color: #3a342c; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.qn-repto { color: #a16b3b; font-size: 12px; }
.qn-time { color: #a49a8b; font-size: 12px; margin-left: auto; }
.qn-text { font-size: 15px; line-height: 1.75; color: #3a342c; margin: 6px 0 6px; word-break: break-word; }
.qn-actions { display: flex; align-items: center; gap: 14px; }
.qn-actions button {
  border: none; background: none; color: #8a8174;
  font-size: 12px; cursor: pointer; padding: 2px 2px;
  display: inline-flex; align-items: center; gap: 4px;
}
.qn-actions .qn-like.on { color: #e07b3a; font-weight: 600; }
.qn-lcnt { font-variant-numeric: tabular-nums; }
.qn-del { color: #c0504d !important; }
.qn-likers {
  margin-top: 8px; padding: 8px 10px; background: #f7efdf;
  border-radius: 8px; font-size: 13px; color: #8a5a2c; line-height: 1.8;
  word-break: break-all;
}
.qn-replybox { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.qn-reply-actions { display: flex; gap: 10px; justify-content: flex-end; }
.qn-submit2 {
  border: none; background: var(--color-primary, #a16b3b); color: #fff;
  padding: 6px 18px; border-radius: 7px; font-size: 13px; cursor: pointer;
}
.qn-submit2:active { filter: brightness(.9); }
.qn-cancel2 {
  border: 1px solid #e6ddcd; background: none; color: #8a8174;
  padding: 6px 14px; border-radius: 7px; font-size: 13px; cursor: pointer;
}
.qn-more {
  margin: 14px auto 4px; display: block;
  border: 1px solid var(--color-primary, #a16b3b); background: #fffdf8;
  color: var(--color-primary, #a16b3b); padding: 8px 26px;
  border-radius: 18px; font-size: 13px; cursor: pointer;
}
.qn-more:active { background: #f7efdf; }
.qn-empty { text-align: center; color: #a49a8b; padding: 30px 0; font-size: 14px; }

/* ---- toast ---- */
#qn-toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(8px);
  background: rgba(30, 24, 16, .9); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: 84vw; text-align: center;
}
#qn-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 长按「划词写批注」入口（B 方案） ---- */
#lp-entry {
  position: fixed; z-index: 130;
  padding: 9px 15px;
  background: var(--color-primary, #a16b3b);
  color: #fff; font-size: 14px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  cursor: pointer; white-space: nowrap;
}
#lp-entry:active { filter: brightness(.9); transform: translateY(1px); }

/* ---- 移动端 ---- */
@media (max-width: 600px) {
  .note-modal { padding: 10px; align-items: flex-end; }
  .note-box { width: 100%; max-height: 78vh; border-radius: 16px 16px 0 0; padding: 18px 14px calc(var(--bottom-h) + 14px); }
  .quote-bubble { z-index: 115; max-width: 96vw; }
  .quote-bubble .cls-swatch { width: 15px; height: 15px; }
}