
        /* ============================ POLISH: icons, pickers, save bar, hints ============================ */
        svg.ic, .icon-btn svg.ic { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; fill: none; }
        .snav .ic { width: 17px; height: 17px; opacity: .85; }
        .snav.active .ic { opacity: 1; }
        .ctx-ico svg.ic { width: 16px; height: 16px; }
        .ch-ic { display: inline-flex; vertical-align: -3px; margin-inline-end: 4px; opacity: .65; }
        .ch-ic .ic { width: 15px; height: 15px; }
        .icon-btn .ic { width: 18px; height: 18px; }
        .msg-tools .icon-btn .ic { width: 17px; height: 17px; }

        /* save bar: only slides in after something changed */
        .savebar.dirty-bar { position: sticky; bottom: 16px; transform: translateY(140%); opacity: 0; pointer-events: none; transition: transform .2s ease, opacity .2s ease; }
        .savebar.dirty-bar { z-index: 20; }
        .savebar.dirty-bar.show { transform: none; opacity: 1; pointer-events: auto; }
        .savebar.dirty-bar.shake { animation: sb-shake .35s; }
        @keyframes sb-shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

        /* hints & errors: one slim line above the bottom edge, never a corner pop-up */
        .msg-pin .ic { width: 14px; height: 14px; color: var(--muted); }
        #toast-container { top: auto; right: auto; left: 50%; bottom: 96px; transform: translateX(-50%); align-items: center; }
        :root[dir="rtl"] #toast-container { left: 50%; right: auto; }
        #toast-container .toast-item { max-width: min(560px, 92vw); padding: 8px 14px; font-size: 12.5px; }
        @media (prefers-reduced-motion: no-preference) { #toast-container .toast-item { animation: hint-in .18s ease-out; } }
        @keyframes hint-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

        /* file pickers: a drop zone instead of the browser's "Choose file" */
        .fpick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--border-focus); border-radius: 6px; background: var(--bg-0); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; min-height: 58px; width: 100%; text-align: start; font: inherit; }
        .fpick:hover, .fpick:focus-visible, .fpick.over { border-color: var(--accent); background: var(--accent-bg); outline: none; }
        .fpick .fp-ic { width: 36px; height: 36px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; overflow: hidden; }
        .fpick .fp-ic img { width: 100%; height: 100%; object-fit: cover; }
        .fpick .fp-t { font-weight: 700; color: var(--bright); font-size: 13px; }
        .fpick .fp-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
        .fpick .fp-name { color: var(--accent-hi, var(--accent)); }
        .fpick.busy { pointer-events: none; opacity: .7; }
        .fpick.busy .fp-ic { animation: fp-pulse 1s infinite; }
        @keyframes fp-pulse { 50% { opacity: .4; } }
        .fpick.compact { min-height: 0; padding: 8px 12px; max-width: 280px; }
        .fpick.compact .fp-ic { width: 28px; height: 28px; }
        body.uploading .fpick { pointer-events: none; opacity: .6; } body.uploading { cursor: progress; }

        /* profile editor */
        .pe-card { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-1); padding: 14px 16px; margin-bottom: 14px; }
        .pe-card > .pe-h { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
        .pe-card .field-group:last-child { margin-bottom: 0; }
        .fld-head { display: flex; justify-content: space-between; align-items: baseline; }
        .fld-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
        .fld-count.warn { color: var(--yellow, #f0b232); }
        .media-row { display: flex; align-items: center; gap: 14px; }
        .media-row .media-av { width: 72px; height: 72px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--border); flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; }
        .media-row .media-av img, .media-bn img, .media-av .mv, .media-bn .mv { width: 100%; height: 100%; object-fit: cover; }
        .av-vid, .bn-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; }
        .media-bn { height: 72px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-3); overflow: hidden; margin-bottom: 10px; }
        .media-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
        .linkalt { margin-top: 10px; font-size: 12px; color: var(--muted); }
        .linkalt summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
        .linkalt summary::-webkit-details-marker { display: none; }
        .linkalt summary:hover { color: var(--text); }
        .linkalt[open] summary { margin-bottom: 8px; }

        /* image viewer */
        #img-viewer { position: fixed; inset: 0; z-index: 100010; background: rgba(4,5,7,.92); display: none; flex-direction: column; }
        #img-viewer.open { display: flex; }
        #img-viewer .iv-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--text); font-size: 12.5px; }
        #img-viewer .iv-bar .iv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        #img-viewer .iv-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: zoom-in; touch-action: none; }
        #img-viewer .iv-stage.zoomed { cursor: grab; }
        #img-viewer .iv-stage.zoomed.drag { cursor: grabbing; }
        #img-viewer img { max-width: 94vw; max-height: calc(100vh - 70px); object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; }
        .chat-attachment-img { cursor: zoom-in; }

        /* audio / video / voice messages */
        .att-audio, .att-video { margin-top: 6px; max-width: 420px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-1); }
        .att-audio { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
        .att-audio audio { flex: 1; min-width: 0; height: 32px; }
        .att-audio .att-k { color: var(--accent); display: flex; }
        .att-video video { display: block; width: 100%; max-height: 320px; border-radius: 6px; background: #000; }
        .vm-play { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent-bg); color: var(--bright); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
        .vm-play .ic { width: 15px; height: 15px; }
        .vm-bars { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; min-width: 120px; cursor: pointer; }
        .vm-bars i { flex: 1; background: var(--border-focus); border-radius: 1px; min-height: 3px; }
        .vm-bars i.on { background: var(--accent); }
        .vm-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: end; }
        #rec-bar { display: none; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--red); border-radius: 6px; background: rgba(242,63,67,.08); color: var(--bright); font-size: 13px; }
        #rec-bar.show { display: flex; }
        #rec-bar .rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: fp-pulse 1s infinite; }
        #rec-bar .rec-time { font-variant-numeric: tabular-nums; flex: 1; }
        #btn-voice-msg.recording { color: var(--red); }

        /* keyboard shortcuts */
        .kb-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; font-size: 13px; }
        .kb-grid .kb-k { display: flex; gap: 4px; justify-content: flex-end; }
        kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--border-focus); border-bottom-width: 2px; border-radius: 3px; background: var(--bg-0); color: var(--bright); }
        .perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-0); margin: 10px 0 4px; font-size: 13px; color: var(--bright); }
        .perm-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
        .kb-group { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 12px 4px 6px; }
        .kb-group:first-child { padding-top: 2px; }
        .kb-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-top: 1px solid var(--border); }
        .kb-row > span { flex: 1; color: var(--bright); font-size: 13px; }
        .kb-bind { min-width: 150px; display: inline-flex; gap: 4px; justify-content: center; align-items: center; padding: 6px 10px; border: 1px solid var(--border-focus); border-radius: 4px; background: var(--bg-0); cursor: pointer; color: var(--text); font: inherit; }
        .kb-bind:hover { border-color: var(--accent); }
        .kb-bind.capturing { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 2px var(--accent-bg); }
        .kb-none { font-size: 11.5px; color: var(--muted); }
        .kb-reset[disabled] { opacity: .25; pointer-events: none; }
        .kb-reset .ic { width: 15px; height: 15px; }
        .main.stage-split { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 36%, 400px); grid-template-rows: auto minmax(0, 1fr); }
        .main.stage-split > .main-header { grid-column: 1 / -1; }
        .main.stage-split > #voice-call-screen { grid-column: 1; grid-row: 2; min-height: 0; }
        .main.stage-split > #chat-view { grid-column: 2; grid-row: 2; min-height: 0; border-inline-start: 1px solid var(--border); background: var(--bg-1); }
        @media (max-width: 860px) { .main.stage-split { grid-template-columns: minmax(0, 1fr) clamp(240px, 42%, 340px); } }
        @media (max-width: 560px) { .main.stage-split { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) 45%; } .main.stage-split > #chat-view { grid-column: 1; grid-row: 3; border-inline-start: 0; border-top: 1px solid var(--border); } }
        #landing { position: fixed; inset: 0; z-index: 99996; overflow: auto; background: #000000 radial-gradient(circle at 50% -10%, #14224d 0%, #000000 62%); color: #e5e7eb; padding: 0 20px 40px; }
        #landing[hidden] { display: none; }
        .ld-top { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 12px; }
        .ld-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; } .ld-brand b { color: #fff; } .ld-brand span { color: #7fa2ff; font-size: 17px; }
        .ld-top-r { display: flex; gap: 10px; align-items: center; }
        .ld-ghost, .ld-lang { background: transparent; color: #e5e7eb; border: 1px solid #5a5a5e; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; cursor: pointer; }
        .ld-ghost:hover, .ld-lang:hover { border-color: #7fa2ff; color: #fff; }
        .ld-hero { max-width: 880px; margin: 7vh auto 0; text-align: center; }
        .ld-hero h1 { font-size: clamp(30px, 6vw, 56px); line-height: 1.12; margin: 0 0 16px; color: #fff; letter-spacing: -.5px; }
        .ld-lead { font-size: clamp(15px, 2.2vw, 19px); color: #a7adbb; max-width: 640px; margin: 0 auto 30px; line-height: 1.6; }
        .ld-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
        .ld-main, .ld-web { display: inline-flex; align-items: center; gap: 10px; border-radius: 999px; padding: 15px 28px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none; border: 0; }
        .ld-main { background: #fff; color: #111; } .ld-main:hover { background: #e6edff; }
        .ld-main .ic { width: 20px; height: 20px; }
        .ld-web { background: #3f66e0; color: #fff; } .ld-web:hover { background: #5278f0; }
        .ld-main.off { opacity: .55; pointer-events: none; }
        .ld-main.ld-sec { background: rgba(255,255,255,.08); color: #e6e8ee; font-weight: 600; padding: 12px 22px; font-size: 14px; } .ld-main.ld-sec:hover { background: rgba(255,255,255,.14); }
        .ld-main[hidden] { display: none; }
        .ld-others { margin-top: 18px; font-size: 13px; color: #8b91a1; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
        .ld-others a { color: #a9bfff; text-decoration: none; } .ld-others a:hover { text-decoration: underline; }
        .ld-safe { margin: 10px auto 0; max-width: 520px; font-size: 12.5px; line-height: 1.5; color: #9aa1b2; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px 14px; text-align: start; }
        .ld-safe b { color: #e6e8ee; }
        .ld-all-wrap { max-width: 760px; margin: 34px auto 0; }
        .ld-all-wrap h2 { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #8b91a1; margin: 0 0 12px; }
        .ld-all { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
        .ld-pl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; box-sizing: border-box; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid #272a35; color: #e6e8ee; text-decoration: none; text-align: start; transition: border-color .15s, background .15s; }
        .ld-pl:hover { border-color: #7fa2ff; background: rgba(91,134,245,.08); }
        .ld-pl.on { border-color: #7fa2ff; box-shadow: 0 0 0 1px #7fa2ff; }
        .ld-pl .ic { width: 22px; height: 22px; flex: none; color: #7fa2ff; }
        .ld-pl span { display: flex; flex-direction: column; min-width: 0; }
        .ld-pl b { font-size: 14px; color: #fff; } .ld-pl small { font-size: 12px; color: #9aa1b1; }
        .ld-pl.off { opacity: .5; cursor: default; } .ld-pl.off:hover { border-color: #272a35; background: rgba(255,255,255,.04); }
        .ld-note { margin-top: 8px; font-size: 12px; color: #7b8190; min-height: 16px; }
        .ld-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 64px; text-align: start; }
        .ld-card { background: rgba(255,255,255,.04); border: 1px solid #272a35; border-radius: 14px; padding: 20px; }
        .ld-card .ic { width: 26px; height: 26px; color: #7fa2ff; margin-bottom: 10px; }
        .ld-card b { display: block; color: #fff; font-size: 16px; margin-bottom: 6px; } .ld-card small { color: #9aa1b1; font-size: 13.5px; line-height: 1.55; display: block; }
        @media (max-width: 760px) { .ld-cards { grid-template-columns: 1fr; margin-top: 40px; } .ld-ghost { display: none; } .ld-main, .ld-web { width: 100%; justify-content: center; } 
            .ld-hero { margin-top: 3vh; } .ld-lead { margin-bottom: 20px; } .ld-main, .ld-web { padding: 12px 20px; }
            .ld-all-wrap { margin-top: 22px; } .ld-all { grid-template-columns: 1fr 1fr; gap: 8px; } .ld-pl { padding: 10px 12px; gap: 10px; }
            .ld-cards { gap: 8px; margin-top: 22px; } .ld-card { display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; padding: 12px 14px; } .ld-card .ic { grid-row: 1 / 3; margin: 2px 0 0; } .ld-card b, .ld-card small { grid-column: 2; } .ld-card b { margin-bottom: 2px; font-size: 15px; } .ld-card small { font-size: 12.5px; line-height: 1.45; } }
        .golive { width: min(920px, 96vw); max-width: 96vw; position: relative; padding: 16px; }
        .gl-tabs { display: flex; gap: 6px; background: var(--bg-0); border: 1px solid var(--border); border-radius: 10px; padding: 5px; margin-bottom: 14px; }
        .gl-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 8px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
        .gl-tab .ic { width: 17px; height: 17px; }
        .gl-tab:hover { color: var(--text); }
        .gl-tab.on { background: var(--bg-3); color: var(--bright); }
        .gl-body { max-height: min(56vh, 520px); overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 2px; align-content: start; }
        .gl-item { position: relative; display: flex; flex-direction: column; gap: 7px; min-width: 0; text-align: start; }
        .gl-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--bg-0); border: 2px solid transparent; display: flex; align-items: center; justify-content: center; }
        .gl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
        .gl-thumb > .ic { width: 38px; height: 38px; color: var(--muted); }
        .gl-item:hover .gl-thumb, .gl-item:focus-within .gl-thumb { border-color: var(--border-focus); }
        .gl-share { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; background: #fff; color: #111; border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; opacity: 0; transition: opacity .12s; white-space: nowrap; }
        .gl-item:hover .gl-share, .gl-item:focus-within .gl-share { opacity: 1; }
        .gl-thumb::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .12s; pointer-events: none; }
        .gl-item:hover .gl-thumb::after { background: rgba(0,0,0,.42); }
        .gl-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--bright); min-width: 0; }
        .gl-label img, .gl-label .ic { width: 20px; height: 20px; flex-shrink: 0; }
        .gl-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .gl-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13.5px; line-height: 1.6; }
        .gl-empty .btn { margin-top: 12px; }
        .gl-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
        .gl-mode { flex: 1; min-width: 0; }
        .gl-mode b { display: block; font-size: 16px; color: var(--bright); }
        .gl-mode small { color: var(--muted); font-size: 12.5px; }
        .gl-gear { width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--bg-3); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .gl-gear .ic { width: 20px; height: 20px; }
        .gl-gear:hover, .gl-gear.on { background: var(--bg-4); color: var(--bright); }
        .gl-menu { position: absolute; inset-inline-end: 16px; bottom: 76px; width: 330px; max-width: calc(100% - 32px); background: var(--bg-1); border: 1px solid var(--border-focus); border-radius: 12px; padding: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.5); z-index: 5; }
        .gl-menu[hidden] { display: none; }
        .gl-m-h { padding: 8px 12px 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
        .gl-m-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--bright); font-size: 14px; font-weight: 600; }
        .gl-m-row small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }
        .gl-m-row > div { flex: 1; min-width: 0; }
        .gl-m-row:hover, .gl-m-row.open { background: var(--bg-3); }
        .gl-m-row .ic { width: 16px; height: 16px; color: var(--muted); }
        :root[dir="rtl"] .gl-m-row .ic { transform: scaleX(-1); }
        .gl-m-sep { height: 1px; background: var(--border); margin: 6px 4px; }
        .gl-radio, .gl-check { width: 22px; height: 22px; flex-shrink: 0; border: 2px solid var(--muted); display: flex; align-items: center; justify-content: center; }
        .gl-radio { border-radius: 50%; } .gl-check { border-radius: 5px; }
        .gl-radio.on { border-color: var(--accent); background: var(--accent); } .gl-radio.on::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
        .gl-check.on { border-color: var(--accent); background: var(--accent); } .gl-check .ic { width: 14px; height: 14px; color: #fff; }
        .stream-quality-badges { max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: flex-end; }
        @media (max-width: 560px) { .stream-quality-badges { top: 6px; right: 6px; max-width: calc(100% - 12px); font-size: 10px; } .stream-action-badge { padding: 5px 8px; } }
        .gl-sub { margin: 2px 0 6px; padding: 4px; background: var(--bg-2); border-radius: 8px; }
        .gl-menu { max-height: min(78vh, calc(100% - 92px)); overflow-y: auto; overscroll-behavior: contain; }
        .gl-menu::-webkit-scrollbar { width: 6px; } .gl-menu::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
        @media (max-width: 760px) { .gl-body { grid-template-columns: 1fr; } .gl-tab span { display: none; } .golive { padding: 12px; } }
        @media (hover: none) { .gl-share { opacity: 1; } }

        #stage-screen-slot.multi .screen-card { min-height: 0; flex: none; aspect-ratio: 16 / 9; max-height: 46vh; }
        #stage-screen-slot.multi .screen-video { max-height: 46vh; }
        #multi-streams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin-top: 8px; }
        .ms-card { position: relative; background: #000; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; cursor: pointer; }
        .ms-card video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
        .ms-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 12px; }
        .ms-bar b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .ms-bar span { display: inline-flex; align-items: center; gap: 6px; }
        .ms-bar button { background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 6px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
        .ms-live { background: var(--red); border-radius: 4px; padding: 1px 5px; font-size: 10px; font-weight: 800; }
        .ms-all { align-self: flex-start; }
        #stream-invites { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
        .stream-invite { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-1); }
        .stream-invite .si-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
        .stream-invite .si-t b { color: var(--bright); }
        .stream-invite .si-t span { color: var(--muted); font-size: 12px; }
        .badge-viewers { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-left: 1px solid var(--border); color: #fff; cursor: default; }
        .badge-viewers .ic { width: 14px; height: 14px; }
        #sub-item-list [draggable="true"] { -webkit-user-drag: element; }
        #sub-item-list .dragging { opacity: .45; }
        #sub-item-list .drop-before { box-shadow: inset 0 2px 0 var(--accent); }
        #sub-item-list .drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
        #sub-item-list .drop-into { outline: 1px dashed var(--accent); outline-offset: -1px; background: var(--accent-bg); }
        .vs-view { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
        .vs-view .ic { width: 13px; height: 13px; }
        .vs-live[data-watch], .tile-watch { cursor: pointer; border: 0; font-family: inherit; }
        .vs-live[data-watch]:hover, .tile-watch:hover { filter: brightness(1.15); }
        /* voice channel row tools + status, as expected */
        .vc-tools { display: none; align-items: center; gap: 2px; margin-inline-start: auto; }
        .channel-item:focus-within .vc-tools { display: inline-flex; }
        .vc-time { margin-inline-start: auto; font-size: 12px; color: var(--green); font-variant-numeric: tabular-nums; font-family: var(--font); }
        .channel-item:focus-within .vc-time { display: none; }
        @media (hover: hover) { .channel-item:hover .vc-tools { display: inline-flex; } .channel-item:hover .vc-time { display: none; } }
        /* touch: the tools are simply there (a hover that reveals them made the first tap on a voice channel do nothing on iPad) */
        @media (hover: none) { .vc-tools { display: inline-flex; } .channel-item .vc-time { display: none; } }
        .vc-tool { display: inline-flex; padding: 2px; color: var(--muted); cursor: pointer; border-radius: 3px; }
        .vc-tool:hover { color: var(--bright); }
        .vc-tool .ic { width: 15px; height: 15px; }
        .vc-status { padding: 2px 8px 5px 34px; font-size: 12.5px; line-height: 1.4; min-height: 20px; color: var(--text); opacity: .75; display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .vc-status:hover { opacity: 1; }
        .vc-status .ic { width: 12px; height: 12px; flex-shrink: 0; }
        :root[dir="rtl"] .vc-status { padding: 2px 34px 5px 8px; }

        /* ---- Macanc colour picker (replaces the phone's own dialog, which flips in Arabic) ---- */
        .mc-cp-back { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.35); direction: ltr; }
        .mc-cp { position: fixed; z-index: 100001; width: 272px; max-width: calc(100vw - 24px); padding: 12px; border-radius: 10px; background: var(--bg-2, #1c1d24); border: 1px solid var(--border, rgba(255,255,255,.12)); box-shadow: 0 12px 40px rgba(0,0,0,.55); direction: ltr; text-align: left; color: var(--text, #ddd); font-size: 13px; }
        .mc-cp * { box-sizing: border-box; }
        .mc-cp-sv { position: relative; height: 150px; border-radius: 6px; cursor: crosshair; touch-action: none; background: linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, rgba(255,255,255,0)); }
        .mc-cp-hue { position: relative; height: 16px; margin: 12px 0; border-radius: 8px; cursor: pointer; touch-action: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
        .mc-cp-knob { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.5); pointer-events: none; }
        .mc-cp-hue .mc-cp-knob { top: 50%; }
        .mc-cp-row { display: flex; gap: 8px; align-items: center; }
        .mc-cp-prev { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border, rgba(255,255,255,.2)); flex: 0 0 auto; }
        .mc-cp-hex { flex: 1; min-width: 0; text-transform: uppercase; font-family: monospace; }
        .mc-cp-sw { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
        .mc-cp-sw button { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); cursor: pointer; }
        .mc-cp-act { display: flex; gap: 8px; justify-content: flex-end; }
        @media (max-width: 600px) { .mc-cp { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; max-width: none; } .mc-cp-sv { height: 180px; } .mc-cp-sw button { width: 28px; height: 28px; } }
        /* ---- less scrolling: use the width on big screens, tighter spacing on small ones ---- */
        .pe-card { padding: 12px 14px; margin-bottom: 12px; }
        .pk-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
        .srow { padding: 10px 0; }
        @media (min-width: 1500px) {
            .settings-content { max-width: 1280px; }
            #sp-profile .profile-edit-grid > div:first-child { columns: 2; column-gap: 20px; }
            #sp-profile .profile-edit-grid > div:first-child > * { break-inside: avoid; }
        }
        @media (max-width: 700px) {
            .settings-body { padding-top: 12px; }
            .spanel h2 { font-size: 19px; margin-bottom: 10px; }
            .spanel h3 { margin: 16px 0 8px; padding-top: 14px; }
            .settings-card { padding: 4px 14px; margin-bottom: 10px; }
            .srow { padding: 8px 0; gap: 10px; }
            .srow .sd { font-size: 12px; }
            .pe-card { padding: 10px 12px; margin-bottom: 10px; }
            .field-group { margin-bottom: 10px; }
        }
        /* ---- phone call UI + sheets  ---- */
        .vc-top, .vc-grab, .vc-stopwatch, .sc-x, .sc-fs, .vc-return { display: none; }
        .vc-in-voice, .in-voice { color: #3ba55d; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
        .in-voice svg { width: 14px; height: 14px; }
        .vc-sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100010; opacity: 0; transition: opacity .2s; }
        .vc-sheet-back.in { opacity: 1; }
        .vc-sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; z-index: 100011; background: #141417; color: #f2f3f5; border-radius: 22px 22px 0 0; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform .22s ease; box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
        .vc-sheet.in { transform: none; }
        .vc-sgrab { width: 44px; height: 5px; border-radius: 3px; background: #55555c; margin: 10px auto 6px; flex: 0 0 auto; }
        .vc-sbody { overflow-y: auto; padding: 4px 16px calc(22px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
        .vc-stitle, .vc-ssub { font-size: 17px; color: #b5b8c0; font-weight: 600; margin: 10px 4px; }
        .vc-shead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
        .vc-shead h3 { font-size: 18px; color: #f2f3f5; margin: 0; }
        .vc-card { background: #1f1f24; border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
        .vc-srow { display: flex; align-items: center; gap: 14px; padding: 13px 16px; min-height: 58px; cursor: pointer; }
        .vc-srow + .vc-srow { border-top: 1px solid #2c2c32; }
        .vc-sic { width: 26px; height: 26px; color: #e6e7ea; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
        .vc-sic .vi { width: 24px; height: 24px; }
        .vc-stx { flex: 1; min-width: 0; display: flex; flex-direction: column; unicode-bidi: plaintext; }
        .vc-stx b { font-weight: 600; font-size: 17px; color: #f2f3f5; }
        .vc-stx small { font-size: 13px; color: #9a9ca4; margin-top: 2px; white-space: normal; }
        .vc-chev { color: #9a9ca4; display: flex; } .vc-chev .vi { width: 20px; height: 20px; }
        .vc-sw { width: 52px; height: 32px; border-radius: 16px; background: #2b2b31; border: 1px solid #3a3a41; position: relative; flex: 0 0 auto; padding: 0; cursor: pointer; transition: background .15s; }
        .vc-sw i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
        .vc-sw.on { background: var(--accent, #5865f2); border-color: var(--accent, #5865f2); } .vc-sw.on i { transform: translateX(20px); }
        .vc-rd { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #4a4a52; position: relative; flex: 0 0 auto; }
        .vc-rd.on { border-color: var(--accent, #5865f2); background: var(--accent, #5865f2); }
        .vc-rd.on::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
        .vc-sheet .vc-sq { width: 40px; height: 40px; border: 0; border-radius: 12px; background: #26262b; color: #f2f3f5; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
        :root[dir="rtl"] .vc-sw i, :root[lang="ar"] .vc-sw i { left: 3px; }
        @media (max-width: 700px) {
            body.vc-open .main-header { display: none; }
            body.vc-open #voice-call-screen { position: fixed; inset: 0; z-index: 40; background: #0b0b0d; }
            body #voice-call-screen .vc-top { display: flex; position: absolute; top: calc(10px + var(--ph-sat, env(safe-area-inset-top, 0px))); left: 12px; right: 12px; gap: 8px; z-index: 8; direction: ltr; }
            #voice-call-screen .vc-sq { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 14px; background: #1c1c20; color: #f2f3f5; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
            #voice-call-screen .vc-sq .vi, #voice-call-screen .vc-sq .ico, #voice-call-screen .vc-sq svg { width: 22px; height: 22px; }
            #voice-call-screen .vc-out { background: #fff; color: #111; }
            #voice-call-screen .vc-pill { flex: 1; min-width: 0; height: 44px; border-radius: 14px; background: #1c1c20; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; color: #fff; font-weight: 700; font-size: 16px; }
            #voice-call-screen .vc-pill .vi { width: 18px; height: 18px; flex: 0 0 auto; color: #9a9ca4; }
            .vc-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            #voice-call-title, #voice-call-screen .vc-chat, #voice-call-screen .vc-inv, #voice-call-screen .vc-corner-r, #voice-call-screen .stage-bar, #stage-alone { display: none !important; }
            body #voice-call-screen .voice-stage-grid { padding: calc(66px + var(--ph-sat, env(safe-area-inset-top, 0px))) 12px calc(132px + env(safe-area-inset-bottom)); justify-content: flex-start; align-items: stretch; gap: 10px; overscroll-behavior: contain; }
            body #voice-call-screen .voice-stage-grid > * { max-width: none; }
            body #voice-call-screen #stage-members { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
            body #voice-call-screen #stage-members .tile { aspect-ratio: 1 / 1.08; min-height: 0; border-radius: 18px; border: 0; background: #2a2a2e; max-height: none; }
            body #voice-call-screen #stage-members .tile:only-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; max-height: none; }
            #voice-call-screen .tile.speaking { box-shadow: inset 0 0 0 3px #23a55a; }
            #voice-call-screen .tile .tile-label { left: 50%; transform: translateX(-50%); bottom: 10px; border-radius: 12px; background: rgba(0,0,0,.55); padding: 5px 12px; font-size: 14px; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
            #voice-call-screen #stage-members.only-vid .tile.novideo, #voice-call-screen #stage-members.hide-own .tile.me:not(.novideo) { display: none; }
            #voice-call-screen .screen-card { min-height: 0; aspect-ratio: 16 / 9; flex: none; border-radius: 18px; border: 1px solid #2c2c31; background: #000; }
            #voice-call-screen .screen-video { max-height: none; height: 100%; }
            #voice-call-screen .stream-quality-badges, #voice-call-screen .stream-viewer-bar { display: none !important; }
            #voice-call-screen .sc-x, #voice-call-screen .sc-fs { display: flex; position: absolute; top: 8px; width: 36px; height: 36px; border-radius: 10px; background: rgba(40,40,44,.85); color: #fff; border: 0; align-items: center; justify-content: center; z-index: 6; padding: 0; }
            #voice-call-screen .sc-x { left: 8px; } #voice-call-screen .sc-fs { right: 8px; }
            #voice-call-screen .sc-x svg, #voice-call-screen .sc-fs svg { width: 18px; height: 18px; }
            #voice-call-screen .stream-user-overlay { left: 50%; transform: translateX(-50%); bottom: 10px; border-radius: 12px; background: rgba(0,0,0,.6); padding: 5px 12px; font-size: 14px; }
            #voice-call-screen .mirror-note { padding: 8px; gap: 4px; max-width: 250px; } #voice-call-screen .mirror-note .ic { width: 28px; height: 28px; } #voice-call-screen .mirror-note b { font-size: 14px; }
            body #voice-call-screen .voice-floating-bar { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; max-width: none; margin: 0; transform: none; padding: 24px 10px 12px; border-radius: 24px; background: #1b1b1f; border: 1px solid #2a2a2f; justify-content: space-between; align-items: center; gap: 4px; flex-wrap: nowrap; box-shadow: 0 8px 30px rgba(0,0,0,.6); direction: ltr; }
            #voice-call-screen .vc-group, #voice-call-screen .vc-split { display: contents; }
            #voice-call-screen .vc-caret, #voice-call-screen .noise-btn, #voice-call-screen .vc-more, #call-btn-deaf, .vc-extra { display: none !important; }
            #voice-call-screen .vc-grab { display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 24px; background: none; border: 0; padding: 0; cursor: pointer; }
            #voice-call-screen .vc-grab::after { content: ''; position: absolute; left: 50%; top: 9px; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: #6b6b73; }
            body #voice-call-screen .voice-floating-bar .control-pill-btn { width: 54px; height: 54px; border-radius: 50%; background: transparent; color: #fff; flex: 0 0 auto; }
            body #voice-call-screen .voice-floating-bar .control-pill-btn .vi { width: 26px; height: 26px; }
            body #voice-call-screen .voice-floating-bar .control-pill-btn.off { background: transparent; color: #fff; }
            body #voice-call-screen .voice-floating-bar .control-pill-btn.active { background: rgba(88,101,242,.28); color: #b4bcff; }
            body #voice-call-screen .voice-floating-bar .control-pill-btn.stream-stop { background: rgba(237,66,69,.25) !important; color: #ff9a9c !important; border: 0 !important; }
            #call-btn-cam { order: 1; } #call-btn-mic { order: 2; } #call-btn-screen { order: 3; } #call-btn-sound { order: 4; } #call-btn-act { display: none !important; }
            body #voice-call-screen .voice-floating-bar .vc-leave, body #voice-call-screen .voice-floating-bar .vc-stopwatch { order: 5; width: 68px; height: 54px; border-radius: 16px; background: #d83c3e; color: #fff; }
            body #voice-call-screen .voice-floating-bar .vc-stopwatch { display: none; }
            #voice-call-screen.vc-full .vc-leave { display: none !important; }
            body #voice-call-screen.vc-full .voice-floating-bar .vc-stopwatch { display: flex; }
            #voice-call-screen.vc-full #stage-members { display: none; }
            body #voice-call-screen.vc-full .voice-stage-grid { padding: calc(66px + var(--ph-sat, env(safe-area-inset-top, 0px))) 0 calc(132px + env(safe-area-inset-bottom)); justify-content: center; }
            #voice-call-screen.vc-full .screen-card { border-radius: 0; border: 0; aspect-ratio: auto; flex: 1; height: 100%; }
            #voice-call-screen.vc-full .screen-video { object-fit: contain; }
            body #voice-call-screen .vc-popover { position: fixed !important; left: 12px !important; right: 12px !important; top: auto !important; bottom: calc(100px + env(safe-area-inset-bottom)) !important; width: auto; max-width: none; max-height: 50vh; max-height: 50dvh; overflow-y: auto; transform: none !important; border-radius: 18px; }
            .vc-return.show { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: #1f6f43; color: #fff; padding: 9px 14px; font-size: 14px; cursor: pointer; text-align: start; flex: 0 0 auto; }
            .vc-return svg { width: 18px; height: 18px; flex: 0 0 auto; } .vc-return span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            #stream-mini { top: calc(72px + var(--ph-sat, env(safe-area-inset-top, 0px))); bottom: auto; inset-inline-end: 10px; width: min(300px, 76vw); border-radius: 16px; border-color: #2c2c31; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
            dialog { align-items: flex-end; height: 100vh; height: 100dvh; }
            .dialog-box { width: 100%; max-width: none; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); border-radius: 22px 22px 0 0; border-left: 0; border-right: 0; border-bottom: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: vc-sheet-up .22s ease; overscroll-behavior: contain; }
            .pk-grid { max-height: none; overflow: visible; } #cs-preview { max-height: none; }
        }
        @keyframes vc-sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
        @media (hover: none) and (pointer: coarse) { * { scrollbar-width: none; } *::-webkit-scrollbar { display: none; width: 0; height: 0; } }
        html, body { overscroll-behavior: none; }
        .chat-messages, .settings-body, .channels-pane, .members-pane, .voice-stage-grid, .dialog-box, .vc-popover, #servers-container { overscroll-behavior: contain; }
        /* phone toasts: one tidy pill across the top, never squeezed or over the call bar */
@media (max-width:700px){
  #toast-container { top: calc(env(safe-area-inset-top,0px) + 10px); bottom: auto; left: 12px; right: 12px; transform: none; width: auto; align-items: stretch; }
  :root[dir="rtl"] #toast-container { left: 12px; right: 12px; }
  #toast-container .toast-item { max-width: none; width: 100%; border-radius: 14px; box-sizing: border-box; }
  #voice-call-screen.vc-full .screen-card .sc-hint, #voice-call-screen.vc-full .screen-card .btn { display: none; }
}
.owner-tag { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-inline-start: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(250,204,21,.14); color: #facc15; border: 1px solid rgba(250,204,21,.4); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.owner-tag .ic { width: 11px; height: 11px; }
.to-tag { display: inline-flex; vertical-align: middle; margin-inline-start: 6px; color: var(--muted); } .to-tag .ic { width: 13px; height: 13px; }
/* settings and the profile editor open as centered pop-ups over a dimmed, blurred app (desktop); phones keep the full-screen sheet */
.pe-x { display: none; }
@keyframes mc-pop { from { opacity: 0; transform: scale(.96) translateZ(0); } to { opacity: 1; transform: scale(1) translateZ(0); } }
@media (min-width: 701px) {
  dialog.fullscreen { background: rgba(0,0,0,.78); align-items: center; justify-content: center; }
  [data-theme="system24"] dialog.fullscreen { background: rgba(0,0,0,.66); }
  dialog.fullscreen .settings-shell { width: min(1100px, 94vw); height: min(780px, 90vh); border-radius: 18px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 30px 90px rgba(0,0,0,.75); transform: translateZ(0); animation: mc-pop .16s ease-out; background: var(--bg-1); }
  dialog.fullscreen .settings-nav { width: 270px; min-width: 270px; max-width: 270px; padding: 22px 10px 22px 14px; align-items: stretch; }
  dialog.fullscreen .settings-nav-inner { width: 100%; }
  dialog.fullscreen .settings-body { padding: 30px 40px 80px; border-top-right-radius: 18px; }
  dialog.fullscreen .settings-close { top: 14px; right: 16px; width: 34px; height: 34px; border-width: 1.5px; }
  dialog.fullscreen .settings-close small { display: none; }
  :root[dir="rtl"] dialog.fullscreen .settings-close { right: auto; left: 16px; }
  #user-settings-dialog.pe-modal .settings-close { display: none; }
  #user-settings-dialog.pe-modal #sp-profile { position: fixed; top: 4%; left: 5%; right: 5%; bottom: 4%; z-index: 6; overflow-y: auto; padding: 28px 32px 70px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.62), 0 24px 70px rgba(0,0,0,.6); animation: mc-pop .16s ease-out; }
  #user-settings-dialog.pe-modal #sp-profile .pe-x { display: flex; position: fixed; top: calc(4% + 12px); right: calc(5% + 14px); width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted); font-size: 15px; align-items: center; justify-content: center; cursor: pointer; z-index: 7; }
  #user-settings-dialog.pe-modal #sp-profile .pe-x:hover { color: var(--bright); border-color: var(--bright); }
}
@media (max-width: 860px) {
  dialog .settings-nav { width: 100% !important; min-width: 0 !important; max-width: none !important; padding: 8px 52px 8px 10px !important; border-inline-end: 0 !important; border-bottom: 1px solid var(--border); align-items: flex-start; flex: 0 0 auto; }
  dialog .settings-nav-inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); width: 100% !important; gap: 2px 4px; }
  dialog .snav { padding: 6px 8px; font-size: 12px; gap: 6px; min-width: 0; text-align: start; justify-content: flex-start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } dialog .snav .ic { width: 15px; height: 15px; flex: none; }
  :root[dir="rtl"] dialog .settings-nav { padding: 8px 10px 8px 52px !important; }
}
@media (min-width: 701px) and (max-width: 860px) {
  dialog.fullscreen .settings-shell { flex-direction: column; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  dialog.fullscreen .settings-body { padding: 16px 18px 80px; border-top-right-radius: 0; }
  dialog.fullscreen .settings-close { top: 8px; right: 8px; } :root[dir="rtl"] dialog.fullscreen .settings-close { right: auto; left: 8px; }
}
/* ---- settings look and spacing like the usual (desktop and tablet; phones keep their own list layout) ---- */
.acc-card { background: var(--bg-0); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.acc-banner { height: 100px; background-color: var(--accent); background-size: cover; background-position: center; }
.acc-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -40px; min-height: 72px; flex-wrap: wrap; }
.acc-av { border-radius: 50%; padding: 6px; background: var(--bg-0); line-height: 0; flex: none; }
.acc-who { flex: 1; min-width: 140px; padding-bottom: 8px; }
.acc-who b { display: block; color: var(--bright); font-size: 20px; font-weight: 700; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-who span { color: var(--muted); font-size: 14px; }
.acc-edit { margin-bottom: 12px; background: var(--accent); border-color: var(--accent); color: #fff; }
.acc-edit:hover { filter: brightness(1.1); color: #fff; }
.acc-fields { background: var(--bg-1); border-radius: 8px; margin: 12px 16px 16px; padding: 16px; display: flex; flex-direction: column; gap: 24px; }
.acc-f { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acc-l { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; margin-bottom: 4px; }
.acc-v { color: var(--bright); font-size: 16px; word-break: break-word; }
.dev-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-3); display: inline-flex; align-items: center; justify-content: center; color: var(--bright); flex: none; }
.dev-ic .ic { width: 22px; height: 22px; }
.snav-foot #snav-ver { margin-top: 2px; opacity: .85; }
@media (min-width: 861px) {
  dialog.fullscreen .settings-nav { padding: 24px 8px 24px 16px; }
  dialog.fullscreen .snav { font-size: 16px; font-weight: 500; line-height: 20px; padding: 6px 10px; margin-bottom: 2px; gap: 0; min-height: 0; }
  dialog.fullscreen .snav > [data-ic], dialog.fullscreen .snav > .ic { display: none; }
  dialog.fullscreen .snav-group { font-size: 12px; font-weight: 700; line-height: 16px; text-transform: uppercase; letter-spacing: .02em; padding: 6px 10px; }
  dialog.fullscreen .snav-sep { margin: 8px 10px; }
  dialog.fullscreen .snav-foot { padding: 8px 10px; font-size: 12px; line-height: 16px; }
  dialog.fullscreen .settings-me { padding: 6px 10px 10px; margin-bottom: 4px; }
  dialog.fullscreen #settings-search { margin: 0 6px 8px 10px; width: auto; height: 32px; padding: 0 10px; font-size: 14px; }
  dialog.fullscreen .settings-body { padding: 40px 40px 80px; }
  dialog.fullscreen .settings-content { max-width: 740px; }
  dialog.fullscreen .spanel h2 { font-size: 20px; line-height: 24px; font-weight: 600; margin-bottom: 20px; }
  dialog.fullscreen .spanel h3 { font-size: 20px; line-height: 24px; font-weight: 600; margin: 40px 0 20px; padding-top: 40px; }
  dialog.fullscreen .spanel h2 + .sd { margin-top: -12px !important; margin-bottom: 20px !important; font-size: 14px; line-height: 20px; }
  dialog.fullscreen .sgroup-title { font-size: 12px; font-weight: 700; line-height: 16px; letter-spacing: .02em; margin: 28px 0 8px; }
  dialog.fullscreen .spanel h2 + .sgroup-title { margin-top: 0; }
  /* flat rows split by thin lines, no boxes, like the usual settings */
  dialog.fullscreen .settings-card:not([style*="padding"]) { background: transparent; border: 0; border-radius: 0; padding: 0; margin-bottom: 20px; box-shadow: none; }
  dialog.fullscreen .settings-card > .srow { padding: 20px 0; border-top: 0; border-bottom: 1px solid var(--border); }
  dialog.fullscreen .settings-card > .srow:first-child { padding-top: 4px; }
  dialog.fullscreen .settings-card > .srow:last-child { border-bottom: 0; padding-bottom: 8px; }
  dialog.fullscreen .srow .st { font-size: 16px; font-weight: 500; line-height: 24px; }
  dialog.fullscreen .srow .sd { font-size: 14px; line-height: 20px; margin-top: 4px; max-width: 520px; }
  dialog.fullscreen .settings-close { width: 36px; height: 36px; border-width: 2px; top: 20px; right: 20px; }
  dialog.fullscreen .settings-close small { display: block; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font-size: 13px; font-weight: 600; }
  :root[dir="rtl"] dialog.fullscreen .settings-close { right: auto; left: 20px; }
}
.vv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 20px; }
.vv-l { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: 8px; }
.vv-grid select { width: 100%; }
.vv-note { align-self: end; color: var(--muted); font-size: 12px; }
.vv-radio { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.vv-r { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-1); border-radius: 4px; cursor: pointer; color: var(--text); font-weight: 500; }
.vv-r:hover { background: var(--bg-3); }
.vv-r input { position: absolute; opacity: 0; pointer-events: none; }
.vv-r i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); flex: none; box-sizing: border-box; }
.vv-r input:checked + i { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 5.5px); }
.vv-r input:checked ~ span { color: var(--bright); }
.vv-r input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) { .vv-grid { grid-template-columns: 1fr; } }
/* keybinds: the usual two columns, a globe on the ones that also work inside games */
.kb-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.kb-head span:first-child { flex: 1; } .kb-head span:nth-child(2) { width: 170px; } .kb-head span:last-child { width: 28px; }
.kb-row .kb-l { flex: 1; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.kb-row .kb-bind { width: 170px; min-width: 0; }
.kb-glb { display: inline-flex; color: var(--green); } .kb-glb .ic { width: 14px; height: 14px; }
.kb-global { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; margin: 0 0 16px; font-size: 13.5px; line-height: 1.4; background: var(--bg-1); border: 1px solid var(--border); color: var(--text); }
.kb-global:empty { display: none; }
.kb-global .kb-gt { flex: 1; min-width: 0; }
.kb-global .kb-gic { display: inline-flex; color: var(--muted); } .kb-global .kb-gic .ic { width: 18px; height: 18px; }
.kb-global.ok { border-color: rgba(35,165,90,.5); } .kb-global.ok .kb-gic { color: var(--green); }
.kb-global.warn { border-color: rgba(240,178,50,.55); } .kb-global.warn .kb-gic { color: #f0b232; }
@media (min-width: 861px) { dialog.fullscreen .kb-row { padding: 10px 4px; } dialog.fullscreen .kb-row .kb-l { font-size: 15px; } }
/* the usual toggle: grey with a cross when off, green with a tick when on */
.switch { width: 40px; height: 24px; }
.switch i { background: #80848e; }
.switch i::after { width: 18px; height: 18px; left: 3px; top: 3px; background: #fff center/12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380848e' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E"); }
.switch input:checked + i { background: #23a55a; }
.switch input:checked + i::after { left: 19px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2323a55a' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + i { opacity: .5; }
/* the desktop app draws its own themed title bar */
#desk-tb { display: none; }
html.desk-tb #desk-tb { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 32px; align-items: center; gap: 8px; padding: 0 150px 0 12px; background: var(--bg-0, #000); color: var(--muted, #c9c9cc); font-size: 12px; font-weight: 700; -webkit-app-region: drag; user-select: none; z-index: 100001; border-bottom: 1px solid var(--border); }
html.desk-tb #desk-tb img { width: 16px; height: 16px; border-radius: 4px; }
html.desk-tb body { padding-top: 32px; }
/* the window's bottom edge can sit under the Dock / taskbar or the rounded corners: keep a little room there (none in full screen) */
html.desk-tb { --desk-bot: calc(10px + max(var(--desk-over, 0px), var(--desk-over-pg, 0px))); }   /* --desk-over: set by the app, --desk-over-pg: measured by the page itself (works with an older app build) when the window hangs under the Dock / taskbar */
html.desk-tb.desk-fs, html.desk-tb.desk-full { --desk-bot: 0px; }
html.desk-tb .app { height: calc(100vh - 32px - var(--desk-bot)); height: calc(100dvh - 32px - var(--desk-bot)); }
/* macOS: the three window buttons sit on the left of the bar and nothing sits on the right */
html.desk-tb.desk-mac #desk-tb { padding: 0 12px 0 84px; }
html.desk-tb.desk-mac.desk-full #desk-tb { padding-left: 12px; }
html.desk-tb dialog { top: 32px; height: calc(100vh - 32px - var(--desk-bot)); }
/* narrow / half-screen window: the server rail, channel list and member list become fixed drawers pinned to top: 0,
   so they start below the title bar instead of under it, and the phone layout's own heights leave room for it */
@media (max-width: 860px) {
  html.desk-tb .rail, html.desk-tb .channels-pane, html.desk-tb .members-pane, html.desk-tb #nav-overlay { top: 32px; }
}
@media (max-width: 700px) {
  html.desk-tb.ph .app { height: calc(var(--vvh, 100dvh) - 32px - var(--desk-bot)) !important; }
  html.desk-tb.ph body.has-mail-bar .app { height: calc(var(--vvh, 100dvh) - 68px - var(--desk-bot)) !important; }
  html.desk-tb.ph body.has-mail-bar .rail, html.desk-tb.ph body.has-mail-bar .channels-pane, html.desk-tb.ph body.has-mail-bar .members-pane,
  html.desk-tb.ph body.has-mail-bar #ph-you, html.desk-tb.ph body.has-mail-bar #ph-notif { top: 68px !important; }
  html.desk-tb.ph #ph-you, html.desk-tb.ph #ph-notif { top: 32px; }
  html.desk-tb.ph dialog[open] { top: 32px; height: calc(var(--vvh, 100dvh) - 32px - var(--desk-bot)) !important; max-height: calc(var(--vvh, 100dvh) - 32px - var(--desk-bot)) !important; }
}
/* full screen (Windows / Linux): the window buttons the system hides, drawn the same way in the bar */
.desk-fs-ctl { display: none; }
html.desk-fs .desk-fs-ctl, .desk-fs-ctl.own { display: flex; position: absolute; top: 0; right: 0; height: 32px; -webkit-app-region: no-drag; }
.desk-fs-ctl button { width: 46px; height: 32px; border: 0; padding: 0; background: transparent; color: var(--bright, #e5e5e7); display: flex; align-items: center; justify-content: center; cursor: default; }
.desk-fs-ctl button:hover { background: rgba(127,127,140,.2); }
.desk-fs-ctl button.x:hover { background: #c42b1c; color: #fff; }
/* things pinned to the top of the page sit below the desktop title bar instead of under it */
/* full-window layers pinned to inset: 0 would run under the title bar (and the Mac window buttons): start them below it */
html.desk-tb #img-viewer, html.desk-tb #vc-prejoin.open, html.desk-tb #landing, html.desk-tb #ph-plus, html.desk-tb #ph-status, html.desk-tb .vc-sheet-back, html.desk-tb .mc-cp-back { top: 32px; }
html.desk-tb #img-viewer, html.desk-tb #vc-prejoin.open, html.desk-tb #landing { bottom: var(--desk-bot); }
/* the call screen is a full-window layer only in the phone layout; wider, it sits inside the main pane, where a top offset would push its controls off the bottom */
@media (max-width: 700px) { html.desk-tb body.vc-open #voice-call-screen { top: 32px; bottom: var(--desk-bot); } }
html.desk-tb #img-viewer img { max-height: calc(100vh - 70px - 32px - var(--desk-bot)); }
html.desk-tb .main.stage-split > #chat-view { top: 32px !important; }
html.desk-tb .settings-close { top: 54px; }
html.desk-tb:not(.ph) .voice-floating-bar { bottom: 26px; }   /* call controls: clear margin above the window edge, so the hang-up button is never touching it */
html.desk-tb #footer-credits { bottom: calc(3px + var(--desk-bot)); }
html.desk-tb #dm-incoming { padding-top: 104px; }
html.desk-tb #offline-banner { top: 38px; }
html.desk-tb #toast-container { top: 48px; }
html.desk-tb #update-bar { top: 44px; -webkit-app-region: no-drag; }
/* classic pop-ups: create channel / category, invite friends, create event */
.mc-box { position: relative; padding: 24px; border-radius: 16px; background: var(--bg-1); border: 1px solid var(--border); box-shadow: 0 24px 70px rgba(0,0,0,.65); animation: mc-pop .16s ease-out; }
.mc-h { font-size: 20px; font-weight: 800; color: var(--bright); margin: 0 38px 16px 0; }
.mc-sub { font-size: 13px; font-weight: 700; color: var(--bright); margin: 0 0 8px; }
.mc-opt-note { font-weight: 500; color: var(--muted); }
.mc-x { position: absolute; top: 16px; inset-inline-end: 16px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mc-x:hover { background: rgba(127,127,140,.16); color: var(--bright); }
.mc-in { width: 100%; padding: 11px 12px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--border); color: var(--bright); font-size: 14px; }
.mc-in:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); outline: none; }
.mc-opt { display: flex; align-items: flex-start; gap: 12px; padding: 9px 4px; cursor: pointer; border-radius: 10px; }
.mc-opt:hover { background: rgba(127,127,140,.08); }
.mc-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mc-opt i { flex: 0 0 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--muted); position: relative; }
.mc-opt input:checked + i { border-color: var(--accent); }
.mc-opt input:checked + i::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.mc-opt input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.mc-opt b { display: block; color: var(--bright); font-size: 15px; font-weight: 700; }
.mc-opt b em { font-style: normal; color: var(--muted); margin-inline-end: 6px; display: inline-flex; vertical-align: -2px; }
.mc-opt b em .ic { width: 16px; height: 16px; }
.mc-opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.35; }
.mc-foot { display: flex; gap: 10px; margin: 22px -24px -24px; padding: 16px 24px; background: color-mix(in srgb, var(--bg-0) 55%, transparent); border-top: 1px solid var(--border); border-radius: 0 0 16px 16px; }
.mc-foot .mc-btn { flex: 1; }
@media (min-width: 701px) { #create-channel-dialog .mc-opt { padding: 6px 4px; } }
#create-channel-dialog .mc-foot { position: sticky; bottom: -24px; z-index: 1; background: var(--bg-1); }   /* Create / Cancel stay in view on phones too, where the six channel types push them off the screen */
.mc-btn { padding: 11px 16px; border-radius: 10px; border: 0; background: var(--bg-4); color: var(--bright); font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.mc-btn:hover { filter: brightness(1.15); }
.mc-btn.primary { background: var(--accent); color: #fff; }
.mc-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.mc-btn.sm { padding: 6px 14px; font-size: 13px; flex: none; }
.mc-btn.sent { background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: default; }
.if-list { max-height: 360px; overflow-y: auto; margin: 6px -10px 0; padding: 0 10px; }
.if-row { display: flex; align-items: center; gap: 12px; padding: 7px 4px; border-radius: 10px; }
.if-row:hover { background: rgba(127,127,140,.08); }
.if-row .if-n { flex: 1; min-width: 0; } .if-row b { display: block; color: var(--bright); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .if-row small { color: var(--muted); font-size: 12px; }
.if-empty { text-align: center; color: var(--muted); padding: 28px 8px; font-size: 13.5px; }
.if-link { margin: 14px -24px 0; padding: 16px 24px 22px; border-top: 1px solid var(--border); }
.if-link .if-box { display: flex; gap: 8px; align-items: center; background: var(--bg-0); border: 1px solid var(--border); border-radius: 10px; padding: 4px 4px 4px 12px; }
.if-link .if-box input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--bright); font-family: inherit; font-size: 13.5px; outline: none; }
.if-link small { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; }
.ew-steps { display: flex; gap: 6px; margin: 0 40px 18px 0; } .ew-steps i { flex: 1; font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); border-top: 4px solid var(--bg-4); padding-top: 6px; } .ew-steps i.on { color: var(--accent); border-color: var(--accent); }
.ew-sub { color: var(--muted); font-size: 13.5px; margin: -8px 0 12px; }
.ew-f { margin-bottom: 12px; } .ew-f label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ew-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ew-rev { background: var(--bg-0); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; } .ew-rev b { color: var(--bright); font-size: 17px; display: block; margin-bottom: 8px; } .ew-rev div { color: var(--text); font-size: 13.5px; margin-top: 5px; word-break: break-word; }
@media (max-width: 700px) { .mc-box { border-radius: 18px 18px 0 0; } .mc-foot { border-radius: 0; } .ew-2 { grid-template-columns: 1fr; } }
/* profile cards open as a small pop-out beside what you clicked, not in the middle */
@media (min-width: 701px) {
  #member-action-dialog { background: transparent; backdrop-filter: none; align-items: flex-start; justify-content: flex-start; }
  #member-action-dialog .profile-pop { position: fixed; width: 340px; max-height: calc(100vh - 24px); border-radius: 14px; animation: mc-pop .12s ease-out; }
}
/* ---- polish pass: focus, touch, motion, phone layout ---- */
        #chat-input { overflow-y: hidden; overflow-x: hidden; text-overflow: ellipsis; } #chat-input.maxed { overflow-y: auto; }
        #chat-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        :root :focus-visible:not(#_):not(input):not(textarea):not(select):not(dialog):not(.settings-nav):not(.settings-body):not([tabindex="-1"]) { outline: 2px solid var(--accent); outline-offset: 2px; }
        :root .snav:focus-visible:not(#_) { outline: none; }
        @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
        @media (pointer: coarse) {
            .icon-btn { min-width: 40px; height: 40px; } .quick-icon-btn { width: 40px; height: 40px; }
            .snav, .stab, .svtab, .tab-btn { min-height: 40px; }
            .composer .icon-btn { height: 40px; }
            .chan-gear { padding: 8px; margin: -8px; }
        }
        @media (max-width: 900px) { :root [data-theme="system24"] .rail::before, :root [data-theme="system24"] .channels-pane::before, :root [data-theme="system24"] .main::before, :root [data-theme="system24"] .members-pane::before, :root[lang="ar"][data-theme="system24"] .rail::before, :root[lang="ar"][data-theme="system24"] .channels-pane::before, :root[lang="ar"][data-theme="system24"] .main::before, :root[lang="ar"][data-theme="system24"] .members-pane::before { display: none; } }
        @media (max-width: 560px) {
            .composer { flex-wrap: wrap; row-gap: 2px; }
            .composer > #chat-input { order: -1; flex: 1 1 100%; min-width: 0; padding: 8px 6px; }
            .composer > .icon-btn:first-of-type { order: 0; }
            #chat-search-input { flex: 0 0 38px; width: 38px; min-width: 38px; padding: 5px 0; color: transparent; cursor: pointer; background: var(--bg-0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / 16px no-repeat; transition: width .15s; }
            #chat-search-input::placeholder { color: transparent; }
            #chat-search-input:focus { flex-basis: 150px; width: 150px; color: var(--bright); background-image: none; padding: 5px 10px; cursor: text; }
            #chat-search-input:focus::placeholder { color: var(--muted); }
            .settings-nav { width: calc(100% - 54px); }
            .settings-close { width: 34px; height: 34px; top: 10px; } .settings-close small { display: none; }
        }
    