:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1015;
  --bg-elev: #111922;
  --bg-elev-2: #16212b;
  --bg-elev-3: #20303c;
  --text: #f3f7f8;
  --text-1: #f3f7f8;
  --text-2: #95a5b1;
  --text-3: #78909c;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.17);
  --bubble-in: #19252f;
  --bubble-in-text: #f1f7f8;
  --bubble-out: #ff7d6e;
  --bubble-out-text: #2b100c;
  --accent: #ff7d6e;
  --accent-soft: rgba(255,125,110,.14);
  --brand: var(--accent);
  --brand-2: #ffb09f;
  --coral: #ff7d6e;
  --coral-soft: rgba(255,125,110,.14);
  --input-bg: #111b24;
  --panel: var(--bg);
  --panel-2: var(--bg-elev-2);
  --panel-3: var(--bg-elev-3);
  --muted: var(--text-2);
  --red: #ff5c5c;
  --green: #37d67a;
  --orange: #f5a623;
  --danger: #ff8a8a;
  --hover: rgba(255,255,255,.06);
  --bubble-shadow: 0 1px 2px rgba(0,0,0,.2);
  --avatar-bg: #263844;
  --avatar-text: #dbe8eb;
  --on-accent: #2b100c;
  --emoji-panel-bg: #0b1015;
  --emoji-tabs-bg: #080d12;
  --control-border: color-mix(in srgb, var(--line) 70%, var(--coral));
  --list-bg: transparent;
  --toast-bg: #16212b;
  --toast-text: #f3f7f8;
  --profile-hero: linear-gradient(145deg, #153442, #101720 60%);
  --card-border: color-mix(in srgb, var(--coral) 34%, var(--line));
  --scrim: rgba(0,0,0,.66);
  --shadow-soft: 0 5px 18px rgba(0,0,0,.18);
  --shadow-card: 0 8px 24px rgba(0,0,0,.18);
  --shadow-modal: 0 24px 80px rgba(0,0,0,.5);
  --shadow: var(--shadow-card);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tap: 44px;
  --control-h: 44px;
  --head-h: 64px;
  --page-pad-x: 16px;
  --dock-h: 56px;
  --page-bottom: calc(var(--dock-h) + 16px + var(--safe-bottom));
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --lh-tight: 1.35;
  --lh-body: 1.5;
  --lh-loose: 1.6;
  --radius-sm: 8px;
  --radius-card: 14px;
  --radius-lg: 18px;
  --ease: 150ms cubic-bezier(.2,.8,.2,1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f1ec;
  --bg-elev: #fffcf8;
  --bg-elev-2: #fff7f1;
  --bg-elev-3: #f0e7df;
  --text: #211a17;
  --text-1: #211a17;
  --text-2: #786b63;
  --text-3: #6d5f56;
  --line: rgba(78,48,36,.13);
  --line-strong: rgba(78,48,36,.24);
  --bubble-in: #fffdfb;
  --bubble-in-text: #211a17;
  --bubble-out: #e46c5d;
  --bubble-out-text: #2b100c;
  --accent: #d95d4f;
  --accent-soft: rgba(228,108,93,.11);
  --brand: var(--accent);
  --brand-2: #b84a3e;
  --coral: #e46c5d;
  --coral-soft: rgba(228,108,93,.11);
  --input-bg: #fffdfb;
  --panel: var(--bg);
  --panel-2: var(--bg-elev);
  --panel-3: var(--bg-elev-3);
  --muted: var(--text-2);
  --red: #c62828;
  --green: #15803d;
  --orange: #b45309;
  --danger: #b42318;
  --hover: rgba(78,48,36,.055);
  --bubble-shadow: 0 1px 2px rgba(0,0,0,.05);
  --avatar-bg: #eaded5;
  --avatar-text: #72594d;
  --on-accent: #2b100c;
  --emoji-panel-bg: #fffcf8;
  --emoji-tabs-bg: #f5f1ec;
  --control-border: color-mix(in srgb, var(--line) 55%, var(--coral));
  --list-bg: transparent;
  --toast-bg: #211a17;
  --toast-text: #fffdfb;
  --profile-hero: linear-gradient(145deg, #e9f3ff, #ffffff 60%);
  --card-border: color-mix(in srgb, var(--coral) 36%, var(--line));
  --scrim: rgba(0,0,0,.28);
  --shadow-soft: 0 5px 18px rgba(67,39,28,.09);
  --shadow-card: 0 8px 24px rgba(67,39,28,.12);
  --shadow-modal: 0 24px 80px rgba(67,39,28,.2);
  --shadow: var(--shadow-card);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.composer button, .composer-toolbar, .voice-overlay, .voice-overlay *, .profile-page, .profile-page *, .drawer-panel, .drawer-panel * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.composer input, .composer textarea, .composer [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
.bubble, .moment-body, .moment-comment-body {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.qq-app { height: 100%; display: flex; background: var(--panel); }
.main-view { flex: 1; min-width: 0; height: 100%; position: relative; overflow: hidden; background: var(--bg); }
.nav-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.qq-app.chat-route .bottom-nav { display: none !important; }
.qq-app.chat-route .chat-page { height: 100%; }
.page { height: 100%; display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; background: var(--panel); }
.rail { width: 300px; flex: 0 0 300px; display: flex; flex-direction: column; background: var(--bg-elev); border-right: 1px solid var(--line); }
.rail-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.rail-brand strong { display: block; font-size: var(--fs-lg); }
.rail-brand span { color: var(--muted); font-size: var(--fs-xs); }
.brand-mark { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 14px; color: var(--on-accent); background: var(--accent); font-weight: 700; font-size: var(--fs-2xl); overflow: hidden; padding: 0; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.brand-mark.small { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; font-size: var(--fs-xl); }
.rail-nav { padding: 12px; display: grid; gap: 4px; }
.rail-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; text-align: left; }
.rail-item.active { color: var(--text); background: var(--panel-2); }
.rail-item:hover { background: var(--panel-2); }
.rail-me { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.rail-me-card { display: flex; align-items: center; gap: 8px; }
.rail-me-card strong { font-size: var(--fs-sm); display: block; }
.rail-me-card span { color: var(--muted); font-size: var(--fs-xs); }
.bottom-nav { display: none; }

.topbar { flex: 0 0 auto; padding: 16px 16px 12px; background: var(--panel); }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.top-me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-me .avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: var(--fs-sm); border: 0; padding: 0; }
.me-title { min-width: 0; }
.me-title strong { display: block; font-size: var(--fs-xl); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-title span { color: var(--muted); font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.me-status.offline { color: var(--danger); }
.me-status.offline .status-dot { background: var(--danger); }
.offline-pill { position: fixed; left: 50%; bottom: calc(124px + var(--safe-bottom)); z-index: 85; transform: translateX(-50%); padding: 4px 12px; border: 1px solid var(--danger); border-radius: 14px; color: var(--danger); background: var(--bg-elev); font-size: var(--fs-xs); white-space: nowrap; box-shadow: var(--shadow); }
.top-actions { display: flex; gap: 8px; }
.icon-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: var(--text); background: var(--panel-2); display: grid; place-items: center; font-size: var(--fs-lg); }
.icon-btn:active { background: var(--panel-3); }
.icon-btn.solid { color: var(--on-accent); background: var(--brand); }
.search-row { margin-top: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; min-height: 37px; padding: 0 12px; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.search-box input { flex: 1; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: var(--fs-sm); }
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0px 8px 80px; background: var(--list-bg); }
.conv-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 8px; border: 0; background: transparent; color: var(--text); text-align: left; border-radius: 14px; }
.conv-row:hover, .conv-row:active { background: var(--panel-2); }
.avatar { width: 47px; height: 47px; flex: 0 0 47px; display: grid; place-items: center; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-text); font-size: var(--fs-md); font-weight: 700; object-fit: cover; overflow: hidden; position: relative; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-wrap { position: relative; flex: 0 0 47px; }
.avatar-wrap .online-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border: 2px solid var(--panel); border-radius: 50%; background: var(--green); }
.conv-main { flex: 1; min-width: 0; }
.conv-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name { font-size: var(--fs-md); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { color: var(--text-3); font-size: var(--fs-xs); flex: 0 0 auto; }
.conv-preview { margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { min-width: 18px; height: 18px; padding: 0 4px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--on-accent); background: var(--red); font-size: var(--fs-xs); font-weight: 700; }
.pin-mark { color: var(--text-3); font-size: var(--fs-xs); margin-right: 4px; }
.empty { padding: 64px 28px; color: var(--muted); font-size: var(--fs-sm); text-align: center; line-height: 1.8; }
.empty strong { display: block; color: var(--text); font-size: var(--fs-md); margin-bottom: 4px; }

.chat-page { background: var(--bg); height: 100%; }
.chat-head { flex: 0 0 auto; min-height: 58px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.chat-head .back { width: 28px; height: 36px; padding: 0; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; }
.chat-head .back svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chat-head .avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: var(--fs-sm); }
.chat-peer { min-width: 0; flex: 1; }
.chat-peer strong { display: block; font-size: var(--fs-lg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-peer span { display: flex; align-items: center; gap: 4px; margin-top: 0px; color: var(--text-2); font-size: var(--fs-xs); }
.chat-peer .status-dot { width: 6px; height: 6px; }
.chat-head-actions { display: flex; gap: 4px; }
.message-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; }
.day-sep { display: flex; justify-content: center; margin: 8px 0 12px; }
.day-sep span { color: var(--text-3); background: transparent; padding: 0; font-size: var(--fs-xs); }
.msg-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-row.mine + .msg-row:not(.mine), .msg-row:not(.mine) + .msg-row.mine { margin-top: 12px; }
.msg-avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: var(--fs-xs); }
.msg-main { max-width: min(72%, 560px); }
.msg-row.mine .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.bubble { position: relative; padding: 8px 12px; color: var(--bubble-in-text); background: var(--bubble-in); border-radius: 8px 18px 18px 18px; font-size: var(--fs-md); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: var(--bubble-shadow); }
.msg-row.mine .bubble { color: var(--bubble-out-text); background: var(--bubble-out); border-radius: 18px 8px 18px 18px; box-shadow: none; }
.bubble::after { display: none; }
.msg-meta { margin-top: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.msg-row.mine .msg-meta { text-align: right; }
.emoji-message { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; background: none; font-size: var(--fs-2xl); line-height: 1; }
.emoji-panel { flex: 0 0 45%; min-height: 0; display: flex; flex-direction: column; background: var(--emoji-panel-bg); border-top: 1px solid var(--line); }
.emoji-panel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 0px; }
.emoji-section { margin-bottom: 4px; }
.emoji-section-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0px 4px; color: var(--text-2); font-size: var(--fs-xs); }
.emoji-more { padding: 0; border: 0; background: transparent; color: var(--text-3); font-size: var(--fs-xs); }
.emoji-section-body { display: flex; align-items: flex-start; gap: 4px; }
.emoji-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.emoji-cell { min-width: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: var(--fs-2xl); line-height: 1; display: grid; place-items: center; }
.emoji-cell:active { background: var(--bg-elev-3); }
.emoji-delete { width: 36px; height: 36px; flex: 0 0 36px; margin-top: 0px; padding: 0; border: 0; border-radius: 50%; background: var(--bg-elev-3); color: var(--text-2); display: grid; place-items: center; }
.emoji-delete svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.emoji-tabs { flex: 0 0 54px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center; background: var(--emoji-tabs-bg); border-top: 1px solid var(--line); padding: 4px 12px 0; }
.emoji-tab { width: 100%; min-width: 0; height: 48px; padding: 0; border: 0; background: transparent; color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.emoji-tab span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: var(--fs-lg); line-height: 1; }
.emoji-tab em { font-style: normal; font-size: var(--fs-xs); color: var(--text-3); }
.emoji-tab.active span { color: var(--on-accent); background: var(--accent); }
.emoji-tab.active em { color: var(--accent); }
.emoji-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); }
.emoji-empty span { color: var(--text-3); font-size: var(--fs-2xl); }
.emoji-empty p { margin: 0; }
.emoji-search { display: flex; align-items: center; gap: 8px; height: 36px; margin: 8px 0px 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--input-bg); color: var(--text-3); font-size: var(--fs-md); }
.emoji-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: var(--fs-sm); }
.emoji-search input::placeholder { color: var(--text-3); }
.msg-status { color: var(--danger); }
.msg-image { width: min(230px, 62vw); max-height: 280px; display: block; border-radius: 8px; object-fit: cover; background: var(--bg-elev-3); }
.bubble.image-bubble { padding: 4px; background: transparent; box-shadow: none; }
.bubble.image-bubble::after { display: none; }
.voice-bubble { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.voice-play { width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; background: var(--hover); color: inherit; }
.voice-wave { display: flex; align-items: center; gap: 4px; height: 22px; flex: 1; }
.voice-wave i { width: 2px; border-radius: 8px; background: currentColor; opacity: .55; }
.voice-time { font-size: var(--fs-xs); opacity: .8; }
.sticker-img { width: 108px; height: 108px; object-fit: contain; display: block; }
.composer { position: relative; flex: 0 0 auto; padding: 8px 8px calc(8px + var(--safe-bottom)); background: var(--bg); border-top: 0; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row input[type=text] { flex: 1; min-width: 0; height: 44px; padding: 0 16px; color: var(--text); background: var(--input-bg); border: 1px solid var(--line); border-radius: 18px; outline: none; font-size: var(--fs-md); }
.composer-row input[type=text]::placeholder { color: var(--text-3); }
.composer-row input[type=text]:focus { border-color: var(--accent); }
.comp-round { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; border: 1.3px solid var(--control-border); border-radius: 50%; color: var(--text); background: transparent; display: grid; place-items: center; font-size: var(--fs-xl); }
.comp-round svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.comp-round:active { background: var(--hover); }
.comp-round.send { color: var(--bubble-out-text); background: var(--bubble-out); border-color: var(--bubble-out); }
.comp-round.send svg { fill: var(--bubble-out-text); stroke: none; }
.comp-round.mic-btn { color: var(--text-2); }
.comp-round.mic-btn.recording { color: var(--red); border-color: var(--red); background: var(--hover); }
.comp-round.mic-btn.cancel { color: var(--text-3); opacity: .55; }
.composer-mode { min-width: 0; }
.voice-row { gap: 8px; }
.voice-overlay { position: fixed; left: 10px; right: 10px; bottom: calc(70px + var(--safe-bottom)); z-index: 30; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev); box-shadow: var(--shadow); pointer-events: none; }
.voice-overlay-head { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-2); font-size: var(--fs-xs); padding: 0px 0 8px; }
.voice-overlay-head i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(255,77,94,.45); animation: voice-pulse 1.2s infinite; }
@keyframes voice-pulse { 70% { box-shadow: 0 0 0 7px rgba(255,77,94,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,94,0); } }
.voice-overlay-actions { display: grid; grid-template-columns: 1fr 1.25fr 1fr; align-items: stretch; gap: 8px; }
.voice-zone { min-height: 42px; display: flex; align-items: center; justify-content: center; padding: 4px 4px; border-radius: 8px; background: var(--input-bg); color: var(--text-2); font-size: var(--fs-xs); line-height: 1.3; text-align: center; }
.voice-zone.send { color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.voice-zone.cancel.active { color: var(--red); background: var(--hover); }
.voice-zone.transcribe.active { color: var(--on-accent); background: var(--accent); }
.voice-zone.send.active { color: var(--accent); background: var(--hover); }
.hold-btn { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--input-bg); color: var(--text); font-size: var(--fs-md); touch-action: none; -webkit-user-select: none; user-select: none; }
.hold-btn.recording { color: var(--red); border-color: var(--red); background: var(--hover); }
.hold-btn.cancel { color: var(--text-3); opacity: .55; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 4px 0; }
.comp-tool { width: 40px; height: 34px; flex: 0 0 40px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.comp-tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.comp-tool:active { background: var(--hover); color: var(--accent); }
.comp-tool.mic-btn.recording { color: var(--red); background: var(--hover); }
.comp-tool.mic-btn.cancel { color: var(--text-3); opacity: .55; }
.emoji-pop { position: absolute; left: 12px; bottom: 64px; z-index: 4; display: flex; gap: 4px; padding: 4px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.emoji-pop button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: var(--fs-xl); }

.contacts-top { padding: 16px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.contacts-top h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; }
.contacts-actions { display: flex; gap: 8px; }
.icon-btn.outline { width: 34px; height: 34px; border: 1.4px solid var(--text-3); background: transparent; color: var(--text); }
.icon-btn.outline svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.contacts-search { flex: 0 0 44px; display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; padding: 0 12px; height: 44px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 14px; }
.contact-search-icon { display: grid; place-items: center; color: var(--text-2); }
.contact-search-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.contacts-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; color: var(--text); background: transparent; font-size: var(--fs-md); }
.contacts-search input::placeholder { color: var(--text-3); }
.contacts-search input::-webkit-search-cancel-button { display: none; }
.contacts-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 80px; background: var(--list-bg); }
.new-friends { display: flex; align-items: center; gap: 12px; width: 100%; height: 64px; padding: 0 12px; border: 0; border-radius: 14px; background: var(--bg-elev); margin-bottom: 4px; color: var(--text); text-align: left; }
.new-friends-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 8px; color: var(--on-accent); background: var(--accent); }
.new-friends-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.new-friends strong { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: 600; }
.new-friends .unread { flex: 0 0 auto; }
.row-arrow { margin-left: 0px; color: var(--text-3); font-size: var(--fs-2xl); font-weight: 400; line-height: 1; }
.contact-group { margin: 0; }
.contact-group-title { color: var(--text-3); font-size: var(--fs-sm); padding: 16px 0px 4px; }
.friend-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 72px; padding: 0 0px; color: var(--text); background: transparent; border: 0; border-radius: 0; text-align: left; }
.friend-row:hover { background: var(--hover); }
.friend-row[hidden] { display: none; }
.friend-avatar { width: 48px; height: 48px; flex-basis: 48px; font-size: var(--fs-md); }
.friend-name { flex: 1; min-width: 0; }
.friend-name strong { display: block; font-size: var(--fs-lg); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-name span { display: flex; align-items: center; gap: 4px; color: var(--text-2); font-size: var(--fs-xs); margin-top: 4px; }
.friend-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--text-3); }
.friend-dot.online, .friend-dot.mobile { background: var(--green); }
.friend-dot.busy { background: var(--orange); }
.friend-dot.offline { background: var(--text-3); }
.request-card { padding: 12px; background: var(--panel-2); border-radius: 8px; margin-bottom: 8px; }
.request-head { display: flex; align-items: center; gap: 8px; }
.request-head .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: var(--fs-xs); }
.request-main { flex: 1; min-width: 0; }
.request-main strong { display: block; font-size: var(--fs-sm); }
.request-main span { color: var(--muted); font-size: var(--fs-xs); display: block; margin-top: 0px; }
.request-message { color: var(--muted); font-size: var(--fs-xs); padding: 8px 0 0px 48px; }
.request-btns { display: flex; gap: 4px; padding: 8px 0 0 48px; }
.small-btn { padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-3); color: var(--text); font-size: var(--fs-xs); }
.small-btn.primary { background: var(--brand); color: var(--on-accent); border-color: var(--brand); }
.small-btn.danger { color: var(--danger); }

