/*
 * Bobuna on the web. The app's own colours, written out by hand rather than imported from a
 * framework, so this looks like the same product rather than a different one wearing its name.
 * Dark by default, light when the browser says the person prefers it.
 */
:root {
  --bg: #09090c;
  --raised: #131318;
  --raised2: #1c1c24;
  --raised3: #262630;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f4f7;
  --muted: #8e8e9c;
  --faint: #5b5b68;
  --petal: #ffd35c;
  --amber: #ff9e45;
  --mint: #5de2a8;
  --danger: #ff5f6d;
  --on-accent: #1a1308;
  --accent: linear-gradient(135deg, var(--petal), var(--amber));
  --radius: 18px;
}

/* Chosen explicitly. The media query below still answers for the very first paint, before the
   stored choice has been read, so the page never flashes the wrong shade. */
:root[data-mood="light"] {
  --bg: #f5f5f8;
  --raised: #ffffff;
  --raised2: #ececf2;
  --raised3: #e1e1ea;
  --line: rgba(0, 0, 0, 0.08);
  --text: #14141a;
  --muted: #6a6a78;
  --faint: #9b9ba8;
  --mint: #17a974;
  --danger: #e23b4a;
}

:root[data-mood="dark"] {
  --bg: #09090c;
  --raised: #131318;
  --raised2: #1c1c24;
  --raised3: #262630;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f4f7;
  --muted: #8e8e9c;
  --faint: #5b5b68;
  --danger: #ff5f6d;
}

@media (prefers-color-scheme: light) {
  :root:not([data-mood]) {
    --bg: #f5f5f8;
    --raised: #ffffff;
    --raised2: #ececf2;
    --raised3: #e1e1ea;
    --line: rgba(0, 0, 0, 0.08);
    --text: #14141a;
    --muted: #6a6a78;
    --faint: #9b9ba8;
    --mint: #17a974;
    --danger: #e23b4a;
  }
}

* { box-sizing: border-box; }

/*
 * `hidden` must win. The browser hides a [hidden] element with a rule of its own, but several
 * rules below give those same elements a display of flex or grid — and a class beats an attribute
 * from the browser's stylesheet, so without this the call overlay, the appearance sheet and the
 * app shell all paint at once over a page nobody has signed in to yet.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  /* The same height the window actually has, so a keyboard coming up shortens the page with it. */
  height: var(--screen, 100dvh);
  overflow: hidden;
}

.muted { color: var(--muted); }
.spacer { flex: 1; }
.error { color: var(--danger); font-size: 13px; }

/* The chamomile itself, the same drawing the app's icon uses. */
.mark { width: 48px; height: 48px; display: block; }
.mark.small { width: 28px; height: 28px; }
.mark.big { width: 84px; height: 84px; }

/* ── Signing in ─────────────────────────────────────────────────────────── */
/* Not a flat sheet: two soft pools of the theme's own colours, so the page belongs to the theme
   rather than merely carrying a coloured button. */
body {
  background-image:
    radial-gradient(60vw 60vw at 12% -10%, color-mix(in srgb, var(--petal) 20%, transparent), transparent 70%),
    radial-gradient(55vw 55vw at 105% 108%, color-mix(in srgb, var(--amber) 18%, transparent), transparent 70%);
  background-attachment: fixed;
}

/*
 * Centred when it fits, scrollable when it does not. A grid with place-items:center cannot be
 * scrolled back to once its content is taller than the box — the overflow goes off both ends and
 * the top is unreachable — so this is a flex column with the card centred by its own auto margins,
 * which overflows downward and scrolls honestly. The code box makes the card tall enough to matter.
 */
.signin {
  display: flex; justify-content: center;
  /*
   * A definite height, not a floor. overflow-y has nothing to scroll against a box that simply
   * grows to fit whatever is in it — and body is height-bound and overflow:hidden, so what grew
   * past the window was clipped away rather than reachable. That is why a card taller than the
   * screen could not be scrolled to: there was no scroller, only a crop.
   *
   * --screen is the height the window actually has at this moment, which on Android is less than
   * 100dvh while the keyboard is up; the fallback covers the moment before the script has said.
   */
  height: var(--screen, 100dvh); overflow-y: auto;
  padding: 16px;
}
/* Enough room above a field for it to sit clear of the top edge when it is scrolled to. */
.signin input, .signin button { scroll-margin: 20px; }
.signin .card {
  width: min(380px, 100%);
  margin: auto;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.signin h1 { margin: 10px 0 4px; font-size: 22px; }
.signin p { margin: 0 0 12px; font-size: 13.5px; }
/* A footnote under the ways in, so it must read quieter than "Sign in with a password instead". */
.signin p.signup-note { margin: 14px 0 0; font-size: 11.5px; line-height: 1.45; text-align: center; color: var(--faint); }
.signup-note a { color: var(--muted); text-decoration-color: var(--faint); text-underline-offset: 2px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 9px 0 5px; }
input {
  width: 100%; padding: 9px 12px;
  background: var(--raised2); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  font: inherit;
}
input:focus { outline: 2px solid var(--petal); outline-offset: 1px; }
button {
  font: inherit; cursor: pointer; border: 0;
  background: var(--accent); color: var(--on-accent);
  padding: 9px 14px; border-radius: 13px; font-weight: 600;
  position: relative; transition: transform 110ms ease;
}
button:disabled { opacity: 0.55; cursor: default; }

/*
 * The press.
 *
 * A phone browser paints its own grey-blue box over whatever is touched, which belongs to no
 * part of this page and lands on top of the thing it is meant to be showing. It is turned off
 * everywhere, and what takes its place is the press the app itself uses: the control sinks, and
 * a bloom of its own colour comes up under the finger.
 *
 * The bloom is instant going on and slow coming off — zero transition while held, half a second
 * once released — so it answers the moment it is touched and then recedes rather than blinking.
 * It is a ::before, because a key that is still loading is already using its ::after to turn.
 */
* { -webkit-tap-highlight-color: transparent; }

button::before,
.chat-list li::before,
.country-list li::before,
a.carried-file::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0; transform: scale(0.72);
  transition: opacity 500ms ease, transform 500ms ease;
  pointer-events: none;
}
button:active::before,
.chat-list li:active::before,
.country-list li:active::before,
a.carried-file:active::before {
  opacity: 0.16; transform: scale(1); transition-duration: 0s;
}
button:disabled::before { content: none; }
button:active { transform: scale(0.97); }
.chat-list li, .country-list li, a.carried-file { position: relative; }
#signin-button { width: 100%; margin-top: 14px; }
button.plain { background: none; color: var(--muted); padding: 6px 10px; font-weight: 500; }
button.plain:hover { color: var(--text); }

/* ── The app ────────────────────────────────────────────────────────────── */
/*
 * One row, and it must not grow. A grid row left to size itself takes its item's content, and a
 * grid item's automatic minimum height is that content too — so a chat with enough messages in it
 * made this row 1650px tall inside a 915px window. The message list was then handed its full
 * natural height, so it had nothing to scroll, and the composer sat below the bottom of the
 * screen. minmax(0, 1fr) pins the row to the window; min-height: 0 lets the panes inside shrink
 * to it, which is what makes their own lists scroll instead.
 */
.app {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  /* Not a fixed height: --screen is what the window actually has at this moment, which is less
     when a keyboard is up. 100dvh is only the answer until the first measurement arrives, and
     for anything that cannot measure. */
  height: var(--screen, 100dvh);
}

.chats {
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
}
.pane-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.pane-head strong { font-size: 17px; }
/* Whether the live connection is up: a proper dot rather than a full stop, with a soft halo when
   it is, so it reads at a glance instead of needing to be looked for. */
.link-state {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: var(--faint); opacity: 0.6;
  transition: background 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}
.link-state.live {
  background: #5de2a8; opacity: 1;
  box-shadow: 0 0 0 3px rgba(93, 226, 168, 0.18);
}

/* The header's icon buttons: no fill, muted until touched. */
button.icon {
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0; flex: none;
  background: none; color: var(--muted); border-radius: 50%;
}
button.icon:hover { color: var(--text); background: var(--raised2); }
button.icon:active { transform: scale(0.94); }
.search { margin: 0 10px 8px; width: auto; border-radius: 15px; }

