/* ─── Onyx web app ─────────────────────────────────────────────────────────
   Warm onyx surfaces, one orange accent, cream text. RTL, mobile first; from
   900px the app becomes a rail + list + detail layout. */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn.woff2') format('woff2-variations'), url('../fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #110d0b;
  --bg-elev: #161210;
  --surface: #1c1714;
  --surface-2: #241e1a;
  --surface-3: #2e2621;
  --surface-hover: #332a24;
  --line: rgba(255, 236, 214, 0.08);
  --line-strong: rgba(255, 236, 214, 0.14);
  --text: #f6eee4;
  --text-2: #bcae9f;
  --text-3: #85776b;
  --accent: #ff5a0a;
  --accent-2: #ff7d36;
  --accent-ink: #1b0e06;
  --accent-soft: rgba(255, 90, 10, 0.14);
  --accent-softer: rgba(255, 90, 10, 0.08);
  --success: #39d98a;
  --success-soft: rgba(57, 217, 138, 0.14);
  --danger: #ff4d5e;
  --danger-soft: rgba(255, 77, 94, 0.14);
  --warning: #ffb547;
  --warning-soft: rgba(255, 181, 71, 0.14);
  --info: #5ab0ff;
  --bubble-mine: linear-gradient(160deg, #ff6a1f 0%, #f04e00 100%);
  --bubble-mine-text: #fff8f2;
  --bubble-theirs: #2a231f;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.55);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tabbar-h: 64px;
  --appbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f6f1eb;
    --bg-elev: #fbf8f4;
    --surface: #ffffff;
    --surface-2: #f4ede6;
    --surface-3: #ebe2d8;
    --surface-hover: #e6dccf;
    --line: rgba(60, 36, 20, 0.09);
    --line-strong: rgba(60, 36, 20, 0.16);
    --text: #1e1612;
    --text-2: #6a5b50;
    --text-3: #9b8b7e;
    --accent: #f24f00;
    --accent-2: #ff6a1f;
    --accent-soft: rgba(242, 79, 0, 0.12);
    --accent-softer: rgba(242, 79, 0, 0.06);
    --bubble-theirs: #ffffff;
    --shadow-1: 0 1px 2px rgba(60, 36, 20, 0.08);
    --shadow-2: 0 8px 28px rgba(60, 36, 20, 0.12);
    --shadow-3: 0 24px 60px rgba(60, 36, 20, 0.2);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f1eb;
  --bg-elev: #fbf8f4;
  --surface: #ffffff;
  --surface-2: #f4ede6;
  --surface-3: #ebe2d8;
  --surface-hover: #e6dccf;
  --line: rgba(60, 36, 20, 0.09);
  --line-strong: rgba(60, 36, 20, 0.16);
  --text: #1e1612;
  --text-2: #6a5b50;
  --text-3: #9b8b7e;
  --accent: #f24f00;
  --accent-2: #ff6a1f;
  --accent-soft: rgba(242, 79, 0, 0.12);
  --accent-softer: rgba(242, 79, 0, 0.06);
  --bubble-theirs: #ffffff;
  --shadow-1: 0 1px 2px rgba(60, 36, 20, 0.08);
  --shadow-2: 0 8px 28px rgba(60, 36, 20, 0.12);
  --shadow-3: 0 24px 60px rgba(60, 36, 20, 0.2);
}

/* ─── Base ──────────────────────────────────────────────────────────────── */

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

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

::selection {
  background: var(--accent-soft);
}

svg {
  flex-shrink: 0;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.muted {
  color: var(--text-2);
}

.faint {
  color: var(--text-3);
}

.small {
  font-size: 13px;
}

.tiny {
  font-size: 11.5px;
}

.bold {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.spacer {
  flex: 1;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.center {
  display: grid;
  place-items: center;
}

/* ─── Boot screen ───────────────────────────────────────────────────────── */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
  transition: opacity 0.3s var(--ease);
}

.boot.gone {
  opacity: 0;
  pointer-events: none;
}

.boot-logo {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(255, 90, 10, 0.35);
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* ─── Shell ─────────────────────────────────────────────────────────────── */

#app {
  height: 100%;
}

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

.main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: view-in 0.24s var(--ease);
}

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

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + var(--tabbar-h) + var(--safe-b));
}

