/* Aimray Web: colors match the Android app's theme (Color.kt / Theme.kt). */

:root {
  --cyan: #0ea5e9;
  --cyan-dark: #38bdf8;
  --emerald: #10b981;
  --violet: #8b5cf6;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --verified: #25d366;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-variant: #f1f5f9;
  --surface-elevated: #e2e8f0;
  --on-surface: #0f172a;
  --on-surface-variant: #64748b;
  --outline: #cbd5e1;
  --outline-variant: #e2e8f0;
  --primary: var(--cyan);
  --primary-soft: #e0f2fe;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  --radius: 16px;
  --nav-width: 76px;
  --nav-height: 64px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #090d16;
  --surface: #111827;
  --surface-variant: #1f2937;
  --surface-elevated: #263238;
  --on-surface: #f8fafc;
  --on-surface-variant: #94a3b8;
  --outline: #334155;
  --outline-variant: #1e293b;
  --primary: var(--cyan-dark);
  --primary-soft: rgba(56, 189, 248, 0.14);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

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

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Color Emoji', sans-serif;
  font-size: 15px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

input,
textarea,
select {
  font: inherit;
  color: var(--on-surface);
}

a {
  color: var(--primary);
}

h1,
h2,
h3 {
  margin: 0;
}

p {
  margin: 0;
}

code {
  background: var(--surface-variant);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

.icon {
  flex-shrink: 0;
  vertical-align: middle;
}

.flip {
  transform: scaleX(-1);
}

.muted {
  color: var(--on-surface-variant);
}

.small {
  font-size: 12.5px;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.pad {
  padding: 24px 12px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.accent {
  color: var(--primary);
}

.emerald {
  color: var(--emerald);
}

.violet {
  color: var(--violet);
}

.cyan {
  color: var(--cyan);
}

.rose {
  color: var(--rose);
}

.amber {
  color: var(--amber);
}

.verified {
  color: var(--verified);
  display: inline-flex;
}

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

.scroll-y {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Spinners ---------- */

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(14, 165, 233, 0.25);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

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

/* ---------- Boot & setup ---------- */

.boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.boot-logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
}

.setup {
  position: fixed;
  inset: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.setup-card {
  max-width: 560px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.setup-card h1 {
  font-size: 22px;
}

.setup-missing,
.setup-steps {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Cards, fields, buttons ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 46px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.search-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--primary);
}

.search-field input {
  border: 0;
  padding: 11px 0;
  box-shadow: none !important;
  background: transparent;
}

.search-field:focus-within {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  transition: filter 0.15s, background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--cyan);
  color: #000;
}

.btn-success {
  background: var(--emerald);
  color: #000;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-text {
  color: var(--on-surface-variant);
  padding: 8px 12px;
}

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

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

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-danger-outline {
  border: 1px solid var(--rose);
  color: var(--rose);
  background: rgba(244, 63, 94, 0.06);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 18px;
  font-size: 15px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface);
  flex-shrink: 0;
  transition: background 0.15s;
}

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

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

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

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

.icon-btn.spinning .icon {
  animation: spin 0.8s linear infinite;
}

.e2ee-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.label-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.label-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.count-badge,
.unread-badge,
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--cyan);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 18px 4px 8px;
}

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

.dialog-text {
  color: var(--on-surface-variant);
  font-size: 14px;
}

.info-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface-variant);
  font-size: 13px;
  background: var(--surface-variant);
  padding: 10px 12px;
  border-radius: 12px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 48px 28px;
  color: var(--on-surface-variant);
}

.empty-state > .icon {
  color: var(--cyan);
  opacity: 0.55;
}

.empty-state h3 {
  color: var(--on-surface);
  font-size: 17px;
  margin-top: 6px;
}

.empty-state p {
  font-size: 13.5px;
  max-width: 340px;
}

.empty-state .btn {
  margin-top: 10px;
}

.empty-state.small {
  padding: 28px 16px;
}

.empty-state.dark h3 {
  color: #fff;
}

.empty-state.dark p {
  color: rgba(255, 255, 255, 0.7);
}

/* Segmented control / tabs / chips */

.segmented,
.tabs {
  display: flex;
  background: var(--surface-variant);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}

.segmented button,
.tabs button {
  flex: 1;
  padding: 9px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--on-surface-variant);
}

