:root {
  --accent: #f2f4f7; --ink: #0a0b0d;
  --display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  --body: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .9, .25, 1); --spring: cubic-bezier(.2, 1.35, .4, 1);
  --sq: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5H64M.5 0V64' stroke='black' fill='none'/%3E%3C/svg%3E");
  --sub: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48'%3E%3Cpath d='M0 .5H96M0 24.5H96M.5 0V24M48.5 24V48' stroke='black' fill='none'/%3E%3C/svg%3E");
  --br: 18px; --tail: 5px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[data-bg="sq"] { --pat: var(--sq); }
[data-bg="sub"] { --pat: var(--sub); }
[data-bubbles="classic"] { --br: 13px; --tail: 3px; }
[data-bubbles="sharp"] { --br: 6px; --tail: 2px; }

[data-theme="dark"] {
  --bg: #08090b; --glow: rgba(255,255,255,.06); --tileline: rgba(255,255,255,.05);
  --panel: rgba(19,21,25,.72); --edge: rgba(255,255,255,.075); --menu: rgba(27,29,34,.95);
  --raise: rgba(255,255,255,.05); --raise2: rgba(255,255,255,.09);
  --text: #f2f3f5; --muted: rgba(242,243,245,.52); --faint: rgba(242,243,245,.3); --line: rgba(255,255,255,.07);
  --theirs: #1c1f24; --mine: #333841; --mine2: #272b32; --shadow: 0 24px 60px rgba(0,0,0,.5); color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eceef1; --glow: rgba(255,255,255,.95); --tileline: rgba(0,0,0,.05);
  --panel: rgba(255,255,255,.74); --edge: rgba(0,0,0,.08); --menu: rgba(255,255,255,.97);
  --raise: rgba(0,0,0,.045); --raise2: rgba(0,0,0,.08);
  --text: #101215; --muted: rgba(16,18,21,.55); --faint: rgba(16,18,21,.32); --line: rgba(0,0,0,.08);
  --theirs: #ffffff; --mine: #2c3038; --mine2: #181b20; --shadow: 0 24px 50px rgba(30,40,60,.14); color-scheme: light;
}
[data-size="s"] body { font-size: 14px; }
[data-size="l"] body { font-size: 17px; }

