/* LiteShare — design tokens and components.
   All colours live in the token blocks below; change them there only. */

:root,
:root[data-theme="light"] {
  /* the start: the same as the Android app's splash (values/ic_launcher_background.xml),
     whatever the theme, so one goes into the other without a jump */
  --start-bg: #141821;
  --accent: #2f6fd6;
  --accent-hover: #255cb5;
  --accent-contrast: #ffffff;
  --accent-soft: #d9e6fb;
  --bg: #f3f5fa;
  --panel: #ffffff;
  --panel-2: #eef1f7;
  --border: #d9dee9;
  --text: #1a2030;
  --text-2: #5f6b82;
  --bubble-own: #d9e6fb;
  --bubble-other: #ffffff;
  --bubble-own-text: #1a2030;
  --bubble-other-text: #1a2030;
  --success: #2c9c73;
  --warning: #c98319;
  --danger: #d2433b;
  --danger-contrast: #ffffff;
  --logo-lite: #1a2030;
  --logo-share: #2f6fd6;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 8px 24px rgba(20, 30, 60, .06);
  --focus: 0 0 0 3px rgba(47, 111, 214, .35);
}

:root[data-theme="dark"] {
  --accent: #5892e8;
  --accent-hover: #6ea2ee;
  --accent-contrast: #0e1320;
  --accent-soft: #264a7d;
  --bg: #141821;
  --panel: #1b2030;
  --panel-2: #232a3a;
  --border: #2d3548;
  --text: #e3e6f0;
  --text-2: #97a0b5;
  --bubble-own: #264a7d;
  --bubble-other: #232a3a;
  --bubble-own-text: #e3e6f0;
  --bubble-other-text: #e3e6f0;
  --success: #3fb68b;
  --warning: #e8a33d;
  --danger: #e5534b;
  --danger-contrast: #1a1d24;
  --logo-lite: #e3e6f0;
  --logo-share: #5892e8;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --focus: 0 0 0 3px rgba(88, 146, 232, .45);
}

:root {
  /* safe-area insets count only where the app really draws behind the system bars; a
     browser page ends above them (and Firefox on Android reports an inset regardless) */
  --inset-top: 0px;
  --inset-bottom: 0px;
  --inset-right: 0px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  /* a call is dark in both themes: a bright screen against a face is unpleasant, and a
     video looks wrong on anything but a dark surround */
  --call-bg: #0b0f18;
  --call-text: #e3e6f0;
  --call-text-2: #aab2c5;
  --call-btn: rgba(255, 255, 255, .14);
  --call-btn-hover: rgba(255, 255, 255, .22);
  --call-accept-contrast: #05130d;
  color-scheme: light dark;
}

/* the app does not zoom as a whole: two fingers only scroll; the picture viewer and the map
   take the gesture themselves (touch-action: none) */
:root.native { touch-action: pan-x pan-y; }
:root.native {
  --inset-top: env(safe-area-inset-top, 0px);
  --inset-bottom: env(safe-area-inset-bottom, 0px);
  --inset-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; }

h1 { font-size: 1.45rem; margin: 0 0 .5rem; font-weight: 650; }
p { margin: .5rem 0; }
code { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--text-2); }
.small { font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- Wordmark ------------------------------------------------------------ */

.logo { font-weight: 750; letter-spacing: -.01em; font-size: 1.25rem; white-space: nowrap; }
.logo-lite { color: var(--logo-lite); }
.logo-share { color: var(--logo-share); }
.logo-large { font-size: 2.2rem; }

.boot { display: grid; place-items: center; min-height: 100vh; background: var(--start-bg); }
/* the logo at the size Android shows it on its start screen (160 dp) */
.boot-logo { width: 160px; height: 160px; }

/* ---- Pre-login screens ----------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: max(1.5rem, var(--inset-top)) 1rem max(1.5rem, var(--inset-bottom));
}

.auth-card, .card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
}

.auth-logo { text-align: center; margin-bottom: 1.25rem; }

.server-line {
  display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; justify-content: space-between;
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--text-2); font-size: .9rem;
}

.fingerprint { font-size: .88rem; margin-top: .75rem; }
.device-list { display: flex; flex-direction: column; gap: .35rem; max-height: 45vh; overflow-y: auto; }
.web-hint { font-size: .8rem; color: var(--text-2); border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .75rem; }
.fingerprint code { letter-spacing: .04em; }

/* ---- Forms ------------------------------------------------------------------ */

.form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label { font-weight: 600; font-size: .92rem; }
.field-hint { color: var(--text-2); font-size: .84rem; }

input[type="text"], input[type="password"], input[type="search"], input:not([type]), select, textarea {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .8rem;
  width: 100%;
  outline: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { box-shadow: var(--focus); border-color: var(--accent); }

.input-group { display: flex; position: relative; }
.input-group input { padding-right: 2.75rem; }
.input-addon {
  position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--text-2); cursor: pointer; padding: .4rem .55rem; border-radius: 6px; font-size: 1rem;
}
.input-addon[aria-pressed="true"] { color: var(--accent); }

.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; cursor: pointer; margin-top: .5rem; }
.check input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; }

.notice {
  border-left: 4px solid var(--warning);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  font-size: .92rem;
}
.notice p { margin: .35rem 0 0; color: var(--text-2); }

