* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg0: #0c1120;
  --page-bot: #0b101e;
  --glow-tint: #16203c;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.075);
  --hover: rgba(255, 255, 255, 0.07);
  --hover-strong: rgba(255, 255, 255, 0.2);
  --line: rgba(255, 255, 255, 0.08);
  --line-thin: rgba(255, 255, 255, 0.06);
  --line-soft: rgba(255, 255, 255, 0.065);
  --text: #dbe2f0;
  --text-dim: #8b95b2;
  --text-faint: #5d6784;
  --blue: #5377d8;
  --blue-soft: #6c90e8;
  --blue-hi: #9fbdfc;
  --blue-rgb: 83, 119, 216;
  --border-focus: rgba(131, 165, 255, 0.5);
  --danger: #d96a82;
  --ok: #5fbfa0;
  --radius-lg: 26px;
  --radius: 16px;
  --radius-sm: 11px;
  --panel-shadow: 0 24px 60px rgba(4, 7, 16, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --tabs-bg: rgba(8, 11, 22, 0.5);
  --tabs-bg-soft: rgba(8, 11, 22, 0.45);
  --field-bg: rgba(15, 16, 19, 0.82);
  --header-bg: rgba(16, 18, 22, 0.62);
  --header-bg-solid: rgba(19, 22, 28, 0.92);
  --overlay-solid: rgba(15, 20, 38, 0.92);
--panel-solid: #151b30;
  --dot: #18263f;
  --badge-ring: #0c1120;

--wall-fx: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1.4px), radial-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1.4px);
  --wall-fx-size: 28px 28px, 28px 28px;
  --wall-fx-pos: 0 0, 14px 14px;
  --wall-grad: linear-gradient(160deg, #15203f 0%, #0f1730 55%, #0b1224 100%);
  --wall-grad-size: 100% 100%;
  --wall-grad-pos: 0 0;
}

html[data-theme="light"] {
    --wall-fx: radial-gradient(rgba(30, 42, 66, 0.07) 1px, transparent 1.4px), radial-gradient(rgba(30, 42, 66, 0.04) 1px, transparent 1.4px);
  --wall-grad: linear-gradient(160deg, #e3e8f4 0%, #d6dcec 55%, #c7d0e4 100%);
  --bg0: #eef1f7;
  --page-bot: #d9dfea;
  --glow-tint: #c9d3f0;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-2: rgba(255, 255, 255, 0.82);
  --hover: rgba(30, 42, 66, 0.1);
  --hover-strong: rgba(30, 42, 66, 0.18);
  --line: rgba(30, 42, 66, 0.14);
  --line-thin: rgba(30, 42, 66, 0.1);
  --line-soft: rgba(30, 42, 66, 0.12);
  --text: #20283a;
  --text-dim: #56607a;
  --text-faint: #8a94ab;
  --border-focus: rgba(66, 114, 223, 0.5);
  --panel-shadow: 0 24px 60px rgba(45, 60, 95, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --tabs-bg: rgba(255, 255, 255, 0.7);
  --tabs-bg-soft: rgba(255, 255, 255, 0.62);
  --field-bg: rgba(255, 255, 255, 0.85);
  --header-bg: rgba(243, 246, 252, 0.66);
  --header-bg-solid: rgba(238, 242, 250, 0.95);
  --overlay-solid: rgba(244, 247, 253, 0.95);
  --panel-solid: #f2f4fa;
  --dot: #5f6b87;
  --badge-ring: #eef1f7;
}

html[data-theme="dark"][data-tone="gray"] {
  --bg0: #14161b;
  --page-bot: #111318;
  --glow-tint: #24272f;
  --tabs-bg: rgba(20, 22, 27, 0.5);
  --tabs-bg-soft: rgba(20, 22, 27, 0.45);
  --field-bg: rgba(22, 24, 30, 0.82);
  --header-bg: rgba(22, 24, 30, 0.62);
  --header-bg-solid: rgba(24, 26, 32, 0.92);
  --overlay-solid: rgba(22, 26, 36, 0.92);
--panel-solid: #1b1e25;
  --dot: #24272f;
  --badge-ring: #14161b;
    --wall-fx: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.4px), radial-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1.4px);
  --wall-grad: linear-gradient(160deg, #20242c 0%, #181b22 55%, #13161c 100%);
}

html[data-theme="dark"][data-tone="amoled"] {
  --bg0: #000000;
  --page-bot: #060608;
  --glow-tint: #14141b;
  --tabs-bg: rgba(8, 8, 11, 0.6);
  --tabs-bg-soft: rgba(8, 8, 11, 0.5);
  --field-bg: rgba(12, 12, 16, 0.85);
  --header-bg: rgba(10, 10, 14, 0.7);
  --header-bg-solid: rgba(12, 12, 16, 0.94);
  --overlay-solid: rgba(10, 10, 14, 0.94);
--panel-solid: #0b0b0e;
  --dot: #1a1a20;
  --badge-ring: #000000;
    --wall-fx: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1.4px), radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1.4px);
  --wall-grad: linear-gradient(160deg, #0b0b12 0%, #06060a 60%, #040406 100%);
}

html[data-theme="light"][data-tone="gray"] {
    --wall-fx: radial-gradient(rgba(30, 42, 66, 0.06) 1px, transparent 1.4px), radial-gradient(rgba(30, 42, 66, 0.035) 1px, transparent 1.4px);
  --wall-grad: linear-gradient(160deg, #e5e7ed 0%, #dcdfe7 55%, #cfd3de 100%);
  --bg0: #e9eaee;
  --page-bot: #dfe1e7;
  --glow-tint: #ccd3e1;
  --tabs-bg: rgba(255, 255, 255, 0.7);
  --tabs-bg-soft: rgba(255, 255, 255, 0.62);
  --field-bg: rgba(255, 255, 255, 0.88);
  --header-bg: rgba(240, 242, 247, 0.7);
  --header-bg-solid: rgba(235, 237, 243, 0.95);
  --overlay-solid: rgba(243, 245, 250, 0.95);
  --panel-solid: #f0f1f5;
  --dot: #5f6b87;
  --badge-ring: #e9eaee;
}

html[data-theme="light"][data-tone="beige"] {
  --bg0: #efe9df;
  --page-bot: #e3dcd0;
  --glow-tint: #dfd3bb;
  --tabs-bg: rgba(255, 252, 245, 0.75);
  --tabs-bg-soft: rgba(255, 252, 245, 0.66);
  --field-bg: rgba(255, 252, 246, 0.92);
  --header-bg: rgba(247, 242, 233, 0.72);
  --header-bg-solid: rgba(243, 237, 227, 0.95);
  --overlay-solid: rgba(248, 243, 234, 0.95);
--panel-solid: #f6f1e8;
  --dot: #8a806c;
  --badge-ring: #efe9df;
    --wall-fx: radial-gradient(rgba(90, 70, 40, 0.06) 1px, transparent 1.4px), radial-gradient(rgba(90, 70, 40, 0.035) 1px, transparent 1.4px);
  --wall-grad: linear-gradient(160deg, #eee7d9 0%, #e4dccb 55%, #d8cfba 100%);
}

html,
body {
  height: 100%;
}

body {
  font-family: "SF Pro Display", "Segoe UI", "Inter", Roboto, system-ui, -apple-system, sans-serif;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(var(--blue-rgb), 0.4);
  color: #fff;
}

/* ------------- custom scrollbars ------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--hover-strong);
  border: 3px solid transparent;
  border-radius: 9px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--hover-strong);
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: var(--text-faint);
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-track:vertical {
  background: transparent;
}

@media (pointer: coarse) {
  ::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

.hidden {
  display: none !important;
}

/* ------------- icons ------------- */
svg {
  fill: none;
}

svg[fill="currentColor"] {
  fill: currentColor;
}

.voice-play svg {
  fill: currentColor;
}

/* ------------- background ------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90% 70% at 80% -10%, var(--glow-tint) 0%, transparent 55%),
    linear-gradient(175deg, var(--bg0), var(--page-bot) 70%);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------- ripple ------------- */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 3;
}

@keyframes rippleAnim {
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* ------------- auth screen ------------- */
.auth-screen {
  height: 100%;
  display: flex;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  width: 400px;
  max-width: 100%;
  margin: auto;
  padding: 40px 32px 32px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.45s var(--ease) both;
}

.auth-card.shake {
  animation: shake 0.5s both;
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(3px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.logo-mark {
  width: 62px;
  height: 62px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--blue-soft), var(--blue));
  box-shadow: inset 0 1px 0 var(--hover-strong);
  animation: logoFloat 4.5s ease-in-out infinite;
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.logo-bubble {
  position: relative;
  width: 30px;
  height: 22px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.logo-bubble i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dot);
  animation: dotBlink 2s ease-in-out infinite;
}

.logo-bubble i:nth-child(2) {
  animation-delay: 0.25s;
}

.logo-bubble i:nth-child(3) {
  animation-delay: 0.5s;
}

@keyframes dotBlink {
  0%,
  70%,
  100% {
    opacity: 0.55;
  }
  35% {
    opacity: 1;
  }
}

.logo-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 7px;
  width: 11px;
  height: 11px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom-left-radius: 7px;
  transform: rotate(14deg);
}

.brand-name {
  text-align: center;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
  animation: brandIn 0.7s 0.15s var(--ease) both;
}

@keyframes brandIn {
  from {
    opacity: 0;
    letter-spacing: 0.28em;
  }
  to {
    opacity: 1;
    letter-spacing: -0.01em;
  }
}

.auth-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 6px 0 24px;
  animation: fadeUp 0.5s 0.3s var(--ease) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------- tabs ------------- */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--tabs-bg);
  border: 1px solid var(--line-thin);
  margin-bottom: 22px;
}

.tabs-glider {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  border-radius: calc(var(--radius-sm) - 3px);
  background: var(--blue);
  box-shadow: inset 0 1px 0 var(--hover-strong);
  transition: transform 0.32s var(--ease);
  z-index: 0;
}

.tabs.with-reg .tabs-glider {
  transform: translateX(100%);
}

.tab {
  position: relative;
  z-index: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.tab.active {
  color: #fff;
}

/* ------------- form ------------- */
.auth-fields {
  animation: fieldsIn 0.35s var(--ease) both;
}

@keyframes fieldsIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  margin: 0 0 6px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.req {
  font-style: normal;
  color: var(--danger);
  margin-left: 1px;
}

.req-note {
  margin: 0 0 10px 2px;
  font-size: 11.5px;
  color: var(--text-faint);
  animation: fadeUp 0.35s var(--ease) both;
}

/* custom date picker */
.date-wrap {
  position: relative;
}

.field .date-wrap input {
  padding-right: 42px;
}

.dp-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.15s;
}

.dp-btn svg {
  width: 16px;
  height: 16px;
}

.dp-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.dp-btn:active {
  transform: translateY(-50%) scale(0.9);
}

.dp-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 400;
  width: 268px;
  padding: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.2s var(--ease) both;
}