.segmented button.active,
.tabs button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.tabs {
  margin: 8px 16px 0;
}

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

.chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--outline);
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.chip.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* Toggle switch */

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: var(--outline);
  cursor: pointer;
  transition: background 0.2s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .slider {
  background: var(--cyan);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Avatars ---------- */

.avatar {
  --avatar-size: 48px;
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
}

.avatar-img,
.avatar-initial {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.avatar-img {
  object-fit: cover;
  background: var(--surface-variant);
}

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}

.avatar-ring {
  width: calc(var(--avatar-size) + 6px);
  height: calc(var(--avatar-size) + 6px);
  padding: 3px;
  background: linear-gradient(135deg, var(--cyan), var(--violet), var(--emerald));
}

.avatar-ring .avatar-img,
.avatar-ring .avatar-initial {
  box-shadow: 0 0 0 2px var(--surface);
}

.avatar-online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: var(--emerald);
  border: 2px solid var(--surface);
}

/* ---------- Modals, sheets, menus, toasts ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.16s;
}

.modal-backdrop.open {
  opacity: 1;
}

.modal-backdrop.closing {
  opacity: 0;
  pointer-events: none;
}

.modal {
  background: var(--surface);
  border-radius: 24px;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.16s;
}

.modal-backdrop.open .modal {
  transform: none;
}

.modal-title {
  padding: 20px 22px 8px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 8px 22px 16px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.modal-backdrop.is-sheet {
  align-items: flex-end;
  padding: 0;
}

.is-sheet .modal {
  max-width: 560px;
  border-radius: 24px 24px 0 0;
  max-height: 88dvh;
  transform: translateY(40px);
}

.is-sheet .modal::before {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--outline);
  margin: 10px auto 0;
}

@media (min-width: 900px) {
  .modal-backdrop.is-sheet {
    align-items: center;
    padding: 16px;
  }

  .is-sheet .modal {
    border-radius: 24px;
  }

  .is-sheet .modal::before {
    display: none;
  }
}

.modal-fullscreen {
  max-width: none;
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  background: #000;
}

.modal-backdrop:has(.modal-fullscreen) {
  padding: 0;
}

.modal-fullscreen .modal-body {
  padding: 0;
  flex: 1;
  overflow: hidden;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 20px);
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 440px);
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-error {
  background: #be123c;
}

.toast-success {
  background: #047857;
}

.dropdown-menu {
  position: fixed;
  z-index: 1100;
  min-width: 230px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--outline-variant);
  padding: 6px;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 14px;
}

.dropdown-item .icon {
  color: var(--primary);
}

.dropdown-item:hover {
  background: var(--surface-variant);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(2, 6, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.busy-card {
  background: var(--surface);
  padding: 18px 22px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.action-list > button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  border-radius: 10px;
  text-align: left;
  font-weight: 500;
}

.action-list > button .icon {
  color: var(--primary);
}

.action-list > button span {
  display: flex;
  flex-direction: column;
}

.action-list > button small {
  color: var(--on-surface-variant);
}

.action-list > button:hover {
  background: var(--surface-variant);
}

.action-list > button.danger,
.action-list > button.danger .icon {
  color: var(--rose);
  font-weight: 700;
}

/* ---------- App shell ---------- */

.app {
  height: 100dvh;
  display: flex;
}

.nav {
  background: var(--surface);
  border-right: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--nav-width);
  padding: 14px 0;
  gap: 6px;
  flex-shrink: 0;
  z-index: 20;
}

.nav-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
  padding: 6px 0;
  border-radius: 14px;
  color: var(--on-surface-variant);
  font-size: 11px;
  font-weight: 600;
}

.nav-icon {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  background: var(--primary-soft);
}

.nav-item:hover .nav-icon {
  background: var(--surface-variant);
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  height: 18px;
  min-width: 18px;
  font-size: 10px;
  border: 2px solid var(--surface);
}

.nav-spacer {
  flex: 1;
}

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

.pane {
  min-width: 0;
  height: 100%;
  position: relative;
}

.pane-list {
  flex: 1;
  background: var(--surface);
}

.pane-detail {
  display: none;
}

.screen-overlay {
  display: none;
}