.chat-list {
  list-style: none; margin: 0; flex: 1; overflow-y: auto;
  padding: 0 8px calc(20px + env(safe-area-inset-bottom));
}
.chat-list li {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 9px; border-radius: 12px; cursor: pointer;
}
.chat-list li:hover { background: var(--raised); }
.chat-list li[aria-current="true"] { background: var(--raised2); }
.chat-line { min-width: 0; flex: 1; }
.chat-line .top { display: flex; align-items: baseline; gap: 8px; }
.chat-line strong { font-size: 15px; font-weight: 600; }
.chat-line .when { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }
.chat-line .preview {
  font-size: 13px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  background: var(--accent); color: var(--on-accent);
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}

/* A face, or initials on a colour taken from the name so each person keeps the same one. */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff;
  background: var(--raised3); background-size: cover; background-position: center;
}
.avatar.saved { background: var(--accent); color: var(--on-accent); }

/* ── The open conversation ──────────────────────────────────────────────── */
.room { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.room > div { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/*
 * Nothing open yet: the flower and its line, in the middle of the room. `.room > div` above made
 * this a column stretched from the top — it outweighs a class alone — so the flower sat against
 * the header with the words under it. Said with the room in front, it wins and is centred both ways.
 */
.room > .room-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px 24px 12vh; text-align: center;
}
.room-empty .mark.big { opacity: 0.9; }
.room-empty p { margin: 0; font-size: 15px; }
.room-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.room-head .avatar { width: 36px; height: 36px; font-size: 13px; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who small { font-size: 12px; }
/* Drawn, like the icons it sits beside — a font’s arrow glyph came out at its own weight
   and its own shape on every platform. Shown only where the chat list is not beside it. */
.back { display: none; place-items: center; width: 38px; height: 38px; padding: 0; }

/*
 * The app's own doodles, at a whisper, so the conversation has something behind it — and at the
 * app's own size. ChatWallpaper.kt asks for 8 repeats of a 384 tile and notes that repeats are
 * counted across the area, so each side is 384/sqrt(8) = 135.8. Drawn at 384 the web was showing
 * roughly one icon where the phone shows nine; at 136 the two match, the tile stays square, so a
 * row and a column are spaced alike and the count grows with the window exactly as it does there.
 */
.messages {
  /* Clipped sideways: a bubble pulled aside must not widen the list or hand it a scrollbar, and
     the mark behind it should come out of the edge rather than sit beyond it. */
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px;
  /* The search bar lies over the top of this, so nothing is scrolled to underneath it. */
  scroll-padding-top: 58px;
  display: flex; flex-direction: column; gap: 3px;
  background-image: url("wallpaper-dark.svg");
  background-size: 136px 136px;
  color: var(--text);
}
/* Dark is this page's default, so the light tile is the exception — the same two cases the
   palette itself is chosen by. */
:root[data-mood="light"] .messages { background-image: url("wallpaper.svg"); }
@media (prefers-color-scheme: light) {
  :root:not([data-mood]) .messages { background-image: url("wallpaper.svg"); }
}
/* The row a message sits in: the whole width of the conversation, so the quiet space beside a
   bubble still belongs to that message and answers a tap on its behalf. The side a bubble takes
   is decided here rather than by the bubble itself. */
.line { display: flex; justify-content: flex-start; position: relative; }
/*
 * The row answers a tap, so the row shows that it was tapped: the same press the controls use,
 * fainter and wider, instant under the finger and slow to leave. The bubble is positioned, so it
 * sits above this and keeps its own colour.
 *
 * Not, however, when the press was really meant for something inside it — a picture, a film, the
 * waveform, a key, a file's link all answer for themselves, and lighting the whole row behind
 * them would be noise. Where :has is not understood the rule is dropped and the row simply
 * blooms anyway, which is the harmless way for it to fail.
 */
.line::before {
  content: ''; position: absolute; inset: 0; border-radius: 14px;
  background: currentColor; opacity: 0; transform: scale(0.98);
  transition: opacity 520ms ease, transform 520ms ease;
  pointer-events: none;
}
/* A click on the row's empty part shades it at once; a click on the bubble does not — the shade
   there is for a press being held, which grows in (.holding) and picks the message. */
.line:active:not(:has(.bubble:active))::before { opacity: 0.09; transform: scale(1); transition-duration: 0s; }
.line.holding::before { opacity: 0.11; transform: scale(1); transition: opacity 300ms ease, transform 300ms ease; }
.line:active:has(.scrub:active, .key:active, img:active, video:active, a:active)::before { opacity: 0; }
.line.mine { justify-content: flex-end; }
.line.note { justify-content: center; }

.bubble {
  max-width: min(520px, 80%); padding: 6px 10px;
  border-radius: 16px; background: var(--raised2); font-size: 14.5px;
  word-wrap: break-word; white-space: pre-wrap;
  /* The up and down of a gesture belongs to the list; only the sideways part is ours. */
  touch-action: pan-y;
}
.bubble.mine { background: var(--accent); color: var(--on-accent); }
.bubble .stamp { font-size: 10.5px; opacity: 0.65; margin-left: 8px; float: right; margin-top: 4px; }
.bubble.note { background: none; color: var(--faint); font-size: 12px; }
.day { align-self: center; color: var(--muted); font-size: 11px; margin: 8px 0 4px; }

/*
 * The page is drawn edge to edge (viewport-fit=cover), so the phone's navigation bar sits over the
 * bottom of it. Everything that ends at the bottom keeps that much clear of itself.
 */
/*
 * The composer and the drawer are one block, as they are in the app: the line above them and the
 * room below the keys belong to the block, so the drawer coming out underneath the composer is
 * still inside both.
 */
.composer-area {
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  /*
   * Sideways is the browser's — it is how the drawer's row is scrolled when there are more choices
   * than fit. Up and down are ours, and saying so is what makes the slide work at all: without it
   * the browser takes a vertical drag for a scroll it might have to do, cancels our pointer, and
   * the slide never arrives. Nothing here scrolls vertically, but it does not wait to find out.
   */
  touch-action: pan-x;
}
.composer {
  /* Centred, or the attach button — fixed at 38 while the field comes out taller — stretches from
     the same top edge and ends up riding three pixels high. */
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
}
.composer input, .composer textarea { border-radius: 20px; }
.composer { align-items: flex-end; }
.composer #attach, .composer #send { margin-bottom: 0; }
#draft {
  flex: 1; min-width: 0; display: block; width: 100%;
  min-height: 40px; max-height: 150px; padding: 9px 14px; resize: none; overflow-y: hidden;
  background: var(--raised2); color: var(--text);
  border: 1px solid var(--line); font: inherit; line-height: 20px;
}
/*
 * The same edge the chat's own search field has: taking the caret warms its border towards the
 * petal rather than putting a hard ring outside it. The ring is the browser's default for a focused
 * field, and against a composer that is already a soft pill it reads as a box drawn round it.
 * The tray's caption gets it too — while the tray is up, that field is the composer.
 */
.composer input:focus, .composer textarea:focus, #tray-caption:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--petal) 55%, var(--line));
}
/* A paper plane on a disc, rather than the word. It is drawn, like every other icon here. */
#send {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
}
#send svg { margin: 1px 2px 0 -1px; }
#send:active { transform: scale(0.94); }

/*
 * Pull a message to the right to answer it, as the app does. The mark waits just off its leading
 * edge and comes up with the pull, so the gesture says what it will do before it is finished.
 */
.bubble.swiping { z-index: 2; }
.bubble.settling { transition: transform 190ms cubic-bezier(0.2, 0.8, 0.3, 1); }
.swipe-mark {
  position: absolute; top: 50%; right: calc(100% + 10px);
  width: 26px; height: 26px; margin-top: -13px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--raised3); color: var(--muted);
  opacity: 0; pointer-events: none; transition: opacity 120ms linear;
}