*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; }
body { margin: 0; height: 100%; overflow: hidden; color: var(--text); background: var(--bg); font: 15px/1.4 var(--body); -webkit-font-smoothing: antialiased; transition: background .4s, color .4s; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: rgba(150,170,200,.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Фон: мягкое свечение, по желанию тонкая сетка */
.wall { position: fixed; inset: 0; z-index: -1; background: var(--bg); overflow: hidden; transition: background .4s; }
.wall::before, .chat::before { content: ""; position: absolute; inset: 0; background: var(--tileline); -webkit-mask-image: var(--pat); mask-image: var(--pat); pointer-events: none; }
.wall::after { content: ""; position: absolute; inset: -15%; background: radial-gradient(40% 35% at 18% 12%, var(--glow), transparent 70%), radial-gradient(38% 34% at 86% 92%, var(--glow), transparent 70%); animation: drift 26s ease-in-out infinite alternate; }
[data-bg="plain"] .wall::before, [data-bg="plain"] .chat::before { display: none; }
@keyframes drift { to { transform: translate3d(4%, 3%, 0) scale(1.08); } }

.glass { background: var(--panel); border: 1px solid var(--edge); -webkit-backdrop-filter: blur(32px) saturate(170%); backdrop-filter: blur(32px) saturate(170%); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05); transition: background .4s, border-color .4s; }

/* Лого и аватары */
.appicon { position: relative; display: grid; place-items: center; flex: none; width: 108px; height: 108px; border-radius: 28%; background: linear-gradient(180deg, #2d3138, #14161a); border: 1px solid rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 20px 44px rgba(0,0,0,.5); }
.appicon.sm { width: 42px; height: 42px; box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 6px 14px rgba(0,0,0,.35); }
.appicon::before, .appicon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1.5px solid rgba(255,255,255,.35); animation: ripple 3.2s ease-out infinite; pointer-events: none; }
.appicon::after { animation-delay: 1.6s; }
.appicon.sm::before, .appicon.sm::after { display: none; }
@keyframes ripple { from { transform: scale(1); opacity: .6; } to { transform: scale(1.9); opacity: 0; } }
.drop { width: 54%; height: 54%; fill: #f4f5f7; }
.av { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; color: #fff; font: 600 16px var(--display); background: linear-gradient(160deg, hsl(var(--h) 32% 50%), hsl(calc(var(--h) + 25) 30% 34%)); box-shadow: inset 0 1px 0 rgba(255,255,255,.22); }
.av.lg { width: 48px; height: 48px; font-size: 19px; }
.av.xl { width: 66px; height: 66px; font-size: 27px; }
.av.xs { width: 18px; height: 18px; font-size: 9px; box-shadow: none; }

/* Вход */
.tag { margin: 0; font-size: 19px; color: var(--muted); }
.card { width: min(100%, 360px); padding: 24px; border-radius: 26px; }
label { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--muted); }
label:first-child { margin-top: 0; }
input:not([type]), .modal input:not([type]), #eq { width: 100%; padding: 12px 14px; color: var(--text); font: inherit; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, background .2s; }
input:not([type]):focus, #eq:focus { outline: none; border-color: var(--accent); background: var(--raise2); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.primary { width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 13px; background: var(--accent); color: var(--ink); font-weight: 600; transition: transform .2s var(--spring), filter .2s; }
.primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary:active { transform: scale(.97); }
.pill { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--raise2); white-space: nowrap; transition: background .2s, transform .15s; }
.pill:hover { background: var(--line); }
.pill:active { transform: scale(.95); }

/* Каркас */
#app { display: grid; grid-template-columns: 68px 340px minmax(0, 1fr); gap: 12px; height: 100%; padding: 12px; }
#app > * { animation: rise .8s var(--ease) both; }
#app > :nth-child(2) { animation-delay: .08s; } #app > :nth-child(3) { animation-delay: .16s; }
.rail, .list, .chat { border-radius: 26px; min-height: 0; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; }
.rail .appicon { margin-bottom: 16px; }
.rbtn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 14px; background: none; color: var(--muted); transition: background .2s, color .2s, transform .2s var(--spring); }
.rbtn:hover { background: var(--raise); color: var(--text); }
.rbtn:active { transform: scale(.9); }
.rbtn.on { background: var(--raise2); color: var(--text); }
.rbtn.plus { width: 38px; height: 38px; border-radius: 50%; background: var(--raise2); color: var(--text); }
.rbtn.plus:hover { background: var(--accent); color: var(--ink); transform: rotate(90deg); }
.rbtn.sm { width: 32px; height: 32px; border-radius: 50%; }
.rbtn.bottom { margin-top: auto; }
.meav { padding: 0; border: 0; background: none; margin-top: 8px; transition: transform .2s var(--spring); }
.meav:hover { transform: scale(1.1); }
.mob, .back { display: none; }

/* Список чатов */
.list { display: flex; flex-direction: column; overflow: hidden; }
.list header { display: flex; align-items: center; gap: 6px; padding: 20px 18px 8px 22px; }
.list h2 { flex: 1; margin: 0; font: 700 28px var(--display); letter-spacing: -.03em; }
.search { display: flex; align-items: center; gap: 8px; margin: 6px 16px 10px; padding: 0 12px; border-radius: 12px; background: var(--raise); color: var(--muted); transition: background .2s; }
.search:focus-within { background: var(--raise2); }
.search .ic { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; padding: 10px 0 !important; border: 0 !important; background: none !important; color: var(--text); font: inherit; outline: none; }
#rooms { flex: 1; overflow-y: auto; padding: 0 8px 12px; scrollbar-width: thin; }
.none { padding: 28px 20px; text-align: center; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; margin-bottom: 2px; border: 0; border-radius: 16px; background: none; text-align: left; transition: background .2s; }
.row:hover { background: var(--raise); }
.row.on { background: var(--raise2); }
.rb { flex: 1; min-width: 0; }
.rt, .rp { display: flex; align-items: center; gap: 8px; }
.rt b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rt time { font-size: 12px; color: var(--faint); }
.pv { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.pv .emo { width: 1.1em; height: 1.1em; }
.badge { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--accent); color: var(--ink); font: 700 12px/18px var(--body); text-align: center; animation: bump .5s var(--spring); }

/* Окно чата */
.chat { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--edge); -webkit-backdrop-filter: blur(32px) saturate(170%); backdrop-filter: blur(32px) saturate(170%); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05); }
#blank { position: relative; margin: auto; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; color: var(--muted); }
#convo { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; animation: fade .4s both; }
.chead { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; background: var(--panel); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.ct { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ct b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 17px var(--display); letter-spacing: -.01em; }
#sub { font-size: 13px; color: var(--muted); }
#sub::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #ffd60a; vertical-align: 1px; }
#sub[data-state="online"]::before { background: #30d158; animation: pulse 2.2s infinite; }
#sub[data-state="offline"]::before { background: #ff453a; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(48,209,88,.55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(48,209,88,0); } }
#msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 24px; scrollbar-width: thin; }
.hint0 { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hint0 .appicon { animation: dropin .9s var(--spring) both; }
.day { align-self: center; margin: 14px 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--raise2); font-size: 12px; color: var(--muted); }

/* Сообщения */
.msg { position: relative; align-self: flex-start; max-width: min(74%, 520px); margin-top: 10px; padding: 7px 12px 6px; overflow-wrap: anywhere; border-radius: var(--br) var(--br) var(--br) var(--tail); background: var(--theirs); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.25); animation: popL .5s var(--spring) both; }
.msg.mine { align-self: flex-end; border-radius: var(--br) var(--br) var(--tail) var(--br); background: linear-gradient(180deg, var(--mine), var(--mine2)); border-color: rgba(255,255,255,.09); color: #f2f3f5; animation-name: popR; }
.msg.cont { margin-top: 2px; }
.msg.pending { opacity: .6; }
.msg.failed { outline: 1px solid #ff453a; }
.msg.bare, .msg.jumbo { padding: 0; background: none; border: 0; box-shadow: none; color: var(--text); }
.msg.gone-msg { padding: 6px 12px; font-size: 13px; font-style: italic; color: var(--muted); background: var(--raise); border: 0; box-shadow: none; }
.who { display: block; font-size: 13px; font-weight: 600; color: var(--accent); }
.txt { white-space: pre-wrap; }
.txt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.txt code, .txt pre { font: .9em ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: rgba(127,127,127,.2); border-radius: 6px; }
.txt code { padding: 1px 5px; }
.txt pre { margin: 4px 0; padding: 8px 10px; border-radius: 10px; }
.spoiler { cursor: pointer; filter: blur(5px); transition: filter .25s; }
.spoiler.open { filter: none; }
.emo { width: 1.3em; height: 1.3em; margin: 0 .03em; vertical-align: -.3em; }
.jumbo .txt { font-size: 52px; line-height: 1.15; }
.jumbo .emo { width: 58px; height: 58px; margin: 0 2px; animation: bump .6s var(--spring) both; }
.quote { margin-bottom: 4px; padding: 3px 9px; border-left: 2px solid var(--accent); border-radius: 3px 6px 6px 3px; background: rgba(127,127,127,.15); font-size: 13px; cursor: pointer; }
.quote b { display: block; font-weight: 600; }
.quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }

/* Низ сообщения: реакции слева, время справа (как в Telegram) */
.foot { display: flex; align-items: flex-end; gap: 12px; margin-top: 1px; }
.reacts { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 1px; }
.react { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px 0 5px; border: 0; border-radius: 13px; background: var(--raise2); font-size: 13px; font-weight: 500; line-height: 1; transition: transform .15s var(--spring), background .2s; animation: bump .4s var(--spring); }
.mine .react { background: rgba(255,255,255,.13); }
.react:hover { transform: scale(1.06); }
.react .emo { width: 17px; height: 17px; margin: 0; vertical-align: 0; }
.react .av { width: 18px; height: 18px; font-size: 9px; }
.react.mine { background: var(--accent); color: var(--ink); }
.react.has-av { padding: 0 6px 0 5px; }
.meta { display: flex; align-items: center; gap: 4px; margin-left: auto; white-space: nowrap; font-size: 11px; line-height: 16px; color: var(--muted); }
.mine .meta { color: rgba(255,255,255,.55); }
.tick { color: var(--accent); }
.more { width: 18px; height: 16px; padding: 0; border: 0; background: none; opacity: 0; transition: opacity .2s; }
.more .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.msg:hover .more { opacity: .9; }
@media (hover: none) { .more { opacity: .8; } }
.msg.bare .foot, .msg.jumbo .foot { padding: 2px 4px 0; }

.gone { max-width: 230px; font-size: 13px; font-style: italic; opacity: .75; }
.photo img, .vid { display: block; max-width: 100%; max-height: 340px; border-radius: 12px; cursor: zoom-in; }
.vid { cursor: default; }
.circle { display: block; width: 220px; height: 220px; border-radius: 50%; object-fit: cover; cursor: pointer; background: #000; box-shadow: 0 0 0 3px var(--raise2), 0 12px 30px rgba(0,0,0,.45); transition: transform .3s var(--spring); }
.circle:hover { transform: scale(1.03); }
.file a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.ficon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(127,127,127,.25); }
.ficon::before { content: "↓"; font-size: 20px; }
.fi { display: flex; flex-direction: column; min-width: 0; }
.fi small { opacity: .7; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.play { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--accent); color: var(--ink); transition: transform .2s var(--spring); }
.play:active { transform: scale(.88); }
.play::before { content: ""; width: 12px; height: 14px; margin-left: 3px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.play.on::before { margin: 0; clip-path: none; background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65%); }
.bars { display: flex; align-items: center; gap: 2px; flex: 1; height: 28px; }
.bars span { width: 3px; border-radius: 2px; background: currentColor; opacity: .3; transition: opacity .2s; }
.bars span.done { opacity: 1; }
.voice small { font-size: 12px; opacity: .8; }
.msg.flash { animation: flash 1.2s; }
@keyframes flash { 30% { filter: brightness(1.4); transform: scale(1.03); } }
.msg.flushing { pointer-events: none; animation: flush .75s cubic-bezier(.5, 0, .8, .4) forwards; }
@keyframes flush { 40% { transform: rotate(200deg) scale(.8); } to { transform: rotate(640deg) scale(0); opacity: 0; filter: blur(5px); } }
@keyframes popL { from { opacity: 0; transform: translateX(-16px) scale(.9); } }
@keyframes popR { from { opacity: 0; transform: translateX(16px) scale(.9); } }
@keyframes bump { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.985); filter: blur(6px); } }
@keyframes dropin { from { opacity: 0; transform: translateY(-70px) scale(.6); } }
@keyframes menuIn { from { opacity: 0; transform: scale(.9) translateY(6px); } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(40px) scale(.96); } }