.dp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.dp-nav {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.dp-nav svg {
  width: 14px;
  height: 14px;
}

.dp-nav:hover {
  color: var(--text);
  background: var(--hover);
}

.dp-label {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.dp-label:hover {
  background: var(--hover);
}

.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.dp-week b {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  padding: 4px 0;
}

.dp-month-grid,
.dp-year-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-year-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.dp-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.dp-cell:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dp-cell:active {
  transform: scale(0.9);
}

.dp-cell.today {
  color: var(--blue-soft);
  font-weight: 700;
}

.dp-cell.sel {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 1px 0 var(--hover-strong);
}

.dp-blank {
  pointer-events: none;
}

.dp-year {
  aspect-ratio: auto;
  border-radius: 10px;
  font-size: 12px;
  padding: 8px 0;
}

.dp-year.sel {
  background: var(--blue);
  color: #fff;
  box-shadow: inset 0 1px 0 var(--hover-strong);
}

.dp-foot {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.dp-today,
.dp-clear {
  flex: 1;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.dp-today:hover {
  color: var(--blue-soft);
  border-color: rgba(var(--blue-rgb), 0.4);
  background: rgba(var(--blue-rgb), 0.1);
}

.dp-clear:hover {
  color: var(--danger);
  border-color: rgba(217, 106, 130, 0.4);
  background: rgba(217, 106, 130, 0.08);
}

input[type="date"] {
  color-scheme: dark;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:hover {
  border-color: var(--hover);
}

.field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.16);
}

/* Белое автозаполнение (бывает на светлой теме) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
  box-shadow: 0 0 0 1000px var(--field-bg) inset;
  border-color: var(--line);
  transition: background-color 9999s ease-in-out 0s;
}

input:-webkit-autofill:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1000px var(--field-bg) inset, 0 0 0 3px rgba(var(--blue-rgb), 0.16);
}

/* password eye */
.pass-field {
  position: relative;
}

.pass-field input {
  padding-right: 44px;
}

.eye-btn {
  position: absolute;
  right: 8px;
  top: 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}

.eye-btn svg {
  width: 18px;
  height: 18px;
}

.eye-btn .eye-off {
  display: none;
}

.eye-btn.on .eye-open {
  display: none;
}

.eye-btn.on .eye-off {
  display: block;
}

.eye-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.eye-btn:active {
  transform: scale(0.9);
}

/* hide native browser password eye / clear buttons */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input::-ms-clear {
  display: none;
}

input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none !important;
}

/* avatar color picker */
.color-field {
  margin-bottom: 12px;
}

.theme-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--tabs-bg);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.tone-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--tabs-bg);
  border: 1px solid var(--line);
  gap: 2px;
  width: fit-content;
}

.seg-btn {
  border: none;
  background: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: linear-gradient(135deg, var(--blue-soft), var(--blue));
  color: #fff;
  box-shadow: 0 3px 10px rgba(var(--blue-rgb), 0.35);
}

.seg-btn.active:hover {
  color: #fff;
}

.theme-opt:hover {
  color: var(--text);
  border-color: var(--line-soft);
}

.theme-opt.selected {
  color: var(--text);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.16);
}

.theme-dot {
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.22), inset 2px 2px 3px rgba(255, 255, 255, 0.6);
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 6px;
  background: var(--tabs-bg-soft);
  border: 1px solid var(--line-thin);
  border-radius: 12px;
}

.swatch {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: transform 0.18s var(--ease), box-shadow 0.18s;
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch.selected {
  transform: scale(1.15);
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--hover-strong);
  animation: swPop 0.3s var(--ease);
}

@keyframes swPop {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1.15);
  }
}

/* custom checkbox */
.agree {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px 2px;
  cursor: pointer;
  user-select: none;
}

.agree input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.agree-box {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--tabs-bg);
  color: #fff;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.agree-box svg {
  width: 13px;
  height: 13px;
  opacity: 0;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 0.3s 0.05s var(--ease), opacity 0.2s;
}

.agree input:checked ~ .agree-box {
  background: var(--blue);
  border-color: var(--blue);
}

.agree input:checked ~ .agree-box svg {
  opacity: 1;
  stroke-dashoffset: 0;
}

.agree:active .agree-box {
  transform: scale(0.92);
}

.agree-text {
  font-size: 12.5px;
  color: var(--text-dim);
  transition: color 0.2s;
}

.agree:hover .agree-text {
  color: var(--text);
}

/* buttons */
.btn-primary,
.send-btn {
  position: relative;
  overflow: hidden;
}

.btn-primary {
  width: 100%;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--hover-strong);
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--hover-strong);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: var(--blue-soft);
  box-shadow: 0 8px 22px rgba(var(--blue-rgb), 0.3), inset 0 1px 0 var(--hover-strong);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--hover);
  box-shadow: none;
}

.btn-block {
  display: flex;
}

.btn-arrow {
  transition: transform 0.25s var(--ease);
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.error {
  min-height: 18px;
  margin: -2px 0 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
}

.error:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.error.ok {
  color: var(--ok);
}

/* ------------- app layout ------------- */
.app {
  display: flex;
  gap: 14px;
  height: 100%;
  height: 100dvh;
  padding: 14px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-sm);
  color: #fff;
  background: linear-gradient(135deg, var(--blue-soft), var(--blue));
  box-shadow: 0 4px 14px rgba(var(--blue-rgb), 0.45);
}

.brand-logo svg {
  width: 16px;
  height: 16px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--blue-hi), var(--blue-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar {
  width: 300px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  animation: riseIn 0.45s var(--ease) both;
}

.btn-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
}

.btn-icon svg {
  width: 17px;
  height: 17px;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--hover);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: scale(0.92);
}

.back-btn {
  display: grid;
  flex: none;
}

.btn-icon.danger:hover {
  color: var(--danger);
  border-color: rgba(217, 106, 130, 0.4);
  background: rgba(217, 106, 130, 0.08);
}

.profile-prev {
  display: flex;
  align-items: center;
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
}

.online-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--badge-ring);
}

.me-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.me-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-login {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  position: relative;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

.sidebar-title {
  padding: 16px 18px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ------------- боковое меню ------------- */
.sidebar-nav {
  display: flex;
  gap: 6px;
  padding: 12px 16px 6px;
}

.snav {
  flex: 1;
  padding: 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.snav-badge {
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex: none;
}

.snav.active {
  background: rgba(var(--blue-rgb), 0.14);
  border-color: rgba(var(--blue-rgb), 0.3);
  color: var(--text);
}

.snav:not(.active):hover {
  color: var(--text);
  background: var(--hover);
}

.sidebar-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#paneChats {
  flex: 1;
  min-height: 0;
}

#paneChats .chats {
  flex: 1;
  min-height: 0;
}

#paneFriends {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

#paneFriends .chats {
  flex: none;
  overflow: visible;
  padding-bottom: 2px;
}

#paneFriends .sidebar-title {
  padding-top: 14px;
}

.friend-search {
  position: relative;
  margin: 8px 14px 4px;
}

.friend-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.friend-search input:focus {
  border-color: rgba(var(--blue-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.18);
}

.friend-search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.friend-search input::placeholder {
  color: var(--text-faint);
}

.friend-results {
  padding: 2px 10px;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.friend-row:hover {
  background: var(--hover);
}

.friend-row .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.friend-meta {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-login {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.friend-act {
  flex: none;
  display: flex;
  gap: 6px;
  align-items: center;
}

.fbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--tabs-bg);
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
}

.fbtn:hover {
  color: var(--text);
  border-color: var(--hover-strong);
  transform: translateY(-1px);
}

.fbtn.primary {
  background: rgba(var(--blue-rgb), 0.16);
  border-color: rgba(var(--blue-rgb), 0.4);
  color: var(--text);
}

.fbtn.primary:hover {
  background: rgba(var(--blue-rgb), 0.26);
}

.fbtn.ok {
  background: rgba(95, 191, 160, 0.14);
  border-color: rgba(95, 191, 160, 0.4);
  color: var(--ok);
}

.fbtn.danger {
  color: var(--danger);
}

.fbtn.danger:hover {
  background: rgba(217, 106, 130, 0.1);
  border-color: rgba(217, 106, 130, 0.4);
}

.fbtn[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.friend-status {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 600;
}

.friend-empty {
  padding: 16px 12px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.5;
}

/* ------------- chat items ------------- */
.chats {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  animation: rowIn 0.4s var(--ease) both;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chat-item:hover {
  background: var(--hover);
  transform: translateX(3px);
}

.chat-item.active {
  background: rgba(var(--blue-rgb), 0.14);
  border-color: rgba(var(--blue-rgb), 0.3);
}

.chat-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 55%;
  border-radius: 3px;
  background: var(--blue);
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-badge {
  background: var(--blue);
  color: white;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: 8px;
}

.chat-pin {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  margin-left: 8px;
  flex: none;
}

.chat-pin svg {
  width: 14px;
  height: 14px;
}

.chat-mute {
  display: inline-flex;
  align-items: center;
  color: var(--text-faint);
  flex: none;
}

.chat-mute svg {
  width: 14px;
  height: 14px;
}

.chat-item .chat-mute {
  margin-left: 8px;
}

.header-actions .chat-mute {
  width: 30px;
  justify-content: center;
}

.chat-item .avatar {
  position: relative;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease);
}

.chat-item:hover .avatar {
  transform: scale(1.05);
}

.chat-item .avatar.online {
  box-shadow: inset 0 1px 1px var(--hover-strong), 0 0 0 2px var(--bg0), 0 0 0 4px var(--ok);
}

.chat-item .avatar.online img,
.chat-item .avatar.online video {
  border-radius: 50%;
}

/* ------------- crop modal ------------- */
.crop-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 44px 16px;
}

.crop-modal.hidden {
  display: none;
}

.crop-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-user-select: none;
  user-select: none;
}

.crop-panel {
  position: relative;
  margin: 0 auto;
  width: min(460px, 92vw);
  max-width: 92vw;
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crop-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.crop-area {
  position: relative;
  display: inline-block;
  align-self: center;
  max-width: 100%;
  line-height: 0;
  background: var(--bg0);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}

#cropCanvas {
  display: block;
  max-width: 100%;
  max-height: 62vh;
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
}

.crop-box {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid var(--blue);
  background: transparent;
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--blue);
  border: 2px solid white;
  border-radius: 50%;
}

.crop-handle.nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}

.crop-handle.ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}

.crop-handle.sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}

.crop-handle.se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}

.crop-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ------------- wall crop modal ------------- */
.wall-crop-panel {
  width: min(860px, 94vw);
}

.wall-crop-body {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.wall-crop-body .crop-area {
  background: var(--bg0);
}

#wallCropCanvas {
  display: block;
  max-width: 100%;
  max-height: 58vh;
}

.wall-crop-preview {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wall-crop-preview-label {
  font-size: 13px;
  color: var(--text-dim);
}

.wall-crop-live {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg0);
  box-shadow: var(--panel-shadow);
}

#wallCropLiveCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.wall-crop-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
}

.wcb {
  max-width: 72%;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.35;
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.wcb-in {
  align-self: flex-start;
  background: var(--hover-strong);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.wcb-out {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.wall-crop-preview-hint {
  font-size: 12px;
  color: var(--text-dim2, var(--text-dim));
}

@media (max-width: 640px) {
  .wall-crop-body {
    flex-direction: column;
  }
}

#videoPreview {
  display: block;
  max-width: 400px;
  max-height: 400px;
}

.video-trim {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trim-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trim-label {
  font-size: 13px;
  color: var(--text-dim);
  min-width: 110px;
}

.trim-row input[type="range"] {
  flex: 1;
  accent-color: var(--blue);
}

.trim-hint {
  font-size: 12px;
  color: var(--text-faint);
}

/* ------------- video modal ------------- */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-modal.hidden {
  display: none;
}

.video-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
}

.video-container {
  position: relative;
  width: 90vw;
  height: 90vh;
  max-width: 1280px;
  max-height: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}

.fullscreen-video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  padding: 6px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s;
}

.fullscreen-video-wrapper:hover .fullscreen-video-controls,
.fullscreen-video-wrapper.playing .fullscreen-video-controls,
.fullscreen-video-wrapper.scrubbing .fullscreen-video-controls {
  opacity: 1;
}

.fullscreen-progress-row {
  width: 100%;
}

.fullscreen-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fs-spacer {
  flex: 1;
}

.fullscreen-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fullscreen-play-btn .ico-pause {
  display: none;
}

.fullscreen-play-btn.playing .ico-play {
  display: none;
}

.fullscreen-play-btn.playing .ico-pause {
  display: block;
}

.fullscreen-progress {
  width: 100%;
  height: 6px;
  padding: 11px 0;
  background-clip: content-box;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  touch-action: none;
}

.fullscreen-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  bottom: 11px;
  border-radius: 3px;
}

.fullscreen-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #5aa7ff);
  border-radius: 3px;
  width: 0%;
  transition: width 0.22s linear;
}

.fullscreen-progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.22s linear;
  z-index: 2;
}

.fullscreen-progress.seeking .fullscreen-progress-bar,
.fullscreen-progress.seeking .fullscreen-progress-handle {
  transition: none;
}

.fullscreen-progress.seeking .fullscreen-progress-handle {
  transform: translate(-50%, -50%) scale(1.25);
}