/* On a phone the two panes become one, and the chat slides over the list. */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; overflow: hidden; }
  .chats { border-right: 0; }
  .back { display: grid; }

  /*
   * Both panes share the one cell, and the chat is moved aside rather than switched off: a pane
   * that is display:none has nothing to animate, so a conversation used to appear in a single
   * frame. It now comes in from the right while the list drifts the other way — the parallax the
   * phone app has — and visibility keeps whichever pane is covered out of the tab order without
   * cutting the movement short, since it counts as visible for as long as either end of the
   * transition is.
   */
  .chats, .room {
    grid-area: 1 / 1;
    transition: transform 280ms cubic-bezier(0.2, 0.85, 0.3, 1), visibility 280ms;
  }
  .room {
    z-index: 2; transform: translateX(100%); visibility: hidden;
    /* Opaque, or the list reads through the header and the composer on the way in. The two pools
       are the body's own, so the pane carries the same painting rather than a flat patch. */
    background-color: var(--bg);
    background-image:
      radial-gradient(60vw 60vw at 12% -10%, color-mix(in srgb, var(--petal) 20%, transparent), transparent 70%),
      radial-gradient(55vw 55vw at 105% 108%, color-mix(in srgb, var(--amber) 18%, transparent), transparent 70%);
    background-attachment: fixed;
  }
  .app[data-open="true"] .room { transform: none; visibility: visible; }
  .app[data-open="true"] .chats { transform: translateX(-24%); visibility: hidden; }
}

/* Beside the list there is nothing to slide over, so the conversation simply arrives. */
@media (min-width: 761px) {
  #room-open.entering { animation: room-in 200ms cubic-bezier(0.2, 0.8, 0.3, 1); }
}
@keyframes room-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Asked for stillness, given stillness: the panes change over without moving. */
@media (prefers-reduced-motion: reduce) {
  .ring.turning svg { animation-duration: 2.4s; }
  .key.loading::after { animation-duration: 2s; }
  .wave.waiting span { animation-duration: 2.6s; }
  .chats, .room { transition: none; }
  #room-open.entering { animation: none; }
  .viewer, .viewer-media, .viewer-strip { transition: none; }
}

/* ── Being let in from a phone ──────────────────────────────────────────── */
.small { font-size: 12.5px; margin: 6px 0; }
button.ghost {
  width: 100%; margin-top: 8px;
  background: var(--raised2); color: var(--text); font-weight: 500;
}
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 12px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* The six characters, spaced so they can be read off a screen and typed without doubt. */
.code {
  font: 700 23px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 3px; text-align: center;
  background: var(--raised2); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 10px; margin: 8px 0;
}

/*
 * The square the phone's camera reads.
 *
 * White, always, and in both themes: a QR code is read as dark on light, and the quiet border is
 * part of the code rather than padding round it — so the white runs to the rounded edge and the
 * border lives inside the drawing. It is given its full size before the code arrives, so the card
 * does not jump when it does.
 */
.qr {
  width: 208px; height: 208px; margin: 14px auto 10px;
  background: #fff; border-radius: 14px; overflow: hidden;
}
.qr svg { display: block; }

/* The way in that most people will not need, offered as a line rather than a third button. */
button.plain.wide { width: 100%; margin-top: 12px; font-size: 13.5px; }

#link-start { width: 100%; margin-top: 4px; }
#link-box { margin-top: 6px; }

/* ── A call ─────────────────────────────────────────────────────────────── */
.call {
  position: fixed; inset: 0; z-index: 10;
  background: #09090c; color: #fff;
  display: flex; flex-direction: column;
}
.call-faces { flex: 1; position: relative; overflow: hidden; }
.call-faces .remote { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-faces .local {
  position: absolute; top: 18px; right: 18px;
  width: 132px; height: 190px; object-fit: cover;
  border-radius: 16px; background: #1c1c24;
}
/* Who it is, in the middle, until a picture covers it. */
.call-who {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  pointer-events: none;
}
.call-who strong { font-size: 22px; }
.avatar.big { width: 108px; height: 108px; font-size: 34px; }

.call-keys {
  display: flex; justify-content: center; gap: 16px;
  padding: 22px 16px calc(34px + env(safe-area-inset-bottom));
}
button.round {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fff;
  font-size: 13px; font-weight: 600;
}
button.round.off { background: #fff; color: #09090c; }
button.round.go { background: #5de2a8; color: #04170e; }
button.round.stop { background: var(--danger); color: #fff; }


/* ── Choosing how it looks ──────────────────────────────────────────────── */
/*
 * The .signin lesson, learnt a second time. An auto grid track grows to hold its item's
 * min-content, and the country list's min-content is the widest country name with nothing
 * wrapped — about 520px, far wider than a phone. So the track outgrew the window, and
 * place-items:center dutifully centred the card inside the *track*: it sat half off the right
 * edge, taking the search field and the dial codes with it, and no amount of scrolling could
 * reach it. A flex row instead, the card centred by its own auto margins so a sheet taller than
 * the window overflows downward and scrolls honestly, and min-width:0 so the card is never
 * widened to fit a name it is going to ellipsise anyway.
 */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.45);
  display: flex; justify-content: center; overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-card {
  width: min(360px, 100%);
  min-width: 0; margin: auto;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 24px; padding: 18px;
}
.sheet-card > strong { font-size: 19px; }
.sheet-card > .muted { font-size: 13px; margin: 8px 0 0; }
/*
 * The people the account already knows, offered inside the write-it-out sheet. The list is the
 * chat list's own rows at a smaller padding, and it is capped so the card keeps its shape however
 * many there are; the sheet itself scrolls past that.
 */
.saved-picks { max-height: 216px; padding: 0; }
.saved-picks li { padding: 8px 9px; }
/*
 * Only while there is more below. A list that has been scrolled to its end, or never had anything
 * hidden, fades nothing — a permanent fade would put a haze over the last row for no reason.
 */
.saved-picks.more {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 30px), transparent);
}
/* The written-out way is a second way, not a continuation of the list above it. */
#contact-saved-wrap { padding-bottom: 14px; border-bottom: 1px solid var(--line); }

.sheet-row { display: flex; align-items: stretch; gap: 10px; margin-top: 20px; }
/*
 * Equal, and level. A ghost button carries its own full width and an 8px top margin, which in a
 * row of two makes it narrower than its neighbour where it is stretched to the same height — and
 * 8px shorter, sitting 8px lower, where it is not. Both are undone here, and the pair is given the
 * fields' own corner and a height a thumb can find.
 */
.sheet-row > button { flex: 1 1 0; width: auto; min-width: 0; margin: 0; min-height: 46px; border-radius: 14px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 18px 0 8px; }

.segmented { display: flex; gap: 3px; background: var(--raised2); border-radius: 16px; padding: 3px; margin-top: 14px; }
.segmented button {
  flex: 1; background: none; color: var(--muted);
  border-radius: 13px; padding: 9px 0; font-size: 13px; font-weight: 600;
}
.segmented button.on { background: var(--accent); color: var(--on-accent); }

.themes { display: flex; gap: 12px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; padding: 0; position: relative; }
.swatch.on::after {
  content: ""; position: absolute; inset: -4px;
  border: 2px solid var(--text); border-radius: 50%;
}

#look-sheet .ghost { margin-top: 20px; }
/*
 * Google's button is 40 tall and arrives whenever Google's script gets here. The slot is that tall
 * from the first frame and holds a quiet stand-in until then, so nothing below it moves.
 */
/*
 * The two sit on top of one another so one can fade out as the other fades in. Without that they
 * would simply swap between frames, which is a jump however well the space was reserved.
 */
#google-slot {
  position: relative; display: flex; justify-content: center; align-items: center;
  margin-top: 14px; min-height: 40px;
}
#google-button { opacity: 0; transition: opacity 260ms ease; }
#google-button.shown { opacity: 1; }
.slot-ghost {
  position: absolute; inset: 0; margin: auto;
  width: 320px; max-width: 100%; height: 40px;
  border-radius: 999px; background: var(--raised2);
  animation: slot-breathe 1.6s ease-in-out infinite;
  transition: opacity 240ms ease;
}
.slot-ghost.gone { opacity: 0; animation: none; }
@keyframes slot-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .slot-ghost { animation: none; } }
/* Nothing to wait for after all: the space goes back, rather than sitting there empty. */
#google-slot.empty { min-height: 0; margin-top: 0; }

/* ── The country tile ───────────────────────────────────────────────────── */
/*
 * The app's own measurements: 54 tall, an 18 corner, the raised surface with a hairline round it,
 * 12 of room at the start and 8 at the end, the flag at 19, the code semibold beside it and a
 * chevron after. Written out here rather than approximated so the two look like one product.
 */
