/* Support chat inside the iframe. Brand colours come from <BASE>/theme.css (loaded after this
   file); the values below are only fallbacks. CSP: no inline styles anywhere.
   WebKit notes kept here: flex: 1 1 auto (not flex: 1), inputs >= 16px, overflow-x hidden→clip,
   animate inner wrappers (never a top-layer element), one vendor pseudo per rule. */

@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/geologica-cyrillic-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/geologica-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/geologica-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/geologica-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens (fallbacks) */
:root {
  --accent: #0552f8;
  --accent-2: #0442c8;
  --accent-3: #82a8fb;
  --bg: #f1f5fe;
  --bg-2: #f7fafe;
  --text: #000;
  --muted: #a2a2a2;
  --surface: #fff;
  --border: #dde6fc;
  --soft: #eaf0fe;
  --soft-line: #d6e2fd;
  --header: #0552f8;
  --on-accent: #fff;
  --font: 'Geologica', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* derived, not brand: */
  --ink-2: #6b7280;                 /* small text that must stay readable */
  --danger: #d93036;
  --shadow: 0 10px 28px -20px rgba(11, 21, 51, 0.35);
  --pop-shadow: 0 18px 44px -18px rgba(11, 21, 51, 0.42);
  --fill: var(--accent);            /* visitor bubble, send button */
  --fill-hover: var(--accent-2);
  --radius: 16px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --accent: #82a8fb;
  --accent-2: #0552f8;
  --accent-3: #82a8fb;
  --bg: #000;
  --bg-2: #07080d;
  --text: #fff;
  --muted: #a2a2a2;
  --surface: #0e1530;
  --border: #1e2950;
  --soft: #16204a;
  --soft-line: #1e2950;
  --header: #0552f8;
  --on-accent: #fff;
  --ink-2: #a3acc2;
  --danger: #ff6b6b;
  --shadow: none;
  --pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.8);
  /* the light accent of the dark theme is too pale under white text */
  --fill: var(--accent-2);
  --fill-hover: var(--accent-2);
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

img {
  max-width: 100%;
}

p,
h2 {
  margin: 0;
}

.sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Safari < 15.4 has no :focus-visible: keep a plain :focus ring there */
:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@supports selector(:focus-visible) {
  :focus {
    outline: none;
  }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

/* ---------------------------------------------------------------- app shell */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

@supports (height: 100dvh) {
  .app {
    height: 100dvh;
  }
}

/* phones: the height of the visible viewport (above the on-screen keyboard), set from JS */
.vvh .app {
  height: var(--vvh);
}

/* no transitions until the page has loaded (else WebKit animates from UA defaults) */
.preload *,
.preload *::before,
.preload *::after {
  transition: none !important;
}

/* in the iframe: hidden until the host said hello (theme), at most ~1 s */
.pre .app {
  visibility: hidden;
}

/* opened directly (no host page): the page is the brand blue, the chat is a card */
.is-standalone,
.is-standalone body {
  background: var(--header);
}

.page-pat {
  display: none;
}

.is-standalone .page-pat {
  position: fixed;
  inset: 0;
  display: block;
  background-repeat: repeat;
  background-size: 450px auto;
  pointer-events: none;
}

@media (min-width: 520px) and (min-height: 560px) {
  .is-standalone .app {
    position: absolute;
    inset: 0;
    width: min(420px, calc(100% - 32px));
    height: min(720px, calc(100% - 48px));
    margin: auto;
    border-radius: 18px;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 18, 0.6);
  }
}

/* ---------------------------------------------------------------- header */
.hdr {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'title actions' 'status status';
  align-items: center;
  column-gap: 10px;
  padding: 12px 10px 14px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  background: var(--header);
  color: var(--on-accent);
}

.hdr__pat {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-repeat: repeat;
  background-size: 360px auto;
  opacity: 0.85;             /* the tile itself is ~13 % white */
  pointer-events: none;
  animation: hdr-drift 120s linear infinite;
}

@keyframes hdr-drift {
  from { background-position: 0 0; }
  to { background-position: 360px 0; }
}