.drawer-root { position: fixed; inset: 0; z-index: 70; }
.drawer-root[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: 78vw; max-width: 360px; display: flex; flex-direction: column; background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .22s cubic-bezier(.22,.72,.24,1); }
.drawer-root.dragging .drawer-panel, .drawer-root.dragging .drawer-backdrop { transition: none; }
.drawer-root.open .drawer-panel { transform: translateX(0); }
.drawer-root.open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 28px 16px 16px; border-bottom: 1px solid var(--line); }
.drawer-avatar { width: 56px; height: 56px; flex: 0 0 56px; font-size: var(--fs-lg); }
.drawer-who { min-width: 0; flex: 1; }
.drawer-who strong { display: block; font-size: var(--fs-lg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-who span { display: block; margin-top: 4px; color: var(--text-2); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-nav { padding: 8px 8px; display: grid; gap: 4px; }
.drawer-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font-size: var(--fs-md); }
.drawer-item:active { background: var(--hover); }
.drawer-ico { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; color: var(--text-2); }
.drawer-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drawer-arrow { margin-left: auto; color: var(--text-3); font-size: var(--fs-xl); font-weight: 400; }
.drawer-bottom { margin-top: auto; padding: 8px 8px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--line); }

.moments-top { padding: 16px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.moments-top h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; }
.moments-actions { display: flex; gap: 8px; }
.moments-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 80px; background: var(--bg); }
.moments-feed { padding: 0px 0 8px; }
.moments-refresh { text-align: center; color: var(--text-3); font-size: var(--fs-xs); padding: 8px 0 12px; }
.moment-card { padding: 12px; margin-bottom: 8px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; }
.moment-head { display: flex; align-items: center; gap: 8px; }
.moment-avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: var(--fs-sm); }
.moment-meta { min-width: 0; flex: 1; }
.moment-meta strong { display: block; color: var(--accent); font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moment-meta span { display: block; margin-top: 0px; color: var(--text-3); font-size: var(--fs-xs); }
.moment-body { margin-top: 8px; color: var(--text); font-size: var(--fs-md); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.moment-body.expanded { display: block; overflow: visible; }
.moment-full-toggle { margin-top: 4px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: var(--fs-sm); }
.moment-grid { display: grid; gap: 4px; margin-top: 8px; }
.moment-grid.count-1 { grid-template-columns: 1fr; }
.moment-grid.count-2, .moment-grid.count-4 { grid-template-columns: repeat(2, 1fr); }
.moment-grid.count-3, .moment-grid.count-5, .moment-grid.count-6, .moment-grid.count-7, .moment-grid.count-8, .moment-grid.count-9 { grid-template-columns: repeat(3, 1fr); }
.moment-grid a { display: block; min-width: 0; overflow: hidden; border-radius: 8px; background: var(--bg-elev-3); }
.moment-grid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.moment-grid.count-1 img { max-height: 280px; aspect-ratio: 4 / 3; }
.moment-grid a:not(.single) img { aspect-ratio: 1; }
.moment-grid.count-1 a { max-height: 280px; }
.moment-grid.count-1 a img { max-height: 280px; }
.moment-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.moment-time { color: var(--text-3); font-size: var(--fs-xs); }
.moment-action-box { display: flex; align-items: center; gap: 4px; }
.moment-action { padding: 4px 4px; border: 0; background: transparent; color: var(--text-2); font-size: var(--fs-sm); }
.moment-action.liked { color: var(--accent); font-weight: 600; }
.moment-comments-box { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.moment-comment-list { display: grid; gap: 8px; }
.moment-comment { display: flex; gap: 8px; align-items: flex-start; }
.moment-comment-avatar { width: 25px; height: 25px; flex-basis: 25px; font-size: var(--fs-xs); }
.moment-comment-body { min-width: 0; color: var(--text); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.moment-comment-body strong { color: var(--accent); font-weight: 400; }
.moment-comments-more { margin-top: 4px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: var(--fs-xs); }
.moment-comment-form { display: flex; gap: 4px; margin-top: 8px; }
.moment-comment-form input { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--input-bg); color: var(--text); font-size: var(--fs-sm); }
.moment-comment-form input::placeholder { color: var(--text-3); }
.moment-comment-form button { min-width: 48px; height: 32px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-xs); }
.moments-empty { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); }
.moments-empty-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; color: var(--text-3); background: var(--bg-elev-3); font-size: var(--fs-2xl); }
.moments-empty strong { font-weight: 400; }
.moment-compose { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; padding: 12px 16px calc(12px + var(--safe-bottom)); background: var(--bg); overflow-y: auto; }
.moment-compose-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.moment-compose-head strong { font-size: var(--fs-lg); }
.compose-cancel { border: 0; background: transparent; color: var(--text-2); font-size: var(--fs-sm); }
.compose-publish { height: 34px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-sm); font-weight: 600; }
.compose-publish:disabled { opacity: .6; }
.moment-compose-body { width: 100%; min-height: 128px; margin-top: 16px; padding: 12px; box-sizing: border-box; resize: vertical; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--input-bg); color: var(--text); font-size: var(--fs-md); line-height: 1.55; }
.moment-compose-body::placeholder { color: var(--text-3); }
.moment-compose-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.moment-compose-thumb { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--bg-elev-3); }
.moment-compose-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.moment-compose-thumb button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--scrim); color: var(--on-accent); font-size: var(--fs-md); line-height: 1; }
.moment-add-media { aspect-ratio: 1; border: 1px dashed var(--text-3); border-radius: 8px; background: var(--bg-elev-3); color: var(--text-3); font-size: var(--fs-2xl); line-height: 1; }
.moment-compose-footer { margin-top: auto; padding-top: 16px; }
.moment-visibility { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); }
.moment-vis-btn { height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: var(--fs-sm); }
.moment-vis-btn.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

.profile-page { background: var(--bg); }
.profile-hero { display: flex; align-items: center; gap: 12px; margin: 12px; padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; }
.profile-hero .avatar { width: 62px; height: 62px; flex-basis: 62px; font-size: var(--fs-xl); border: 2px solid var(--line); cursor: pointer; }
.settings-avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: var(--fs-xs); }
.profile-id { flex: 1; min-width: 0; margin-top: 0; }
.profile-id strong { font-size: var(--fs-xl); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-id span { color: var(--muted); display: block; margin-top: 4px; font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-hero-arrow { margin-left: auto; color: var(--text-3); font-size: var(--fs-xl); line-height: 1; }
.profile-bio { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; margin: 8px 0 0; white-space: pre-wrap; }
.profile-meta { color: var(--text-3); font-size: var(--fs-xs); margin: 4px 0 0; }
.profile-details { margin: 8px 12px 12px; padding: 0px 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.profile-detail-row { display: flex; align-items: flex-start; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.profile-detail-key { flex: 0 0 45px; color: var(--text-3); }
.profile-detail-value { flex: 1; min-width: 0; color: var(--text); text-align: right; white-space: pre-wrap; word-break: break-word; }
.profile-edit-btn { width: calc(100% - 28px); margin: 12px 12px 12px; min-height: 34px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-size: var(--fs-sm); font-weight: 700; }
.edit-profile-form { padding: 12px 16px calc(24px + var(--safe-bottom)); display: grid; gap: 12px; }
.edit-avatar-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-size: var(--fs-sm); text-align: left; }
.edit-avatar-row .arrow { margin-left: auto; color: var(--text-3); }
.edit-field { display: grid; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.edit-field input, .edit-field textarea { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--text); background: var(--input-bg); font-size: var(--fs-sm); font-family: inherit; }
.edit-field input:focus, .edit-field textarea:focus { border-color: var(--accent); }
.edit-field textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.edit-gender { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; }
.edit-gender-btn { height: 32px; border: 0; border-radius: 8px; color: var(--text-2); background: transparent; font-size: var(--fs-sm); }
.edit-gender-btn.active { color: var(--on-accent); background: var(--accent); font-weight: 600; }
.edit-inline { display: flex; align-items: center; gap: 8px; }
.edit-inline input { flex: 1; }
.edit-age-hint, .edit-count { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.edit-count { justify-self: end; }
.edit-save { min-height: 42px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-size: var(--fs-sm); font-weight: 700; }
.profile-modal-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-modal-avatar { width: 58px; height: 58px; flex-basis: 58px; font-size: var(--fs-lg); }
.profile-modal-top strong { display: block; font-size: var(--fs-lg); }
.profile-modal-top span { display: block; margin-top: 0px; color: var(--text-3); font-size: var(--fs-xs); }
.profile-modal-bio { margin: 0 0 8px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; white-space: pre-wrap; }
.profile-modal-details { border-top: 1px solid var(--line); }
.profile-list { padding: 0 12px 20px; background: transparent; }
.profile-page > .settings-entry { width: calc(100% - 24px); margin: 0 12px; }
.theme-setting { padding: 12px 16px 16px; border-bottom: 1px solid var(--line); }
.theme-setting-head { display: flex; align-items: center; justify-content: space-between; color: var(--text); font-size: var(--fs-sm); }
.theme-setting-head span:last-child { color: var(--text-3); font-size: var(--fs-xs); }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; padding: 4px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; }
.theme-btn { height: 34px; padding: 0; border: 0; border-radius: 8px; color: var(--text-2); background: transparent; font-size: var(--fs-sm); }
.theme-btn.active { color: var(--on-accent); background: var(--accent); font-weight: 600; }
.settings-page { background: var(--bg); }
.settings-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.settings-head h2 { margin: 0; font-size: var(--fs-xl); }
.settings-head .icon-btn { width: 34px; height: 34px; font-size: var(--fs-2xl); line-height: 1; }
.settings-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.settings-page .theme-setting { margin: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev); }
.settings-page .theme-setting:first-of-type { margin-top: 12px; }
.server-setting-row { display: flex; gap: 8px; margin-top: 8px; }
.server-setting-row input { flex: 1; min-width: 0; padding: 8px 8px; color: var(--text); background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: var(--fs-sm); }
.server-setting-row button { padding: 0 12px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-size: var(--fs-sm); font-weight: 700; }
.server-state { margin-top: 8px; color: var(--text-3); font-size: var(--fs-xs); }
.server-state.offline { color: var(--danger); }
.settings-version { padding: 24px 16px calc(24px + var(--safe-bottom)); color: var(--text-3); font-size: var(--fs-xs); text-align: center; letter-spacing: .3px; }
.profile-item { display: flex; align-items: center; gap: 12px; width: 100%; margin: 12px 0; padding: 12px 16px; color: var(--text); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; text-align: left; font-size: var(--fs-sm); }
.profile-item:hover { background: var(--panel-2); }
.profile-item .ico { width: 23px; text-align: center; color: var(--brand); }
.profile-item .arrow { margin-left: auto; color: var(--text-3); }
.legacy-page { padding: 24px 16px; overflow-y: auto; }
.legacy-card { max-width: 520px; margin: 0 auto; padding: 24px; background: var(--panel-2); border-radius: 14px; }
.legacy-card h2 { margin: 0 0 8px; }
.legacy-card p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
.legacy-card a { display: inline-block; margin-top: 8px; padding: 8px 12px; border-radius: 8px; color: var(--on-accent); background: var(--brand); text-decoration: none; font-weight: 700; font-size: var(--fs-sm); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--scrim); }
.modal-card { width: min(430px, 100%); max-height: 88vh; overflow-y: auto; padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.modal-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-title h3 { margin: 0; font-size: var(--fs-lg); }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: var(--fs-xl); }
.modal-input { width: 100%; box-sizing: border-box; padding: 8px 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: var(--fs-sm); }
.user-result { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.user-result .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: var(--fs-xs); }
.user-result-main { flex: 1; min-width: 0; }
.user-result-main strong { display: block; font-size: var(--fs-sm); }
.user-result-main span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 0px; }
.request-list { display: grid; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(78px + var(--safe-bottom)); z-index: 80; transform: translateX(-50%); max-width: 86vw; padding: 8px 12px; color: var(--toast-text); background: var(--toast-bg); border: 1px solid var(--line); border-radius: 8px; font-size: var(--fs-sm); box-shadow: var(--shadow); }

