/* ---------- themes ---------- */
:root {
  --font: Roboto, "Segoe UI", -apple-system, BlinkMacSystemFont, "Noto Sans Hebrew", "Arial Hebrew", Helvetica, Arial, sans-serif;
  --stage: radial-gradient(120% 90% at 50% 20%, #7cc6b0 0%, #4fa28c 45%, #2f7d6b 100%);
  --header: #008069;
  --header-2: #0b8f74;
  --header-fg: #fff;
  --chat-bg: linear-gradient(180deg, #c9dfec 0%, #a9c9dc 55%, #93b9d0 100%);
  --doodle-op: .09;
  --in-top: #effbe0;
  --in-bot: #d6efb8;
  --out-top: #ffffff;
  --out-bot: #f1f5f7;
  --text: #111b21;
  --meta: #667781;
  --tick: #53bdeb;
  --chip: #ffffffe6;
  --chip-fg: #54656f;
  --sys: #fff5c4;
  --composer: transparent;
  --field: #fff;
  --icon: #8696a0;
  --fab: #00a884;
  --quote-bg: rgba(0, 0, 0, .05);
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
:root[data-theme="classic"] {
  --stage: linear-gradient(160deg, #d9dbd5 0%, #c9cdc4 100%);
  --chat-bg: #efeae2;
  --doodle-op: .06;
  --in-top: #ffffff;
  --in-bot: #ffffff;
  --out-top: #d9fdd3;
  --out-bot: #d9fdd3;
  --composer: #f0f2f5;
}
:root[data-theme="dark"] {
  --stage: radial-gradient(120% 90% at 50% 20%, #2b3a40 0%, #172126 60%, #0b1014 100%);
  --header: #1f2c34;
  --header-fg: #e9edef;
  --chat-bg: #0b141a;
  --doodle-op: .05;
  --in-top: #202c33;
  --in-bot: #202c33;
  --out-top: #005c4b;
  --out-bot: #005c4b;
  --text: #e9edef;
  --meta: #8696a0;
  --chip: #182229;
  --chip-fg: #8696a0;
  --sys: #182229;
  --composer: #0b141a;
  --field: #1f2c34;
  --quote-bg: rgba(255, 255, 255, .06);
  --shadow: 0 1px .5px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--stage);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; fill: currentColor; }

/* ---------- stage + phone mockup (desktop / tablet) ---------- */
.stage {
  height: 100dvh;
  display: grid;
  place-items: center;
  position: relative;
  padding: 24px 16px;
}
.phone {
  position: relative;
  width: min(400px, calc((100dvh - 60px) * 0.47));
  height: min(860px, calc(100dvh - 60px));
  border-radius: 54px;
  padding: 12px;
  background: linear-gradient(145deg, #2b2b2e, #0d0d0f 60%, #252528);
  box-shadow:
    0 0 0 2px #3a3a3d,
    0 0 0 3px #111,
    0 40px 80px -30px rgba(0, 0, 0, .55),
    inset 0 0 3px rgba(255, 255, 255, .15);
  z-index: 1;
}
.phone::before, .phone::after { /* side buttons */
  content: ""; position: absolute; width: 4px; border-radius: 2px; background: #1b1b1d;
}
.phone::before { left: -5px; top: 150px; height: 60px; box-shadow: 0 80px 0 #1b1b1d; }
.phone::after { right: -5px; top: 190px; height: 90px; }
.island {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; border-radius: 20px; background: #000; z-index: 20;
}
.floor {
  position: absolute; bottom: max(8px, calc(50dvh - min(430px, calc(50dvh - 30px)) - 34px));
  width: 440px; max-width: 80vw; height: 40px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .35), transparent);
  filter: blur(4px);
}
.screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 43px;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--chat-bg);
  isolation: isolate;
}

/* ---------- status bar ---------- */
.statusbar {
  height: 50px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 30px 0;
  background: var(--header);
  color: var(--header-fg);
  font-size: 15px; font-weight: 600;
  direction: ltr;
}
.sb-icons { display: flex; gap: 6px; align-items: center; }
.sb-icons svg { height: 11px; width: auto; }

/* ---------- header ---------- */
.topbar {
  position: relative;
  flex: none;
  height: 58px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 4px 0 6px;
  background: var(--header);
  color: var(--header-fg);
  z-index: 5;
}
.icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.icon svg { width: 23px; height: 23px; }
.icon:active { background: rgba(255, 255, 255, .12); }
.topbar .back svg { transform: scaleX(-1); }
.gavatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 20px;
  background: #dfe5e7; color: #fff; overflow: hidden;
}
.gtitle { flex: 1; min-width: 0; padding-inline-start: 6px; line-height: 1.2; cursor: pointer; }
.gname { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsub {
  font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s;
}
.gsub.live { opacity: 1; }

.menu {
  position: absolute; top: 6px; left: 6px;
  background: #fff; color: #3b4a54; border-radius: 6px; padding: 8px 0; min-width: 190px;
  box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
  z-index: 30;
}
.menu button { display: block; width: 100%; text-align: start; padding: 12px 22px; font-size: 15px; }
.menu button:hover { background: #f5f6f6; }

/* ---------- chat ---------- */
.chat {
  position: relative;
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.screen::before { /* doodle wallpaper */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--doodle);
  background-size: 260px;
  opacity: var(--doodle-op);
}
:root[data-theme="dark"] .screen::before { filter: invert(1); }
.chat-inner { padding: 8px 0 10px; display: flex; flex-direction: column; }

.chip {
  align-self: center;
  margin: 8px 0 6px;
  padding: 5px 12px 6px;
  border-radius: 7.5px;
  background: var(--chip);
  color: var(--chip-fg);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 85%;
}
.chip.date { text-transform: uppercase; }
.chip.sys { background: var(--sys); color: #54656f; line-height: 1.4; }
:root[data-theme="dark"] .chip.sys { color: #ffd279; }
.chip.lock { background: #ffeecd; color: #54656f; line-height: 1.45; font-size: 12.5px; }
:root[data-theme="dark"] .chip.lock { background: #182229; color: #ffd279; }
.chip.lock svg { display: inline-block; width: 11px; height: 11px; vertical-align: -1px; margin-inline-end: 3px; }

.row {
  display: flex; align-items: flex-start;
  padding: 0 9px;
  margin-top: 2px;
  animation: pop .22s ease-out;
}
.row.first { margin-top: 8px; }
.row.out { justify-content: flex-end; }
.row.in { justify-content: flex-start; }
.av {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  margin-inline-end: 6px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff;
  visibility: hidden;
}
.row.first .av { visibility: visible; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.bubble {
  position: relative;
  max-width: min(80%, 460px);
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  font-size: 14.2px; line-height: 19px;
  box-shadow: var(--shadow);
  word-wrap: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.in .bubble { background: linear-gradient(180deg, var(--in-top), var(--in-bot)); }
.out .bubble { background: linear-gradient(180deg, var(--out-top), var(--out-bot)); }
.row.first .bubble::before { /* tail */
  content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.row.in.first .bubble { border-start-start-radius: 0; }
.row.out.first .bubble { border-start-end-radius: 0; }
.row.in.first .bubble::before {
  inset-inline-start: -8px; background: var(--in-top);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.row.out.first .bubble::before {
  inset-inline-end: -8px; background: var(--out-top);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.sender { font-size: 12.8px; font-weight: 500; line-height: 20px; display: flex; gap: 8px; justify-content: space-between; }
.sender .ph { color: var(--meta); font-weight: 400; font-size: 12px; direction: ltr; }
.spacer { display: inline-block; width: 64px; height: 1px; }
.out .spacer { width: 80px; }
.edited .spacer { width: 104px; }
.out.edited .spacer, .edited.out .spacer { width: 120px; }
.meta {
  position: absolute; bottom: 3px; inset-inline-end: 7px;
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--meta); line-height: 15px; white-space: nowrap;
}
.meta .ed { font-style: normal; }
.tick { width: 16px; height: 11px; color: var(--meta); }
.tick.read { color: var(--tick); }
.tick.pending { width: 12px; height: 12px; }

.body a { color: #027eb5; text-decoration: none; }

/* big emoji (no bubble) */
.bubble.jumbo { background: none !important; box-shadow: none; padding: 0 2px 16px; font-size: 44px; line-height: 52px; }
.bubble.jumbo::before { display: none; }
.bubble.jumbo .spacer { display: none; }
.bubble.jumbo .meta { background: var(--chip); padding: 1px 6px; border-radius: 10px; bottom: 0; }
.bubble.jumbo .sender { font-size: 12.8px; line-height: 20px; }

/* quoted reply */
.quote {
  display: block;
  margin: 2px -2px 5px -4px;
  padding: 5px 9px 6px 10px;
  border-radius: 6px;
  background: var(--quote-bg);
  border-inline-start: 4px solid var(--qc, #06cf9c);
  font-size: 13px; line-height: 18px;
  cursor: pointer;
  white-space: normal;
}
.quote .qn { font-weight: 500; color: var(--qc, #06cf9c); font-size: 12.8px; }
.quote .qt { color: var(--meta); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* deleted */
.deleted .body { color: var(--meta); font-style: italic; }
.deleted .body svg { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-inline-end: 4px; }

/* image */
.bubble.img { padding: 3px; }
.bubble.img .sender { padding: 2px 6px 0; }
.bubble.img img {
  display: block; width: 100%; max-width: 260px; min-width: 200px;
  aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #cfd8dc;
}
.bubble.img .cap { padding: 6px 6px 4px; }
.bubble.img.nocap .meta {
  color: #fff; bottom: 7px; inset-inline-end: 9px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}
.bubble.img.nocap::after {
  content: ""; position: absolute; inset: auto 3px 3px 3px; height: 28px; border-radius: 0 0 6px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .35));
}
.bubble.img.nocap .meta { z-index: 1; }
.bubble.img.nocap .tick { color: #fff; }
.bubble.img.nocap .tick.read { color: var(--tick); }

/* voice note */
.bubble.vn { width: min(300px, 82%); }
.voice { display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 0 12px; }
.voice .vav { width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative; display: grid; place-items: center; color: #fff; font-weight: 600; }
.voice .vav i { position: absolute; bottom: -2px; inset-inline-start: -4px; width: 18px; height: 18px; color: #34b7f1; }
.voice .vav i svg { width: 18px; height: 18px; }
.voice .play { width: 28px; height: 28px; color: #8696a0; flex: none; display: grid; place-items: center; }
.voice .play svg { width: 28px; height: 28px; }
.voice .wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; direction: ltr; position: relative; flex-direction: row-reverse; touch-action: none; cursor: pointer; }
.voice .wave b { flex: 1; background: #b8c3ca; border-radius: 2px; min-height: 3px; }
.voice .wave b.on { background: #34b7f1; }
.voice .dur { position: absolute; bottom: 3px; inset-inline-start: 62px; font-size: 11px; color: var(--meta); }

/* poll */
.poll { width: 260px; max-width: 64vw; padding-bottom: 14px; }
.poll .q { font-weight: 600; font-size: 15px; margin: 2px 0 2px; }
.poll .hint { color: var(--meta); font-size: 12.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.poll .opt { margin: 10px 0 12px; }
.poll .ol { display: flex; align-items: center; gap: 10px; font-size: 14.2px; }
.poll .rd { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #aebac1; flex: none; display: grid; place-items: center; }
.poll .opt.mine .rd { border-color: var(--fab); background: var(--fab); }
.poll .opt.mine .rd::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-inline-end: 0; transform: rotate(-45deg) translate(1px, -1px); }
.poll .ot { flex: 1; }
.poll .oc { color: var(--meta); font-size: 13px; min-width: 14px; text-align: center; }
.poll .bar { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .08); margin: 7px 30px 0 0; overflow: hidden; }
.poll .bar i { display: block; height: 100%; width: 0; background: var(--fab); border-radius: 3px; transition: width .5s ease; }
.poll .view { border-top: 1px solid rgba(0, 0, 0, .08); margin: 6px -7px -2px -9px; padding: 10px 0 0; text-align: center; color: #008069; font-size: 14.2px; font-weight: 500; }
.poll .opt { cursor: pointer; }

/* reactions */
.reacts {
  position: absolute; bottom: -18px; inset-inline-start: 8px;
  display: flex; align-items: center; gap: 1px;
  padding: 1px 5px; border-radius: 12px; height: 24px;
  background: var(--field); box-shadow: 0 1px 3px rgba(11, 20, 26, .2);
  font-size: 13.5px; line-height: 1;
  animation: pop .25s ease-out;
  z-index: 2;
}
.reacts .rc { font-size: 12px; color: var(--meta); padding-inline-start: 3px; }
.row.has-react { margin-bottom: 18px; }

/* typing bubble */
.typing .bubble { padding: 12px 14px 12px; min-width: 64px; }
.dots { display: flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: blink 1.3s infinite; }
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.typing .sender { margin-bottom: 4px; }

.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { filter: none; } 30% { filter: brightness(.82); } }

/* scroll-down button */
.down[hidden], .menu[hidden] { display: none; }
.down {
  position: absolute; bottom: 74px; left: 14px; z-index: 6;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--field); color: var(--icon);
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(11, 20, 26, .3);
}
.down svg { width: 26px; height: 26px; }
.down .badge {
  position: absolute; top: -8px; right: -2px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #25d366; color: #fff; font-size: 11.5px; font-weight: 600;
  display: grid; place-items: center;
}
.down .badge:empty { display: none; }

/* ---------- composer ---------- */
.composer {
  flex: none;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 6px 10px;
  background: var(--composer);
}
.field {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  min-height: 48px; border-radius: 24px;
  background: var(--field);
  padding: 0 6px;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.field .icon { color: var(--icon); width: 36px; height: 36px; flex: none; }
.field .icon svg { width: 24px; height: 24px; }
.field .attach svg { transform: rotate(-45deg); }
.field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--text); padding: 12px 4px;
}
.field input::placeholder { color: #8696a0; }
.fab {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: var(--fab); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(11, 20, 26, .25);
}
.fab svg { width: 24px; height: 24px; grid-area: 1 / 1; transition: transform .15s, opacity .15s; }
.fab .send { transform: scale(.4) scaleX(-1); opacity: 0; }
.fab.has .send { transform: scaleX(-1); opacity: 1; }
.fab.has .mic { transform: scale(.4); opacity: 0; }
.composer.typing-on .cam { display: none; }

/* ---------- mobile: become the real app, full screen ---------- */
@media (max-width: 899px), (max-height: 560px) {
  body { background: var(--header); }
  .stage { padding: 0; display: block; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .phone::before, .phone::after, .island, .floor { display: none; }
  .screen { border-radius: 0; }
  .statusbar { display: none; }
  .topbar { padding-top: env(safe-area-inset-top); height: calc(58px + env(safe-area-inset-top)); }
  .composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
/* option: ?frame=0 hides the mockup on any screen */
:root.noframe body { background: var(--header); }
:root.noframe .stage { padding: 0; display: block; }
:root.noframe .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: none; box-shadow: none; }
:root.noframe .phone::before, :root.noframe .phone::after, :root.noframe .island, :root.noframe .floor, :root.noframe .statusbar { display: none; }
:root.noframe .screen { border-radius: 0; }
:root.noframe .chat-inner { max-width: 980px; margin: 0 auto; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .row, .reacts { animation: none; }
}

/* ---------- archive content: rich bubbles, pinned bar, sheet ---------- */
.av img, .vav img, .gavatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.av { overflow: hidden; }
.bubble.rich { cursor: pointer; padding-bottom: 22px; min-width: 200px; }
.kind { font-size: 11.5px; color: var(--meta); margin: 0 0 3px; letter-spacing: .1px; }
.tnote { font-size: 12px; color: var(--meta); margin: 0 0 4px; }
.decision { margin-top: 6px; padding-top: 5px; border-top: 1px dashed rgba(0, 0, 0, .12); font-size: 13.5px; line-height: 18px; }
.decision b { font-weight: 600; }
.qnote { font-size: 11.5px; color: var(--meta); margin-top: 8px; }
.pq {
  margin: 6px 0 2px; padding: 5px 10px 6px; border-radius: 6px;
  background: var(--quote-bg); border-inline-start: 4px solid #e9a100;
  font-size: 14px; line-height: 19px; white-space: normal;
}
.pq span { display: block; font-size: 11.5px; color: #b07800; font-weight: 500; margin-bottom: 2px; }
.srcs { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; font-size: 12px; white-space: normal; }
.srcs a { color: #027eb5; text-decoration: none; }
.srcs a:hover { text-decoration: underline; }
.srcs .more { color: var(--meta); }
:root[data-theme="dark"] .srcs a { color: #53bdeb; }
:root[data-theme="dark"] .decision { border-color: rgba(255, 255, 255, .12); }

.pinned {
  flex: none; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 14px; text-align: start;
  background: var(--field); color: var(--text);
  font-size: 13px; line-height: 17px;
  box-shadow: 0 1px 2px rgba(11, 20, 26, .15);
  z-index: 4;
}
.pinned[hidden], .readonly[hidden], .sheet[hidden], .composer[hidden] { display: none; }
.pinned svg { width: 18px; height: 18px; color: var(--meta); flex: none; transform: rotate(45deg); }
.pinned span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.readonly {
  flex: none; width: 100%;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--field); color: var(--meta);
  font-size: 13.5px; text-align: center;
  box-shadow: 0 -1px 2px rgba(11, 20, 26, .08);
}

.sheet {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(11, 20, 26, .45);
  display: flex; align-items: flex-end;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet-card {
  position: relative; width: 100%; max-height: 82%;
  background: var(--field); color: var(--text);
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: #c9d1d6; margin: 8px auto 0; flex: none; }
.sheet-close { position: absolute; top: 10px; left: 12px; width: 32px; height: 32px; border-radius: 50%; color: var(--meta); font-size: 16px; }
.sheet-body { overflow-y: auto; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); font-size: 14px; line-height: 1.55; }
.sheet-body h3 { font-size: 16px; margin: 12px 0 6px; }
.sheet-body h4 { font-size: 13px; color: var(--meta); font-weight: 600; margin: 14px 0 6px; }
.sheet-body p { margin: 0 0 10px; }
.sh-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; padding-inline-end: 34px; }
.sh-head small { display: block; color: var(--meta); font-size: 12px; }
.sh-av { width: 44px; height: 44px; visibility: visible; margin: 0; font-size: 15px; }
.sheet-body dl { margin: 0; }
.kv { padding: 7px 0; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.kv dt { font-size: 12px; color: var(--meta); }
.kv dd { margin: 1px 0 0; }
.caveat { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #fff5c4; color: #54410a; }
:root[data-theme="dark"] .caveat { background: #3a3218; color: #ffd279; }
.caveat p { margin: 4px 0 0; }
.srclist, .credits { list-style: none; margin: 0; padding: 0; }
.srclist li, .credits li { padding: 6px 0; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.srclist a, .credits a { color: #027eb5; text-decoration: none; }
.srclist small { display: block; color: var(--meta); font-size: 11.5px; direction: ltr; text-align: right; }
.credits { font-size: 12.5px; }

.memorial { font-size: 12px; color: #6b4f00; font-weight: 500; margin: 0 0 4px; }
:root[data-theme="dark"] .memorial { color: #ffd279; }

/* real published messages (Nova): plain white bubble, message text first */
.in .bubble.real { background: linear-gradient(180deg, #ffffff, #f7f9fa); }
.row.in.first .bubble.real::before { background: #ffffff; }
.bubble.real .body { font-size: 15.5px; line-height: 21px; display: block; margin: 2px 0; }
:root[data-theme="dark"] .in .bubble.real { background: #2a3942; }
:root[data-theme="dark"] .row.in.first .bubble.real::before { background: #2a3942; }

/* voice note with transcript (recordings) */
.bubble.vn.rich { width: min(330px, 86%); }
.bubble.vn .voice { padding-bottom: 4px; }
.bubble.vn .dur { position: static; display: block; margin: -2px 62px 4px 0; }
.vt { border-top: 1px dashed rgba(0, 0, 0, .12); padding-top: 6px; margin-top: 2px; }
.vtt { font-size: 14px; line-height: 19px; }
.vtt::before { content: "תמלול: "; color: var(--meta); font-size: 12px; }

/* seekable waveform knob, like a real voice message */
.voice .wave .knob {
  position: absolute; top: 50%; right: -6px; width: 13px; height: 13px; margin-top: -6.5px;
  border-radius: 50%; background: #34b7f1; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  pointer-events: none; transition: transform .1s;
}
.bubble.seeking .knob { transform: scale(1.35); }

/* plain (drama) mode: bubbles look like a real group; tap opens the details */
.bubble.tap { cursor: pointer; }
:root.plain .vtt::before { content: none; }
:root.plain .vt { border-top: 0; padding-top: 0; }

/* time jump in the dramatized version */
.chip.skip { background: rgba(17, 27, 33, .55); color: #fff; font-size: 12px; letter-spacing: .5px; padding: 3px 10px 4px; direction: ltr; }

/* video message */
.bubble.vid .vbox { position: relative; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.bubble.vid video { display: block; width: 100%; max-width: 280px; min-width: 210px; aspect-ratio: 9 / 16; max-height: 360px; object-fit: cover; background: #111; }
.bubble.vid .vplay { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; pointer-events: none; }
.bubble.vid .vplay svg { width: 30px; height: 30px; }
.bubble.vid .vdur { position: absolute; bottom: 6px; inset-inline-start: 8px; color: #fff; font-size: 11.5px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); pointer-events: none; }
.bubble.vid .vbox.on .vplay, .bubble.vid .vbox.on .vdur { display: none; }

/* sound unlock hint (browsers need one tap before playing sound) */
.sndhint {
  position: absolute; top: 172px; left: 50%; transform: translateX(-50%); z-index: 7;
  padding: 7px 14px; border-radius: 16px; font-size: 13px;
  background: rgba(17, 27, 33, .78); color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  white-space: nowrap;
}
@media (max-width: 899px), (max-height: 560px) { .sndhint { top: calc(124px + env(safe-area-inset-top)); } }

/* jump to hour */
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.hours button { padding: 10px 0; border-radius: 10px; background: var(--quote-bg); font-size: 15px; font-weight: 500; direction: ltr; }
.hours button:hover { background: rgba(0, 168, 132, .15); }

/* WhatsApp "unread messages" bar + infinite-scroll trigger */
.chip.unread { align-self: stretch; max-width: none; margin: 10px 0 8px; border-radius: 0; background: rgba(255, 255, 255, .55); color: #54656f; font-size: 12.5px; box-shadow: none; }
:root[data-theme="dark"] .chip.unread { background: rgba(32, 44, 51, .7); color: #8696a0; }
.sentinel { height: 1px; }

/* private chat: no avatars/sender column */
:root.private .row .av { display: none; }
/* contact card */
.contact { text-align: center; padding: 6px 0 4px; }
.contact .cav { width: 132px; height: 132px; border-radius: 50%; margin: 6px auto 10px; display: grid; place-items: center; font-size: 46px; color: #fff; overflow: hidden; }
.contact .cav img { width: 100%; height: 100%; object-fit: cover; }
.contact h3 { margin: 4px 0 2px; font-size: 21px; }
.contact .crole { color: var(--meta); margin: 0 0 6px; }
.contact .ccount { color: var(--meta); font-size: 13px; margin: 0 0 14px; }
.contact .cmsg { padding: 10px 22px; border-radius: 22px; background: var(--fab); color: #fff; font-size: 15px; font-weight: 500; }
.av, .sender { cursor: pointer; }
/* chats list */
.chats { position: absolute; inset: 0; z-index: 35; background: var(--field); color: var(--text); display: flex; flex-direction: column; }
.chats[hidden] { display: none; }
.chats-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 50px 8px 0; height: 108px; background: var(--header); color: var(--header-fg); font-size: 19px; }
@media (max-width: 899px), (max-height: 560px) { .chats-head { padding-top: env(safe-area-inset-top); height: calc(58px + env(safe-area-inset-top)); } }
:root.noframe .chats-head { padding-top: 0; height: 58px; }
.chats-head .icon svg { transform: scaleX(-1); }
.chats-list { flex: 1; overflow-y: auto; }
.chatrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: start; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.chatrow:hover { background: rgba(0, 0, 0, .03); }
.chatrow .cav { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; color: #fff; font-size: 22px; }
.chatrow .cav img { width: 100%; height: 100%; object-fit: cover; }
.chatrow .cbody { min-width: 0; flex: 1; }
.chatrow b { display: block; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatrow small { display: block; color: var(--meta); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chats-sec { padding: 14px 16px 6px; color: var(--fab); font-size: 13px; font-weight: 600; }

/* ---------- desktop: WhatsApp Desktop layout (rail + chat list + chat) ---------- */
:root { --panel: #f0f2f5; --side-bg: #fff; --line: #e9edef; --icon2: #54656f; --active: #f0f2f5; }
:root[data-theme="dark"] { --panel: #202c33; --side-bg: #111b21; --line: #222d34; --icon2: #aebac1; --active: #2a3942; }
.rail, .side { display: none; }
@media (min-width: 900px) and (min-height: 561px) {
  :root:not(.mockup):not(.noframe) body { background: var(--side-bg); }
  :root:not(.mockup):not(.noframe) .stage { padding: 0; display: block; height: 100dvh; }
  :root:not(.mockup):not(.noframe) .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: var(--side-bg); box-shadow: none; display: flex; }
  :root:not(.mockup):not(.noframe) .phone::before, :root:not(.mockup):not(.noframe) .phone::after,
  :root:not(.mockup):not(.noframe) .island, :root:not(.mockup):not(.noframe) .floor, :root:not(.mockup):not(.noframe) .statusbar { display: none; }
  :root:not(.mockup):not(.noframe) .screen { flex: 1; min-width: 0; border-radius: 0; }
  :root:not(.mockup):not(.noframe) .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; flex: none; padding-top: 14px; background: var(--panel); border-inline-end: 1px solid var(--line); }
  .rail-i { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--icon2); }
  .rail-i svg { width: 24px; height: 24px; }
  .rail-i.on { background: rgba(0, 0, 0, .08); color: var(--text); }
  :root:not(.mockup):not(.noframe) .side { display: flex; flex-direction: column; flex: none; width: clamp(340px, 30vw, 440px); background: var(--side-bg); border-inline-end: 1px solid var(--line); }
  .side-head { display: flex; align-items: center; height: 64px; padding: 0 20px; font-size: 22px; color: var(--text); }
  .side-head b { font-weight: 700; }
  .side-search { display: flex; align-items: center; gap: 10px; margin: 0 14px 8px; padding: 0 14px; height: 38px; border-radius: 19px; background: var(--panel); color: var(--icon2); }
  .side-search svg { width: 20px; height: 20px; flex: none; }
  .side-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--text); }
  .side-filters { display: flex; gap: 8px; padding: 2px 14px 10px; }
  .side-filters button { padding: 6px 14px; border-radius: 16px; background: var(--panel); color: var(--icon2); font-size: 14px; }
  .side-filters button.on { background: #d9fdd3; color: #008069; }
  :root[data-theme="dark"] .side-filters button.on { background: #0a332c; color: #00a884; }
  .side-list { flex: 1; overflow-y: auto; }
  .side-list .chatrow { border-bottom: 1px solid var(--line); color: var(--text); }
  .side-list .chatrow.active { background: var(--active); }
  .chats-empty { padding: 30px; text-align: center; color: var(--meta); }
  /* chat pane: WhatsApp Desktop look */
  :root:not(.mockup):not(.noframe) .topbar { background: var(--panel); color: var(--text); height: 64px; padding: 0 16px; border-inline-start: 1px solid var(--line); }
  :root:not(.mockup):not(.noframe) .topbar .icon { color: var(--icon2); }
  :root:not(.mockup):not(.noframe) .topbar .back { display: none; }
  :root:not(.mockup):not(.noframe) .gsub { color: var(--meta); opacity: 1; }
  :root:not(.mockup):not(.noframe) .gavatar { width: 40px; height: 40px; }
  :root:not(.mockup):not(.noframe) .composer { background: var(--panel); padding: 8px 16px 10px; }
  :root:not(.mockup):not(.noframe) .field { border-radius: 8px; min-height: 42px; box-shadow: none; }
  :root:not(.mockup):not(.noframe) .fab { background: transparent; color: var(--icon2); box-shadow: none; }
  :root:not(.mockup):not(.noframe) .chat-inner { padding-inline: 5%; }
  :root:not(.mockup):not(.noframe) .bubble { max-width: min(65%, 560px); }
  :root:not(.mockup):not(.noframe) .chats { display: none !important; }
  :root:not(.mockup):not(.noframe) .sndhint { top: 132px; }
  :root:not(.mockup):not(.noframe) .menu { top: 52px; left: 16px; }
}