#down { position: absolute; right: 22px; bottom: 82px; z-index: 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--menu); animation: bump .35s var(--spring); }

/* Строка ввода, как в Telegram: плоская панель, скрепка слева, эмодзи и микрофон справа */
.cwrap { position: relative; z-index: 2; }
#ctx { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 18px; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; animation: fadeUp .25s var(--ease); }
#ctx > .ic { color: var(--accent); }
#ctx div { flex: 1; min-width: 0; font-size: 13px; }
#ctx b, #ctx span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ctx b { color: var(--accent); }
#ctx span { color: var(--muted); }
#composer { display: flex; align-items: flex-end; gap: 2px; min-height: 62px; padding: 9px 12px; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; transition: border-color .2s; }
#composer:focus-within { border-top-color: rgba(127,127,127,.35); }
#text { flex: 1; min-width: 0; height: 44px; min-height: 44px; max-height: 140px; margin: 0; padding: 11px 10px; resize: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--text); font: inherit; line-height: 22px; outline: none; }
.icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--muted); transition: color .2s, background .2s, transform .2s var(--spring); }
.icon:hover { color: var(--text); background: var(--raise); }
.icon:active { transform: scale(.88); }
.icon .ic { width: 24px; height: 24px; }
.send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: var(--ink); animation: bump .35s var(--spring); transition: transform .2s var(--spring); }
.send:hover { transform: scale(1.06); }
.send:active { transform: scale(.88); }
.send .ic { stroke-width: 2.3; }
#fmt { position: absolute; left: 14px; bottom: calc(100% + 4px); display: flex; gap: 2px; padding: 4px; border-radius: 13px; background: var(--menu); animation: menuIn .2s var(--spring); transform-origin: bottom left; }
#fmt button { min-width: 34px; height: 30px; border: 0; border-radius: 8px; background: none; }
#fmt button:hover { background: var(--raise2); }