.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.auth-card { width: min(380px, 100%); padding: 24px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand h1 { margin: 0; font-size: var(--fs-2xl); }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-xs); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.auth-tab { min-height: 37px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-weight: 600; }
.auth-tab.active { color: var(--on-accent); background: var(--brand); }
.auth-connection { margin: 0 0 8px; color: var(--danger); font-size: var(--fs-xs); line-height: 1.5; }
.auth-offline { width: 100%; min-height: 34px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: transparent; font-size: var(--fs-xs); }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-xs); }
.auth-form input { width: 100%; padding: 8px 12px; color: var(--text); background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.auth-form input:focus { border-color: var(--accent); }
.auth-submit { margin-top: 0px; min-height: 42px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-weight: 700; }
.auth-error { margin: 0; color: var(--danger); font-size: var(--fs-xs); }
.auth-hint { margin: 16px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; }

@media (max-width: 760px) {
  .rail { display: none; }
  .qq-app { display: block; }
  .main-view { height: 100%; padding-bottom: 0; }
  .page { max-width: none; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 4px 8px calc(4px + var(--safe-bottom));
    background: var(--bg); border-top: 1px solid var(--line);
  }
  .bottom-item { position: relative; display: grid; place-items: center; gap: 4px; min-height: 46px; padding: 0px; border: 0; background: transparent; color: var(--text-2); font-size: var(--fs-xs); }
  .bottom-item.active { color: var(--accent); }
  .bottom-item.active::after { content: ""; position: absolute; bottom: 1px; width: 18px; height: 2px; border-radius: 8px; background: var(--brand); }
  .bottom-item .nav-ico { font-size: var(--fs-xl); line-height: 1; }
  .bottom-item em { position: absolute; top: 1px; right: 20%; min-width: 15px; height: 15px; padding: 0 4px; display: grid; place-items: center; border-radius: 8px; background: var(--red); color: var(--on-accent); font-size: var(--fs-xs); font-style: normal; }
  .topbar { padding: 16px 16px 8px; }
  .topbar .me-title strong { font-size: var(--fs-xl); }
  .list-scroll, .contacts-body { padding-bottom: 80px; }
  .chat-page { height: calc(100% - 56px); padding-bottom: 0; }
  .message-scroll { padding-bottom: 8px; }
  .composer { position: relative; }
  .msg-main { max-width: 72%; }
}
@media (min-width: 761px) {
  .bottom-nav { display: none; }
  .page { max-width: 920px; }
  .topbar { padding: 24px 24px 12px; }
  .list-scroll { padding: 0px 16px 20px; }
  .contacts-body { padding: 0 16px 20px; }
  .message-scroll { padding: 16px 24px; }
  .composer { padding: 8px 24px; }
  .chat-head { padding: 12px 20px; }
}


/* video tools */
.video-tools-scroll { padding: 12px 16px calc(28px + var(--safe-bottom)); }
.video-tools-intro { display: grid; gap: 4px; margin: 0 0px 16px; }
.video-tools-intro strong { font-size: var(--fs-lg); }
.video-tools-intro span { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.5; }
.video-url-row { display: flex; gap: 8px; align-items: stretch; }
.video-url-row input { flex: 1; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--input-bg); color: var(--text); font-size: var(--fs-sm); }
.video-url-row input:focus { border-color: var(--accent); }
.video-parse-btn { flex: 0 0 64px; border: 0; border-radius: 8px; background: var(--brand); color: var(--on-accent); font-size: var(--fs-sm); font-weight: 700; }
.video-parse-btn:disabled { opacity: .6; }
.video-result { margin-top: 16px; }
.video-result-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev); }
.video-result-cover { aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--panel-3); color: var(--text-3); overflow: hidden; }
.video-result-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-result-info { display: grid; gap: 4px; padding: 12px 12px 8px; }
.video-result-info strong { font-size: var(--fs-md); line-height: 1.45; }
.video-platform { justify-self: start; padding: 0px 4px; border-radius: 8px; color: var(--text-3); background: var(--panel-3); font-size: var(--fs-xs); }
.video-duration { color: var(--text-3); font-size: var(--fs-xs); }
.video-result-actions { display: flex; gap: 8px; padding: 4px 12px 12px; }
.video-action { display: grid; place-items: center; flex: 1; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-2); font-size: var(--fs-xs); text-decoration: none; }
.video-action.primary { border-color: transparent; background: var(--brand); color: var(--on-accent); font-weight: 700; }
.video-player-wrap { padding: 0 12px 12px; }
.video-player { width: 100%; max-height: 46vh; border-radius: 8px; background: #000; display: block; }
.video-direct-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: var(--fs-xs); text-decoration: none; }
.video-tools-error { padding: 12px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line)); border-radius: 8px; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); font-size: var(--fs-sm); line-height: 1.5; }
.video-tools-loading { padding: 16px 4px; color: var(--text-3); font-size: var(--fs-sm); }

/* file messages */
.file-bubble { display: flex; align-items: center; gap: 8px; min-width: 190px; max-width: 280px; padding: 8px 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-align: left; }
.file-icon { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .2px; }
.file-info { min-width: 0; display: grid; gap: 4px; }
.file-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 400; }
.file-info span { color: var(--text-3); font-size: var(--fs-xs); }
.file-preview-card { display: flex; flex-direction: column; max-height: 86vh; }
.file-preview-frame { width: 100%; min-height: 55vh; border: 0; border-radius: 8px; background: #fff; flex: 1; }
.file-preview-tip { padding: 24px 8px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.file-preview-actions { display: flex; gap: 8px; padding: 8px 0; }
.file-bubble { background: var(--panel-2); color: var(--text); }
.msg-row.mine .file-bubble { background: var(--accent); color: var(--on-accent); }
.file-icon { background: var(--panel-3); color: var(--accent); }
.msg-row.mine .file-icon { background: rgba(255,255,255,.18); color: #fff; }
.file-info span { color: var(--text-3); }
.msg-row.mine .file-info span { color: rgba(255,255,255,.72); }

/* QQ-style attachment panel */
.attach-plus { color: var(--text-2); font-size: var(--fs-2xl); font-weight: 400; line-height: 1; }
.attach-plus:active { background: var(--hover); }
.attach-panel { position: absolute; left: 9px; right: 9px; bottom: calc(100% + 8px); z-index: 40; padding: 12px 12px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.attach-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.attach-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 0px; border: 0; border-radius: 8px; color: var(--text-2); background: transparent; font-size: var(--fs-xs); }
.attach-item:active { color: var(--accent); background: var(--hover); }
.attach-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--panel-2); color: var(--text); }
.attach-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }



/* custom infinite canvas */
.qq-app.canvas-route .rail { display: none; }
.qq-app.canvas-route .bottom-nav { display: none; }
.canvas-page { width: 100%; max-width: none; height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.canvas-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.canvas-title { flex: 1; min-width: 0; }
.canvas-title h2 { margin: 0; font-size: var(--fs-lg); }
.canvas-save-state { display: block; margin-top: 0px; color: var(--text-3); font-size: var(--fs-xs); }
.canvas-actions { display: flex; align-items: center; gap: 8px; }
.canvas-btn { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--bg-elev); font-size: var(--fs-xs); white-space: nowrap; }
.canvas-btn.primary { border-color: transparent; color: var(--on-accent); background: var(--brand); font-weight: 700; }
.canvas-body { flex: 1; min-height: 0; display: flex; }
.canvas-wrap { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.canvas-surface { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.canvas-surface.panning { cursor: grabbing; }
.canvas-inspector { width: 290px; flex: 0 0 290px; overflow-y: auto; padding: 16px 12px 24px; border-left: 1px solid var(--line); background: var(--bg-elev); }
.canvas-inspector-empty { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.7; }
.canvas-inspector-empty strong { display: block; margin-bottom: 8px; color: var(--text); font-size: var(--fs-md); }
.canvas-inspector-empty p { margin: 0; }
.canvas-inspector-tag { display: inline-block; padding: 4px 8px; border-radius: 8px; color: var(--text-2); background: var(--panel-3); font-size: var(--fs-xs); }
.canvas-node-status { margin: 12px 0 8px; font-size: var(--fs-xs); color: var(--text-3); }
.canvas-node-status.generating { color: var(--accent); }
.canvas-node-status.failed { color: var(--danger); }
.canvas-node-status.done { color: #35a66f; }
.canvas-field { display: grid; gap: 4px; margin: 8px 0; color: var(--text-3); font-size: var(--fs-xs); }
.canvas-textarea, .canvas-select { width: 100%; box-sizing: border-box; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--text); background: var(--input-bg); font-size: var(--fs-sm); font-family: inherit; }
.canvas-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.canvas-textarea:focus, .canvas-select:focus { border-color: var(--accent); }
.canvas-generate { width: 100%; min-height: 38px; margin-top: 8px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-size: var(--fs-sm); font-weight: 700; }
.canvas-generate:disabled { opacity: .6; }
.canvas-hint { margin-top: 8px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.6; }
.canvas-delete { width: 100%; min-height: 32px; margin-top: 8px; border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--line)); border-radius: 8px; color: var(--danger); background: transparent; font-size: var(--fs-xs); }
@media (max-width: 760px) {
  .canvas-head { padding: 8px 12px; gap: 4px; }
  .canvas-actions { gap: 4px; }
  .canvas-btn { height: 30px; padding: 0 8px; font-size: var(--fs-xs); }
  .canvas-body { flex-direction: column; }
  .canvas-inspector { width: auto; flex: 0 0 auto; max-height: 43%; padding: 12px 12px calc(12px + var(--safe-bottom)); border-left: 0; border-top: 1px solid var(--line); }
  .canvas-textarea { min-height: 66px; }
}

/* 0.11.45 canvas v2 */
.canvas-back { width: 32px; height: 32px; padding: 0; }
.canvas-back svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.canvas-icon-btn { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--bg-elev); font-size: var(--fs-lg); line-height: 1; }
.canvas-actions { overflow-x: auto; max-width: 62%; }
.canvas-actions::-webkit-scrollbar { display: none; }
.canvas-help { margin-top: 12px !important; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.6; }
.canvas-search-card { width: min(420px, calc(100vw - 28px)); }
.canvas-search-results { max-height: min(50vh, 360px); overflow-y: auto; margin-top: 8px; }
.canvas-search-empty { padding: 16px 4px; color: var(--text-3); font-size: var(--fs-xs); }
.canvas-search-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-sm); text-align: left; }
.canvas-search-row:active, .canvas-search-row:hover { background: var(--hover); }
.canvas-search-type { flex: 0 0 auto; padding: 0px 4px; border-radius: 8px; color: var(--text-2); background: var(--panel-3); font-size: var(--fs-xs); }
.canvas-export-actions { display: grid; gap: 8px; margin-top: 12px; }
.canvas-export-actions .canvas-btn { width: 100%; margin: 0; }
@media (max-width: 760px) {
  .canvas-actions { max-width: 66%; }
  .canvas-icon-btn { width: 29px; height: 29px; font-size: var(--fs-lg); }
}