.page.narrow {
  max-width: 480px;
}

.tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
  z-index: 30;
  transition: transform 0.25s var(--ease);
}

.tabbar.away {
  transform: translateY(110%);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.18s;
}

.tab svg {
  width: 24px;
  height: 24px;
  transition: transform 0.25s var(--ease);
}

.tab.active {
  color: var(--accent);
}

.tab.active svg {
  transform: translateY(-1px) scale(1.06);
}

.tab .dot {
  position: absolute;
  top: 8px;
  inset-inline-start: calc(50% + 6px);
}

.rail {
  display: none;
}

@media (min-width: 900px) {
  .shell {
    flex-direction: row;
  }

  .tabbar {
    display: none;
  }

  .rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 232px;
    flex-shrink: 0;
    padding: 18px 12px;
    background: var(--bg-elev);
    border-inline-end: 1px solid var(--line);
  }

  .rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 20px;
    font-weight: 800;
    font-size: 18px;
  }

  .rail-brand img {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .rail-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--r-md);
    color: var(--text-2);
    font-weight: 600;
    transition: background 0.18s, color 0.18s;
  }

  .rail-item svg {
    width: 22px;
    height: 22px;
  }

  .rail-item:hover {
    background: var(--surface);
    color: var(--text);
  }

  .rail-item.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .rail-item .count {
    margin-inline-start: auto;
  }

  .rail-foot {
    margin-top: auto;
  }

  .page {
    padding-bottom: 40px;
  }
}

/* ─── App bar ───────────────────────────────────────────────────────────── */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--appbar-h) + var(--safe-t));
  padding: var(--safe-t) 10px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.appbar.scrolled {
  border-bottom-color: var(--line);
}

.appbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.2px;
  padding-inline: 6px;
}

.appbar .title-block {
  min-width: 0;
  flex: 1;
}

.appbar .title-block .sub {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.15s var(--ease), background 0.15s;
}

.coin-pill:active {
  transform: scale(0.96);
}

.coin-pill img {
  width: 22px;
  height: 22px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.18s, box-shadow 0.18s, opacity 0.18s;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn img {
  width: 22px;
  height: 22px;
}

.btn.block {
  width: 100%;
}

.btn.sm {
  height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 12px;
}

.btn.lg {
  height: 56px;
  font-size: 16.5px;
  border-radius: var(--r-lg);
}

.btn-primary {
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 90, 10, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 26px rgba(255, 90, 10, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

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

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

.btn .price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12.5px;
}

.btn.loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: rgba(255, 255, 255, 0.85) rgba(255, 255, 255, 0.85) transparent transparent;
  animation: spin 0.7s linear infinite;
}

.btn-secondary.loading::after,
.btn-ghost.loading::after,
.btn-soft.loading::after {
  border-color: var(--accent) var(--accent) transparent transparent;
}

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

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease);
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 23px;
  height: 23px;
}

.icon-btn.accent {
  color: var(--accent);
}

.icon-btn .dot {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
}

/* ─── Badges, chips, dots ───────────────────────────────────────────────── */

.dot {
  min-width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-elev);
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
}

.count.muted-count {
  background: var(--surface-3);
  color: var(--text-2);
}

