/* Yilinhut Marginalia 2.0 */

.yhm-mark {
  background: color-mix(in srgb, var(--yh-accent, #0891b2) 16%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--yh-accent, #0891b2) 55%, transparent);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yhm-mark.is-hot {
  background: color-mix(in srgb, var(--yh-accent, #0891b2) 30%, transparent);
}

/* 选中浮出按钮 */
.yhm-fab {
  position: absolute;
  z-index: 9600;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--yh-accent, #0891b2);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.35);
}

.yhm-fab:hover {
  transform: translateY(-1px);
}

/* 就地编辑浮窗 */
.yhm-editor {
  position: absolute;
  z-index: 9700;
  width: min(340px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--yh-line, rgba(15, 23, 31, 0.14));
  background: var(--yh-panel, #fff);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 60px rgba(15, 23, 31, 0.22);
}

.yhm-editor blockquote {
  margin: 0 0 10px;
  padding: 6px 10px;
  border-left: 3px solid var(--yh-accent, #0891b2);
  background: color-mix(in srgb, var(--yh-accent, #0891b2) 7%, transparent);
  font-size: 12.5px;
  color: var(--yh-muted, #5c6875);
  border-radius: 0 8px 8px 0;
}

.yhm-editor__id {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.yhm-editor__id input {
  flex: 1;
  min-width: 0;
}

.yhm-editor input,
.yhm-editor textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--yh-line, rgba(15, 23, 31, 0.14));
  background: var(--yh-bg, #fff);
  color: var(--yh-ink, #11161c);
  font-size: 13.5px;
  outline: none;
  box-sizing: border-box;
}

.yhm-editor textarea:focus,
.yhm-editor input:focus {
  border-color: var(--yh-accent, #0891b2);
}

.yhm-editor__notify {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--yh-muted, #5c6875);
}

.yhm-editor__notify input {
  width: auto;
  margin: 0;
}

.yhm-editor__acts {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.yhm-editor__acts button {
  padding: 7px 16px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  font-size: 13px;
}

.yhm-cancel {
  background: transparent;
  color: var(--yh-muted, #5c6875);
}

.yhm-send {
  background: var(--yh-accent, #0891b2);
  color: #fff;
}

.yhm-send:disabled {
  opacity: 0.6;
}

.yhm-editor__msg {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--yh-muted, #5c6875);
}

/* 页边栏 */
.yhm-rail {
  position: absolute;
  z-index: 40;
}

.yhm-rail__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--yh-muted, #5c6875);
}

.yhm-rail__bar strong {
  font-weight: 600;
  letter-spacing: 0.08em;
}

.yhm-modes button {
  border: 1px solid var(--yh-line, rgba(15, 23, 31, 0.14));
  background: transparent;
  color: var(--yh-muted, #5c6875);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
}

.yhm-modes button:first-child {
  border-radius: 8px 0 0 8px;
}

.yhm-modes button:last-child {
  border-radius: 0 8px 8px 0;
}

.yhm-modes button.is-on {
  background: var(--yh-accent, #0891b2);
  border-color: var(--yh-accent, #0891b2);
  color: #fff;
}

.yhm-rail__list {
  position: relative;
  height: calc(100% - 30px);
}

.yhm-note {
  position: absolute;
  left: 0;
  right: 0;
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--yh-line, rgba(15, 23, 31, 0.12));
  background: var(--yh-panel, rgba(255, 255, 255, 0.85));
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.3s ease;
}

.yhm-note.is-hot,
.yhm-note:hover {
  border-color: var(--yh-accent, #0891b2);
  box-shadow: 0 6px 22px rgba(8, 145, 178, 0.18);
}

.yhm-note.is-pending {
  opacity: 0.65;
  border-style: dashed;
}

.yhm-note__quote {
  display: block;
  font-size: 11.5px;
  color: var(--yh-muted, #5c6875);
  border-left: 2px solid var(--yh-accent, #0891b2);
  padding-left: 8px;
  margin-bottom: 6px;
}

.yhm-note__body {
  display: block;
  font-style: normal;
  font-size: 13px;
  line-height: 1.6;
  color: var(--yh-ink, #11161c);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yhm-note__meta {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--yh-muted, #5c6875);
}

/* 模式行为 */
html[data-yhm-mode="off"] .yhm-rail {
  display: none !important;
}

html[data-yhm-mode="off"] .yhm-mark {
  background: transparent;
  border-bottom-style: dotted;
}

html[data-yhm-mode="auto"] .yhm-rail .yhm-note {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

html[data-yhm-mode="auto"] .yhm-rail:hover .yhm-note,
html[data-yhm-mode="auto"] .yhm-rail .yhm-note.is-hot {
  opacity: 1;
  pointer-events: auto;
}

/* 评论区引用块 */
.yhm-comment-quote {
  margin: 0 0 8px;
  padding: 6px 12px;
  border-left: 3px solid var(--yh-accent, #0891b2);
  background: color-mix(in srgb, var(--yh-accent, #0891b2) 6%, transparent);
  color: var(--yh-muted, #5c6875);
  font-size: 0.88em;
  border-radius: 0 8px 8px 0;
}

@media (max-width: 1319px) {
  .yhm-rail {
    display: none;
  }
}


/* 关闭后重开胶囊 */
.yhm-reopen {
  position: fixed;
  right: 16px;
  top: 45vh;
  z-index: 9000;
  padding: 8px 12px;
  border: 1px solid var(--yh-line, rgba(15, 23, 31, 0.14));
  border-radius: 999px;
  background: var(--yh-panel, #fff);
  color: var(--yh-accent, #0891b2);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(15, 23, 31, 0.14);
  writing-mode: vertical-rl;
  letter-spacing: 0.2em;
}

.yhm-reopen:hover {
  border-color: var(--yh-accent, #0891b2);
}