.phone-row { display: flex; gap: 10px; }
.phone-row input { flex: 1; min-width: 0; }
/*
 * The tile, the number and the password are one set and read as one: 54 each.
 *
 * Each of the three used to arrive at its own height. The tile said 54; the number beside it was
 * whatever the row stretched it to, which was the tile's 54; and the password, standing on its
 * own, fell back to what padding and a line of text come to, which was 41.8 — a dozen points
 * shorter than the pair above it. They are told once now, and the number no longer depends on its
 * neighbour for its height.
 */
#signin-form input { height: 54px; }

button.country {
  display: flex; align-items: center; gap: 8px;
  height: 54px; padding: 0 8px 0 12px;
  background: var(--raised); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px;
  font-weight: 600; flex: none;
  transition: transform 90ms ease;
}
button.country:active { transform: scale(0.97); }
.country .flag { font-size: 19px; line-height: 1; }
/* Where flags cannot be drawn, the two letters stand in — deliberately, not as a broken glyph. */
.flag.letters {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 18px; padding: 0 4px;
  border-radius: 5px; background: var(--raised3); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
}
.country .dial { font-size: 15.5px; font-weight: 600; }
/* The chevron, drawn rather than fetched. */
/* A drawn chevron, two strokes meeting — not the solid triangle the old border trick made. */
.country .chev { flex: none; margin-left: -2px; color: var(--muted); }

/* ── The country list ───────────────────────────────────────────────────── */
.list-card { display: flex; flex-direction: column; max-height: min(560px, 82dvh); }
.list-card .search { margin: 12px 0 8px; width: 100%; }
.country-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1; min-height: 0;
}
.country-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px; border-radius: 12px; cursor: pointer;
}
.country-list li:hover { background: var(--raised2); }
.country-list li[aria-current="true"] { background: var(--raised2); }
.country-list .flag { font-size: 20px; line-height: 1; }
.country-list .cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-list .cdial { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── What a message carries ─────────────────────────────────────────────── */
/*
 * Pictures and video are fetched with the session's token and handed over as blob URLs, so they
 * are ordinary local sources by the time they reach these rules.
 */
.bubble .shot { margin: 2px 0 4px; }
/*
 * A bubble is otherwise only as wide as what it holds, and an empty picture holds nothing — so
 * the box collapsed to the width of the word "Photo" and then sprang open when the blob arrived.
 * A picture's width here never depended on the picture anyway: the image is 100% of the bubble
 * and capped at 320, so it is always min(320, the bubble's own limit), before and after. Saying
 * so outright is what holds the room still.
 */
.bubble.has-shot { width: min(320px, 100%); }
/* A sticker: no bubble, the animation itself, and the time on a small pill beneath. */
.bubble.sticker, .bubble.sticker.has-shot { width: auto; background: none; padding: 0; box-shadow: none; }
.bubble.sticker .shot img { width: 150px; height: 150px; object-fit: contain; border-radius: 0; background: none; }
.bubble.sticker .foot {
  display: inline-flex; margin-top: 2px; padding: 2px 8px; border-radius: 10px;
  background: var(--raised2); color: var(--muted);
}
.shot { position: relative; }
.gif-mark {
  position: absolute; top: 7px; left: 7px; z-index: 1; padding: 1px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 11px; font-weight: 700; pointer-events: none;
}
.bubble .shot img, .bubble .shot video {
  /* height: auto matters: the width and height attributes that hold the room are presentational
     hints, and the height among them would otherwise make the box as tall as the photo's own
     pixels. With it, the pair are read as a shape and the room comes out right. */
  display: block; width: 100%; height: auto; max-width: 320px; max-height: 340px;
  object-fit: cover; border-radius: 14px; background: rgba(0, 0, 0, 0.25);
  transition: opacity 200ms ease;
}
/* A film has no such attributes to borrow, so its shape is set directly and it is given a floor
   to stand on while it is still empty. */
.bubble .shot video { min-width: 220px; }
.bubble .shot video.unsized { aspect-ratio: 4 / 3; }
/* Fetched, not yet painted: the room is held and the picture fades into it. */
.bubble .shot img.waiting { opacity: 0; }
.bubble .shot img { cursor: zoom-in; }
.bubble .shot.broken, .bubble .sound.broken, .bubble .carried-file.broken { opacity: 0.6; font-size: 13px; }

/*
 * An album: several pictures and films sent together, as one block.
 *
 * The same four shapes the app lays out (MediaCollage in MessageContent.kt) — two side by side,
 * one large beside two, a square of four, rows of three after that — and the same 2px between
 * them, with the corners rounded once, around the whole block rather than each tile.
 *
 * Every tile's shape is set here rather than taken from its picture, so the block is the size it
 * is going to be before any of them have arrived: nothing below it moves as they fill in.
 */
.bubble .album {
  display: grid; gap: 2px; width: 100%; max-width: 320px;
  margin: 2px 0 4px; border-radius: 14px; overflow: hidden;
}
.bubble .album .tile {
  position: relative; overflow: hidden;
  background: rgba(0, 0, 0, 0.25); cursor: zoom-in;
}
.bubble .album .tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 200ms ease; }
.bubble .album .tile img.waiting { opacity: 0; }
/*
 * Each shape says what its own tiles are, rather than one rule saying "square" and another trying
 * to take it back: the taking back lost, because `.bubble .album .tile` outweighs `.album-3 .tile`,
 * and three pictures came out as squares overflowing rows half their height — the big one short of
 * the bottom edge and the low one clipped against it.
 */
.bubble .album-2, .bubble .album-4 { grid-template-columns: 1fr 1fr; }
.bubble .album-many { grid-template-columns: repeat(3, 1fr); }
.bubble .album-2 .tile, .bubble .album-4 .tile, .bubble .album-many .tile { aspect-ratio: 1; }
/* One large beside two. The app gives this row 0.62 of its own width, and the large one 1.3 of the
   two columns — so the proportion is the grid's, and the tiles take the height it hands them. */
.bubble .album-3 { grid-template-columns: 1.3fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 100 / 62; }
.bubble .album-3 .tile:first-child { grid-row: span 2; }
/* A film in a collage is a frame with a key over it, not a player: there is no room for works in
   a third of a bubble, and it opens full size like the app's does. */
.bubble .album .tile.film { cursor: pointer; }
.bubble .album .tile .tile-key {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.45); pointer-events: none;
}
.bubble .album .tile.loading .tile-key { opacity: 0.5; }
.bubble .album .tile .tile-time {
  position: absolute; left: 6px; bottom: 6px;
  padding: 1px 5px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 11px; font-variant-numeric: tabular-nums;
}
/* More than the block holds. */
.bubble .album .tile .tile-more {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 19px; font-weight: 700;
}
.bubble .album .tile.broken { opacity: 0.6; }
.bubble .sound { display: block; width: 280px; max-width: 100%; margin: 3px 0; }
/*
 * A little air before the clock, not a corridor. Most of what looked like a gap was not the gap
 * at all: the clock is right-aligned inside a 36px box, so a short label like 0:12 left the
 * difference standing empty to its left. The box hugs its text here and the gap is the gap.
 */
.sound .transport { gap: 6px; }
.sound .time { min-width: 0; }
/* What it is called and how long it runs, under the bars rather than beside them — and lined up
   with the bars, not with the key, so the two read as one block. */
