/* Luna landing — her DM, dark. Phone full-bleed, desktop inside a device frame.
   Chat conventions (dark thread, blue outgoing bubble, round avatars) are shared across every
   messenger; brand-specific marks are not. Nothing here may be another company's logo, badge or
   brand gradient — see --ring-grad and the header, both of which used to be Instagram's. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
/* `textarea` used to be missing from this line. The composer IS a <textarea>, so it never
   inherited the white body colour and fell back to the UA default `fieldtext` - which resolves
   to BLACK on a document that declares no colour-scheme, whatever the phone's system theme is.
   Result: black text on the black composer, invisible while typing.
   Owner 2026-07-27: "я пишу чёрным по чёрному. И ничего не понятно, что я пишу." */
button, input, textarea, select, optgroup { font: inherit; color: inherit; }
/* Tells the UA every widget it draws itself (caret, autofill chrome, scrollbars, select popups,
   the iOS keyboard) is on a dark surface. Without it `fieldtext`/`canvastext` resolve light-mode
   even when the device is in dark mode - which is exactly how the black caret got in. */
html { color-scheme: dark; }
button { background: none; border: 0; cursor: pointer; }
/* must beat the display rules below — .screen is display:flex */
[hidden] { display: none !important; }
/* zero-specificity default, so the explicit rules further down still win */
:where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid #6db4ff; outline-offset: 2px; border-radius: 8px;
}
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

:root {
  --bubble-in: #262626;
  /* the outgoing blue. Nudged off Instagram Direct's exact #3797f0 — a blue outgoing bubble is
     a chat convention, that specific hex is their token. */
  --bubble-out: #2f8cf5;
  --line: #262626;
  --muted: #a8a8a8;
  --of: #00aff0;
  /* Her ring, not a borrowed one. The stops used to be Instagram's exact brand gradient; this is
     the page's own coral→magenta→violet run, tied to the indigo in the notification icon. */
  --ring-grad: linear-gradient(45deg, #ff9d5c, #ff4d7a 32%, #b046e8 66%, #6f6cd8);
  --vh: 100dvh;
}

/* ── ambient backdrop (desktop only) ─────────────────────────────────── */
#ambient {
  position: fixed; inset: -8%;
  background: #000 center/cover no-repeat;
  filter: blur(60px) saturate(1.3) brightness(.42);
  opacity: 0; transition: opacity 1.2s ease;
  z-index: 0; pointer-events: none;
  transform-origin: 50% 50%;
}
/* invisible on mobile — the phone is full-bleed and opaque over it */
@media (min-width: 760px) and (min-height: 640px) {
  #ambient { animation: ambientDrift 56s ease-in-out infinite alternate; will-change: transform; }
}
#ambient::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 85% at 50% 46%, transparent 38%, rgba(0,0,0,.5) 76%, rgba(0,0,0,.82) 100%),
    linear-gradient(180deg, rgba(255,150,80,.10), transparent 26%, transparent 72%, rgba(120,50,20,.22));
  pointer-events: none;
}
#ambient.on { opacity: 1; }
@keyframes ambientDrift {
  0%   { transform: scale(1)     translate3d(0,0,0); }
  50%  { transform: scale(1.055) translate3d(-1.4%, 1.1%, 0); }
  100% { transform: scale(1.02)  translate3d(1.1%, -0.9%, 0); }
}

/* ── stage / phone frame ─────────────────────────────────────────────── */
#stage {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
}
#phone {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 100%;
  background: #000;
  overflow: hidden;
  display: flex; flex-direction: column;
}
/* passthrough on mobile: full width/height, no chrome. The mockup starts at 760px. */
.device-screen {
  position: relative;
  width: 100%; height: 100%;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #000;
}
.dev-buttons, .statusbar, .device-island, .screen-glare, .home-indicator { display: none; }