.tab .count {
  position: absolute;
  top: 5px;
  left: calc(50% + 5px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  box-shadow: 0 0 0 2px var(--bg-elev);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.chip.on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

.chip img {
  width: 18px;
  height: 18px;
}

.chip .chip-price {
  font-size: 11.5px;
  opacity: 0.85;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.tag.common {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag.success {
  background: var(--success-soft);
  color: var(--success);
}

.tag.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.verified {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--info);
  color: #fff;
  flex-shrink: 0;
}

.verified svg {
  width: 12px;
  height: 12px;
}

/* ─── Avatars ───────────────────────────────────────────────────────────── */

.avatar {
  --size: 48px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  font-size: calc(var(--size) * 0.4);
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar.xs {
  --size: 32px;
}

.avatar.sm {
  --size: 40px;
}

.avatar.lg {
  --size: 64px;
}

.avatar.xl {
  --size: 104px;
}

.avatar .online {
  position: absolute;
  bottom: 1px;
  inset-inline-end: 1px;
  width: calc(var(--size) * 0.26);
  height: calc(var(--size) * 0.26);
  max-width: 15px;
  max-height: 15px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2.5px var(--bg);
}

.avatar.ring {
  box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px var(--accent);
}

/* ─── Cards and lists ───────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 4px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.section-title .spacer + * {
  font-weight: 600;
}

.list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  text-align: start;
  width: 100%;
  transition: background 0.15s;
  color: var(--text);
}

.list-item + .list-item {
  border-top: 1px solid var(--line);
}

button.list-item:hover,
a.list-item:hover {
  background: var(--surface-2);
}

.list-item .li-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  flex-shrink: 0;
}

.list-item .li-icon img {
  width: 24px;
  height: 24px;
}

.list-item .li-icon svg {
  width: 21px;
  height: 21px;
  color: var(--text-2);
}

.list-item .li-body {
  flex: 1;
  min-width: 0;
}

.list-item .li-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item .li-sub {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item > svg:not(.chev) {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.list-item .chev {
  color: var(--text-3);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.list-item.danger,
.list-item.danger .li-icon svg {
  color: var(--danger);
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
.field .label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.input,
.textarea,
.select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
}

.textarea {
  height: auto;
  min-height: 110px;
  padding: 13px 16px;
  resize: vertical;
  line-height: 1.7;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.field .hint {
  font-size: 12px;
  color: var(--text-3);
}

.field .error {
  font-size: 12.5px;
  color: var(--danger);
}

.select {
  appearance: none;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385776b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: left 14px center;
  background-size: 18px 18px;
  background-repeat: no-repeat;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: inset-inline-start 0.22s var(--ease);
}

.switch.on {
  background: var(--accent);
}

.switch.on::after {
  inset-inline-start: 23px;
}

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.segmented button {
  flex: 1;
  height: 38px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segmented button.on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 90, 10, 0.3);
}

.segmented button.on .count {
  background: #fff;
  color: var(--accent);
}

.segmented button .count {
  min-width: 19px;
  height: 19px;
  font-size: 11px;
}

/* ─── Overlays: sheets, dialogs, toasts ─────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 5, 3, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.2s var(--ease);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay.closing {
  animation: fade-out 0.18s var(--ease) forwards;
}

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

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-3);
  padding-bottom: var(--safe-b);
  animation: sheet-in 0.32s var(--ease);
}

.overlay.closing .sheet {
  animation: sheet-out 0.2s var(--ease) forwards;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 4px 8px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  flex: 1;
  padding-inline: 6px;
}

.sheet-body {
  padding: 8px 18px 20px;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .overlay {
    align-items: center;
  }

  .sheet {
    border-radius: var(--r-xl);
    max-height: 86vh;
    animation: dialog-in 0.26s var(--ease);
  }

  .overlay.closing .sheet {
    animation: fade-out 0.16s var(--ease) forwards;
  }

  .sheet-grip {
    display: none;
  }

  .sheet-head {
    padding-top: 14px;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

.dialog-icon {
  width: 64px;
  height: 64px;
  margin: 6px auto 12px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--accent-soft);
}

.dialog-icon img {
  width: 40px;
  height: 40px;
}

.dialog-title {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
}

.dialog-text {
  text-align: center;
  color: var(--text-2);
  margin: 0 0 20px;
}

.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toasts {
  position: fixed;
  top: calc(12px + var(--safe-t));
  inset-inline: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 12px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
  animation: toast-in 0.32s var(--ease);
  font-size: 14px;
  font-weight: 600;
}

.toast.leaving {
  animation: toast-out 0.22s var(--ease) forwards;
}

.toast img {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.toast .toast-body {
  flex: 1;
  min-width: 0;
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.toast.success {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
}

.toast button {
  color: var(--accent);
  font-weight: 800;
  font-size: 13.5px;
  padding: 4px 6px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
}

/* ─── Feedback ──────────────────────────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 42px 20px;
  gap: 6px;
}

.empty img {
  width: 72px;
  height: 72px;
  opacity: 0.95;
  margin-bottom: 8px;
  filter: drop-shadow(0 10px 22px rgba(255, 90, 10, 0.22));
}

.empty h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.empty p {
  margin: 0;
  color: var(--text-2);
  max-width: 320px;
}

.empty .btn {
  margin-top: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--accent-softer);
  border: 1px solid var(--accent-soft);
  font-size: 13.5px;
  color: var(--text-2);
}

.notice img {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notice.warning {
  background: var(--warning-soft);
  border-color: transparent;
}

.offline-bar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 80;
  padding: calc(4px + var(--safe-t)) 12px 4px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--warning);
  color: #1d1205;
  transform: translateY(-100%);
  transition: transform 0.25s var(--ease);
}

.offline-bar.show {
  transform: none;
}

/* ─── Auth ──────────────────────────────────────────────────────────────── */

.auth {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 22px calc(32px + var(--safe-b));
  position: relative;
  overflow: hidden;
}

.auth::before {
  content: '';
  position: absolute;
  width: 640px;
  height: 640px;
  top: -340px;
  inset-inline-start: 50%;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 10, 0.28), transparent 65%);
  pointer-events: none;
}

[dir='rtl'] .auth::before {
  translate: 50% 0;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  width: 84px;
  height: 84px;
  border-radius: 28px;
  margin: 0 auto 22px;
  box-shadow: 0 14px 44px rgba(255, 90, 10, 0.38);
}

.auth h1 {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.auth .lead {
  text-align: center;
  color: var(--text-2);
  margin: 0 0 28px;
}

.phone-input {
  display: flex;
  align-items: center;
  direction: ltr;
  height: 58px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  transition: border-color 0.18s, box-shadow 0.18s;
  overflow: hidden;
}

.phone-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-softer);
}

.phone-input .cc {
  padding: 0 14px;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-weight: 700;
  border-inline-end: 1px solid var(--line);
  background: var(--surface-2);
}

.phone-input input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 16px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.otp {
  display: flex;
  direction: ltr;
  justify-content: center;
  gap: 9px;
}

.otp input {
  width: 48px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}

.otp input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-softer);
}