.sound-note {
  margin: 3px 0 1px 40px; font-size: 11.5px; opacity: 0.72;   /* the key's 34 and the row's 6 */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Players of our own, and the ring on what is still going out ────────── */
/*
 * One set of parts serves both: a round key, something to scrub along, and the clock. They take
 * their colour from the bubble they sit in, so they are right in either shade and on either side
 * of the conversation without being told twice.
 */
.key {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.22); color: inherit;
}
.key:hover { background: rgba(0, 0, 0, 0.32); }
.key:active { transform: scale(0.94); }
/* Nothing to play yet: the key turns in place rather than sending the eye somewhere else. */
.key.loading { cursor: default; }
.key.loading svg { display: none; }
.key.loading::after {
  content: ''; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; opacity: 0.75;
  animation: key-turn 760ms linear infinite;
}
.key.big.loading::after { width: 24px; height: 24px; border-width: 2.5px; }
@keyframes key-turn { to { transform: rotate(360deg); } }
.transport { display: flex; align-items: center; gap: 8px; }
/* touch-action: none, or the browser takes the drag for scrolling before the seek ever sees it. */
.scrub {
  position: relative; flex: 1; min-width: 0; height: 24px;
  display: flex; align-items: center; cursor: pointer; touch-action: none;
}
.scrub::before {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  border-radius: 2px; background: currentColor; opacity: 0.28;
}
.scrub .fill { position: absolute; left: 0; width: 0; height: 3px; border-radius: 2px; background: currentColor; }
/* Bars instead of a line, once there are bars to show. */
.scrub.waved::before { display: none; }
/*
 * Forty-eight bars share whatever width there is, exactly as the app divides it: the bar is what
 * is left after the gaps, not a fixed size. They were each holding out for 2px, which forty-eight
 * of them cannot have in this space, so they spilled out of the track and ran into the clock.
 * min-width: 0 lets them be as thin as the room requires, and the clip is a second guarantee.
 */
.wave { position: absolute; inset: 0; display: flex; align-items: center; gap: 1px; overflow: hidden; }
/* 0.4 and 1, and the heights the app gives them, so the two draw the same sound alike. */
.wave span { flex: 1 1 0; min-width: 0; border-radius: 2px; background: currentColor; opacity: 0.4; }
.wave span.on { opacity: 1; }
/* No reading yet — and it does not pretend to be one. */
.wave.waiting span { opacity: 0.22; transform-origin: center; animation: wave-wait 1150ms ease-in-out infinite; }
@keyframes wave-wait {
  0%, 100% { transform: scaleY(0.4); opacity: 0.18; }
  50% { transform: scaleY(1); opacity: 0.42; }
}
.time {
  font-size: 11px; opacity: 0.75; min-width: 36px;
  text-align: right; font-variant-numeric: tabular-nums;
}

.player { position: relative; display: block; }
.player .key.big {
  position: absolute; top: 50%; left: 50%; margin: -27px 0 0 -27px;
  width: 54px; height: 54px; background: rgba(0, 0, 0, 0.5); color: #fff;
  transition: opacity 180ms ease;
}
.player.playing .key.big { opacity: 0; pointer-events: none; }
.player .transport {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  padding: 3px 8px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.52); color: #fff;
}
.player .transport .key { width: 28px; height: 28px; background: none; }
.player:fullscreen video { max-height: none; height: 100%; object-fit: contain; }