/* 0.11.46 model picker + image-to-image refs */
.canvas-model-wrap { position: relative; }
.canvas-model-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.canvas-model-arrow { color: var(--text-3); font-size: var(--fs-xs); }
.canvas-model-menu { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 4px); max-height: 290px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.canvas-model-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-xs); text-align: left; }
.canvas-model-option span:last-child { color: var(--accent); font-size: var(--fs-xs); white-space: nowrap; }
.canvas-model-option:hover, .canvas-model-option.active { background: var(--hover); }
.canvas-refs { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.canvas-refs-title { color: var(--text-2); font-size: var(--fs-xs); }
.canvas-ref-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.canvas-ref-strip img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.canvas-ref-warn { margin-top: 4px; color: var(--danger); font-size: var(--fs-xs); line-height: 1.45; }
.canvas-ref-clear { margin-top: 8px; padding: 0; border: 0; color: var(--accent); background: transparent; font-size: var(--fs-xs); }

/* 0.11.47 batch/history/viewer/context */
.canvas-batch-row { display: flex; align-items: center; gap: 8px; }
.canvas-batch-row .canvas-select { flex: 0 0 92px; }
.canvas-batch-total { color: var(--accent); font-size: var(--fs-xs); white-space: nowrap; }
.canvas-history { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.canvas-history-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: var(--text-2); font-size: var(--fs-xs); }
.canvas-history-nav { display: flex; align-items: center; gap: 4px; }
.canvas-history-nav button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 8px; color: var(--text); background: var(--panel-3); font-size: var(--fs-md); line-height: 1; }
.canvas-history-nav button:disabled { opacity: .3; }
.canvas-history-nav em { color: var(--text-3); font-style: normal; font-size: var(--fs-xs); }
.canvas-history-strip { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; padding-bottom: 0px; }
.canvas-history-cell { position: relative; flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 8px; overflow: hidden; }
.canvas-history-cell.active { border-color: var(--accent); }
.canvas-history-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.canvas-history-del { position: absolute; right: 0; top: 0; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 0 0 0 8px; color: #fff; background: rgba(0,0,0,.55); font-size: var(--fs-sm); line-height: 1; }
.canvas-context { position: fixed; z-index: 200; width: 184px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.canvas-context-item { display: block; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-xs); text-align: left; }
.canvas-context-item:hover { background: var(--hover); }
.canvas-context-item.danger { color: var(--danger); }
.canvas-viewer-backdrop { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.88); backdrop-filter: blur(4px); }
.canvas-viewer { width: 100%; height: 100%; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); box-sizing: border-box; }
.canvas-viewer-top { display: flex; align-items: center; gap: 8px; color: #fff; }
.canvas-viewer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.canvas-viewer-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: rgba(255,255,255,.08); font-size: var(--fs-sm); }
.canvas-viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.canvas-viewer-stage img { max-width: 96vw; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-card); }
.canvas-viewer-bottom { display: flex; justify-content: center; gap: 12px; }
.canvas-viewer-arrow { width: 44px; height: 36px; border: 1px solid rgba(255,255,255,.24); border-radius: 8px; color: #fff; background: rgba(255,255,255,.1); font-size: var(--fs-2xl); line-height: 1; }
.canvas-viewer-arrow:disabled { opacity: .25; }
@media (max-width: 760px) {
  .canvas-viewer { padding-left: 8px; padding-right: 8px; }
  .canvas-viewer-stage img { max-width: 100%; }
}

/* 0.11.48 task controls */
.canvas-cancel, .canvas-retry { width: 100%; min-height: 32px; margin-top: 8px; border-radius: 8px; background: transparent; font-size: var(--fs-xs); }
.canvas-cancel { border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }
.canvas-retry { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }
.canvas-icon-btn:disabled { opacity: .32; }

/* 0.11.49 chat polish */
.quote-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; margin: 0 0 4px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--panel-2); }
.quote-bar[hidden] { display: none; }
.quote-bar-text { flex: 1; min-width: 0; display: flex; gap: 4px; overflow: hidden; font-size: var(--fs-xs); }
.quote-bar-text strong { flex: 0 0 auto; color: var(--accent); font-weight: 600; }
.quote-bar-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.quote-bar-close { flex: 0 0 auto; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; color: var(--text-3); background: var(--panel-3); font-size: var(--fs-md); line-height: 1; }
.quote-block { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; margin-bottom: 4px; padding: 4px 8px; border-left: 2px solid rgba(255,255,255,.35); border-radius: 8px; color: inherit; background: rgba(0,0,0,.14); font-size: var(--fs-xs); text-align: left; }
.msg-row:not(.mine) .quote-block { border-left-color: rgba(0,0,0,.2); background: rgba(0,0,0,.06); }
.quote-block strong { color: inherit; opacity: .78; font-size: var(--fs-xs); }
.quote-block span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.msg-recall { align-self: center; margin: 8px auto; padding: 4px 8px; border-radius: 8px; color: var(--text-3); background: var(--panel-2); font-size: var(--fs-xs); text-align: center; }
.msg-flash { animation: msgFlash 1.4s ease; }
@keyframes msgFlash { 0%, 100% { background: transparent; } 25%, 65% { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 8px; } }
.msg-retry { width: 18px; height: 18px; margin-left: 0px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: var(--danger); font-size: var(--fs-sm); font-weight: 700; line-height: 18px; }
.msg-menu { position: fixed; z-index: 260; width: 178px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.msg-menu-item { display: block; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-xs); text-align: left; }
.msg-menu-item:hover { background: var(--hover); }
.msg-menu-item.danger { color: var(--danger); }
.new-msg-badge { position: fixed; right: 18px; bottom: 92px; z-index: 40; padding: 8px 12px; border: 0; border-radius: 18px; color: #fff; background: var(--accent); box-shadow: var(--shadow-card); font-size: var(--fs-xs); }
.chat-image-viewer { position: fixed; inset: 0; z-index: 350; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.93); }
.chat-image-viewer img { max-width: 96vw; max-height: 92vh; object-fit: contain; border-radius: 8px; }
.chat-image-top { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; display: flex; gap: 8px; }
.chat-image-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 32px; padding: 0 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: rgba(255,255,255,.1); font-size: var(--fs-sm); text-decoration: none; }
.forward-card { width: min(380px, calc(100vw - 28px)); max-height: 70vh; }
.forward-list { max-height: 52vh; overflow-y: auto; margin-top: 8px; }
.forward-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-sm); text-align: left; }
.forward-row:hover { background: var(--hover); }
.forward-empty { padding: 20px; color: var(--text-3); font-size: var(--fs-xs); text-align: center; }
.voice-bubble { position: relative; }
.voice-progress { position: absolute; left: 34px; bottom: 3px; height: 2px; border-radius: 8px; background: var(--accent); opacity: .75; pointer-events: none; }
.voice-unplayed { position: absolute; right: -4px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 760px) {
  .new-msg-badge { right: 12px; bottom: calc(82px + var(--safe-bottom)); }
  .msg-menu { width: 166px; }
}

/* refinements */
.quote-block, .msg-row.mine .quote-block { background: rgba(135,145,165,.20); border-left-color: rgba(255,255,255,.38); }
.msg-row:not(.mine) .quote-block { background: rgba(135,145,165,.16); }
.msg-recall { width: fit-content; max-width: 82%; }

/* 0.11.50 canvas media/layout/colors */
.canvas-media-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.canvas-media-layer > * { pointer-events: auto; position: absolute; border-radius: 8px; background: #000; object-fit: contain; }
.canvas-node-plus { position: absolute; z-index: 8; transform: translateX(-50%); width: 25px; height: 25px; padding: 0; border: 2px solid var(--bg); border-radius: 50%; color: #fff; background: var(--accent); box-shadow: var(--shadow-soft); font-size: var(--fs-lg); line-height: 21px; }
.canvas-quick-menu { position: absolute; z-index: 9; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.canvas-quick-item { padding: 4px 8px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-xs); white-space: nowrap; }
.canvas-quick-item:hover { background: var(--hover); }
.canvas-color-row { display: flex; flex-wrap: wrap; gap: 4px; }
.canvas-color-dot, .canvas-menu-color { width: 18px; height: 18px; padding: 0; border: 2px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.canvas-menu-colors { display: flex; gap: 4px; padding: 4px 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.canvas-menu-color { width: 16px; height: 16px; }
.canvas-layout-row { display: flex; gap: 4px; margin: 8px 0 4px; }
.canvas-layout-btn { flex: 1; padding: 4px 4px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: transparent; font-size: var(--fs-xs); }
.canvas-layout-btn.active { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.canvas-layout-span { max-width: 100px; }
.canvas-btn.active { border-color: var(--accent); color: var(--accent); }

/* 0.11.51 mobile UX */
.bottom-more { display: none; }
.bottom-more-menu { position: fixed; right: 12px; bottom: calc(66px + var(--safe-bottom)); z-index: 35; display: grid; gap: 4px; min-width: 132px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.bottom-more-menu[hidden] { display: none; }
.bottom-more-menu button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-sm); text-align: left; }
.bottom-more-menu button:active { background: var(--hover); }
@media (max-width: 399px) {
  .bottom-nav { grid-template-columns: repeat(2, 1fr); padding: 4px 8px calc(4px + var(--safe-bottom)); }
  .bottom-item { min-height: 48px; }
  .bottom-item[data-route="contacts"], .bottom-item[data-route="moments"], .bottom-item[data-route="me"] { display: none; }
  .bottom-item.bottom-more { display: grid; }
  .bottom-item span { display: none; }
  .bottom-item .nav-ico { font-size: var(--fs-xl); }
  .msg-menu-item, .canvas-context-item { min-height: 44px; display: flex; align-items: center; }
}
@media (min-width: 400px) and (max-width: 760px) {
  .bottom-more-menu { display: none !important; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .bottom-nav { padding-top: 0px; padding-bottom: calc(0px + var(--safe-bottom)); }
  .bottom-item { min-height: 38px; font-size: var(--fs-xs); gap: 0; }
  .bottom-item .nav-svg { width: 18px; height: 18px; }
  .bottom-item.active::after { bottom: 0; }
  .list-scroll, .contacts-body { padding-bottom: 48px; }
  .chat-page { height: calc(100% - 48px); }
  .bottom-more-menu { bottom: calc(44px + var(--safe-bottom)); }
}
@media (max-width: 760px) {
  .qq-app, .main-view { min-height: 100dvh; }
  .composer { padding-bottom: calc(8px + var(--safe-bottom)); }
  .canvas-inspector { border-radius: 14px 14px 0 0; box-shadow: var(--shadow-card); }
  .canvas-quick-item { min-height: 44px; }
}

.canvas-text-editor { position: absolute; z-index: 12; box-sizing: border-box; padding: 8px 12px; border: 2px solid var(--accent); border-radius: 8px; outline: none; color: var(--text); background: var(--bg-elev-2); box-shadow: var(--shadow-card); resize: none; font-family: inherit; font-size: var(--fs-md); line-height: 1.5; }
@media (max-width: 760px) {
  .qq-app { height: var(--vvh, 100dvh); }
  .main-view { height: 100%; }
}

/* 0.11.52 canvas list / landscape */
.canvas-list-page { padding-bottom: calc(80px + var(--safe-bottom)); }
.canvas-list-top { padding-bottom: 8px; }
.canvas-list-title-row { align-items: center; gap: 12px; }
.canvas-list-heading { flex: 1; min-width: 0; }
.canvas-list-heading h2 { margin: 0; font-size: var(--fs-xl); }
.canvas-list-heading p { margin: 4px 0 0; color: var(--text-3); font-size: var(--fs-xs); }
.canvas-new-board { min-height: 48px; padding: 0 16px; border: 0; border-radius: 8px; color: var(--on-accent); background: var(--brand); font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; }
.canvas-list-body { position: relative; min-height: calc(100dvh - 180px); padding: 16px 16px 100px; }
.canvas-list-card { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--bg-elev); text-align: left; cursor: pointer; }
.canvas-list-card:active { border-color: var(--accent); }
.canvas-list-thumb { flex: 0 0 96px; height: 72px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: var(--accent); background: var(--panel-2); font-size: var(--fs-2xl); }
.canvas-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.canvas-list-info { display: grid; gap: 4px; min-width: 0; padding-right: 48px; }
.canvas-list-info strong { font-size: var(--fs-md); }
.canvas-list-info span { color: var(--text-3); font-size: var(--fs-xs); }
.canvas-list-info em { color: var(--accent); font-size: var(--fs-xs); font-style: normal; }
.canvas-list-empty { display: grid; place-items: center; min-height: 45vh; color: var(--text-3); text-align: center; }
.canvas-list-empty strong { color: var(--text); font-size: var(--fs-lg); }
.canvas-list-empty p { margin: 8px 0 0; font-size: var(--fs-xs); }
.canvas-list-foot { margin-top: 20px; color: var(--text-3); font-size: var(--fs-xs); text-align: center; }
.canvas-list-error { color: var(--danger); font-size: var(--fs-xs); }
.canvas-rotate-hint { display: none; }
.canvas-context { max-height: calc(100dvh - 16px); overflow-y: auto; }
@media (max-width: 760px) {
  .canvas-list-heading h2 { font-size: var(--fs-xl); }
  .canvas-new-board { min-height: 48px; padding: 0 12px; font-size: var(--fs-xs); }
  .canvas-list-body { padding: 12px 12px 100px; }
}
@media (orientation: portrait) and (max-width: 760px) {
  .canvas-rotate-hint { display: block; position: absolute; top: calc(64px + env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 18; padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; color: var(--text-2); background: var(--bg-elev-2); box-shadow: var(--shadow-soft); font-size: var(--fs-xs); pointer-events: none; white-space: nowrap; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-page { position: relative; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); overflow: hidden; }
  .canvas-head { min-height: 40px; height: 40px; padding: 4px 8px; gap: 8px; z-index: 20; }
  .canvas-title h2 { font-size: var(--fs-md); }
  .canvas-save-state { display: none; }
  .canvas-actions { position: fixed; left: calc(8px + env(safe-area-inset-left)); bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 25; display: flex; flex-direction: column; max-width: none; max-height: calc(100dvh - 56px); overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent); box-shadow: var(--shadow-card); }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { width: 78px; height: 30px; box-sizing: border-box; font-size: var(--fs-xs); }
  .canvas-body { position: relative; display: block; flex: 1; min-height: 0; }
  .canvas-wrap { position: absolute; inset: 0; }
  .canvas-inspector { position: absolute; top: 0; right: 0; bottom: 0; width: min(300px, 46vw); max-height: none; z-index: 12; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-left: 1px solid var(--line); border-top: 0; box-shadow: var(--shadow-card); }
  .canvas-rotate-hint { display: none; }
}

/* 0.11.52b LYCanvas-style landscape chrome */
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-page { position: relative; padding: 0; overflow: hidden; }
  .canvas-head {
    position: absolute; left: calc(8px + env(safe-area-inset-left)); top: calc(6px + env(safe-area-inset-top));
    width: auto; max-width: calc(100vw - 84px); min-height: 34px; height: 34px; box-sizing: border-box;
    padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px;
    background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent); box-shadow: var(--shadow-soft);
    z-index: 30; border-bottom: 0;
  }
  .canvas-title h2 { font-size: var(--fs-sm); white-space: nowrap; }
  .canvas-save-state { display: none; }
  .canvas-back { width: 28px; height: 28px; }
  .canvas-actions {
    position: fixed; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    flex-direction: row; width: auto; max-width: calc(100vw - 16px); height: 56px; box-sizing: border-box;
    padding: 4px 8px; gap: 4px; overflow-x: auto; overflow-y: hidden;
    border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
    box-shadow: var(--shadow-card); z-index: 40;
  }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { width: 48px; height: 44px; padding: 0 4px; box-sizing: border-box; border-radius: 8px; font-size: var(--fs-xs); }
  .canvas-actions .canvas-btn.primary { color: var(--on-accent); background: var(--brand); }
  .canvas-body { position: relative; display: block; flex: 1; min-height: 0; height: 100%; }
  .canvas-wrap { position: absolute; inset: 0; }
  .canvas-inspector { top: 0; right: 0; bottom: 0; width: min(300px, 46vw); max-height: none; z-index: 12; }
  .canvas-rotate-hint { display: none; }
}

.canvas-help-fab { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-inspector.is-help-collapsed { display: none; }
  .canvas-help-fab {
    display: grid; place-items: center; position: fixed; right: calc(12px + env(safe-area-inset-right)); bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 45; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
    color: var(--text); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent); box-shadow: var(--shadow-card); font-size: var(--fs-lg); font-weight: 700;
  }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 639px) {
  .canvas-actions { height: 48px; padding: 4px 4px; border-radius: 14px; bottom: calc(5px + env(safe-area-inset-bottom)); }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { width: 38px; height: 38px; font-size: var(--fs-xs); padding: 0 0px; }
  .canvas-help-fab { right: calc(8px + env(safe-area-inset-right)); bottom: calc(58px + env(safe-area-inset-bottom)); width: 40px; height: 40px; }
}

/* 0.11.53 help popover: no permanent panel on phones */
@media (max-width: 760px) {
  .canvas-inspector.is-help-collapsed { display: none !important; }
  .canvas-help-fab {
    display: grid; place-items: center; position: fixed; z-index: 55;
    right: calc(12px + env(safe-area-inset-right)); bottom: calc(68px + env(safe-area-inset-bottom));
    width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
    color: var(--text); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
    box-shadow: var(--shadow-soft); font-size: var(--fs-lg); font-weight: 700;
  }
  .canvas-help-popover {
    position: fixed; z-index: 56; right: calc(12px + env(safe-area-inset-right)); bottom: calc(116px + env(safe-area-inset-bottom));
    box-sizing: border-box; width: min(280px, 30vw); max-width: 30vw; padding: 8px 8px;
    border: 1px solid var(--line); border-radius: 8px; color: var(--text-2);
    background: color-mix(in srgb, var(--bg-elev-2) 96%, transparent); box-shadow: var(--shadow-card);
    font-size: var(--fs-xs); line-height: 1.55; overflow-wrap: anywhere;
  }
  .canvas-help-popover[hidden] { display: none; }
  .canvas-help-popover strong { display: block; margin-bottom: 4px; color: var(--text); font-size: var(--fs-sm); }
  .canvas-help-popover p { margin: 0 0 4px; }
  .canvas-help-popover p:last-child { margin-bottom: 0; }
}

/* help popover base: applies in landscape even when width > 760 */
.canvas-help-popover {
  position: fixed; z-index: 56; right: calc(12px + env(safe-area-inset-right)); bottom: calc(124px + env(safe-area-inset-bottom));
  box-sizing: border-box; width: min(280px, 30vw); max-width: 30vw; padding: 8px 8px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text-2);
  background: color-mix(in srgb, var(--bg-elev-2) 96%, transparent); box-shadow: var(--shadow-card);
  font-size: var(--fs-xs); line-height: 1.55; overflow-wrap: anywhere;
}
.canvas-help-popover[hidden] { display: none; }
.canvas-help-popover strong { display: block; margin-bottom: 4px; color: var(--text); font-size: var(--fs-sm); }
.canvas-help-popover p { margin: 0 0 4px; }
.canvas-help-popover p:last-child { margin-bottom: 0; }