.hdr__title {
  position: relative;
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.hdr__logo {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: 20px;
}

.hdr__name {
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hdr--wordmark .hdr__logo {
  height: 22px;
}

.hdr__status {
  position: relative;
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.3;
  font-weight: 450;
  color: rgba(255, 255, 255, 0.88);
}

.hdr__status > span:last-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hdr__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ef2a8;
  box-shadow: 0 0 0 3px rgba(110, 242, 168, 0.22);
}

.hdr__actions {
  position: relative;
  grid-area: actions;
  display: flex;
  gap: 2px;
}

.ibtn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ibtn:hover,
.ibtn[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.16);
}

.ibtn:focus,
.ibtn:focus-visible {
  outline-color: #fff;
  outline-offset: -2px;
}

/* menu */
.menu {
  position: absolute;
  top: calc(100% - 8px);
  right: 10px;
  z-index: 6;
  min-width: 232px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--pop-shadow);
  animation: pop-in 0.14s ease-out;
  transform-origin: top right;
}

.mi {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.mi:hover,
.mi:focus-visible {
  background: var(--soft);
  outline: none;
}

.tile {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--accent);
}

.tile--sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

/* connection banner */
.net {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  font-size: 13px;
}

/* ---------------------------------------------------------------- body + log */
.body {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 14px 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  overflow-y: auto;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* conversation sits at the bottom, like a messenger */
.log > :first-child {
  margin-top: auto;
}

.is-new {
  animation: msg-in 0.16s ease-out both;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- intro / empty state */
.intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 6px;
}

.intro__who {
  display: flex;
  align-items: center;
  gap: 12px;
}

.intro__ava {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.intro__names {
  min-width: 0;
}

.intro__name {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.intro__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13px;
}

.intro__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.intro__card {
  padding: 16px 18px 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  border-top-left-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro__title {
  margin-bottom: 6px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.intro__text {
  font-size: 15px;
  line-height: 1.5;
}

.intro:not(.intro--full) {
  margin-bottom: 4px;
}

.intro:not(.intro--full) .intro__card {
  padding: 13px 15px;
}

.intro:not(.intro--full) .intro__title {
  font-size: 16px;
  margin-bottom: 3px;
}

.intro:not(.intro--full) .intro__text {
  font-size: 14.5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.chip {
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--soft);
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.chip:hover {
  border-color: var(--soft-line);
  background: var(--soft-line);
}

.chip:active {
  transform: scale(0.98);
}

.intro__tg {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin-top: 2px;
  padding: 6px 4px;
  border-radius: 10px;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.intro__tg:hover .intro__arrow {
  transform: translateX(3px);
}

.intro__arrow {
  transition: transform 0.15s ease;
}

/* ---------------------------------------------------------------- day separator + system pills */
.day,
.sys {
  display: flex;
  justify-content: center;
  margin: 18px 0 8px;
}

.day__pill,
.sys__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.35;
}

.sys {
  margin: 16px 0 4px;
}

.sys__pill svg {
  color: var(--accent);
}

/* ---------------------------------------------------------------- messages */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 3px;
}

.msg--first {
  margin-top: 12px;
}

.day + .msg {
  margin-top: 4px;
}

.msg--in {
  justify-content: flex-end;
}

.msg__ava {
  flex: 0 0 28px;
  width: 28px;
}

.msg__avaimg {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.msg__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: min(80%, 340px);
}

.msg--in .msg__col {
  align-items: flex-end;
}

.bubble {
  position: relative;
  max-width: 100%;
  padding: 9px 14px 10px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg--in .bubble {
  border-bottom-right-radius: 6px;
  background: var(--fill);
  color: var(--on-accent);
}

.msg--out .bubble {
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* a chain of bubbles reads as one block */
.msg--in:not(.msg--first) .bubble {
  border-top-right-radius: 6px;
}

.msg--out:not(.msg--first) .bubble {
  border-top-left-radius: 6px;
}

.bubble__text {
  white-space: pre-wrap;
}

.lnk {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.msg--out .lnk {
  color: var(--accent);
}

.msg--sending .bubble,
.msg--failed .bubble {
  opacity: 0.72;
}

.msg--failed .bubble {
  opacity: 0.6;
}

.msg__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 6px 0;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.msg__sep {
  opacity: 0.6;
}

.msg__meta--err {
  color: var(--danger);
  font-weight: 550;
}

.linkbtn {
  margin-left: 4px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.linkbtn:hover {
  background: var(--soft);
}

.linkbtn--muted {
  margin-left: 0;
  color: var(--ink-2);
  font-weight: 550;
}

/* reaction from support on a visitor message */
.msg--reacted .bubble {
  margin-bottom: 10px;
}

.bubble__react {
  position: absolute;
  bottom: -12px;
  left: -6px;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1;
  box-shadow: var(--shadow);
}

/* photos */
.bubble--photo {
  padding: 4px;
}

.bubble--photo .bubble__text {
  padding: 6px 10px 5px;
}

.bubble--bare {
  padding: 0;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

.ph {
  position: relative;
  display: block;
  min-width: 120px;
  max-width: 240px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--soft);
  cursor: zoom-in;
}

.bubble--bare .ph {
  border-radius: var(--radius);
}

.msg--in .bubble--bare .ph {
  border-bottom-right-radius: 6px;
}

.msg--out .bubble--bare .ph {
  border-bottom-left-radius: 6px;
}

.ph__img {
  display: block;
  width: auto;
  max-width: 240px;
  height: auto;
  max-height: 300px;
}

.ph--loading,
.ph--err {
  width: 220px;
  height: 160px;
  cursor: default;
}

.ph--loading .ph__img,
.ph--err .ph__img {
  position: absolute;
  opacity: 0;
}

.ph--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--soft-line);
  animation: pulse 1.2s ease-in-out infinite;
}

.ph--err {
  cursor: pointer;
}

.ph__err {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: center;
}

/* files from support */
.filechip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  max-width: 100%;
  padding: 2px 4px 2px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.filechip__ic {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--accent);
}

.filechip__tx {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.filechip__name {
  overflow: hidden;
  font-weight: 550;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.filechip__act {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.bubble--photo + .msg__meta,
.filechip + .bubble__text {
  margin-top: 6px;
}

/* ---------------------------------------------------------------- rating card */
.rate {
  margin: 16px 0 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.rate__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
}

.rate__head .tile {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.rate__q {
  margin: 10px 0 14px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.rate--done .rate__q {
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 550;
}

.rate__btns {
  display: flex;
  gap: 10px;
}

.rbtn {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: var(--soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.rbtn:hover:not(:disabled) {
  background: var(--soft-line);
}

.rbtn:active:not(:disabled) {
  transform: scale(0.98);
}

.rbtn:disabled {
  opacity: 0.6;
  cursor: default;
}

.rbtn__e {
  font-size: 18px;
}

/* ---------------------------------------------------------------- notices (load error / unavailable) */
.notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: auto 0;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.notice__title {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.notice__text {
  max-width: 300px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.notice__btns {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 8px;
  margin-top: 8px;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--fill);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--fill-hover);
}

.btn--ghost {
  background: var(--soft);
  color: var(--accent);
}

.btn--ghost:hover {
  background: var(--soft-line);
}

/* ---------------------------------------------------------------- skeleton */
.skel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel__b {
  height: 44px;
  width: 70%;
  border-radius: var(--radius);
  background: var(--soft);
  animation: pulse 1.2s ease-in-out infinite;
}

.skel__b--out {
  border-bottom-left-radius: 6px;
}

.skel__b--in {
  align-self: flex-end;
  width: 45%;
  border-bottom-right-radius: 6px;
}

.skel__b--short {
  width: 40%;
}

.skel__b--mid {
  width: 58%;
  height: 64px;
}

.skel__b:nth-child(2) { animation-delay: 0.1s; }
.skel__b:nth-child(3) { animation-delay: 0.2s; }
.skel__b:nth-child(4) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------------------------------------------------------------- new messages pill + toasts */
.newpill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 24px -10px rgba(5, 30, 110, 0.55);
  transform: translateX(-50%);
  cursor: pointer;
  animation: rise-in 0.18s ease-out;
}

@keyframes rise-in {
  from { opacity: 0; translate: 0 6px; }
  to { opacity: 1; translate: 0 0; }
}

.toasts {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  background: #151b2e;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 16px 36px -14px rgba(5, 10, 30, 0.6);
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

:root[data-theme='dark'] .toast {
  border: 1px solid var(--border);
  background: var(--surface);
}

.toast__ic {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #6ef2a8;
}

.toast--err .toast__ic {
  color: #ff8a8f;
}

.toast--out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- composer */
.composer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 10px 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cbtn {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.cbtn:active:not(:disabled) {
  transform: scale(0.94);
}

.cbtn--attach {
  background: var(--soft);
  color: var(--accent);
}

.cbtn--attach:hover {
  background: var(--soft-line);
}

.cbtn--send {
  background: var(--fill);
  color: var(--on-accent);
}

.cbtn--send:hover:not(:disabled) {
  background: var(--fill-hover);
}

.cbtn--send:disabled {
  background: var(--soft);
  color: var(--accent-3);
  cursor: default;
}

.field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

/* focus ring = accent at 20 % (drawn by a pseudo element so it follows the theme token) */
.field::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  box-shadow: 0 0 0 3px var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.field:focus-within::after {
  opacity: 0.2;
}

.field textarea {
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 132px;
  margin: 0;
  padding: 10px 16px;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 22px;
  resize: none;
  transition: border-color 0.15s ease;
}

.field textarea.is-scroll {
  overflow-y: auto;
}

/* an empty field shows its placeholder on one line, never a cut second line */
.field textarea.is-empty {
  overflow: hidden;
  white-space: nowrap;
}

.field textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.counter {
  margin: 5px 58px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.counter--over {
  color: var(--danger);
  font-weight: 600;
}

/* attachment preview above the input */
.tray {
  margin: 0 0 10px 52px;
}

.tray__item {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 6px 6px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-2);
  animation: msg-in 0.16s ease-out;
}

.tray__img {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--soft);
}

.tray__info {
  flex: 1 1 auto;
  min-width: 0;
}

.tray__name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tray__size {
  color: var(--ink-2);
  font-size: 12.5px;
}

.tray__x {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.tray__x:hover {
  background: var(--soft);
  color: var(--text);
}

/* small dismissible note above the input (signed in during an anonymous request) */
.cnote {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 4px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-2);
  animation: msg-in 0.16s ease-out;
}

.cnote__tx {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 3px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.4;
}

.cnote__x {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.cnote__x:hover {
  background: var(--soft);
  color: var(--text);
}

.banned {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 2px;
  text-align: center;
}

.banned p {
  color: var(--ink-2);
  font-size: 14px;
}

.banned .btn {
  min-height: 42px;
}

/* ---------------------------------------------------------------- spinner */
.spin {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1.8px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------- drop overlay */
.drop {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}

.drop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.9;
}

.drop__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: var(--surface);
}

.drop__tx {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 650;
}

.drop__hint {
  color: var(--ink-2);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- confirm sheet */
.sheet {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(4, 10, 32, 0.42);
  animation: fade-in 0.16s ease-out;
}

.sheet__card {
  width: 100%;
  max-width: 420px;
  padding: 20px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--pop-shadow);
  animation: sheet-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.sheet__text {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.sheet__btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet__btns .btn {
  flex: 1 1 0;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------------------------------------------------------- lightbox */
.lb {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(3, 6, 18, 0.94);
  animation: fade-in 0.16s ease-out;
}

.lb__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lb__bar {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px;
  padding-top: max(10px, env(safe-area-inset-top));
}

.lbbtn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.lbbtn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lbbtn:focus,
.lbbtn:focus-visible {
  outline-color: #fff;
}

.lb__stage {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.lb__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  object-fit: contain;
  animation: zoom-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes zoom-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}

.nojs {
  padding: 24px;
  text-align: center;
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .hdr__pat {
    animation: none;
  }
}

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 360px) {
  .hdr__status {
    font-size: 11.5px;
  }

  .msg__col {
    max-width: 86%;
  }
}