.fullscreen-time {
  color: white;
  font-size: 13px;
  font-weight: 500;
  min-width: 74px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fs-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.fs-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.fs-btn svg {
  width: 20px;
  height: 20px;
}

#fsMuteBtn .ico-vol-off,
#fsMuteBtn.off .ico-vol-on {
  display: none;
}

#fsMuteBtn.off .ico-vol-off {
  display: block;
}

.vol-wave {
  opacity: 0.85;
}

.fs-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.fs-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.fs-volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.fs-volume::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.fs-speed-btn {
  min-width: 46px;
  height: 38px;
  padding: 0 8px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.fs-speed-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

#fsFullscreenBtn .ico-fs-off {
  display: none;
}

#fsFullscreenBtn.on .ico-fs-on {
  display: none;
}

#fsFullscreenBtn.on .ico-fs-off {
  display: block;
}

@media (min-width: 900px) {
  .fs-volume {
    width: 110px;
  }
}

@media (max-width: 640px) {
  .fullscreen-video-controls {
    padding: 4px 8px 10px;
    gap: 2px;
  }
  .fullscreen-toolbar {
    gap: 5px;
  }
  .fullscreen-play-btn {
    width: 36px;
    height: 36px;
  }
  .fullscreen-time {
    min-width: 62px;
    font-size: 12px;
  }
  .fs-btn {
    width: 34px;
    height: 34px;
  }
  .fs-btn svg {
    width: 18px;
    height: 18px;
  }
  .fs-volume {
    width: 54px;
  }
  .fs-speed-btn {
    min-width: 38px;
    height: 34px;
    padding: 0 6px;
    font-size: 12px;
  }
  .video-close {
    width: 34px;
    height: 34px;
  }
  .fullscreen-progress {
    padding: 10px 0;
  }
  #fsFullscreenBtn {
    display: none;
  }
}

.video-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.video-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ------------- custom video player in chat ------------- */
.custom-video-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg0);
}

.custom-video {
  width: 100%;
  display: block;
  max-height: 300px;
  object-fit: contain;
  cursor: pointer;
}

/* Галерея медиа (сетка фото/видео) */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  width: 100%;
}

.media-grid .media-grid-cell:last-child:nth-child(odd) {
  grid-column: span 2;
}

.media-grid-cell {
  position: relative;
  overflow: hidden;
  padding-bottom: 100%;
}

.media-grid-cell .msg-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  cursor: zoom-in;
  border-radius: 0;
}

/* Панель прикрепления файла к сообщению */
.attach-bar {
  flex: 0 0 100%;
  order: -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 8px;
}

.attach-bar.hidden {
  display: none;
}

.attach-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: 2px 0;
}

.attach-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.attach-option:hover {
  color: var(--text);
}

.attach-option input {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex: none;
}

.attach-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg0);
  border: 1px solid var(--line);
}

.attach-thumb img,
.attach-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.attach-thumb.video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.attach-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

.attach-remove svg {
  width: 12px;
  height: 12px;
}

/* ------------- confirm modal ------------- */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal.hidden {
  display: none;
}

.confirm-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
}

.confirm-panel {
  position: relative;
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  padding: 22px 24px;
  width: min(380px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: confirmPop 0.18s ease-out;
}

@keyframes confirmPop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.confirm-panel h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.confirm-actions .btn-danger {
  padding: 9px 18px;
}

.confirm-actions .btn-danger.solid {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.confirm-actions .btn-danger.solid:hover {
  background: var(--danger);
  filter: brightness(1.1);
}

.btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid var(--line, rgba(128, 128, 128, 0.3));
  border-radius: 10px;
  background: transparent;
  color: var(--text-main, var(--text));
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-cancel:hover {
  background: rgba(128, 128, 128, 0.12);
}

/* ------------- media editor modal ------------- */
.media-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-editor-modal.hidden {
  display: none;
}

/* ------------- logs modal ------------- */
.modal-logs {
  position: relative;
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.logs-textarea {
  background: var(--bg-solid);
  border-radius: var(--radius-md);
  padding: 12px;
  max-height: 60vh;
  max-width: 100%;
  width: 100%;
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  resize: none;
  color: var(--text-main);
}

.media-editor-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
}

.media-editor-panel {
  position: relative;
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.media-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.media-editor-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.media-editor-canvas-container {
  position: relative;
  width: min(600px, calc(100vw - 64px));
  height: min(400px, 62vh);
  background: var(--bg0);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#mediaEditorCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-editor-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.media-editor-tools .tool-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--hover);
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.media-editor-tools .tool-btn:hover {
  background: var(--hover-strong);
}

.media-editor-tools .tool-btn.active {
  background: var(--blue);
  color: white;
}

.editor-color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-color-picker input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.editor-brush-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-brush-size input[type="range"] {
  width: 100px;
}

.media-editor-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ------------- avatar ------------- */
.avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  background: linear-gradient(140deg, var(--blue-soft), var(--blue));
  box-shadow: inset 0 1px 1px var(--hover-strong);
  transition: transform 0.2s var(--ease);
}

.user-box:hover .avatar {
  transform: scale(1.05);
}

.avatar.ring {
  box-shadow: 0 0 0 1px var(--hover-strong), inset 0 1px 1px var(--hover-strong);
}

.avatar.big {
  width: 84px;
  height: 84px;
  font-size: 30px;
  border-radius: 26px;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

#meAvatar,
#friendAvatar,
.msg-avatar {
  cursor: pointer;
}

#meAvatar:hover,
#friendAvatar:hover,
.msg-avatar:hover {
  transform: scale(1.08);
}

/* ------------- chat main ------------- */
.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  position: relative;
  animation: riseIn 0.45s 0.06s var(--ease);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--header-bg);
  backdrop-filter: blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(4px) saturate(140%);
  position: relative;
  z-index: 3;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chat-header {
    background: var(--header-bg-solid);
  }
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-weight: 600;
  font-size: 16px;
}

.friend-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ok);
}

.friend-status.typing {
  color: var(--text-dim);
}

.friend-status.offline {
  color: var(--text-faint);
}

.friend-status.offline .pulse-dot {
  background: var(--text-faint);
}

.friend-status.offline .pulse-dot::after {
  display: none;
}

.typing-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px 3px 9px;
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.tdot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: tBounce 1.1s ease-in-out infinite;
}

.tdot:nth-child(2) {
  animation-delay: 0.15s;
}

.tdot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes tBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-chip {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, background 0.2s, transform 0.15s;
}

.header-chip:hover {
  color: var(--text);
  background: var(--hover);
  transform: translateY(-1px);
}

.header-chip svg {
  width: 16px;
  height: 16px;
}

/* ------------- messages ------------- */
.messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.wall-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--wall-base, #0b1224);
  background-image: var(--wall-glow, none), var(--wall-fx), var(--wall-grad);
  background-size: var(--wall-glow-size, 100% 100%), var(--wall-fx-size, 28px 28px, 28px 28px), var(--wall-grad-size, 100% 100%);
  background-position: var(--wall-glow-pos, 0 0), var(--wall-fx-pos, 0 0, 14px 14px), var(--wall-grad-pos, 0 0);
  background-repeat: no-repeat, var(--wall-fx-repeat, repeat), no-repeat;
}

.messages {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  font-weight: 500;
}

/* ------------- chat loading skeleton ------------- */
.chat-skeleton {
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
  user-select: none;
  flex: none;
}

.chat-skeleton .sk-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-skeleton .sk-row.mine {
  justify-content: flex-end;
}

.sk-bubble {
  height: 46px;
  width: 45%;
  border-radius: 17px;
  background: linear-gradient(100deg, var(--glass) 20%, var(--hover) 42%, var(--glass) 65%);
  background-size: 300% 100%;
  animation: skShimmer 1.6s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.sk-bubble::after {
  content: "";
  position: absolute;
  inset: 9px 16px auto;
  height: 8px;
  border-radius: 6px;
  background: var(--glass-2);
  opacity: 0.9;
}

.chat-skeleton .sk-row.mine .sk-bubble {
  width: 36%;
}

.chat-skeleton .sk-row:nth-child(3n) .sk-bubble {
  width: 52%;
}

.chat-skeleton .sk-sep {
  align-self: center;
  width: 90px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--glass) 25%, var(--hover) 45%, var(--glass) 65%);
  background-size: 300% 100%;
  animation: skShimmer 1.6s ease-in-out infinite;
}

@keyframes skShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.msg-new-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 18px 4px;
  color: var(--blue-soft);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  user-select: none;
  pointer-events: none;
}

.msg-new-bar::before,
.msg-new-bar::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.msg-new-bar span {
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  white-space: nowrap;
}

/* ------------- date separators ------------- */
.msg-date-sep {
  display: flex;
  justify-content: center;
  margin: 2px 0 6px;
  flex: none;
  user-select: none;
  pointer-events: none;
}

.msg-date-sep span {
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--overlay-solid);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* ------------- jump to last message ------------- */
.jump-down {
  position: absolute;
  right: 18px;
  bottom: 92px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--overlay-solid);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.25s var(--ease) both;
  transition: transform 0.18s var(--ease), background 0.18s, color 0.18s;
}

.jump-down:hover {
  background: var(--panel-solid);
  color: var(--blue-hi);
  transform: translateY(-2px);
}

.jump-down:active {
  transform: translateY(0) scale(0.94);
}

.jump-down svg {
  width: 20px;
  height: 20px;
}

.msg-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  will-change: transform;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.swipe-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.swipe-arrow svg {
  width: 18px;
  height: 18px;
}

.swipe-arrow.ready {
  opacity: 1;
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(74, 144, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.msg-row.swipe-ready {
  transition: transform 0.18s var(--ease);
}

.msg-row.mine {
  justify-content: flex-end;
  animation: msgInMine 0.4s var(--ease) both;
}

.msg-row.theirs {
  justify-content: flex-start;
  animation: msgInOther 0.4s var(--ease) both;
}

@keyframes msgInMine {
  from {
    opacity: 0;
    transform: translateY(12px) translateX(30px) scale(0.95);
  }
  60% {
    transform: translateY(-2px) translateX(-4px) scale(1.01);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes msgInOther {
  from {
    opacity: 0;
    transform: translateY(12px) translateX(-30px) scale(0.95);
  }
  60% {
    transform: translateY(-2px) translateX(4px) scale(1.01);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

.msg-row.msg-flash .msg-bubble {
  animation: msgFlash 1.6s var(--ease);
}

@keyframes msgFlash {
  0%,
  100% {
    box-shadow: none;
  }
  25% {
    box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.8), 0 0 30px rgba(var(--blue-rgb), 0.4);
  }
  55% {
    box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.5), 0 0 16px rgba(var(--blue-rgb), 0.25);
  }
}

.msg-bubble {
  max-width: min(64%, 470px);
  padding: 11px 15px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  border-radius: 17px;
  position: relative;
}

.msg-row.mine .msg-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.msg-row.mine .msg-bubble::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -6px;
  width: 13px;
  height: 13px;
  background: var(--blue);
  border-radius: 3.5px;
  transform: rotate(45deg);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1);
}

.msg-row.theirs .msg-bubble {
  background: var(--glass-2);
  border: 1px solid var(--line-thin);
  border-bottom-left-radius: 5px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.msg-row.theirs .msg-bubble::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: -6px;
  width: 13px;
  height: 13px;
  background: var(--glass-2);
  border-radius: 3.5px;
  transform: rotate(45deg);
  box-shadow: 1px 1px 0 0 var(--line-thin);
}

.msg-time {
  display: block;
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.55;
}

.msg-row.mine .msg-time {
  text-align: right;
}

.msg-ticks {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -1px;
  color: inherit;
  opacity: 0.6;
  vertical-align: middle;
}

.msg-ticks.read {
  color: inherit;
  opacity: 1;
}

.msg-ticks.sending {
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  animation: tSpin 0.8s linear infinite;
}

@keyframes tSpin {
  to {
    transform: rotate(360deg);
  }
}

.msg-quote {
  background: var(--hover);
  border-left: 3px solid currentColor;
  padding: 5px 10px 6px;
  border-radius: 8px;
  margin-bottom: 6px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s, transform 0.18s;
}

.msg-quote:hover {
  background: var(--hover-strong);
  transform: translateY(-1px);
}

.msg-row.mine .msg-quote {
  background: var(--hover-strong);
}

.mq-name {
  font-size: 11.5px;
  font-weight: 600;
  color: inherit;
  opacity: 0.75;
  margin-bottom: 1px;
}

.mq-text {
  font-size: 12.5px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-edited {
  font-style: normal;
  font-size: 9.5px;
  opacity: 0.7;
  margin-right: 5px;
}

/* ------------- composer ------------- */
.composer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 13px 18px 15px;
  border-top: 1px solid var(--line-soft);
}

.lock-note {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.composer.locked .composer-bar,
.composer.locked .mic-btn,
.composer.locked .send-btn,
.composer.locked .attach-btn {
  display: none;
}

.composer.locked .lock-note {
  display: flex;
}

.mode-chip {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 60px);
  padding: 8px 10px 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--overlay-solid);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
  z-index: 30;
  animation: riseIn 0.22s var(--ease) both;
  font-size: 13px;
  color: var(--text-dim);
}

.mode-chip .chip-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
}