.otp input.filled {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.otp.shake {
  animation: shake 0.42s;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.dev-code {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}

.dev-code b {
  color: var(--accent);
  letter-spacing: 2px;
}

.stepper {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
}

.stepper span {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.3s var(--ease);
}

.stepper span.done {
  background: var(--accent);
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 2px solid var(--line);
  font-weight: 800;
  font-size: 16px;
  transition: all 0.2s var(--ease);
}

.choice img {
  width: 54px;
  height: 54px;
}

.choice.on {
  border-color: var(--accent);
  background: var(--accent-softer);
  transform: translateY(-2px);
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px;
}

.city-grid button {
  height: 46px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}

.city-grid button.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.age-wheel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 18px 0;
}

.age-wheel .age-value {
  font-size: 64px;
  font-weight: 900;
  min-width: 120px;
  text-align: center;
  line-height: 1;
}

.age-wheel .icon-btn {
  width: 56px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--line);
}

/* ─── Home ──────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 22px 20px 20px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 106, 31, 0.42), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(255, 90, 10, 0.18), transparent 60%), var(--surface);
  border: 1px solid var(--line);
}

.hero:has(.hero-art) > h2,
.hero:has(.hero-art) > p {
  padding-inline-end: 64px;
}

.hero h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.hero p {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 14px;
}

.hero .hero-art {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 56px;
  height: 56px;
  opacity: 0.95;
  transform: rotate(-8deg);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}

.hero .chips {
  margin-bottom: 16px;
}

.radar {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 6px auto 16px;
  display: grid;
  place-items: center;
}

.radar::before,
.radar::after,
.radar .ring {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: radar 2.6s var(--ease) infinite;
}

.radar::after {
  animation-delay: 0.87s;
}

.radar .ring {
  animation-delay: 1.74s;
}

@keyframes radar {
  0% {
    transform: scale(0.35);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.radar .core {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 34px rgba(255, 90, 10, 0.5);
}

.radar .core img {
  width: 42px;
  height: 42px;
  filter: brightness(0) invert(1);
}

.searching-meta {
  text-align: center;
  margin-bottom: 16px;
}

.searching-meta .timer {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  position: relative;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: start;
  transition: transform 0.18s var(--ease), background 0.18s;
  min-height: 112px;
}

.tile:hover {
  background: var(--surface-2);
}

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

.tile img {
  width: 36px;
  height: 36px;
}

.tile .tile-title {
  font-weight: 800;
}

.tile .tile-sub {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.tile .count {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
}

.request-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.request-card + .request-card {
  margin-top: 8px;
}

/* ─── Prices ────────────────────────────────────────────────────────────── */