/* Still going out: the file sits where it will end up, with a ring that fills as it leaves. */
.bubble.pending { opacity: 0.94; }
.going { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.going-note { font-size: 11px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.ring { width: 26px; height: 26px; flex: none; display: block; }
/* Where a sound is still going out, the ring stands in the key's place and at the key's size. */
.ring.in-key { width: 34px; height: 34px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; stroke: currentColor; }
.ring .track { opacity: 0.25; }
/* 97.389 is the way round a circle of radius 15.5, which is what the dashes are measured in. */
.ring .line {
  stroke-linecap: round; stroke-dasharray: 97.389;
  stroke-dashoffset: calc(97.389 * (1 - var(--done, 0)));
  transition: stroke-dashoffset 140ms linear;
}
/* Before the bytes start and after they end, there is no fraction to show, so it simply turns. */
.ring.turning svg { animation: ring-turn 900ms linear infinite; }
.ring.turning .line { stroke-dasharray: 26 72; stroke-dashoffset: 0; transition: none; }
@keyframes ring-turn { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
.bubble .carried-file {
  display: block; margin: 3px 0; padding: 8px 10px;
  border-radius: 12px; background: rgba(0, 0, 0, 0.16);
  color: inherit; text-decoration: none; font-size: 13.5px;
}
.bubble.mine .carried-file { background: rgba(0, 0, 0, 0.12); }
.bubble .words { white-space: pre-wrap; word-wrap: break-word; }
.bubble .quoted {
  border-left: 3px solid currentColor; opacity: 0.75;
  padding: 1px 0 1px 7px; margin-bottom: 4px; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}
.bubble .call-note { font-size: 14px; }

/* The line a bubble ends with: feelings, the clock, and how far it got. */
.bubble .foot {
  display: flex; align-items: center; gap: 4px;
  justify-content: flex-end; margin-top: 1px; height: 14px;
}
.bubble .stamp { font-size: 10px; opacity: 0.65; float: none; margin: 0; }
.bubble .tick { font-size: 11px; opacity: 0.7; letter-spacing: -2px; }
.bubble .tick.read { opacity: 1; color: #5de2a8; }
.bubble.mine .tick.read { color: inherit; opacity: 1; }
.bubble .chip {
  background: rgba(0, 0, 0, 0.18); color: inherit;
  border-radius: 8px; padding: 0 5px; height: 15px;
  font-size: 10.5px; line-height: 15px; font-weight: 600;
}
.bubble .chip.ours { background: rgba(0, 0, 0, 0.34); }

/* Held over the message it belongs to. */
.bubble { position: relative; cursor: default; }
/* Hung from the bubble's own side: anchored right for mine, left for theirs. A narrow incoming
   bubble would otherwise carry the menu off the left edge, where the list now clips it. */
.line:not(.mine) .msg-menu { right: auto; left: 0; }
.msg-menu {
  position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  background: var(--raised3); border: 1px solid var(--line);
  border-radius: 22px; padding: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.msg-menu button {
  background: none; color: var(--text);
  width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 17px;
}
.msg-menu button:hover { background: var(--raised2); }
.msg-menu button.reply { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }

/* ── Writing ────────────────────────────────────────────────────────────── */
.typing { padding: 1px 14px 5px; font-size: 11.5px; color: var(--muted); }
/*
 * Searching lies over the conversation instead of shoving it down: the bar is as tall as it is
 * and then takes that height back as a negative margin, so the messages keep their own space and
 * it floats on top of them, flush under the toolbar. The field keeps to the right — the arrows
 * step between matches and want the left — and gets no hard outline when it is focused, only a
 * warmer edge.
 */
.find-bar {
  position: relative; z-index: 6;
  height: 52px; margin-bottom: -52px;
  display: flex; align-items: center; gap: 4px; padding: 0 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.find-bar .search {
  width: min(250px, 80%); margin: 0 0 0 auto;
  height: 36px; border-radius: 18px;
}
.find-bar .search:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--petal) 55%, var(--line));
}
.find-count {
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; padding-left: 2px;
}

/*
 * What was found is marked where it was found — the words themselves, not a ring round the whole
 * bubble. The green is the one the read ticks already use: the petal and the amber are what a
 * bubble of my own is made of, so a highlight in either would disappear into it. The one being
 * looked at is solid, the rest are a wash of the same colour, and both read on either side of
 * the conversation. box-decoration-break keeps a match that wraps from losing its corners.
 */
mark.found {
  background: color-mix(in srgb, #5de2a8 46%, transparent);   /* enough to read over amber too */
  color: inherit; border-radius: 4px; padding: 0 1px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
mark.found.on { background: #5de2a8; color: #0d1f18; }
.reply-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px; padding: 8px 10px;
  background: var(--raised2); border-radius: 14px;
}
.reply-mark { width: 3px; align-self: stretch; border-radius: 2px; background: var(--petal); }
.reply-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon.small { width: 28px; height: 28px; }

/* ── Who to write to ────────────────────────────────────────────────────── */
.chat-list.people { padding: 8px 0; }
.empty-note { padding: 14px 10px; color: var(--muted); font-size: 13.5px; }

/* A shared contact, as the app draws one: a mark, then who it is, on a panel of its own. */
.contact-card {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0; padding: 8px;
  border-radius: 12px; background: color-mix(in srgb, currentColor 10%, transparent);
}
.contact-mark { display: grid; place-items: center; width: 26px; height: 26px; flex: none; }
.contact-said { white-space: pre-wrap; font-size: 13.5px; }

/* ── What can be sent, and what is waiting to go ────────────────────────── */
/*
 * The drawer: a row of choices under the composer rather than a sheet over the conversation, the
 * same seven the app offers, each a disc of its own colour with its name beneath. It spreads while
 * the choices fit and scrolls once there are more than will.
 */
/*
 * It comes out of the composer's bottom edge rather than appearing over the conversation, the way
 * the app's does. The height is animated through a grid row from nothing to its own size, which is
 * the one way to get there without naming a height that would have to be kept true by hand.
 */
.attach-drawer {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 200ms cubic-bezier(0.2, 0.8, 0.25, 1), opacity 150ms ease;
}
.attach-drawer:not(.open) { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
/*
 * What is squeezed, and what is squeezed inside it.
 *
 * A row told to be nothing is nothing only as far as its content: the padding it is drawn with, the
 * border round it and the margin under it are its own box and go on taking room — 28 and 2 and 8,
 * which is the 38 points of air that sat under the composer with the drawer shut. So the squeezing
 * is done here, where there is nothing to leave behind, and the card with all its drawing is inside.
 */
.attach-clip { min-height: 0; overflow: hidden; }
.attach-row {
  display: flex; gap: 2px; justify-content: space-evenly;
  margin: 0 10px 8px; padding: 14px 6px;
  border: 1px solid var(--line); border-radius: 24px; background: var(--raised);
  overflow-x: auto; scrollbar-width: none;
}
.attach-row::-webkit-scrollbar { display: none; }
.attach-choice {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 72px; flex: none; padding: 4px; border: 0; border-radius: 18px;
  background: none; color: var(--muted); cursor: pointer;
  /* Not the `font` shorthand: it has no way to say "the family I already have", and the whole
     declaration goes if you try, which left these labels at the page's own size. */
  font-family: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.1;
}
.attach-disc {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: color-mix(in srgb, currentColor 15%, transparent);
}
.attach-choice.petal .attach-disc, .attach-choice.petal svg { color: var(--petal); }
.attach-choice.mint .attach-disc, .attach-choice.mint svg { color: var(--mint); }
.attach-choice.amber .attach-disc, .attach-choice.amber svg { color: var(--amber); }
.attach-choice.blue .attach-disc, .attach-choice.blue svg { color: #4fa3ff; }
.attach-choice.violet .attach-disc, .attach-choice.violet svg { color: #8b7cff; }
.attach-choice.danger .attach-disc, .attach-choice.danger svg { color: var(--danger); }
.attach-label { color: var(--muted); }
#attach.on { color: var(--petal); }

/* The tray: everything picked and not yet sent, with one caption for the lot. */
.tray {
  margin: 8px 10px 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 24px; background: var(--raised);
}
.tray-head { display: flex; align-items: center; padding: 0 4px 10px; }
.tray-count { flex: 1; color: var(--muted); font-size: 13px; font-weight: 600; }
.tray-tiles { display: flex; gap: 8px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: thin; }
.tray-tile {
  position: relative; flex: none; width: 86px; height: 86px;
  border-radius: 16px; overflow: hidden; background: var(--raised2);
  cursor: grab; touch-action: pan-x; user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tray-tile img, .tray-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Lifted out of the row and carried: it rides above its neighbours until it is let go. */
.tray-tile.lifted { z-index: 3; cursor: grabbing; box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45); transition: none; }
.tray-kind { position: absolute; inset: 0; display: grid; place-items: center; color: var(--petal); }
.tray-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 5px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: #fff; font-size: 10.5px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tray-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.45);
}
.tray-drop {
  position: absolute; top: 3px; right: 3px; display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); cursor: pointer;
}
.tray-more {
  flex: none; width: 86px; height: 86px; border: 0; border-radius: 16px;
  background: var(--raised2); color: var(--petal); font-size: 26px; cursor: pointer;
}
.tray-foot { display: flex; align-items: center; gap: 8px; }
.tray-foot input { flex: 1; border-radius: 20px; }
#tray-send {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
}
#tray-send svg { margin: 1px 2px 0 -1px; }

/* ── One picture, full size ─────────────────────────────────────────────── */
/* The shade comes up while the picture itself flies out of the chat and back into it. */
.viewer {
  position: fixed; inset: 0; z-index: 40; overflow: hidden;
  background: rgba(0, 0, 0, calc(0.92 * var(--fade, 1)));
  opacity: 0; transition: opacity 220ms ease;
  touch-action: none; user-select: none;
}
.viewer.shown { opacity: 1; }
/* The pieces lie side by side and the strip is slid; only the one in front is ever on screen. */
.viewer-strip {
  display: flex; width: 100%; height: 100%;
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.25, 1);
  will-change: transform;
}
/* One cell exactly the page's size: left to itself the row took the picture's unclamped height,
   and the picture, clamped inside it, sat low with its foot under the window's edge. */
.viewer-page {
  position: relative; flex: none; width: 100%; height: 100%; padding: 20px;
  display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.viewer-media {
  /* The window's own size, less the page's padding: a percentage of a grid area is not always
     settled when the picture is sized, and a wide photo came out taller than the window. */
  max-width: min(100%, calc(100vw - 40px)); max-height: min(100%, calc(100dvh - 40px));
  border-radius: 10px;
  transform-origin: center; will-change: transform;
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.25, 1);
}
.viewer-page.zoomed .viewer-media { transition: none; cursor: grab; }
.viewer-page video { background: #000; }
.viewer-page.broken { color: var(--muted); font-size: 13px; }
/* Over the blurred stand-in: large enough to read as progress, white on a soft shadow so it shows
   on any photo, and the fill eases between the pieces the download arrives in. */
.viewer-waiting {
  position: absolute; width: 52px; height: 52px; color: #fff;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55));
}
.viewer-waiting circle { stroke-width: 2.6; }
.viewer-waiting .track { opacity: 0.35; }
/* The small copy, standing in while the full photo comes: sized like the photo, softened, and
   cross-faded away. The blur is cheap at this size and hides the small copy's few pixels. */
.viewer-media.stand-in { filter: blur(14px); width: 100%; height: auto; object-fit: contain; }
.viewer-media { transition: transform 260ms cubic-bezier(0.2, 0.8, 0.25, 1), filter 220ms ease; }
/* The buttons and the caption stay where they are while the picture is pulled away, and go when a
   tap puts them away — which is why they are not inside the strip. */
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.28), transparent);
  transition: opacity 180ms ease;
}
.viewer-gap { flex: 1; }
.viewer-top .icon { color: #fff; }
.viewer-count {
  padding: 5px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.76); color: #fff; font-size: 12.5px; font-weight: 600;
}
.viewer-hd {
  padding: 3px 7px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
}
.viewer-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 40px 14px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.9));
  color: #fff; font-size: 14.5px; white-space: pre-wrap;
  transition: opacity 180ms ease;
}
/*
 * Centred by its own height rather than by a transform: every button shrinks a little while it is
 * pressed (button:active sets a transform), and that took the centring transform's place, so the
 * arrows jumped down half their height on each click.
 */