/* Desktop: list + conversation side by side */
@media (min-width: 900px) {
  .app[data-tab='CHAT'] .pane-list {
    flex: 0 0 400px;
    border-right: 1px solid var(--outline-variant);
  }

  .app[data-tab='CHAT'] .pane-detail {
    display: block;
    flex: 1;
  }

  .app.has-overlay .screen-overlay {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: var(--nav-width);
    z-index: 30;
    background: var(--bg);
  }

  .nav-me {
    border-radius: 50%;
  }
}

/* Mobile: bottom navigation, conversation and secondary screens full screen */
@media (max-width: 899px) {
  .app {
    flex-direction: column-reverse;
  }

  .nav {
    width: 100%;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding: 4px 4px env(safe-area-inset-bottom);
    flex-direction: row;
    justify-content: space-around;
    border-right: 0;
    border-top: 1px solid var(--outline-variant);
  }

  .nav-brand,
  .nav-spacer,
  .nav-me {
    display: none;
  }

  .nav-item {
    flex: 1;
  }

  .main {
    height: calc(100dvh - var(--nav-height) - env(safe-area-inset-bottom));
  }

  .app.has-chat .pane-detail {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
  }

  .app.has-overlay .screen-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--bg);
  }

  .toast-root {
    bottom: calc(var(--nav-height) + 16px);
  }
}

.detail-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 32px;
  background: var(--bg);
  border-bottom: 6px solid var(--cyan);
  color: var(--on-surface-variant);
}

.placeholder-logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  opacity: 0.9;
}

.detail-placeholder h2 {
  color: var(--on-surface);
  font-size: 26px;
  font-weight: 300;
}

.detail-placeholder p {
  max-width: 440px;
}

.placeholder-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
}

/* Generic secondary screen */

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
}

.header-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header-titles h1 {
  font-size: 19px;
}

.screen-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.screen-overlay .screen-body,
.pane-list .profile-view .screen-body,
.pane-list .settings-view .screen-body {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.card-title {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-row .card-title {
  margin-bottom: 0;
}

section.card {
  padding: 16px;
}

.fab {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
  z-index: 5;
}

.fab-top {
  top: 70px;
  bottom: auto;
  /* Next to the reel column (max 520px wide, centered) rather than the far edge on wide screens. */
  right: max(16px, calc(50% - 244px));
  color: #fff;
}

/* ---------- Auth ---------- */

#auth {
  position: fixed;
  inset: 0;
  overflow-y: auto;
}

.auth {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.auth-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.auth-hero h1 {
  font-size: 26px;
  font-weight: 800;
}

.auth-hero p {
  font-size: 12.5px;
  color: var(--on-surface-variant);
}

.auth-steps {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-step {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-step.current {
  background: var(--cyan);
  color: #000;
}

.auth-step.done {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
}

.auth-step.current-2 {
  background: var(--emerald);
  color: #000;
}

.auth-step-line {
  width: 18px;
  height: 2px;
  background: var(--outline-variant);
}

.auth-step-line.done {
  background: var(--emerald);
}

.auth-card {
  width: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 20px;
}

.auth-card h2 {
  font-size: 21px;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

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

.country-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: var(--surface-variant);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.country-pill .icon {
  color: var(--cyan);
}

.auth-step2-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.auth-step2-head h2 {
  text-align: left;
}

.auth-step2-head .icon-btn {
  color: var(--cyan);
}

.auth-phone-display {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
}

.otp-cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  cursor: text;
}

.otp-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--outline-variant);
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.otp-cell.filled {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
}

.otp-cell.current {
  border: 2px solid var(--cyan);
  background: rgba(14, 165, 233, 0.08);
}

.auth-resend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-error {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.12);
  color: #be123c;
  font-size: 12.5px;
  text-align: center;
}

[data-theme='dark'] .auth-error {
  color: #fda4af;
}

.auth-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--on-surface-variant);
}

.auth-footer .icon {
  color: var(--emerald);
}

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

.country-list {
  max-height: 320px;
  overflow-y: auto;
}

.country-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 12px 8px;
  border-bottom: 1px solid var(--outline-variant);
}

.country-item b {
  color: var(--primary);
}

.country-item:hover {
  background: var(--surface-variant);
}

/* ---------- Chat list ---------- */