#emoji { position: absolute; right: 12px; bottom: calc(100% + 6px); display: flex; flex-direction: column; width: min(380px, calc(100% - 24px)); height: 380px; border-radius: 22px; overflow: hidden; background: var(--menu); animation: menuIn .3s var(--spring); transform-origin: bottom right; }
#eq { margin: 10px 10px 4px; width: calc(100% - 20px); }
#egrid { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); align-content: start; gap: 2px; padding: 6px 8px; overflow-y: auto; scrollbar-width: thin; }
#egrid .lab { grid-column: 1 / -1; padding: 8px 4px 2px; font-size: 12px; color: var(--muted); }
#egrid button { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 9px; background: none; }
#egrid button:hover { background: var(--raise2); }
#egrid img { width: 30px; height: 30px; transition: transform .2s var(--spring); }
#egrid button:hover img { transform: scale(1.3) rotate(-6deg); }
#etabs { display: flex; justify-content: space-between; padding: 6px 8px; border-top: 1px solid var(--line); }
#etabs button { display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 9px; background: none; opacity: .45; transition: opacity .2s, transform .2s var(--spring); }
#etabs button:hover { transform: translateY(-2px); opacity: .85; }
#etabs button.on { background: var(--raise2); opacity: 1; }
#etabs img { width: 22px; height: 22px; }

#rec { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 18px 14px; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; animation: fadeUp .3s var(--ease); }
#preview { width: 240px; height: 240px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); box-shadow: 0 0 0 3px var(--raise2), 0 0 0 7px rgba(255,69,58,.5); animation: bump .45s var(--spring); }
.recrow { display: flex; align-items: center; gap: 12px; width: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #ff453a; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.eq { display: flex; align-items: center; gap: 3px; height: 22px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: var(--accent); animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .45s; } .eq i:nth-child(5) { animation-delay: .6s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
#recTime { flex: 1; font-variant-numeric: tabular-nums; }

/* Меню, окна */
#menu { position: fixed; z-index: 40; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--menu); transform-origin: top left; animation: menuIn .2s var(--spring); }
#menu > button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; text-align: left; transition: background .15s; }
#menu > button:hover { background: var(--raise2); }
#menu > button.danger { color: #ff6b61; }
.reactrow { display: flex; justify-content: space-between; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.reactrow button { padding: 3px; border: 0; border-radius: 50%; background: none; transition: transform .18s var(--spring); }
.reactrow button:hover { transform: scale(1.3) translateY(-3px); }
.reactrow img { width: 26px; height: 26px; display: block; }
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade .25s both; }
.modal { display: flex; flex-direction: column; width: min(100%, 440px); max-height: min(92vh, 780px); border-radius: 28px; background: var(--menu); animation: sheetUp .5s var(--spring) both; overflow: hidden; }
.sh { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 12px; }
.sh h3 { margin: 0; font: 700 26px var(--display); letter-spacing: -.03em; }
#sheetB { overflow-y: auto; padding: 0 20px 22px; scrollbar-width: thin; }
#sheetB > .primary:last-child { margin-top: 16px; }
.sub { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.rowf { display: flex; gap: 8px; }

/* Настройки */
.prof { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 20px; background: var(--raise); }
.prof .st { flex: 1; min-width: 0; }
.prof input { margin-top: 6px; }
.gt { margin: 22px 6px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grp { border-radius: 18px; background: var(--raise); overflow: hidden; }
.srow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.grp > .srow:first-child { border-top: 0; }
.srow.col { flex-wrap: wrap; }
.srow.col .ctl { flex-basis: 100%; }
button.srow { transition: background .2s; }
button.srow:hover { background: var(--raise); }
button.srow > .ic:last-child { width: 18px; height: 18px; color: var(--faint); }
.srow.danger b { color: #ff6b61; }
.sic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--raise2); color: var(--text); }
.sic .ic { width: 18px; height: 18px; }
.st { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st b { font-weight: 500; }
.st small { font-size: 12px; color: var(--muted); }
.ctl { display: flex; align-items: center; justify-content: flex-end; }
.seg { display: flex; width: 100%; padding: 3px; border-radius: 12px; background: var(--raise); }
.seg button { flex: 1; padding: 7px 4px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 13px; transition: background .25s, color .25s; }
.seg button.on { background: var(--raise2); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--edge); }
.sw { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 50px; height: 30px; margin: 0; border-radius: 15px; background: var(--raise2); cursor: pointer; transition: background .3s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.4); transition: transform .35s var(--spring), background .3s; }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(20px); background: var(--ink); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
.swatch { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127,127,127,.3); transition: transform .25s var(--spring), box-shadow .25s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { box-shadow: 0 0 0 3px var(--menu), 0 0 0 5px var(--c); }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--raise2); outline: none; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.about { padding: 14px; font-size: 13px; color: var(--muted); line-height: 1.5; }

#toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--menu); font-size: 14px; animation: fadeUp .3s var(--spring); }
#lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.9); cursor: zoom-out; animation: fade .2s; }
#lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 12px; animation: bump .35s var(--spring); }

[data-motion="soft"] .wall::after, [data-motion="soft"] .appicon::before, [data-motion="soft"] .appicon::after, [data-motion="soft"] .eq i, [data-motion="soft"] #sub::before { animation: none; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }

/* Телефон */
@media (max-width: 859px) {
  h1 { font-size: 52px; }
  #app { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .rail { display: none; }
  .list, .chat { border-radius: 0; border: 0; }
  .chat { display: none; }
  #app.in-chat .list { display: none; }
  #app.in-chat .chat { display: flex; }
  .mob, .back { display: grid; }
  .msg { max-width: 88%; }
  #msgs { padding: 10px 12px; }
  #down { bottom: 78px; right: 14px; }
  .modal { max-height: 94vh; border-radius: 24px; }
}

