:root { color-scheme: dark; --bg:#1e2128; --side:#171a20; --rail:#101216; --text:#e8eaf0; --dim:#9aa1b1; --accent:#4fb894; --on-accent:#08150f; --line:#2c313c; --bad:#ff8080; }
:root[data-theme=black] { --bg:#000; --side:#0a0a0c; --rail:#000; --line:#23232a; }
:root[data-theme=light] { color-scheme: light; --bg:#fff; --side:#f2f3f6; --rail:#e4e6ec; --text:#1b1e26; --dim:#5c6475; --accent:#137a5a; --on-accent:#fff; --line:#d5d9e2; --bad:#b3261e; }
:root[data-theme=plum] { --bg:#221a33; --side:#1a1228; --rail:#120c1e; --accent:#a78bfa; --on-accent:#170b33; --line:#382b52; --dim:#ab9fc4; }
:root[data-theme=ocean] { --bg:#10242e; --side:#0c1c25; --rail:#08141b; --accent:#38bdf8; --on-accent:#04202e; --line:#1f3d4c; --dim:#8fb0bf; }
:root[data-theme=contrast] { --bg:#000; --side:#000; --rail:#000; --text:#fff; --dim:#e0e0e0; --accent:#ffd400; --on-accent:#000; --line:#8a8a8a; --bad:#ff9b9b; }
:root[data-accent=green] { --accent:#4fb894; --on-accent:#08150f; }
:root[data-accent=blue] { --accent:#6ea8fe; --on-accent:#06152e; }
:root[data-accent=violet] { --accent:#a78bfa; --on-accent:#170b33; }
:root[data-accent=orange] { --accent:#f59e42; --on-accent:#2b1500; }
:root[data-accent=pink] { --accent:#f472b6; --on-accent:#33061d; }
:root[data-theme=light][data-accent=green] { --accent:#137a5a; --on-accent:#fff; }
:root[data-theme=light][data-accent=blue] { --accent:#1d5fd0; --on-accent:#fff; }
:root[data-theme=light][data-accent=violet] { --accent:#6d3fd4; --on-accent:#fff; }
:root[data-theme=light][data-accent=orange] { --accent:#a85400; --on-accent:#fff; }
:root[data-theme=light][data-accent=pink] { --accent:#b81e6e; --on-accent:#fff; }
:root[data-size=small] .msg .body, :root[data-size=small] #composer textarea { font-size: 13px; }
:root[data-size=large] .msg .body, :root[data-size=large] #composer textarea { font-size: 18px; }
dialog select { width: 100%; margin-top: 4px; font: inherit; color: inherit; background: var(--rail); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
#lookButton { margin-top: auto; }
#botDialog { width: min(520px, calc(100% - 32px)); max-height: 94vh; }
#botDialog small { display: block; margin: 4px 0; }
#botDialog fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 0; padding: 8px; }
#botDialog textarea { resize: vertical; }
#botDialog select { width: 100%; }
#botLog { padding-left: 18px; margin: 6px 0; }
#botSave { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--dim); }
.dot.st-online { background: var(--accent); } .dot.st-away { background: #e0af68; }
.dot.st-busy { background: #f7768e; } .dot.st-dnd { background: #f7768e; border-radius: 2px; }
#members .label { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
#members .label span, #members .label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#members .label small { font-size: 11px; color: var(--dim); }
#members li.st-away .ava { box-shadow: 0 0 0 2px #e0af68; }
#members li.st-busy .ava { box-shadow: 0 0 0 2px #f7768e; }
#members li.st-dnd .ava { box-shadow: 0 0 0 2px #f7768e, 0 0 0 4px var(--side), 0 0 0 5px #f7768e; }
#authInvite { margin: 0; color: var(--accent); }
#avatarDialog { max-height: 94vh; }
#avatarStage { display: flex; gap: 14px; align-items: flex-end; justify-content: center; margin-bottom: 8px; }
#avatarCanvas { width: min(256px, 100%); aspect-ratio: 1; border-radius: 8px; cursor: grab; touch-action: none; }
#avatarCanvas:active { cursor: grabbing; }
#avatarRound { width: 48px; height: 48px; border-radius: 50%; flex: none; }
#avatarDialog input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
#avatarEffects { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
#avatarEffects button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: 11px; }
#avatarEffects button.on { box-shadow: inset 0 0 0 2px var(--accent); }
#avatarEffects canvas { width: 48px; height: 48px; border-radius: 50%; }
#avatarSave { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#avatarSave:disabled { opacity: .5; }
#billingDialog { max-height: 90vh; }
#billingDialog p { margin: 6px 0; }
#billingDialog h2 { font-size: 14px; margin: 14px 0 4px; }
#voteList ul { list-style: none; margin: 0; padding: 0; }
#voteList li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0; }
#voteList li select { flex: 1; min-width: 130px; width: auto; margin: 0; }
#voteList .line { display: flex; flex-wrap: wrap; gap: 8px; }
#buyButton { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#friendsButton { position: relative; }
#friendsButton.attention::after { content: ""; position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
#friendForm { display: flex; gap: 8px; margin: 4px 0; }
#friendList ul { list-style: none; margin: 0 0 12px; padding: 0; }
#friendList h2 { font-size: 13px; margin: 8px 0 4px; }
#friendList li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
#friendList li > div { flex: 1; min-width: 0; overflow: hidden; }
#friendList small { display: block; }
#friendList li.online .ava { box-shadow: 0 0 0 2px var(--accent); }
#friendList button { font-size: 13px; padding: 5px 8px; }
.inside { list-style: none; margin: 0 0 4px; padding: 0 0 0 24px; }
.inside button { display: flex; align-items: center; gap: 6px; background: none; padding: 2px 4px; font-size: 13px; }
.inside .ava { width: 20px; height: 20px; font-size: 11px; }
#memberBody { display: flex; flex-direction: column; gap: 8px; }
#memberBody .who { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
#memberBody .ava.big { width: min(256px, 60vw); height: min(256px, 60vw); font-size: 96px; }
#memberDialog { max-height: 94vh; }
#memberBody .who small { display: block; }
button.danger { color: var(--bad); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { background: var(--line); border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
button:hover { filter: brightness(1.2); }
input, textarea { background: var(--rail); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; width: 100%; }
.link { background: none; color: var(--accent); padding: 4px; }
#adminLink { color: var(--accent); text-decoration: none; }
#adminLink[hidden] { display: none; }
.error { color: var(--bad); min-height: 1.4em; margin: 0; }
#auth { display: grid; place-items: center; min-height: 100%; padding: 16px; }
#authForm { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
#authForm label, #regFields { display: flex; flex-direction: column; gap: 4px; }
#regFields { gap: 12px; }
#authSubmit, #composer button, #dialogOk { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#app { display: grid; grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr); grid-template-areas: "rail side chat"; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; position: relative; }
#rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; overflow-y: auto; }
#servers { display: flex; flex-direction: column; gap: 8px; }
#rail button { width: calc(var(--rail-w) - 22px); height: calc(var(--rail-w) - 22px); border-radius: 14px; padding: 0; font-weight: 600; flex: none; }
#rail button.active { background: var(--accent); color: var(--on-accent); }
#rail button .nm { display: none; }
#servers button .ico { display: contents; }
/* широкая панель серверов: значок поменьше, название рядом (обрезается многоточием, полное — во всплывающей подсказке) */
#app[data-rail=wide] #rail { align-items: stretch; padding: 10px 8px; }
#app[data-rail=wide] #servers { gap: 6px; }
#app[data-rail=wide] #rail button { width: auto; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 8px; text-align: left; font-size: 14px; }
#app[data-rail=wide] #servers button .ico { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: rgba(128,128,128,.22); font-size: 12px; }
#app[data-rail=wide] #servers button.active .ico { background: rgba(0,0,0,.18); }
#app[data-rail=wide] #servers button .nm { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app[data-rail=wide] #rail > button::after { content: attr(title); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
#side { background: var(--side); display: flex; flex-direction: column; min-height: 0; }
#side header, #chat header { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
#side header { flex-direction: column; align-items: flex-start; gap: 0; }
small, #status, h2 { color: var(--dim); }
#channels { flex: 1; overflow-y: auto; padding: 8px; }
.channel { display: flex; gap: 0; }
.channel button { background: none; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .open { flex: 1; min-width: 0; padding-left: 8px; }
.channel button:not(.open) { flex: none; padding: 8px 3px; }
.channel.active .open { background: var(--line); }
#ownerTools { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
#voiceBar { border-top: 1px solid var(--line); padding: 8px; max-height: 60%; overflow-y: auto; }
#voiceBar div { display: flex; flex-wrap: wrap; gap: 6px; }
#voiceBar button { font-size: 13px; padding: 5px 8px; }
#voiceBar #voiceControls { flex-wrap: nowrap; }
#voiceControls button { flex: 1; font-size: 17px; }
#voiceControls button.off { box-shadow: inset 0 0 0 2px var(--bad); }
#voiceControls button.on { background: var(--accent); color: var(--on-accent); }
#ownerTools button { font-size: 13px; padding: 5px 8px; }
#mic, #deaf { background: var(--line); }
#voicePing { display: block; color: var(--dim); }
#voiceBar #sensitivityBox { flex-direction: column; flex-wrap: nowrap; gap: 2px; margin: 6px 0 0; }
details { margin-top: 8px; font-size: 13px; }
summary { cursor: pointer; padding: 2px 0; }
details label { display: block; margin-top: 4px; }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; vertical-align: middle; accent-color: var(--accent); }
#soundVolume { padding: 0; border: 0; background: none; accent-color: var(--accent); }
#voiceBar #soundButtons, #voiceBar #soundOwn { gap: 4px; margin-top: 6px; }
#soundButtons button.remove { color: var(--bad); }
#cueSettings { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 0; padding: 8px; }
#cueSettings div { display: flex; gap: 6px; margin-bottom: 8px; }
#cueSettings div select { margin: 0; flex: 1; min-width: 0; }
#micNote, #soundNote { display: block; }
#sensitivity { padding: 0; border: 0; background: none; accent-color: var(--accent); }
#level { width: 100%; height: 6px; accent-color: var(--accent); }
#gateState { min-height: 1.4em; }
#side footer { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#meRow { display: flex; align-items: center; gap: 10px; }
#meRow .ava { width: 42px; height: 42px; font-size: 18px; }
#statusButton { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; padding: 2px 4px; color: var(--text); text-align: left; line-height: 1.25; }
#meName { max-width: 100%; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#meState { display: flex; align-items: center; gap: 5px; max-width: 100%; }
#myStatusText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12px; }
#meTools { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#meTools #ping { flex: 1; }
#meTools .link, #adminLink { font-size: 13px; }
#avatarButton { padding: 0; background: none; border-radius: 50%; flex: none; }
.ava { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; overflow: hidden; font-weight: 600; font-size: 14px; color: #0d1014; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tone0 { background: #4fb894; } .tone1 { background: #7aa2f7; } .tone2 { background: #e0af68; }
.tone3 { background: #f7768e; } .tone4 { background: #bb9af7; } .tone5 { background: #7dcfff; }
#chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#status { margin-left: auto; font-size: 13px; }
#menu { display: none; }
#messages { flex: 1; overflow-y: auto; padding: 12px; }
#stage { position: relative; display: flex; flex-direction: column; flex: none; height: var(--stage-h); min-height: 180px; background: var(--rail); border-bottom: 1px solid var(--line); }
#screens { flex: 1; min-height: 0; display: flex; gap: 8px; padding: 8px; }
#screens figure { flex: 1; min-width: 0; min-height: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
#screens video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
#screens figcaption { font-size: 12px; color: var(--dim); }
#stageBar { display: flex; gap: 8px; align-items: center; padding: 6px 8px; }
#stageSounds { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; }
#stageBar button { flex: none; font-size: 13px; padding: 5px 8px; }
.msg { display: flex; gap: 10px; padding: 4px 0; }
.msg .text { min-width: 0; flex: 1; }
.msg .meta { color: var(--dim); font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg .meta b { color: var(--text); font-size: 15px; }
.msg .meta button { font-size: 12px; padding: 0 4px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--dim); text-align: center; margin-top: 15vh; padding: 0 16px; }
#composer { display: flex; gap: 8px; padding: 12px; }
#composer textarea { resize: none; max-height: 140px; flex: 1; min-width: 0; }
#composer .tool { background: none; padding: 4px 6px; font-size: 20px; flex: none; }
#picker { display: flex; flex-direction: column; flex: none; height: min(340px, 50%); border-top: 1px solid var(--line); background: var(--side); }
#pickerTabs { display: flex; gap: 6px; padding: 6px 12px; flex-wrap: wrap; }
#pickerTabs button { font-size: 13px; padding: 5px 10px; }
#pickerTabs button.on { background: var(--accent); color: var(--on-accent); }
#pickerClose { margin-left: auto; }
#pickerBody { flex: 1; overflow-y: auto; padding: 0 12px 10px; }
#pickerBody h3 { font-size: 12px; color: var(--dim); margin: 8px 0 4px; }
#pickerBody .grid { display: grid; gap: 6px; }
#pickerBody .emoji { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
#pickerBody .emoji button { background: none; padding: 2px; font-size: 22px; }
#pickerBody .stickers { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
#pickerBody .stickers .sticker-emoji { font-size: 30px; }
#pickerBody .stickers b { font-size: 11px; }
#pickerBody .gifs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
#pickerBody .gifs button { padding: 4px; }
#pickerBody .gifs img { width: 100%; height: 90px; object-fit: contain; }
.gifcard { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; }
.gifcard img { width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 10px; background: var(--rail); }
#pickerBody .set { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
#pickerBody .set button { padding: 4px; }
#pickerBody .set .gifcard img { width: 100%; }
#pickerBody .set .gifcard b { font-size: 11px; }
#pickerBody .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
#pickerBody .chips button { font-size: 12px; padding: 4px 8px; }
#pickerBody .chips button.on { background: var(--accent); color: var(--on-accent); }
.sticker { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.sticker-emoji { display: inline-block; font-size: 64px; line-height: 1.2; }
.attach { display: inline-block; max-width: 100%; }
.attach img { display: block; max-width: min(360px, 100%); max-height: 320px; min-height: 40px; border-radius: 8px; }
.anim-bounce { animation: bounce 1s ease-in-out infinite; } .anim-spin { animation: spin 3s linear infinite; }
.anim-shake { animation: shake .6s ease-in-out infinite; } .anim-pulse { animation: pulse 1.1s ease-in-out infinite; }
.anim-wave { animation: wave 1.2s ease-in-out infinite; transform-origin: 70% 80%; } .anim-float { animation: float 2.4s ease-in-out infinite; }
.anim-flip { animation: flip 2s ease-in-out infinite; } .anim-zoom { animation: zoom 1.6s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-7%) rotate(-7deg); } 75% { transform: translateX(7%) rotate(7deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(20deg); } 60% { transform: rotate(-12deg); } }
@keyframes float { 0%, 100% { transform: translate(0, 4%); } 50% { transform: translate(4%, -8%); } }
@keyframes flip { 0%, 60%, 100% { transform: rotateY(0); } 80% { transform: rotateY(180deg); } }
@keyframes zoom { 0%, 100% { transform: scale(.85); } 50% { transform: scale(1.25) rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .sticker-emoji { animation: none; } }
#people { background: var(--side); border-top: 1px solid var(--line); padding: 6px 12px 8px; max-height: 108px; flex: none; overflow-y: auto; }
#people h2 { font-size: 12px; margin: 0 0 4px; }
#members { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
#members li { max-width: 200px; opacity: .5; }
#members button { display: flex; align-items: center; gap: 6px; max-width: 100%; background: none; padding: 2px; }
#members li.online { opacity: 1; }
#members button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#members .ava { width: 26px; height: 26px; font-size: 12px; }
#members li.online .ava { box-shadow: 0 0 0 2px var(--accent); }
:root { --side-w: 230px; --people-w: 210px; --stage-h: 52%; --rail-w: 68px; --sep: #3a4150; }
:root[data-theme=black] { --sep: #34343e; }
:root[data-theme=light] { --sep: #b7bdcc; }
:root[data-theme=plum] { --sep: #5b4687; }
:root[data-theme=ocean] { --sep: #2f6179; }
:root[data-theme=contrast] { --sep: #bdbdbd; }
#rail { grid-area: rail; }
#side { grid-area: side; position: relative; }
#chat { grid-area: chat; }
#app[data-side=right] { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--side-w); grid-template-areas: "rail chat side"; }
#app[data-people=right] { grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr) var(--people-w); grid-template-areas: "rail side chat people"; }
#app[data-side=right][data-people=right] { grid-template-columns: var(--rail-w) var(--people-w) minmax(0, 1fr) var(--side-w); grid-template-areas: "rail people chat side"; }
#app[data-people=hidden] #people { display: none; }
#app[data-people=right] > #people { grid-area: people; position: relative; max-height: none; min-height: 0; border-top: 0; border-left: 1px solid var(--line); padding: 12px; }
#app[data-side=right][data-people=right] > #people { border-left: 0; border-right: 1px solid var(--line); }
#app[data-people=right] #members { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
#app[data-people=right] #members li { max-width: none; }
#app[data-people=right] #members button { width: 100%; text-align: left; }
.movable { cursor: grab; touch-action: none; user-select: none; }
/* разделитель панелей: трубка в 5 px (тёмные края, светлая середина) цвета темы; при наведении цвет чуть сдвигается к акценту. Зона захвата шире самой трубки */
.grip { --c: var(--sep); --hi: color-mix(in srgb, var(--c) 55%, #fff); --lo: color-mix(in srgb, var(--c) 65%, #000); position: absolute; z-index: 5; touch-action: none; }
.grip::before { content: ""; position: absolute; inset: 0; }
.grip-sideW::before, .grip-peopleW::before, .grip-railW::before { inset: 0 -3px; }
.grip-stageH::before { inset: -3px 0; }
.grip:hover, .grip:focus-visible, .grip:active { --c: color-mix(in srgb, var(--sep) 62%, var(--accent)); outline: none; }
.grip-sideW, .grip-peopleW, .grip-railW { top: 0; bottom: 0; width: 5px; cursor: col-resize; background: linear-gradient(90deg, var(--lo), var(--hi), var(--lo)); }
.grip-railW { left: calc(var(--rail-w) - 3px); }
.grip-stageH { left: 0; right: 0; bottom: 0; height: 5px; cursor: row-resize; background: linear-gradient(180deg, var(--lo), var(--hi), var(--lo)); }
.grip-sideW, #app[data-side=right] .grip-peopleW { right: 0; }
.grip-peopleW, #app[data-side=right] .grip-sideW { left: 0; right: auto; }
#app[data-side=right] .grip-peopleW { left: auto; }
#app[data-people=bottom] .grip-peopleW { display: none; }
#dropZones { position: absolute; inset: 0 0 0 var(--rail-w); z-index: 20; background: rgba(0,0,0,.35); }
#dropZones .zone { position: absolute; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 12px; background: var(--side); font-weight: 600; text-align: center; padding: 8px; }
#dropZones .zone.on { background: var(--accent); color: var(--on-accent); }
.zone-left { left: 3%; top: 15%; width: 30%; height: 70%; }
.zone-right { right: 3%; top: 15%; width: 30%; height: 70%; }
.zone-bottom { left: 35%; bottom: 5%; width: 30%; height: 30%; }
.zone-hidden { left: 35%; top: 5%; width: 30%; height: 18%; }
#layoutSettings { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 0; padding: 8px; }
#layoutSettings small { display: block; margin-bottom: 8px; }
#lookDialog { max-height: 94vh; }
@media (max-width: 900px) { .grip-sideW, .grip-railW { display: none; } .movable { cursor: auto; touch-action: auto; } }
@media (max-width: 640px) {
  #app, #app[data-people] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chat"; }
  #rail, #side { display: none; }
  #app.nav, #app.nav[data-people] { grid-template-columns: 68px minmax(0, 1fr); grid-template-areas: "rail side"; }
  #app.nav #rail, #app.nav #side { display: flex; }
  #app.nav #chat { display: none; }
  #menu { display: inline-block; }
}
dialog { background: var(--side); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(420px, calc(100% - 32px)); }
dialog label { display: block; margin-bottom: 8px; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 12px 0 0; }


/* редактор гифки */
#gifDialog { width: min(720px, calc(100% - 16px)); }
#gifViews { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
#gifViews figure { margin: 0; min-width: 0; text-align: center; }
#gifViews canvas { max-width: 100%; max-height: 32vh; border-radius: 6px; background: repeating-conic-gradient(#8884 0 25%, #8881 0 50%) 0 0 / 16px 16px; }
#gifSource { cursor: crosshair; touch-action: none; }
#gifViews figcaption { font-size: 12px; margin-top: 4px; }
.gifRow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.gifRow span { margin-right: auto; font-size: 13px; }
.gifGrid, #gifTrim { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 10px; margin-top: 10px; }
.gifGrid[hidden], #gifTrim[hidden], #gifToleranceRow[hidden] { display: none; }
#gifDialog { max-height: 94vh; }
#gifDialog label.gifCheck { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
#gifDialog input[type=checkbox] { width: auto; margin: 0; }
#gifDialog select:disabled { opacity: 0.5; }
.msg .stickerfile img { width: 200px; height: auto; max-width: 100%; background: none; border: 0; border-radius: 0; }
#pickerBody .grid.own button img { width: 96px; height: 96px; object-fit: contain; background: none; }
#gifTrim input[type=range] { width: 100%; padding: 0; border: 0; background: none; accent-color: var(--accent); }
#gifSend { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#gifSend:disabled { opacity: 0.5; }
@media (max-width: 520px) { #gifViews canvas { max-height: 22vh; } }
/* полосы прокрутки: тонкие, в цвет темы (--sep), как трубка разделителя; при наведении сдвигаются к акценту */
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--sep) transparent; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { min-height: 36px; min-width: 36px; border: 2px solid transparent; border-radius: 8px; background-clip: padding-box;
  background-color: var(--sep);
  background-image: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.22), rgba(0,0,0,.28)); }
::-webkit-scrollbar-thumb:horizontal { background-image: linear-gradient(180deg, rgba(0,0,0,.28), rgba(255,255,255,.22), rgba(0,0,0,.28)); }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: color-mix(in srgb, var(--sep) 55%, var(--accent)); }
/* ответы и упоминания */
.msg .replyref { color: var(--dim); font-size: 13px; cursor: pointer; border-left: 3px solid var(--line); padding-left: 8px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .replyref:hover { color: var(--text); border-color: var(--accent); }
.msg .replyref.gone { cursor: default; font-style: italic; }
.msg .replyref b { color: var(--text); font-weight: 600; }
.msg .mention { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.msg.pinged { background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 3px 0 0 var(--accent); padding-left: 6px; border-radius: 4px; }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 28%, transparent); } 100% { background: transparent; } }
#replyBar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--side); border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
#replyBar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#replyBar button { padding: 0 8px; font-size: 16px; }
#composer { position: relative; }
#mentionList { position: absolute; left: 12px; bottom: 100%; z-index: 6; min-width: 200px; max-width: calc(100% - 24px); background: var(--side); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
#mentionList button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; color: var(--text); text-align: left; padding: 5px 8px; font-weight: 500; }
#mentionList button.on, #mentionList button:hover { background: var(--line); }
#mentionList .ava { width: 22px; height: 22px; font-size: 11px; }
.badge { flex: none; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 1; }
.badge.ping { background: #e5484d; color: #fff; padding: 3px 6px; margin-left: 6px; }
.badge.dot { width: 8px; height: 8px; background: var(--accent); margin-left: 6px; display: inline-block; }
.channel .open { position: relative; padding-right: 28px; }
.channel .open .badge { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); margin: 0; }
#servers button { position: relative; }
#servers button .badge { position: absolute; right: -4px; bottom: -4px; margin: 0; }
#app[data-rail=wide] #servers button .badge { position: static; margin-left: auto; }
/* быстрый переход и поиск */
#palette { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
#palette[hidden] { display: none; }
#paletteBox { width: min(640px, calc(100% - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--side); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); overflow: hidden; }
#paletteInput { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 14px 16px; font-size: 16px; }
#paletteInput:focus { outline: none; }
#paletteList { overflow-y: auto; padding: 6px; min-height: 40px; }
#paletteList h4 { margin: 8px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
#paletteList .item, #paletteList .back { display: flex; align-items: flex-start; gap: 10px; width: 100%; background: none; color: var(--text); text-align: left; padding: 7px 10px; border-radius: 8px; font-weight: 500; }
#paletteList .back { color: var(--dim); }
#paletteList .item.on, #paletteList .item:hover, #paletteList .back:hover { background: var(--line); }
#paletteList .ico { flex: none; width: 22px; text-align: center; }
#paletteList .txt { min-width: 0; display: flex; flex-direction: column; }
#paletteList .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#paletteList .sub { color: var(--dim); font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
#paletteList mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; }
#paletteList .empty { color: var(--dim); padding: 10px; margin: 0; }
#paletteHint { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
#detachedBar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: color-mix(in srgb, var(--accent) 14%, var(--side)); border-bottom: 1px solid var(--line); font-size: 13px; }
#detachedBar[hidden] { display: none; }
#detachedBar span { flex: 1; }
/* временные комнаты */
#roomTools { padding: 4px 10px 8px; }
#roomTools button { width: 100%; background: none; border: 1px dashed var(--line); color: var(--dim); }
#roomTools button:hover { color: var(--text); border-color: var(--accent); }
/* кнопки сервера внизу списка каналов */
#serverTools { display: flex; gap: 6px; padding: 0 10px 8px; }
#serverTools button { flex: 1; font-size: 12px; padding: 5px 6px; background: none; border: 1px solid var(--line); color: var(--dim); }
#serverTools button:hover { color: var(--text); border-color: var(--accent); }
#deleteServer:hover { color: var(--bad) !important; border-color: var(--bad) !important; }

/* анимация появления окон и панелей */
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
dialog[open] { animation: pop .2s cubic-bezier(.2, .9, .3, 1.1); }
dialog[open]::backdrop { animation: fade .2s ease-out; }
#palette:not([hidden]) { animation: fade .15s ease-out; }
#palette:not([hidden]) #paletteBox { animation: pop .2s cubic-bezier(.2, .9, .3, 1.1); }
#picker:not([hidden]) { animation: rise .18s ease-out; }
#mentionList:not([hidden]) { animation: rise .12s ease-out; }
#replyBar:not([hidden]), #detachedBar:not([hidden]) { animation: drop .15s ease-out; }
#voiceBar:not([hidden]), #stage:not([hidden]) { animation: rise .2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop, #palette:not([hidden]), #palette:not([hidden]) #paletteBox, #picker:not([hidden]), #mentionList:not([hidden]),
  #replyBar:not([hidden]), #detachedBar:not([hidden]), #voiceBar:not([hidden]), #stage:not([hidden]) { animation: none; }
}
/* справка */
#helpDialog { width: min(780px, calc(100% - 24px)); height: min(80vh, 760px); padding: 0; overflow: hidden; }
#helpDialog[open] { display: flex; flex-direction: column; }
#helpHead { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#helpHead strong { flex: 1; font-size: 17px; }
#helpTabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
#helpTabs button { background: none; border: 1px solid var(--line); color: var(--dim); }
#helpTabs button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
#helpBody { flex: 1; overflow-y: auto; padding: 4px 18px 18px; line-height: 1.5; }
#helpBody h2 { margin: 22px 0 0; font-size: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
#helpBody h3 { margin: 18px 0 6px; font-size: 15px; color: var(--accent); }
#helpBody ul { margin: 0; padding-left: 20px; }
#helpBody li { margin: 5px 0; overflow-wrap: anywhere; }
/* вид сообщений (настройки ⚙ «Вид сообщений»; хранится в браузере) */
:root { --mine: var(--accent); --bubble-sat: 38%; --bubble-light: 26%; }
:root[data-theme=light] { --bubble-sat: 70%; --bubble-light: 91%; }
:root[data-minecolor=green] { --mine: #3ccf8e; }
:root[data-minecolor=blue] { --mine: #5aa9ff; }
:root[data-minecolor=orange] { --mine: #ffa24d; }
:root[data-minecolor=pink] { --mine: #ff7ab6; }
:root[data-minecolor=yellow] { --mine: #ffd24a; }
:root[data-theme=light][data-minecolor=green] { --mine: #0f7a53; }
:root[data-theme=light][data-minecolor=blue] { --mine: #1d5fd0; }
:root[data-theme=light][data-minecolor=orange] { --mine: #a85400; }
:root[data-theme=light][data-minecolor=pink] { --mine: #b81e6e; }
:root[data-theme=light][data-minecolor=yellow] { --mine: #8a6500; }

:root:not([data-bubbles=off]) .msg { padding: 5px 0; }
:root:not([data-bubbles=off]) .msg .text { flex: 0 1 auto; max-width: min(80%, 680px); padding: 7px 14px 9px; border-radius: 18px; border-top-left-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
:root[data-bubbles=colors] .msg .text { background: hsl(var(--hue) var(--bubble-sat) var(--bubble-light) / .75); }

:root[data-others=right] .msg:not(.mine) { flex-direction: row-reverse; }
:root[data-others=right] .msg:not(.mine) .text { text-align: right; }
:root[data-others=right] .msg:not(.mine) .meta { justify-content: flex-end; }
:root[data-others=right]:not([data-bubbles=off]) .msg:not(.mine) .text { border-top-left-radius: 18px; border-top-right-radius: 6px; }
:root[data-others=right] .msg:not(.mine) .replyref { border-left: 0; border-right: 3px solid var(--line); padding-left: 0; padding-right: 8px; }

:root[data-mine=color] .msg.mine .body, :root[data-mine=both] .msg.mine .body { color: var(--mine); }
:root[data-mine=bold] .msg.mine .body, :root[data-mine=both] .msg.mine .body { font-weight: 700; }
:root[data-mine=color]:not([data-bubbles=off]) .msg.mine .text, :root[data-mine=both]:not([data-bubbles=off]) .msg.mine .text { background: color-mix(in srgb, var(--mine) 20%, var(--bg)); }
:root[data-mine=color]:not([data-bubbles=off]) .msg.mine .body, :root[data-mine=both]:not([data-bubbles=off]) .msg.mine .body { color: var(--text); }
#messageLook { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 0; padding: 8px; }
/* свой участник и цвет шарика в списках */
.swatch { display: none; flex: none; width: 10px; height: 10px; border-radius: 50%; margin-left: auto; background: hsl(var(--hue) 70% 55%); box-shadow: 0 0 0 2px var(--side); }
:root[data-bubbles=colors] .swatch { display: inline-block; }
#members li button, .inside li button { display: flex; align-items: center; gap: 8px; }
#members li.me, .inside li.me { background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 8px; box-shadow: inset 3px 0 0 var(--accent); }
#members li.me .label > span:first-child, .inside li.me button > span:not(.swatch) { font-weight: 700; }
#members li button .label { flex: 1; min-width: 0; }
/* закрытие окон с анимацией (anim.js, палитра Ctrl+K, меню участника) */
@keyframes popOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
dialog[open].closing { animation: popOut .16s ease-in forwards; }
dialog[open].closing::backdrop { animation: fadeOut .16s ease-in forwards; }
#palette.closing { animation: fadeOut .16s ease-in forwards; }
#palette.closing #paletteBox { animation: popOut .16s ease-in forwards; }
@media (prefers-reduced-motion: reduce) {
  dialog[open].closing, dialog[open].closing::backdrop, #palette.closing, #palette.closing #paletteBox { animation: none; }
}

/* кто говорит: подсветка в списках (сверху и справа) */
#members li.speaking .ava, .inside li.speaking .ava { box-shadow: 0 0 0 2px var(--accent), 0 0 9px 1px var(--accent); }
#members li.speaking .label > span:first-child, .inside li.speaking button > span:not(.swatch) { color: var(--accent); font-weight: 700; }
.ava { transition: box-shadow .12s ease-out; }

/* меню участника по правой кнопке */
#memberMenu { position: fixed; z-index: 40; width: 250px; padding: 6px; background: var(--side); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: pop .14s cubic-bezier(.2, .9, .3, 1.1); }
#memberMenu[hidden] { display: none; }
#memberMenu.closing { animation: popOut .12s ease-in forwards; }
#memberMenu .who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
#memberMenu .who span { display: flex; flex-direction: column; min-width: 0; }
#memberMenu .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#memberMenu .who small, #memberMenu .note { color: var(--dim); }
#memberMenu .note { margin: 4px 8px 6px; font-size: 12px; }
#memberMenu .vol { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; }
#memberMenu .vol input { padding: 0; border: 0; background: none; accent-color: var(--accent); min-width: 0; }
#memberMenu button { display: block; width: 100%; text-align: left; background: none; color: var(--text); padding: 7px 10px; border-radius: 6px; font-weight: 500; }
#memberMenu button:hover { background: var(--line); }
@media (prefers-reduced-motion: reduce) { #memberMenu, #memberMenu.closing { animation: none; } }
/* готовые картинки профиля */
#avatarPresets { margin: 4px 0 10px; }
#avatarPresets summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
#avatarPresetList h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
#avatarPresetList .presetRow { display: flex; flex-wrap: wrap; gap: 6px; }
#avatarPresetList button { padding: 0; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--line); border: 2px solid transparent; }
#avatarPresetList button.on, #avatarPresetList button:hover { border-color: var(--accent); }
#avatarPresetList img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* значки микрофона и наушников справа от человека в голосе */
.vstate { display: inline-flex; gap: 4px; margin-left: auto; flex: none; align-items: center; }
.vstate + .swatch { margin-left: 6px; }
.vi { position: relative; display: inline-flex; color: var(--dim); }
.vi.off { color: #ef5350; }
.vi .slash { stroke-width: 2.4; }
.vi.mod::after { content: "🛡"; position: absolute; right: -7px; bottom: -6px; font-size: 9px; line-height: 1; }
/* роли и права канала */
#rolesBody { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-height: 50vh; overflow-y: auto; }
.roleRow { display: flex; align-items: center; gap: 8px; }
.roleRow input[type=text] { flex: 1; min-width: 0; }
.roleRow input[type=color] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--line); background: none; flex: none; }
.roleRow small { color: var(--dim); white-space: nowrap; }
.roleRow.add { border-top: 1px solid var(--line); padding-top: 10px; }
.roleBox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.roleBox > small { flex-basis: 100%; color: var(--dim); }
.roleCheck { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.roleCheck input { width: auto; margin: 0; }
.chip { border: 1px solid; border-radius: 99px; padding: 1px 10px; font-size: 13px; }
#permsBody { margin: 10px 0; max-height: 55vh; overflow-y: auto; }
.permRow { display: grid; grid-template-columns: minmax(110px, 1.4fr) repeat(auto-fit, minmax(64px, 1fr)); gap: 6px 8px; align-items: center; padding: 4px 0; }
.permRow.head small { color: var(--dim); text-align: center; }
.permRow select { width: 100%; margin: 0; }
/* появление новых сообщений: только у только что пришедших (app.js, .fresh) */
@keyframes msgIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes msgInRight { from { opacity: 0; transform: translateX(18px) scale(.97); } to { opacity: 1; transform: none; } }
.msg.fresh { animation: msgIn .3s cubic-bezier(.2, .9, .3, 1.1); transform-origin: left bottom; }
:root[data-others=right] .msg.fresh:not(.mine) { animation-name: msgInRight; transform-origin: right bottom; }
@media (prefers-reduced-motion: reduce) { .msg.fresh { animation: none; } }
/* опросы */
.poll { display: flex; flex-direction: column; gap: 6px; min-width: min(320px, 100%); max-width: 460px; }
.poll .q { font-weight: 700; overflow-wrap: anywhere; }
.poll .opt { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 7px 12px; border-radius: 10px; background: var(--line); overflow: hidden; font-weight: 500; color: var(--text); border: 1px solid transparent; }
.poll .opt i { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 28%, transparent); transition: width .35s ease-out; }
.poll .opt .t, .poll .opt .n { position: relative; }
.poll .opt .t { overflow-wrap: anywhere; }
.poll .opt .n { color: var(--dim); font-size: 12px; white-space: nowrap; }
.poll .opt.mine { border-color: var(--accent); }
.poll .opt:disabled { cursor: default; opacity: .85; }
.poll .foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.poll .foot small { color: var(--dim); }
.poll .foot button { font-size: 12px; padding: 2px 8px; }
:root[data-others=right] .msg:not(.mine) .poll { margin-left: auto; text-align: left; }
@media (prefers-reduced-motion: reduce) { .poll .opt i { transition: none; } }
/* каналы с новыми сообщениями: жирное название, полоса слева; с упоминанием — красная */
.channel.unread .open { font-weight: 700; color: var(--text); box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 6px; }
.channel.unread.mention .open { box-shadow: inset 3px 0 0 #e5484d; background: color-mix(in srgb, #e5484d 12%, transparent); }
.channel.active.unread .open { background: var(--line); }
/* наклейка-картинка (добавлена или заменена админом) */
.sticker .sticker-img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 2px; }
/* регистрация: отметки согласий */
.agree { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 13px; line-height: 1.4; }
.agree input { width: auto !important; margin: 3px 0 0 !important; flex: none; }
.agree a { color: var(--accent); }
#agreeDialog { width: min(440px, calc(100% - 24px)); }
#agreeForm { display: flex; flex-direction: column; gap: 8px; }