.mode-chip .chip-mark svg {
  width: 13px;
  height: 13px;
}

.mode-chip .chip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-chip .chip-text b {
  color: var(--text);
  font-weight: 600;
}

.mode-chip .chip-cancel {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s, background 0.15s;
}

.mode-chip .chip-cancel:hover {
  color: var(--danger);
  background: rgba(217, 106, 130, 0.14);
}

.mode-chip .chip-cancel svg {
  width: 13px;
  height: 13px;
}

.composer-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  background: var(--tabs-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 5px 3px 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.composer-bar:hover {
  border-color: var(--hover);
}

.composer-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.15);
}

.composer-bar #input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.35;
}

.composer-bar #input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}

.composer-bar #input .emoji-img {
  height: 22px;
  width: auto;
  vertical-align: -5px;
  display: inline-block;
}

.send-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--hover-strong);
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--hover-strong);
  transition: background 0.2s, transform 0.2s var(--ease);
}

.send-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}

.send-btn:hover {
  background: var(--blue-soft);
  transform: translateY(-2px);
}

.send-btn:hover svg {
  transform: translate(2px, -2px);
}

.send-btn:active {
  transform: scale(0.95);
}

/* ------------- profile: страница профиля ------------- */
.profile-page {
  height: 100%;
  overflow-y: auto;
  padding: 18px 16px 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

.profile-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(620px, 100%);
  margin: -4px auto 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--header-bg);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(4px) saturate(140%);
  box-shadow: var(--panel-shadow);
  animation: none;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .profile-topbar {
    background: var(--header-bg-solid);
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, transform 0.15s var(--ease);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.back-link:hover {
  color: var(--text);
  transform: translateX(-3px);
}

.profile-topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-name {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
}

.btn-outline {
  padding: 9px 16px;
  border: 1px solid var(--hover);
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-outline:hover {
  color: var(--danger);
  border-color: rgba(217, 106, 130, 0.4);
  background: rgba(217, 106, 130, 0.08);
}

.profile-shell {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 26px 30px 30px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.45s 0.06s var(--ease) both;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
  animation: fadeUp 0.45s 0.12s var(--ease) both;
}

.profile-hero .avatar {
  animation: heroPop 0.5s 0.2s var(--ease) both;
}

@keyframes heroPop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  margin-top: 14px;
}

.profile-login {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 3px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 12px;
}

.psec {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--hover);
  margin-bottom: 14px;
  animation: fadeUp 0.45s var(--ease) both;
}

.psec:nth-of-type(2) {
  animation-delay: 0.1s;
}

.psec h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.form-msg {
  min-height: 0;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.25s, transform 0.25s;
}

.form-msg:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.form-msg.ok {
  color: var(--ok);
}

.form-msg.err {
  color: var(--danger);
}

/* ------------- шапка: чипы навигации ------------- */
a.header-chip {
  text-decoration: none;
}

.avatar img,
.avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar video {
  pointer-events: none;
}

/* saved accounts */
.saved-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 2px;
  animation: fadeUp 0.35s var(--ease) both;
}

.saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line-thin);
  border-radius: 999px;
  background: var(--hover);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.saved-chip:hover {
  background: var(--hover);
  transform: translateY(-1px);
}

.saved-chip .avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.saved-name {
  font-size: 12.5px;
  font-weight: 600;
}

.saved-x {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: color 0.2s, background 0.15s;
}

.saved-x:hover {
  color: var(--danger);
  background: rgba(217, 106, 130, 0.15);
}

/* password generator + strength */
.gen-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-thin);
  border-radius: 10px;
  background: var(--hover);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

.gen-btn-text svg {
  width: 15px;
  height: 15px;
}

.gen-btn-text:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--hover);
  transform: translateY(-1px);
}

.gen-btn-text:active {
  transform: scale(0.97);
}

/* forgot / reset password */
.forgot-btn {
  align-self: flex-start;
  margin-top: -2px;
  padding: 4px 2px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.forgot-btn:hover {
  color: var(--blue);
}

.auth-mode-hint {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
}

.back-link-btn {
  margin-top: 4px;
  padding: 5px 2px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.back-link-btn:hover {
  color: var(--blue);
}

.pw-strength {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}

.pw-strength i {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--hover);
  transition: background 0.25s;
}

.pw-strength i.lv1 {
  background: var(--danger);
}

.pw-strength i.lv2 {
  background: #e8a44c;
}

.pw-strength i.lv3 {
  background: var(--blue-soft);
}

.pw-strength i.lv4 {
  background: var(--ok);
}

.pw-strength span {
  flex: none;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-left: 5px;
  min-width: 52px;
  text-align: right;
  transition: color 0.2s;
}

.pw-hint {
  font-size: 12px;
  margin-top: 7px;
  min-height: 16px;
  transition: color 0.2s;
}

.pw-hint.bad {
  color: var(--danger);
}

.pw-hint.good {
  color: var(--ok);
}

/* composer tools */
.tool-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.tool-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn.recording {
  color: var(--danger);
  animation: recPulse 0.8s ease-in-out infinite;
}

/* mic button: tap = switch voice/circle, hold = record */
.mic-btn {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.mic-btn .ico-circle {
  display: none;
}

.mic-btn.circle-mode .ico-mic {
  display: none;
}

.mic-btn.circle-mode .ico-circle {
  display: block;
}

.mic-btn.circle-mode {
  color: var(--blue);
}

.mic-btn.circle-mode:hover {
  color: var(--blue);
}

.composer.recording .mic-btn,
.composer.recording .mic-btn:hover {
  color: var(--danger);
  background: var(--hover);
}

.composer-bar {
  position: relative;
}

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 292px;
  max-width: 76vw;
  padding: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  z-index: 40;
  animation: riseIn 0.22s var(--ease) both;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 204px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.emoji-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding: 6px 0;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.emoji-cell .emoji-art {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.emoji-cell:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.18);
}

.emoji-cat .emoji-art {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.emoji-img {
  height: 1.25em;
  width: auto;
  vertical-align: -0.25em;
  display: inline-block;
  object-fit: contain;
}

.mq-text .emoji-img {
  height: 1em;
  vertical-align: -0.15em;
}

.emoji-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.emoji-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.emoji-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--tabs-bg);
  border: 1px solid var(--hover);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.emoji-search::placeholder {
  color: var(--text-faint);
}

.emoji-search:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.15);
}

.emoji-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 2px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.emoji-recent .emoji-cell {
  width: 32px;
  font-size: 18px;
  padding: 4px 0;
}

.emoji-tag {
  width: 100%;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 2px 4px;
}

.emoji-empty {
  padding: 16px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

.emoji-cats {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.emoji-cat {
  width: 100%;
  padding: 6px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}

.emoji-cat:hover {
  opacity: 0.85;
  background: var(--hover);
}

.emoji-cat.active {
  opacity: 1;
  transform: translateY(-1px);
  background: var(--hover);
}

.record-box {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
}

.composer.recording .composer-bar {
  display: none;
}

.composer.recording .send-btn {
  display: none;
}

.composer.recording .record-box {
  display: block;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 8px;
  right: 8px;
  padding: 8px 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  overflow: visible;
  z-index: 40;
  animation: riseIn 0.16s var(--ease) both;
  transition: background 0.2s, border-color 0.2s;
}

.record-box.cancel-armed {
  background: rgba(217, 106, 130, 0.14);
  border-color: rgba(217, 106, 130, 0.4);
}

.record-box.lock-armed {
  border-color: rgba(95, 191, 160, 0.4);
}

.rec-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  transition: transform 0.16s var(--ease);
}

.rec-swap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 12px;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transform: translateX(-10px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.record-box.cancel-armed .rec-swap,
.record-box.lock-armed .rec-swap {
  opacity: 1;
  transform: translateX(0);
}

.rec-swap-card {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--hover);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  transform: scale(0.9);
  transition: transform 0.18s var(--ease), background 0.18s, color 0.18s;
}

.record-box.cancel-armed .rec-swap-card {
  background: rgba(217, 106, 130, 0.18);
  color: var(--danger);
  animation: recCancelShake 0.44s ease-in-out infinite;
}

.record-box.lock-armed .rec-swap-card {
  background: rgba(95, 191, 160, 0.18);
  color: var(--ok);
  transform: scale(1.06);
}

@keyframes recCancelShake {
  0%,
  100% {
    transform: scale(1.06) translateX(0) rotate(0deg);
  }
  30% {
    transform: scale(1.06) translateX(-2px) rotate(-2.5deg);
  }
  70% {
    transform: scale(1.06) translateX(2px) rotate(2.5deg);
  }
}

.rec-swap-cancel,
.rec-swap-lock {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-swap-lock {
  display: none;
}

.record-box.lock-armed .rec-swap-cancel {
  display: none;
}

.record-box.lock-armed .rec-swap-lock {
  display: flex;
}

.rec-swap-card svg {
  width: 17px;
  height: 17px;
}

.rec-actions {
  display: none;
  align-items: center;
  gap: 8px;
  flex: none;
}

.composer.rec-locked .rec-actions {
  display: flex;
}

.rec-stage {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  background: radial-gradient(circle at 50% 46%, rgba(6, 9, 17, 0.52), rgba(6, 9, 17, 0.18) 56%, rgba(6, 9, 17, 0) 78%);
  animation: fadeIn 0.2s var(--ease) both;
}

.rec-stage.hidden {
  display: none;
}

.rec-stage-inner {
  position: relative;
  width: min(56vw, 38vh, 380px);
  height: min(56vw, 38vh, 380px);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.rec-circle-prev {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #05070d;
  border: 2px solid var(--danger);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  animation: recStageIn 0.24s var(--ease) both;
}

.rec-circle-prev video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #05070d;
}

@keyframes recStageIn {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.rec-stage-btns {
  position: absolute;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  transform: translateY(-50%);
}

.rec-stage-btns.left {
  right: calc(100% + 12px);
}

.rec-stage-btns.right {
  left: calc(100% + 12px);
}

.rec-stage-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(14, 18, 32, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
  transition: background 0.2s, color 0.2s, transform 0.15s, opacity 0.2s;
}

.rec-stage-btn svg {
  width: 20px;
  height: 20px;
}

.rec-stage-btn:hover:not(:disabled) {
  transform: scale(1.07);
}

.rec-stage-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.rec-stage-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.rec-stage-btn.active {
  background: var(--blue);
  border-color: transparent;
}

.rec-stage-btn.busy {
  opacity: 0.5;
}

.rec-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--danger);
  animation: recPulse 1s ease-in-out infinite;
}

@keyframes recPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.55;
  }
}

.rec-timer {
  font-variant-numeric: tabular-nums;
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
}

.rec-hint {
  flex: 1;
  color: var(--text-faint);
  font-size: 13px;
}

.rec-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: none;
  border-radius: 11px;
  background: var(--ok);
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--hover-strong);
  transition: background 0.2s, transform 0.15s;
}

.rec-send:hover {
  background: #74cfb2;
  transform: scale(1.05);
}

.rec-send:active {
  transform: scale(0.94);
}

.rec-send svg {
  width: 17px;
  height: 17px;
}

.rec-cancel {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.rec-cancel:hover {
  color: var(--danger);
  background: rgba(217, 106, 130, 0.12);
}

.rec-cancel svg {
  width: 17px;
  height: 17px;
}

/* voice message */
.voice-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.voice-play {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.voice-play:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.06);
}