.chat-list-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 8px 18px;
  min-height: 64px;
}

.header-title {
  flex: 1;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.list-header .icon-btn:not(.danger) {
  color: var(--primary);
}

.search-bar {
  padding: 4px 16px 6px;
}

.stories-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 16px 10px;
  border-bottom: 1px solid var(--outline-variant);
  scrollbar-width: none;
  flex-shrink: 0;
}

.story-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 74px;
  flex-shrink: 0;
}

.story-avatar-wrap {
  position: relative;
}

.story-add {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.story-name {
  font-size: 12px;
  font-weight: 500;
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

.chat-rows {
  flex: 1;
  padding-bottom: 90px;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.12s;
}

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

.chat-row.active {
  background: var(--primary-soft);
}

.chat-row.selected {
  background: rgba(14, 165, 233, 0.14);
}

.row-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.row-check.checked {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #000;
}

.row-avatar {
  display: inline-flex;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row-top,
.row-bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.row-name {
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chat-row.unread .row-name {
  font-weight: 800;
}

.row-lock {
  color: var(--emerald);
  display: inline-flex;
}

.row-time {
  margin-left: auto;
  padding-left: 8px;
  font-size: 12px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

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

.tick {
  display: inline-flex;
  flex-shrink: 0;
}

.tick-grey {
  color: var(--on-surface-variant);
  opacity: 0.6;
}

.tick-read {
  color: var(--cyan);
}

.row-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.row-preview.strong {
  color: var(--on-surface);
}

.chat-row.unread .row-preview {
  font-weight: 500;
}

/* ---------- Conversation ---------- */

.chat-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 4px;
  min-height: 62px;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface);
}

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

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

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

.peer-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 15px;
}

.peer-name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-status {
  font-size: 11px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-status .icon {
  color: var(--emerald);
}

.peer-status.online {
  color: var(--emerald);
}

.chat-body {
  flex: 1;
  min-height: 0;
  position: relative;
  background-size: cover;
  background-position: center;
}

.wallpaper-light {
  background-color: #f2f2f2;
  background-image: url('/img/chat-bg-light.webp');
}

.wallpaper-dark {
  background-color: #0b141a;
  background-image: url('/img/chat-bg-dark.webp');
}

.messages {
  position: absolute;
  inset: 0;
  padding: 10px 14px;
}

.history-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  font-size: 11.5px;
  color: var(--on-surface-variant);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
}

.msg {
  display: flex;
}

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

.bubble {
  position: relative;
  max-width: min(78%, 420px);
  padding: 10px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 90px;
  -webkit-touch-callout: none;
}

.msg-out .bubble {
  background: var(--sent-bg);
  color: var(--sent-fg);
  border-bottom-right-radius: 4px;
  --b-sub: var(--sent-sub);
  --b-inner: var(--sent-inner);
  --b-read: var(--sent-read);
  --b-reply: var(--sent-replyName);
}

.msg-in .bubble {
  background: var(--recv-bg);
  color: var(--recv-fg);
  border-bottom-left-radius: 4px;
  --b-sub: var(--recv-sub);
  --b-inner: var(--recv-inner);
  --b-read: var(--recv-read);
  --b-reply: var(--recv-replyName);
}

.msg-menu-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 22px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--b-sub);
  background: var(--b-inner);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 2;
}

.bubble:hover .msg-menu-btn,
.msg-menu-btn:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .msg-menu-btn {
    display: none;
  }
}

.inner-card {
  background: var(--b-inner);
  border-radius: 10px;
  padding: 8px 10px;
}

.reply-quote {
  border-left: 3px solid var(--cyan);
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
}

.reply-quote b {
  color: var(--b-reply);
}

.reply-quote span {
  color: var(--b-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bubble-text {
  font-size: 15px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-right: 6px;
}

.bubble-meta {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--b-sub);
}

.bubble-meta .tick {
  color: var(--b-sub);
}

.bubble-meta .tick-sending {
  opacity: 0.6;
}

.bubble-meta .tick-read-bubble {
  color: var(--b-read);
}

.bubble-image {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.06);
  min-height: 120px;
  min-width: min(220px, 100%);
}

.bubble-image img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  margin: 0 auto;
  object-fit: contain;
}

.upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bubble-media-missing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px;
  border-radius: 12px;
  background: var(--b-inner);
  color: var(--b-sub);
}

.bubble-video {
  position: relative;
  width: 260px;
  max-width: 100%;
  height: 160px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
}

.play-badge {
  color: var(--cyan);
  display: flex;
}

.bubble-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--b-inner);
  cursor: pointer;
}

.bubble-doc > .icon {
  color: var(--cyan);
}

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

.doc-text b {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-text span {
  font-size: 11px;
  color: var(--b-sub);
}

.bubble-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  min-width: 220px;
}

.audio-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.waveform {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.waveform i {
  width: 2.5px;
  height: calc(var(--h) * 100%);
  background: var(--cyan);
  border-radius: 1px;
}

.bubble-audio.playing .waveform i {
  animation: wave 0.6s ease-in-out infinite alternate;
}

.bubble-audio.playing .waveform i:nth-child(2n) {
  animation-delay: 0.15s;
}

.bubble-audio.playing .waveform i:nth-child(3n) {
  animation-delay: 0.3s;
}

@keyframes wave {
  from {
    transform: scaleY(0.3);
  }

  to {
    transform: scaleY(1);
  }
}

.audio-time {
  font-size: 11px;
  color: var(--b-sub);
}

.product-card .pc-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pc-name {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pc-price {
  color: var(--emerald);
  font-weight: 700;
  font-size: 13px;
}

.pc-origin {
  font-size: 11.5px;
  color: var(--b-sub);
  margin-top: 4px;
}

.pc-desc {
  font-size: 12px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.contact-card div {
  display: flex;
  flex-direction: column;
}

.contact-card span {
  font-size: 12px;
  color: var(--b-sub);
}

.link-preview {
  border-radius: 10px;
  overflow: hidden;
  background: var(--b-inner);
  cursor: pointer;
  max-width: 320px;
}

.lp-image {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.lp-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-domain,
.lp-loading {
  font-size: 11px;
  color: var(--b-sub);
  display: flex;
  align-items: center;
  gap: 4px;
}

.lp-title {
  font-size: 13px;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-desc {
  font-size: 11px;
  color: var(--b-sub);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-footer {
  background: var(--surface);
  border-top: 1px solid var(--outline-variant);
  padding-bottom: env(safe-area-inset-bottom);
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-variant);
}

.reply-accent {
  width: 3px;
  align-self: stretch;
  background: var(--cyan);
  border-radius: 2px;
}

.reply-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

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

.reply-text span {
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px;
}

.composer-input {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  border-radius: 22px;
  background: var(--surface-variant);
  padding: 2px 4px 2px 14px;
}

.composer-input textarea {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  padding: 9px 0;
  max-height: 120px;
  line-height: 20px;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cyan);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recording-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 14px;
  border-radius: 22px;
  background: rgba(244, 63, 94, 0.12);
  color: var(--rose);
  font-size: 13px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.blocked-banner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
  margin: 4px;
  border-radius: 16px;
  background: var(--surface-variant);
  text-align: center;
  font-size: 13px;
}

.blocked-banner b {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--rose);
}

.blocked-banner span {
  color: var(--on-surface-variant);
}

.attach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 8px;
  padding: 8px 0 12px;
}

.attach-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.attach-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-option:hover .attach-icon {
  filter: brightness(0.95);
}

.contact-share {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  text-align: left;
}

.cs-item > span:not(.avatar) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cs-item small {
  color: var(--on-surface-variant);
}

.cs-item:hover {
  background: var(--surface-variant);
}

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

.product-tile {
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pt-images {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.pt-images img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.pt-name {
  display: flex;
  align-items: center;
  gap: 4px;
}

.price {
  color: var(--emerald);
}

.safety-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  letter-spacing: 0.06em;
  line-height: 1.8;
  text-align: center;
  padding: 14px;
  margin-top: 10px;
  border-radius: 12px;
  background: var(--surface-variant);
  word-spacing: 0.4em;
}

.media-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.media-viewer img,
.media-viewer video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mv-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.mv-actions .icon-btn {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

.mv-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  white-space: pre-wrap;
}

.camera-modal {
  max-width: 640px;
}

.camera-capture {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: #fff;
}

/* ---------- Contacts ---------- */

.action-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  text-align: left;
}

.action-row span:not(.action-icon):not(.action-tail) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.action-row small {
  color: var(--on-surface-variant);
  font-size: 12px;
}

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

.action-icon,
.row-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-variant);
}