.coin-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.5;
}

.coin-price img {
  width: 16px;
  height: 16px;
}

.btn .price .cp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn .price .cp img {
  width: 17px;
  height: 17px;
}

.free-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* ─── Match filters ─────────────────────────────────────────────────────── */

.filter-label {
  margin: 4px 2px 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-2);
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.choice-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 6px 10px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 2px solid var(--line);
  color: var(--text-2);
  font-weight: 700;
  font-size: 13.5px;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.15s var(--ease);
}

.choice-pill img {
  width: 30px;
  height: 30px;
  opacity: 0.7;
  transition: opacity 0.18s, transform 0.25s var(--ease);
}

.choice-pill:active {
  transform: scale(0.97);
}

.choice-pill.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.choice-pill.on img {
  opacity: 1;
  transform: scale(1.08);
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 380px) {
  .check-grid {
    grid-template-columns: 1fr;
  }
}

.check-tile {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 2px solid var(--line);
  text-align: start;
  transition: border-color 0.18s, background 0.18s, transform 0.15s var(--ease);
}

.check-tile:hover {
  border-color: var(--line-strong);
}

.check-tile:active {
  transform: scale(0.98);
}

.check-tile .ct-box {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 2px solid var(--text-3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s;
}

.check-tile .ct-box svg {
  width: 15px;
  height: 15px;
  stroke-width: 3.2;
  color: #fff;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.18s, transform 0.25s var(--ease);
}

.check-tile .ct-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-tile .ct-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
}

.check-tile .ct-label img {
  width: 18px;
  height: 18px;
}