/* 0.11.54 inspector close / floating back / slim handles */
.canvas-inspector { position: relative; }
.canvas-inspector-close { position: absolute; top: 6px; right: 8px; z-index: 4; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--text-2); background: var(--bg-elev-2); font-size: var(--fs-xl); line-height: 30px; }
.canvas-inspector-close:active { color: var(--text); border-color: var(--accent); }
.canvas-back-float { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-head .canvas-back { display: none; }
  .canvas-back-float { display: grid; place-items: center; position: fixed; z-index: 32; left: calc(8px + env(safe-area-inset-left)); top: calc(6px + env(safe-area-inset-top)); width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent); box-shadow: var(--shadow-soft); }
  .canvas-back-float svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .canvas-head { left: calc(56px + env(safe-area-inset-left)); }
  .canvas-inspector-close { top: 4px; right: 6px; width: 30px; height: 30px; line-height: 28px; }
}
@media (max-width: 760px) {
  .canvas-inspector-close { width: 36px; height: 36px; line-height: 34px; font-size: var(--fs-xl); }
}

/* keep the 0.11.54 inspector on the right in landscape */
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-inspector { position: absolute; top: 0; right: 0; bottom: 0; left: auto; }
}

/* 0.11.54 LYCanvas detail alignment */
.canvas-btn, .canvas-icon-btn, .canvas-back, .canvas-back-float, .canvas-new-board, .canvas-context-item, .canvas-list-card, .canvas-inspector-close {
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.canvas-btn { height: 32px; border-radius: 8px; font-size: var(--fs-sm); }
.canvas-btn:hover { border-color: var(--line-strong, var(--line)); background: var(--hover); }
.canvas-btn:active, .canvas-icon-btn:active, .canvas-back:active, .canvas-back-float:active, .canvas-new-board:active { transform: scale(.96); }
.canvas-icon-btn { width: 32px; height: 32px; border-radius: 8px; font-size: var(--fs-lg); }
.canvas-context { width: 184px; padding: 4px; border-radius: 14px; box-shadow: var(--shadow-card); }
.canvas-context-item { padding: 8px 8px; border-radius: 8px; font-size: var(--fs-sm); transition: background .15s ease, color .15s ease; }
.canvas-context-item:hover { background: var(--hover); }
.canvas-dock-sep { flex: 0 0 1px; width: 1px; height: 23px; margin: 0 4px; background: var(--line); }
.canvas-inspector { width: 300px; flex: 0 0 300px; padding: 16px 16px 24px; box-shadow: var(--shadow-card); }
.canvas-list-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-content: start; }
.canvas-list-card { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-radius: 14px; box-shadow: var(--shadow-soft); }
.canvas-list-card:hover { border-color: var(--line-strong, var(--line)); transform: translateY(-1px); }
.canvas-list-thumb { width: 100%; height: auto; aspect-ratio: 16 / 10; flex: none; border-radius: 8px; }
.canvas-list-foot, .canvas-list-empty, .canvas-list-error { grid-column: 1 / -1; }
.canvas-list-info { padding: 0 48px 4px 4px; }
.canvas-list-info strong { font-size: var(--fs-md); }
.canvas-inspector-close { width: 30px; height: 30px; border-radius: 8px; line-height: 28px; font-size: var(--fs-lg); }
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-actions { gap: 4px; height: 56px; padding: 4px 8px; border-radius: 14px; }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { width: 42px; height: 42px; border-radius: 8px; font-size: var(--fs-xs); }
  .canvas-actions .canvas-btn:hover, .canvas-actions .canvas-icon-btn:hover { background: var(--hover); }
  .canvas-inspector { width: min(320px, 46vw); padding: 12px 12px 12px; }
  .canvas-dock-sep { height: 23px; margin: 0 4px; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 639px) {
  .canvas-actions { gap: 4px; height: 48px; padding: 4px 4px; border-radius: 14px; }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { width: 38px; height: 38px; font-size: var(--fs-xs); }
  .canvas-dock-sep { height: 18px; margin: 0 0px; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .canvas-inspector { width: auto; flex: 0 0 auto; max-height: 43%; padding: 12px 12px calc(12px + var(--safe-bottom)); box-shadow: var(--shadow-card); }
}

/* 0.11.54 conversation long-press pin menu */
.conv-row { user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.conv-menu { position: fixed; z-index: 260; min-width: 160px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev-2); box-shadow: var(--shadow-card); }
.conv-menu-item { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-sm); text-align: left; }
.conv-menu-item:hover, .conv-menu-item:active { background: var(--hover); }
.conv-menu-item.danger { color: var(--danger); }

/* 0.11.55 visual system: warm coral, one radius/shadow/stroke scale */
/* 0.11.62 tokens consolidated at top of file */

#auth-view button, #qq-app button, #modal-root button, .conv-row, .msg-menu-item, .msg-search-result {
  transition: transform var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), color var(--ease);
}
#auth-view button:active, #qq-app button:active, #modal-root button:active, .conv-row:active, .msg-search-result:active {
  transform: scale(.96);
}
#auth-view button:disabled, #qq-app button:disabled { transform: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.page { max-width: 980px; background: var(--bg); }
.topbar { padding: 20px 20px 8px; }
.top-me { gap: 12px; }
.top-me .avatar { width: 42px; height: 42px; flex-basis: 42px; border-radius: var(--radius-card); }
.me-title strong { font-size: var(--fs-xl); letter-spacing: -.3px; }
.me-title span { margin-top: 4px; font-size: var(--fs-xs); }
.icon-btn { width: var(--control-h); height: var(--control-h); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--bg-elev-2); font-size: var(--fs-lg); }
.icon-btn:hover { border-color: var(--card-border); background: var(--bg-elev-3); }
.icon-btn.solid { color: var(--on-accent); border-color: var(--coral); background: var(--coral); box-shadow: var(--shadow-soft); }
.search-row { margin-top: 12px; }
.search-box { min-height: var(--control-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--input-bg); box-shadow: var(--shadow-soft); }
.search-box:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.search-box input { font-size: var(--fs-sm); }
.list-scroll { padding: 8px 12px 100px; }
.conv-row { gap: 12px; padding: 12px 8px; margin: 0px 0; border: 1px solid transparent; border-radius: var(--radius-card); }
.conv-row:hover { border-color: var(--line); background: var(--bg-elev-2); }
.conv-row:active { border-color: var(--card-border); background: var(--coral-soft); }
.conv-name { font-size: var(--fs-md); letter-spacing: -.1px; }
.conv-time { font-size: var(--fs-xs); }
.conv-preview { margin-top: 4px; font-size: var(--fs-sm); }
.avatar { border-radius: var(--radius-card); }
.avatar img { border-radius: var(--radius-card); }
.avatar-wrap { border-radius: var(--radius-card); }
.pin-mark { padding: 0px 4px; border: 1px solid var(--card-border); border-radius: 8px; color: var(--accent); background: var(--coral-soft); font-size: var(--fs-xs); }
.unread { background: var(--coral); color: var(--on-accent); }

.chat-page { background: var(--bg); }
.chat-head { min-height: 64px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, var(--bg-elev)); }
.chat-head .back { width: 38px; height: var(--control-h); border-radius: var(--radius-sm); }
.chat-head .avatar { width: 38px; height: 38px; flex-basis: 38px; border-radius: 14px; }
.chat-peer strong { font-size: var(--fs-lg); }
.chat-head-actions { gap: 8px; }
.message-scroll { padding: 16px 16px 12px; }
.msg-row { gap: 8px; margin: 12px 0; }
.msg-avatar { width: 36px; height: 36px; flex-basis: 36px; border-radius: 8px; }
.msg-main { max-width: min(72%, 580px); }
.bubble { padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px 14px 14px 8px; background: var(--bubble-in); color: var(--bubble-in-text); box-shadow: var(--shadow-soft); font-size: var(--fs-md); line-height: 1.5; }
.msg-row.mine .bubble { border-color: transparent; border-radius: 14px 14px 8px 14px; background: var(--bubble-out); color: var(--bubble-out-text); box-shadow: var(--shadow-soft); }
.bubble.image-bubble, .msg-row.mine .bubble.image-bubble { border: 0; background: transparent; box-shadow: none; }
.msg-image { border-radius: 14px; }
.msg-meta { margin-top: 4px; font-size: var(--fs-xs); }
.msg-sender { margin: 0 0 4px 4px; font-size: var(--fs-xs); }
.msg-recall { margin: 12px auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev-2); font-size: var(--fs-xs); }
.emoji-message { font-size: var(--fs-2xl); }
.file-bubble { border-radius: 14px; }
.msg-row.mine .file-bubble { color: var(--on-accent); background: var(--coral); }
.quote-bar { padding: 8px 12px; margin: 0 0 8px; border: 1px solid var(--card-border); border-left: 3px solid var(--coral); border-radius: var(--radius-sm); background: var(--coral-soft); }
.quote-bar-text { font-size: var(--fs-xs); }
.quote-bar-close { width: 26px; height: 26px; background: var(--bg-elev-3); color: var(--text-2); }
.quote-block, .msg-row.mine .quote-block, .msg-row:not(.mine) .quote-block { padding: 8px 8px; margin-bottom: 4px; border: 1px solid var(--line); border-left: 3px solid var(--coral); border-radius: var(--radius-sm); background: var(--coral-soft); color: inherit; }
.quote-block strong { font-size: var(--fs-xs); opacity: .9; }
.quote-block span { font-size: var(--fs-xs); opacity: .78; }

.composer { padding: 8px 12px calc(8px + var(--safe-bottom)); background: color-mix(in srgb, var(--bg) 94%, var(--bg-elev)); }
.composer-row { gap: 8px; }
.composer-row input[type=text] { height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); box-shadow: var(--shadow-soft); }
.composer-row input[type=text]:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.comp-round { width: var(--control-h); height: var(--control-h); flex-basis: var(--control-h); border: 1px solid var(--control-border); border-radius: var(--radius-card); background: var(--bg-elev-2); }
.comp-round.send { color: var(--on-accent); border-color: var(--coral); background: var(--coral); box-shadow: var(--shadow-soft); }
.comp-round.send svg { fill: var(--on-accent); }
.hold-btn { height: var(--control-h); border-radius: var(--radius-card); background: var(--input-bg); }
.composer-toolbar { padding: 8px 4px 0; }
.comp-tool { height: 38px; border-radius: var(--radius-sm); }
.attach-panel { border: 2px solid var(--card-border); border-radius: var(--radius-card); background: var(--bg-elev); box-shadow: var(--shadow); }
.attach-item { border-radius: var(--radius-sm); }
.msg-menu, .conv-menu { width: 190px; padding: 4px; border: 2px solid var(--card-border); border-radius: var(--radius-card); background: var(--bg-elev); box-shadow: var(--shadow); }
.msg-menu-item, .conv-menu-item { min-height: 42px; padding: 0 12px; display: flex; align-items: center; border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.msg-menu-item:hover, .conv-menu-item:hover { background: var(--coral-soft); }
.msg-menu-item.danger, .conv-menu-item.danger { color: var(--danger); }

.modal-backdrop { background: color-mix(in srgb, var(--scrim) 94%, transparent); backdrop-filter: blur(3px); }
.modal-card { padding: 20px; border: 2px solid var(--card-border); border-radius: var(--radius-card); background: var(--bg-elev); box-shadow: var(--shadow); }
.modal-title { margin-bottom: 16px; }
.modal-title h3 { font-size: var(--fs-lg); letter-spacing: -.2px; }
.modal-close { width: 34px; height: 34px; border-radius: var(--radius-sm); }
.modal-input { min-height: var(--control-h); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); }
.modal-input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.forward-row, .user-result { border-radius: var(--radius-sm); }
.msg-search-card { width: min(520px, 100%); }
.msg-search-box { display: flex; align-items: center; gap: 8px; min-height: var(--control-h); padding: 0 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--input-bg); color: var(--text-3); }
.msg-search-box:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.msg-search-box input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: var(--fs-md); }
.msg-search-results { max-height: min(52vh, 440px); overflow-y: auto; display: grid; gap: 4px; }
.msg-search-result { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 58px; padding: 8px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text); background: transparent; text-align: left; }
.msg-search-result:hover { border-color: var(--line); background: var(--bg-elev-2); }
.msg-search-result:active { border-color: var(--card-border); background: var(--coral-soft); }
.msg-search-avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 8px; font-size: var(--fs-sm); }
.msg-search-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.msg-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.msg-search-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.msg-search-head time { flex: 0 0 auto; color: var(--text-3); font-size: var(--fs-xs); }
.msg-search-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: var(--fs-xs); }
.msg-search-hint { padding: 32px 12px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }

.drawer-panel { width: min(84vw, 360px); border-right: 1px solid var(--card-border); border-radius: 0 var(--radius-card) var(--radius-card) 0; background: var(--bg-elev); }
.drawer-head { padding: 24px 16px 16px; border-bottom-color: var(--line); }
.drawer-avatar { border-radius: var(--radius-card); }
.drawer-item { height: 52px; border-radius: var(--radius-sm); }
.drawer-item:active { background: var(--coral-soft); }
.drawer-bottom { border-top-color: var(--line); }

.profile-hero, .profile-details, .profile-item, .settings-page .theme-setting { border: 2px solid var(--card-border); border-radius: var(--radius-card); background: var(--bg-elev); box-shadow: var(--shadow-soft); }
.profile-hero { padding: 16px; }
.profile-hero .avatar { border-radius: var(--radius-card); }
.profile-edit-btn, .edit-save, .settings-page .server-setting-row button { min-height: var(--control-h); border-radius: var(--radius-sm); color: var(--on-accent); background: var(--coral); }
.profile-item { padding: 12px 16px; }
.edit-profile-form { gap: 12px; padding: 16px 16px calc(24px + var(--safe-bottom)); }
.edit-field input, .edit-field textarea, .theme-seg, .edit-gender, .server-setting-row input { border-radius: var(--radius-sm); background: var(--input-bg); }
.edit-field input:focus, .edit-field textarea:focus, .server-setting-row input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.edit-save { margin-top: 4px; }
.settings-head { min-height: 64px; border-bottom-color: var(--line); background: color-mix(in srgb, var(--bg) 94%, var(--bg-elev)); }
.settings-page .theme-setting { margin: 12px; overflow: hidden; }
.theme-btn { min-height: 36px; border-radius: var(--radius-sm); }
.theme-btn.active, .edit-gender-btn.active { color: var(--on-accent); background: var(--coral); }
.profile-list { padding: 0 12px 20px; }

.auth-wrap { background: radial-gradient(1200px 500px at 50% -10%, var(--coral-soft), transparent 70%), var(--bg); }
.auth-card { padding: 24px; border: 2px solid var(--card-border); border-radius: var(--radius-lg); background: var(--bg-elev); }
.auth-tabs { padding: 4px; border-radius: var(--radius-card); background: var(--bg-elev-2); }
.auth-tab { min-height: var(--control-h); border-radius: var(--radius-sm); }
.auth-tab.active { color: var(--on-accent); background: var(--coral); }
.auth-form input { min-height: var(--control-h); border-radius: var(--radius-sm); background: var(--input-bg); }
.auth-form input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.auth-submit { min-height: var(--control-h); border-radius: var(--radius-sm); background: var(--coral); color: var(--on-accent); }
.auth-offline { min-height: var(--control-h); border-radius: var(--radius-sm); }

.bottom-nav { min-height: var(--dock-h); }
.bottom-item { min-height: 46px; }
.bottom-more-menu { border: 2px solid var(--card-border); border-radius: var(--radius-card); background: var(--bg-elev); }
.toast { border: 1px solid var(--card-border); border-radius: 999px; background: var(--bg-elev-3); color: var(--text); box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .topbar { padding: 16px 16px 8px; }
  .list-scroll { padding: 4px 8px 80px; }
  .chat-head { min-height: 58px; padding: 8px 12px; }
  .message-scroll { padding: 12px 12px 8px; }
  .composer { padding: 8px 8px calc(8px + var(--safe-bottom)); }
  .msg-main { max-width: 74%; }
  .icon-btn { width: 40px; height: 40px; border-radius: 14px; }
  .chat-head-actions .icon-btn { width: 36px; height: 36px; }
  .comp-round { width: 40px; height: 40px; flex-basis: 40px; }
  .msg-menu, .conv-menu { width: 170px; }
  .modal-card { padding: 16px; }
}
@media (min-width: 761px) {
  .topbar { padding: 20px 24px 12px; }
  .list-scroll { padding: 8px 16px 24px; }
  .chat-head { padding: 12px 24px; }
  .message-scroll { padding: 20px 28px 12px; }
  .composer { padding: 12px 24px 12px; }
  .page { max-width: 980px; }
  .icon-btn:hover { transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  #auth-view button, #qq-app button, #modal-root button, .conv-row, .msg-menu-item, .msg-search-result { transition: none; }
  #auth-view button:active, #qq-app button:active, #modal-root button:active, .conv-row:active, .msg-search-result:active { transform: none; }
}

/* 0.11.55 mobile dock: keep the four primary destinations visible on 360-399px phones */
@media (max-width: 399px) {
  .bottom-nav {
    grid-template-columns: repeat(4, 1fr);
    min-height: var(--dock-h);
    padding: 4px 4px calc(4px + var(--safe-bottom));
  }
  .bottom-item { min-height: 48px; gap: 4px; }
  .bottom-item[data-route="contacts"], .bottom-item[data-route="moments"], .bottom-item[data-route="me"] { display: grid; }
  .bottom-item.bottom-more { display: none; }
  .bottom-item span { display: block; font-size: var(--fs-xs); }
  .bottom-item .nav-svg { width: 20px; height: 20px; }
}

/* 0.11.56 image upload preview/progress */
.bubble.image-bubble { position: relative; overflow: hidden; }
.upload-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px; color: #fff; background: rgba(8,12,16,.46); pointer-events: none; }
.upload-label { padding: 0px 8px; border-radius: 999px; background: rgba(0,0,0,.34); font-size: var(--fs-xs); line-height: 1.5; }
.upload-meter { width: min(140px, 72%); height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.28); }
.upload-meter i { display: block; height: 100%; border-radius: inherit; background: var(--coral); transition: width 120ms linear; }

/* 0.11.57 canvas naming/progress */
.canvas-name-btn { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: var(--bg-elev-2); font-size: var(--fs-xs); }
.canvas-name-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.canvas-list-rename { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; min-width: 44px; min-height: 32px; padding: 0 0px; border: 0; border-radius: 8px; color: var(--text-3); background: transparent; font-size: var(--fs-xs); line-height: 1; }
.canvas-list-rename:hover { color: var(--accent); background: var(--hover); }
.canvas-progress { display: flex; align-items: center; gap: 8px; margin: 4px 0 0px; color: var(--text-3); font-size: var(--fs-xs); }
.canvas-progress-meter { flex: 1; height: 5px; overflow: hidden; border-radius: 999px; background: var(--bg-elev-3); }
.canvas-progress-meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 180ms linear; }

/* 0.11.58 inline canvas name, compact header chip */
.canvas-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.canvas-name-chip { max-width: min(240px, 34vw); min-height: 27px; padding: 0px 8px; overflow: hidden; border: 1px solid transparent; border-radius: 8px; color: var(--text); background: transparent; font-size: var(--fs-sm); font-weight: 600; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.canvas-name-chip::after { content: '✎'; margin-left: 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
.canvas-name-chip:hover { border-color: var(--line); background: var(--hover); }
.canvas-name-input { width: min(190px, 34vw); height: 27px; padding: 0 8px; border: 1px solid var(--accent); border-radius: 8px; outline: none; color: var(--text); background: var(--input-bg); box-shadow: 0 0 0 3px var(--accent-soft, rgba(255,125,110,.14)); font-size: var(--fs-sm); }
@media (max-width: 760px) {
  .canvas-name-chip { max-width: 120px; font-size: var(--fs-xs); min-height: 25px; padding: 0px 4px; }
  .canvas-name-chip::after { margin-left: 4px; font-size: var(--fs-xs); }
  .canvas-name-input { width: min(145px, 36vw); height: 25px; padding: 0 4px; font-size: var(--fs-xs); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-name-chip { max-width: 190px; min-height: 24px; font-size: var(--fs-xs); }
  .canvas-name-input { width: 165px; height: 24px; font-size: var(--fs-xs); }
}

/* 0.11.59 in-app video download */
.video-download-progress { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; color: var(--text-3); font-size: var(--fs-xs); }
.video-download-progress > span { flex: 0 0 auto; }
.video-download-meter { flex: 1; height: 5px; overflow: hidden; border-radius: 999px; background: var(--bg-elev-3); }
.video-download-meter i { display: block; height: 100%; width: 2%; border-radius: inherit; background: var(--accent); transition: width 140ms linear; }
.video-download-note { margin: 0 12px 8px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: var(--bg-elev-2); font-size: var(--fs-xs); }
.video-download-gallery { display: block; width: calc(100% - 26px); min-height: 34px; margin: 0 12px 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 8px; color: var(--accent); background: transparent; font-size: var(--fs-xs); }

/* 0.11.60 video transcript */
.video-result-actions .video-action { min-width: 0; font-size: var(--fs-xs); }
.video-transcript-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 12px 8px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: var(--bg-elev-2); font-size: var(--fs-xs); }
.video-transcript-status button { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-3); background: transparent; font-size: var(--fs-xs); }
.video-transcript { margin: 0 12px 12px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev-2); }
.video-transcript-text { max-height: 300px; overflow: auto; color: var(--text-1); font-size: var(--fs-sm); line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.video-transcript-tools { display: flex; gap: 8px; margin-top: 8px; }
.video-transcript-tools button { flex: 1; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: transparent; font-size: var(--fs-xs); }

/* 0.11.62 unified visual system + interaction pass */
.page { animation: wt-page-in 150ms var(--ease); }
@keyframes wt-page-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
}

/* One page header rhythm. */
.topbar {
  padding: calc(12px + var(--safe-top)) var(--page-pad-x) 8px;
  background: var(--bg);
}
.chat-head,
.settings-head,
.canvas-head {
  min-height: calc(var(--head-h) + var(--safe-top));
  padding: var(--safe-top) var(--page-pad-x) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.chat-head { padding-bottom: 0; }
.settings-head { padding-bottom: 0; }
.canvas-head { padding-bottom: 0; }
.me-title strong,
.chat-peer strong,
.settings-head h2,
.canvas-title h2,
.contacts-top h2,
.moments-top h2,
.profile-id strong {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -.2px;
}
.me-title span,
.chat-peer span,
.settings-head .settings-subtitle,
.canvas-save-state {
  font-size: var(--fs-xs);
}
@media (min-width: 761px) {
  :root { --page-pad-x: 24px; }
}

/* Text scale: only six visual sizes, body copy reads at 14/16. */
body { font-size: var(--fs-md); line-height: var(--lh-body); }
.bubble { font-size: var(--fs-md); line-height: var(--lh-body); }
.msg-meta,
.conv-time,
.day-sep,
.chat-peer span,
.canvas-list-info span,
.canvas-list-info em,
.video-duration,
.video-platform,
.video-direct-link,
.canvas-save-state,
.settings-version,
.moment-meta span,
.profile-meta span,
.msg-search-hint { font-size: var(--fs-xs); }
.conv-preview,
.chat-sub,
.video-result-info strong,
.canvas-list-info strong,
.moment-body { font-size: var(--fs-sm); }
.video-result-info strong { font-size: var(--fs-md); }
.msg-meta,
.conv-time,
.day-sep,
.video-duration,
.settings-version { font-variant-numeric: tabular-nums; }
.canvas-name-chip { font-weight: 600; }

/* Three radii, three shadows, one-pixel borders. */
.icon-btn,
.modal-close,
.settings-head .icon-btn,
.chat-head .back,
.canvas-btn,
.canvas-icon-btn,
.canvas-list-rename,
.video-action,
.video-transcript-status button,
.video-download-gallery,
.theme-btn,
.small-btn,
.modal-input,
.edit-field input,
.edit-field textarea,
.server-setting-row input { border-radius: var(--radius-sm); }
#qq-app .video-result-card,
#qq-app .canvas-list-card,
#qq-app .attach-panel,
#qq-app .msg-menu,
#qq-app .conv-menu,
#qq-app .bottom-more-menu,
.profile-hero,
.profile-item,
.settings-page .theme-setting,
.modal-card,
.auth-card,
.drawer-panel { border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.modal-card,
.auth-card { box-shadow: var(--shadow-modal); }
.avatar,
.avatar img,
.avatar-wrap,
.msg-avatar,
.chat-head .avatar { border-radius: var(--radius-card); }
.bubble { border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm); }
.msg-row.mine .bubble { border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg); }
.msg-menu,
.conv-menu,
.attach-panel { border-radius: var(--radius-card); }

/* Touch targets: primary controls get a real 44px hit area. */
#qq-app .icon-btn,
#qq-app .chat-head .back,
#qq-app .chat-head-actions .icon-btn,
#qq-app .settings-head .icon-btn,
#modal-root .icon-btn,
#modal-root .modal-close { min-width: var(--tap); min-height: var(--tap); }
#qq-app .video-action,
#qq-app .video-transcript-status button,
#qq-app .video-download-gallery,
#qq-app .canvas-btn,
#qq-app .canvas-name-chip,
#qq-app .canvas-list-rename { min-height: var(--tap); }
#qq-app input:not([type="checkbox"]):not([type="radio"]),
#qq-app textarea,
#qq-app select,
#modal-root input:not([type="checkbox"]):not([type="radio"]),
#modal-root textarea { min-height: var(--tap); }
.canvas-list-rename { min-width: var(--tap); }

/* Safe bottom everywhere a scrolling page can end. */
.canvas-list-page { padding-bottom: 0; }
.canvas-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px var(--page-bottom);
}
.settings-scroll,
.list-scroll,
.contacts-body,
.moments-scroll,
.profile-list,
.video-tools-scroll { padding-bottom: var(--page-bottom); }
.drawer-bottom { padding-bottom: calc(8px + var(--safe-bottom)); }
.composer { padding-bottom: calc(8px + var(--safe-bottom)); }

/* Loading skeleton and one empty-state baseline. */
.skeleton {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-elev-2);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: wt-shimmer 1.25s infinite;
}
@keyframes wt-shimmer { to { transform: translateX(100%); } }
.skeleton-list { display: grid; gap: 12px; }
.skeleton-row { height: 64px; border-radius: var(--radius-card); }
.skeleton-line { height: 12px; border-radius: 999px; background: var(--bg-elev-3); }
.state-empty,
.empty,
.canvas-list-empty,
.moments-empty,
.emoji-empty,
.forward-empty,
.msg-search-hint {
  min-height: 180px;
  padding: var(--space-6) var(--space-4);
  color: var(--text-2);
  text-align: center;
  line-height: var(--lh-loose);
}
.empty strong,
.canvas-list-empty strong,
.moments-empty strong,
.forward-empty strong { color: var(--text); font-size: var(--fs-lg); font-weight: 600; }
.empty p,
.canvas-list-empty p,
.moments-empty p { margin: var(--space-2) 0 0; font-size: var(--fs-sm); }

