/* 详情里的对话：左边详情，右边评论和记录。窄屏换成三栏切换。颜色都用系统变量，深色跟着走。 */
.talk-split [hidden] { display: none !important; }
.talk-split { flex: 1; min-height: 0; display: flex; }
.talk-split > .sheet-body { flex: 1; min-width: 0; }
.talk-pane { flex: none; width: clamp(340px, 42%, 480px); min-height: 0; display: flex; flex-direction: column; background: var(--surface); box-shadow: -1px 0 0 var(--sep); }
.talk-split.narrow { flex-direction: column; }
.talk-split.narrow > .talk-pane { flex: 1; width: auto; box-shadow: none; }
.talk-tabs { flex: none; padding: 8px 12px; }
.talk-split.narrow > .talk-tabs { background: var(--material); box-shadow: inset 0 -1px 0 var(--sep); }
.talk-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.talk-records { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.talk-records .timeline { padding-top: 6px; }

/* 详情放了两栏，用大一档的弹层 */
@media (min-width: 761px) {
  .sheet.has-talk:not(.full) { width: min(var(--modal-preview-w), calc(100vw - 64px)); }
  .sheet.full.has-talk .talk-split:not(.narrow) > .sheet-body { padding: 24px max(24px, calc((100vw - 480px - 760px) / 2)) 48px; }
  .sheet.full.has-talk .talk-pane { width: 480px; }
}

.talk-body { position: relative; flex: 1; min-height: 0; display: flex; }
.talk-scroll { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.talk-list { display: flex; flex-direction: column; min-height: 100%; padding: 4px 14px 12px; }
.talk-list::before { content: ""; flex: 1; }
.talk-empty { margin: auto; padding: 24px 12px; color: var(--label-3); font-size: 14px; text-align: center; }

.talk-day { align-self: center; margin: 14px 0 4px; color: var(--label-3); font-size: 12px; font-weight: 500; }
.talk-sys {
  align-self: center; max-width: 92%; margin: 8px 0 2px; padding: 1px 8px; border-radius: 8px; color: var(--label-3); font-size: 13px; line-height: 1.45; text-align: center;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}

.talk-msg { display: flex; gap: 8px; margin-top: 3px; }
.talk-msg.head { margin-top: 12px; }
.talk-msg.mine { flex-direction: row-reverse; }
.talk-av { flex: none; width: 32px; }
.talk-av .av { width: 32px; height: 32px; font-size: 14px; }
.talk-col { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.talk-msg.mine .talk-col { align-items: flex-end; }
.talk-meta { display: flex; align-items: baseline; gap: 6px; margin-bottom: 3px; color: var(--label-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.talk-name { color: var(--label-2); font-weight: 500; }
.talk-line { display: flex; align-items: center; gap: 4px; width: 100%; }
.talk-msg.mine .talk-line { flex-direction: row-reverse; }
/* 留出放操作的位置，长气泡旁边也放得下“回复” */
.talk-stack { min-width: 0; max-width: calc(100% - 72px); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.talk-msg.mine .talk-stack { align-items: flex-end; }

.talk-bubble { max-width: 100%; padding: 7px 12px; border-radius: 16px; background: var(--fill); color: var(--label); font-size: 15px; line-height: 1.45; }
.talk-msg.other.head .talk-bubble { border-top-left-radius: 6px; }
.talk-msg.mine .talk-bubble { background: var(--accent); color: #fff; }
.talk-msg.mine.head .talk-bubble { border-top-right-radius: 6px; }
.talk-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.talk-text a { color: var(--accent-text); }
.talk-msg.mine .talk-text a { color: #fff; }
.talk-at { color: var(--accent-text); font-weight: 500; }
.talk-at.me { padding: 0 3px; border-radius: 4px; background: var(--accent-soft); }
.talk-msg.mine .talk-at { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.talk-msg.mine .talk-at.me { background: none; }
.talk-label { margin-bottom: 1px; font-size: 12px; font-weight: 600; color: var(--orange); }
.talk-msg.mine .talk-label { color: rgba(255, 255, 255, .85); }

.talk-quote { display: block; width: 100%; margin: 1px 0 5px; padding: 3px 8px; border-left: 3px solid var(--accent); border-radius: 4px 8px 8px 4px; background: var(--fill-soft); color: inherit; font-size: 13px; line-height: 1.4; text-align: left; }
.talk-quote:hover { background: var(--fill); }
.talk-quote-name { display: block; font-weight: 600; }
.talk-quote-text { display: block; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-msg.mine .talk-quote { border-left-color: rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .18); }
.talk-msg.mine .talk-quote:hover { background: rgba(255, 255, 255, .26); }

.talk-media { display: flex; flex-wrap: wrap; gap: 4px; max-width: 100%; }
.talk-msg.mine .talk-media { justify-content: flex-end; }
.talk-image { display: block; max-width: 100%; overflow: hidden; border-radius: 12px; background: var(--fill-soft); line-height: 0; cursor: zoom-in; }
.talk-image img { display: block; width: auto; height: auto; min-width: 48px; min-height: 48px; max-width: 240px; max-height: 220px; object-fit: contain; }
.talk-video { display: block; width: min(260px, 100%); max-height: 240px; border-radius: 12px; background: #000; }

/* 回复和“…”：悬停出现，手机上长按出现 */
.talk-actions { flex: none; display: inline-flex; align-items: center; opacity: 0; pointer-events: none; }
.talk-msg.active .talk-actions, .talk-actions:focus-within, .talk-actions:has([aria-expanded="true"]) { opacity: 1; pointer-events: auto; }
@media (hover: hover) { .talk-msg:hover .talk-actions { opacity: 1; pointer-events: auto; } }
.talk-act { min-height: 26px; padding: 2px 7px; border-radius: 7px; color: var(--label-2); font-size: 13px; white-space: nowrap; }
.talk-act:hover { background: var(--fill); color: var(--label); }
.talk-actions .more-btn { width: 26px; height: 26px; }
@media (hover: none) {
  /* 长按是出操作，不是选字 */
  .talk-bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .talk-actions { display: none; }
  .talk-msg.active .talk-actions { display: inline-flex; }
  .talk-act { min-height: 34px; padding: 4px 10px; font-size: 14px; background: var(--fill); }
  .talk-actions .more-btn { width: 34px; height: 34px; }
}

/* 通知或引用点过来时亮一下 */
@keyframes talk-flash {
  0%, 55% { box-shadow: 0 0 0 4px var(--talk-flash); }
  100% { box-shadow: 0 0 0 4px transparent; }
}
@keyframes talk-flash-line {
  0%, 55% { background-color: var(--talk-flash); }
  100% { background-color: transparent; }
}
:root { --talk-flash: rgba(255, 204, 0, .55); }
.talk-msg.flash .talk-stack { border-radius: 16px; animation: talk-flash 1.7s ease-out; }
.talk-sys.flash { animation: talk-flash-line 1.7s ease-out; }

.talk-new {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 12px 4px 8px; border-radius: 999px;
  background: var(--surface-raised); box-shadow: var(--shadow-float); outline: 1px solid var(--sep); color: var(--accent-text); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.talk-new svg { width: 15px; height: 15px; }

/* 输入框 */
.talk-composer { position: relative; flex: none; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); box-shadow: inset 0 1px 0 var(--sep); }
.talk-input { display: flex; align-items: flex-end; gap: 6px; }
.talk-textarea {
  flex: 1; min-width: 0; display: block; max-height: 132px; padding: 7px 12px; border: 0; border-radius: 18px; background: var(--fill-soft); color: var(--label);
  font: inherit; font-size: 15px; line-height: 1.45; resize: none; overflow-y: auto; outline: none; box-shadow: inset 0 0 0 1px var(--sep);
}
.talk-textarea:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.talk-textarea::placeholder { color: var(--label-3); }
.talk-add, .talk-send { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.talk-add { color: var(--label-2); }
.talk-add:hover { background: var(--fill); color: var(--label); }
.talk-add svg { width: 20px; height: 20px; }
.talk-send { background: var(--accent); color: #fff; transition: opacity .15s; }
.talk-send:hover:not(:disabled) { background: var(--accent-press); }
.talk-send:disabled { background: var(--fill-strong); color: var(--surface); cursor: default; }
.talk-send svg { width: 18px; height: 18px; }
.talk-denied { flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); color: var(--label-3); font-size: 13px; text-align: center; box-shadow: inset 0 1px 0 var(--sep); }

.talk-replying { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 5px 6px 5px 10px; border-left: 3px solid var(--accent); border-radius: 4px 8px 8px 4px; background: var(--fill-soft); font-size: 13px; color: var(--label-2); }
.talk-replying-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-replying strong { color: var(--label); font-weight: 600; }
.talk-x { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--fill-strong); color: var(--label); font-size: 15px; line-height: 1; }
.talk-pending { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; padding-top: 4px; }
.talk-thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; background: var(--fill); display: grid; place-items: center; }
.talk-thumb img { width: 100%; height: 100%; border-radius: 10px; object-fit: cover; }
.talk-thumb-name { padding: 4px; font-size: 11px; color: var(--label-2); text-align: center; overflow: hidden; overflow-wrap: anywhere; max-height: 100%; }
.talk-thumb .talk-x { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; font-size: 14px; background: var(--label-2); color: var(--surface); }
.talk-composer .upload-progress { margin-bottom: 8px; }

.talk-mention {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 4px); z-index: 3; max-height: 232px; overflow-y: auto; padding: 5px; border-radius: 12px;
  background: var(--surface-raised); box-shadow: var(--shadow-float); outline: 1px solid var(--sep);
}
.talk-mention-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 4px 8px; border-radius: 8px; text-align: left; font-size: 14px; color: var(--label); }
.talk-mention-item[aria-selected="true"] { background: var(--accent-soft); }
.talk-mention-name { font-weight: 500; }
.talk-mention-pos { margin-left: auto; color: var(--label-3); font-size: 13px; white-space: nowrap; }

@media (max-width: 760px) {
  .talk-textarea { font-size: 16px; }
  .talk-add, .talk-send { width: 38px; height: 38px; }
  .talk-mention-item { min-height: 44px; }
}