.check-tile .ct-sub {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.check-tile .ct-price {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 10px;
}

.check-tile .ct-body {
  padding-bottom: 22px;
}

.check-tile.on {
  border-color: var(--accent);
  background: var(--accent-softer);
}

.check-tile.on .ct-box {
  background: var(--accent);
  border-color: var(--accent);
}

.check-tile.on .ct-box svg {
  opacity: 1;
  transform: none;
}

.check-tile.on .ct-sub {
  color: var(--text-2);
}

/* ─── Chat list ─────────────────────────────────────────────────────────── */

.chat-row {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  text-align: start;
  border-radius: var(--r-md);
  transition: background 0.15s;
}

.chat-row:hover {
  background: var(--surface);
}

.chat-row.selected {
  background: var(--accent-softer);
}

.chat-row .cr-body {
  flex: 1;
  min-width: 0;
}

.chat-row .cr-top,
.chat-row .cr-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-row .cr-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-row .cr-time {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}

.chat-row .cr-last {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-row.unread .cr-last {
  color: var(--text);
  font-weight: 600;
}

.chat-row.unread .cr-time {
  color: var(--accent);
  font-weight: 700;
}

.chat-row.ended {
  opacity: 0.62;
}

/* ─── Split layout (desktop chats) ──────────────────────────────────────── */

.split {
  display: flex;
  height: 100%;
}

.split-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.split-detail {
  display: none;
}

@media (min-width: 900px) {
  .split-list {
    width: 360px;
    flex-shrink: 0;
    border-inline-end: 1px solid var(--line);
  }

  .split-detail {
    display: flex;
    flex: 1;
    min-width: 0;
    position: relative;
  }

  .split.has-detail .split-list .page {
    padding-bottom: 20px;
  }

  .detail-placeholder {
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--text-3);
  }
}

@media (max-width: 899px) {
  .split.has-detail .split-list {
    display: none;
  }

  .split.has-detail .split-detail {
    display: flex;
    flex: 1;
    min-width: 0;
  }
}

/* ─── Conversation ──────────────────────────────────────────────────────── */

.conversation {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(70% 50% at 100% 0%, rgba(255, 90, 10, 0.06), transparent 70%), var(--bg);
}

.conversation .appbar {
  gap: 4px;
}

.conv-peer {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
  padding: 4px 4px;
  border-radius: 12px;
}

.conv-peer .name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-peer .presence {
  font-size: 12px;
  color: var(--text-2);
}

.conv-peer .presence.online {
  color: var(--success);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.messages-inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-sep {
  align-self: center;
  margin: 12px 0 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 4px;
  z-index: 2;
}

.sys-msg {
  align-self: center;
  max-width: 86%;
  margin: 10px 0;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

.msg {
  display: flex;
  max-width: 100%;
}

.msg.mine {
  justify-content: flex-start;
}

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

.msg + .msg.gap {
  margin-top: 8px;
}

.bubble {
  position: relative;
  max-width: min(78%, 520px);
  padding: 8px 12px 6px;
  border-radius: 20px;
  background: var(--bubble-theirs);
  color: var(--text);
  box-shadow: var(--shadow-1);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: bubble-in 0.22s var(--ease);
  cursor: default;
  user-select: text;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.msg.mine .bubble {
  background: var(--bubble-mine);
  color: var(--bubble-mine-text);
  border-start-start-radius: 20px;
  border-end-start-radius: 6px;
}

.msg.theirs .bubble {
  border-end-end-radius: 6px;
}

.msg.mine.cont .bubble {
  border-start-start-radius: 6px;
}

.msg.theirs.cont .bubble {
  border-start-end-radius: 6px;
}

.bubble .text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.7;
}

.bubble .meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  float: left;
  margin: 6px 10px 0 0;
  font-size: 11px;
  opacity: 0.72;
  direction: ltr;
  user-select: none;
}

.bubble .meta svg {
  width: 15px;
  height: 15px;
}

.bubble .meta .edited {
  font-style: normal;
}

.bubble.pending {
  opacity: 0.75;
}

.bubble.failed {
  box-shadow: 0 0 0 1.5px var(--danger);
}

.bubble .failed-note {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.msg.mine .bubble .failed-note {
  color: #ffe1e1;
}

.bubble.media-only {
  padding: 4px;
}

.bubble.media-only .meta {
  position: absolute;
  bottom: 10px;
  left: 10px;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  opacity: 1;
}

.bubble.sticker-bubble {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
}

.bubble.sticker-bubble .meta {
  position: static;
  float: none;
  display: flex;
  justify-content: flex-end;
  background: none;
  color: var(--text-2);
}

.reply-quote {
  display: block;
  margin: 2px 0 6px;
  padding: 5px 10px;
  border-radius: 10px;
  border-inline-start: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.16);
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-align: start;
  cursor: pointer;
}

.msg.mine .reply-quote {
  border-inline-start-color: #fff;
  background: rgba(0, 0, 0, 0.14);
}

.reply-quote .rq-name {
  font-weight: 800;
  font-size: 12px;
  color: var(--accent);
}

.msg.mine .reply-quote .rq-name {
  color: #fff;
}

.reply-quote .rq-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.88;
}

.bubble.highlight {
  animation: highlight 1.2s var(--ease);
}

@keyframes highlight {
  30% {
    box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-1);
    transform: scale(1.02);
  }
}

.media-photo {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-3);
  cursor: zoom-in;
  min-width: 160px;
  min-height: 120px;
  max-height: 380px;
}

.media-photo img,
.media-photo video {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
}

.media-video video {
  width: 100%;
  max-height: 420px;
  border-radius: 16px;
  background: #000;
}

.bubble .media-photo + .text,
.bubble .media-video + .text,
.bubble .file-card + .text,
.bubble .voice + .text {
  margin-top: 6px;
  padding: 0 4px;
}

.media-missing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 13px;
}

.media-missing svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.video-note {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
}

.sticker {
  width: 170px;
  height: 170px;
  object-fit: contain;
}

.voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 4px 2px;
}

.voice .play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease);
}

.msg.mine .voice .play {
  background: #fff;
  color: var(--accent);
}

.voice .play:active {
  transform: scale(0.92);
}

.voice .play svg {
  width: 20px;
  height: 20px;
}

.voice .wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  direction: ltr;
  cursor: pointer;
}

.voice .wave span {
  flex: 1;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.32;
  min-height: 3px;
  transition: opacity 0.15s;
}

.voice .wave span.played {
  opacity: 0.95;
}

.voice .vtime {
  font-size: 11.5px;
  opacity: 0.8;
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  min-width: 200px;
  color: inherit;
}

.file-card .fc-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

.msg.mine .file-card .fc-icon {
  background: #fff;
  color: var(--accent);
}