.voice-play svg {
  width: 15px;
  height: 15px;
}

.voice-play .ico-pause {
  display: none;
}

.voice-play.playing .ico-play {
  display: none;
}

.voice-play.playing .ico-pause {
  display: block;
}

.voice-track {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding-right: 4px;
}

.voice-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.voice-dur {
  flex: none;
  font-size: 12px;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.voice-transcribe {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.voice-transcribe:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.08);
}

.voice-transcribe.active {
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.voice-transcribe svg {
  width: 14px;
  height: 14px;
}

.voice-transcribe.busy svg {
  animation: vtBusy 0.9s linear infinite;
}

@keyframes vtBusy {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.voice-transcript {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  animation: riseIn 0.16s var(--ease) both;
}

.voice-transcript .vt-hint {
  opacity: 0.75;
  font-style: italic;
}

.voice-transcript .vt-text {
  opacity: 0.95;
}

/* photo / video messages */
.msg-bubble.media-bubble {
  padding: 5px;
  line-height: 0;
  max-width: min(72%, 420px);
}

.msg-bubble.media-bubble.media-tile {
  width: min(96%, 405px);
  max-width: 100%;
}

@media (max-width: 760px) {
  .msg-bubble.media-bubble.media-tile {
    width: min(96%, 560px);
  }
}

.msg-bubble.media-bubble .msg-quote {
  line-height: 1.4;
  margin-bottom: 6px;
}

.msg-media {
  display: block;
  max-width: 320px;
  max-height: 380px;
  width: 100%;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.msg-media.zoom {
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.msg-media.zoom:hover {
  opacity: 0.92;
}

.msg-bubble.media-bubble .msg-time {
  padding: 4px 8px 3px;
  line-height: 1.4;
}

/* circle video message (кружочек) */
.msg-bubble.circle-bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  width: min(46vw, 210px);
  max-width: 49vw;
  padding: 3px;
  line-height: 1;
}

.msg-row.mine .msg-bubble.circle-bubble {
  background: transparent;
  box-shadow: none;
}

.msg-row.theirs .msg-bubble.circle-bubble {
  background: transparent;
  border: none;
  backdrop-filter: none;
}

.msg-row.mine .msg-bubble.circle-bubble::after,
.msg-row.theirs .msg-bubble.circle-bubble::after {
  display: none;
}

.circle-msg {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.circle-msg.expanded {
  transform: scale(1.5);
  z-index: 50;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.circle-msg:hover {
  transform: scale(1.04);
}

.circle-msg:hover.expanded {
  transform: scale(1.5);
}

.circle-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--bg0);
  cursor: pointer;
}

.circle-ring {
  position: absolute;
  inset: 5px;
  width: auto;
  height: auto;
  overflow: visible;
  pointer-events: none;
}

.circle-msg.paused .circle-ring {
  transform: scale(0.94);
}

.circle-ring circle {
  fill: none;
  stroke-width: 0.7;
  stroke-linecap: round;
}

.circle-ring .ring-track {
  stroke: rgba(255, 255, 255, 0.5);
  stroke-dasharray: 0 100;
  opacity: 0;
  transition: opacity 0.25s;
}

.circle-msg.playing .ring-track,
.circle-msg.paused .ring-track {
  opacity: 1;
}

.circle-ring .ring-bar {
  stroke: #fff;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.5));
  transition: opacity 0.25s;
}

.circle-msg.playing .ring-bar,
.circle-msg.paused .ring-bar {
  opacity: 1;
}

.circle-msg.playing .circle-ring {
  transform: scale(1);
}

.circle-ring .ring-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}

.circle-msg .ring-knob {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: all;
  cursor: grab;
  touch-action: none;
  z-index: 2;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s;
}

.circle-msg.paused .ring-knob {
  opacity: 1;
}

.circle-msg .ring-knob:active {
  cursor: grabbing;
}

/* запасной вариант, если кольцо не поместилось в круг */
.circle-msg .ring-warn {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 14, 0.88);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  animation: fadeIn 0.2s both;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: heroPop 0.25s var(--ease) both;
}

/* context menu */
.ctx-menu {
  position: fixed;
  z-index: 300;
  min-width: 184px;
  padding: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.16s var(--ease) both;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.ctx-item:hover {
  background: var(--hover);
}

.ctx-item.danger {
  color: var(--danger);
}

.ctx-item.danger:hover {
  background: rgba(217, 106, 130, 0.12);
}

.ctx-item svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.ctx-sep {
  height: 1px;
  background: var(--line-soft);
  margin: 4px 6px;
}

.ctx-reacts {
  display: flex;
  gap: 4px;
  justify-content: space-between;
  padding: 5px 7px 7px;
  background: var(--panel-solid);
  border: 1px solid var(--line-thin);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ctx-react {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--rc, var(--hover));
  border-radius: 50%;
  font-size: 17px;
  filter: saturate(1);
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
}

.ctx-react:hover {
  filter: saturate(1.35) brightness(1.08);
  transform: scale(1.18);
}

.ctx-react:active {
  transform: scale(0.92);
}

.ctx-react .emoji-img {
  height: 20px;
  vertical-align: -0.1em;
}

.msg-reactions {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  padding-left: 6px;
}

.msg-row.mine .msg-reactions {
  padding-right: 6px;
  padding-left: 0;
  justify-content: flex-end;
}

.msg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--rc-b, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  background: var(--rc, var(--hover));
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
}

.msg-reaction:hover {
  filter: brightness(1.18);
  transform: translateY(-1px);
}

.msg-reaction-count {
  color: inherit;
}

.msg-reaction .emoji-img {
  height: 16px;
  vertical-align: -0.2em;
}

.msg-reaction.mine {
  border-color: var(--rc-b, var(--blue));
  background: var(--rc, var(--blue-soft));
  color: var(--blue-hi);
  box-shadow: 0 1px 6px var(--rc-b);
}

.msg-reaction.mine .msg-reaction-count {
  color: var(--rc-c, var(--blue-hi));
}

/* pinned messages */
.media-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  margin: 6px 12px 0;
  background: var(--hover);
  border: 1px solid var(--line-thin);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--text);
  flex: none;
}

.mi-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex: none;
}

.mi-ico svg {
  width: 15px;
  height: 15px;
}

.mi-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.mi-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.mi-title:hover {
  text-decoration: underline;
}

.mi-time {
  font-size: 11px;
  color: var(--text-dim);
}

.mi-speed {
  flex: none;
  min-width: 40px;
  padding: 4px 8px;
  border: 1px solid var(--line-thin);
  border-radius: 8px;
  background: var(--glass);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.mi-speed:hover {
  background: var(--hover-strong);
}

.mi-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mi-close:hover {
  background: var(--hover);
  color: var(--text);
}

.mi-close svg {
  width: 14px;
  height: 14px;
}

.pinned-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  margin: 0 0 6px;
  background: var(--hover);
  border: 1px solid var(--line-thin);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  flex: none;
  transition: background 0.15s;
}

.pinned-bar:hover {
  background: var(--hover-strong);
}

.pinned-pin {
  font-size: 13px;
}

.pinned-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinned-count {
  flex: none;
  color: var(--text-faint);
  font-weight: 600;
}

.pinned-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.pin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--hover);
  border: 1px solid var(--line-thin);
  border-radius: 10px;
}

.pin-row-pin {
  font-size: 13px;
  flex: none;
}

.pin-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.pin-row-body:hover b {
  color: var(--blue);
}

.pin-row-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.pin-row-time {
  flex: none;
  color: var(--text-faint);
  font-size: 11.5px;
}

.pin-row-x {
  flex: none;
  padding: 2px;
  font-size: 12px;
}

.pin-row-x:hover {
  color: var(--danger);
}

/* search */
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--hover);
  color: var(--text-faint);
}

.search-field svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.search-results {
  max-height: 330px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.search-hit {
  padding: 8px 10px;
  background: var(--hover);
  border: 1px solid var(--line-thin);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.search-hit:hover {
  background: var(--hover-strong);
  border-color: var(--line);
}

.search-hit-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.search-hit-chat {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 12px;
}

.search-hit-time {
  flex: none;
  color: var(--text-faint);
  font-size: 11.5px;
}

.search-hit-text {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* profile avatar actions */
.avatar-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-actions .btn-outline:hover {
  color: var(--text);
  border-color: var(--hover-strong);
  background: var(--hover);
}

.avatar-actions .btn-outline.danger:hover {
  color: var(--danger);
  border-color: rgba(217, 106, 130, 0.4);
  background: rgba(217, 106, 130, 0.08);
}

.avatar-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  max-width: 260px;
}

/* settings + user page */
.settings-page {
  height: 100%;
  overflow-y: auto;
  padding: 18px 16px 30px;
  scrollbar-width: thin;
  animation: fadeIn 0.3s both;
}

.settings-shell,
.user-shell {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 26px 30px 30px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.45s 0.06s var(--ease) both;
}

.setting-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.setting-item:last-of-type {
  border-bottom: none;
}

.setting-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.setting-label {
  font-weight: 500;
  font-size: 14.5px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-thin);
  pointer-events: none;
  transition: background 0.2s, border-color 0.2s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s var(--ease);
}

.switch input:checked ~ .switch-track {
  background: var(--blue);
  border-color: transparent;
}

.switch input:checked ~ .switch-track::after {
  transform: translateX(20px);
}

.setting-note {
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
  color: var(--text-faint);
}

.setting-note.ok {
  color: var(--ok);
}

.setting-note.bad {
  color: var(--danger);
}

.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blocked-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line-thin);
  border-radius: 10px;
}

.blocked-item .blocked-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background: var(--blue);
}