@media (max-width: 760px) {
  .chat-head,
  .settings-head,
  .canvas-head { min-height: calc(var(--head-h) + var(--safe-top)); padding-left: 16px; padding-right: 16px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .chat-head-actions { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
  .drawer-panel, .drawer-backdrop, .toast, .msg-flash { transition: none !important; animation: none !important; }
  #auth-view button, #qq-app button, #modal-root button, .conv-row, .msg-menu-item, .msg-search-result { transition: none !important; transform: none !important; }
}

/* 0.11.62 final interaction/elevation pass */
.topbar { min-height: calc(var(--head-h) + var(--safe-top)); }
#qq-app button:not(.emoji-cell):not(.emoji-tab):not(.conv-row):not(.rail-item):not(.bottom-item),
#modal-root button,
#auth-view button,
#qq-app [role="button"]:not(.conv-row):not(.rail-item):not(.canvas-list-card) {
  min-height: var(--tap);
}
#qq-app .video-direct-link { min-height: var(--tap); display: inline-flex; align-items: center; }
.attach-panel,
.canvas-model-menu,
.canvas-context,
.canvas-quick-menu,
.canvas-inspector,
.canvas-help-popover,
.canvas-list-card,
.canvas-viewer-stage img,
.msg-menu,
.conv-menu,
.bottom-more-menu { box-shadow: var(--shadow-card); }
.bubble,
.icon-btn.solid,
.comp-round.send,
.canvas-help-fab,
.canvas-back-float,
.new-msg-badge { box-shadow: var(--shadow-soft); }
.canvas-inspector-close,
.canvas-viewer-btn,
.canvas-viewer-arrow { border-radius: var(--radius-sm); }

/* 0.11.62 horizontal overflow guard */
html, body { overflow-x: hidden; }
.auth-wrap { width: 100%; }
.auth-card { width: 100%; max-width: 380px; min-width: 0; }
.auth-form input { min-width: 0; }

/* 0.11.63 canvas upload + honest generation wait */
.canvas-upload-card {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); z-index: 48;
  width: min(360px, calc(100vw - 32px)); transform: translateX(-50%);
  display: grid; gap: 8px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  color: var(--text); background: var(--bg-elev-2); box-shadow: var(--shadow-card);
}
.canvas-upload-card[hidden] { display: none; }
.canvas-upload-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 600; }
.canvas-upload-meter { height: 6px; overflow: hidden; border-radius: 999px; background: var(--bg-elev-3); }
.canvas-upload-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--coral); transition: width 140ms linear; }
.canvas-upload-meter.indeterminate i { width: 35%; animation: canvas-task-slide 1.25s ease-in-out infinite; }
.canvas-upload-label { color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-body); }
.canvas-upload-actions { display: flex; justify-content: flex-end; gap: 8px; }
.canvas-upload-actions button { min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); background: transparent; font-size: var(--fs-sm); }
.canvas-upload-actions button:active { background: var(--hover); }
.canvas-progress-meter.indeterminate i { width: 35%; animation: canvas-task-slide 1.25s ease-in-out infinite; }
.canvas-progress-label { min-width: 72px; text-align: right; }
@keyframes canvas-task-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
  .canvas-upload-meter.indeterminate i, .canvas-progress-meter.indeterminate i { animation: none; width: 100%; opacity: .65; }
}

/* 0.11.64 LYCanvas-style canvas chrome */
.canvas-actions {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 46;
  display: flex; align-items: center; gap: 4px;
  height: 56px; max-width: calc(100vw - 24px);
  padding: 6px; overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
  box-shadow: var(--shadow-modal);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.canvas-actions::-webkit-scrollbar { display: none; }
.canvas-actions .canvas-btn,
.canvas-actions .canvas-icon-btn {
  height: 42px; min-height: 42px; flex: 0 0 auto;
  padding: 0 10px; border: 0; border-radius: 10px;
  color: var(--text-2); background: transparent;
  font-size: var(--fs-sm);
}
.canvas-actions .canvas-btn:hover,
.canvas-actions .canvas-icon-btn:hover { color: var(--text); background: var(--hover); }
.canvas-actions .canvas-btn.active { color: var(--coral); background: var(--coral-soft); }
.canvas-actions .canvas-btn.primary { color: var(--on-accent); background: var(--coral); font-weight: 600; }
.canvas-actions .canvas-btn.primary:hover { background: var(--coral); filter: brightness(1.06); }
.canvas-actions .canvas-icon-btn { width: 42px; padding: 0; font-size: var(--fs-lg); }
.canvas-actions .canvas-dock-sep { height: 22px; margin: 0 3px; background: var(--line); }
.canvas-head { justify-content: flex-start; }
.canvas-head .canvas-title { flex: 1; min-width: 0; }
.canvas-zoom-hud {
  position: absolute; left: 12px; bottom: calc(78px + var(--safe-bottom)); z-index: 7;
  display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev-2) 92%, transparent);
  box-shadow: var(--shadow-soft); backdrop-filter: blur(8px);
}
.canvas-zoom-btn, .canvas-zoom-value {
  display: grid; place-items: center; height: 28px; min-height: 28px; padding: 0;
  border: 0; border-radius: 999px; color: var(--text-2); background: transparent; font-size: var(--fs-sm);
}
.canvas-zoom-btn { width: 28px; font-size: var(--fs-lg); }
.canvas-zoom-range { width: 72px; height: 18px; margin: 0 2px; accent-color: var(--coral); background: transparent; }
.canvas-zoom-range:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.canvas-zoom-value { min-width: 52px; padding: 0 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.canvas-zoom-btn:hover, .canvas-zoom-value:hover { color: var(--coral); background: var(--coral-soft); }
.canvas-context {
  width: 204px; min-width: 204px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elev-2) 96%, transparent);
  box-shadow: var(--shadow-modal);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.canvas-context-item {
  min-height: 38px; padding: 0 10px; border-radius: 8px;
  font-size: var(--fs-sm); text-align: left;
}
.canvas-context-item:hover { background: var(--coral-soft); color: var(--text); }
.canvas-context-item.danger { color: var(--danger); }
.canvas-menu-colors { margin-top: 4px; padding: 7px 8px 3px; border-top: 1px solid var(--line); }
.canvas-menu-color { width: 24px; height: 24px; border-radius: 50%; }
@media (max-width: 760px) {
  .canvas-actions { bottom: calc(10px + var(--safe-bottom)); height: 54px; max-width: calc(100vw - 16px); }
  .canvas-actions .canvas-btn, .canvas-actions .canvas-icon-btn { height: 40px; min-height: 40px; border-radius: 9px; }
  .canvas-zoom-hud { bottom: calc(78px + var(--safe-bottom)); height: 32px; }
  .canvas-upload-card { bottom: calc(124px + var(--safe-bottom)); }
  .canvas-help-fab { bottom: calc(78px + var(--safe-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .canvas-actions, .canvas-zoom-hud, .canvas-context { transition: none !important; }
}
@media (max-width: 760px) { .canvas-help-fab { bottom: calc(176px + var(--safe-bottom)); } }

/* 0.11.68 left canvas workrail (mobile first) */
.canvas-body {
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr) 290px;
  grid-template-rows: minmax(0, 1fr);
  transition: grid-template-columns 150ms var(--ease);
}
.canvas-body.rail-open { grid-template-columns: 144px minmax(0, 1fr) 290px; }
.canvas-workrail {
  position: relative; z-index: 22; width: 0; min-width: 0;
  grid-column: 1; grid-row: 1; min-height: 0; overflow: visible;
  border-right: 1px solid transparent; background: var(--bg-elev);
}
.canvas-body.rail-open .canvas-workrail { width: 144px; border-right-color: var(--line); }
.canvas-workrail-panel {
  display: none; flex-direction: column; gap: 4px;
  height: 100%; min-height: 0; padding: 48px 8px calc(16px + var(--safe-bottom));
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.canvas-body.rail-open .canvas-workrail-panel { display: flex; }
.canvas-rail-tab {
  position: absolute; left: 0; top: 50%; z-index: 3;
  display: grid; place-items: center; width: 44px; height: 48px; min-height: 48px; padding: 0;
  transform: translateY(-50%);
  border: 1px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0;
  color: var(--text-2); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
  box-shadow: var(--shadow-soft); font-size: var(--fs-lg);
}
.canvas-body.rail-open .canvas-rail-tab {
  left: 6px; top: 6px; width: 36px; height: 36px; min-height: 36px;
  transform: none; border-left: 1px solid var(--line); border-radius: 9px;
}
.canvas-rail-tab:hover { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); }
.canvas-workrail .canvas-btn,
.canvas-workrail .canvas-icon-btn {
  display: flex; align-items: center; justify-content: flex-start; gap: 9px;
  width: 100%; height: 44px; min-height: 44px; padding: 0 9px;
  border: 0; border-radius: 8px; color: var(--text-2); background: transparent;
  font-size: var(--fs-xs); text-align: left; white-space: nowrap;
}
.canvas-workrail .canvas-btn:hover,
.canvas-workrail .canvas-icon-btn:hover { color: var(--text); background: var(--hover); }
.canvas-workrail .canvas-btn.active { color: var(--coral); background: var(--coral-soft); }
.canvas-workrail .canvas-btn.primary { color: var(--coral); background: var(--coral-soft); border: 1px solid color-mix(in srgb, var(--coral) 34%, var(--line)); font-weight: 600; }
.canvas-workrail .canvas-rail-icon { flex: 0 0 20px; width: 20px; text-align: center; font-size: var(--fs-lg); line-height: 1; }
.canvas-workrail .canvas-button-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.canvas-workrail .canvas-dock-sep { flex: 0 0 1px; height: 1px; margin: 3px 6px; background: var(--line); }
.canvas-statusbar {
  flex: 0 0 auto; display: flex; align-items: center; min-height: 32px; padding: 0 14px;
  border-top: 1px solid var(--line); color: var(--text-3); background: var(--bg-elev);
  font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.canvas-statusbar[hidden] { display: none !important; }
@media (min-width: 761px) {
  .canvas-body { grid-template-columns: 0 minmax(0, 1fr) 290px; }
  .canvas-body.rail-open { grid-template-columns: 144px minmax(0, 1fr) 290px; }
}
@media (max-width: 760px) {
  .canvas-body {
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    flex-direction: initial;
  }
  .canvas-body.rail-open { grid-template-columns: 124px minmax(0, 1fr); }
  .canvas-workrail { grid-column: 1; grid-row: 1; }
  .canvas-body.rail-open .canvas-workrail { width: 124px; }
  .canvas-wrap { grid-column: 2; grid-row: 1; }
  .canvas-inspector { grid-column: 1 / -1; grid-row: 2; width: auto; flex: 0 0 auto; max-height: 43%; }
  .canvas-workrail-panel { padding-left: 6px; padding-right: 6px; }
  .canvas-workrail .canvas-btn,
  .canvas-workrail .canvas-icon-btn { padding: 0 7px; gap: 7px; }
  .canvas-statusbar { min-height: 32px; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .canvas-body { transition: none; }
}

/* 0.11.69 compact header / rail spacing */
.canvas-head {
  min-height: 56px; padding: 8px 12px; gap: 8px;
  align-items: center; justify-content: flex-start;
}
.canvas-head .canvas-back {
  flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  margin: 0; position: relative; z-index: 1;
}
.canvas-title {
  display: flex; align-items: center; gap: 4px;
  flex: 0 1 50vw; width: auto; max-width: 50vw; min-width: 0;
}
.canvas-name-chip {
  display: block; max-width: 50vw; min-height: 32px; padding: 0 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; line-height: 30px; border-radius: 8px;
}
.canvas-save-state { display: none !important; }
.canvas-workrail-panel {
  justify-content: flex-start; align-items: stretch; gap: 6px;
  padding-top: 56px; scroll-padding-top: 56px;
  overflow-x: hidden; overflow-y: auto;
}
.canvas-workrail .canvas-btn,
.canvas-workrail .canvas-icon-btn {
  flex: 0 0 44px; height: 44px; min-height: 44px; margin: 0;
}
.canvas-workrail .canvas-dock-sep { display: none; }
@media (max-width: 760px) {
  .canvas-workrail-panel { padding-top: 56px; }
  .canvas-name-chip { font-size: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .canvas-head { min-height: 48px; padding: 4px 8px; }
  .canvas-head .canvas-back { width: 44px; height: 44px; }
  .canvas-title { max-width: 50vw; }
  .canvas-name-chip { min-height: 28px; line-height: 26px; font-size: 14px; }
  .canvas-workrail-panel { padding-top: 50px; }
}

/* 0.11.70 title clearance from back arrow */
.canvas-head .canvas-title {
  margin-left: 10px;
  min-width: 0; max-width: 50vw;
  flex: 0 1 50vw;
}
.canvas-head .canvas-name-chip {
  max-width: 50vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 0.11.70 exact title gap: arrow right + 10px */
.canvas-head { column-gap: 0; }

/* 0.11.71 real header row + flex canvas body; no absolute chrome */
.canvas-page { display: flex; flex-direction: column; }
.canvas-head {
  position: relative !important; left: auto !important; top: auto !important;
  width: 100% !important; max-width: none !important;
  height: calc(52px + var(--safe-top)) !important;
  min-height: calc(52px + var(--safe-top)) !important;
  box-sizing: border-box;
  padding: var(--safe-top) 8px 0 !important;
  border: 0 !important; border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: var(--bg) !important; box-shadow: none !important;
  z-index: 20;
}
.canvas-head .canvas-back {
  flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px;
}
.canvas-head .canvas-title {
  flex: 1 1 auto; max-width: 50vw; min-width: 0; margin-left: 10px;
}
.canvas-body {
  display: flex !important; flex-direction: row; flex: 1 1 auto;
  min-height: 0; position: relative; overflow: hidden;
}
.canvas-workrail {
  flex: 0 0 0; width: 0; min-width: 0; position: relative;
  grid-column: auto !important; grid-row: auto !important;
}
.canvas-body.rail-open .canvas-workrail { flex: 0 0 124px; width: 124px; }
.canvas-wrap { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; }
.canvas-workrail-panel {
  width: 100%; min-height: 0; height: 100%;
  padding: 8px 46px 16px 8px !important;
  gap: 6px; justify-content: flex-start; align-items: stretch;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.canvas-body.rail-open .canvas-workrail-panel { display: flex; }
.canvas-rail-tab {
  left: 0 !important; right: auto !important; top: 50% !important;
  width: 44px; height: 48px; min-height: 48px;
  transform: translateY(-50%) !important;
}
.canvas-body.rail-open .canvas-rail-tab {
  left: auto !important; right: 4px !important; top: 8px !important;
  width: 36px; height: 36px; min-height: 36px; transform: none !important;
}
.canvas-workrail .canvas-btn,
.canvas-workrail .canvas-icon-btn {
  flex: 0 0 44px; height: 44px; min-height: 44px; width: 100%; margin: 0;
  box-sizing: border-box; padding: 0 7px;
}
.canvas-workrail .canvas-dock-sep { display: none; }
.canvas-inspector { flex: 0 0 290px; }
@media (max-width: 760px) {
  .canvas-body { flex-direction: row; }
  .canvas-workrail { flex-basis: 0; }
  .canvas-body.rail-open .canvas-workrail { flex-basis: 124px; width: 124px; }
  .canvas-workrail-panel { padding-right: 46px !important; }
  .canvas-inspector {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 34;
    width: auto; max-height: 43%; overflow-y: auto;
    border-left: 0; border-top: 1px solid var(--line);
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-head {
    position: relative !important; left: auto !important; top: auto !important;
    width: 100% !important; max-width: none !important;
    height: 52px !important; min-height: 52px !important;
    padding: 0 8px !important;
    border: 0 !important; border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important; background: var(--bg) !important; box-shadow: none !important;
  }
  .canvas-body { display: flex !important; flex-direction: row; position: relative; }
  .canvas-wrap { position: relative !important; inset: auto !important; flex: 1 1 auto; min-width: 0; min-height: 0; }
  .canvas-workrail-panel { padding: 8px 46px 16px 8px !important; }
  .canvas-inspector { position: absolute; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 43%; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .canvas-head .canvas-back { display: grid !important; }
  .canvas-back-float { display: none !important; }
}

/* 0.11.72 slimmer header; 36px visual / 44px hit back button */
.canvas-head {
  height: 44px !important; min-height: 44px !important;
  padding: 0 8px !important;
  align-items: center !important;
}
.canvas-head .canvas-back {
  flex: 0 0 36px; width: 36px; height: 36px;
  min-width: 36px; min-height: 36px;
  padding: 0; position: relative;
}
.canvas-head .canvas-back::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; transform: translate(-50%, -50%);
  border-radius: 50%; background: transparent;
}
.canvas-head .canvas-back svg { width: 18px; height: 18px; }
.canvas-head .canvas-title {
  flex: 1 1 auto; min-width: 0;
  max-width: 45vw; margin-left: 8px;
}
.canvas-head .canvas-name-chip {
  max-width: 45vw; font-size: 13px; line-height: 30px; min-height: 30px;
}
.canvas-workrail-panel {
  padding: 6px 46px 6px 6px !important;
}
@media (orientation: landscape) and (max-height: 520px) {
  .canvas-head { height: 44px !important; min-height: 44px !important; padding: 0 8px !important; }
  .canvas-head .canvas-back { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  .canvas-head .canvas-back svg { width: 18px; height: 18px; }
  .canvas-head .canvas-title { max-width: 45vw; margin-left: 8px; }
  .canvas-head .canvas-name-chip { max-width: 45vw; font-size: 13px; }
  .canvas-workrail-panel { padding: 6px 46px 6px 6px !important; }
}

/* 0.11.72 actual 44 hit box, 36px visual circle */
.canvas-head .canvas-back {
  width: 44px !important; height: 44px !important;
  min-width: 44px !important; min-height: 44px !important;
  flex: 0 0 44px !important;
  padding: 0 !important; border: 0 !important; background: transparent !important;
  box-shadow: none !important; border-radius: 0 !important;
  display: grid; place-items: center; position: relative;
}
.canvas-head .canvas-back::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 36px; height: 36px; transform: translate(-50%, -50%);
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg-elev-2); box-shadow: none;
  z-index: 0;
}
.canvas-head .canvas-back svg { width: 18px !important; height: 18px !important; position: relative; z-index: 1; }

/* 0.11.73 right inspect rail: absolute overlay, no canvas squeeze */
.canvas-inspectrail {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 36;
  width: min(280px, 72vw); max-width: calc(100% - 44px);
  display: block; overflow: hidden;
  border-left: 1px solid var(--line);
  border-radius: 16px 0 0 16px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-modal);
  transform: translateX(calc(100% - 44px));
  transition: transform 150ms var(--ease);
}
.canvas-inspectrail.is-open { transform: translateX(0); }
.canvas-inspectrail-tab {
  position: absolute; left: 0; top: 50%; z-index: 3;
  display: grid; place-items: center;
  width: 44px; height: 48px; min-width: 44px; min-height: 48px; padding: 0;
  transform: translateY(-50%);
  border: 1px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0;
  color: var(--text-2); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
  box-shadow: var(--shadow-soft); font-size: var(--fs-lg);
}
.canvas-inspectrail.is-open .canvas-inspectrail-tab {
  top: 8px; transform: none; border-left: 1px solid var(--line); border-radius: 9px;
}
.canvas-inspectrail-tab:hover { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); }
.canvas-inspectrail .canvas-inspector {
  position: relative !important; inset: auto !important;
  width: 100% !important; height: 100% !important;
  min-width: 0 !important; max-height: none !important;
  margin: 0 !important; flex: none !important;
  padding: 56px 14px calc(20px + var(--safe-bottom)) !important;
  overflow-x: hidden !important; overflow-y: auto !important;
  border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
.canvas-inspectrail .canvas-inspector-close { top: 10px; right: 10px; }
@media (max-width: 760px) {
  .canvas-inspectrail { width: min(280px, 72vw); }
}
@media (prefers-reduced-motion: reduce) {
  .canvas-inspectrail { transition: none; }
}

.canvas-body.rail-open .canvas-inspectrail {
  width: min(280px, 72vw, calc(100% - 124px));
  max-width: calc(100% - 124px);
  box-sizing: border-box;
}
.canvas-inspectrail { box-sizing: border-box; }

/* 0.11.74 inspect rail viewport clamp; wide and landscape safe */
.canvas-inspectrail {
  right: 0 !important;
  left: auto !important;
  width: min(280px, 62vw, calc(100% - 52px)) !important;
  max-width: calc(100% - 52px) !important;
  box-sizing: border-box;
}
.canvas-body.rail-open .canvas-inspectrail {
  right: 0 !important;
  left: auto !important;
  width: min(280px, 62vw, calc(100% - 52px)) !important;
  max-width: calc(100% - 52px) !important;
}
.canvas-inspectrail .canvas-inspector {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  min-width: 0 !important;
  overflow-wrap: anywhere;
}
.canvas-inspectrail .canvas-inspector *,
.canvas-inspectrail .canvas-field,
.canvas-inspectrail .canvas-field > span,
.canvas-inspectrail .canvas-inspector-tag,
.canvas-inspectrail .canvas-hint,
.canvas-inspectrail .canvas-select,
.canvas-inspectrail .canvas-textarea {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.canvas-inspectrail .canvas-inspector .canvas-color-row { flex-wrap: wrap; }
@media (orientation: landscape) {
  .canvas-statusbar { display: none !important; }
}

.canvas-inspectrail.is-open { transform: translateX(0) !important; }

/* 0.11.75 collapsed inspect rail really narrows */
.canvas-inspectrail {
  transform: none !important;
  transition: width 150ms var(--ease), box-shadow 150ms var(--ease) !important;
}
.canvas-inspectrail.is-open,
.canvas-body.rail-open .canvas-inspectrail.is-open {
  width: min(280px, 62vw, calc(100% - 52px)) !important;
  max-width: calc(100% - 52px) !important;
  transform: none !important;
}
.canvas-inspectrail:not(.is-open),
.canvas-body.rail-open .canvas-inspectrail:not(.is-open) {
  width: 44px !important;
  max-width: 44px !important;
  min-width: 44px !important;
  transform: none !important;
  border-left: 0 !important;
  border-radius: 12px 0 0 12px !important;
  box-shadow: var(--shadow-soft) !important;
}
.canvas-inspectrail .canvas-inspector { transition: opacity 150ms var(--ease), visibility 0s linear; }
.canvas-inspectrail:not(.is-open) .canvas-inspector {
  opacity: 0 !important; visibility: hidden !important; pointer-events: none !important;
}
.canvas-inspectrail:not(.is-open) .canvas-inspectrail-tab {
  top: 50% !important; transform: translateY(-50%) !important;
}
.canvas-inspectrail.is-open .canvas-inspectrail-tab {
  top: 8px !important; transform: none !important;
}
@media (max-width: 900px) {
  .canvas-body { width: 100vw; max-width: 100vw; }
}

.canvas-inspectrail:not(.is-open),
.canvas-body.rail-open .canvas-inspectrail:not(.is-open) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}
.canvas-inspectrail:not(.is-open) .canvas-inspectrail-tab {
  background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-soft) !important;
}

/* 0.11.76 canvas audit fixes */
.canvas-list-more {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text-2);
  background: color-mix(in srgb, var(--bg-elev-2) 92%, transparent); font-size: 22px; line-height: 1;
}
.canvas-list-more:hover { color: var(--coral); border-color: var(--coral); }
.canvas-list-menu { width: 168px; }
.canvas-multibar {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 42;
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 5px 7px 5px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent); box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px); color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap;
}
.canvas-multibar[hidden] { display: none !important; }
.canvas-multibar button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: var(--bg-elev); font-size: var(--fs-xs); }
.canvas-multibar-group { color: var(--on-accent) !important; background: var(--coral) !important; border-color: transparent !important; }
.canvas-multibar-exit { border-color: transparent !important; color: var(--text-3) !important; background: transparent !important; }
.canvas-export-card { max-height: min(86dvh, 720px); display: flex; flex-direction: column; overflow: hidden; }
.canvas-export-card .canvas-export-actions {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 2px 2px calc(12px + var(--safe-bottom));
  box-shadow: inset 0 10px 8px -10px rgba(0,0,0,.35);
  scrollbar-width: thin;
}
@media (max-width: 760px) {
  .canvas-multibar { top: 6px; max-width: calc(100% - 28px); }
}

@media (max-width: 900px) and (orientation: landscape) {
  .canvas-head { height: 42px !important; min-height: 42px !important; padding: 0 8px !important; }
  .canvas-head .canvas-title { max-width: 40vw !important; margin-left: 8px; }
  .canvas-head .canvas-name-chip { max-width: 40vw !important; font-size: 12px !important; line-height: 28px !important; min-height: 28px !important; }
  .canvas-help-header { width: 44px; height: 44px; min-height: 44px; }
  .canvas-body.rail-open .canvas-workrail { width: 112px !important; flex-basis: 112px !important; }
  .canvas-workrail-panel { padding: 6px 42px 80px 6px !important; }
  .canvas-zoom-hud { height: 30px !important; }
  .canvas-zoom-btn { width: 26px; height: 26px; min-height: 26px; }
  .canvas-zoom-value { height: 26px; min-height: 26px; font-size: var(--fs-xs); }
  .canvas-inspectrail,
  .canvas-body.rail-open .canvas-inspectrail {
    width: min(260px, 34vw, calc(100% - 52px)) !important;
    max-width: calc(100% - 52px) !important;
  }
  .canvas-inspectrail-tab {
    width: 44px !important; height: 44px !important; min-height: 44px !important;
    padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
    font-size: 0 !important;
  }
  .canvas-inspectrail-tab::before {
    content: '›'; display: grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--line); border-radius: 9px;
    color: var(--text-2); background: color-mix(in srgb, var(--bg-elev-2) 94%, transparent);
    box-shadow: var(--shadow-soft); font-size: 18px;
  }
  .canvas-inspectrail.is-open .canvas-inspectrail-tab::before { content: '‹'; }
}