.file-card .fc-icon svg {
  width: 22px;
  height: 22px;
}

.file-card .fc-name {
  font-weight: 700;
  font-size: 13.5px;
}

.location-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  color: inherit;
}

.location-card img {
  width: 34px;
  height: 34px;
}

.new-pill {
  position: absolute;
  bottom: 90px;
  left: 50%;
  translate: -50% 0;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: toast-in 0.25s var(--ease);
}

.new-pill svg {
  width: 16px;
  height: 16px;
}

.composer-wrap {
  flex-shrink: 0;
  padding: 6px 10px calc(10px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}

.composer-inner {
  max-width: 820px;
  margin: 0 auto;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 6px 6px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border-inline-start: 3px solid var(--accent);
  animation: toast-in 0.2s var(--ease);
}

.composer-bar svg.lead {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.composer-bar .cb-body {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.composer-bar .cb-title {
  color: var(--accent);
  font-weight: 800;
  font-size: 12.5px;
}

.composer-bar .cb-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}

.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  padding: 9px 6px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  line-height: 1.6;
  font-size: 15.5px;
}

.composer .send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.18s var(--ease), opacity 0.18s;
  box-shadow: 0 4px 14px rgba(255, 90, 10, 0.35);
}

.composer .send:active {
  transform: scale(0.9);
}

.composer .send svg {
  width: 21px;
  height: 21px;
  transform: scaleX(-1);
}

.composer .send.mic svg {
  transform: none;
}

.composer .icon-btn {
  width: 42px;
  height: 42px;
}

.rec-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  box-shadow: var(--shadow-2);
}

.rec-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
  flex-shrink: 0;
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

.rec-time {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.rec-level {
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  direction: ltr;
  overflow: hidden;
}

.rec-level span {
  width: 3px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent);
  min-height: 3px;
}

.chat-ended-bar {
  max-width: 820px;
  margin: 0 auto;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.chat-ended-bar p {
  margin: 0 0 12px;
  color: var(--text-2);
  font-weight: 600;
}

.msg-menu {
  position: fixed;
  z-index: 70;
  min-width: 190px;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-3);
  animation: dialog-in 0.16s var(--ease);
}

.msg-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  text-align: start;
}

.msg-menu button:hover {
  background: var(--surface-3);
}

.msg-menu button svg {
  width: 19px;
  height: 19px;
  color: var(--text-2);
}

.upload-preview {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  max-height: 46vh;
}

.upload-preview img,
.upload-preview video {
  max-height: 46vh;
  width: 100%;
  object-fit: contain;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.2s;
}

/* ─── Lightbox ──────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(0, 0, 0, 0.94);
  display: grid;
  place-items: center;
  animation: fade-in 0.2s;
}

.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  animation: dialog-in 0.25s var(--ease);
}

.lightbox .icon-btn {
  position: absolute;
  top: calc(12px + var(--safe-t));
  inset-inline-end: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* ─── Profiles ──────────────────────────────────────────────────────────── */

.profile-hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.profile-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 440px;
  width: 100%;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.profile-photo.zoomable {
  cursor: zoom-in;
}

.profile-photo .initial {
  font-size: 110px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.92);
}

.profile-photo::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(10, 6, 4, 0.92), transparent);
  pointer-events: none;
}

.profile-photo .ph-caption {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 18px 18px 16px;
  color: #fff;
}

.profile-photo .ph-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
}

.profile-photo .ph-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

.profile-photo .ph-meta img {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.profile-photo .ph-badge {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 2;
}

.profile-photo .ph-edit {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(20, 12, 6, 0.72);
  color: var(--warning);
  font-size: 12.5px;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

.pending-badge img {
  width: 16px;
  height: 16px;
}

.profile-body {
  padding: 14px 16px 18px;
}

.id-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  direction: ltr;
}

.id-chip svg {
  width: 15px;
  height: 15px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 8px;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  transition: background 0.15s, transform 0.15s var(--ease);
  text-align: center;
}

.action:hover {
  background: var(--surface-3);
}

.action:active {
  transform: scale(0.95);
}

.action img {
  width: 30px;
  height: 30px;
}

.action.on {
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  color: var(--text);
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 19px;
  font-weight: 900;
}

.stat span {
  font-size: 12px;
  color: var(--text-2);
}

/* ─── Discover grid ─────────────────────────────────────────────────────── */

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 560px) {
  .people-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.person {
  position: relative;
  color: var(--text);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: start;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  animation: view-in 0.3s var(--ease) backwards;
}

.person:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.person .p-photo {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2));
  display: grid;
  place-items: center;
  position: relative;
}