.blocked-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.blocked-info b {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blocked-info span {
  font-size: 12.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-hero .avatar {
  margin: 0 auto 16px;
}

.user-login-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  justify-content: center;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.user-shell-ref {
  margin: 0 auto;
  width: min(620px, 100%);
}

/* ------------- scrollbars ------------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--hover-strong);
}

/* ------------- responsive ------------- */
@media (max-width: 760px) {
  .app {
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-radius: 0;
  }

  .sidebar,
  .chat {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .sidebar {
    border-top: none;
    border-bottom: none;
  }

  .chat {
    border-top: none;
    border-bottom: none;
    display: none;
  }

  .app.chat-open .sidebar {
    display: none;
  }

  .app.chat-open .chat {
    display: flex;
  }

  .back-btn {
    display: grid;
    flex: none;
  }

  .msg-bubble {
    max-width: 84%;
  }

  .header-actions {
    display: flex;
  }

  .chat-header {
    padding: 10px 12px;
    gap: 12px;
  }

  .composer {
    padding: 8px 10px;
  }

  .auth-card {
    padding: 30px 20px 24px;
  }

  .reg-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .friend-rows > .friend-empty {
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .msg-bubble {
    max-width: 92%;
  }

  .sidebar-nav {
    font-size: 13px;
  }

  .tool-btn {
    width: 38px;
  }
}

/* ------------- user appearance settings ------------- */
html {
  background: var(--bg0);
}

html[data-fontsize="sm"] body {
  zoom: 0.94;
}

html[data-fontsize="lg"] body {
  zoom: 1.07;
}

html[data-fontsize="sm"] .auth-screen {
  height: calc(100% / 0.94);
}

html[data-fontsize="lg"] .auth-screen {
  height: calc(100% / 1.07);
}

html[data-fontsize="sm"] .app {
  height: calc(100dvh / 0.94);
}

html[data-fontsize="lg"] .app {
  height: calc(100dvh / 1.07);
}

html[data-hidetime="1"] .msg-time {
  display: none;
}

html[data-compact="1"] .chat-item {
  padding: 7px 12px;
  gap: 10px;
}

html[data-compact="1"] .chat-item .avatar {
  width: 38px;
  height: 38px;
}

html[data-anim="off"] *,
html[data-anim="off"] *::before,
html[data-anim="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ------------- без чата: шапка скрыта ------------- */
.app.no-chat .chat-header,
.app.no-chat .composer {
  display: none;
}

.app.no-chat .messages {
  padding: 0;
}

/* ------------- карточки пользователей ------------- */
.user-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
  animation: fadeUp 0.45s 0.1s var(--ease) both;
}

/* ------------- фото в профиле ------------- */
.profile-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-photo {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  flex: none;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.profile-photo img:hover {
  opacity: 0.85;
}

.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.profile-photo:hover .photo-del {
  opacity: 1;
}

.photo-del svg {
  width: 12px;
  height: 12px;
}

.photo-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.user-card-body {
  min-width: 0;
  flex: 1;
}

.user-status {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

.user-status.offline {
  color: var(--text-faint);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  animation: fadeUp 0.45s 0.14s var(--ease) both;
}

.user-actions .btn-primary {
  flex: 1;
  min-width: 200px;
  text-decoration: none;
}

a.btn-primary,
a.btn-outline {
  text-decoration: none;
}

.user-actions .btn-outline {
  flex: none;
}

.btn-outline.danger {
  color: var(--danger);
  border-color: rgba(217, 106, 130, 0.4);
}

.btn-outline.danger:hover {
  background: rgba(217, 106, 130, 0.12);
}

.info-list {
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-label {
  flex: none;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.info-value {
  min-width: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.danger-zone {
  border-color: rgba(217, 106, 130, 0.35);
  background: rgba(217, 106, 130, 0.06);
}

.danger-zone h3 {
  color: var(--danger);
}

.danger-text {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid rgba(217, 106, 130, 0.5);
  border-radius: 10px;
  background: rgba(217, 106, 130, 0.14);
  color: var(--danger);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-danger:hover {
  background: rgba(217, 106, 130, 0.24);
  border-color: rgba(217, 106, 130, 0.7);
}

#profileAvatar,
#uAvatar {
  cursor: zoom-in;
}

.avatar-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.92);
}

.avatar-lightbox.hidden {
  display: none;
}

.lightbox-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lightbox-inner img,
.lightbox-inner video {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.lightbox-inner.letter {
  width: min(70vw, 70vh);
  height: min(70vw, 70vh);
  border-radius: 50%;
  color: #fff;
  font-size: min(34vw, 34vh);
  font-weight: 700;
  text-transform: uppercase;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.drop-overlay.hidden {
  display: none;
}

.drop-overlay span {
  padding: 26px 40px;
  border: 2px dashed var(--blue);
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--panel-shadow);
}

/* ------------- toasts ------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(340px, calc(100vw - 24px));
  pointer-events: none;
}

html[data-toastpos="top"] .toasts {
  top: 16px;
  bottom: auto;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  background: var(--overlay-solid);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  animation: toastIn 0.25s var(--ease) both;
  pointer-events: auto;
}

.toast .avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 15px;
}

.toast.clickable {
  cursor: pointer;
  transition: border-color 0.15s;
}

.toast.clickable:hover {
  border-color: var(--blue);
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.toast-text {
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-dim);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toast-close {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  border-radius: 50%;
  cursor: pointer;
}

.toast-close:hover {
  background: var(--hover);
  color: var(--text);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

.toast.out {
  animation: toastOut 0.3s var(--ease) both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

html[data-toastpos="top"] .toast {
  animation-name: toastInTop;
}

html[data-toastpos="top"] .toast.out {
  animation-name: toastOutTop;
}

@keyframes toastInTop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOutTop {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}/* ------------ undo-тост для отмены отправки ------------ */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  z-index: 5100;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 18px;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--overlay-solid);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
  opacity: 0;
  pointer-events: auto;
}

.undo-toast.show {
  animation: undoIn 0.3s var(--ease) forwards;
  opacity: 1;
}

.undo-toast.out {
  animation: undoOut 0.25s var(--ease) forwards;
}

.undo-toast-text {
  font-size: 14px;
  color: var(--text);
}

.undo-tick {
  flex: none;
  min-width: 34px;
  text-align: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.undo-btn {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.15s;
}

.undo-btn:hover {
  transform: scale(1.05);
  filter: brightness(1.08);
}

.undo-btn:active {
  transform: scale(0.96);
}

@keyframes undoIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes undoOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.98);
  }
}

/* ------------ попап выбора реакции ------------ */
.msg-reactions.react-pop {
  animation: reactIn 0.26s var(--ease);
}

@keyframes reactIn {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.94);
  }
  70% {
    opacity: 1;
    transform: translateY(-1px) scale(1.02);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------ анимация для очистки переписки ------------ */
.msg-clear-anim {
  animation: clearFlash 0.45s var(--ease);
}

@keyframes clearFlash {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  40% {
    opacity: 0.25;
    transform: scale(0.995);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ------------ строка закрепления ------------ */
.pin-row {
  animation: rowIn 0.35s var(--ease) both;
}

/* ------------ режим выделения сообщений ------------ */
body.selecting .msg-row {
  cursor: pointer;
}

.msg-row.selected {
  position: relative;
  border-radius: 18px;
  background: rgba(var(--blue-rgb), 0.08);
}

.msg-row.selected .msg-bubble {
  box-shadow: 0 0 0 2px var(--blue);
}

.msg-row.selected::after {
  content: "?";
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.select-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 5090;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  max-width: min(560px, calc(100vw - 24px));
  pointer-events: auto;
  background: var(--overlay-solid);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
  animation: undoIn 0.25s var(--ease);
}

.select-count {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
  white-space: nowrap;
}

.select-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.select-btn svg {
  width: 14px;
  height: 14px;
}

.select-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.select-btn:hover:not(:disabled) {
  background: var(--glass-2);
}

.select-btn.danger {
  color: #ff5a5a;
}

.select-btn.danger:hover:not(:disabled) {
  background: rgba(255, 90, 90, 0.12);
}

.select-btn.cancel {
  border-color: transparent;
  background: var(--glass-2);
}

/* ------------ модалка пересылки ------------ */
.fwd-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fwd-modal.hidden {
  display: none;
}

.fwd-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
}

.fwd-panel {
  position: relative;
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  padding: 18px 16px;
  width: min(400px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  animation: confirmPop 0.18s ease-out;
}

.fwd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.fwd-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.fwd-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.fwd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: background 0.15s var(--ease);
}

.fwd-item:hover {
  background: var(--glass-2);
}

.fwd-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.fwd-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fwd-preview {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fwd-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ------------ версия клиента (альфа, не для всех) ------------ */
.ver-badge {
  position: fixed;
  right: 10px;
  top: 10px;
  z-index: 9000;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: var(--overlay-solid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  user-select: none;
  pointer-events: none;
  opacity: 0.9;
}

/* ------------ блок пересланного сообщения ------------ */
.msg-fwd {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 4px 5px;
  margin-bottom: 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  opacity: 0.85;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, opacity 0.15s;
}

.msg-fwd:hover {
  background: var(--hover);
  opacity: 1;
}

.msg-row.mine .msg-fwd {
  opacity: 0.9;
}

.fwd-from-label {
  flex: 0 0 auto;
  color: #fff;
  font-weight: 500;
}

.msg-fwd .fwd-avatar {
  width: 18px;
  height: 18px;
  font-size: 9px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
}

.fwd-avatar img,
.fwd-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.fwd-author-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------ трей пересылки для полосы прокрутки ------------ */
.fwd-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 100%;
  padding: 6px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass-1);
}

.fwd-tray.hidden {
  display: none;
}

/* ============================================================
   Splash (загрузка)
   ============================================================ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, var(--bg0) 0%, var(--page-bot) 60%, var(--bg0) 100%);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: splashIn 0.6s var(--ease) both;
}

@keyframes splashIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.splash-logo {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  animation: splashLogo 1.4s var(--ease) both, logoFloat 3.4s ease-in-out 0.7s infinite;
}

@keyframes splashLogo {
  0% {
    transform: scale(0.4) rotate(-14deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.12) rotate(3deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.splash-tag {
  margin-top: 6px;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.splash-line {
  position: relative;
  width: 120px;
  height: 3px;
  margin-top: 22px;
  border-radius: 999px;
  background: rgba(var(--blue-rgb), 0.18);
  overflow: hidden;
}

.splash-line i {
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--blue-soft), transparent);
  animation: splashSlide 1.1s var(--ease) infinite;
}

@keyframes splashSlide {
  0% {
    left: -40%;
  }
  100% {
    left: 110%;
  }
}

/* ============================================================
   Пустые состояния (примеры)
   ============================================================ */
.empty-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 6px;
  text-align: center;
  padding: 24px 18px;
  color: var(--text-dim);
}

.empty-art.small {
  min-height: 180px;
  height: auto;
  justify-content: center;
}

.empty-art-ico {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.empty-art-ico::before,
.empty-art-ico::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--blue-rgb), 0.22);
  animation: emptyPulse 2.6s var(--ease) infinite;
}

.empty-art-ico::after {
  animation-delay: 1.3s;
  border-color: rgba(var(--blue-rgb), 0.11);
}

@keyframes emptyPulse {
  0% {
    transform: scale(0.72);
    opacity: 0;
  }
  45% {
    opacity: 1;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

.empty-art-emoji {
  font-size: 46px;
  line-height: 1;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 26px;
  background: linear-gradient(150deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hover-strong);
}

.empty-art-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.empty-art-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-faint);
  max-width: 260px;
}

.empty-art-link {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}

.empty-art-link:hover {
  border-color: var(--blue);
  color: var(--blue-soft);
  background: rgba(var(--blue-rgb), 0.1);
  transform: translateY(-1px);
}

.empty-art-link svg {
  width: 15px;
  height: 15px;
}

/* ============================================================
   Обои чата
   ============================================================ */
[data-wall="night"] {
  --wall-fx: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.4px), radial-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1.4px);
  --wall-fx-size: 28px 28px, 28px 28px;
  --wall-fx-pos: 0 0, 14px 14px;
  --wall-grad: linear-gradient(160deg, #101a3a 0%, #0b1024 55%, #070a18 100%);
}

[data-wall="ocean"] {
  --wall-fx: radial-gradient(rgba(120, 200, 230, 0.05) 1px, transparent 1.5px), radial-gradient(rgba(120, 200, 230, 0.03) 1px, transparent 1.5px);
  --wall-fx-size: 26px 26px, 26px 26px;
  --wall-fx-pos: 0 0, 13px 13px;
  --wall-grad: linear-gradient(165deg, #0c2a38 0%, #0a1c2c 55%, #081322 100%);
}

[data-wall="forest"] {
  --wall-fx: radial-gradient(rgba(140, 220, 160, 0.05) 1px, transparent 1.5px), radial-gradient(rgba(140, 220, 160, 0.03) 1px, transparent 1.5px);
  --wall-fx-size: 26px 26px, 26px 26px;
  --wall-fx-pos: 0 0, 13px 13px;
  --wall-grad: linear-gradient(165deg, #0f2e22 0%, #0b241b 55%, #071a13 100%);
}

[data-wall="sunset"] {
  --wall-fx: radial-gradient(rgba(255, 200, 150, 0.06) 1px, transparent 1.5px), radial-gradient(rgba(255, 200, 150, 0.03) 1px, transparent 1.5px);
  --wall-fx-size: 26px 26px, 26px 26px;
  --wall-fx-pos: 0 0, 13px 13px;
  --wall-grad: linear-gradient(160deg, #3a1624 0%, #2a1220 55%, #1c0d1d 100%);
}

[data-wall="lavender"] {
  --wall-fx: radial-gradient(rgba(200, 170, 255, 0.06) 1px, transparent 1.5px), radial-gradient(rgba(200, 170, 255, 0.03) 1px, transparent 1.5px);
  --wall-fx-size: 26px 26px, 26px 26px;
  --wall-fx-pos: 0 0, 13px 13px;
  --wall-grad: linear-gradient(160deg, #241a3c 0%, #191232 55%, #120b26 100%);
}

[data-wall="peach"] {
  --wall-fx: radial-gradient(rgba(255, 190, 160, 0.05) 1px, transparent 1.5px), radial-gradient(rgba(255, 190, 160, 0.03) 1px, transparent 1.5px);
  --wall-fx-size: 26px 26px, 26px 26px;
  --wall-fx-pos: 0 0, 13px 13px;
  --wall-grad: linear-gradient(160deg, #38241e 0%, #2a1c1a 55%, #1e1416 100%);
}

[data-wall="aurora"] {
  --wall-glow: radial-gradient(760px 480px at 82% -10%, rgba(64, 255, 220, 0.16), transparent 62%), radial-gradient(760px 480px at 12% 112%, rgba(160, 110, 255, 0.24), transparent 62%);
  --wall-grad: linear-gradient(160deg, #082f3b 0%, #0d2e4a 52%, #24174d 100%);
}

[data-wall="neon"] {
  --wall-glow: radial-gradient(780px 500px at 84% -10%, rgba(255, 84, 182, 0.28), transparent 62%), radial-gradient(760px 480px at 10% 114%, rgba(96, 140, 255, 0.32), transparent 62%);
  --wall-grad: linear-gradient(158deg, #2a0f3e 0%, #1d1142 55%, #0b1638 100%);
}

[data-wall="candy"] {
  --wall-glow: radial-gradient(780px 500px at 82% -10%, rgba(255, 122, 190, 0.3), transparent 62%), radial-gradient(760px 500px at 14% 112%, rgba(188, 122, 255, 0.28), transparent 62%);
  --wall-grad: linear-gradient(160deg, #3b1231 0%, #301345 55%, #251044 100%);
}

[data-wall="gold"] {
  --wall-glow: radial-gradient(780px 500px at 84% -10%, rgba(255, 196, 96, 0.24), transparent 62%), radial-gradient(760px 480px at 12% 112%, rgba(255, 124, 60, 0.2), transparent 62%);
  --wall-grad: linear-gradient(160deg, #3c2511 0%, #301c12 55%, #241310 100%);
}

[data-wall="mint"] {
  --wall-glow: radial-gradient(780px 500px at 84% -10%, rgba(96, 255, 190, 0.16), transparent 62%), radial-gradient(760px 480px at 12% 112%, rgba(70, 190, 160, 0.24), transparent 62%);
  --wall-grad: linear-gradient(160deg, #0c3026 0%, #0e352a 55%, #0b281e 100%);
}

[data-wall="berry"] {
  --wall-glow: radial-gradient(780px 500px at 84% -10%, rgba(255, 92, 150, 0.26), transparent 62%), radial-gradient(760px 500px at 12% 112%, rgba(150, 78, 190, 0.32), transparent 62%);
  --wall-grad: linear-gradient(160deg, #341022 0%, #2c1432 55%, #1f0f2c 100%);
}

[data-wall="slate"] {
  --wall-glow: radial-gradient(760px 480px at 84% -10%, rgba(150, 190, 240, 0.16), transparent 62%), radial-gradient(760px 480px at 12% 112%, rgba(100, 130, 200, 0.22), transparent 62%);
  --wall-grad: linear-gradient(160deg, #1b2334 0%, #151d2d 55%, #101725 100%);
}

[data-wall="graph"] {
  --wall-fx: linear-gradient(var(--line-thin) 1px, transparent 1px), linear-gradient(90deg, var(--line-thin) 1px, transparent 1px);
  --wall-fx-size: 34px 34px, 34px 34px;
  --wall-fx-pos: 0 0, 0 0;
  --wall-grad: linear-gradient(165deg, #0e1526 0%, #0b1120 60%, #080d1a 100%);
}

[data-wall="dots"] {
  --wall-fx: radial-gradient(rgba(var(--blue-rgb), 0.16) 1.5px, transparent 2px), radial-gradient(rgba(var(--blue-rgb), 0.08) 1.5px, transparent 2px);
  --wall-fx-size: 22px 22px, 22px 22px;
  --wall-fx-pos: 0 0, 11px 11px;
  --wall-grad: linear-gradient(160deg, #101a33 0%, #0c1226 55%, #0a101f 100%);
}

[data-wall="solid"] {
  --wall-fx: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1.4px), radial-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1.4px);
  --wall-fx-size: 28px 28px, 28px 28px;
  --wall-fx-pos: 0 0, 14px 14px;
  --wall-grad: linear-gradient(160deg, #131a2c 0%, #0e1422 60%, #0c111e 100%);
}

.wall-panel {
  width: min(400px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hover-strong) transparent;
}

.wall-hint {
  margin: -4px 0 6px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.wall-done {
  margin-top: 14px;
}

.wall-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.wall-actions .wall-done {
  margin-top: 0;
  flex: 1;
}

.wall-actions .btn-outline {
  flex-shrink: 0;
}

.wall-dots-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.wall-cell {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 1.35 / 1;
  overflow: hidden;
  background: var(--glass);
  transition: transform 0.18s var(--ease), border-color 0.2s, box-shadow 0.2s;
}

.wall-cell:hover {
  transform: translateY(-2px);
  border-color: var(--hover-strong);
}

.wall-cell.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.25);
}

.wall-preview {
  position: absolute;
  inset: 0;
  background-image: var(--wall-glow, none), var(--wall-fx, none), var(--wall-grad);
  background-size: var(--wall-glow-size, 100% 100%), var(--wall-fx-size, 100% 100%), var(--wall-grad-size, 100% 100%);
  background-position: var(--wall-glow-pos, 0 0), var(--wall-fx-pos, 0 0), var(--wall-grad-pos, 0 0);
  background-repeat: no-repeat, var(--wall-fx-repeat, repeat), no-repeat;
}



.wall-cell .wall-name {
  position: absolute;
  left: 8px;
  bottom: 7px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.wall-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ============================================================
   Превью ссылок
   ============================================================ */
.msg-link-preview {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease);
}

.msg-link-preview:hover {
  border-color: var(--blue);
  background: rgba(var(--blue-rgb), 0.07);
  transform: translateY(-1px);
}

/* ----- карточка обычной ссылки (фавиконка-плитка слева) ----- */
.msg-link-preview.link {
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.link-tile {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(140deg, var(--glass-2), var(--glass));
  color: var(--text-faint);
}

.link-globe {
  font-size: 20px;
  line-height: 1;
}

.link-tile-fav {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.msg-link-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ----- медиа-карточка (изображение сверху) ----- */
.msg-link-preview.media {
  flex-direction: column;
  padding: 0;
}

.msg-link-preview.media .link-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  max-height: 200px;
  overflow: hidden;
  background: var(--hover);
}

.link-media-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-media-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 42px;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
}

.msg-link-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 13px 12px;
}

.msg-link-cardhost {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--blue-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-link-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.msg-link-go {
  flex: none;
  align-self: center;
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--text-faint);
  transition: color 0.18s;
}

.msg-link-preview:hover .msg-link-go {
  color: var(--blue-soft);
}

/* ============================================================
   Экран звонка
   ============================================================ */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  flex-direction: column;
  color: #fff;
  overflow: hidden;
}

.call-overlay.hidden {
  display: none;
}

.call-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(var(--blue-rgb), 0.35), transparent 60%),
    radial-gradient(700px 500px at 85% 110%, rgba(217, 106, 130, 0.22), transparent 60%),
    linear-gradient(170deg, #0c1226 0%, #080d1c 60%, #070a16 100%);
  transition: filter 0.4s var(--ease);
}

.call-overlay.muted .call-bg {
  filter: saturate(0.4) brightness(0.6);
}

.call-back {
  position: relative;
  z-index: 2;
  padding: 16px;
}

.call-back .btn-icon {
  color: rgba(255, 255, 255, 0.7);
}

.call-back .btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.call-body {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 24px 32px;
  text-align: center;
  animation: callIn 0.45s var(--ease) both;
}

@keyframes callIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.call-avatar-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.call-avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 44px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: #5377d8;
  background-image: linear-gradient(140deg, var(--blue-soft), var(--blue));
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.call-avatar img,
.call-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.call-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(var(--blue-rgb), 0.7);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: callRing 2.4s var(--ease) infinite;
}

.call-ring-a {
  inset: -16px;
}

.call-ring-b {
  inset: -16px;
  animation-delay: 1.2s;
}

@keyframes callRing {
  0% {
    transform: scale(0.86);
    opacity: 0;
  }
  30% {
    opacity: 0.9;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

.call-overlay.connected .call-ring {
  display: none;
}

.call-overlay.connected .call-bg {
  background:
    radial-gradient(800px 560px at 50% -10%, rgba(95, 191, 160, 0.28), transparent 60%),
    radial-gradient(700px 500px at 20% 115%, rgba(var(--blue-rgb), 0.18), transparent 60%),
    linear-gradient(175deg, #0a1a16 0%, #081412 65%, #06100e 100%);
}

.call-overlay.muted .call-bg {
  filter: saturate(0.35) brightness(0.55);
}

.call-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.45);
}

.call-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
}

.call-preset {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: 120px;
}

.call-controls {
  display: flex;
  gap: 26px;
}

.call-ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.call-ctl:hover {
  transform: translateY(-2px);
}

.call-ctl svg {
  width: 26px;
  height: 26px;
  display: block;
  padding: 15px;
  box-sizing: content-box;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s;
}

.call-ctl:active svg {
  transform: scale(0.92);
}

.call-ctl.on svg {
  background: linear-gradient(140deg, var(--blue-soft), var(--blue));
  box-shadow: 0 0 0 1px rgba(131, 165, 255, 0.35);
}

.call-ctl.off svg {
  background: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.call-ctl.off {
  opacity: 0.85;
}

.call-ctl.big.ok svg {
  width: 34px;
  height: 34px;
  padding: 22px;
  background: var(--ok);
  box-shadow: 0 10px 34px rgba(95, 191, 160, 0.45);
  animation: callAnswer 0.9s var(--ease) infinite;
}

@keyframes callAnswer {
  0%,
  100% {
    box-shadow: 0 10px 34px rgba(95, 191, 160, 0.45), 0 0 0 0 rgba(95, 191, 160, 0.4);
  }
  50% {
    box-shadow: 0 10px 34px rgba(95, 191, 160, 0.45), 0 0 0 12px rgba(95, 191, 160, 0);
  }
}

.call-hangup {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 40px rgba(217, 106, 130, 0.45);
  transition: transform 0.15s, filter 0.15s;
}

.call-hangup:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.call-hangup svg {
  width: 30px;
  height: 30px;
  transform: rotate(135deg);
}

.call-timer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.call-overlay.connected .call-timer-bar {
  opacity: 1;
}

.call-timer {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.05em;
}

.call-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.call-eq i {
  width: 3px;
  border-radius: 2px;
  background: var(--ok);
  animation: callEq 1s ease-in-out infinite;
}

.call-eq i:nth-child(2) {
  animation-delay: 0.15s;
}

.call-eq i:nth-child(3) {
  animation-delay: 0.3s;
}

.call-eq i:nth-child(4) {
  animation-delay: 0.45s;
}

.call-eq i:nth-child(5) {
  animation-delay: 0.6s;
}

@keyframes callEq {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 16px;
  }
}

.call-overlay.ringing .call-name {
  animation: callShake 1.8s var(--ease) infinite;
}

@keyframes callShake {
  0%,
  86%,
  100% {
    transform: translateX(0);
  }
  90% {
    transform: translateX(-2px);
  }
  94% {
    transform: translateX(2px);
  }
  98% {
    transform: translateX(-1px);
  }
}

.call-avatar img,
.call-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-anim="off"] .call-ring,
html[data-anim="off"] .call-eq i,
html[data-anim="off"] .splash-line i,
html[data-anim="off"] .empty-art-ico::before,
html[data-anim="off"] .empty-art-ico::after,
html[data-anim="off"] .call-ctl.big.ok svg,
html[data-anim="off"] .call-overlay.ringing .call-name {
  animation: none !important;
}

.tray-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  min-width: 0;
  text-align: left;
}

.tray-btn:hover {
  background: var(--glass-2);
}

.tray-btn.primary {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  flex: 0 0 auto;
}

.tray-btn.primary:hover {
  background: var(--blue-soft);
}

.tray-btn.border {
  border: 1px solid var(--line);
  font-weight: 600;
  flex: 0 0 auto;
}

.tray-btn.border:hover {
  border-color: var(--blue);
  color: var(--blue-soft);
}

.tray-btn.icon {
  flex: 0 0 auto;
  padding: 7px 9px;
  opacity: 0.75;
}

.tray-btn.icon:hover {
  opacity: 1;
}

.tray-btn.icon svg {
  width: 15px;
  height: 15px;
}

.tray-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--blue);
}

.tray-ico svg {
  width: 16px;
  height: 16px;
}

.fwd-tray-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ------------ меню трея пересылки ------------ */
.fwd-tray-menu {
  position: absolute;
  bottom: calc(100% - 8px);
  left: 10px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 230px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--overlay-solid);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.18s var(--ease) both;
}

.fwd-tray-menu.hidden {
  display: none;
}

.fwd-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.fwd-menu-item:hover {
  background: var(--glass-2);
}

.fwd-menu-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--blue-soft);
}

.fwd-menu-hide input {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  cursor: pointer;
}

.fwd-menu-btn {
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 9px 9px;
  padding-top: 10px;
}

/* Трей пересылки: сверху над полем ввода */
.fwd-tray {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 100%;
  width: 100%;
  box-sizing: border-box;
  order: -1;
  flex-basis: 100%;
  padding: 6px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass-1);
}

.fwd-tray.hidden {
  display: none;
}


/* ==== Обои: выключение точек (паттерна) ==== */
[data-fx="off"] {
  --wall-fx: none, none;
}
[data-fx="off"] [data-wall] {
  --wall-fx: none, none;
}

/* ==== Свой градиент (пресет custom) ==== */
[data-wall="custom"] {
  --wall-grad: linear-gradient(160deg, #3b2a7d 0%, #16244d 100%);
}

/* ==== Редактор своего градиента в модалке обоев ==== */
.wall-custom {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
}
.wall-custom-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
}
.wall-custom-title .emoji-x {
  font-size: 14px;
}
.wall-img-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wall-img-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.wall-img-btn:hover {
  background: var(--hover);
  border-color: var(--hover-strong);
}
.wall-img-del {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.wall-img-del:hover {
  color: #e05656;
  border-color: rgba(224, 86, 86, 0.4);
}
.wall-custom-or {
  margin: 11px 0 9px;
  font-size: 11px;
  color: var(--text-faint);
}
.wall-custom-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.wall-cfield {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
}
.wall-cfield input[type="color"] {
  width: 46px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-2);
  cursor: pointer;
}
.wall-cfield input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.wall-cfield input[type="color"]::-webkit-color-swatch {
  border-radius: 7px;
  border: 0;
}
.wall-cfield input[type="number"] {
  width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.wall-custom-prev {
  height: 96px;
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-image: var(--wall-glow, none), var(--wall-fx, none), var(--wall-grad);
  background-size: var(--wall-glow-size, 100% 100%), var(--wall-fx-size, 100% 100%), var(--wall-grad-size, 100% 100%), 100% 100%;
  background-position: var(--wall-glow-pos, 0 0), var(--wall-fx-pos, 0 0), var(--wall-grad-pos, 0 0), 0 0;
  background-repeat: no-repeat, var(--wall-fx-repeat, repeat), no-repeat;
}
.wall-custom-prev.is-img {
  background-image: var(--wall-img, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.wall-both-row {
  margin-top: 6px;
}
.wall-both-sub {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
  margin-top: 2px;
}

/* ==== Свой акцентный цвет в настройках ==== */
.acc-custom {
  display: flex;
  align-items: center;
  gap: 10px;
}
.acc-custom input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-2);
  cursor: pointer;
}
.acc-custom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.acc-custom input[type="color"]::-webkit-color-swatch {
  border-radius: 7px;
  border: 0;
}
.acc-custom .acc-hex {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ------------- истории ------------- */
.stories-bar {
  display: flex;
  gap: 6px;
  padding: 8px 10px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: none;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-thin);
}
.stories-bar::-webkit-scrollbar {
  display: none;
}

.story-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  flex: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.story-ring {
  position: relative;
  display: flex;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--hover-strong);
  transition: filter 0.2s var(--ease), transform 0.15s;
}
.story-ring:not(.seen) {
  background: conic-gradient(from 210deg, #ff8a00, #e52e71, #a74cff, #5377d8, #ff8a00);
}
.story-ring .story-avatar {
  width: 100%;
  height: 100%;
  font-size: 17px;
  border-radius: 50%;
}
.story-add-avatar {
  background: linear-gradient(140deg, var(--blue-soft), var(--blue));
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}
.story-cell:hover .story-ring {
  filter: brightness(1.18);
  transform: scale(1.04);
}
.story-name {
  max-width: 64px;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--text-dim);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-plus {
  position: absolute;
  right: -2px;
  bottom: 15px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  border: 2px solid var(--bg0);
  z-index: 2;
}

.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 10, 0.92);
}
.story-overlay.hidden {
  display: none;
}
body.story-open {
  overflow: hidden;
}