.action-tail {
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
}

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

.contact-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.contact-text b {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contact-text small {
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Stories ---------- */

.stories-view {
  height: 100%;
  background: #000;
  position: relative;
}

.stories-view.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reels {
  height: 100%;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.reels::-webkit-scrollbar {
  display: none;
}

.reel {
  position: relative;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  color: #fff;
}

.reel-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reel-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 35%, transparent 60%, rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.reel-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.reel-sound {
  position: absolute;
  top: 70px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
}

.reel-sound.on {
  opacity: 1;
  color: var(--cyan);
}

.reel-text {
  position: absolute;
  inset: 0;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reel-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reel-author {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.reel-author div {
  display: flex;
  flex-direction: column;
}

.reel-author span.reel-time {
  font-size: 12px;
  opacity: 0.7;
}

.reel-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reel-delete {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-expiry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 11px;
  white-space: nowrap;
}

.reel-expiry .icon {
  color: var(--cyan);
}

.reel-caption {
  position: absolute;
  left: 16px;
  right: 76px;
  bottom: 64px;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reel-actions {
  position: absolute;
  right: 12px;
  bottom: 64px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reel-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.ra-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.reel-action.selected .ra-icon {
  background: rgba(244, 63, 94, 0.55);
}

.reel-emoji-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.65);
}

.reel-emoji-bar button {
  font-size: 20px;
  padding: 4px;
  border-radius: 50%;
  transition: transform 0.12s;
}

.reel-emoji-bar button:hover {
  transform: scale(1.2);
}

.reel-emoji-bar button.selected {
  background: rgba(255, 255, 255, 0.2);
}

.comments {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comments-list {
  max-height: 50dvh;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.comment-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.comment p {
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.comment-form input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 22px;
  border: 1px solid var(--outline);
  background: var(--surface-variant);
  outline: none;
}

/* Create story */

.media-buttons {
  display: flex;
  gap: 10px;
}

.media-buttons .btn {
  flex: 1;
}

.story-media-preview {
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-variant);
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-media-preview img,
.story-media-preview video {
  max-width: 100%;
  max-height: 420px;
  display: block;
}

.media-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px;
  text-align: center;
  color: var(--on-surface-variant);
}

.media-empty b {
  color: var(--on-surface);
}

.gradient-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.gradient-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
}

.gradient-swatch.selected {
  border-color: var(--cyan);
}

.story-text-preview {
  border-radius: 18px;
  min-height: 320px;
  display: flex;
  padding: 24px;
}

.story-text-preview textarea {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  line-height: 32px;
}

.story-text-preview textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- Profile ---------- */

.profile-view .screen-body {
  padding: 0 0 24px;
  gap: 14px;
}

.profile-view .screen-body > .card,
.profile-view .profile-actions {
  margin: 0 16px;
}

.profile-banner {
  position: relative;
  height: 170px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  flex-shrink: 0;
}

.profile-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-banner.editable {
  cursor: pointer;
}

.banner-edit {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.on-image {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.on-image:hover {
  background: rgba(0, 0, 0, 0.6);
}

.on-image-right {
  position: absolute;
  top: 12px;
  right: 12px;
}

.profile-head {
  margin-top: -56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 0 16px;
  position: relative;
}

.profile-head h1 {
  font-size: 22px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-bio {
  max-width: 520px;
  margin-top: 4px;
  white-space: pre-wrap;
}

.profile-info:empty {
  display: none;
}

.profile-info {
  padding: 6px 14px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.info-row + .info-row {
  border-top: 1px solid var(--outline-variant);
}

.info-row > .icon {
  color: var(--primary);
}

.info-row div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.round-action {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.round-action.danger {
  background: rgba(244, 63, 94, 0.12);
  color: var(--rose);
}

.round-action.ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}

.reel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.reel-thumb {
  position: relative;
  aspect-ratio: 9 / 14;
  border-radius: 12px;
  overflow: hidden;
  color: #fff;
}

.reel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-text {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}

.thumb-days {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 10px;
}

.avatar-edit {
  position: relative;
}

.avatar-edit-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--bg);
}

.edit-profile-view .screen-body {
  padding: 0 0 24px;
}

.edit-profile-view .form-stack,
.edit-profile-view .section-label,
.edit-profile-view .preset-row {
  margin-left: 16px;
  margin-right: 16px;
}

.preset-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.preset-avatar,
.preset-banner {
  flex-shrink: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  overflow: hidden;
}

.preset-avatar img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: block;
}

.preset-banner {
  border-radius: 12px;
}

.preset-banner img {
  width: 140px;
  height: 70px;
  object-fit: cover;
  display: block;
}

.preset-avatar.selected,
.preset-banner.selected {
  border-color: var(--cyan);
}

/* ---------- Settings ---------- */

.settings-profile,
.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.settings-profile > span:not(.avatar),
.settings-row > span:not(.row-icon) {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.settings-profile > .icon {
  color: var(--primary);
}

.settings-profile:hover,
.settings-row:hover {
  background: var(--surface-variant);
}

.settings-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  width: 100%;
  text-align: left;
}

.settings-line.column {
  flex-direction: column;
  align-items: stretch;
}

.settings-line-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-line .grow,
.settings-line-head .grow {
  display: flex;
  flex-direction: column;
}

.settings-line + .settings-line,
.settings-line + .bubble-picker,
.bubble-picker + .bubble-picker {
  border-top: 1px solid var(--outline-variant);
}

.settings-line.clickable {
  cursor: pointer;
}

.bubble-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 54px;
}

.swatch-color {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch.selected .swatch-color {
  box-shadow: 0 0 0 3px var(--cyan);
}

.swatch-label {
  font-size: 10.5px;
  color: var(--on-surface-variant);
}

.bubble-preview {
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-size: cover;
}

.preview-bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.preview-bubble.in {
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.preview-bubble.out {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.label-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.label-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.label-picker {
  display: flex;
  flex-direction: column;
}

.label-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 10px;
  text-align: left;
  font-weight: 600;
}

.label-option:hover {
  background: var(--surface-variant);
}

.crypto-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--on-surface-variant);
  justify-content: center;
  text-align: center;
}

.crypto-note .icon {
  color: var(--emerald);
}

.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blocked-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.blocked-item .grow {
  display: flex;
  flex-direction: column;
}

.row-icon.cyan {
  color: var(--cyan);
}

.row-icon.emerald {
  color: var(--emerald);
}

.row-icon.violet {
  color: var(--violet);
}

.row-icon.rose {
  color: var(--rose);
}

.row-icon.amber {
  color: var(--amber);
}

/* ---------- Catalog ---------- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-head h3 {
  font-size: 16px;
}

.list-card,
.product-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.list-card .grow,
.product-card-row .grow {
  display: flex;
  flex-direction: column;
}

.product-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald);
  flex-shrink: 0;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pending-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--amber);
  background: rgba(245, 158, 11, 0.14);
  padding: 2px 6px;
  border-radius: 6px;
}

.pic-slots {
  display: flex;
  gap: 10px;
}

.pic-slot {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: var(--surface-variant);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--cyan);
  font-size: 10px;
}

.pic-slot span {
  color: var(--on-surface-variant);
}

.pic-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Call ---------- */

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #0a0f1d;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px calc(36px + env(safe-area-inset-bottom));
}

.call-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.self-preview {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 110px;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--cyan);
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 2;
}

.self-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.call-info {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.call-info h2 {
  font-size: 24px;
  margin-top: 12px;
}

.call-info p {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  font-weight: 500;
}

.call-info p .icon {
  color: var(--emerald);
}

.call-info p.connected {
  color: var(--emerald);
}

.call-controls {
  position: relative;
  margin-top: auto;
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding: 14px 16px;
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.75);
}

.call-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-btn.active-red,
.call-btn.end {
  background: var(--rose);
}

.call-btn.active-cyan {
  background: var(--cyan);
}

.call-btn.end {
  width: 58px;
  height: 58px;
}

.call-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.call-big .icon {
  width: 64px;
  height: 64px;
  padding: 16px;
  border-radius: 50%;
  box-sizing: border-box;
}

.call-big.decline .icon {
  background: var(--rose);
}

.call-big.accept .icon {
  background: var(--emerald);
  color: #000;
}

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