.person .p-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.person .p-photo .initial {
  font-size: 48px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
}

.person .p-photo::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  background: linear-gradient(to top, rgba(10, 6, 4, 0.88), transparent);
}

.person .p-info {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  padding: 10px 12px;
  color: #fff;
}

.person .p-name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
}

.person .p-sub {
  font-size: 12px;
  opacity: 0.85;
}

.person .p-online {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2.5px rgba(0, 0, 0, 0.35);
}

.person .p-common {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  z-index: 2;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 90, 10, 0.88);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
}

/* ─── Wallet ────────────────────────────────────────────────────────────── */

.balance-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 22px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.18), transparent 50%),
    linear-gradient(150deg, #ff7a33 0%, #f04e00 60%, #c23d00 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(255, 90, 10, 0.32);
}

.balance-card .bc-label {
  opacity: 0.85;
  font-weight: 600;
}

.balance-card .bc-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.2;
}

.balance-card .bc-value img {
  width: 44px;
  height: 44px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.balance-card .bc-art {
  position: absolute;
  inset-inline-end: -10px;
  bottom: -18px;
  width: 120px;
  height: 120px;
  opacity: 0.13;
  filter: brightness(0) invert(1);
  transform: rotate(-12deg);
}

.packages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.package {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1.5px solid var(--line);
  transition: all 0.18s var(--ease);
}

.package:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  transform: translateY(-2px);
}

.package img {
  width: 40px;
  height: 40px;
}

.package .pk-coins {
  font-size: 22px;
  font-weight: 900;
}

.package .pk-price {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}

.package.best {
  border-color: var(--accent);
  background: var(--accent-softer);
}

.package .pk-ribbon {
  position: absolute;
  top: -10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
}

.tx + .tx {
  border-top: 1px solid var(--line);
}

.tx .tx-amount {
  font-weight: 800;
  direction: ltr;
}

.tx .tx-amount.plus {
  color: var(--success);
}

.tx .tx-amount.minus {
  color: var(--text-2);
}

/* ─── Inbox ─────────────────────────────────────────────────────────────── */

.inbox-item {
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.inbox-item + .inbox-item {
  margin-top: 10px;
}

.inbox-item.sealed {
  display: flex;
  align-items: center;
  gap: 12px;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: linear-gradient(120deg, var(--accent-softer), var(--surface) 60%);
  width: 100%;
  text-align: start;
}

.inbox-item.sealed > img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.inbox-item.sealed > svg {
  width: 20px;
  height: 20px;
  color: var(--text-3);
}

.inbox-item .ii-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}

.inbox-item .ii-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inbox-item .ii-quote {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border-inline-start: 3px solid var(--text-3);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item .ii-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.ghost-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 20px;
  background: linear-gradient(150deg, #2c1e16, #1a1310 70%);
  border: 1px solid var(--line);
  color: #f6eee4;
}

:root[data-theme='light'] .ghost-card {
  background: linear-gradient(150deg, #2c1e16, #1a1310 70%);
}

.ghost-card .gc-label {
  font-size: 12.5px;
  opacity: 0.7;
  font-weight: 700;
}

.ghost-card .gc-name {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 14px;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  direction: ltr;
}

.link-box code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-box .icon-btn {
  width: 36px;
  height: 36px;
  color: inherit;
  background: rgba(255, 255, 255, 0.1);
}

.rules {
  line-height: 2;
}

.rules b {
  color: var(--text);
}

.notification {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  width: 100%;
  text-align: start;
}

.notification + .notification {
  border-top: 1px solid var(--line);
}

.notification.unread {
  background: var(--accent-softer);
}

.notification img {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.notification .n-body {
  flex: 1;
  min-width: 0;
}

.notification .n-time {
  font-size: 12px;
  color: var(--text-3);
}

/* ─── Small screens ─────────────────────────────────────────────────────── */

@media (max-width: 380px) {
  .otp input {
    width: 42px;
    height: 54px;
  }
}

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