@media (min-width: 760px) and (min-height: 640px) {
  #stage { padding: 28px 16px; }
  #phone {
    /* --u = 1 iOS point at the current scale; every hardware measurement is calc(N * var(--u)),
       so the whole mockup scales as one unit. 986.6 = 956pt screen + 2 × 15.3pt bezel. */
    --u: calc(min(986.6px, (100dvh - 56px)) / 986.6);
    width: auto;
    height: auto;
    min-width: 0;
    overflow: visible; /* side buttons protrude past the titanium edge */
    border-radius: calc(77.3 * var(--u));
    padding: calc(15.3 * var(--u));
    background:
      linear-gradient(152deg,
        #55565a 0%, #37383b 14%, #232326 34%, #1b1b1d 50%,
        #232326 66%, #37383b 84%, #55565a 100%);
    box-shadow:
      inset 0 1px 1px rgba(255,255,255,.30),
      inset 0 -1.5px 1.5px rgba(0,0,0,.65),
      inset 1.5px 0 1.5px rgba(255,255,255,.06),
      inset -1.5px 0 1.5px rgba(0,0,0,.45),
      0 0 0 1px rgba(0,0,0,.9),
      0 2px 6px rgba(0,0,0,.5),
      0 40px 120px rgba(0,0,0,.85),
      0 14px 40px rgba(0,0,0,.6);
  }
  .device-screen {
    /* the ratio lives on the screen, not on the padded corpus */
    width: calc(440 * var(--u));
    height: calc(956 * var(--u));
    flex: none;
    border-radius: calc(62 * var(--u));
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,.05),
      inset 0 0 14px rgba(0,0,0,.55);
    padding-top: calc(62 * var(--u));    /* status bar + Dynamic Island */
    padding-bottom: calc(34 * var(--u)); /* home indicator safe area */
  }
  .screen-glare {
    display: block;
    position: absolute; inset: 0; z-index: 30; pointer-events: none;
    background: linear-gradient(118deg,
      rgba(255,255,255,.05) 0%, rgba(255,255,255,0) 16%,
      rgba(255,255,255,0) 58%, rgba(255,255,255,.035) 78%, rgba(255,255,255,0) 100%);
  }
  .home-indicator {
    display: block; position: absolute; left: 50%; bottom: calc(8 * var(--u));
    transform: translateX(-50%);
    width: calc(134 * var(--u)); height: calc(5 * var(--u));
    border-radius: 999px; background: rgba(255,255,255,.92);
    z-index: 25; pointer-events: none;
  }

  .dev-buttons { display: block; }
  .dev-btn {
    position: absolute; border-radius: calc(3 * var(--u));
    background: linear-gradient(90deg, #2c2c2e 0%, #4c4c4f 45%, #2c2c2e 100%);
    box-shadow: 0 0 0 .5px rgba(0,0,0,.7), inset 0 0 1px rgba(255,255,255,.3);
  }
  .dev-btn.left { left: calc(-3 * var(--u)); width: calc(3 * var(--u)); }
  .dev-btn.right { right: calc(-3 * var(--u)); width: calc(3 * var(--u)); }
  .dev-action   { top: 14%; height: calc(24 * var(--u)); border-radius: calc(2 * var(--u)); }
  .dev-vol-up   { top: 23.5%; height: calc(46 * var(--u)); }
  .dev-vol-down { top: 33%; height: calc(46 * var(--u)); }
  .dev-power    { top: 19%; height: calc(62 * var(--u)); }
  .dev-camera {
    top: 58%; height: calc(58 * var(--u)); border-radius: calc(4 * var(--u));
    background: linear-gradient(90deg, #141416 0%, #2a2a2c 45%, #141416 100%);
    box-shadow: 0 0 0 .5px rgba(0,0,0,.7), inset 0 0 2px rgba(0,0,0,.85), inset 0 0 1px rgba(255,255,255,.08);
  }

  /* status bar: 3 columns, the middle one exactly as wide as the island, so overlap is
     impossible by construction */
  .statusbar {
    display: grid; grid-template-columns: 1fr calc(126 * var(--u)) 1fr;
    position: absolute; top: 0; left: 0; right: 0; height: calc(62 * var(--u));
    align-items: center; padding: 0 calc(24 * var(--u)); z-index: 15; pointer-events: none;
    color: #fff; font-weight: 600; font-size: calc(15 * var(--u)); letter-spacing: -.2px;
    font-variant-numeric: tabular-nums;
  }
  .sb-time { grid-column: 1; justify-self: center; }
  .sb-icons { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: calc(5 * var(--u)); }
  .sb-icons svg { display: block; }
  .sb-icons svg:nth-child(1) { width: calc(17 * var(--u)); height: calc(11 * var(--u)); }
  .sb-icons svg:nth-child(2) { width: calc(16 * var(--u)); height: calc(12 * var(--u)); }
  .sb-icons svg:nth-child(3) { width: calc(25 * var(--u)); height: calc(12 * var(--u)); }

  .device-island {
    display: flex; position: absolute; top: calc(11 * var(--u)); left: 50%; transform: translateX(-50%);
    width: calc(126 * var(--u)); height: calc(37 * var(--u)); border-radius: 999px; background: #000;
    z-index: 20; align-items: center; justify-content: flex-end; padding-right: calc(11 * var(--u));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 1px 3px rgba(0,0,0,.7);
  }
  .island-cam {
    width: calc(9 * var(--u)); height: calc(9 * var(--u)); border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #3c3c3e 0%, #050505 72%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  }
}

/* the screens stack in their own box; the link bar sits above them */
#screens { position: relative; flex: 1 1 auto; min-height: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ── permanent link bar ─────────────────────────────────────────────── */
#linkbar {
  flex: 0 0 auto; position: relative; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
  padding: 9px 13px calc(9px + 1px);
  padding-top: calc(9px + env(safe-area-inset-top));
  text-decoration: none; color: inherit;
  background: linear-gradient(180deg, #151515, #0b0b0b);
  transition: background .15s ease, box-shadow .3s ease, opacity .3s ease;
  animation: lbBreathe 6s ease-in-out infinite;
}
#linkbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--ring-grad); opacity: .55;
}
#linkbar:hover { background: linear-gradient(180deg, #1a1a1a, #0f0f0f); }
#linkbar:active { background: linear-gradient(180deg, #1d1d1d, #121212); animation-play-state: paused; }
#linkbar:focus-visible {
  outline: 2px solid #6db4ff; outline-offset: -2px;
  border-radius: 6px;
}
@keyframes lbBreathe {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(214,41,118,0); }
  50%      { box-shadow: inset 0 -18px 22px -20px rgba(214,41,118,.35); }
}
.lb-ic {
  width: 27px; height: 27px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; background: var(--ring-grad);
}
.lb-tx { flex: 1 1 auto; min-width: 0; }
.lb-t { display: block; font-size: 13px; font-weight: 600; letter-spacing: -.1px; }
.lb-s {
  display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-go {
  flex: 0 0 auto; font-size: 12.5px; font-weight: 600; color: #fff;
  background: var(--bubble-out); border-radius: 999px; padding: 7px 16px;
  transition: filter .12s ease, transform .12s ease;
}
#linkbar:hover .lb-go { filter: brightness(1.08); }
#linkbar:active .lb-go { filter: brightness(.9); transform: scale(.96); }
@media (min-width: 760px) and (min-height: 640px) {
  #linkbar { padding: 13px 18px 10px; }
}
/* muted, never disabled, while the notification is up */
#linkbar.dim, #head.dim { opacity: .4; }
#linkbar, #head { transition: opacity .3s ease; }

/* ── notification banner ─────────────────────────────────────────────
   iOS banner anatomy: blurred rounded card, app icon, tiny app line, bold title, one line of
   body, contact photo on the right. Anchored to .device-screen so the same rule works
   full-bleed and inside the framed mockup. */
/* Anchored INSIDE the screen, never against the corpus. On a real phone that means under the
   notch/island via the safe-area inset; inside the desktop mockup the same job is done by the
   device metrics below, because env() is 0 in a desktop browser and 8px from the top of a
   62pt status band puts the card straight through the Dynamic Island and into the 62pt corner
   radius, where overflow:hidden shears its top corners off. */
.toast {
  position: absolute; left: 8px; right: 8px;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 50;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  /* Opaque enough that the header underneath cannot be read through the card. At .72 the chat
     title bled through and the visitor saw "chrysiluna" twice — once as the banner title, once as
     a ghost of the header behind it. */
  background: rgba(38,38,43,.975);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 10px 26px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.08);
  text-decoration: none; color: #fff;
  transform: translateY(-130%);
  opacity: 0;
  /* an iOS banner has a little spring in it; 2% of overshoot is life, 10% is a bounce */
  transition: transform .5s cubic-bezier(.22,1.02,.36,1), opacity .28s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast-ic {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto; overflow: hidden;
  background: #1a1a1a;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 2px 6px rgba(0,0,0,.35);
}
.toast-av { display: block; width: 100%; height: 100%; object-fit: cover; }
.toast-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.toast-app {
  font-size: 10.5px; font-weight: 600; letter-spacing: .2px; color: #c9c9c9;
  text-transform: uppercase; margin-bottom: 2px;
}
.toast-app b { font-weight: 600; opacity: .7; margin: 0 1px; }
.toast-title { font-size: 13.5px; font-weight: 700; letter-spacing: -.1px; }
.toast-body {
  font-size: 13px; color: #e6e6e6; margin-top: 1px; line-height: 1.32;
  /* balance the wrap instead of dropping one orphan word onto its own line */
  text-wrap: pretty;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 760px) and (min-height: 640px) {
  /* 62pt = the status band the screen already reserves; the island ends at 48pt. Clearing the
     band also clears the 62pt corner radius, so the card lands whole and square-cornered. */
  .toast {
    left: calc(12 * var(--u)); right: calc(12 * var(--u));
    top: calc(66 * var(--u));
    border-radius: calc(19 * var(--u));
  }
}

/* ── waiting gate ────────────────────────────────────────────────────── */
#gateWait { justify-content: center; align-items: center; }
.w-inner { text-align: center; animation: rise .45s ease both; }
.ringwrap { position: relative; width: 132px; height: 132px; margin: 0 auto 22px; }
.ringwrap::before {
  content: ""; position: absolute; inset: -16px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(214,41,118,.22), rgba(150,47,191,.10) 55%, transparent 76%);
  filter: blur(10px);
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #1c1c1c; stroke-width: 3.5; }
.ring-fg {
  fill: none; stroke: url(#ringGrad); stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 345.6; stroke-dashoffset: 0;
  transition: stroke-dashoffset .3s cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 0 6px rgba(214,41,118,.35));
}
.wait-avatar {
  position: absolute; inset: 9px; width: calc(100% - 18px); height: calc(100% - 18px);
  border-radius: 50%; object-fit: cover; background: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
}
.w-name { font-weight: 600; font-size: 17px; letter-spacing: -.2px; }
.w-status { color: var(--muted); font-size: 13.5px; margin-top: 5px; min-height: 18px; transition: color .3s ease; }
.w-status.online { color: #4fd35c; }
.w-count { margin-top: 26px; font-size: 40px; font-weight: 300; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.w-count span { display: block; font-size: 10.5px; letter-spacing: 2.6px; color: #8a8a8a; text-transform: uppercase; margin-top: 5px; }

/* ── chat ────────────────────────────────────────────────────────────── */
#head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.82); backdrop-filter: blur(14px);
}
.ico { color: #fff; display: grid; place-items: center; padding: 2px; }
.h-av { position: relative; width: 34px; height: 34px; flex: 0 0 auto; }
.h-ring { position: absolute; inset: -2.5px; border-radius: 50%; background: var(--ring-grad); }
.h-av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #000; background: #1a1a1a; }
/* presence is a dot on the avatar, not a tinted status label */
.h-av::after {
  content: ""; display: none; position: absolute; right: -1px; bottom: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #4fd35c; border: 2px solid #000;
}
#head:has(#headStatus.on) .h-av::after { display: block; }
.h-txt { flex: 1 1 auto; min-width: 0; }
.h-name { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 15px; }
.h-status { font-size: 11.5px; color: var(--muted); }
.h-status.on { color: var(--muted); }
.h-actions { flex: 0 0 auto; display: flex; align-items: center; }
.hact {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; border-radius: 50%;
  transition: background .12s ease, transform .12s ease;
}
.hact svg { display: block; }
.hact:hover { background: #1c1c1c; }
.hact:active { transform: scale(.9); background: #242424; }

/* ── call / video: the two controls we actually want tapped ──────────────
   The header icons used to be flat white on black and read as chrome. They are the entry to the
   one-ring scene, so they get a live accent: the glyph itself is tinted, a soft halo breathes
   behind it, and a small dot sits on the shoulder of the audio button the way an unread mark
   does. All of it is decoration on top of the existing 44px hit target - nothing moves, nothing
   grows, and the whole thing goes still under prefers-reduced-motion. */
.hact.bait { color: var(--bubble-out); }
.hact.bait::before {
  content: ""; position: absolute; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle, rgba(47,140,245,.34) 0%, rgba(47,140,245,0) 70%);
  opacity: 0; animation: hactBreathe 2.9s ease-in-out infinite;
  pointer-events: none;
}
.hact { position: relative; }
#btnVideo.bait::before { animation-delay: .95s; }
.hact.bait::after {
  content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: #ff4d6a; border: 1.5px solid #000;
  animation: hactDot 2.9s ease-in-out infinite;
}
#btnVideo.bait::after { display: none; }
.hact.bait:hover::before, .hact.bait:focus-visible::before { opacity: .95; animation: none; }
@keyframes hactBreathe {
  0%, 100% { opacity: 0; transform: scale(.82); }
  45%      { opacity: 1; transform: scale(1.06); }
  70%      { opacity: .25; transform: scale(1); }
}
@keyframes hactDot {
  0%, 100% { transform: scale(1); opacity: .9; }
  45%      { transform: scale(1.22); opacity: 1; }
}

#thread {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* the bottom pad is deeper than the entrance offset on purpose — the newest bubble starts
     11px low, and with a 6px pad its first frames were shaved off by the scroll edge */
  padding: 14px 12px 14px;
  display: flex; flex-direction: column; gap: 0;
  scrollbar-width: thin; scrollbar-color: #2e2e2e transparent;
}
/* short conversations sit at the bottom, against the composer. margin-top:auto on the first
   child rather than justify-content:flex-end, which clips the top once the thread overflows. */
#thread > *:first-child { margin-top: auto; }
#thread::-webkit-scrollbar { width: 5px; }
#thread::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 3px; }

.day { align-self: center; color: #6b6b6b; font-size: 11px; margin: 10px 0 14px; }

/* a change of sender reads as a new turn (8px); consecutive bubbles as one breath (2px) */
/* The entrance is a lift and a fade on a curve that decelerates and stops — no overshoot, no
   spring. A bubble that bounces past its resting place is the single cheapest-looking thing a
   chat can do, and the outgoing (blue) one is the message the visitor is watching most closely. */
.row {
  display: flex; align-items: flex-end; gap: 7px; max-width: 100%;
  margin-top: 8px;
  animation: msgIn .38s cubic-bezier(.215,.61,.355,1) both;
}
.row.me { justify-content: flex-end; }
.row.me .bub { transform-origin: 100% 100%; }
.row:not(.me) .bub { transform-origin: 0 100%; }
.row.tight { margin-top: 2px; }
.row .av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #1a1a1a; }
.row .av.ghost { visibility: hidden; }

.bub {
  max-width: 74%; padding: 9px 13px; border-radius: 19px;
  background: var(--bubble-in); white-space: pre-wrap; word-break: break-word;
  font-size: 14.5px; line-height: 1.42; letter-spacing: -.1px;
}
.row.me .bub { background: var(--bubble-out); }
/* Her line is written, not pasted. The bubble is already at its final size — only the words
   inside fade up, on a stagger the script caps well under a second. Nothing reflows. */
.bub .wd { display: inline-block; animation: wordIn .28s cubic-bezier(.215,.61,.355,1) both; }
/* both sides of a seam are softened, so a group reads as one continued shape */
.row.tight:not(.me) .bub { border-top-left-radius: 7px; }
.row:not(.me):has(+ .row.tight) .bub { border-bottom-left-radius: 7px; }

.row.me + .row.me { margin-top: 2px; }
.row.me + .row.me .bub { border-top-right-radius: 7px; }
.row.me:has(+ .row.me) .bub { border-bottom-right-radius: 7px; }

/* transcript of a voice message the visitor sent */
.heard {
  align-self: flex-end; max-width: 74%;
  margin: 4px 2px 0; padding: 0 6px;
  font-size: 11px; line-height: 1.35; color: #8f8f8f; text-align: right;
  animation: pop .25s ease both;
}

/* media bubbles */
.media { max-width: 63%; border-radius: 18px; overflow: hidden; position: relative; background: #141414; line-height: 0; }
.media img.ph, .media video { width: 100%; height: auto; display: block; }
.media img.lq { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px); transform: scale(1.06); }
.media img.ph { position: relative; opacity: 0; transition: opacity .45s ease; }
.media img.ph.in { opacity: 1; }
.media .vplay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.18);
}
.media .vplay i {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
}
.media .vplay i::after { content: ""; border-left: 15px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 4px; }
.media.playing .vplay { display: none; }

/* outgoing photo, with the same in-progress state media from her uses */
.media.out { max-width: 58%; }
.sendspin {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.38); opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.media.sending .sendspin { opacity: 1; }
.sendspin i {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.28); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.media.failed { box-shadow: inset 0 0 0 1.5px #a03a3a; }
.media.failed .sendspin { opacity: 1; background: rgba(50,0,0,.42); }
.media.failed .sendspin i { animation: none; border-color: #ff7a7a; border-top-color: #ff7a7a; }
@keyframes spin { to { transform: rotate(360deg); } }

/* voice bubble */
.voice { display: flex; align-items: center; gap: 10px; padding: 9px 13px 9px 10px; border-radius: 20px; background: var(--bubble-in); max-width: 78%; }
.voice .pb { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.voice .pb::after { content: ""; border-left: 10px solid #262626; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }
.voice.on .pb::after { border: 0; width: 9px; height: 11px; margin: 0; background: linear-gradient(90deg,#262626 0 3px, transparent 3px 6px, #262626 6px 9px); }
.voice .wave { flex: 1 1 auto; display: flex; align-items: center; gap: 2px; height: 26px; }
.voice .wave b { flex: 1 1 auto; min-width: 1.5px; border-radius: 2px; background: #5b5b5b; transition: background .1s linear; }
.voice .wave b.p { background: #fff; }
.voice .dur { font-size: 11.5px; color: #b7b7b7; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.voice .new { width: 7px; height: 7px; border-radius: 50%; background: var(--bubble-out); flex: 0 0 auto; }

.voice.out { background: var(--bubble-out); min-width: 190px; }
.voice.out .pb::after { border-left-color: #2073bd; }
.voice.out.on .pb::after { background: linear-gradient(90deg,#2073bd 0 3px, transparent 3px 6px, #2073bd 6px 9px); }
.voice.out .wave b { background: rgba(255,255,255,.45); }
.voice.out .wave b.p { background: #fff; }
.voice.out .dur { color: #e8f3ff; }
.voice.sending { opacity: .62; }
.voice.failed { box-shadow: inset 0 0 0 1.5px #a03a3a; }

/* indicators — Direct shows one three-dot bubble, never a label */
.ind { display: flex; align-items: center; gap: 7px; padding: 2px 0 4px; margin-top: 8px; animation: pop .25s ease both; }
.ind .av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: #1a1a1a; }
.ind .box { background: var(--bubble-in); border-radius: 19px; padding: 11px 14px; display: flex; align-items: center; gap: 5px; }
.ind .box em { width: 6px; height: 6px; border-radius: 50%; background: #8b8b8b; animation: dot 1.25s infinite ease-in-out; }
.ind .box em:nth-child(2) { animation-delay: .18s; }
.ind .box em:nth-child(3) { animation-delay: .36s; }
.ind .lbl { display: none; }
.ind .mic { display: flex; align-items: center; gap: 5px; height: auto; }
.ind .mic b {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8b8b8b; animation: dot 1.25s infinite ease-in-out;
}
.ind .mic b:nth-child(2) { animation-delay: .18s; }
.ind .mic b:nth-child(3) { animation-delay: .36s; }
.ind .mic b:nth-child(4), .ind .mic b:nth-child(5) { display: none; }

/* link card — no price, no timer */
.cta {
  max-width: 80%; border-radius: 18px; overflow: hidden; background: #1c1c1c;
  border: 1px solid #303030; animation: msgIn .42s cubic-bezier(.215,.61,.355,1) both;
}
.cta a { display: flex; align-items: center; gap: 11px; padding: 13px 14px; text-decoration: none; color: inherit; }
.cta .ic { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(140deg,#00aff0,#0080c0); display: grid; place-items: center; flex: 0 0 auto; font-weight: 700; font-size: 17px; }
.cta .tx { flex: 1 1 auto; min-width: 0; }
.cta .t { font-weight: 600; font-size: 14px; }
.cta .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cta .h { font-size: 11px; color: #6e6e6e; margin-top: 3px; }
.cta .ch { color: #6e6e6e; flex: 0 0 auto; }

/* ── composer ────────────────────────────────────────────────────────── */
#composer { flex: 0 0 auto; padding: 5px 10px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #000; }
.c-row { display: flex; align-items: center; gap: 6px; }
#composer.recording .c-row:not(.rec) { display: none; }
.c-cam {
  position: relative; flex: 0 0 auto; width: 44px; height: 44px;
  display: grid; place-items: center;
}
.c-cam::before {
  content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bubble-out); transition: filter .12s ease, transform .12s ease;
}
.c-cam svg { position: relative; }
.c-cam:hover::before { filter: brightness(1.08); }
.c-cam:active::before { transform: scale(.92); }
.c-wrap {
  /* flex-end, not center: once the draft wraps to a second line the icons have to stay pinned to
     the bottom of the pill the way they do in any messenger, instead of drifting to its middle */
  flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; gap: 0;
  border: 1px solid #363636; border-radius: 22px; padding: 0 4px 0 16px; min-height: 44px;
}
#input {
  flex: 1 1 auto; background: none; border: 0; outline: none; font-size: 15px; min-width: 0;
  /* explicit, not inherited: this is the field the owner types into and it must never be able to
     pick a colour up from the UA again. -webkit-text-fill-color also beats iOS/Chrome autofill,
     which overrides `color` but not this. */
  color: #fff; -webkit-text-fill-color: #fff; caret-color: #fff;
  /* the field is a textarea so Shift+Enter can insert a line break; the script sets the height
     from the content and this caps it at roughly four lines before it starts scrolling */
  font-family: inherit; line-height: 1.35; resize: none; overflow-y: auto;
  height: 42px; min-height: 42px; max-height: 106px; padding: 11px 0 10px;
  scrollbar-width: thin; scrollbar-color: #3a3a3a transparent;
}
#input::-webkit-scrollbar { width: 4px; }
#input::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 2px; }
#input::placeholder { color: #9a9a9a; -webkit-text-fill-color: #9a9a9a; opacity: 1; }
/* Autofill repaints the field with its own light background and dark text. Every visible field
   is pinned back to the dark surface; the 9999s transition is the standard way to stop the UA
   background from ever painting. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, textarea:-webkit-autofill:hover, textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px #1c1c1c inset;
  transition: background-color 9999s ease-out 0s;
}
/* Focus lives on the PILL, not on the textarea. The old ring was an outline drawn on the field
   itself with outline-offset:-4px, i.e. inset — it ran straight through the word "Message…" and
   through the first line of a draft. A messenger marks the whole composer instead: the pill's own
   1px border lights up and gains one crisp ring outside it, so nothing is ever drawn over text. */
#input:focus, #input:focus-visible { outline: none; }
.c-wrap:focus-within {
  border-color: var(--bubble-out);
  box-shadow: 0 0 0 1px var(--bubble-out);
}
/* Send replaces the mic/gallery pair only once there is text — :placeholder-shown is true
   exactly while the field is empty, so no JS is involved */
#send { display: none; color: var(--bubble-out); font-weight: 600; font-size: 14px; padding: 0 10px; min-height: 44px; align-items: center; opacity: .45; transition: opacity .15s; }
#send.live { opacity: 1; }
#input:not(:placeholder-shown) ~ #send { display: inline-flex; }
.c-ic { flex: 0 0 auto; display: flex; align-items: center; }
#input:not(:placeholder-shown) ~ .c-ic { display: none; }
.c-b {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; border-radius: 50%;
  transition: background .12s ease, transform .12s ease;
}
.c-b svg { display: block; }
.c-b:hover { background: #1c1c1c; }
.c-b:active { transform: scale(.9); }
.c-b.on { background: #232323; }
.c-b[aria-pressed="true"] { color: #ff5a5a; }
.c-legal { text-align: center; font-size: 9.5px; color: #7a7a7a; letter-spacing: .3px; margin-top: 5px; }

/* voice recorder */
.c-row.rec { display: flex; }
.rec-x, .rec-go {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  transition: background .12s ease, transform .12s ease;
}
.rec-x { color: #ff5a5a; }
.rec-x:hover { background: #241616; }
.rec-go { color: #fff; background: var(--bubble-out); }
.rec-go:hover { filter: brightness(1.08); }
.rec-go:active, .rec-x:active { transform: scale(.9); }
.rec-wrap {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 9px;
  min-height: 44px; border-radius: 999px; background: #1c1c1c; padding: 0 14px;
}
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; flex: 0 0 auto; animation: recPulse 1.1s infinite ease-in-out; }
.rec-time { font-size: 12.5px; color: #dcdcdc; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.rec-wave { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 2px; height: 24px; overflow: hidden; }
.rec-wave b { flex: 1 1 auto; min-width: 2px; height: 4px; border-radius: 2px; background: #7a7a7a; transition: height .08s linear; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ── emoji keyboard ──────────────────────────────────────────────────── */
.emoji {
  flex: 0 0 auto; display: flex; flex-direction: column;
  height: clamp(196px, 46%, 316px);
  background: #0c0c0c; border-top: 1px solid var(--line);
}
.emoji-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 6px 4px 10px; }
.emoji-grab { display: none; }
.emoji-search {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: #1c1c1c; border-radius: 12px; padding: 0 11px; min-height: 36px; color: #7e7e7e;
}
#emojiSearch {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; outline: none;
  color: #fff; -webkit-text-fill-color: #fff; caret-color: #fff; font-size: 14px; min-height: 36px;
}
#emojiSearch::placeholder { color: #9a9a9a; -webkit-text-fill-color: #9a9a9a; opacity: 1; }
.emoji-search:focus-within { box-shadow: 0 0 0 2px var(--bubble-out) inset; }
.emoji-x { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; color: #9a9a9a; border-radius: 50%; }
.emoji-x:hover { background: #1c1c1c; color: #fff; }
.emoji-grid {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  grid-auto-rows: 44px; align-content: start; gap: 1px;
  padding: 2px 8px 8px;
  scrollbar-width: thin; scrollbar-color: #2e2e2e transparent;
}
.emoji-grid::-webkit-scrollbar { width: 5px; }
.emoji-grid::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 3px; }
.emo {
  display: grid; place-items: center; height: 44px; border-radius: 10px;
  font-size: 26px; line-height: 1; padding: 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.emo:hover { background: #1e1e1e; }
.emo:focus-visible { outline: 2px solid #6db4ff; outline-offset: -2px; }
.emo-none { grid-column: 1 / -1; color: #6e6e6e; font-size: 13px; padding: 14px 4px; }
.emoji-tabs {
  flex: 0 0 auto; display: flex; gap: 1px; padding: 3px 6px;
  border-top: 1px solid #1b1b1b; overflow-x: auto; scrollbar-width: none;
}
.emoji-tabs::-webkit-scrollbar { display: none; }
/* 44px minimum in BOTH axes — ten categories at that size no longer fit a 393px phone, which
   is what the strip's own horizontal scroll is for; the active one is scrolled into view. */
.etab {
  flex: 1 0 auto; min-width: 44px; height: 44px; border-radius: 10px;
  font-size: 19px; line-height: 1; opacity: .5;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: opacity .12s ease, background .12s ease;
}
.etab:hover { opacity: .8; }
.etab.on { opacity: 1; background: #232323; }

/* ── call ────────────────────────────────────────────────────────────── */
.call {
  position: absolute; inset: 0; z-index: 12;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(46px + env(safe-area-inset-top)) 20px calc(26px + env(safe-area-inset-bottom));
  background: #0a0a0c; color: #fff;
  opacity: 0; transition: opacity .26s ease;
}
.call.in { opacity: 1; }
.call-bg { position: absolute; inset: 0; overflow: hidden; }
.call-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25); filter: blur(26px) brightness(.36) saturate(1.15); }
.call-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.5), rgba(0,0,0,.15) 42%, rgba(0,0,0,.78));
}
.call.video .call-bg img { filter: blur(9px) brightness(.5) saturate(1.15); }
.call-self {
  display: none; position: absolute; right: 14px; top: calc(52px + env(safe-area-inset-top));
  width: 84px; height: 118px; border-radius: 14px; place-items: center;
  background: #131315; box-shadow: 0 8px 22px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.06);
  z-index: 2;
}
.call.video .call-self { display: grid; }
.call-top { position: relative; text-align: center; margin-top: 8px; }
.call-av {
  width: 104px; height: 104px; border-radius: 50%; object-fit: cover; background: #1a1a1a;
  box-shadow: 0 12px 34px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  animation: callPulse 2.4s ease-in-out infinite;
}
.call-name { font-size: 27px; font-weight: 600; letter-spacing: -.5px; margin-top: 17px; }
.call-state { font-size: 14.5px; color: rgba(255,255,255,.72); margin-top: 6px; }
.call-timer { font-size: 12.5px; color: rgba(255,255,255,.45); margin-top: 3px; font-variant-numeric: tabular-nums; }
.call-ctl { position: relative; display: flex; gap: 22px; }
.cc { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 60px; color: #fff; }
.cc svg {
  width: 22px; height: 22px; padding: 15px; box-sizing: content-box;
  border-radius: 50%; background: rgba(255,255,255,.15);
  transition: background .14s ease, color .14s ease;
}
.cc span { font-size: 11px; color: rgba(255,255,255,.62); }
.cc:hover svg { background: rgba(255,255,255,.22); }
.cc.on svg { background: #fff; color: #111; }
.cc[disabled] { opacity: .38; cursor: default; }
.spk-off { display: none; }
.cc.off .spk-on { display: none; }
.cc.off .spk-off { display: block; }
.call-actions { position: relative; }
.call-end {
  width: 70px; height: 70px; border-radius: 50%; background: #ff3b30; color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(255,59,48,.32);
  transition: transform .12s ease, filter .12s ease;
}
.call-end:hover { filter: brightness(1.07); }
.call-end:active { transform: scale(.93); }
.call.over .call-av { animation: none; opacity: .75; }
.call.over .call-end { opacity: .5; pointer-events: none; }
@keyframes callPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes pop { from { opacity: 0; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translate3d(0, 11px, 0); } to { opacity: 1; transform: none; } }
@keyframes wordIn { from { opacity: 0; transform: translate3d(0, 2px, 0); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dot { 0%,60%,100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  /* animation-duration:.01ms does not disable an animation, it freezes it on a random frame —
     the backdrop landed crooked and the bar glow stuck on. Off means off. */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  /* the call/video accent is built out of an animated halo; with animation off it would sit at
     its 0% keyframe (invisible). Pin it on instead, so the accent still reads without motion. */
  .hact.bait::before { opacity: .6 !important; transform: scale(1) !important; }
}
