/* The chat backgrounds of decision 59 (real video loops, js/walls.js) and the Backgrounds screen (js/views/backgrounds.js).
   A .wall holds a poster (the clip's first frame), two stacked <video> elements that dissolve into each other at the loop point,
   and a scrim in the look's own colours (--bg) so the bubbles stay readable and the picture stays calm. Nothing here animates
   except the dissolve itself (opacity); the page decides what plays (one at a time, only while visible, never with less motion). */

.wall .wv { position: absolute; inset: 0; overflow: hidden; }
.wall .wv-poster, .wall .wv-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
.wall .wv-noposter { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 24%, var(--surface-2)), var(--surface-2)); }
.wall .wv-v { opacity: 0; background: transparent; transition: opacity .8s linear; }
.wall .wv-v.on { opacity: 1; }
/* the scrim: the look's background colour over the picture; a little more in dark mode */
.wall .wv-scrim { position: absolute; inset: 0; --dim: 32%; background: color-mix(in srgb, var(--bg) var(--dim), transparent); }
:root[data-mode="dark"] .wall .wv-scrim { --dim: 50%; }
@media (prefers-reduced-motion: reduce) { .wall .wv-v { transition: none; } }
/* a frozen Aurora (a tile that is not the chosen one) */
.wall.still::before, .wall.still::after { animation: none !important; }
/* a preview tile that is off screen */
.bg-live.off .wall::before, .bg-live.off .wall::after { animation-play-state: paused !important; }

