/* Kobra Krypted Komm Desktop — the same colours as the phone application. */
:root {
  --bg: #F7F4EC; --surface: #FFFFFF; --ink: #1B1A17; --muted: #6E6A60; --line: #E5DFD0; --primary: #8A5A00; --on-primary: #FFFFFF;
  --bubble-out: #F4E3B8; --bubble-in: #FFFFFF; --soft: #F3EAD3; --danger: #B3261E; --warn: #9A5B00; --ok: #1E8E62; --read: #1976D2;
  --brand: #E19830; --shadow: 0 8px 30px rgba(0,0,0,.18); --radius: 14px;
  color-scheme: light;
}
:root[data-dark="1"] {
  --bg: #0B0B0C; --surface: #161617; --ink: #ECEAE4; --muted: #A19C90; --line: #2B2A27; --primary: #E6A23C; --on-primary: #1C1300;
  --bubble-out: #4A3712; --bubble-in: #1C1C1D; --soft: #2A2212; --danger: #F2B8B5; --warn: #F0B45A; --ok: #5AD1B1; --read: #7CC0FF;
  --shadow: 0 8px 34px rgba(0,0,0,.6);
  color-scheme: dark;
}
/* Each palette has a day and a night version; the display mode (or Windows) chooses. */
:root[data-palette="indigo"][data-dark="1"] { --bg:#1D1A2C; --surface:#282439; --ink:#F2EBDD; --muted:#A9A2BC; --line:#3A3552; --primary:#E2B866; --on-primary:#1D1A2C; --bubble-out:#4F4124; --bubble-in:#2B2740; --soft:#312C47; --danger:#FFA59E; --warn:#F5C46E; --ok:#74D9AE; --read:#8FC2FF; }
:root[data-palette="indigo"][data-dark="0"] { --bg:#F3F1FA; --surface:#FFFFFF; --ink:#1D1A2C; --muted:#6A6480; --line:#DDD8EC; --primary:#7A5A12; --on-primary:#FFFFFF; --bubble-out:#E9E2F7; --bubble-in:#FFFFFF; --soft:#ECE8F6; --danger:#B3261E; --warn:#8A5A00; --ok:#1B7F58; --read:#3D5AFE; }
:root[data-palette="copper"][data-dark="0"] { --bg:#FBF5EC; --surface:#FFFFFF; --ink:#2B1D12; --muted:#7B6757; --line:#E9DAC8; --primary:#9A5B2E; --on-primary:#FFFFFF; --bubble-out:#F2D9C1; --bubble-in:#FFFFFF; --soft:#F4E6D6; --danger:#B3261E; --warn:#8A4B12; --ok:#1E8E62; --read:#1565C0; }
:root[data-palette="copper"][data-dark="1"] { --bg:#1E1611; --surface:#2A1F18; --ink:#F3E6D8; --muted:#B8A08C; --line:#3E2F24; --primary:#E0915A; --on-primary:#1E1611; --bubble-out:#5A3720; --bubble-in:#2D221A; --soft:#33271E; --danger:#FFA59E; --warn:#F5C46E; --ok:#74D9AE; --read:#8FC2FF; }
:root[data-palette="ink"][data-dark="0"] { --bg:#F5F5F4; --surface:#FFFFFF; --ink:#111111; --muted:#666666; --line:#DDDDDB; --primary:#111111; --on-primary:#FFFFFF; --bubble-out:#E3E3E1; --bubble-in:#FFFFFF; --soft:#EBEBE9; --danger:#B3261E; --warn:#7A4B00; --ok:#1B7F58; --read:#1565C0; }
:root[data-palette="ink"][data-dark="1"] { --bg:#000000; --surface:#121212; --ink:#F2F2F2; --muted:#9E9E9E; --line:#2A2A2A; --primary:#FFFFFF; --on-primary:#000000; --bubble-out:#2E2E2E; --bubble-in:#161616; --soft:#1C1C1C; --danger:#FF8A80; --warn:#FFD180; --ok:#69F0AE; --read:#82B1FF; }
:root[data-palette="slate"][data-dark="1"] { --bg:#15181C; --surface:#1F2328; --ink:#ECEEF0; --muted:#9AA3AD; --line:#30363D; --primary:#E8EAED; --on-primary:#15181C; --bubble-out:#39424C; --bubble-in:#22272D; --soft:#2A3037; --danger:#FFA59E; --warn:#F0C674; --ok:#74D9AE; --read:#8FC2FF; }
:root[data-palette="slate"][data-dark="0"] { --bg:#EEF1F4; --surface:#FFFFFF; --ink:#15181C; --muted:#5B6670; --line:#D5DBE1; --primary:#2F3A45; --on-primary:#FFFFFF; --bubble-out:#DCE3EA; --bubble-in:#FFFFFF; --soft:#E4E9EE; --danger:#B3261E; --warn:#7A4B00; --ok:#1B7F58; --read:#1565C0; }
/* Red on black only: keeps the eyes used to the dark (hiking at night, astronomy). */
:root[data-palette="red"] { --bg:#000000; --surface:#120303; --ink:#E0412E; --muted:#9A2A1E; --line:#3A0B07; --primary:#FF5A3C; --on-primary:#000000; --bubble-out:#3A0D08; --bubble-in:#160404; --soft:#1E0605; --danger:#FF6E50; --warn:#E0412E; --ok:#C8452E; --read:#FF7A5A; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-first, "Segoe UI Variable Text"), "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Arabic", "Noto Sans CJK JP", "Microsoft YaHei UI", "Yu Gothic UI", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.38; -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.danger { color: var(--danger); }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.pre { white-space: pre-wrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- layout */
#app { height: 100%; display: flex; }
.side { width: 360px; flex: none; display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: var(--surface); position: relative; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.wall::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--wall-layers, none); z-index: 0; }
.mark::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--mark) center 46% / min(60%, 460px) no-repeat; opacity: var(--mark-alpha, .2); z-index: 0;
  transform: perspective(1100px) rotateX(var(--tilt-x, 14deg)) rotateY(var(--tilt-y, 0deg)); transform-origin: 50% 46%;
  /* thickness: the same shape repeated a little lower and darker, like the side of a gold plate */
  filter: drop-shadow(0 2px 0 #6b4a08) drop-shadow(0 2px 0 #4a3204) drop-shadow(0 3px 0 #2c1e02) drop-shadow(0 14px 18px rgba(0,0,0,.55)); }
.wall > *, .mark > * { position: relative; z-index: 1; }
@media (max-width: 760px) {
  .side { width: 100%; }
  #app.in-chat .side { display: none; }
  #app:not(.in-chat) .main:not(.welcome):not(.lock) { display: none; }
}

/* ---- bars */
.bar { min-height: 64px; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.bar .titles { flex: 1; min-width: 0; }
.bar .t { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; color: var(--ink); }
.icon:hover { background: var(--soft); }
.icon:focus-visible, .btn:focus-visible, .item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .flip svg { transform: scaleX(-1); }
.btn { border: none; border-radius: 12px; padding: 10px 18px; min-height: 42px; background: var(--primary); color: var(--on-primary); font-weight: 650; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.out { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.plain { background: transparent; color: var(--primary); padding: 8px 12px; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wide { width: 100%; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---- fields */
.field, textarea.field, select.field { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; }
.field:focus { border-color: var(--primary); }
textarea.field { resize: vertical; min-height: 90px; }
label.lab { display: block; font-weight: 650; font-size: 14px; margin: 16px 2px 6px; }
.cap { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.search { margin: 10px 12px 6px; width: calc(100% - 24px); }

/* ---- lists */
.list { flex: 1; overflow-y: auto; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; border: none; background: transparent; width: 100%; text-align: start; }
.item:hover { background: var(--soft); }
.item.sel { background: var(--soft); }
.item .n { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .l { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .l.un { color: var(--ink); }
.item .r { text-align: end; font-size: 12px; color: var(--muted); flex: none; }
.badge { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-weight: 700; text-align: center; padding: 0 6px; margin-top: 4px; font-size: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 17px; }
.avatar.small { width: 36px; height: 36px; font-size: 14px; }
img.avatar.photo { object-fit: cover; background: var(--line, #ddd); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 9px; background: var(--soft); color: var(--primary); margin-inline-end: 4px; }
.empty { padding: 40px 28px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 8px; }

/* ---- pages in the main area */
.page { flex: 1; overflow-y: auto; }
.page .inner { max-width: 760px; margin: 0 auto; padding: 18px 26px 60px; }
.sec { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--primary); text-transform: uppercase; margin: 26px 4px 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin: 10px 0; }
.card .ti { font-weight: 700; font-size: 16px; }
.card .st { font-weight: 650; font-size: 14px; margin-top: 2px; }
.card .ab { margin-top: 8px; }
.setting { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting:last-child { border-bottom: none; }
.setting .k { font-weight: 600; }
.setting .v { color: var(--muted); font-size: 13.5px; white-space: pre-line; }
.switch { width: 44px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; border: none; cursor: pointer; }
.switch::after { content: ""; position: absolute; inset-inline-start: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--primary); }
.switch.on::after { inset-inline-start: 22px; }

/* ---- conversation */
.chat { flex: 1; overflow-y: auto; padding: 10px 14px 6px; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 10px; margin: 10px 0 4px; border: 1px solid var(--line); }
.info { align-self: center; font-size: 13px; color: var(--muted); background: var(--surface); padding: 5px 12px; border-radius: 12px; margin: 6px 20px; text-align: center; border: 1px solid var(--line); max-width: 80%; }
.line { display: flex; }
.line.out { justify-content: flex-end; }
.b { max-width: min(72%, 620px); padding: 8px 12px 6px; border-radius: 18px; background: var(--bubble-in); border: 1px solid var(--line); overflow-wrap: anywhere; }
.line.out .b { background: var(--bubble-out); border-color: transparent; }
.b .who { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.b .txt { white-space: pre-wrap; font-size: 15px; line-height: 1.42; }
.b .foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 3px; }
.b .foot svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.b .foot .read { color: var(--read); }
.b img.pic, .b video { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; margin: 2px 0 4px; cursor: zoom-in; background: var(--soft); }
.b .file { display: flex; align-items: center; gap: 10px; padding: 4px 2px; cursor: pointer; min-width: 220px; }
.b .file .fi { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; color: var(--primary); flex: none; }
.b .file .fi svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.b .place { display: flex; gap: 10px; align-items: center; cursor: pointer; min-width: 240px; }
.b .place .pin { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.more { align-self: center; margin: 8px 0; }
.banner { padding: 10px 16px; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 14px; flex: none; }
.banner .btns { margin-top: 8px; }
#chat-foot { position: relative; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 12px; flex: none; background: var(--bg); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 180px; border-radius: 22px; padding: 11px 16px; border: 1px solid var(--line); background: var(--surface); outline: none; line-height: 1.38; }
.send { width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: var(--on-primary); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.send svg { width: 22px; height: 22px; fill: currentColor; }
[dir="rtl"] .send svg { transform: scaleX(-1); }
.closed { padding: 14px 18px; text-align: center; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.drop { position: absolute; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; z-index: 30; pointer-events: none; }

/* ---- menus, dialogs, toasts */
.menu { position: fixed; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 6px 0; min-width: 230px; z-index: 50; border: 1px solid var(--line); }
.menu button { display: block; width: 100%; text-align: start; padding: 10px 18px; border: none; background: transparent; cursor: pointer; }
.menu button:hover, .menu button:focus { background: var(--soft); outline: none; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }
.shade { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dialog { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); width: min(520px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px 24px 14px; }
.dialog h2 { margin: 0 0 10px; font-size: 19px; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.dialog .choice { display: flex; align-items: center; gap: 14px; padding: 10px 6px; cursor: pointer; border-radius: 10px; border: none; background: transparent; width: 100%; text-align: start; }
.dialog .choice:hover { background: var(--soft); }
.dialog .choice i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); flex: none; position: relative; }
.dialog .choice.on i { border-color: var(--primary); }
.dialog .choice.on i::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }
.code { font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: 12.5px; background: var(--bg); border-radius: 10px; padding: 10px 12px; word-break: break-all; user-select: all; max-height: 160px; overflow-y: auto; }
.safety { font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: 20px; letter-spacing: .08em; text-align: center; padding: 12px; background: var(--bg); border-radius: 12px; margin: 10px 0; }
#toasts { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { background: #222; color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 520px; text-align: center; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 70; display: flex; align-items: center; justify-content: center; }
.viewer img, .viewer video { max-width: 96vw; max-height: 90vh; }
.viewer .icon { position: absolute; top: 14px; color: #fff; }

/* ---- welcome and lock */
.welcome { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; }
.welcome .inner { width: min(560px, 100%); padding: 40px 28px 60px; }
.welcome .logo { width: 128px; height: 128px; border-radius: 26px; display: block; margin: 0 auto 18px; object-fit: cover; }
.welcome h1 { text-align: center; font-size: 28px; margin: 6px 0 8px; }
.point { display: flex; gap: 14px; margin: 16px 0; }
.point .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; font-weight: 700; }
.lock { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lock .inner { width: 340px; text-align: center; }
.lock input { text-align: center; letter-spacing: .3em; font-size: 20px; }

/* ---- shared positions plan */
.plan { width: 100%; max-width: 520px; aspect-ratio: 1.2; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; display: block; margin: 8px auto; }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pal { border: 2px solid var(--line); border-radius: 16px; padding: 12px; cursor: pointer; background: var(--surface); text-align: start; }
.pal.on { border-color: var(--primary); }
.pal .sw { display: flex; gap: 6px; margin-bottom: 8px; }
.pal .sw i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(128,128,128,.4); }
.pats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.pat { height: 90px; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; background-color: var(--bg); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 12.5px; }
.pat.on { border-color: var(--primary); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; background: var(--surface); }
.chip.on { border-color: var(--primary); color: var(--primary); font-weight: 650; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--primary); }

/* ---- appearance screen: backgrounds, colours, fonts */
.walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.wtile { border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; text-align: center; position: relative; }
.wtile.on { border-color: var(--primary); }
.wtile .pic { height: 84px; background-size: cover; background-position: center; background-color: var(--bg); background-repeat: repeat; }
.wtile .pic.add { display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--primary); }
.wtile .n { font-size: 12.5px; padding: 6px 4px 7px; line-height: 1.2; }
.wtile.on .n { color: var(--primary); font-weight: 650; }
.wtile .del { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 13px; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 15px; line-height: 26px; }
.swatches { display: grid; grid-template-columns: repeat(8, 34px); gap: 8px; margin: 12px 0; }
.swatches button { width: 34px; height: 34px; border-radius: 17px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.swatches button.on { outline: 3px solid var(--primary); outline-offset: 2px; }
.colorline { display: flex; align-items: center; gap: 12px; }
.colorline .dot { width: 30px; height: 30px; border-radius: 15px; border: 1px solid var(--line); flex: none; }
.sample { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.sample .bub { display: inline-block; margin-top: 8px; padding: 7px 12px; border-radius: 12px; background: var(--bubble-out); }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.fonts button { border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 12px; cursor: pointer; text-align: start; font-size: 16px; }
.fonts button.on { border-color: var(--primary); color: var(--primary); }
.fonts button small { display: block; font-size: 12px; color: var(--muted); font-family: system-ui, sans-serif; }

/* ---- a call */
.callpanel { position: fixed; inset: 0; z-index: 50; background: #0B0F10; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 48px 20px 40px; }
.callpanel video { background: #0B0F10; }
#call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#call-local { position: absolute; right: 20px; top: 20px; width: 22%; max-width: 260px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; border: 1px solid rgba(255,255,255,.28); transform: scaleX(-1); z-index: 2; }
.callpanel .who { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8vh; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.callpanel .who.small { margin-top: 0; align-self: flex-start; align-items: flex-start; }
.callpanel .who .avatar { width: 112px; height: 112px; font-size: 44px; }
.callpanel .who .n { font-size: 26px; font-weight: 650; }
.callpanel .who .s { font-size: 15px; color: rgba(255,255,255,.75); }
.callpanel .ctl { position: relative; z-index: 2; display: flex; gap: 22px; }
.roompanel { position: fixed; inset: 0; z-index: 50; background: #0B0F10; color: #fff; display: flex; flex-direction: column; padding: 18px 18px 26px; gap: 14px; }
.roompanel .rhead { text-align: center; }
.roompanel .rhead .n { font-size: 22px; font-weight: 650; }
.roompanel .rhead .s { font-size: 14px; color: rgba(255,255,255,.75); margin-top: 2px; }
.roompanel .rgrid { flex: 1; min-height: 0; display: grid; gap: 8px; }
.roompanel .ctl { display: flex; gap: 22px; justify-content: center; }
.rtile { position: relative; background: #161C1E; border-radius: 14px; overflow: hidden; min-height: 0; }
.rtile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.rtile.me video { transform: scaleX(-1); }
.rtile.novideo video { visibility: hidden; }
.rtile .ini { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 700; color: #fff; }
.rtile .who { z-index: 2; position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.45); padding: 3px 9px; border-radius: 8px; font-size: 14px; max-width: 80%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rtile.waiting .who::after { content: " …"; }
.round { width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); color: #fff; }
.round svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.round.on { background: #fff; color: #111; }
.round.red { background: #D93025; }
.round.green { background: #1E8E3E; }
.round:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* profile pictures (version 1.18) */
.profile-preview { display: flex; justify-content: center; margin: 4px 0 10px; }
.profile-preview img, .profile-preview .avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; font-size: 44px; }
.presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 6px 0 4px; }
.preset { padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; aspect-ratio: 1; overflow: hidden; }
.preset:hover, .preset:focus-visible { border-color: var(--primary); }
.preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who-card { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.who-card .about { font-style: italic; color: var(--muted); }

/* emojis, stickers and GIFs (version 1.18) */
img.sticker { width: 150px; height: 150px; object-fit: contain; }
.sticker.loading { width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; }
.sticker.loading .icon, .sticker.loading svg { width: 34px; height: 34px; }
.stickerpanel { position: absolute; bottom: 72px; inset-inline-start: 12px; inset-inline-end: 12px; max-width: 420px; height: 340px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.3); z-index: 40; overflow: hidden; }
.stk-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.stk-tab { flex: 1; border: none; background: transparent; color: var(--ink); font-weight: 650; padding: 8px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.stk-tab.on { background: var(--primary); color: var(--on-primary); }
.stk-body { flex: 1; overflow-y: auto; padding: 8px; }
.stk-body .field { margin-bottom: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 2px; }
.emoji-grid .em { border: none; background: transparent; font-size: 24px; height: 40px; border-radius: 8px; cursor: pointer; }
.emoji-grid .em:hover { background: var(--soft); }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sticker-grid .stk { border: none; background: transparent; border-radius: 12px; cursor: pointer; padding: 4px; aspect-ratio: 1; }
.sticker-grid .stk:hover { background: var(--soft); }
.sticker-grid .stk img { width: 100%; height: 100%; object-fit: contain; }

/* Reply quote, edit/reply bar and deleted message (1.22) */
.b .quote { border-left: 3px solid var(--primary); background: rgba(127,127,127,.12); padding: 4px 8px; border-radius: 6px; margin-bottom: 5px; }
.b .quote .qn { color: var(--primary); font-weight: 650; font-size: 12.5px; }
.b .quote .qt { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.b .txt.del { color: var(--muted); font-style: italic; }
.composebar { display: flex; align-items: center; gap: 8px; padding: 6px 12px 0; }
.composebar .cbt { flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composebar .cbx { border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }

/* ---- stories (1.29) */
.stories { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px 4px; scrollbar-width: none; flex: none; }
.stories::-webkit-scrollbar { display: none; }
.story-cell { flex: none; width: 70px; background: none; border: none; padding: 2px; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.story-disc { position: relative; width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.story-disc .avatar { width: 50px; height: 50px; font-size: 18px; }
.ring-new .story-disc { background: conic-gradient(var(--primary), #FF7BE0, #6FE6FF, var(--primary)); }
.ring-seen .story-disc { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.ring-live .story-disc { background: #E53935; }
.ring-new .story-disc .avatar, .ring-seen .story-disc .avatar, .ring-live .story-disc .avatar { box-shadow: 0 0 0 2px var(--surface); }
.story-plus { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.story-live { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); background: #E53935; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .08em; padding: 1px 5px; border-radius: 6px; box-shadow: 0 0 0 2px var(--surface); }
.story-name { font-size: 11.5px; max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-viewer { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; }
.sv-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.sv-stage img, .sv-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.sv-card { width: min(100%, 520px); height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; box-sizing: border-box; }
.sv-text { font-size: 28px; font-weight: 700; text-align: center; white-space: pre-wrap; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.sv-livebadge { background: #E53935; padding: 6px 14px; border-radius: 8px; letter-spacing: .1em; margin-bottom: 16px; }
.sv-caption { position: absolute; left: 0; right: 0; bottom: 96px; text-align: center; padding: 8px 18px; background: rgba(0,0,0,.4); }
.sv-top { position: absolute; left: 0; right: 0; top: 0; padding: 10px 10px 18px; background: linear-gradient(rgba(0,0,0,.6), transparent); z-index: 2; }
.sv-bars { display: flex; gap: 4px; }
.sv-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sv-bar i { display: block; height: 100%; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sv-head .sv-who { flex: 1; font-weight: 700; }
.sv-head .icon { color: #fff; }
.sv-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; display: flex; gap: 10px; justify-content: center; background: linear-gradient(transparent, rgba(0,0,0,.6)); z-index: 2; }
.sv-foot button { background: rgba(255,255,255,.16); color: #fff; border: none; border-radius: 18px; padding: 8px 16px; cursor: pointer; font: inherit; }
.sv-prev, .sv-next { position: absolute; top: 90px; bottom: 90px; width: 30%; background: none; border: none; cursor: pointer; z-index: 1; }
.sv-prev { left: 0; } .sv-next { right: 0; }
.story-sample { border-radius: 14px; padding: 14px; margin-top: 6px; }
.story-sample textarea { background: transparent; border: none; color: #fff; font-size: 20px; font-weight: 700; text-align: center; min-height: 110px; }
.story-sample textarea::placeholder { color: rgba(255,255,255,.7); }
