/* 02 聊天：列表、对话、＋ 面板 */

/* ---------- 列表 ---------- */
.clist { padding: 54px 16px 24px; }
.clist-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 0 12px 8px; border-bottom: 1px solid var(--rule); margin: 0 8px; }
.clist-head h1 { margin: 0; font-family: var(--font-song); font-size: 30px; font-weight: 300; letter-spacing: .3em; line-height: 1.1; }
.clist-head .sub { font-family: var(--font-song); font-size: 11px; letter-spacing: .3em; color: var(--ink-soft); margin-top: 6px; }
.clist-group { display: flex; align-items: center; gap: 6px; padding: 14px 4px 8px; }
.clist-group .sheet-label { margin-right: auto; }
.chip-btn { height: 26px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-song); font-size: 11px; letter-spacing: .15em; }
.chip-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.crow { width: 100%; height: 76px; padding: 0 14px; display: flex; align-items: center; gap: 12px; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 3px 8px rgba(120, 100, 60, .06); }
.crow + .crow { margin-top: 10px; }
.crow .av { position: relative; flex: none; }
.crow .av img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--rule); }
.crow .av i { position: absolute; right: -1px; bottom: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--paper-card); }
.crow .ic { width: 42px; height: 42px; flex: none; border-radius: 12px; border: 1px solid var(--rule); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-song); font-size: 15px; }
.crow .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crow .l1 { display: flex; align-items: baseline; gap: 8px; }
.crow .name { font-family: var(--font-song); font-size: 15px; letter-spacing: .15em; }
.crow .model { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-faint); }
.crow .time { margin-left: auto; font-family: var(--font-latin); font-size: 11px; color: var(--ink-soft); }
.crow .l2 { display: flex; align-items: center; gap: 8px; }
.crow .last { flex: 1; min-width: 0; font-size: 13px; color: #8A7D6E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #E39A63; color: var(--paper-card); font-family: var(--font-latin); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.chistory { width: 100%; height: 30px; margin: 6px 0 0; padding: 0 14px; display: flex; align-items: center; gap: 8px; font-family: var(--font-song); font-size: 11px; letter-spacing: .1em; color: var(--ink-soft); border-bottom: 1px dashed var(--rule); }
.chistory svg { width: 13px; height: 13px; flex: none; }
.chistory span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.chistory b { flex: none; white-space: nowrap; font-family: var(--font-latin); font-weight: 400; }
.cnew { width: 100%; height: 56px; margin-top: 10px; border: 1px dashed var(--rule-dash); border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-song); font-size: 13px; letter-spacing: .25em; color: var(--ink-soft); }