/* password strength */
.meter { display: flex; align-items: center; gap: .75rem; margin-top: -.5rem; }
.meter-track { flex: 1; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.meter[data-score="2"] .meter-fill { background: var(--warning); }
.meter[data-score="3"] .meter-fill, .meter[data-score="4"] .meter-fill { background: var(--success); }
.meter-text { font-size: .82rem; color: var(--text-2); min-width: 6rem; text-align: right; }

/* ---- Buttons ------------------------------------------------------------------ */

.actions { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }
.actions.stacked { flex-direction: column; margin-top: 1.25rem; }

.btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: .65rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[disabled] { opacity: .55; cursor: default; }

.link { font: inherit; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Messages & progress ----------------------------------------------------------- */

.msg { border-radius: var(--radius-sm); padding: .65rem .85rem; font-size: .92rem; }
.msg-error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.msg-info { background: var(--panel-2); color: var(--text-2); }

.progress { display: flex; flex-direction: column; gap: .4rem; }
.progress-track { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .8s linear; }
.progress.indeterminate .progress-fill { width: 35%; animation: slide 1.1s ease-in-out infinite; }
.progress-caption { font-size: .86rem; color: var(--text-2); }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---- Preferences bar ----------------------------------------------------------------- */

.prefs-bar { display: flex; gap: .75rem; justify-content: center; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
select { -webkit-appearance: auto; appearance: auto; }
.prefs-bar select { width: auto; padding: .35rem .6rem; font-size: .88rem; background: transparent; color: var(--text-2); }

/* ---- Logged-in shell ---------------------------------------------------------------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.75rem + var(--inset-top)) 1rem .75rem;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.home { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding: 2rem 1rem; }

.conn { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--panel-2); color: var(--text-2); display: inline-flex; align-items: center; gap: .4rem; }
.conn::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--warning); }
.conn[data-state="online"]::before { background: var(--success); }
.conn[data-state="offline"]::before { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Messenger: two panes on wide screens, one pane on phones ---------------------- */

.icon { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { border-color: var(--danger); }

.messenger {
  display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); overflow: hidden;
  /* Android 15 and installed apps draw behind the navigation bar: stay above it, rather
     than padding every element that would otherwise end up underneath */
  height: calc(var(--app-height, 100dvh) - var(--inset-bottom));
}

.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--border); }
.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.6rem + var(--inset-top)) .75rem .6rem 1rem; border-bottom: 1px solid var(--border);
}
.side-actions { display: flex; align-items: center; gap: .25rem; flex: none; }
/* on a narrow phone the logo yields first, and the buttons are never pushed off the edge */
.side-head .logo { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-head .conn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions .conn { margin-right: .25rem; }

/* our own context menu: a layer that catches the click beside it, and the menu itself */
.ctx-layer { position: fixed; inset: 0; z-index: 60; }
.ctx-menu {
  position: fixed; min-width: 11rem; padding: .3rem; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.ctx-menu button {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--panel-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu .icon { width: 1.1rem; height: 1.1rem; flex: none; }

.info-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.info-list dt { color: var(--text-2); }
.info-list dd { margin: 0; }
.danger-text { color: var(--danger); overflow-wrap: anywhere; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + .25rem); z-index: 20; min-width: 12rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .3rem;
}
.menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: none; border: 0; border-radius: 6px; padding: .55rem .7rem; cursor: pointer;
}
.menu button:hover { background: var(--panel-2); }

.banner { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; background: var(--accent-soft); font-size: .88rem; }
.banner .link { margin-left: auto; }

.search-wrap { position: relative; padding: .6rem .75rem; }
.search-wrap .icon { position: absolute; left: 1.3rem; top: 50%; transform: translateY(-50%); color: var(--text-2); width: 1.05rem; height: 1.05rem; }
.search { padding-left: 2.3rem !important; border-radius: 999px !important; }

.conv-list { position: relative; flex: 1; overflow-y: auto; }
.list-empty { padding: 1.5rem 1rem; text-align: center; }
.conv-item {
  display: flex; gap: .75rem; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  padding: .65rem .9rem; cursor: pointer;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item[aria-current="true"] { background: var(--accent-soft); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.conv-top, .conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.conv-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: .76rem; color: var(--text-2); flex: none; }
.conv-preview { color: var(--text-2); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .2rem; }
.conv-preview .typing, .chat-sub:empty + * { color: var(--accent); }
/* the mark of one's own last message, centred on the line (inline it sat on the baseline, too high) */
.conv-preview .status { display: inline-flex; justify-content: center; align-items: center; flex: none; vertical-align: middle; margin: -.15em .15rem 0 0; }
.composer-hint { color: var(--danger); font-size: .88rem; transition: opacity .4s; }
/* in place of the composer: the account of this chat was deleted */
.chat-gone { margin: 0; padding: .9rem .75rem; text-align: center; font-size: .88rem; background: var(--panel); border-top: 1px solid var(--border); }
.chat-head .icon-btn:disabled { opacity: .35; cursor: default; background: none; color: inherit; }
.composer-hint.fading { opacity: 0; }
/* news that is no error ("Saved to your stickers."): neutral, without the red mark */
.composer-hint.info { color: var(--text-2); }
.composer-hint.info .mark-failed { display: none; }
.badge { background: var(--accent); color: var(--accent-contrast); border-radius: 999px; font-size: .74rem; font-weight: 700; min-width: 1.35rem; padding: 0 .4rem; text-align: center; line-height: 1.35rem; flex: none; }

.avatar {
  width: 2.8rem; height: 2.8rem; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .icon { width: 1.4rem; height: 1.4rem; }
.avatar-large { width: 4.5rem; height: 4.5rem; font-size: 1.8rem; }
.av-0 { background: #4f7fd9; } .av-1 { background: #3fa27f; } .av-2 { background: #c7703a; } .av-3 { background: #9160c7; }
.av-4 { background: #c2476c; } .av-5 { background: #2f9bb0; } .av-6 { background: #7c8b2f; } .av-7 { background: #6b6fd0; }
.sender.av-0, .sender.av-1, .sender.av-2, .sender.av-3, .sender.av-4, .sender.av-5, .sender.av-6, .sender.av-7 { background: none; }
.sender.av-0 { color: #4f7fd9; } .sender.av-1 { color: #3fa27f; } .sender.av-2 { color: #c7703a; } .sender.av-3 { color: #9160c7; }
.sender.av-4 { color: #c2476c; } .sender.av-5 { color: #2f9bb0; } .sender.av-6 { color: #8a9a35; } .sender.av-7 { color: #6b6fd0; }

/* chat pane */
.chat-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.chat-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: .5rem; text-align: center; padding: 2rem; }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-head {
  display: flex; align-items: center; gap: .5rem;
  padding: calc(.5rem + var(--inset-top)) .75rem .5rem; background: var(--panel); border-bottom: 1px solid var(--border);
}
.chat-head .back { display: none; }
.chat-head .avatar { width: 2.4rem; height: 2.4rem; font-size: 1rem; }
.chat-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; font: inherit; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; padding: 0 .25rem; }
.chat-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.chat-sub { font-size: .8rem; color: var(--text-2); min-height: 1em; }
.chat > .msg { margin: .5rem .75rem 0; }

/* the list decides its own scrolling: the browser's anchoring would move it while a bubble
   grows, which looks to us like the reader scrolling away */
.msgs { overflow-anchor: none; position: relative; flex: 1; overflow-y: auto; padding: 1rem clamp(.75rem, 4vw, 3rem); display: flex; flex-direction: column; gap: .25rem; }
.chat-hint { text-align: center; margin: auto; }
/* the message list with its "to the newest" button, which stays put while the list scrolls */
.msgs-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* the chat's background (SPEC §16.2): a layer behind the messages, painted through the CSSOM
   (ui/background.js) — a pattern as a mask in a faint shade of the text colour, a colour or a
   picture under a softening layer of the theme's background */
.chat-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; background: var(--bg); }
.msgs-wrap > .msgs { position: relative; }
.chat-bg[data-bg="pattern"]::before {
  content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--text) 10%, transparent);
  -webkit-mask-image: var(--bg-pattern); mask-image: var(--bg-pattern);
  -webkit-mask-size: var(--bg-pattern-size); mask-size: var(--bg-pattern-size);
}
.chat-bg[data-bg="colour"] { background: var(--bg-colour); }
.chat-bg[data-bg="picture"] { background: var(--bg-picture) var(--bg-focus) / cover no-repeat; }
/* a video: its first frame underneath (built-in ones), the video itself shown only once it
   plays — never the browser's empty video with a play icon */
.chat-bg[data-bg="video"] { background: var(--bg-picture, none) var(--bg-focus) / cover no-repeat var(--bg); }
.chat-bg .bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--bg-focus);
  opacity: 0; transition: opacity .25s;
}
.chat-bg .bg-video.playing { opacity: 1; }
.chat-bg[data-bg="colour"]::after, .chat-bg[data-bg="picture"]::after, .chat-bg[data-bg="video"]::after {
  content: ''; position: absolute; inset: 0; background: var(--bg); opacity: var(--bg-dim);
}
.to-end {
  position: absolute; right: 1rem; bottom: .75rem; z-index: 2; width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--panel); color: var(--text-2); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.to-end[hidden] { display: none; }
.older { align-self: center; margin: .5rem 0; }
.day { align-self: center; margin: .75rem 0 .35rem; }
.day span { background: var(--panel); border: 1px solid var(--border); color: var(--text-2); font-size: .76rem; border-radius: 999px; padding: .15rem .7rem; }
.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.bubble {
  max-width: min(75%, 42rem); padding: .45rem .7rem .3rem; border-radius: 14px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
  background: var(--bubble-other); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--bubble-other-text);
}
.msg-row.in .bubble { border-bottom-left-radius: 4px; }
.msg-row.out .bubble { background: var(--bubble-own); color: var(--bubble-own-text); border-color: transparent; border-bottom-right-radius: 4px; }
.bubble.failed { border: 1px solid var(--danger); }
.bubble .sender { font-size: .8rem; font-weight: 650; margin-bottom: .1rem; }
/* Only the chat follows the reading size chosen in the settings. The base is 15px because
   that is what the app is set in (body); 1rem would be the browser's 16px and would quietly
   enlarge every bubble. */