/* ---------- thumbnails in the Customize sheet: the clip's first frame ---------- */
.wp-tile > .wall { position: absolute; inset: 0; z-index: 0; }
.wp-tile.wp-scene { color: #fff; }
.wp-tile > .wall ~ .wp-name, .bgs-pick .wp-name { padding: 1px 6px; border-radius: 8px; background: #0000005c; text-shadow: none; }
.wp-tile.wp-none .wp-name { background: none; }

/* ---------- the Backgrounds screen ---------- */
.bgs-default { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--glass-line); }
.bgs-default .bg-live { width: 76px; flex: none; }
.bgs-default .grow { min-width: 0; }
.bgs-default strong { display: block; }
.bgs-default small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.bgs-group { margin-top: 22px; }
.bgs-ghead { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
.bgs-ghead h2 { margin: 0; font-size: calc(18px * var(--fz)); }
.bgs-ghead .emo { font-size: calc(22px * var(--fz)); line-height: 1; }
.bgs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .bgs-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bgs-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--glass-line); min-width: 0; }
.bgs-card.is-default { box-shadow: inset 0 0 0 2px var(--accent); }
.bg-live { position: relative; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface-2); isolation: isolate; }
.bg-live .wall { z-index: 0; }
.bg-live .bg-badge { position: absolute; z-index: 1; top: 6px; inset-inline-start: 6px; padding: 2px 8px; border-radius: 999px; font-size: calc(11px * var(--fz)); font-weight: 800; color: #fff; background: color-mix(in srgb, var(--accent) 88%, #000); }
.bg-live .bg-mock, .ov-frame .bg-mock { position: absolute; z-index: 1; inset-inline: 8px; bottom: 10px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.bg-mock i { display: block; height: 10px; border-radius: 6px; background: var(--glass); box-shadow: 0 1px 2px #0002; width: 62%; }
.bg-mock i.me { align-self: flex-end; width: 48%; background: var(--accent); opacity: .9; }
.bgs-name { display: flex; align-items: baseline; gap: 6px; padding: 0 4px; font-weight: 800; }
.bgs-name small { color: var(--muted); font-weight: 600; margin-inline-start: auto; }
.bgs-chats { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-wrap: wrap; gap: 6px; }
.bgs-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 3px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: calc(13px * var(--fz)); cursor: pointer; }
[dir="rtl"] .bgs-chip { padding: 3px 3px 3px 10px; }
.bgs-chip .avatar { flex: none; }
.bgs-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bgs-chip .dflt { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.bgs-none { color: var(--muted); font-size: calc(13px * var(--fz)); padding: 0 4px; }
.bgs-add { align-self: flex-start; }
.bgs-legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: calc(12px * var(--fz)); margin: 10px 4px 0; }
.bgs-legend .dflt { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
/* the pickers in the sheets */
.bgs-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bgs-pick .wp-tile { min-height: 0; aspect-ratio: 3 / 4; }
.bgs-pick-h { margin: 14px 2px 8px; font-size: calc(14px * var(--fz)); color: var(--muted); }
.bgs-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow: auto; }
.bgs-checks label { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 14px; cursor: pointer; }
.bgs-checks label:hover { background: var(--surface-2); }
.bgs-checks .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgs-checks small { color: var(--muted); }
.bgs-checks input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* a card that plays after a tap: a small play mark on the poster, gone while it plays */
.bg-live[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bg-live[role="button"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bg-play { position: absolute; z-index: 1; top: 50%; inset-inline-start: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #0000006e; pointer-events: none; transition: opacity .25s; }
[dir="rtl"] .bg-play { margin-inline-start: -17px; margin-left: 0; }
.bg-play::after { content: ""; position: absolute; top: 50%; left: 50%; border: solid transparent; border-width: 7px 0 7px 11px; border-left-color: #fff; transform: translate(-35%, -50%); }
.bg-live.playing .bg-play { opacity: 0; }
.bgs-chip-bg { color: var(--muted); font-size: calc(11px * var(--fz)); }

/* the own-video preview dialog */
.ov-frame { position: relative; width: min(190px, 52vw); aspect-ratio: 9 / 16; margin: 6px auto 12px; border-radius: 20px; overflow: hidden; isolation: isolate; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--glass-line); }
.ov-stage { position: absolute; inset: 0; z-index: 0; }
.ov-stage .wv { position: absolute; inset: 0; }
.ov-pick { display: flex; flex-direction: column; gap: 2px; }
.ov-range { text-align: center; font-variant-numeric: tabular-nums; }
.ov-progress { width: 100%; height: 8px; margin-top: 8px; accent-color: var(--accent); }
.wp-vid .ico { top: 8px; }

/* ---------- Decision 60: my groups of chats (js/views/groups.js, js/views/chats.js) ---------- */
/* the chips under the search: All, Unread, Favourites, then one per group */
.chat-chips { display: flex; gap: 8px; padding: 0 14px 8px; overflow-x: auto; scrollbar-width: none; flex: none; position: relative; z-index: 2; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips:empty { display: none; } /* no groups yet: no chips row */
.chat-chips .chip { flex: none; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 28px; }
/* select mode: the bar replaces the header; a tick on every row */
.list-head.sel-bar { gap: 6px; padding-inline: 6px; }
.list-head.sel-bar .btn { flex: 0 1 auto; min-width: 0; min-height: 40px; padding: 0 10px; gap: 5px; font-size: calc(13px * var(--fz)); white-space: nowrap; }
.list-head.sel-bar .btn .ico { width: 18px; height: 18px; }
.list-head.sel-bar .sel-count { flex: none; min-width: 32px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); text-align: center; font-variant-numeric: tabular-nums; }
.chat-row .sel-tick { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); color: var(--accent-ink); transition: background-color .15s, border-color .15s; }
.chat-row .sel-tick .ico { width: 16px; height: 16px; opacity: 0; }
.chat-row.picked { background: var(--accent-soft); border-color: var(--accent); }
.chat-row.picked .sel-tick { background: var(--accent); border-color: var(--accent); }
.chat-row.picked .sel-tick .ico { opacity: 1; }
/* the My groups section of the Backgrounds screen */
.grp-section .bgs-ghead .emo .ico { width: 24px; height: 24px; }
.grp-hint { margin: 0 4px 10px; font-size: calc(13px * var(--fz)); line-height: 1.4; }
.grp-list { display: flex; flex-direction: column; gap: 12px; }
.grp-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 22px; background: var(--glass); border: var(--gw) solid var(--glass-line); box-shadow: var(--shadow), inset 0 1px 0 var(--hi); min-width: 0; }
.grp-top { display: flex; gap: 12px; min-width: 0; }
.grp-poster { position: relative; flex: none; width: 84px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface-2); isolation: isolate; }
.grp-poster .wall { position: absolute; inset: 0; z-index: 0; }
.grp-poster.nobg { outline: 2px dashed var(--glass-line); outline-offset: -2px; }
.grp-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.grp-info .grp-name { font-size: calc(18px * var(--fz)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-info small { color: var(--muted); }
.grp-faces { display: flex; align-items: center; margin-top: auto; padding-inline-start: 8px; }
.grp-faces .avatar { margin-inline-start: -8px; box-shadow: 0 0 0 2px var(--bg); }
.grp-more { margin-inline-start: 4px; color: var(--muted); font-size: calc(12px * var(--fz)); font-weight: 800; }
.grp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grp-actions .btn { flex: 1 1 auto; justify-content: center; min-width: 0; padding-inline: 12px; font-size: calc(13px * var(--fz)); }
.grp-head { display: flex; align-items: center; gap: 2px; min-width: 0; }
.grp-head .grp-name { flex: 1; min-width: 0; }
.grp-head .icon-btn { flex: none; width: 36px; height: 36px; margin-block: -4px; }
.grp-head .icon-btn:first-of-type { margin-inline-start: 4px; }
.grp-head .icon-btn:last-of-type { margin-inline-end: -6px; }
.grp-section { margin-bottom: 20px; }
.grp-field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.grp-new .look-scroll { padding-bottom: 12px; }
.grp-new .sh-foot .grow { margin-inline-end: auto; }
.bgs-chip .dflt.grp { background: var(--a2, var(--accent)); border-radius: 3px; }
