:root {
  --primary: #26835c;
  --primary-hover: #1b6848;
  --primary-soft: #e9f3ed;
  --outgoing: #dff2d9;
  --b-bubble: #e2edf8;
  --surface: #fff;
  --incoming: #fff;
  --history-ink: #000;
  --canvas: #f1f4f0;
  --shell: #edf0ec;
  --text: #25342d;
  --secondary: #627168;
  --border: #e0e7df;
  --blue: #367093;
  --danger: #a34343;
  --coral: #f4cec6;
  --coral-ink: #653d35;
  --chrome: #fbfcfa;
  --list: #edf2ed;
  --field: #edf1ea;
  --hover: #e7eee5;
  --nav: #fff;
  --on-primary: #fff;
  --yellow: #f7e7a7;
  --yellow-ink: #554719;
  --blocked: #e2e5e2;
  --blocked-ink: #515b54;
  --radius: 16px;
  --ease: cubic-bezier(.16,1,.3,1);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 16px;
  font-synthesis: none;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--shell); }
button,input,textarea { font: inherit; outline-offset: 3px; }
button { cursor: pointer; touch-action: manipulation; color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--blue); }
[hidden] { display: none !important; }

svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* 切屏防窥全黑遮罩 */
.blind-screen {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 99999;
  display: none;
}

/* 隐蔽式淡雅水印 */
.watermark-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: space-around;
  overflow: hidden;
}
.watermark-item {
  transform: rotate(-25deg);
  font-size: 11px;
  font-family: monospace;
  color: rgba(58, 79, 65, 0.09);
  margin: 36px 24px;
  letter-spacing: 2px;
}