.bubble .text, .bubble .file-name, .voice-time { font-size: calc(15px * var(--chat-font, 1)); }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* links in a message, and the card of a preview its sender made */
.msg-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble.out .msg-link, .msg-row.out .msg-link { color: inherit; }
.text-with-card { display: flex; flex-direction: column; gap: .4rem; }
.link-card { display: flex; flex-direction: column; border-radius: var(--radius-sm); overflow: hidden; background: var(--panel-2); color: var(--text); text-decoration: none; max-width: 22rem; }
.link-card-img { width: 100%; max-height: 11rem; object-fit: cover; display: block; }
.link-card-body { display: flex; flex-direction: column; gap: .15rem; padding: .45rem .6rem; min-width: 0; }
.link-card-title { font-weight: 600; font-size: .9rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card-desc { font-size: .8rem; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card-host { font-size: .75rem; color: var(--text-2); }
.link-bar-img { width: 2.6rem; height: 2.6rem; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.link-bar-spin { width: 1.4rem; height: 1.4rem; border-width: 2px; flex: none; }
.link-bar .pending-text { flex: 1; }
/* a quoted message above a reply, and the same shape above the composer */
.quote, .pending-text {
  display: flex; flex-direction: column; gap: .05rem; width: 100%; text-align: start;
  padding: .25rem .5rem; margin-bottom: .25rem; border: 0; border-inline-start: 3px solid var(--accent);
  border-radius: 5px; background: color-mix(in srgb, var(--accent) 10%, transparent); font: inherit; color: inherit;
}
.quote { cursor: pointer; }
.quote-who { font-size: .8rem; font-weight: 650; }
.quote-text { font-size: .85rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forwarded { display: flex; align-items: center; gap: .3rem; font-size: .78rem; margin-bottom: .1rem; }
.forwarded .icon { width: .9rem; height: .9rem; }
.text.deleted { display: flex; align-items: center; gap: .35rem; font-style: italic; color: var(--text-2); }
.text.deleted .icon { width: 1rem; height: 1rem; }
.edited { font-size: .7rem; color: var(--text-2); margin-inline-end: .15rem; }
/* the message a quote points at, briefly marked when it is jumped to */
.msg-row.found .bubble { animation: found .4s ease-in-out 3; }
@keyframes found {
  0%, 100% { background: var(--bubble-other); }
  50% { background: color-mix(in srgb, var(--accent) 45%, var(--bubble-other)); }
}
.msg-row.out.found .bubble { animation-name: found-own; }
@keyframes found-own {
  0%, 100% { background: var(--bubble-own); }
  50% { background: color-mix(in srgb, var(--accent) 45%, var(--bubble-own)); }
}

/* On a touch screen the app behaves like an app: holding a finger on a message opens our
   menu instead of the system's text selection. Copying is offered there. */
@media (pointer: coarse) {
  /* a finger is not a mouse: the entries of a menu need room so the wrong one is not hit */
  .menu [role="menuitem"], .ctx-menu button { padding-top: .7rem; padding-bottom: .7rem; }
  .menu { padding: .35rem .3rem; }

  /* the emoji and sticker picker and the sticker editor too (user, 2026-11-12: a finger held
     on a sticker selected text from the picker down into the message field) */
  .msgs, .conv-list, .chat-head, .side-head, .ctx-menu, .emoji-picker, .sticker-editor { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* a call lies over everything: it is what the moment is about */
.call-overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: var(--call-bg); color: var(--call-text);
  padding: calc(1rem + var(--inset-top)) 1rem calc(1.5rem + var(--inset-bottom));
}
.call-stage { position: absolute; inset: 0; overflow: hidden; background: var(--call-bg); }
.call-remote { width: 100%; height: 100%; object-fit: cover; display: none; }
/* the two pictures of a 1:1 call. A group call draws tiles instead, and these must be gone
   there: an empty <video> is not nothing — a phone's WebView fills it with a play symbol */
.call-overlay.video[data-kind="direct"][data-phase="active"] .call-remote { display: block; }
.call-local {
  position: absolute; right: 1rem; top: calc(1rem + var(--inset-top)); width: 28vw; max-width: 9rem;
  border-radius: 10px; object-fit: cover; box-shadow: 0 2px 12px rgba(0, 0, 0, .5); display: none;
}
.call-overlay.video[data-kind="direct"] .call-local { display: block; }
/* the floating window of a video call (picture-in-picture, the app left during the call):
   the other side fills it, one's own picture small in a corner, no names and no buttons —
   Android draws its own controls over it, and a tap brings the whole call back */
.pip .call-overlay { padding: 0; }
.pip .call-head, .pip .call-controls { display: none; }
.pip .call-local { top: .35rem; right: .35rem; width: 30%; border-radius: 6px; }
.call-head { position: relative; text-align: center; margin-top: 12vh; }
.call-name { font-size: 1.5rem; font-weight: 650; }
.call-state { color: var(--call-text-2); margin-top: .35rem; font-variant-numeric: tabular-nums; }
.call-quality { margin-top: .5rem; color: var(--warning); font-size: .85rem; }
.call-controls { position: relative; margin-top: auto; display: flex; justify-content: center; gap: 1.25rem; }
.call-btn {
  width: 3.6rem; height: 3.6rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--call-btn); color: var(--call-text); display: grid; place-items: center;
}
.call-btn:hover { background: var(--call-btn-hover); }
.call-btn .icon { width: 1.6rem; height: 1.6rem; }
.call-btn.accept { background: var(--success); color: var(--call-accept-contrast); }
.call-btn.decline { background: var(--danger); color: var(--danger-contrast); }

/* an icon fills its box to the edge where a letter has its own small margin, so a call
   record needs a little room to sit as comfortably as text does */
/* several people: a grid that grows from one tile to six */
.call-grid {
  position: absolute; inset: 0; display: grid; gap: .4rem; padding: .4rem;
  grid-template-columns: 1fr; align-content: center;
}
.call-grid[data-count="2"], .call-grid[data-count="3"], .call-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.call-grid[data-count="5"], .call-grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.call-tile {
  position: relative; min-height: 0; min-width: 0; overflow: hidden; border-radius: 10px;
  background: color-mix(in srgb, var(--call-text) 10%, var(--call-bg));
  outline: 2px solid transparent;
}
.call-tile-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-overlay:not(.video) .call-tile-video { display: none; }
.call-tile-name {
  position: absolute; left: .4rem; bottom: .35rem; max-width: calc(100% - .8rem); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; color: var(--call-text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
/* a voice call has no picture: the tile is the name */
.call-overlay:not(.video) .call-tile-name { position: static; display: grid; place-items: center; height: 100%; font-size: 1rem; }
.call-tile.waiting { opacity: .55; }
.call-tile.weak { outline-color: var(--warning); }
.call-count { color: var(--call-text-2); font-size: .85rem; margin-top: .25rem; font-variant-numeric: tabular-nums; }

/* a call running in this group, which this device is not in */
.join-strip {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border-bottom: 1px solid var(--border);
}
.join-strip .icon { width: 1.2rem; height: 1.2rem; color: var(--accent); flex: none; }
.join-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.join-text { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-who { color: var(--text-2); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-btn { padding: .35rem 1rem; flex: none; }

.call-record { display: flex; align-items: center; gap: .45rem; padding: .05rem .1rem; }
.call-record .icon { width: 1.1rem; height: 1.1rem; }
.call-record.missed { color: var(--danger); }

/* picking several messages: a bar instead of the chat header, and a mark per bubble */
.conv-item.archived .conv-title, .conv-item.archived .conv-preview, .conv-item.archived .conv-time { color: var(--text-2); }
.archive-tag {
  margin-inline-start: .4rem; padding: 0 .35rem; border-radius: 4px; font-size: .68rem; font-weight: 650;
  background: var(--panel-2); color: var(--text-2); vertical-align: middle;
}

.select-bar {
  display: flex; align-items: center; gap: .6rem; padding: calc(.5rem + var(--inset-top)) .75rem .5rem;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.select-count { flex: 1; }
.select-actions { display: flex; gap: .15rem; }
.chat.selecting .chat-head { display: none; }
.chat.selecting .msg-row { cursor: pointer; }
.msg-row.picked { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 10px; }

.reactions { display: flex; flex-wrap: wrap; gap: .25rem; margin: -.2rem .3rem .1rem; }
.msg-row.out .reactions { justify-content: flex-end; }
.reaction {
  display: flex; align-items: center; gap: .2rem; padding: .1rem .4rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-2); font-size: .75rem; cursor: pointer;
}
.reaction.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--text); }
.reaction-emoji { font-size: .95rem; line-height: 1; }

.ctx-reactions { display: flex; gap: .15rem; padding: .15rem; border-bottom: 1px solid var(--border); margin-bottom: .25rem; }
.ctx-reactions button {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0; border: 0; border-radius: 50%;
  background: none; font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.ctx-reactions button:hover, .ctx-reactions button:focus-visible { background: var(--panel-2); }
.ctx-reactions button.mine { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.ctx-reactions .more .icon { width: 1.1rem; height: 1.1rem; }

.pending-bar { display: flex; align-items: center; gap: .4rem; padding: .4rem .75rem 0; background: var(--panel); }
.pending-bar > .icon { width: 1.1rem; height: 1.1rem; flex: none; color: var(--text-2); }
.pending-text { margin-bottom: 0; min-width: 0; }

.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: .25rem; font-size: .7rem; color: var(--text-2); margin-top: .1rem; }
.status .icon { width: 1rem; height: 1rem; }
.status-read { color: var(--accent); }
.status-failed { color: var(--danger); }
/* a message that could not be sent keeps this mark, however old it is */
.mark-failed {
  width: 1rem; height: 1rem; border-radius: 50%; background: var(--danger); color: var(--danger-contrast);
  display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; line-height: 1;
}

.composer { display: flex; align-items: flex-end; gap: .5rem; padding: .6rem .75rem; background: var(--panel); border-top: 1px solid var(--border); }
/* the field is the rounded box; emoji and attachment sit inside it at the bottom edge, so
   they stay beside the last line while the text grows upwards */
.composer-field {
  flex: 1; min-width: 0; display: flex; align-items: flex-end;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 22px;
}
.composer-field:focus-within { box-shadow: var(--focus); border-color: var(--accent); }
.composer-field > .icon-btn, .composer-field > .menu-wrap { margin: .1rem; }
.composer textarea {
  flex: 1; min-width: 0; overflow-y: hidden; resize: none; max-height: 10rem; line-height: 1.4;
  border: 0; border-radius: 0; background: none; padding: .6rem .1rem;
}
.composer textarea:focus-visible { box-shadow: none; }
/* a textarea wraps its placeholder where an input would not: on a narrow phone the hint
   became two lines and pushed the composer taller */
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-btn { width: 2.7rem; height: 2.7rem; flex: none; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; cursor: pointer; }
.send-btn:hover { background: var(--accent-hover); }
/* the microphone takes the send button's place while the field is empty, so it has its shape:
   swapping one for the other moves nothing */
.composer .mic-btn { width: 2.7rem; height: 2.7rem; background: var(--accent); color: var(--accent-contrast); }
.composer .mic-btn:hover { background: var(--accent-hover); color: var(--accent-contrast); }

/* dialogs */
/* in the installed app the system's bars lie over the page: a dialog keeps between them, so
   its close button at the top and its buttons at the bottom stay free (the user's test) */
.dialog {
  top: var(--inset-top); bottom: var(--inset-bottom);
  width: min(460px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem - var(--inset-top) - var(--inset-bottom));
  padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(8, 12, 20, .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem .9rem .4rem 1.25rem; }
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.dialog-body { padding: 0 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.dialog .form { margin-top: 0; }
.contact-card { display: flex; gap: 1rem; align-items: center; }
.members { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow-y: auto; }
.member { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.member .avatar { width: 2.2rem; height: 2.2rem; font-size: .95rem; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .72rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 0 .5rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-start; }
.inline-form input, .inline-form .chips { flex: 1; }
/* several usernames as chips (components.js namesField) */
.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 0; cursor: text;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .4rem;
}
.chips:focus-within { box-shadow: var(--focus); border-color: var(--accent); }
.chips-list { display: contents; }
.chips input[type="text"] { flex: 1; min-width: 7rem; width: auto; border: 0; background: none; padding: .35rem .3rem; box-shadow: none; }
.name-chip { display: inline-flex; align-items: center; gap: .1rem; max-width: 100%; background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: .1rem .15rem .1rem .65rem; font-size: .9rem; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-chip .chip-x { border: 0; background: none; color: var(--text-2); font: inherit; font-size: 1.05rem; line-height: 1; width: 1.5rem; height: 1.5rem; border-radius: 50%; cursor: pointer; flex: none; }
.name-chip .chip-x:hover { background: var(--panel); color: var(--text); }
.name-chip.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.name-chip.bad .chip-x { color: var(--danger); }

/* names: "@username" beside a nickname or display name */
.handle { font-weight: 400; color: var(--text-2); font-size: .85em; margin-left: .35rem; }
.sender .handle { font-size: .92em; }

/* contact card */
.contact-names { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: .5rem 0 0; font-weight: 650; }
.verify { display: flex; flex-direction: column; gap: .6rem; }
.verify-state { display: flex; align-items: center; gap: .45rem; margin: 0; color: var(--text-2); }
.verify-state.ok { color: var(--success); }
.actions.start { justify-content: flex-start; }
.safety { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: .35rem 1rem; font-size: 1.05rem; letter-spacing: .06em; }
.qr-wrap { display: flex; justify-content: center; }
.qr { width: min(220px, 70vw); height: auto; border-radius: 6px; }
.break { overflow-wrap: anywhere; }

/* settings panel (replaces the chat list) */
.settings { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.side-head .side-title { margin: 0 auto 0 .25rem; font-size: 1.1rem; }
.settings-body { position: relative; flex: 1; overflow-y: auto; padding: 0 1rem 1.5rem; }
.set-section { display: flex; flex-direction: column; gap: .5rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.set-section:last-child { border-bottom: 0; }
.set-section .prefs-bar { justify-content: flex-start; }
/* the list of groups: one row each, name and what is in it, an arrow pointing in */
.set-groups { display: flex; flex-direction: column; padding: .5rem 0; }
.set-group {
  display: flex; align-items: center; gap: .9rem; width: 100%; padding: .75rem .25rem; text-align: start;
  background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--text); font: inherit; cursor: pointer;
}
.set-group:last-child { border-bottom: 0; }
.set-group:hover { background: var(--panel-2); }
.set-group:focus-visible { outline: none; box-shadow: var(--focus); }
.set-group > .icon { flex: none; width: 1.35rem; height: 1.35rem; color: var(--accent); }
.set-group .set-text { flex: 1; }
.set-group .set-group-go { flex: none; width: 1.1rem; height: 1.1rem; color: var(--text-2); transform: scaleX(-1); }
[dir=rtl] .set-group .set-group-go { transform: none; }
/* the background dialog and the picture library (SPEC §16.2) */
.bg-dialog { width: min(36rem, 100vw - 2rem); }
/* the title, the X and the preview with its controls stay in view; only the tiles scroll */
.bg-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.bg-dialog .dialog-head { flex: none; }
.bg-dialog .dialog-body { flex: 1; min-height: 0; padding-bottom: 0; }
.bg-pinned { flex: none; display: flex; flex-direction: column; gap: .5rem; }
.bg-tiles { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 1.25rem; overscroll-behavior: contain; }
.bg-preview {
  position: relative; display: flex; flex-direction: column; gap: .4rem; padding: .9rem; min-height: 9.5rem;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: crosshair;
}
.bg-preview > .msg-row { position: relative; }
.bg-dim input { flex: 1; max-width: 16rem; accent-color: var(--accent); }
.bg-group h4 { margin: .6rem 0 .3rem; font-size: .85rem; color: var(--text-2); }
.bg-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.bg-tile {
  position: relative; display: inline-flex; flex-direction: column; justify-content: flex-end; flex: none;
  width: 4.6rem; height: 4.6rem; padding: 0; overflow: hidden; cursor: pointer; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); font: inherit;
}
.bg-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-tile-label {
  position: relative; padding: .1rem .2rem; font-size: .68rem; line-height: 1.2; text-align: center;
  background: color-mix(in srgb, var(--panel) 85%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bg-row .bg-tile[data-key^="c:"] .bg-tile-label, .bg-row .bg-tile[data-key^="b:"] .bg-tile-label { display: none; }
/* a tile shows more of its pattern than the corner a full-size tile would */
.bg-tile .chat-bg[data-bg="pattern"]::before { -webkit-mask-size: 170px; mask-size: 170px; }
.bg-add { justify-content: center; align-items: center; gap: .2rem; border-style: dashed; }
.bg-add .bg-tile-label { background: none; }
.bg-add-icon .icon { width: 1.4rem; height: 1.4rem; }
.chat-bg-btn, .bg-all-btn { display: inline-flex; align-items: center; gap: .4rem; }
.chat-bg-btn .icon, .bg-all-btn .icon { width: 1.1rem; height: 1.1rem; }
.bg-library { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.bg-library-row { display: flex; align-items: center; gap: .75rem; }
.bg-library-row .bg-tile { width: 3.2rem; height: 3.2rem; cursor: default; }
.bg-library-row .set-text { flex: 1; }

/* colour presets (SPEC §16.1): the list, the editor and its picker */
.swatch { display: inline-block; flex: none; border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.preset-title { margin: .5rem 0 0; font-size: .95rem; }
.preset-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.preset-row { display: flex; align-items: center; gap: .6rem; padding: .25rem 0; border-bottom: 1px solid var(--border); }
.preset-row:last-child { border-bottom: 0; }
.preset-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-swatches { display: flex; flex: none; padding-inline-start: .3rem; }
.preset-swatches .swatch { width: 1.05rem; height: 1.05rem; border-radius: 50%; margin-inline-start: -.3rem; }
.theme-preview {
  position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; gap: .4rem; margin: .5rem 0;
  padding: .75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.theme-preview-foot { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.theme-preview-link { color: var(--accent); text-decoration: underline; }
.color-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: .45rem 0;
  background: none; border: 0; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.color-value { display: flex; align-items: center; gap: .5rem; flex: none; }
.color-value .swatch { width: 1.6rem; height: 1.6rem; border-radius: var(--radius-sm); }
.color-picker { display: flex; flex-direction: column; gap: .45rem; padding: .6rem; margin-bottom: .4rem; background: var(--panel-2); border-radius: var(--radius-sm); }
.color-picker label { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; color: var(--text-2); }
.color-picker input[type=range] { width: 100%; accent-color: var(--accent); }
.color-picker .hex-row { flex-direction: row; align-items: center; justify-content: space-between; }
.color-picker .hex-row span { white-space: nowrap; }
.hex-input { width: 7.5rem; font-family: var(--mono); }
.palette { display: flex; flex-wrap: wrap; gap: .4rem; }
.palette button {
  width: 1.7rem; height: 1.7rem; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
}
.font-row { display: flex; flex-direction: column; gap: .4rem; }
.font-row input[type=range] { width: 100%; accent-color: var(--accent); }
.font-example { display: flex; }
.font-example .bubble { padding: .4rem .7rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .3rem 0; cursor: pointer; }
.set-text { display: flex; flex-direction: column; min-width: 0; }
/* a row that reports something rather than switching it: no pointer, and the button keeps
   its size while the explanation beside it wraps */
.set-row.set-stack { cursor: default; align-items: flex-start; }
.set-row.set-stack .btn { flex: none; }
.warn-text { color: var(--warning); }
.set-text small { font-size: .8rem; line-height: 1.35; }
.set-choice { flex-direction: column; align-items: stretch; gap: .35rem; }
.set-select { padding: .45rem .6rem; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer;
  width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--border); transition: background .15s; margin: 0;
}
.switch::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(1.1rem); }
.switch:disabled { opacity: .6; }
.profile-row { display: flex; align-items: center; gap: 1rem; }
.avatar-btn { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.avatar-edit { position: absolute; right: -.1rem; bottom: -.1rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-contrast); border: 2px solid var(--panel); }
.avatar-edit .icon { width: 1rem; height: 1rem; }

/* emoji picker (above the composer) */
.chat { position: relative; }
/* files dragged over the chat: where they will go */
.drop-zone { position: absolute; inset: 0; z-index: 30; padding: .75rem; background: var(--bg); pointer-events: none; }
.drop-zone[hidden] { display: none; }
.drop-zone-inner { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 600; font-size: 1.1rem; }
.drop-zone-inner .icon { width: 2.4rem; height: 2.4rem; }
.bubble .text.jumbo { font-size: calc(2.4rem * var(--chat-font, 1)); line-height: 1.2; }
.emoji-picker {
  position: absolute; left: .5rem; bottom: 4.2rem; z-index: 15; width: min(22rem, calc(100% - 1rem)); height: min(24rem, 60vh);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.dialog .emoji-picker { position: static; width: 100%; height: min(24rem, 60vh); border: 0; box-shadow: none; }
.emoji-head { display: flex; gap: .35rem; align-items: center; padding: .5rem .5rem .25rem; }
.emoji-search { padding: .45rem .7rem !important; border-radius: 999px !important; }
.emoji-tone-btn { font-size: 1.25rem; }
.emoji-tones { display: flex; justify-content: space-around; padding: .15rem .5rem; border-bottom: 1px solid var(--border); }
.emoji-tones [aria-checked="true"] { background: var(--accent-soft); }
.emoji-tabs { display: flex; justify-content: space-between; padding: 0 .35rem; border-bottom: 1px solid var(--border); }
.emoji-tab { flex: 1; border: 0; background: none; font-size: 1.05rem; padding: .35rem 0; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; filter: grayscale(.6); }
.emoji-tab[aria-current="true"] { border-bottom-color: var(--accent); filter: none; }
.emoji-tab .icon { width: 1.1rem; height: 1.1rem; }
.emoji-scroll { flex: 1; overflow-y: auto; padding: 0 .4rem .5rem; position: relative; }
.emoji-section h4 { position: sticky; top: 0; margin: 0; padding: .45rem .2rem .25rem; font-size: .75rem; font-weight: 650; color: var(--text-2); background: var(--panel); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.2rem, 1fr)); }
.emoji { border: 0; background: none; font-size: 1.45rem; line-height: 1; padding: .3rem 0; border-radius: 6px; cursor: pointer; font-family: var(--font); }
.emoji:hover, .emoji:focus-visible { background: var(--panel-2); }
.emoji-empty { text-align: center; padding: 1.5rem .5rem; }

/* media in chats */
.bubble-media { padding: .25rem .25rem .3rem; max-width: min(320px, 78%); }
.bubble-media .caption { padding: .25rem .45rem 0; }
.media { display: flex; flex-direction: column; gap: .25rem; }
.media-frame {
  position: relative; display: block; width: 100%; max-width: 300px; min-height: 3rem; padding: 0; border: 0; cursor: pointer;
  background: var(--panel-2); border-radius: 10px; overflow: hidden;
}
.media-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-2); }
.media-play {
  position: absolute; inset: 0; margin: auto; width: 3rem; height: 3rem; border-radius: 50%;
  display: grid; place-items: center; background: rgba(8, 12, 20, .55); color: #fff;
}
.media-play .icon { width: 1.6rem; height: 1.6rem; }
.media-badge { position: absolute; right: .4rem; bottom: .4rem; background: rgba(8, 12, 20, .65); color: #fff; font-size: .72rem; border-radius: 999px; padding: .05rem .45rem; }
.media-pending .media-frame { opacity: .65; }
.media-pending .media-bar { min-width: 4rem; }
.media-status { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--text-2); padding: 0 .35rem; }
.media-status.failed { color: var(--danger); }
.media-status.failed .media-bar { display: none; }
.media-bar { flex: 1; height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
/* glides between the values it is given (they come about once a second); a new step that starts again at 0 jumps (moveBar) */
.media-bar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .8s linear; }

.file-row { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: .35rem .3rem; cursor: pointer; border-radius: 8px; }
.file-row:hover { background: var(--panel-2); }
.file-icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 8px; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: .78rem; }
.file-dl { color: var(--text-2); }

/* voice messages */
.voice { display: flex; align-items: center; gap: .5rem; padding: .15rem .25rem; min-width: 13rem; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 2rem; }
.wave-bar { flex: 1; min-width: 2px; background: var(--text-2); border-radius: 1px; opacity: .5; }
.wave-bar.played { background: var(--accent); opacity: 1; }
.voice-time { font-size: .76rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip { font: inherit; font-size: .72rem; border: 1px solid var(--border); background: none; color: var(--text-2); border-radius: 999px; padding: .05rem .4rem; cursor: pointer; }
.recording { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; background: var(--panel); border-top: 1px solid var(--border); }
.rec-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.rec-time { font-variant-numeric: tabular-nums; color: var(--text-2); margin-right: auto; }
.composer.recording-on textarea, .composer.recording-on .send-btn { opacity: .5; pointer-events: none; }
@keyframes pulse { 50% { opacity: .25; } }
.menu-up { top: auto; bottom: calc(100% + .25rem); }
.composer .menu { right: 0; left: auto; } /* anchored right: the button is at the field's right edge */

/* fullscreen viewer */
.viewer { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; padding: 0; border: 0; background: #0b0f18; color: #e3e6f0; }
.viewer::backdrop { background: #000; }
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: .5rem; padding: calc(.5rem + var(--inset-top)) .75rem .5rem; background: linear-gradient(rgba(0, 0, 0, .6), transparent); }
/* The buttons on a viewer sit on dark see-through circles, so they show on any picture or
   map; hovered, the circle deepens and the icon turns white (user, 2026-11-11: a white × had
   turned up on the theme's white hover circle) */
.viewer-bar .icon-btn { color: #fff; background: rgba(0, 0, 0, .55); }
.viewer-bar .icon-btn:hover { background: rgba(0, 0, 0, .72); color: #fff; }
.viewer-name { text-shadow: 0 1px 3px rgba(0, 0, 0, .85), 0 0 10px rgba(0, 0, 0, .45); }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.viewer-stage { position: relative; width: 100%; height: 100%; overflow: hidden; touch-action: none; display: grid; place-items: center; }
/* the photos and videos of a chat, one after another (user, 2026-11-12): each on a slide that
   follows the finger and glides into place */
.viewer-slide { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .25s ease-out; }
.viewer-slide.dragging { transition: none; }
.viewer-error { margin: 0; padding: 1rem; text-align: center; color: #c5cad6; }
/* name above, size and date below */
.viewer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-title .viewer-name { flex: none; }
.viewer-meta { font-size: .76rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, .85); }
/* back and forth: round and dark like the bar's buttons, at the middle of each side */
.viewer-nav {
  position: absolute; top: 50%; z-index: 2; width: 2.6rem; height: 2.6rem; margin-top: -1.3rem;
  color: #fff; background: rgba(0, 0, 0, .55); transition: opacity .25s;
}
.viewer-nav:hover { background: rgba(0, 0, 0, .72); color: #fff; }
.viewer-prev { left: calc(.6rem + var(--inset-left, 0px)); }
.viewer-next { right: calc(.6rem + var(--inset-right, 0px)); }
.viewer-next .icon { transform: scaleX(-1); }
/* on phones people swipe; the buttons would only cover the picture (user, 2026-11-12) */
@media (hover: none) and (pointer: coarse) { .viewer-nav { display: none; } }
.viewer-stage.zoomed { cursor: grab; }
.viewer-media { display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; will-change: transform; }
img.viewer-media { user-select: none; -webkit-user-drag: none; }
/* above the player's own controls, never swallowing clicks */
.viewer-caption {
  position: absolute; left: 0; right: 0; bottom: calc(3.6rem + var(--inset-bottom)); margin: 0; padding: .6rem 1.25rem;
  text-align: center; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); transition: opacity .25s;
}
.viewer-bar, .viewer-caption { opacity: 1; }
.viewer.overlays-hidden .viewer-bar, .viewer.overlays-hidden .viewer-caption, .viewer.overlays-hidden .viewer-nav { opacity: 0; }
.viewer.overlays-hidden .viewer-bar, .viewer.overlays-hidden .viewer-nav { pointer-events: none; }
.send-preview { width: 100%; max-height: 40vh; object-fit: contain; border-radius: var(--radius-sm); background: var(--panel-2); }
/* while a picked video is read: a plain box with a turning ring — never an empty <video>, over which a phone's WebView paints its own play symbol */
.send-loading { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; }
/* several files before sending: tiles, each with a button to take it out */
.send-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .5rem; max-height: 45vh; overflow-y: auto; }
.send-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); background: var(--panel-2); overflow: hidden; display: flex; }
.send-tile > .send-loading { flex: 1; aspect-ratio: auto; }
.send-thumb { width: 100%; height: 100%; object-fit: cover; }
.send-file { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: .4rem; min-width: 0; color: var(--text-2); }
.send-file-name { font-size: .75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.send-preview.send-file, .form > .send-file { padding: 1rem; background: var(--panel-2); border-radius: var(--radius-sm); }
.send-remove { position: absolute; top: .2rem; right: .2rem; width: 1.8rem; height: 1.8rem; min-width: 0; padding: 0; border-radius: 50%; background: rgba(8, 12, 20, .65); color: #fff; }
.send-remove .icon { width: 1rem; height: 1rem; }
.send-tile .media-badge { left: .3rem; right: auto; bottom: .3rem; }
.spinner { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* location messages */
.tilemap { position: relative; overflow: hidden; background: var(--panel-2); border-radius: 10px; }
.tilemap-layer { position: absolute; inset: 0; }
.tile { position: absolute; top: 0; left: 0; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; }
.tilemap.interactive { cursor: grab; touch-action: none; }
.tilemap.interactive:active { cursor: grabbing; }
.tilemap-marker { position: absolute; transform: translate(-50%, -100%); color: var(--danger); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); pointer-events: none; }
.tilemap-credit {
  position: absolute; right: 0; bottom: 0; z-index: 1; font-size: .62rem; line-height: 1.4; padding: 0 .3rem;
  background: rgba(255, 255, 255, .7); color: #1a2030; text-decoration: none; border-top-left-radius: 4px;
}
.tilemap-marker .icon { width: 2rem; height: 2rem; fill: var(--panel); stroke-width: 1.6; }
.own-code { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.own-code .qr { width: min(200px, 60vw); }
.own-code code { font-size: .7rem; text-align: center; }
.loc-name { font-weight: 600; padding: .2rem .35rem 0; overflow-wrap: anywhere; }
.loc-dialog .loc-name { min-height: 1.2em; margin: 0; }
.tilemap-marker.center { transform: translate(-50%, -100%); animation: none; }
.tilemap.interactive .tilemap-marker.center { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.loc-preview { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; overflow: hidden; max-width: 100%; }
.loc-foot { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .15rem .35rem 0; }
.loc-dialog { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.loc-dialog .tilemap { max-width: 100%; }
.loc-map { position: relative; align-self: center; max-width: 100%; }
.loc-map .map-controls { right: .5rem; bottom: .5rem; }
.map-viewer { display: grid; place-items: center; }
/* A map is bright: a darker, taller shade than over photos, and the text shadow does the
   rest (user, 2026-11-11 — a bar was readable but did not look modern). The shade is only
   a picture: the map is dragged under it, only the buttons take the pointer. */
.map-viewer .viewer-bar {
  background: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, .35) 55%, transparent);
  padding-bottom: 2.25rem; pointer-events: none;
}
.map-viewer .viewer-bar > * { pointer-events: auto; }
.map-viewer .viewer-bar .viewer-name { pointer-events: none; }
.map-viewer .viewer-bar .btn {
  background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .35); border-radius: 999px;
}
.map-viewer .viewer-bar .btn:hover { background: rgba(0, 0, 0, .72); }
.map-controls { position: absolute; right: calc(1rem + var(--inset-right)); bottom: calc(1.5rem + var(--inset-bottom)); z-index: 2; display: flex; flex-direction: column; gap: .35rem; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem; }
/* LiteShare's own camera (views/camera.js) */
.camera-viewer { display: grid; place-items: center; }
.camera-preview { width: 100%; height: 100%; object-fit: contain; background: #000; }
.camera-preview.mirrored { transform: scaleX(-1); } /* the front camera like a mirror; the photo is not */
.camera-note { position: absolute; top: 40%; left: 1rem; right: 1rem; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .85); }
.camera-timer { font-variant-numeric: tabular-nums; color: #fff; background: var(--danger); border-radius: 999px; padding: .1rem .6rem; font-size: .85rem; }
.camera-torch[aria-pressed="true"] { color: #ffd34d; }
.camera-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: .7rem;
  padding: 2rem 1rem calc(1.2rem + var(--inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .6));
}
.camera-zoom { width: min(70vw, 18rem); }
.camera-modes { display: flex; gap: .4rem; }
.camera-mode { font: inherit; font-size: .85rem; color: #fff; background: rgba(0, 0, 0, .45); border: 0; border-radius: 999px; padding: .3rem .9rem; cursor: pointer; }
.camera-mode[aria-pressed="true"] { background: #fff; color: #111; }
.camera-shutter { width: 4.2rem; height: 4.2rem; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, .85); cursor: pointer; padding: 0; }
.camera-shutter.video { background: var(--danger); }
.camera-shutter.recording { background: var(--danger); border-radius: 1rem; transform: scale(.85); }
.camera-shutter:disabled { opacity: .4; cursor: default; }
/* a photo taken: it stands still, dimmed, with a spinner, until the overview opens */
.camera-spinner { position: absolute; inset: 0; margin: auto; display: none; }
.camera-busy .camera-spinner { display: block; }
.camera-busy .camera-preview { opacity: .45; }
.camera-busy .camera-controls, .camera-busy .viewer-bar .icon-btn:not(:last-child) { visibility: hidden; }
/* Stickers (SPEC §15.1): the picker's two parts, the collection, a sticker in a chat */
.emoji-part, .sticker-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.picker-parts { display: flex; border-bottom: 1px solid var(--border); }
.picker-part {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-size: .85rem;
  color: var(--text-2); background: none; border: 0; border-bottom: 2px solid transparent; padding: .45rem 0; cursor: pointer;
}
.picker-part .icon { width: 1.05rem; height: 1.05rem; }
.picker-part[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.sticker-pane .emoji-scroll { padding-top: .5rem; }
.sticker-pane-note { margin: .5rem .75rem 0; text-align: center; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .35rem; }
.sticker-tile { aspect-ratio: 1; border: 0; border-radius: var(--radius-sm); background: none; padding: .2rem; cursor: pointer; display: grid; place-items: center; }
.sticker-tile:hover, .sticker-tile:focus-visible { background: var(--panel-2); }
.sticker-tile img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-select: none; user-select: none; }
.sticker-new { border: 2px dashed var(--border); color: var(--text-2); font-size: .72rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; text-align: center; }
.sticker-new .icon { width: 1.4rem; height: 1.4rem; }
.msg-row .bubble.bubble-sticker { background: none; border-color: transparent; box-shadow: none; padding: 0; }
.sticker-frame { display: grid; place-items: center; width: 160px; height: 160px; }
.sticker-img { width: 100%; height: 100%; object-fit: contain; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bubble-sticker .meta { align-self: flex-end; width: fit-content; margin-left: auto; padding: .05rem .45rem; border-radius: 999px; background: var(--panel); }
.bubble-sticker .sender, .bubble-sticker .forwarded { width: fit-content; padding: .05rem .45rem; border-radius: 999px; background: var(--panel); }
/* the editor (views/sticker-editor.js): always dark, like the other full-screen views */
.sticker-editor[open] { display: flex; flex-direction: column; }
.sticker-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: crosshair; }
.sticker-stage[data-tool="move"] { cursor: grab; }
.sticker-stage[data-tool="erase"], .sticker-stage[data-tool="restore"] { cursor: none; }
.sticker-canvas {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform;
  /* mid-grey (user, 2026-11-12): the white outline and white specks stand out, dark parts too */
  background: repeating-conic-gradient(#6b707c 0 25%, #545862 0 50%) 0 0 / 16px 16px;
}
.sticker-ring { position: absolute; left: 0; top: 0; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); pointer-events: none; }
.sticker-controls { position: relative; display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: .6rem 1rem calc(.8rem + var(--inset-bottom)); background: #151a26; }
/* an animated sticker: play and a slider through the frames; the part of the video chosen first */
.sticker-timeline { display: flex; align-items: center; gap: .6rem; width: min(100%, 24rem); }
.sticker-track { position: relative; flex: 1; display: flex; align-items: center; }
.sticker-track input { flex: 1; width: 100%; }
/* a corrected frame: a mark above the slider (the person's bright, followed ones faint) */
.sticker-marks { position: absolute; left: .5rem; right: .5rem; top: -.35rem; height: .4rem; pointer-events: none; }
.sticker-mark { position: absolute; top: 0; width: 3px; height: .4rem; margin-left: -1.5px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.sticker-mark.manual { background: #ffd34d; }
/* where an edit applies: this frame, from here on, all frames */
.sticker-scope-row { display: flex; align-items: center; justify-content: center; gap: .5rem; max-width: 100%; }
.sticker-follow {
  flex: none; display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .78rem; color: #111; background: #ffd34d;
  border: 0; border-radius: 999px; padding: .3rem .8rem .3rem .6rem; cursor: pointer;
}
.sticker-follow .icon { width: 1rem; height: 1rem; }
.sticker-follow:disabled { opacity: .5; cursor: default; }
.sticker-scope { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .08); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.sticker-scope-btn { flex: none; font: inherit; font-size: .78rem; color: #c5cad6; background: none; border: 0; border-radius: 999px; padding: .3rem .75rem; cursor: pointer; }
.sticker-scope-btn[aria-pressed="true"] { background: #fff; color: #111; }
.sticker-timeline .icon-btn { color: #fff; background: rgba(255, 255, 255, .1); flex: none; }
.clip-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; padding: calc(3rem + var(--inset-top)) .5rem .5rem; }
/* the whole video in view, however tall (it is not a grid item that grows to its size) */
.clip-stage { display: grid; }
.clip-video { grid-area: 1 / 1; display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
/* the two copies lie on each other; the waiting one is see-through, not hidden — a browser
   may pause a video it counts as out of sight */
.clip-video:not(.shown) { opacity: 0; }
.clip-times { margin: 0; font-size: .82rem; color: #c5cad6; font-variant-numeric: tabular-nums; }
/* one bar, two handles (ui/range-bar.js): the chosen part framed, the rest dimmed */
.range-bar { width: min(100%, 28rem); padding: 0 1.2rem; touch-action: none; }
.range-bar.disabled { opacity: .5; pointer-events: none; }
.range-track { position: relative; height: 2.6rem; border-radius: 4px; background: rgba(255, 255, 255, .08); cursor: pointer; }
/* the video's pictures along the bar; outside the chosen part darkened (the part's shadow) */
.range-window { position: absolute; inset: 0; overflow: hidden; border-radius: 4px; }
.range-strip { position: absolute; inset: 0; display: flex; pointer-events: none; }
.range-pic { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.range-fill { position: absolute; top: 0; bottom: 0; border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .6); cursor: grab; }
.range-handle {
  position: absolute; top: 0; bottom: 0; width: 1.1rem; padding: 0; border: 0; border-radius: 6px;
  background: var(--accent); cursor: ew-resize; display: grid; place-items: center; touch-action: none;
}
/* the handles lie outside the part, so they never cover each other however short it is */
.range-start { margin-left: -1.1rem; border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.range-end { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.range-grip { width: 3px; height: 1rem; border-radius: 2px; background: rgba(255, 255, 255, .85); }
.range-handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sticker-note { margin: 0; font-size: .82rem; text-align: center; color: #c5cad6; }
.sticker-slider-row { display: flex; align-items: center; gap: .6rem; width: min(100%, 24rem); font-size: .8rem; color: #c5cad6; }
.sticker-slider-row input { flex: 1; }
.sticker-tools {
  display: flex; gap: .35rem; flex-wrap: nowrap; width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 0 .25rem;
}
.sticker-tools::-webkit-scrollbar { display: none; }
/* centred while they fit; when they do not, they scroll sideways from the first one, as a
   phone's camera app does (user, 2026-11-12) — auto margins, unlike justify-content:
   center, never push the first button out of reach */
.sticker-tools > :first-child { margin-left: auto; }
.sticker-tools > :last-child { margin-right: auto; }
.sticker-tools > * { flex: none; }
.sticker-tool {
  display: inline-flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 4.4rem; font: inherit; font-size: .72rem;
  color: #e3e6f0; background: rgba(255, 255, 255, .08); border: 0; border-radius: var(--radius-sm); padding: .4rem .5rem; cursor: pointer;
}
.sticker-tool .icon { width: 1.3rem; height: 1.3rem; }
.sticker-tool[aria-pressed="true"] { background: #fff; color: #111; }
.sticker-options-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .22); }
/* the options: switches as in the settings, in a panel above the tools */
.sticker-options-panel {
  position: absolute; bottom: calc(100% + .5rem); left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; flex-direction: column; width: min(calc(100% - 2rem), 22rem); padding: .25rem .9rem;
  background: #222838; border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
/* it floats over the picture: opening it does not move the picture */
.sticker-option { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; font-size: .9rem; color: #e3e6f0; cursor: pointer; }
.sticker-option + .sticker-option { border-top: 1px solid rgba(255, 255, 255, .08); }
.sticker-option .switch:not(:checked) { background: #4a5163; }
/* "Save sticker" beside undo and close, the one action that finishes */
.viewer-bar .icon-btn.sticker-save { background: var(--accent); color: var(--accent-contrast); }
.viewer-bar .icon-btn.sticker-save:hover { background: var(--accent); filter: brightness(1.1); }
.viewer-bar .icon-btn.sticker-save:disabled { opacity: .5; }
/* Settings → About, the last line: "LiteShare v0.9.2", small (user, 2026-11-11) */
.app-version { font-size: .74rem; margin-top: .5rem; }
.btn-small { padding: .3rem .7rem; font-size: .85rem; text-decoration: none; display: inline-flex; align-items: center; }

/* camera scanner */
.scan-body { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: min(70vw, 60vh); height: min(70vw, 60vh); border: 3px solid rgba(255, 255, 255, .85); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
.scan-hint { position: absolute; bottom: 2rem; color: #e3e6f0; text-align: center; padding: 0 1rem; }

/* device diagnostics (?diag=1) */
.diag {
  position: fixed; left: 0; right: 0; top: 0; z-index: 9999; padding: .3rem .5rem;
  background: rgba(8, 12, 20, .85); color: #7fe0a8; font: 11px/1.45 var(--mono); white-space: pre-wrap; pointer-events: auto;
}

/* GIF picker */
.gif-head { position: sticky; top: 0; background: var(--panel); padding-bottom: .4rem; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .4rem; max-height: 50vh; overflow-y: auto; overflow-x: hidden; }
.gif-cell { padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--panel-2); cursor: pointer; min-height: 4rem; }
.gif-cell.busy { opacity: .5; pointer-events: none; }
.gif-item { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-mark { text-align: right; margin: 0; font-size: .62rem; letter-spacing: .06em; opacity: .75; }
.media-gif .media-thumb { width: 100%; height: 100%; object-fit: cover; }
.attrib-list { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }

@media (max-width: 760px) {
  /* no room to float: the picker pushes the messages up instead of covering the composer */
  .emoji-picker {
    position: static; width: auto; height: min(20rem, 45vh); border-radius: 0;
    border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none;
  }
  /* with the keyboard open the screen is short: the picker may not eat the messages */
  :root.keyboard-open .emoji-picker { height: min(14rem, 40vh); }
  /* minmax(0, …), not 1fr: a column of `1fr` may not shrink below its content, and a
     long file name or a wide header then pushes the whole screen sideways */
  .messenger { grid-template-columns: minmax(0, 1fr); }
  .messenger .chat-pane { display: none; }
  .messenger.chat-open .sidebar { display: none; }
  .messenger.chat-open .chat-pane { display: flex; }
  .chat-head .back { display: inline-grid; }
  .bubble { max-width: 85%; }
}

/* ---- Polls ---------------------------------------------------------------------------- */
.poll { display: flex; flex-direction: column; gap: .45rem; min-width: min(16rem, 62vw); }
.poll-question { display: flex; gap: .4rem; align-items: flex-start; font-weight: 600; overflow-wrap: anywhere; }
.poll-question .icon { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .1rem; color: var(--accent); }
.poll-options { display: flex; flex-direction: column; gap: .35rem; }
.poll-option { display: flex; align-items: flex-start; gap: .5rem; width: 100%; padding: .2rem 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.poll-option[disabled] { cursor: default; }
.poll-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; margin-top: .1rem; border: 2px solid var(--text-2); border-radius: 50%; color: var(--accent-contrast); }
.poll-mark.multi { border-radius: 4px; }
.poll-option.mine .poll-mark { background: var(--accent); border-color: var(--accent); }
.poll-mark .icon { width: .8rem; height: .8rem; stroke-width: 3; }
.poll-answer { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.poll-line { display: flex; gap: .5rem; justify-content: space-between; }
.poll-text { overflow-wrap: anywhere; }
.poll-count { flex: none; color: var(--text-2); font-size: .85rem; }
.poll-bar { display: block; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text-2) 22%, transparent); overflow: hidden; }
.poll-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .8s; }
.poll-foot { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: .75rem; }
.poll-foot:empty { display: none; }
.poll-form .poll-answers { display: flex; flex-direction: column; gap: .4rem; }
.poll-answer-row { display: flex; gap: .3rem; align-items: center; }
.poll-answer-row input { flex: 1; min-width: 0; }
.poll-add { align-self: flex-start; gap: .3rem; }
.poll-add .icon { width: 1rem; height: 1rem; }
.poll-votes-question { font-weight: 600; margin-top: 0; overflow-wrap: anywhere; }
.poll-votes h3 { display: flex; justify-content: space-between; gap: .75rem; font-size: .95rem; margin: .8rem 0 .3rem; overflow-wrap: anywhere; }
.poll-votes ul { margin: 0; padding-left: 1.2rem; }
/* trimming and muting a video before sending (views/video-trim.js): the video, then the
   sound's button and the bar with the video's pictures, then the part's times */
.send-trim { display: flex; flex-direction: column; gap: .5rem; }
.trim-row { display: flex; align-items: center; gap: .25rem; }
.trim-row .range-bar { flex: 1; width: auto; padding: 0 1.1rem; }
.send-trim .range-track { background: var(--panel-2); }
.trim-mute[aria-pressed="true"] { color: var(--danger); }
.trim-times { margin: 0; text-align: center; font-variant-numeric: tabular-nums; }
/* a video among several: scissors on its tile, marked while it is trimmed */
.send-cut { position: absolute; top: .2rem; left: .2rem; width: 1.8rem; height: 1.8rem; min-width: 0; padding: 0; border-radius: 50%; background: rgba(8, 12, 20, .65); color: #fff; }
.send-cut .icon { width: 1rem; height: 1rem; }
.send-cut.active { background: var(--accent); }
.send-tile .media-badge { display: inline-flex; align-items: center; gap: .2rem; }
.send-tile .media-badge .icon { width: .8rem; height: .8rem; }