.viewer-arrow {
  position: absolute; top: calc(50% - 21px); z-index: 2;
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.5); color: #fff; cursor: pointer;
  transition: opacity 180ms ease;
}
.viewer-arrow.prev { left: 10px; }
.viewer-arrow.next { right: 10px; }
.viewer-arrow:active { transform: scale(0.92); }
/* A tap puts everything over the picture away, and another brings it back. */
.viewer.bare .viewer-top, .viewer.bare .viewer-caption, .viewer.bare .viewer-arrow { opacity: 0; pointer-events: none; }
.viewer-menu {
  position: absolute; top: 58px; right: 12px; z-index: 3;
  display: flex; flex-direction: column; min-width: 170px; padding: 6px;
  border-radius: 16px; background: color-mix(in srgb, var(--raised3) 96%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}
.viewer-menu button {
  padding: 11px 14px; border: 0; border-radius: 11px;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.viewer-menu button:hover { background: var(--raised2); }

/* ── Markdown ───────────────────────────────────────────────────────────── */
/*
 * What the app's MarkdownMessageText draws: the inline marks, links, and code in a panel of its own
 * that scrolls sideways rather than wrapping, coloured the way the app colours it.
 */
.words strong, .md strong { font-weight: 700; }
.words code, .md code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em;
  padding: 0 4px; border-radius: 5px; background: color-mix(in srgb, currentColor 12%, transparent);
}
.words a.web-link, .md a.web-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble:not(.mine) .words a.web-link, .md a.web-link { color: var(--petal); }
:root[data-mood="light"] .bubble:not(.mine) .words a.web-link,
:root[data-mood="light"] .md a.web-link { color: color-mix(in srgb, var(--amber) 80%, #000); }
.code-panel {
  margin: 5px 0; padding: 7px 9px; overflow-x: auto; white-space: pre;
  background: rgba(0, 0, 0, 0.2); border-radius: 8px;
  font-size: 13px; line-height: 18px; direction: ltr; text-align: left;
}
.code-panel code { padding: 0; background: none; font-size: 13px; }
.code-mint { color: var(--mint); }
.code-amber { color: var(--amber); }
.code-petal { color: var(--petal); }
.code-muted { color: var(--muted); }
:root[data-mood="light"] .code-petal { color: color-mix(in srgb, var(--amber) 70%, #000); }
/* On your own bubble, which wears the accent, the colours would vanish: the panel keeps the ink. */
.bubble.mine .code-panel { background: rgba(0, 0, 0, 0.16); }
.bubble.mine .code-panel span { color: inherit; font-weight: 600; }
.bubble.mine .code-panel .code-muted { opacity: 0.65; font-weight: 400; }

/* A .md file, read in a sheet. */
.doc-card { width: min(720px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; padding: 14px 16px 6px; }
.doc-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.doc-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.doc-save { font-size: 13.5px; color: var(--muted); text-decoration: none; cursor: pointer; }
.doc-save:not([href]) { opacity: 0.4; pointer-events: none; }
.doc-body { overflow-y: auto; padding: 6px 2px 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.md h2, .md h3, .md h4, .md h5, .md h6 { margin: 18px 0 6px; line-height: 1.3; }
.md h2 { font-size: 1.45em; } .md h3 { font-size: 1.25em; } .md h4 { font-size: 1.1em; }
.md p { margin: 8px 0; white-space: pre-wrap; }
.md ul, .md ol { margin: 8px 0; padding-left: 24px; }
.md li { margin: 3px 0; white-space: pre-wrap; }
/* The app's inputs are full-width fields; a task's box is just a box beside its words. */
.md li input[type="checkbox"] {
  display: inline-block; width: auto; height: auto; min-height: 0; padding: 0; border: 0;
  margin: 0 6px 0 0; vertical-align: -2px; accent-color: var(--amber);
}
.md li:has(> input[type="checkbox"]) { list-style: none; margin-left: -20px; }
.md blockquote { margin: 10px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md .code-panel { background: var(--raised2); }

/* ── Right-click menu, forwarding, deleting, dragging to answer ─────────── */
.ctx-menu {
  position: fixed; z-index: 60; min-width: 200px; padding: 5px;
  background: var(--raised3); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  animation: ctx-in 110ms ease-out;
}
@keyframes ctx-in { from { opacity: 0; transform: scale(0.97); } }
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 9px; background: none; color: var(--text);
  font-size: 14px; text-align: left;
}
.ctx-item:hover, .ctx-item:focus-visible { background: var(--raised2); outline: none; }
.ctx-item:active { transform: none; }
.ctx-glyph { display: grid; place-items: center; width: 18px; color: var(--muted); }
.ctx-item.danger, .ctx-item.danger .ctx-glyph { color: #ff5a5f; }
.ctx-rule { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

.forward-list { overflow-y: auto; margin: 0; padding: 0; min-height: 0; }
.forward-list li { cursor: pointer; }
.forward-list li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-button {
  width: 100%; margin-top: 14px; min-height: 44px; border-radius: 14px;
  background: #ff5a5f; color: #fff; font-weight: 600;
}

/* The arrow that shows behind a message pulled to the left. */
.swipe-mark.from-right { right: auto; left: calc(100% + 10px); }
.swipe-mark.armed { color: var(--text); }
body.dragging-message, body.dragging-message * { cursor: grabbing !important; user-select: none; }
/* A photo in a message is not something to drag out of the page; pressing on it pulls the message. */
.bubble img { -webkit-user-drag: none; user-select: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  padding: 9px 16px; border-radius: 20px; background: rgba(20, 20, 26, 0.92); color: #fff;
  font-size: 13.5px; transition: opacity 160ms ease, transform 160ms ease;
}
.toast.shown { opacity: 1; transform: translate(-50%, 0); }
/* A row being pulled aside is not also being pressed: no press shade behind it. */
.line:has(> .bubble.swiping)::before { opacity: 0 !important; }

/* ── Picking messages ───────────────────────────────────────────────────── */
.room-head-main { display: contents; }
.pick-bar { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; min-height: 38px; }
.pick-count { font-size: 18px; min-width: 22px; font-variant-numeric: tabular-nums; }
.pick-all {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 6px;
  padding: 6px 12px 6px 9px; border-radius: 18px; background: var(--raised2); color: var(--text);
  font-size: 13.5px; font-weight: 500;
}
.pick-all-box {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted);
  display: grid; place-items: center; transition: background 120ms ease, border-color 120ms ease;
}
.pick-all[aria-checked="true"] .pick-all-box { background: var(--petal); border-color: var(--petal); }
.pick-all[aria-checked="true"] .pick-all-box::after,
.line.picked .pick-mark::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px;
  border: solid #1b1b20; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.pick-bar .icon.danger { color: #ff5a5f; }

/* The circles come out of the left edge, and the rows make room for them. */
.pick-mark {
  position: absolute; left: 10px; top: 50%; z-index: 1;
  width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  border: 1.5px solid var(--muted); background: transparent;
  display: grid; place-items: center;
  opacity: 0; transform: scale(0.65); pointer-events: none;
  transition: opacity 110ms ease, transform 130ms ease, background 90ms ease, border-color 90ms ease;
}
.messages .line { transition: padding-left 150ms ease; }
.messages.picking .line { padding-left: 42px; cursor: pointer; }
.messages.picking .line .pick-mark { opacity: 1; transform: scale(1); }
.messages.picking .line.picked .pick-mark { background: var(--petal); border-color: var(--petal); }
/* Picked rows wear the petal, edge to edge, as on the phone. */
.line.picked::before { background: var(--petal); opacity: 0.16; transform: scale(1); transition-duration: 120ms; }
.messages.picking .bubble, .messages.picking .bubble * { cursor: pointer; }
.messages.picking .words { user-select: none; }

.check-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; font-size: 14.5px; color: var(--text); cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: #ff5a5f; flex: none; }
.delete-note { font-size: 13px; margin: 10px 0 0; }
.sheet-row > .danger-button { margin: 0; }
.messages .line { -webkit-touch-callout: none; }

/* ── Groups and details ─────────────────────────────────────────────────── */
.who-open { cursor: pointer; }
.who.who-open { border-radius: 8px; }
.who.who-open:hover strong { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.sheet-title-row { display: flex; align-items: baseline; gap: 10px; }
.sheet-title-row strong { font-size: 19px; }
.small-count { font-size: 13px; }
.group-card { width: min(440px, 100%); }
.group-step { display: flex; flex-direction: column; min-height: 0; }
.group-card .search { margin: 10px 0 8px; width: 100%; }
.chosen-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chosen-chips:empty { display: none; }
.chip-person {
  padding: 4px 10px; border-radius: 14px; background: color-mix(in srgb, var(--petal) 22%, var(--raised2));
  color: var(--text); font-size: 12.5px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-person::after { content: ' \00d7'; opacity: 0.6; }
.pick-people { overflow-y: auto; min-height: 120px; }
.pick-people li { cursor: pointer; }
.pick-tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--muted);
  display: grid; place-items: center; margin-left: auto;
}
.pick-people li.chosen .pick-tick { background: var(--petal); border-color: var(--petal); }
.pick-people li.chosen .pick-tick::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px; border: solid #1b1b20; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.group-face-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.group-face {
  width: 56px; height: 56px; flex: none; padding: 0; border-radius: 50%;
  background: var(--raised2) center / cover no-repeat; color: var(--muted); display: grid; place-items: center;
}
.group-face.has-photo svg { display: none; }
.area {
  width: 100%; padding: 9px 12px; resize: vertical; min-height: 60px;
  background: var(--raised2); color: var(--text); border: 1px solid var(--line); border-radius: 14px; font: inherit;
}
.admins-list, .details-members { padding: 0; margin: 0; }
.admins-list { max-height: 220px; overflow-y: auto; }
.admin-row, .member-row { cursor: default; }
.role-chip {
  flex: none; margin-left: auto; padding: 4px 11px; border-radius: 14px; font-size: 12.5px; font-weight: 600;
  background: var(--raised2); color: var(--muted); border: 1px solid var(--line);
}
.role-chip.on { background: color-mix(in srgb, var(--petal) 26%, var(--raised2)); color: var(--text); border-color: transparent; }
span.role-chip { cursor: default; }
.error { color: #ff5a5f; font-size: 13px; margin: 10px 0 0; }
#group-next, #group-create { flex: 1 1 0; }
#group-next:disabled, #group-create:disabled { opacity: 0.45; cursor: default; }
.new-group-row .add-disc, .details-add .add-disc {
  display: grid; place-items: center; background: color-mix(in srgb, var(--petal) 24%, var(--raised2)); color: var(--text);
}
.new-group-row, .details-add { cursor: pointer; }

.details-card { width: min(460px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; padding: 12px 14px 16px; }
.details-top { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.details-body { overflow-y: auto; min-height: 0; padding: 0 4px; }
.details-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 14px; }
.details-face { width: 104px; height: 104px; font-size: 34px; }
.details-name { margin: 14px 0 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.details-under { margin-top: 5px; font-size: 13.5px; color: var(--muted); }
.details-under.online, .preview.online { color: var(--mint); }
.details-phone { margin-top: 9px; color: var(--text); text-decoration: none; font-size: 15px; }
.detail-actions { display: flex; justify-content: center; gap: 12px; padding: 0 0 8px; flex-wrap: wrap; }
.detail-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 72px;
  padding: 10px 8px; border-radius: 16px; background: var(--raised2); color: var(--text); font-size: 12.5px;
}
.detail-disc { display: grid; place-items: center; color: var(--petal); }
:root[data-mood="light"] .detail-disc { color: color-mix(in srgb, var(--amber) 80%, #000); }
.detail-action.mint .detail-disc { color: var(--mint); }
.details-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 6px 20px 0; }
.details-label { margin: 20px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); text-transform: uppercase; }
.details-rules { font-size: 14.5px; line-height: 1.5; }
.details-link { background: none; padding: 6px 0; color: var(--petal); font-size: 14px; font-weight: 600; }
:root[data-mood="light"] .details-link { color: color-mix(in srgb, var(--amber) 80%, #000); }
.details-link.danger { color: #ff5a5f; }
.details-members .top { gap: 8px; justify-content: flex-start; }
.role { font-size: 11.5px; font-weight: 600; }
.role.owner { color: var(--petal); }
:root[data-mood="light"] .role.owner { color: color-mix(in srgb, var(--amber) 80%, #000); }
.role.admin { color: var(--mint); }
.member-row { cursor: pointer; }
.member-act {
  flex: none; padding: 4px 9px; border-radius: 12px; font-size: 12px; background: var(--raised2); color: var(--text);
  opacity: 0; transition: opacity 120ms ease;
}
.member-row:hover .member-act, .member-act:focus-visible { opacity: 1; }
@media (hover: none) { .member-act { opacity: 1; } }
.member-act.danger { color: #ff5a5f; }
.details-leave {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 10px;
  border-radius: 14px; background: none; color: #ff5a5f; font-weight: 600;
}
.details-leave .detail-disc { color: #ff5a5f; }
.details-editor { width: 100%; margin-top: 14px; text-align: left; }
.editor-photos { display: flex; gap: 16px; margin-top: 6px; }
.member-row .chat-line { min-width: 0; flex: 1; }
.member-row .top strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.member-row .role { flex: none; }

/* After Google: the number, then the code. */
.google-phone { text-align: left; margin-top: 8px; }
.google-phone #gp-go { width: 100%; margin-top: 14px; }
#google-error { text-align: center; }

/* A message on its way: a small clock where the tick will be; one that could not go: a red mark. */
/*
 * Every mark — clock, one tick, two, the red one — sits in the same box, so going from one to the
 * next never moves the time beside it or changes the bubble's width.
 */
.bubble .tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 14px; flex: none; overflow: visible; vertical-align: -2px; line-height: 1;
}
.bubble .tick.clock { letter-spacing: 0; opacity: 0.75; }
.bubble .tick.failed { letter-spacing: 0; opacity: 1; cursor: pointer; }
.bubble .tick .fail-dot {
  display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  background: #ff5a5f; color: #fff; font-size: 10px; font-weight: 800;
}

/* Emoji, drawn as the app draws them: Microsoft's Fluent 3D pictures in place of the computer's own
   (see Emoji in app.js). As tall as the line's text, sitting on its baseline. */
img.emoji {
  width: 1.25em; height: 1.25em; margin: 0 0.04em; vertical-align: -0.28em;
  display: inline-block; object-fit: contain; user-select: text; -webkit-user-drag: none;
}

/* ── Emoji, stickers and GIFs ─────────────────────────────────────────────
   The same drawer as the attach row (it opens out of the composer the same way), holding a card
   of a fixed height: one pane at a time, the tabs along its foot. */
#picks.on { color: var(--petal); }
.pick-card {
  display: flex; flex-direction: column; height: min(340px, 46vh);
  margin: 0 10px 8px; border: 1px solid var(--line); border-radius: 24px; background: var(--raised);
  overflow: hidden;
}
.pick-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pick-pane[hidden] { display: none; }
.pick-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; scrollbar-width: thin; }
.emoji-kinds { display: flex; justify-content: space-between; padding: 6px 8px 2px; }
.emoji-kinds button {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 11px;
  background: none; cursor: pointer; opacity: 0.55; filter: grayscale(0.6);
}
.emoji-kinds button.on { opacity: 1; filter: none; background: color-mix(in srgb, var(--petal) 16%, transparent); }
.emoji-kinds img.emoji { width: 22px; height: 22px; margin: 0; vertical-align: 0; }
.pick-title { padding: 10px 6px 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.emoji-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.emoji-set button {
  aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 12px;
  background: none; cursor: pointer; font-size: 28px; line-height: 1; padding: 0;
}
.emoji-set button:hover { background: var(--raised2); }
.emoji-set img.emoji { width: 30px; height: 30px; margin: 0; vertical-align: 0; }
.emoji-tones {
  position: fixed; z-index: 40; display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--raised2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.emoji-tones button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-size: 26px; }
.emoji-tones button:hover { background: var(--raised); }
.emoji-tones img.emoji { width: 30px; height: 30px; margin: 0; vertical-align: 0; }
.sticker-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; }
.sticker-set button {
  aspect-ratio: 1; border: 0; border-radius: 16px; background: none; cursor: pointer; padding: 6px;
}
.sticker-set button:hover { background: var(--raised2); }
.sticker-set img { width: 100%; height: 100%; object-fit: contain; }
.sticker-credit, .gif-credit { padding: 8px 6px; color: var(--faint); font-size: 11px; text-align: center; }
#gif-search {
  margin: 8px 10px 4px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--raised2); color: var(--text); font: inherit; font-size: 14px;
}
#gif-search:focus { outline: none; border-color: color-mix(in srgb, var(--petal) 55%, var(--line)); }
.gif-grid { columns: 2 150px; column-gap: 6px; }
.gif-grid button {
  display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  background: var(--raised2); cursor: pointer; break-inside: avoid;
}
.gif-grid img { display: block; width: 100%; height: auto; }
.pick-empty { padding: 30px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.pick-tabs {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line);
}
.pick-tabs button:not(.icon) {
  padding: 6px 14px; border: 0; border-radius: 14px; background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.pick-tabs button.on { background: color-mix(in srgb, var(--petal) 16%, transparent); color: var(--petal); }
.pick-tabs .spacer { flex: 1; }
.pick-tabs .icon { color: var(--muted); }

/* One to three emoji and nothing else: large and without a bubble, as the app draws them. */
.bubble.big-emoji, .bubble.big-emoji.mine { background: none; padding: 0; box-shadow: none; }
.bubble.big-emoji .words { font-size: 42px; line-height: 1.2; }
.bubble.big-emoji.one .words { font-size: 64px; }
.bubble.big-emoji .words img.emoji { width: 1.2em; height: 1.2em; vertical-align: -0.2em; }
.bubble.big-emoji .foot {
  display: inline-flex; margin-top: 2px; padding: 2px 8px; border-radius: 10px;
  background: var(--raised2); color: var(--muted);
}