.story-viewer {
  position: relative;
  width: min(420px, 100vw);
  height: min(720px, calc(100vh - 24px));
  max-height: 92vh;
  background: #0a0d14;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.story-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 12px 14px 20px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}

.story-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.story-progress-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.story-progress-fill {
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: 2px;
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.story-author {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.s-ring {
  width: 38px;
  height: 38px;
  font-size: 15px;
  border: 2px solid #fff;
}
.story-author-meta {
  min-width: 0;
}
.story-author-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.story-time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}
.story-head-actions {
  display: flex;
  gap: 4px;
}
.story-overlay .btn-icon {
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
}
.story-overlay .btn-icon:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
}
.story-overlay .btn-icon.off {
  opacity: 0.45;
}

.story-media-wrap {
  position: absolute;
  inset: 0;
}
.story-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #07090f;
}
.story-media img,
.story-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.story-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}
.story-prev {
  left: 0;
}
.story-next {
  right: 0;
}

.story-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 14px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.story-reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 68%;
}
.story-react {
  position: relative;
  min-width: 38px;
  height: 38px;
  border-radius: 19px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  font-family: inherit;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.story-react:hover {
  transform: scale(1.12);
}
.story-react.on {
  background: var(--blue);
}
.story-react-count {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
}
.story-foot-actions {
  display: flex;
  gap: 8px;
  flex: none;
}
.story-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.story-btn svg {
  width: 17px;
  height: 17px;
}
.story-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

.stories-viewers {
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.story-viewer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 12px;
}
.story-viewer-row:hover {
  background: var(--hover);
}

.story-pub-panel {
  width: min(440px, 92vw);
}
.story-pub-preview {
  margin: 12px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 46vh;
  min-height: 120px;
}
.story-pub-preview img,
.story-pub-preview video {
  max-width: 100%;
  max-height: 46vh;
  object-fit: contain;
}
.story-pub-vis {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}
.story-pub-label {
  color: var(--text-dim);
  font-size: 13px;
}
.story-vis-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.story-vis-opt input {
  accent-color: var(--blue);
}
.story-pub-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 520px) {
  .story-viewer {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ------------ миниигры 1:1 ------------ */
.game-pick {
  position: absolute;
  top: 52px;
  right: 12px;
  z-index: 42;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--overlay-solid);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.18s var(--ease) both;
}
.game-pick.hidden {
  display: none;
}
.gp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.gp-item:hover {
  background: var(--hover);
}
.gp-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
  font-size: 15px;
}