/* ===== Стартовая страница: бачок, воронка, пузыри ===== */
#welcome { --lvl: 0; position: relative; display: flex; align-items: center; justify-content: center; height: 100%; padding: 24px; overflow: hidden; }
.wcontent { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 26px; max-height: 100%; padding: 8px; overflow-y: auto; scrollbar-width: none; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.hero .appicon { margin-bottom: 16px; animation: dropin 1s var(--spring) both, floaty 5s 1.2s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-7px); } }
h1 { margin: 0; font: 700 72px/1 var(--display); letter-spacing: -.05em; background: linear-gradient(90deg, var(--text) 30%, var(--muted) 50%, var(--text) 70%) 0 0 / 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: fadeUp .8s .3s var(--ease) both, shine 7s 1s linear infinite; }
@keyframes shine { to { background-position: -220% 0; } }
.hero .tag { animation: fadeUp .8s .45s var(--ease) both; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 440px; margin-top: 10px; }
.chips span { padding: 6px 13px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); font-size: 13px; color: var(--muted); animation: fadeUp .7s var(--ease) both; }
.chips span:nth-child(1) { animation-delay: .6s; } .chips span:nth-child(2) { animation-delay: .7s; } .chips span:nth-child(3) { animation-delay: .8s; } .chips span:nth-child(4) { animation-delay: .9s; }
#welcomeForm { animation: fadeUp .8s .75s var(--ease) both; }
.tank { height: 6px; margin-top: 14px; border-radius: 3px; background: var(--raise2); overflow: hidden; }
.tank i { display: block; height: 100%; width: calc(var(--lvl) * 100%); border-radius: inherit; background: linear-gradient(90deg, #5ac8fa, #a8ecff); transition: width .6s var(--ease); }
.tanktxt { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.lever { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lever .ic { width: 22px; height: 22px; transition: transform .35s var(--spring); }
.lever:hover .ic { transform: rotate(-25deg) translateX(-2px); }
.hint { margin: 12px 0 0; font-size: 12px; text-align: center; color: var(--faint); }

.vortex { position: absolute; left: 50%; top: 50%; width: min(130vmin, 1000px); aspect-ratio: 1; translate: -50% -50%; color: var(--text); pointer-events: none; -webkit-mask-image: radial-gradient(circle, #000 22%, transparent 68%); mask-image: radial-gradient(circle, #000 22%, transparent 68%); transition: transform 1s var(--ease); }
.vortex svg { width: 100%; height: 100%; }
.vortex circle { fill: none; stroke: currentColor; stroke-linecap: round; transform-origin: center; transform-box: fill-box; opacity: var(--o, .15); animation: spin var(--d, 40s) linear infinite; }
.vortex circle.r { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.bubbles i { position: absolute; bottom: -70px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.18), transparent 60%); animation: bubbleUp linear infinite; }
.bubbles i:nth-child(1) { left: 8%; width: 30px; height: 30px; animation-duration: 19s; }
.bubbles i:nth-child(2) { left: 21%; width: 14px; height: 14px; animation-duration: 13s; animation-delay: -5s; }
.bubbles i:nth-child(3) { left: 38%; width: 46px; height: 46px; animation-duration: 25s; animation-delay: -11s; }
.bubbles i:nth-child(4) { left: 55%; width: 18px; height: 18px; animation-duration: 15s; animation-delay: -3s; }
.bubbles i:nth-child(5) { left: 69%; width: 34px; height: 34px; animation-duration: 21s; animation-delay: -9s; }
.bubbles i:nth-child(6) { left: 82%; width: 12px; height: 12px; animation-duration: 12s; animation-delay: -7s; }
.bubbles i:nth-child(7) { left: 92%; width: 40px; height: 40px; animation-duration: 23s; animation-delay: -14s; }
.bubbles i:nth-child(8) { left: 47%; width: 10px; height: 10px; animation-duration: 11s; animation-delay: -2s; }
@keyframes bubbleUp { to { transform: translate(24px, -112vh); } }
.water { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: calc(var(--lvl) * 36vh); background: linear-gradient(180deg, rgba(90,200,250,.14), rgba(90,200,250,.03)); transition: height 1.1s var(--ease); pointer-events: none; }
.water::before, .water::after { content: ""; position: absolute; left: 0; right: 0; top: -19px; height: 20px; opacity: min(1, calc(var(--lvl) * 4)); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='20'%3E%3Cpath d='M0 10Q25 0 50 10T100 10T150 10T200 10V20H0Z' fill='%235ac8fa' fill-opacity='.14'/%3E%3C/svg%3E") repeat-x 0 0 / 200px 20px; animation: wave 8s linear infinite; }
.water::after { top: -13px; animation-duration: 13s; animation-direction: reverse; }
@keyframes wave { to { background-position-x: 200px; } }
#welcome.flushing .vortex { transform: scale(1.5) rotate(300deg); }
#welcome.flushing .vortex circle { animation-duration: .8s !important; opacity: .5; }
#welcome.flushing .wcontent { animation: flushOut 1s cubic-bezier(.6, 0, .9, .4) forwards; }
@keyframes flushOut { 30% { transform: rotate(90deg) scale(.85); } to { transform: rotate(720deg) scale(0); opacity: 0; filter: blur(8px); } }

/* ===== Диалоги внутри сайта ===== */
#dlg { z-index: 45; background: rgba(0,0,0,.35); }
.dlg { width: min(100%, 380px); padding: 24px; border-radius: 26px; }
.dlg h3 { margin: 0 0 8px; font: 700 22px var(--display); letter-spacing: -.02em; }
.dtxt { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.dbtn { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dbtn .pill { padding: 10px 18px; }
.okbtn { background: var(--accent); color: var(--ink); font-weight: 600; }
.okbtn:hover { background: var(--accent); filter: brightness(1.08); }
.dangerbtn { background: #ff453a; color: #fff; font-weight: 600; }
.dangerbtn:hover { background: #ff453a; filter: brightness(1.1); }

/* ===== Настройки с вкладками ===== */
.modal.wide { width: min(100%, 780px); height: min(86vh, 640px); max-height: none; }
.modal.wide #sheetB { display: flex; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.setw { display: grid; grid-template-columns: 200px 1fr; flex: 1; min-width: 0; min-height: 0; }
.snav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 16px 14px; border-right: 1px solid var(--line); overflow-y: auto; }
.snav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--muted); text-align: left; font-weight: 500; transition: background .2s, color .2s; }
.snav button:hover { background: var(--raise); color: var(--text); }
.snav button.on { background: var(--raise2); color: var(--text); }
.snav .ic { width: 19px; height: 19px; }
.spane { overflow-y: auto; padding: 0 22px 24px; animation: fade .3s both; }
.spane > .gt:first-child { margin-top: 4px; }
.keys > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.keys > div:first-child { border-top: 0; }
kbd { padding: 2px 8px; border-radius: 7px; background: var(--raise2); border: 1px solid var(--edge); font: 12px var(--body); box-shadow: 0 1px 0 var(--edge); white-space: nowrap; }

/* ===== Мелочи ===== */
.ic.tiny { width: 14px; height: 14px; flex: none; color: var(--faint); }
.badge.mute { background: var(--raise2); color: var(--muted); }
.reactrow span { display: block; font-size: 24px; line-height: 26px; }
.react .emo.sys, .emo.sys { width: auto; height: auto; font-size: 16px; }
[data-density="compact"] .msg { padding: 5px 10px 4px; margin-top: 6px; }
[data-density="compact"] .msg.cont { margin-top: 1px; }
[data-density="compact"] .row { padding: 7px 10px; }
[data-density="roomy"] .msg { padding: 10px 15px 7px; margin-top: 14px; }
[data-density="roomy"] .msg.cont { margin-top: 4px; }
[data-density="roomy"] .row { padding: 13px 10px; }

@media (max-width: 859px) {
  h1 { font-size: 56px; }
  .wcontent { gap: 20px; }
  .modal.wide { height: min(92vh, 720px); }
  .setw { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .snav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 12px 10px; overflow-x: auto; overflow-y: hidden; }
  .snav button { flex: none; padding: 8px 12px; }
  .snav span { white-space: nowrap; }
  .spane { padding: 0 16px 24px; }
}

/* ===== Меню сообщения с иконками ===== */
#menu { min-width: 250px; max-height: min(82vh, 600px); overflow-y: auto; scrollbar-width: thin; }
#menu > button { display: flex; align-items: center; gap: 12px; padding: 9px 12px; }
#menu > button .mi { display: grid; place-items: center; width: 22px; height: 22px; flex: none; color: var(--muted); transition: color .15s, transform .2s var(--spring); }
#menu > button .mi .ic { width: 20px; height: 20px; }
#menu > button:hover .mi { color: var(--text); transform: scale(1.12); }
#menu > button.danger .mi { color: #ff6b61; }
#menu .sep { height: 1px; margin: 5px 6px; background: var(--line); }
.reactrow { display: flex; gap: 1px; padding: 2px 0 7px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.reactrow button { display: grid; place-items: center; flex: 1; padding: 4px 0; border: 0; border-radius: 12px; background: none; transition: transform .18s var(--spring), background .15s; }
.reactrow button:hover { transform: scale(1.28) translateY(-3px); background: var(--raise); }
.reactrow button.mine { background: var(--raise2); }
.reactrow button.plus { color: var(--muted); }
.reactrow button.plus .ic { width: 18px; height: 18px; }
.reactrow img { width: 25px; height: 25px; display: block; }

/* ===== Меню вложений ===== */
#attachMenu { position: absolute; left: 12px; bottom: calc(100% + 8px); z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 2px; width: min(360px, calc(100% - 24px)); padding: 14px 8px 8px; border-radius: 26px; background: var(--menu); transform-origin: bottom left; animation: menuIn .3s var(--spring); }
#attachMenu button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 6px 2px; border: 0; background: none; font-size: 12px; line-height: 1.2; color: var(--muted); text-align: center; animation: bump .45s var(--spring) both; animation-delay: calc(var(--i) * 40ms); }
#attachMenu .at { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 19px; background: var(--raise2); color: var(--text); transition: background .2s, color .2s, transform .25s var(--spring); }
#attachMenu .at .ic { width: 26px; height: 26px; }
#attachMenu button:hover .at { background: var(--accent); color: var(--ink); transform: translateY(-4px) rotate(-4deg); }
#attachMenu button:hover { color: var(--text); }

/* ===== Редактор фото ===== */
.ed { z-index: 35; background: rgba(0,0,0,.72); }
.edwin { display: flex; flex-direction: column; width: min(100%, 880px); max-height: min(95vh, 860px); border-radius: 28px; background: var(--menu); overflow: hidden; animation: sheetUp .5s var(--spring) both; }
.edh { display: flex; align-items: center; gap: 12px; padding: 14px 16px 8px; }
.edh b { flex: 1; font: 600 17px var(--display); }
.edh span { color: var(--muted); font-size: 13px; }
.edtools { display: flex; align-items: center; gap: 4px; padding: 4px 14px 8px; overflow-x: auto; }
.edtools button { display: grid; place-items: center; flex: none; width: 42px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); transition: background .2s, color .2s, transform .2s var(--spring); }
.edtools button:hover { background: var(--raise); color: var(--text); }
.edtools button:active { transform: scale(.9); }
.edtools button.on { background: var(--accent); color: var(--ink); }
.vsep { width: 1px; height: 22px; margin: 0 6px; background: var(--line); flex: none; }
.edstage { position: relative; flex: 1; min-height: 160px; display: grid; place-items: center; padding: 4px 16px; overflow: hidden; }
.edstage canvas { max-width: 100%; max-height: 46vh; border-radius: 14px; background: #000; touch-action: none; cursor: crosshair; box-shadow: 0 10px 40px rgba(0,0,0,.4); animation: bump .4s var(--spring); }
.edstage img, .edstage video { max-width: 100%; max-height: 46vh; border-radius: 14px; }
.edstage .filecard { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-radius: 20px; background: var(--raise); }
.filecard .fci { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--raise2); }
.filecard .fci .ic { width: 28px; height: 28px; }
.filecard b { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard small { color: var(--muted); }
#edTxt { position: fixed; z-index: 50; width: auto; min-width: 140px; padding: 6px 10px; background: rgba(0,0,0,.55); border: 1px dashed var(--accent); border-radius: 8px; font: 700 22px var(--body); }
.edopts { display: flex; align-items: center; gap: 14px; padding: 8px 18px; flex-wrap: wrap; }
.edopts input[type="range"] { flex: 1; min-width: 100px; max-width: 220px; }
.colors { display: flex; gap: 7px; }
.colors button { width: 26px; height: 26px; border: 2px solid transparent; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127,127,127,.4); transition: transform .2s var(--spring); }
.colors button.on { border-color: var(--text); transform: scale(1.18); }
.edemo { display: flex; gap: 2px; flex-wrap: wrap; }
.edemo button { padding: 3px; border: 0; border-radius: 9px; background: none; }
.edemo button.on { background: var(--raise2); }
.edemo img { width: 26px; height: 26px; display: block; }
.edfoot { display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 16px; border-top: 1px solid var(--line); }
.edtog { display: flex; gap: 8px; flex-wrap: wrap; }
.edtog button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 999px; background: var(--raise2); font-size: 13px; color: var(--muted); transition: background .2s, color .2s; }
.edtog button .ic { width: 16px; height: 16px; }
.edtog button.on { background: var(--accent); color: var(--ink); }
.edcap { display: flex; align-items: flex-end; gap: 8px; }
.edcap textarea { flex: 1; min-width: 0; height: 44px; max-height: 100px; padding: 11px 16px; resize: none; border: 1px solid var(--line); border-radius: 22px; background: var(--raise); color: var(--text); font: inherit; line-height: 20px; outline: none; }
.edcap textarea:focus { border-color: var(--accent); }
.camwin { position: relative; width: min(100%, 560px); border-radius: 28px; overflow: hidden; background: #000; animation: sheetUp .5s var(--spring) both; }
#camV { display: block; width: 100%; max-height: 70vh; object-fit: cover; }
.camrow { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: linear-gradient(0deg, rgba(0,0,0,.6), transparent); }
.camrow .rbtn { color: #fff; background: rgba(255,255,255,.15); }
.shot { width: 66px; height: 66px; border: 4px solid #fff; border-radius: 50%; background: rgba(255,255,255,.25); transition: transform .2s var(--spring); }
.shot:hover { transform: scale(1.08); }
.shot:active { transform: scale(.9); background: #fff; }

/* ===== Новые типы сообщений ===== */
.msg.media { padding: 4px 4px 5px; }
.msg.media .foot { padding: 0 8px; }
.msg.media .who, .msg.media .quote, .msg.media .fwd { margin-left: 6px; margin-right: 6px; }
.cap { padding: 6px 8px 0; }
.photo.sp, .vwrap.sp { position: relative; overflow: hidden; border-radius: 12px; }
.photo.sp:not(.open) img, .vwrap.sp:not(.open) video { filter: blur(26px) brightness(.7); transform: scale(1.1); }
.spv { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.6); cursor: pointer; }
.spv .ic { width: 28px; height: 28px; }
.sp.open .spv { display: none; }
.fwd { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; font-size: 13px; color: var(--accent); }
.fwd .ic { width: 14px; height: 14px; }
.fwd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll { display: flex; flex-direction: column; gap: 6px; min-width: 250px; }
.pq { font-weight: 600; font-size: 1.04em; }
.poll small { color: var(--muted); font-size: 12px; }
.mine .poll small { color: rgba(255,255,255,.6); }
.po { position: relative; display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; border-radius: 11px; background: rgba(127,127,127,.15); overflow: hidden; text-align: left; transition: background .2s, transform .15s var(--spring); }
.po:hover { background: rgba(127,127,127,.25); }
.po:active { transform: scale(.985); }
.po > * { position: relative; }
.po .pbar { position: absolute; inset: 0 auto 0 0; background: rgba(127,127,127,.28); transition: width .6s var(--ease); }
.po.me .pbar { background: var(--accent); opacity: .3; }
.po .pt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.po .pc { font-size: 12px; opacity: .85; }
.po .pck { display: grid; place-items: center; flex: none; width: 19px; height: 19px; border: 1.5px solid currentColor; border-radius: 50%; opacity: .55; }
.po .pck .ic { width: 12px; height: 12px; stroke-width: 3; }
.po.me .pck { background: var(--accent); border-color: var(--accent); color: var(--ink); opacity: 1; }
.loc a, .contact { display: flex; align-items: center; gap: 12px; min-width: 230px; color: inherit; text-decoration: none; }
.locmap { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: rgba(127,127,127,.2); background-image: linear-gradient(rgba(127,127,127,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(127,127,127,.2) 1px, transparent 1px); background-size: 14px 14px; }
.locmap .ic { width: 26px; height: 26px; color: #ff6b61; }
.loc .lnk { color: var(--accent); }
.contact .pill { margin-left: auto; font-size: 12px; padding: 6px 12px; color: inherit; }
.spd { padding: 2px 7px; border: 0; border-radius: 999px; background: rgba(127,127,127,.25); font-size: 11px; font-weight: 600; color: inherit; }
.ttl { width: 14px; height: 14px; transform: rotate(-90deg); }
.ttl circle { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 38; stroke-dashoffset: 0; animation: ttl linear forwards; }
@keyframes ttl { to { stroke-dashoffset: 38; } }
.meta .ic.tiny { width: 12px; height: 12px; color: currentColor; opacity: .8; }
.meta .ic.tiny.stard { fill: currentColor; }
.tick.read { letter-spacing: -3px; margin-right: 3px; }
.unreadline { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; font-size: 12px; font-weight: 600; color: var(--accent); }
.unreadline::before, .unreadline::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .35; }
mark { padding: 0 1px; border-radius: 3px; background: rgba(255,214,10,.45); color: inherit; }
mark.cur { background: rgba(255,159,10,.8); }
.draft { color: #ff6b61; }

/* ===== Панели над чатом ===== */
.pinbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 18px; border-bottom: 1px solid var(--line); background: var(--panel); animation: fadeUp .3s var(--ease); }
.pinbar > .ic { color: var(--accent); flex: none; width: 20px; height: 20px; }
.pinbar #pinMain { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font-size: 13px; }
.pinbar b, .pinbar span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinbar b { color: var(--accent); font-weight: 600; }
.pinbar span { color: var(--muted); }
.pinbar .emo { width: 1.1em; height: 1.1em; }
.csearch { position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--muted); animation: fadeUp .25s var(--ease); }
.csearch input { flex: 1; min-width: 0; padding: 8px 0 !important; border: 0 !important; background: none !important; color: var(--text); font: inherit; outline: none; }
#csn { font-size: 12px; white-space: nowrap; }
#selbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; animation: fade .2s; }
#selbar b { font: 600 16px var(--display); }
.grow { flex: 1; }
#convo.selecting .msg { cursor: pointer; padding-left: 34px; }
#convo.selecting .msg::before { content: ""; position: absolute; left: 9px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border: 2px solid var(--muted); border-radius: 50%; }
#convo.selecting .msg.sel::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--theirs); }
#convo.selecting .msg.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
#convo.selecting .msg.mine { padding-left: 34px; }
.msg.mine::before { box-shadow: none; }
.msg .flushmark { display: none; }
#msgs.flushall { animation: flushOut 1s cubic-bezier(.6, 0, .9, .4) forwards; transform-origin: center; }
#down .badge { position: absolute; top: -6px; right: -4px; }
#down { position: absolute; }
#sub[data-state="typing"] { color: var(--accent); }
#sub[data-state="typing"]::before { display: none; }
.dots { display: inline-flex; gap: 2px; margin-left: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dotb 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dotb { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.ttlchip { display: inline-flex; align-items: center; gap: 5px; align-self: center; margin: 0 2px; padding: 5px 10px; border: 0; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 12px; font-weight: 600; animation: bump .35s var(--spring); }
.ttlchip .ic { width: 15px; height: 15px; }
#cmds { position: absolute; left: 12px; bottom: calc(100% + 6px); z-index: 6; width: min(340px, calc(100% - 24px)); padding: 6px; border-radius: 18px; background: var(--menu); animation: menuIn .2s var(--spring); transform-origin: bottom left; }
#cmds button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 11px; background: none; text-align: left; }
#cmds button.on, #cmds button:hover { background: var(--raise2); }
#cmds .mi { display: grid; place-items: center; width: 22px; color: var(--muted); }
#cmds small { margin-left: auto; color: var(--muted); }

/* ===== Формы, списки в окнах ===== */
#pOpts input { margin-bottom: 8px; }
.starrow, .fwrow { cursor: pointer; }
.starrow:hover, .fwrow:hover { background: var(--raise); }
.fwrow { transition: background .2s; }
.dtxt { white-space: pre-line; }

/* ===== Обои чата ===== */
[data-wall="aurora"] #msgs { background: radial-gradient(60% 45% at 15% 8%, rgba(90,200,250,.13), transparent 65%), radial-gradient(55% 45% at 90% 90%, rgba(177,151,252,.13), transparent 65%); }
[data-wall="dusk"] #msgs { background: radial-gradient(60% 45% at 85% 6%, rgba(255,143,171,.13), transparent 65%), radial-gradient(55% 45% at 8% 92%, rgba(255,159,10,.11), transparent 65%); }
[data-wall="forest"] #msgs { background: radial-gradient(60% 45% at 10% 10%, rgba(99,230,190,.12), transparent 65%), radial-gradient(55% 45% at 92% 88%, rgba(48,209,88,.1), transparent 65%); }
[data-wall="ice"] #msgs { background: linear-gradient(180deg, rgba(168,236,255,.09), transparent 55%), radial-gradient(50% 40% at 80% 95%, rgba(90,200,250,.1), transparent 65%); }

.ripple { position: absolute; right: 22px; bottom: 20px; width: 44px; height: 44px; border: 2px solid var(--accent); border-radius: 50%; pointer-events: none; animation: rip .7s ease-out forwards; }
@keyframes rip { from { transform: scale(.6); opacity: .8; } to { transform: scale(4.5); opacity: 0; } }
#sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Flush 6: поиск, QR-приглашение, «Дополнительно», мелочи ---- */
.hint0 .e2e { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.hint0 .e2e .ic { width: 14px; height: 14px; }
.qrbox { display: grid; place-items: center; margin: 4px auto 0; padding: 10px; width: fit-content; border-radius: 16px; background: #fff; }
.qrbox svg { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.code { margin: 14px 0 0; text-align: center; font: 600 15px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; user-select: all; word-break: break-all; }
.pill.wide { display: block; width: 100%; margin-top: 10px; padding: 12px; }
.linkbtn { display: block; margin: 14px auto 0; padding: 6px 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--text); }
.joinlink { display: block; margin: 8px auto 12px; padding: 6px 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; }
.joinlink:hover { color: var(--text); }
details.adv { margin-top: 18px; }
details.adv > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; margin: 0 6px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: "›"; font-size: 16px; transition: transform .2s; }
details.adv[open] > summary::after { transform: rotate(90deg); }
details.adv > .gt:first-child { margin-top: 4px; }