/* 核心布局 */
.preview { max-width: 1050px; margin: 32px auto; }
.app { display: grid; position: relative; grid-template-columns: 270px minmax(0,1fr); height: min(820px,calc(100dvh - 120px)); min-height: 560px; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: 0 16px 56px #25392b12; }
.sidebar { display: flex; flex-direction: column; background: var(--list); border-right: 1px solid var(--border); min-height: 0; }
.app-brand { display: grid; grid-template-columns: 32px minmax(0,1fr) 32px; align-items: center; gap: 8px; min-height: 66px; padding: 16px 20px 8px; flex: none; background: var(--chrome); }
.app-brand img { image-rendering: pixelated; }
.app-brand h1 { font-size: 19px; line-height: 1.4; font-weight: 600; letter-spacing: 0; text-align: center; white-space: nowrap; }
.sidebar-heading { height: 66px; flex: none; display: flex; align-items: center; padding: 8px 18px 16px; background: var(--chrome); border-bottom: 1px solid var(--border); }
h1,h2,p { margin: 0; }
h1 { font-size: 23px; letter-spacing: -.02em; font-weight: 650; }
#conversations { overflow-y: auto; flex: 1; padding: 10px 10px 110px; }

.conversation-item { width: 100%; padding: 16px 13px; display: flex; gap: 12px; text-align: left; border: 0; border-radius: 12px; background: transparent; align-items: center; margin-bottom: 4px; }
.conversation-item.active { background: var(--hover); }
@media (hover:hover) { .conversation-item:hover { background: var(--hover); } }
.conversation-item .info { flex: 1; min-width: 0; }
.conversation-item strong { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.conversation-item p { font-size: 13px; color: var(--secondary); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item time { display: block; font-size: 11px; color: var(--secondary); align-self: flex-start; margin-top: 3px; }

.avatar { background: #e1e9dc; color: #59714d; border-radius: 13px; display: grid; place-items: center; font-size: 17px; font-weight: 550; width: 42px; height: 42px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.b { background: #eee7db; color: #806b47; }
.avatar.admin { background: #e0eadc; color: #4d6d42; }

.recent-avatar { display: block; flex: none; position: relative; width: 46px; height: 46px; }
.recent-avatar>.avatar { width: 46px; height: 46px; }
.recent-avatar.pair>.avatar { position: absolute; width: 31px; height: 31px; border-radius: 10px; font-size: 12px; }
.recent-avatar.pair>.avatar:first-child { left: 0; top: 0; }
.recent-avatar.pair>.avatar:last-child { right: 0; bottom: 0; box-shadow: 0 0 0 2px #f9fbf8; }

.recent-trailing { display: flex; flex-direction: column; align-items: flex-end; align-self: stretch; gap: 9px; padding-top: 3px; }
.recent-trailing time { margin: 0; align-self: auto; }
.recent-count,.nav-badge { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 8px; background: #b33d3d; color: #fff; font-size: 11px; font-weight: 600; }
.bottom-nav button { position: relative; }
.nav-badge { position: absolute; left: calc(50% + 7px); top: 3px; }

.search-field { display: flex; flex: 1; align-items: center; gap: 9px; min-width: 0; height: 42px; padding: 0 12px; border-radius: 11px; background: var(--field); color: var(--secondary); }
.search-field:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.search-field>span { display: flex; }
.search-field svg { width: 19px; height: 19px; }
.search-field input { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 15px; }
.search-field input::placeholder { color: var(--secondary); opacity: 1; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field button { display: grid; place-items: center; flex: none; width: 28px; height: 36px; padding: 0; border: 0; background: transparent; color: var(--secondary); border-radius: 6px; }
.search-empty { padding: 40px 16px; text-align: center; color: var(--secondary); font-size: 14px; }
.search-hit .bubble { outline: 2px solid var(--blue); outline-offset: 3px; }

.contact-item { min-height: 78px; }
.bottom-nav { position: absolute; left: 135px; transform: translateX(-50%); bottom: 18px; width: 181.5px; display: flex; z-index: 20; padding: 4px; gap: 2px; background: var(--nav); border: 0; border-radius: 30px; box-shadow: 0 8px 28px #213c291f; }
.bottom-nav button { min-height: 44px; min-width: 0; flex: 1; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--secondary); border-radius: 24px; }
.bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }
.bottom-nav svg { width: 24px; height: 24px; }
.bottom-nav .pixel-cat-icon { width: 34px; height: 34px; }

.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background: var(--canvas); }
.chat-header { min-height: 78px; display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 8px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.header-copy { grid-column: 2; min-width: 0; text-align: center; }
.chat-options { grid-column: 3; }
.header-copy h2 { font-size: 17px; font-weight: 600; line-height: 1.5; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.header-copy p { font-size: 12px; color: var(--secondary); margin-top: 2px; }

.icon-button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; background: transparent; color: var(--secondary); border-radius: 12px; }
.icon-button:hover { background: var(--hover); }
.danger-button { color: var(--danger); }
.danger-button svg { width: 20px; height: 20px; }
.mobile-back { display: none; }

.message-toolbar { padding: 9px 24px 5px; flex: none; }
.message-filters { display: flex; gap: 5px; }
.message-filters button { border: 0; border-radius: 8px; min-height: 34px; padding: 0 11px; font-size: 12px; color: var(--secondary); background: transparent; }
.message-filters button:hover { background: #e6ece2; }
.message-filters button.active { color: #386349; background: #e1ebdd; font-weight: 600; }
.message-filters span { margin-left: 3px; font-size: 11px; }

.delegate-invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #e8f1e2; margin: 0 16px 12px; padding: 13px; border-radius: 12px; }
.delegate-invite strong { font-size: 13px; font-weight: 500; line-height: 1.6; }
.delegate-invite>strong { flex: 1; }

.recent-alerts button { display: flex; align-items: center; gap: 8px; width: calc(100% - 32px); border: 0; background: #f6e7de; color: #885538; margin: 0 16px 10px; border-radius: 9px; min-height: 44px; padding: 8px 12px; font-size: 12px; cursor: pointer; }
.recent-alerts svg { width: 17px; height: 17px; }

.takeover-bar { display: flex; gap: 8px; align-items: center; background: #e9eee5; padding: 10px 18px; min-height: 48px; }
.takeover-bar>span { color: #5c7154; font-size: 12px; flex: 1; }
.takeover-bar button { border: 0; background: white; color: var(--primary); border-radius: 8px; padding: 0 11px; height: 32px; font-size: 12px; }

.small-primary, .subtle-button { border: 0; border-radius: 9px; padding: 0 14px; height: 40px; font-size: 13px; white-space: nowrap; }
.small-primary { color: var(--on-primary); background: var(--primary); }
.small-primary:hover { background: var(--primary-hover); }
.subtle-button { background: #ede8dc; color: #705f3e; }

.chat-scroll { padding: 20px 24px 24px; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c8d3c6 transparent; background-position: center; background-size: cover; }
.date-divider { display: flex; justify-content: center; align-items: center; color: #677361; font-size: 11px; margin: 0 0 22px; gap: 14px; }
.date-divider::before,.date-divider::after { content: ''; width: 36px; height: 1px; background: #d9e2d4; }

.message-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 21px; }
.message-row>.avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; margin-top: 2px; }
.message-row.outgoing { flex-direction: row-reverse; }
.message-stack { min-width: 0; max-width: min(82%,440px); }

.bubble { background: var(--incoming); border-radius: 4px 16px 16px 16px; padding: 11px 14px 8px; min-width: 100px; overflow-wrap: anywhere; }
.bubble-text { font-size: 16px; line-height: 1.65; white-space: pre-wrap; margin: 0; }
.bubble-text { -webkit-touch-callout: none; user-select: none; }
.message-row, .message-row * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.message-quote { display: block; max-width: 100%; border: 0; border-radius: 7px; background: #25342d0b; padding: 8px 10px; margin-bottom: 8px; text-align: left; color: inherit; font-size: 12px; line-height: 1.5; }
.message-quote strong { display: block; font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.message-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.reply-preview { display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; color: var(--secondary); font-size: 12px; }
.reply-preview>span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-preview button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.reply-preview svg { width: 17px; height: 17px; }
.review-cutoff { display: flex; flex: none; justify-content: flex-end; padding: 8px 18px 14px; }
.review-cutoff button { min-height: 36px; border: 1px solid #e2b3ad; border-radius: 10px; padding: 0 15px; background: #fff5f1; color: #8e3935; font-size: 13px; }
.admin-view .message-row.is-recalled .bubble { background: var(--yellow); color: var(--yellow-ink); }
.admin-view .message-row.is-recalled .bubble-meta { color: #6a5b2e; }
.outgoing .bubble { background: var(--outgoing); border-radius: 16px 4px 16px 16px; }

/* 管理端三色气泡 */
.admin-view .from-a .bubble { background: var(--incoming); }
.admin-view .from-b .bubble { background: var(--b-bubble); }
.admin-view .avatar.b { background: #dbe6f1; color: #526d89; }
.admin-view .from-admin .bubble { background: var(--outgoing); }
.admin-view .message-row.is-pending .bubble { background: var(--coral); color: var(--coral-ink); }
.admin-view .message-row.is-pending .bubble-meta { color: var(--coral-ink); }
.admin-view .message-row.is-blocked .bubble { background: var(--blocked); color: var(--blocked-ink); }
.admin-view .message-row.is-blocked .bubble-meta { color: var(--blocked-ink); }

.bubble-meta { display: flex; gap: 4px; justify-content: flex-end; align-items: center; margin-top: 4px; font-size: 10px; color: #63715e; line-height: 1.4; }
.bubble-meta svg { width: 12px; height: 12px; }
.admin-view .from-b .bubble-meta { color: #607289; }

.message-status { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: inherit; padding: 0 2px; min-height: 18px; font-size: 10px; line-height: 1.3; border-radius: 4px; position: relative; }
.message-status.pending { color: #805b22; background: #f8edcd; padding: 2px 5px; }
.message-status.approved { color: #26734f; }
.message-status.blocked,.message-status.recalled { color: #8c4c4c; }
button.message-status:hover { background: #ffffff80; }

.media-bubble { padding: 4px; width: 236px; overflow: hidden; }
.media-bubble .bubble-meta { margin: 4px 5px 2px; }
.photo-preview { position: relative; padding: 0; display: block; border: 0; width: 100%; border-radius: 10px; overflow: hidden; background: #dae3d3; }
.photo-preview img { width: 100%; height: 154px; display: block; object-fit: cover; }
.video-bubble { width: 245px; padding: 4px 8px 6px 4px; }
.video-bubble .video-row { width: 100%; padding: 4px; background: transparent; border-radius: 11px; }
.video-row { display: flex; align-items: center; gap: 10px; border: 0; background: white; border-radius: 4px 16px 16px 16px; padding: 8px 13px 8px 8px; width: 245px; text-align: left; }
.video-thumbnail { width: 66px; height: 58px; position: relative; display: grid; place-items: center; border-radius: 9px; overflow: hidden; flex: none; background: #cbd5e1; }
.video-thumbnail img { position: absolute; width: 100%; height: 100%; object-fit: cover; filter: brightness(.7); }
.video-thumbnail svg { position: relative; color: white; width: 26px; height: 26px; }
.video-title { font-size: 14px; display: block; font-weight: 500; }
.video-caption { font-size: 11px; color: var(--secondary); display: block; margin-top: 6px; }

.message-stack.has-review { display: flex; align-items: flex-start; gap: 8px; max-width: min(calc(100% - 44px),560px); }
.message-stack.has-review>.bubble { flex: 1; min-width: 0; }
.outgoing .message-stack.has-review { flex-direction: row-reverse; }
.review-actions { display: flex; flex: none; align-items: center; gap: 4px; padding-top: 2px; }
.review-actions button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; padding: 0; border-radius: 12px; }
.review-primary { background: var(--primary); color: var(--on-primary); }
.review-actions svg { width: 18px; height: 18px; }
.review-primary:hover { background: var(--primary-hover); }
.review-primary:disabled { background: var(--field); color: var(--secondary); }
.review-secondary { background: var(--field); color: var(--secondary); }
.recall-line { font-size: 12px; text-align: center; color: #66715e; margin: 10px 0 24px; line-height: 1.6; }

/* 骰子气泡与选择器 */
.dice-face { display: inline-grid; grid-template-columns: repeat(3,6px); grid-template-rows: repeat(3,6px); gap: 6px; width: 48px; height: 48px; padding: 8px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); vertical-align: middle; clip-path: polygon(4px 0,44px 0,44px 4px,48px 4px,48px 44px,44px 44px,44px 48px,4px 48px,4px 44px,0 44px,0 4px,4px 4px); }
.dice-face i { display: block; width: 6px; height: 6px; }
.dice-face .pip { background: #376347; }
.dice-bubble { min-width: 78px; width: fit-content; padding: 9px 12px 6px; }
.dice-bubble .bubble-meta { margin-top: 6px; }
.floating-menu.dice-menu { width: 192px; padding: 8px; }
.dice-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.floating-menu .dice-picker button { display: grid; place-items: center; width: 100%; min-width: 0; height: 44px; margin: 0; padding: 0; text-align: center; background: var(--field); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.floating-menu.dice-menu>button { justify-content: center; margin-top: 6px; }
.dice-rolling { display: inline-block; animation: dice-pixel-toss 1.05s steps(1,end) both; }
@keyframes dice-pixel-toss { 0% { transform: translate(0,0); } 12% { transform: translate(-4px,-8px) rotate(-90deg); } 24% { transform: translate(0,-16px) rotate(-180deg); } 36% { transform: translate(4px,-12px) rotate(-270deg); } 48% { transform: translate(4px,-4px) rotate(-360deg); } 60% { transform: translate(0,0); } 72% { transform: translate(-4px,-4px) rotate(90deg); } 84% { transform: translate(0,-4px); } 100% { transform: translate(0,0); } }

.composer { padding: 9px 18px max(16px,env(safe-area-inset-bottom)); background: var(--chrome); border-top: 1px solid var(--border); flex: none; }
#send-form { display: flex; align-items: flex-end; gap: 8px; }
.attach-button { background: var(--field); color: var(--secondary); }
.attachment-panel { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding: 24px 0 8px; }
.attachment-panel button { display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 0; padding: 0 0 8px; border: 0; background: transparent; font-size: 12px; color: var(--secondary); }
.attachment-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 15px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.attachment-icon svg { width: 27px; height: 27px; stroke-width: 1.6; }
@media (hover:hover) and (pointer:fine) {
  .attachment-panel button:hover .attachment-icon { background: #edf2e9; }
}
.input-wrap { display: flex; flex: 1; background: var(--surface); border: 1px solid #dfe6db; border-radius: 14px; overflow: hidden; }
.input-wrap:focus-within { border-color: #8cb198; }
textarea { display: block; resize: none; width: 100%; max-height: 110px; border: 0; background: transparent; font-size: 16px; line-height: 24px; padding: 10px 12px; color: var(--text); outline: none; }
textarea::placeholder { color: #747f70; }
.send-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 13px; color: var(--on-primary); background: var(--primary); transition: background .18s; }
.send-button:disabled { background: #dbe5d6; color: #6a7a61; }
.send-button:not(:disabled):hover { background: var(--primary-hover); }

.access-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; }
.access-illustration { width: 64px; height: 64px; border-radius: 20px; background: #e0ebdb; color: #59724e; display: grid; place-items: center; margin-bottom: 22px; }
.access-illustration svg { width: 29px; height: 29px; }
.access-screen h3 { font-size: 18px; margin: 0 0 12px; }
.access-screen p { font-size: 14px; line-height: 1.8; max-width: 260px; color: var(--secondary); margin-bottom: 24px; }
.access-screen button { min-height: 44px; }

/* 个人资料页面 */
.profile-panel { background: var(--chrome); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.profile-panel>.bottom-nav { margin-top: auto; flex: none; }
.profile-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.profile-heading { display: flex; align-items: center; gap: 8px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.profile-heading h2 { font-size: 18px; font-weight: 600; }
#profile-form { padding: 28px 28px 24px; max-width: 440px; width: 100%; margin: 0 auto; }
.profile-avatar { display: block; margin: 0 auto; padding: 0; border: 0; background: transparent; border-radius: 24px; }
.profile-avatar>.avatar { width: 88px; height: 88px; font-size: 32px; border-radius: 25px; }
.profile-avatar-link { display: block; border: 0; background: transparent; color: var(--blue); font-size: 13px; min-height: 44px; margin: 4px auto 8px; text-align: center; }
.profile-field { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.profile-field input { width: 65%; text-align: right; font-family: inherit; font-size: 16px; background: transparent; border: 0; outline-offset: 4px; color: var(--text); }
.account-field { color: var(--secondary); }
.profile-save { width: 100%; height: 44px; margin-top: 20px; border: 0; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 15px; font-weight: 500; }
.profile-save:hover { background: var(--primary-hover); }
.me-actions { max-width: 440px; width: 100%; margin: 0 auto; padding: 0 28px 24px; }
.me-action { display: flex; align-items: center; gap: 12px; min-height: 52px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; font-size: 14px; }
.me-action>svg:first-child { width: 20px; height: 20px; color: var(--secondary); }
.me-action>span { flex: 1; }
.me-action>svg:last-child { width: 14px; height: 14px; color: var(--secondary); }
.me-action.danger { color: var(--danger); }
.password-settings { max-width: 440px; width: 100%; margin: 0 auto; padding: 0 28px 12px; }
.password-settings summary { min-height: 50px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--border); list-style: none; }
.password-settings summary::-webkit-details-marker { display: none; }
.password-settings summary::after { content: ''; flex: none; width: 12px; height: 12px; color: var(--secondary); background: linear-gradient(currentColor,currentColor) center/12px 2px no-repeat,linear-gradient(currentColor,currentColor) center/2px 12px no-repeat; }
.password-settings[open] summary::after { background-size: 12px 2px,0 0; }
.password-form { padding: 12px 0; }
.password-form label { display: block; margin: 12px 0; font-size: 12px; color: var(--secondary); }
.password-form input { display: block; height: 44px; width: 100%; margin-top: 6px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; background: var(--surface); color: var(--text); font-size: 16px; }
.password-form p { color: var(--danger); font-size: 12px; line-height: 1.6; }
.password-form .profile-save { margin-top: 8px; }
.contact-result { display: flex; align-items: center; gap: 10px; padding: 16px 12px; }
.contact-result .info { flex: 1; min-width: 0; }
.contact-result strong { display: block; font-size: 15px; }
.contact-result p { font-size: 12px; color: var(--secondary); margin-top: 4px; }

/* 登录与注册面板 */
.auth-panel { position: fixed; inset: 0; z-index: 900; overflow-y: auto; background: #fafafa; color: #171717; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(32px,env(safe-area-inset-top)) 32px max(32px,env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 310px; margin: auto; padding: 28px 0; text-align: center; }
.auth-logo { display: block; width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 20px; }
.auth-card h1 { font-size: 25px; line-height: 1.4; font-weight: 600; letter-spacing: .05em; margin: 0 0 46px; }
.auth-card p { font-size: 13px; color: #666; margin: -26px 0 26px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-form label:not(.sr-only) { display: block; font-size: 12px; color: #666; font-weight: 500; margin-bottom: 6px; }
.auth-form input:not([type="hidden"]) { width: 100%; height: 52px; border: 1px solid #dedede; border-radius: 12px; padding: 0 16px; font-size: 15px; color: #171717; background: #fff; }
.auth-form input::placeholder { color: #737373; opacity: 1; }
.auth-form input:focus { border-color: #171717; outline: 1px solid #171717; outline-offset: 0; }
.auth-submit { height: 52px; border: 0; border-radius: 12px; background: #171717; color: white; font-size: 15px; font-weight: 500; margin-top: 10px; }
.auth-submit:hover { background: #333; }
.auth-error { color: #333; font-size: 12px; line-height: 1.6; text-align: center; }
.auth-error:empty { display: none; }
.auth-panel :focus-visible { outline-color: #171717; }

/* 浮动菜单与弹窗 */
.floating-menu { position: fixed; z-index: 1000; width: 210px; padding: 6px; background: var(--surface); box-shadow: 0 8px 32px rgba(20,44,30,0.18); border-radius: 14px; }
.floating-menu button { display: flex; width: 100%; padding: 0 10px; align-items: center; gap: 10px; text-align: left; min-height: 44px; background: transparent; border: 0; border-radius: 9px; font-size: 13px; }
.floating-menu button:hover { background: var(--hover); }
.floating-menu button:disabled { color: var(--secondary); font-size: 11px; background: transparent; }
.floating-menu button svg { width: 18px; height: 18px; color: var(--secondary); }
.floating-menu.message-actions { width: max-content; display: flex; gap: 8px; padding: 0; box-shadow: none; background: transparent; }
.floating-menu.message-actions button { min-width: 72px; width: auto; justify-content: center; gap: 0; padding: 0 16px; border-radius: 13px; background: var(--surface); box-shadow: 0 4px 18px #25342d24; font-size: 13px; }
.floating-menu.message-actions button svg { display: none; }

.toast { position: fixed; bottom: max(100px,calc(env(safe-area-inset-bottom) + 90px)); left: 50%; transform: translateX(-50%); background: #293c31; color: white; border-radius: 10px; padding: 12px 18px; font-size: 13px; z-index: 2000; box-shadow: 0 6px 24px rgba(21,37,28,0.15); max-width: calc(100vw - 36px); width: max-content; }
dialog { padding: 50px 16px 18px; max-width: min(700px,calc(100vw - 24px)); border: 0; border-radius: 16px; background: var(--chrome); color: var(--text); overflow: visible; position: relative; }
dialog::backdrop { background: rgba(21,35,27,0.85); }
dialog img, dialog video { display: block; max-width: 100%; max-height: 72dvh; border-radius: 6px; margin: 0 auto; }
.dialog-close { position: absolute; top: 10px; right: 10px; }
.user-info-dialog { width: min(340px,calc(100vw - 32px)); padding: 54px 24px 20px; }
.user-info-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.user-info-heading .avatar { width: 52px; height: 52px; }
.user-info-heading h2 { min-width: 0; font-size: 19px; overflow-wrap: anywhere; }
.user-info-fields { margin: 0; font-size: 14px; }
.user-info-fields>div { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; border-top: 1px solid var(--border); }
.user-info-fields dt { color: var(--secondary); }
.user-info-fields dd { margin: 0; overflow-wrap: anywhere; }
.user-presence.online { color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 媒体上传状态条 */
.media-upload-state { font-size: 11px; color: var(--secondary); margin-top: 4px; overflow-wrap: anywhere; }
.media-upload-state button { text-decoration: underline; margin-left: 8px; background: transparent; border: 0; color: var(--blue); padding: 0; }

/* 移动端响应式 */
@media(max-width: 700px) {
  body { background: var(--canvas); }
  .preview { margin: 0; width: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .app { display: block; position: relative; height: 100%; border-radius: 0; box-shadow: none; }
  .sidebar { position: absolute; inset: 0; width: 100%; height: 100%; transform: none; visibility: visible; box-shadow: none; border: 0; background: var(--list); }
  .app-brand { padding-top: max(16px,env(safe-area-inset-top)); }
  .conversation { width: 100%; height: 100%; display: none; }
  .preview[data-screen="chat"] .conversation { display: flex; }
  .preview[data-screen="chat"] .sidebar, .preview[data-screen="profile"] .sidebar, .preview[data-screen="cat"] .sidebar { display: none; }
  .profile-panel { height: 100%; }
  .preview[data-screen="recent"] .conversation { display: none; }
  .conversation-item { padding: 16px 12px; border-radius: 0; border-bottom: 1px solid var(--border); }
  #conversations { padding: 8px 10px 110px; }
  .bottom-nav { left: 50%; right: auto; width: calc(75% - 27px); bottom: max(16px,env(safe-area-inset-bottom)); }
  .profile-scroll { padding-bottom: 106px; }
  .preview[data-screen="chat"] .bottom-nav { display: none; }
  .conversation-item .info strong { font-size: 16px; }
  .chat-header { min-height: 68px; padding: 10px 8px; }
  .mobile-back { display: grid; width: 36px; }
  .takeover-bar { padding: 9px 14px; }
  .chat-scroll { padding: 18px 14px 20px; }
  .message-row { gap: 8px; margin-bottom: 20px; }
  .message-stack { max-width: calc(100% - 47px); }
  .composer { padding: 9px 12px max(14px,env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { .dice-rolling { animation: none; } }

.media-open {display:flex;align-items:center;gap:10px;border:0;background:transparent;color:inherit;padding:10px 0;min-width:120px;min-height:44px;text-align:left;}
#media-dialog-content .media-preview {display:block;max-width:100%;max-height:75dvh;margin:auto;}

.cat-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 0; height: 100%; background: var(--canvas); padding: 32px 24px 110px; text-align: center; }
.cat-panel img { border-radius: 18px; }
.cat-panel h2 { font-size: 22px; font-weight: 600; }
.cat-panel p { font-size: 13px; color: var(--secondary); }
.appearance-settings { width: 100%; max-width: 440px; margin: 0 auto; padding: 0 28px 12px; }
.theme-setting { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 58px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--border); }
.theme-setting input { position: absolute; right: 0; width: 48px; height: 44px; opacity: 0; cursor: pointer; margin: 0; }
.switch-track { width: 44px; height: 26px; border-radius: 18px; background: #b6c1b7; pointer-events: none; }
.switch-track::after { content: ''; display: block; width: 20px; height: 20px; margin: 3px; background: #fff; border-radius: 50%; }
.theme-setting input:checked+.switch-track { background: var(--primary); }
.theme-setting input:checked+.switch-track::after { transform: translateX(18px); }
.theme-setting input:focus-visible+.switch-track { outline: 2px solid var(--blue); outline-offset: 3px; }

:root[data-theme="dark"] {
  --primary: #8acc9d; --primary-hover: #a0d8b0; --primary-soft: #304635; --on-primary: #14251a;
  --surface: #26312a; --canvas: #19211b; --shell: #111713; --chrome: #202922; --list: #18211b;
  --field: #2b362e; --hover: #304236; --nav: #2a352d;
  --text: #e5ede6; --secondary: #b0bfb3; --border: #3a493e; --blue: #9bc5e2;
  --incoming: #344339; --history-ink: #d6ddd6;
  --outgoing: #2c5037; --b-bubble: #2b4258;
  --coral: #683e38; --coral-ink: #ffe3da; --danger: #f0a99f;
  --yellow: #665624; --yellow-ink: #fff0b5; color-scheme: dark;
  --blocked: #363e38; --blocked-ink: #c5cec7;
}
[data-theme="dark"] .auth-panel { color-scheme: light; }
[data-theme="dark"] .avatar { background: #344538; color: #c9dfc8; }
[data-theme="dark"] .avatar.admin { background: #344e3a; color: #c9e5cd; }
[data-theme="dark"] .avatar.b, [data-theme="dark"] .admin-view .avatar.b { background: #30495f; color: #d1e5f7; }
[data-theme="dark"] .recent-avatar.pair>.avatar:last-child { box-shadow: 0 0 0 2px var(--list); }
[data-theme="dark"] .bubble-meta, [data-theme="dark"] .date-divider { color: var(--secondary); }
[data-theme="dark"] .admin-view .from-b .bubble-meta { color: #b8cee2; }
[data-theme="dark"] .admin-view .is-recalled .bubble-meta { color: #efdda0; }
[data-theme="dark"] .admin-view .is-blocked .bubble-meta { color: var(--blocked-ink); }
[data-theme="dark"] .message-quote { background: #ffffff10; }
[data-theme="dark"] .input-wrap { border-color: var(--border); }
[data-theme="dark"] textarea::placeholder { color: var(--secondary); }
[data-theme="dark"] .send-button:disabled { background: #36483b; color: #acc3b0; }
@media (hover:hover) and (pointer:fine) {
  [data-theme="dark"] .attachment-panel button:hover .attachment-icon { background: var(--hover); }
}
[data-theme="dark"] .dice-face { background: #334639; }
[data-theme="dark"] .dice-face .pip { background: #d8e9d7; }
[data-theme="dark"] .message-status.pending { color: #f8e2aa; background: #594c2c; }
[data-theme="dark"] .delegate-invite, [data-theme="dark"] .takeover-bar { background: #2e4433; }
[data-theme="dark"] .message-filters button.active { background: var(--primary-soft); color: var(--primary); }
[data-theme="dark"] .date-divider::before, [data-theme="dark"] .date-divider::after { background: var(--border); }
[data-theme="dark"] .review-cutoff button { background: #3e2d28; border-color: #745149; color: #f1b6aa; }
[data-theme="dark"] .recent-alerts button { background: #493829; color: #f1c6a2; }
[data-theme="dark"] .subtle-button { background: #453c2c; color: #ead5aa; }
[data-theme="dark"] .floating-menu button:hover { background: var(--hover); }
[data-theme="dark"] #invite-link-input { background: var(--surface) !important; color: var(--text); }
[data-theme="dark"] .watermark-item { color: #d0e1d016; }

/* Chat continuity: bounded flex sizing, inline private media, and a visible composer. */
.app, .conversation, #messages-list, .chat-scroll { min-height: 0; }
.chat-scroll { overflow-anchor: none; min-width: 0; overscroll-behavior: none; }
.history-more { display: block; min-height: 44px; margin: 0 auto 12px; padding: 8px 16px; background: transparent; color: var(--secondary); font-size: 13px; }
.history-more:disabled { opacity: .7; }
.composer { flex: none; }
.jump-latest { position: absolute; right: 18px; bottom: calc(var(--composer-height,80px) + 14px); z-index: 12; min-height: 44px; padding: 0 16px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--blue); font-size: 13px; cursor: pointer; }
.media-bubble { width: min(56vw,280px); max-width: 100%; min-width: 120px; padding: 5px 5px 6px; }
.media-bubble .bubble-meta { padding: 0 6px; }
.media-open { position: relative; display: grid; place-items: center; width: 100%; min-width: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--field); }
.photo-open { width: auto; min-width: 120px; min-height: 88px; }
.chat-photo { display: block; width: auto; height: auto; max-width: min(60vw,280px); max-height: min(55dvh,360px); object-fit: contain; }
.image-bubble, .pending-upload .media-bubble:has(.local-photo) { position: relative; width: auto; min-width: 0; padding: 0; background: transparent; border-radius: 0; overflow: visible; }
.image-bubble .bubble-meta { position: absolute; right: 6px; bottom: 6px; margin: 0; padding: 2px 6px; border-radius: 5px; background: #17271dbf; color: #fff; pointer-events: none; }
.photo-open[data-preview-state="ready"] { min-width: 0; min-height: 0; background: transparent; }
.photo-open[data-preview-state="ready"]>svg, .photo-open[data-preview-state="loading"]>svg { display: none; }
.photo-state:empty { display: none; }
.photo-open>svg { width: 26px; height: 26px; }
:root[data-input-method="pointer"] .media-open:focus, :root[data-input-method="pointer"] .attachment-panel button:focus { outline: none; }
:root[data-input-method="pointer"] :is(#chat-scroll,.message-row,#media-dialog,#media-dialog button,#media-dialog a,#media-dialog video,#media-dialog-content):focus { outline: none; }
.media-open:focus-visible, .attachment-panel button:focus-visible { outline-color: var(--primary); outline-offset: -2px; }
.photo-state { padding: 18px; text-align: center; color: var(--secondary); font-size: 13px; line-height: 1.5; }
.photo-open[data-preview-state="loading"]::after { content: ''; position: absolute; left: calc(50% - 13px); top: calc(50% - 13px); width: 26px; height: 26px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: media-loading-spin .8s linear infinite; }
.video-open { aspect-ratio: 16 / 10; align-content: center; gap: 8px; }
.video-open>svg { width: 36px; height: 36px; color: var(--primary); }
.video-open .photo-state { padding: 0 8px; }
.upload-preview { display: grid; place-items: center; min-height: 88px; position: relative; overflow: hidden; border-radius: 10px; background: var(--field); }
.local-photo { display: block; width: auto; height: auto; max-width: min(60vw,280px); max-height: min(55dvh,360px); object-fit: contain; }
.send-state { color: var(--secondary); font-size: 11px; }
.send-retry { align-self: center; flex: none; color: var(--danger); }
.dice-waiting { display: grid; place-items: center; min-height: 44px; }
.dice-waiting svg { width: 32px; height: 32px; }
.upload-feedback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #17271d99; color: white; }
.upload-label { font-size: 13px; line-height: 1.5; }
.upload-progress { width: 72%; height: 5px; accent-color: #a2e4b4; }
.upload-actions { display: flex; gap: 8px; }
.upload-actions button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 22px; background: #14291ed9; color: white; cursor: pointer; }
.upload-actions svg { width: 18px; height: 18px; }
#media-dialog { width: min(900px,calc(100vw - 24px)); max-height: calc(var(--app-height,100dvh) - 24px); padding: 58px 12px 14px; overflow: hidden; }
#media-dialog-content { min-height: 100px; overflow: auto; }
#media-dialog-content .media-preview { max-width: 100%; max-height: calc(var(--app-height,100dvh) - 110px); object-fit: contain; }
#media-dialog .media-download { position: absolute; top: 10px; right: 60px; text-decoration: none; }
.media-loading { padding: 28px 14px; color: var(--secondary); text-align: center; font-size: 14px; }
@keyframes media-loading-spin { to { transform: rotate(360deg); } }
@media(max-width:700px), (max-height:500px) {
  html, body { overscroll-behavior: none; }
  body:has(#main-view:not([hidden])) { height: 100%; overflow: hidden; }
  .preview { position: fixed; inset: auto 0 auto; top: var(--app-top,0px); margin: 0; width: 100%; height: var(--app-height,100dvh); display: flex; flex-direction: column; overflow: hidden; }
  .app { display: block; position: relative; height: 100%; min-height: 0; border-radius: 0; box-shadow: none; }
  .sidebar { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
  .conversation { display: none; width: 100%; height: 100%; }
  .preview[data-screen="chat"] .conversation { display: flex; }
  .preview[data-screen="chat"] .sidebar, .preview[data-screen="profile"] .sidebar, .preview[data-screen="cat"] .sidebar { display: none; }
  .preview[data-screen="chat"] .bottom-nav { display: none; }
  .preview[data-screen="recent"] .conversation { display: none; }
  .mobile-back { display: grid; }
  .chat-header { min-height: 56px; padding-top: max(8px,env(safe-area-inset-top)); padding-bottom: 8px; }
  .composer { padding-bottom: max(10px,env(safe-area-inset-bottom)); }
  .attachment-panel { max-height: min(190px,calc(var(--app-height,100dvh) - 160px)); overflow-y: auto; }
  .message-stack.has-review { max-width: calc(100% - 42px); }
  .message-filters { flex-wrap: wrap; }
  #media-dialog .dialog-close, #media-dialog .media-download { top: max(10px,env(safe-area-inset-top)); }
}
@media(prefers-reduced-motion:reduce) { .photo-open[data-preview-state="loading"]::after { animation: none; } }

/* Media feedback follows actual upload/commit state; private images stay unobscured. */
.upload-feedback { position: absolute; inset: auto 7px 7px auto; display: flex; flex-direction: row; align-items: center; gap: 5px; padding: 3px; border-radius: 8px; background: #17271dbf; }
.upload-ring { display: block; width: 34px; height: 34px; flex: none; transform: rotate(-90deg); }
.upload-ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: #ffffff50; }
.ring-value { stroke: #fff; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--upload-progress,0)); transition: stroke-dashoffset 160ms linear; }
.upload-ring.is-finalizing .ring-value { animation: ring-wait 1.1s ease-in-out infinite alternate; }
@keyframes ring-wait { to { opacity: .5; } }
.upload-actions button { min-width: 34px; min-height: 34px; color: #fff; }
.sticker-bubble .chat-photo, .sticker-open .chat-photo { max-width: min(36vw,150px); max-height: 150px; }
.sticker-open { background: transparent; }
.message-row .bubble.sticker-bubble, .admin-view .message-row .bubble.sticker-bubble { background: transparent; border: 0; border-radius: 0; padding: 0; min-width: 0; box-shadow: none; overflow: visible; }
.sticker-bubble .sticker-open { border: 0; border-radius: 0; min-width: 0; min-height: 0; background: transparent; }
.sticker-bubble .chat-photo { border-radius: 0; }

#chat-subtitle { margin: 3px 0 0; color: var(--secondary); font-size: 12px; line-height: 1.3; }
.sticker-toggle { flex: none; width: 36px; }
.sticker-toggle svg { width: 23px; height: 23px; }
.utility-panel { position: fixed; top: var(--app-top,0px); left: 50%; transform: translateX(-50%); width: min(100%,1050px); height: var(--app-height,100dvh); z-index: 80; display: flex; flex-direction: column; background: var(--surface); }
.utility-heading { flex: none; display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.utility-heading h2 { margin: 0; font-size: 18px; }
.utility-content { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.delegate-person { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; }
.delegate-person>span:not(.avatar) { flex: 1; }
.delegate-person>svg { width: 16px; height: 16px; color: var(--secondary); }
.media-draft { display: grid; place-items: center; min-height: 180px; }
.media-draft img, .media-draft video { display: block; max-width: 100%; max-height: calc(var(--app-height,100dvh) - 190px); object-fit: contain; }
.utility-actions { display: flex; justify-content: flex-end; gap: 14px; padding: 20px 0; }
.utility-actions button { min-height: 44px; padding: 9px 24px; }
.utility-actions .small-secondary, .delegate-invite .small-secondary { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.utility-empty { color: var(--secondary); font-size: 14px; }
.history-dialog { width: min(420px,calc(100vw - 32px)); padding: 22px; }
.history-dialog h2 { margin: 0 0 14px; font-size: 18px; }
.history-dialog p { margin: 10px 0; color: var(--secondary); font-size: 13px; line-height: 1.6; }
.history-target { display: block; width: 100%; min-height: 44px; margin-top: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--danger); text-align: left; }
.history-cancel { display: block; min-height: 44px; margin: 12px auto 0; padding: 8px 24px; color: var(--blue); }
.history-dialog #history-error { color: var(--danger); }

/* A single in-bubble archive cue, independent of review and recall colors. */
.has-hidden-history { position: relative; overflow: hidden; }
.history-hidden-corner { position: absolute; top: 0; right: 0; width: 16px; height: 8px; background: var(--history-ink); border-top-right-radius: inherit; border-bottom-left-radius: 14px 8px; pointer-events: auto; }
.history-deleted-notice { margin: 0 0 18px; color: var(--secondary); font-size: 11px; line-height: 1.5; text-align: center; }
.bubble-guide { padding: 18px 0; border-top: 1px solid var(--border); }
.bubble-guide summary { cursor: pointer; font-size: 14px; }
.bubble-guide-list { display: grid; gap: 12px; padding: 18px 0 0; }
.bubble-guide .bubble { display: inline-block; min-width: 0; padding: 10px 20px 10px 12px; font-size: 13px; }
.bubble-guide .from-admin .bubble { background: var(--outgoing); }
.bubble-guide .from-b .bubble { background: var(--b-bubble); }
.bubble-guide .is-pending .bubble { background: var(--coral); color: var(--coral-ink); }
.bubble-guide .is-blocked .bubble { background: var(--blocked); color: var(--blocked-ink); }
.bubble-guide .is-recalled .bubble { background: var(--yellow); color: var(--yellow-ink); }

/* Sticker input replaces the keyboard, with native horizontal page swipes. */
.sticker-panel { height: var(--sticker-panel-height,280px); max-height: min(420px,52dvh); min-height: 0; padding: 8px 4px 4px; display: flex; flex-direction: column; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sticker-track { display: flex; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x; }
.sticker-track::-webkit-scrollbar { display: none; }
.sticker-page { flex: 0 0 100%; min-width: 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-template-rows: repeat(3,minmax(0,1fr)); gap: 6px; padding: 4px; scroll-snap-align: start; scroll-snap-stop: always; }
.sticker-panel .sticker-cell { position: relative; min-width: 0; min-height: 0; }
.sticker-panel .sticker-cell>button:first-child { width: 100%; height: 100%; min-height: 0; padding: 4px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 8px; -webkit-touch-callout: none; }
.sticker-panel .sticker-cell img { width: min(64px,100%); height: auto; max-height: 100%; aspect-ratio: 1; object-fit: cover; pointer-events: none; }
.sticker-panel .sticker-add svg { width: 28px; height: 28px; color: var(--secondary); }
.sticker-panel .sticker-remove { top: 0; right: 0; width: 28px; height: 28px; border: 0; background: var(--text); color: var(--surface); border-radius: 50%; padding: 8px; }
.sticker-panel .sticker-remove svg { width: 12px; height: 12px; }
.sticker-dots { display: flex; justify-content: center; align-items: center; gap: 6px; height: 18px; flex: none; }
.sticker-dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--secondary); opacity: .3; }
.sticker-dots .active { opacity: 1; }
.sticker-panel .is-unavailable { opacity: .45; }
.message-row .sticker-open { display: block; width: min(32vw,128px); height: min(32vw,128px); aspect-ratio: 1; cursor: default; padding: 0; }
.sticker-bubble .chat-photo, .sticker-open .chat-photo { display: block; width: min(32vw,128px); height: min(32vw,128px); max-width: 128px; max-height: 128px; aspect-ratio: 1; object-fit: cover; }

.conversation-swipe { position: relative; overflow: hidden; border-radius: 12px; margin-bottom: 4px; touch-action: pan-y; }
.conversation-swipe>.conversation-item { position: relative; z-index: 1; margin-bottom: 0; background: var(--list); transform: translateX(var(--swipe-x,0px)); transition: transform 160ms var(--ease); }
.conversation-swipe.is-open>.conversation-item { transform: translateX(var(--swipe-x,-78px)); }
.conversation-delete { position: absolute; right: 0; top: 0; bottom: 0; width: 78px; border: 0; color: #fff; background: #a34343; font-size: 14px; }
.conversation-delete:focus-visible~.conversation-item { transform: translateX(-78px); }
.delete-history-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.delete-history-confirm { min-height: 40px; padding: 0 18px; border: 0; border-radius: 9px; background: #a34343; color: #fff; }
@media (prefers-reduced-motion: reduce) { .conversation-swipe>.conversation-item { transition: none; } }

/* One shared panel slot: a native keyboard and custom content never stack. */
.input-panel-slot { height: var(--input-slot-height,auto); overflow: hidden; flex: none; min-height: 0; }
.input-panel-slot>.attachment-panel { height: var(--input-panel-height,280px); max-height: none; overflow-y: auto; align-content: start; box-sizing: border-box; }
.input-panel-slot>.sticker-panel { height: var(--input-panel-height,280px); max-height: none; }
.chat-header { position: relative; z-index: 15; }
@media(max-width:700px), (max-height:500px) {
  .preview { top: 0; }
  .chat-header { flex-shrink: 0; }
}