@media (max-width: 900px) { .canvas-help-header { margin-left: auto; } }

@media (min-width: 901px) {
  .canvas-minimap { position: absolute; right: 12px; bottom: 12px; width: 180px; height: 120px; z-index: 6; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-card); cursor: crosshair; touch-action: none; }
}

/* 0.11.80 mobile canvas P0 */
.canvas-empty-state { display: none; }
@media (max-width: 900px) {
  .canvas-empty-state {
    position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center;
    gap: 6px; padding: 24px 20px calc(96px + var(--safe-bottom)); box-sizing: border-box;
    text-align: center; pointer-events: none; color: #2B2621;
  }
  .canvas-empty-state[hidden] { display: none !important; }
  .canvas-empty-icon {
    display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px;
    border: 1px solid rgba(61,52,43,.12); border-radius: 14px; color: #E8755F;
    background: #FFFDF8; box-shadow: 0 1px 2px rgba(48,38,28,.06), 0 10px 24px -12px rgba(48,38,28,.20);
    font-size: 22px;
  }
  .canvas-empty-state strong { font-size: 15px; line-height: 20px; font-weight: 650; }
  .canvas-empty-state p { margin: 0 0 8px; color: #7D7367; font-size: 12px; line-height: 18px; }
  .canvas-empty-actions { display: flex; gap: 8px; pointer-events: auto; }
  .canvas-empty-actions button {
    min-height: 44px; padding: 0 14px; border: 1px solid rgba(61,52,43,.12); border-radius: 12px;
    background: #FFFDF8; color: #2B2621; font: 600 12px/1 system-ui, sans-serif; cursor: pointer;
    box-shadow: 0 1px 2px rgba(48,38,28,.05);
  }
  .canvas-empty-actions button:active { background: #FFF0EA; border-color: rgba(232,117,95,.4); }
  html[data-theme="dark"] .canvas-empty-state { color: #ECE7DF; }
  html[data-theme="dark"] .canvas-empty-icon { background: #1B1D21; border-color: rgba(255,255,255,.10); box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 14px 30px -14px rgba(0,0,0,.7); }
  html[data-theme="dark"] .canvas-empty-state p { color: #9C9489; }
  html[data-theme="dark"] .canvas-empty-actions button { background: #1B1D21; border-color: rgba(255,255,255,.10); color: #ECE7DF; box-shadow: 0 1px 2px rgba(0,0,0,.5); }
  html[data-theme="dark"] .canvas-empty-actions button:active { background: rgba(232,117,95,.16); border-color: rgba(255,154,132,.4); }
}

/* 0.11.81 mobile canvas fixes */
.canvas-edge-delete { display: none; }
@media (max-width: 900px) {
  .canvas-edge-delete {
    position: absolute; z-index: 45; display: grid; place-items: center;
    min-width: 44px; min-height: 44px; padding: 0 12px; transform: translate(-50%, -50%);
    border: 1px solid rgba(232,117,95,.35); border-radius: 999px;
    color: #FFFDF8; background: #E8755F; font: 600 12px/1 system-ui, sans-serif;
    box-shadow: 0 8px 24px rgba(48,38,28,.20);
  }
  .canvas-edge-delete[hidden] { display: none !important; }
  .canvas-context { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .canvas-context-item { min-height: 44px; display: flex; align-items: center; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .canvas-inspectrail.is-open,
  .canvas-body.rail-open .canvas-inspectrail.is-open { width: 260px !important; max-width: 260px !important; }
}

/* 0.11.83 mobile inspector bottom safe-area/scroll */
@media (max-width: 900px) {
  .canvas-inspectrail {
    bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .canvas-inspectrail .canvas-inspector {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  .canvas-inspectrail .canvas-color-row { padding-bottom: 8px; }
}

/* 0.11.83 inspector color dots: true circles + selected ring */
.canvas-inspectrail .canvas-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.canvas-inspectrail .canvas-color-dot {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  flex: 0 0 20px !important;
  aspect-ratio: 1 / 1;
  padding: 0 !important;
  border: 2px solid transparent !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  box-sizing: border-box;
}
.canvas-inspectrail .canvas-color-dot.is-selected {
  border-color: var(--text) !important;
  outline: 2px solid var(--coral, #e8755f);
  outline-offset: 1px;
}