.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s var(--ease) both;
}
.game-overlay.hidden {
  display: none;
}
.game-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
  animation: riseIn 0.22s var(--ease) both;
}
.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.game-id-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  min-width: 0;
}
.game-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-type-ico {
  font-size: 17px;
}
.game-opp-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13.5px;
}
.s-game {
  width: 34px;
  height: 34px;
  font-size: 13px;
  flex: none;
}
.game-stats {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--hover);
  color: var(--text-dim);
  font-size: 12.5px;
}
.game-stats b {
  color: var(--text);
  font-weight: 600;
}
.game-status-big {
  text-align: center;
  padding: 28px 10px;
  color: var(--text-dim);
  font-size: 14px;
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1;
}
.ttt-cell {
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--hover);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.ttt-cell:not(:disabled):hover {
  background: rgba(83, 119, 216, 0.16);
  border-color: var(--border-focus);
}
.ttt-cell:disabled {
  cursor: default;
}
.ttt-cell.ttt-x {
  color: var(--blue-soft);
}
.ttt-cell.ttt-o {
  color: #f2c94c;
}
.rps-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rps-score {
  display: flex;
  gap: 26px;
  font-size: 14px;
  color: var(--text-dim);
}
.rps-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rps-score-row b {
  color: var(--text);
  font-size: 16px;
}
.rps-round-note {
  color: var(--text-faint);
  font-size: 12px;
}
.rps-reveal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--hover);
  flex-wrap: wrap;
  justify-content: center;
}
.rps-reveal-pick {
  font-size: 34px;
  line-height: 1;
}
.rps-reveal-vs {
  color: var(--text-faint);
  font-size: 12px;
}
.rps-reveal-txt {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.rps-choices {
  display: flex;
  gap: 10px;
}
.rps-choice {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  font-size: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--hover);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease);
}
.rps-choice:not(:disabled):hover {
  background: rgba(83, 119, 216, 0.16);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}
.rps-choice:disabled {
  cursor: default;
  opacity: 0.6;
}
.game-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 34px;
}
.game-hint {
  flex: 1;
  color: var(--text-dim);
  font-size: 13px;
}
.btn-danger-ghost {
  padding: 8px 14px;
  border: 1px solid rgba(217, 106, 130, 0.4);
  border-radius: 10px;
  background: transparent;
  color: #d96a82;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger-ghost:hover {
  background: rgba(217, 106, 130, 0.12);
}
.btn-danger-ghost[hidden] {
  display: none;
}
.game-result {
  padding: 12px;
  border-radius: 12px;
  background: rgba(83, 119, 216, 0.14);
  color: var(--text);
  font-weight: 600;
  text-align: center;
  font-size: 14.5px;
}
.game-invite-panel {
  width: min(360px, 92vw);
}
.game-invite-text {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
  text-align: center;
}
.game-invite-text b {
  color: var(--text);
}

.msg-game-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(300px, 86%);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--hover);
  color: var(--text-dim);
}
.msg-game-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
  font-size: 18px;
}
.msg-game-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msg-game-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.msg-game-sub {
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-game-res {
  font-size: 13px;
  color: var(--blue-soft);
  margin-top: 2px;
}

.msg-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 86%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--hover);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s;
}
.msg-call-pill:hover {
  background: var(--hover-strong);
}
.msg-call-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
}
.msg-call-ico svg {
  width: 17px;
  height: 17px;
}
.msg-call-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msg-call-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.msg-call-sub {
  font-size: 12px;
  color: var(--text-faint);
}
.msg-call-sub.call-ok {
  color: var(--ok);
}
.msg-call-sub.call-miss {
  color: var(--danger);
}
.msg-call-pill .msg-time {
  font-size: 11px;
  color: var(--text-faint);
}
.msg-row.game-sys {
  justify-content: center;
  width: 100%;
  padding: 6px 12px;
}
.msg-row.game-sys .avatar {
  display: none;
}

/* ------------ истории: реакции и ответ ------------ */
.story-react .emoji-img {
  height: 20px;
  vertical-align: -0.35em;
}
.story-react.got {
  background: var(--rc, rgba(0, 0, 0, 0.42));
  border-color: var(--rc-b, rgba(255, 255, 255, 0.2));
  cursor: default;
}
.story-react.got:hover {
  transform: none;
}

#storyViewsModal,
#storyPublishModal {
  z-index: 3000;
}

.story-reply-tray {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 60px);
  padding: 7px 10px 7px 7px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--overlay-solid);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
  z-index: 30;
  animation: riseIn 0.22s var(--ease) both;
  font-size: 13px;
  color: var(--text-dim);
}
.story-reply-tray.hidden {
  display: none;
}
.srt-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  border: none;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  padding: 0;
  transition: filter 0.15s;
}
.srt-thumb:hover {
  filter: brightness(1.15);
}
.srt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.srt-meta {
  min-width: 0;
}
.srt-title {
  color: var(--text);
  font-weight: 600;
}
.srt-sub {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-story-q {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--hover);
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: filter 0.15s, border-color 0.15s;
}
.msg-story-q:hover {
  filter: brightness(1.12);
  border-color: var(--border-focus);
}
.msq-thumb {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 9px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: rgba(83, 119, 216, 0.18);
  color: var(--blue-soft);
  font-size: 16px;
}
.msq-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msq-title {
  font-size: 12px;
  color: var(--blue-soft);
  font-weight: 600;
}
.msq-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