/* ---------- 对话 ---------- */
.chat { position: relative; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.chat-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.chat-fade { position: absolute; inset: 0; background: var(--paper); pointer-events: none; }
.chat-top { position: relative; z-index: 2; background: var(--paper); box-shadow: 0 1px 0 var(--rule); padding-top: max(46px, env(safe-area-inset-top)); }
.chat-header { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.chat-who { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chat-who b { font-family: var(--font-song); font-weight: 400; font-size: 17px; letter-spacing: .3em; padding-left: .3em; }
.chat-mood { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-song); font-size: 11px; letter-spacing: .25em; color: var(--ink-soft); }
.chat-mood i { width: 8px; height: 8px; border-radius: 50%; }
.chat-tabs { height: 34px; margin: 6px 16px 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab { height: 34px; padding: 0 12px; flex: none; font-family: var(--font-song); font-size: 13px; letter-spacing: .2em; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 5px; border-bottom: 2px solid transparent; }
.chat-tab.active { color: var(--ink); border-bottom-color: #E39A63; }
.chat-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: #E39A63; }
.chat-tabs .icon-btn { margin-left: auto; width: 34px; height: 34px; }

.msgs { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.msgs > * { flex-shrink: 0; }   /* 纵向 flex 里不让消息被压扁 */
.row { display: flex; gap: 8px; align-items: flex-end; }
.row.her { align-self: flex-end; max-width: 78%; }
.row.him { align-self: flex-start; align-items: flex-start; max-width: 86%; }
.row .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--rule); flex: none; cursor: pointer; }
.stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row.her .stack { align-items: flex-end; }
.row.him .stack { align-items: flex-start; }
.row.him.cont { padding-left: 38px; }

.bubble { padding: 9px 13px; font-size: 15px; line-height: 1.55; word-break: break-word; }
.bubble.him { background: var(--bubble-him); border: 1px solid var(--rule); border-radius: var(--r-bubble-him); }
.bubble.her { background: var(--bubble-her); border-radius: var(--r-bubble-her); }
.bubble.md p { margin: 0; }
.bubble.md p + p, .bubble.md ul { margin-top: 4px; }
.bubble.md ul { padding-left: 1.1em; margin-bottom: 0; }
.bubble.md code { font-family: var(--font-mono); font-size: 12px; padding: 1px 5px; background: #EFE4CD; border-radius: 4px; }
.bubble.md blockquote { margin: 4px 0 0; padding-left: 10px; border-left: 2px solid var(--rule); color: var(--ink-soft); }
.bubble .err { display: block; margin-top: 4px; font-size: 12px; color: #C26F3E; }

.sysnote { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); background: var(--paper-card); border: 1px solid var(--rule); font-family: var(--font-song); font-size: 11px; letter-spacing: .12em; color: var(--ink-soft); }
.sysnote button { color: var(--accent); }

.think-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px dashed #D3C2A2; border-radius: 12px; background: var(--paper-card); font-family: var(--font-song); font-size: 12px; color: var(--ink-soft); }
.think-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.think-text { padding: 8px 12px; border-left: 2px solid var(--rule); border-radius: 0 10px 10px 0; background: var(--paper-card); font-size: 13px; line-height: 1.6; color: var(--ink-soft); font-style: italic; white-space: pre-wrap; }

.tools { min-width: 220px; max-width: 100%; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper-card); overflow: hidden; }
.tools-head { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border-bottom: 1px dashed var(--rule); font-family: var(--font-song); font-size: 11px; letter-spacing: .1em; color: var(--ink-soft); }
.tools-head i { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #9CC59A; }
.tools-head i.run { background: #E6C27A; animation: blink 1s infinite; }
.tools-body { padding: 8px 11px; font-family: var(--font-mono); font-size: 11px; line-height: 1.75; white-space: pre-wrap; word-break: break-all; }
.tools-body .cmd b { color: #C98A5A; font-weight: 400; }
.tools-body .res { color: var(--ink-soft); }

.voice { display: flex; align-items: center; gap: 9px; padding: 8px 13px; }
.voice.him { background: var(--bubble-him); border: 1px solid var(--rule); border-radius: var(--r-bubble-him); }
.voice.her { background: var(--bubble-her); border-radius: var(--r-bubble-her); }
.voice .play { width: 26px; height: 26px; border-radius: 50%; background: #E39A63; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.voice .wave { display: flex; align-items: center; gap: 2px; height: 22px; }
.voice .wave i { width: 2px; border-radius: 2px; background: #B8A88F; }
.voice.her .wave i { background: var(--bubble-her-wave); }
.voice .len { font-family: var(--font-latin); font-size: 11px; color: var(--ink-soft); }
.voice.playing .wave i { animation: wave .9s ease-in-out infinite alternate; }
.transcript { align-self: flex-start; padding: 3px 10px; border-radius: 10px; background: var(--paper-card); font-size: 12px; color: var(--ink-soft); }
button.transcript { border: 0; font-family: inherit; cursor: pointer; text-align: left; }
.transcript.fill { color: #9A8D7E; background: transparent; border: 1px dashed var(--rule); }
@keyframes wave { to { transform: scaleY(.45); } }

.photo { padding: 5px; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 4px 10px rgba(120, 100, 60, .1); transform: rotate(1.5deg); cursor: zoom-in; }
.photo img { width: 150px; height: 112px; object-fit: cover; border-radius: 10px; }
.filecard { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; width: 220px; padding: 10px 12px; background: var(--bubble-her); border-radius: 16px 14px 6px 16px; }
.row.him .filecard { background: var(--bubble-him); border: 1px solid var(--rule); border-radius: var(--r-bubble-him); }
.filecard .ext { width: 36px; height: 44px; flex: none; background: var(--paper-card); border: 1px solid #DCC6A8; border-radius: 4px 10px 4px 4px; display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; font-family: var(--font-latin); font-size: 9px; color: #C26F3E; text-transform: uppercase; }
.filecard .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filecard .fname { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filecard .fsize { font-family: var(--font-latin); font-size: 10px; color: #8A7B6A; }
.stamp { font-family: var(--font-latin); font-size: 10px; color: var(--ink-soft); padding: 1px 8px; border-radius: 8px; background: var(--paper-card); }

.typing { align-self: flex-start; margin-left: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: var(--r-pill); background: var(--paper-card); font-family: var(--font-song); font-size: 12px; letter-spacing: .15em; color: var(--ink-soft); }
.typing i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #B8A88F; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* 输入区 */
.composer { position: relative; z-index: 2; padding: 6px 12px calc(16px + env(safe-area-inset-bottom)); }
.pending { display: flex; gap: 8px; align-items: flex-end; padding: 0 0 8px; overflow-x: auto; }
.pending:empty { display: none; }
.pend { position: relative; flex: none; }
.pend img { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; border: 1px solid var(--rule); }
.pend.file { height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 10px; }
.pend.file .ext { font-family: var(--font-latin); font-size: 9px; color: #5E8F78; padding: 3px 4px; border: 1px solid #BFD8C8; border-radius: 4px; text-transform: uppercase; }
.pend.file .fname { font-size: 12px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend .x { position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.inputbar { height: 54px; display: flex; align-items: center; gap: 4px; padding: 0 6px; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 26px 22px 26px 22px; box-shadow: 0 6px 16px rgba(120, 100, 60, .08); }
.inputbar input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-family: var(--font-hand); font-size: 15px; padding: 8px 2px; }
.inputbar .icon-btn { width: 40px; height: 40px; color: var(--ink-soft); }
.inputbar .send { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.inputbar .plus.open svg { transform: rotate(45deg); color: #E39A63; }
.inputbar .plus svg { transition: transform .2s; }
.inputbar.recording { background: var(--accent-wash); }
.rec-tip { text-align: center; font-size: 12px; color: var(--accent); padding-bottom: 6px; }

/* ＋ 面板 */
.tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 12px -12px calc(-16px - env(safe-area-inset-bottom)); padding: 22px 22px calc(18px + env(safe-area-inset-bottom)); background: var(--paper-card) url("../assets/paper.jpg") center / cover; background-blend-mode: multiply; border-radius: 24px 24px 0 0; box-shadow: 0 -6px 18px rgba(80, 60, 40, .10); }
.tray[hidden] { display: none; }
.tray button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-family: var(--font-song); font-size: 12px; letter-spacing: .25em; }
.tray .tile { width: 64px; height: 64px; border-radius: 20px; border: 1px solid; display: inline-flex; align-items: center; justify-content: center; }
.tray .tile svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tray-tip { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* 看大图 */
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(40, 32, 26, .86); display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 12px; }
