:root {
  color-scheme: dark;
  --bg: #030814;
  --text: #eaf2ff;
  --sidebar-icon-btn-size: clamp(34px, 4.2vh, 44px);
  --sidebar-label-space: clamp(9px, 1.5vh, 15px);
  --sidebar-label-font-size: 0.689rem; /* было 0.53rem, +30% */
  --sidebar-rail-width: 84px;
  --main-screen-bg: radial-gradient(circle at top, #f7fbff 0%, #e8f5ff 40%, #dff3ff 100%);
  --main-screen-text: #1c3557;
  --sidebar-bg: linear-gradient(180deg, #0f2348, #122b57);
  --sidebar-text: #e8f3ff;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --content-bg: transparent;
  --home-panel-bg: #f7fbff;
  --home-panel-border: rgba(181, 208, 236, 0.65);
  --lock-card-bg: linear-gradient(165deg, rgba(20, 46, 86, 0.94), rgba(17, 38, 74, 0.92));
  --lock-card-border: rgba(146, 188, 230, 0.55);
  --lock-title: #eaf5ff;
  --lock-text: #cfe6ff;
  --chat-shell-bg: rgba(255, 255, 255, 0.86);
  --chat-shell-border: rgba(132, 174, 214, 0.35);
  --chat-list-title: #3a5f87;
  --chat-contact-hover-bg: rgba(238, 247, 255, 0.9);
  --chat-contact-hover-border: rgba(122, 177, 232, 0.62);
  --chat-contact-hover-glow: rgba(132, 188, 241, 0.22);
  --msg-incoming-bg: rgba(255, 255, 255, 0.95);
  --msg-incoming-border: rgba(132, 174, 214, 0.32);
  --msg-incoming-text: #31557d;
  --msg-incoming-shadow: rgba(62, 116, 168, 0.08);
  --msg-outgoing-bg: linear-gradient(145deg, #62b6ff, #8698ff);
  --msg-outgoing-text: #ffffff;
  --msg-outgoing-shadow: rgba(67, 116, 205, 0.16);
  --chat-contact-blocked-bg: rgba(255, 238, 242, 0.9);
  --chat-contact-blocked-border: rgba(233, 126, 149, 0.6);
  --chat-contact-blocked-glow: rgba(231, 122, 145, 0.2);
  --chip-bg: rgba(255, 255, 255, 0.75);
  --chip-text: #264b76;
  --settings-bg: rgba(255, 255, 255, 0.95);
  --settings-text: #2b4b75;
  --settings-border: rgba(148, 186, 222, 0.5);
  --lang-panel-bg: linear-gradient(165deg, rgba(10, 22, 50, 0.84), rgba(7, 16, 38, 0.82));
  --lang-panel-glow: rgba(118, 186, 246, 0.26);
  --lang-btn-bg: rgba(10, 23, 52, 0.9);
  --lang-btn-border: rgba(161, 214, 255, 0.3);
  --lang-btn-text: #ffffff;
  --lang-btn-active-border: rgba(125, 213, 255, 1);
  --lang-btn-active-ring: rgba(89, 194, 255, 0.2);
  --scrollbar-track: rgba(212, 232, 252, 0.55);
  --scrollbar-thumb: rgba(130, 178, 224, 0.62);
  --scrollbar-thumb-hover: rgba(109, 164, 216, 0.74);
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #0f1f45 0%, var(--bg) 65%);
  color: var(--text);
  transition: background 1.15s ease, color 0.8s ease;
}

.app,
.loader-screen,
.auth-screen,
.main-screen {
  width: 100%;
  height: 100%;
}

.hidden {
  display: none;
}

.loader-screen {
  position: relative;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  overflow: hidden;
  z-index: 1;
}

body.entering #loader,
body.entered #loader {
  pointer-events: none;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 35%, #fff, transparent 80%),
    radial-gradient(1.5px 1.5px at 70% 20%, #b9d9ff, transparent 80%),
    radial-gradient(2px 2px at 55% 80%, #fff, transparent 80%),
    radial-gradient(1px 1px at 10% 75%, #d0e8ff, transparent 80%),
    radial-gradient(1px 1px at 80% 65%, #fff, transparent 80%);
  opacity: 0.42;
  pointer-events: none;
}

.lang-panel {
  position: fixed;
  top: 4px;
  left: 0;
  width: var(--sidebar-rail-width);
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
  overflow: visible;
}

.lang-panel:hover,
.lang-panel:focus-within {
  gap: 4px;
}

.lang-btn {
  width: 0;
  height: 30px;
  border-radius: 8px;
  border: 0 solid var(--lang-btn-border);
  background: var(--lang-btn-bg);
  color: var(--lang-btn-text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  padding: 0;
  transition: width 0.2s ease, opacity 0.16s ease, transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, border-width 0.18s ease;
  pointer-events: none;
  transform: translateX(-4px);
}

.lang-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 213, 255, 0.95);
}

.lang-btn.active {
  width: 30px;
  border-color: var(--lang-btn-active-border);
  border-width: 1px;
  box-shadow: 0 0 0 3px var(--lang-btn-active-ring);
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.lang-panel:hover .lang-btn,
.lang-panel:focus-within .lang-btn {
  width: 30px;
  border-width: 1px;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.globe-wrap {
  position: relative;
  width: min(48vw, 320px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: visible;
  cursor: pointer;
  transition: transform 1.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease, filter 0.9s ease;
  transform-origin: center center;
  z-index: 7;
}

.scan-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #69dcff 0deg,
    #58a1ff 75deg,
    #7e7bff 155deg,
    #3dffd2 235deg,
    #69dcff 360deg
  );
  box-shadow:
    0 0 26px rgba(84, 185, 255, 0.45),
    0 0 50px rgba(64, 245, 206, 0.24);
  animation: pulse 2s ease-in-out infinite, spin 7s linear infinite;
  transition: transform 1.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease, filter 0.9s ease;
  z-index: 2;
  pointer-events: none;
}

.scan-ring::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #0e2251 0%, #050d22 80%);
}

.avatar-entry-hit {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 50%;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  cursor: pointer;
  z-index: 40;
  pointer-events: auto;
  touch-action: manipulation;
}

.avatar-entry-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 43%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(185, 231, 255, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(186, 247, 255, 0.45), rgba(123, 184, 255, 0.26) 45%, rgba(117, 108, 255, 0.2) 70%, rgba(83, 228, 206, 0.2) 100%),
    linear-gradient(145deg, rgba(109, 218, 255, 0.26), rgba(112, 133, 255, 0.2), rgba(76, 251, 215, 0.22));
  box-shadow:
    inset 0 0 26px rgba(196, 246, 255, 0.24),
    0 0 30px rgba(86, 179, 255, 0.38);
  color: #eaf7ff;
  display: grid;
  place-content: center;
  place-items: center;
  gap: 4px;
  padding: clamp(8px, 1.4vw, 14px);
  cursor: pointer;
  z-index: 20;
  backdrop-filter: blur(2px);
  transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.5s ease;
  pointer-events: none;
  overflow: hidden;
  text-align: center;
  container-type: inline-size;
}

.avatar-entry-logo:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow:
    inset 0 0 28px rgba(214, 251, 255, 0.35),
    0 0 36px rgba(119, 202, 255, 0.5);
}

.avatar-entry-title {
  width: 94%;
  max-width: 94%;
  font-size: clamp(0.76rem, 1.12vw, 1.02rem);
  font-weight: 700;
  letter-spacing: 0.055em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  padding-inline: 2px;
  text-shadow: 0 0 10px rgba(142, 224, 255, 0.6);
}

.avatar-entry-sub {
  width: 92%;
  max-width: 92%;
  font-size: clamp(0.45rem, 0.52vw + 0.2rem, 0.64rem);
  letter-spacing: 0.05em;
  line-height: 1.18;
  text-transform: uppercase;
  opacity: 0.86;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  padding-bottom: 2px;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

body.entered {
  background: radial-gradient(circle at top, #f7fbff 0%, #e8f5ff 40%, #dff3ff 100%);
  color: #1e355a;
}

body.entered .stars {
  opacity: 0;
  transition: opacity 0.7s ease;
}

body.entering .globe-wrap {
  transform: scale(var(--exit-scale, 8));
  opacity: 0;
  filter: blur(3px);
}

.auth-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 10;
  pointer-events: none;
}

.auth-screen.visible {
  opacity: 1;
  pointer-events: auto;
}

body.logged-in .auth-screen {
  display: none !important;
}

.auth-stage {
  width: min(420px, 92vw);
  display: grid;
  place-items: center;
  gap: 10px;
}

.auth-form-stack {
  position: relative;
  width: 100%;
  display: grid;
}

.auth-form.auth-form-on-logo {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(160, 196, 230, 0.5);
  box-shadow: 0 14px 36px rgba(88, 123, 155, 0.2);
  backdrop-filter: blur(8px);
}

.auth-form-panel {
  grid-area: 1 / 1;
  position: relative;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.32s ease, transform 0.32s ease;
  pointer-events: none;
}

.auth-form-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.auth-form-panel.fading-out {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
}

.auth-form input,
.auth-form button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.98rem;
}

.auth-form input {
  border: 1px solid rgba(117, 161, 203, 0.4);
  background: rgba(255, 255, 255, 0.78);
  color: #27466b;
}

.auth-form button {
  border: 0;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
}

.auth-form .register-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(120, 164, 210, 0.45);
  color: #36597f;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: #355579;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-message[data-type="error"] {
  color: #b24747;
}

.auth-message[data-type="success"] {
  color: #2f8d5d;
}

.main-screen {
  position: absolute;
  inset: 0;
  background: var(--main-screen-bg);
  color: var(--main-screen-text);
  z-index: 20;
}

.platform {
  display: grid;
  grid-template-columns: var(--sidebar-rail-width) minmax(0, 1fr);
  height: 100%;
}

.platform-sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--sidebar-border);
}

body.logged-in .platform-sidebar {
  padding-top: clamp(104px, 22vh, 190px);
}

.user-panel {
  position: fixed;
  top: 50px;
  left: 0;
  width: var(--sidebar-rail-width);
  z-index: 55;
  display: none;
  gap: 8px;
  justify-items: center;
}

body.logged-in .user-panel {
  display: grid;
}

.current-user-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.current-user-avatar-trigger {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.current-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(190, 225, 255, 0.45);
  object-fit: cover;
  object-position: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.current-user-avatar-trigger:hover .current-user-avatar,
.current-user-avatar-trigger:focus-visible .current-user-avatar {
  border-color: rgba(200, 231, 255, 0.7);
  filter: drop-shadow(0 0 7px rgba(171, 219, 255, 0.52));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.26),
    0 0 10px rgba(154, 207, 255, 0.35);
  animation: menu-icon-active 1.15s ease-in-out infinite;
}

.logout-btn {
  background: rgba(255, 100, 115, 0.2);
  border: 1px solid rgba(255, 130, 140, 0.35);
}

.logout-btn:hover {
  background: rgba(255, 100, 115, 0.32);
}

.settings-screen {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 34, 0.52);
  backdrop-filter: blur(4px);
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: clamp(10px, 2.2vh, 20px);
  overflow-y: auto;
}

.settings-screen.hidden {
  display: none;
}

.settings-card {
  width: min(680px, 96vw);
  background: var(--settings-bg);
  color: var(--settings-text);
  border-radius: 16px;
  border: 1px solid rgba(146, 186, 224, 0.36);
  box-shadow: 0 16px 36px rgba(16, 48, 84, 0.2);
  padding: 16px 16px 14px;
  display: grid;
  gap: 9px;
  max-height: min(92vh, 980px);
  overflow-y: auto;
}

.settings-card h3 {
  margin: 0 0 4px;
}

.settings-avatar-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.settings-avatar-edit-btn {
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
}

.settings-avatar-preview {
  width: 146px;
  height: 146px;
  border-radius: 50%;
  border: 2px solid rgba(138, 181, 221, 0.62);
  object-fit: cover;
}

.settings-avatar-edit-btn:hover .settings-avatar-preview,
.settings-avatar-edit-btn:focus-visible .settings-avatar-preview {
  box-shadow: 0 0 0 3px rgba(111, 185, 255, 0.26);
  border-color: rgba(102, 170, 235, 0.72);
}

.settings-upload-btn {
  border: 1px solid rgba(104, 154, 206, 0.46);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(238, 248, 255, 0.99));
  color: #2a5e8d;
  border-radius: 999px;
  min-width: 182px;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  text-align: center;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(80, 140, 198, 0.16);
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.settings-upload-btn:hover,
.settings-upload-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(86, 148, 213, 0.72);
  box-shadow: 0 10px 20px rgba(50, 109, 168, 0.24);
}

.settings-card input,
.settings-card select,
.settings-card textarea,
.settings-card button {
  width: 100%;
  border-radius: 12px;
  font-size: 0.95rem;
}

.settings-card input,
.settings-card select,
.settings-card textarea {
  border: 1px solid rgba(133, 177, 217, 0.42);
  background: rgba(252, 254, 255, 0.96);
  color: #234e78;
  padding: 10px 12px;
}

.settings-card textarea {
  resize: vertical;
  min-height: 90px;
}

.settings-card input[readonly] {
  background: rgba(238, 246, 255, 0.88);
  color: rgba(50, 86, 122, 0.92);
}

.settings-readonly-note {
  margin-top: -2px;
  font-size: 0.78rem;
  color: #5e7fa3;
}

.settings-subsection {
  margin-top: 2px;
  padding: 10px 10px;
  border: 1px solid rgba(146, 189, 228, 0.3);
  border-radius: 12px;
  background: rgba(246, 252, 255, 0.9);
}

.settings-subsection h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #2f5f8f;
}

.settings-grid-contacts {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 7px 8px;
}

.settings-qr-block {
  text-align: center;
}

.settings-qr-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 3px auto 6px;
  text-decoration: none;
}

.settings-qr-image {
  width: 160px;
  height: 160px;
  border-radius: 14px;
  border: 1px solid rgba(143, 184, 223, 0.48);
  background: #fff;
  box-shadow: 0 8px 18px rgba(61, 116, 170, 0.2);
}

.settings-qr-url {
  font-size: 0.78rem;
  color: #4f749e;
  word-break: break-all;
}

.settings-qr-brand {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #2c5f90;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-actions button {
  padding: 10px 12px;
  border: 0;
  background: linear-gradient(145deg, #78bfff, #8fa4ff);
  color: #fff;
  cursor: pointer;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.side-btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: "Segoe UI", "Segoe UI Emoji", "Noto Color Emoji", Arial, sans-serif;
  font-synthesis: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  color: #d9ebff;
  background: transparent;
  cursor: pointer;
}

.side-btn-icon {
  width: var(--sidebar-rail-width);
  height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space)) !important;
  min-width: var(--sidebar-rail-width);
  min-height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space));
  max-width: var(--sidebar-rail-width);
  max-height: none;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  text-align: center;
  flex: 0 0 calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space));
  overflow: hidden;
}

.side-btn-icon::after {
  content: attr(data-label);
  display: block;
  max-width: 100%;
  padding: 0 4px;
  margin-top: 2px;
  font-size: var(--sidebar-label-font-size);
  line-height: 1.1;
  color: rgba(215, 235, 255, 0.94);
  white-space: normal;
  text-align: center;
  pointer-events: none;
}

.side-btn-subs::after {
  margin-top: 7px;
}

.side-btn-recommended {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
}

.recommended-star-badge {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
  color: #d89a1a;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    radial-gradient(circle at 35% 30%, #ffffff 0%, #f4f8ff 55%, #dde9ff 100%);
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.62),
    0 0 7px rgba(207, 226, 255, 0.28);
  transform-origin: 50% 52%;
  animation: menu-icon-idle 5.4s ease-in-out infinite;
}

@keyframes menu-icon-idle {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  46% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-0.2px) scale(1.04) rotate(-5deg); }
  54% { transform: translateY(-0.2px) scale(1.02) rotate(4deg); }
  58% { transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes menu-icon-active {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  25% { transform: translateY(-0.5px) scale(1.05) rotate(-6deg); }
  50% { transform: translateY(-0.2px) scale(1.02) rotate(5deg); }
  75% { transform: translateY(-0.4px) scale(1.05) rotate(-4deg); }
}

.side-btn-icon .recommended-star-badge,
.side-btn-icon .shorts-timer-icon,
.side-btn-icon .live-pill,
.side-btn-icon .subs-bell-icon,
.side-btn-icon .history-clock-emoji,
.side-btn-icon .chat-emoji-icon,
.side-btn-icon .channels-double-icon,
.side-btn-icon .settings-gear-icon,
.side-btn-icon .logout-door-icon {
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.side-btn-icon.active .recommended-star-badge,
.side-btn-icon.active .shorts-timer-icon,
.side-btn-icon.active .live-pill,
.side-btn-icon.active .subs-bell-icon,
.side-btn-icon.active .history-clock-emoji,
.side-btn-icon.active .chat-emoji-icon,
.side-btn-icon.active .channels-double-icon,
.side-btn-icon.active .settings-gear-icon,
.side-btn-icon.active .logout-door-icon {
  filter: inherit;
  animation: menu-icon-idle 5.6s ease-in-out infinite;
}

@media (hover: hover) and (pointer: fine) {
  .side-btn-icon:hover .recommended-star-badge,
  .side-btn-icon:hover .shorts-timer-icon,
  .side-btn-icon:hover .live-pill,
  .side-btn-icon:hover .subs-bell-icon,
  .side-btn-icon:hover .history-clock-emoji,
  .side-btn-icon:hover .chat-emoji-icon,
  .side-btn-icon:hover .channels-double-icon,
  .side-btn-icon:hover .settings-gear-icon,
  .side-btn-icon:hover .logout-door-icon,
  .side-btn-icon:focus-visible .recommended-star-badge,
  .side-btn-icon:focus-visible .shorts-timer-icon,
  .side-btn-icon:focus-visible .live-pill,
  .side-btn-icon:focus-visible .subs-bell-icon,
  .side-btn-icon:focus-visible .history-clock-emoji,
  .side-btn-icon:focus-visible .chat-emoji-icon,
  .side-btn-icon:focus-visible .channels-double-icon,
  .side-btn-icon:focus-visible .settings-gear-icon,
  .side-btn-icon:focus-visible .logout-door-icon {
    filter: drop-shadow(0 0 7px rgba(171, 219, 255, 0.52));
    animation: menu-icon-active 1.15s ease-in-out infinite;
  }
}

.shorts-timer-icon {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(217, 235, 255, 0.92);
  border-radius: 50%;
  position: relative;
  display: inline-block;
  animation: menu-icon-idle 5.6s ease-in-out infinite;
}

.shorts-timer-icon::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  background: rgba(217, 235, 255, 0.92);
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
}

.shorts-timer-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-32%, -50%);
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid rgba(217, 235, 255, 0.95);
}

.side-btn-live {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 170, 170, 0.65);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 115, 115, 0.9), rgba(230, 21, 21, 0.96) 56%, rgba(161, 5, 5, 0.98) 100%);
  box-shadow:
    inset 0 1px 3px rgba(255, 224, 224, 0.35),
    0 0 9px rgba(255, 65, 65, 0.32);
  animation: menu-icon-idle 6s ease-in-out infinite;
}

.live-dot {
  display: none;
}

.live-text {
  font-size: 0.41rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(89, 0, 0, 0.55);
}

.side-btn-subs {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
}

.subs-bell-icon {
  width: 15px;
  height: 12px;
  border: 2px solid rgba(255, 230, 184, 0.98);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  position: relative;
  display: inline-block;
  background: linear-gradient(180deg, rgba(255, 211, 92, 0.95), rgba(255, 155, 42, 0.95));
  box-shadow:
    inset 0 0 5px rgba(255, 244, 204, 0.45),
    0 0 8px rgba(255, 170, 64, 0.42);
  animation: menu-icon-idle 5.8s ease-in-out infinite;
}

.side-btn-subs .subs-bell-icon {
  transform: translateY(-1px);
}

.subs-bell-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 220, 131, 0.98), rgba(245, 155, 45, 0.98));
}

.subs-bell-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff7b2f;
  box-shadow:
    0 0 6px rgba(255, 123, 47, 0.9),
    0 0 10px rgba(255, 179, 93, 0.6);
}

.side-btn-history {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
}

.history-clock-emoji {
  font-size: 1.2rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(158, 206, 255, 0.35));
  animation: menu-icon-idle 5.7s ease-in-out infinite;
}

#menu-chats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.side-btn-chats {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
  position: relative;
  justify-content: center !important;
  align-items: center;
}

.side-btn-channels {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
}

.side-btn-logout {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
  margin-top: 2px;
}

.side-btn-settings {
  width: var(--sidebar-icon-btn-size) !important;
  height: var(--sidebar-icon-btn-size) !important;
  margin-top: auto;
}

.platform-sidebar .side-btn-icon,
.platform-sidebar .side-btn-recommended,
.platform-sidebar .side-btn-live,
.platform-sidebar .side-btn-subs,
.platform-sidebar .side-btn-history,
.platform-sidebar .side-btn-chats,
.platform-sidebar .side-btn-channels,
.platform-sidebar .side-btn-settings,
.platform-sidebar .side-btn-logout {
  width: var(--sidebar-rail-width) !important;
  min-width: var(--sidebar-rail-width) !important;
  max-width: var(--sidebar-rail-width) !important;
  height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space)) !important;
  min-height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space)) !important;
  max-height: none !important;
}

.settings-gear-icon {
  font-size: 1.38rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 0 6px rgba(158, 206, 255, 0.35));
  animation: menu-icon-idle 5.6s ease-in-out infinite;
}

.logout-door-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #ff6f84 0%, #d90f36 38%, #b9002a 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 223, 0.65),
    0 2px 8px rgba(132, 11, 33, 0.45);
  animation: menu-icon-idle 5.6s ease-in-out infinite;
}

.logout-door-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 21%;
  width: 3px;
  height: 8px;
  background: rgba(255, 255, 255, 0.94);
  transform: translateX(-50%);
  border-radius: 999px;
  z-index: 2;
}

.logout-door-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 54%;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-top-color: transparent;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}

.chat-emoji-icon {
  font-size: 1.08rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(158, 206, 255, 0.35));
  transform: translateY(0.5px);
  animation: menu-icon-idle 5.5s ease-in-out infinite;
}

.channels-double-icon {
  position: relative;
  width: 18px;
  height: 14px;
  display: inline-block;
  animation: menu-icon-idle 5.5s ease-in-out infinite;
}

.channels-double-icon::before,
.channels-double-icon::after {
  content: "💬";
  position: absolute;
  font-size: 0.86rem;
  line-height: 1;
  filter: drop-shadow(0 0 5px rgba(158, 206, 255, 0.32));
}

.channels-double-icon::before {
  left: 0;
  top: 0;
}

.channels-double-icon::after {
  left: 5px;
  top: -3px;
}

.side-btn-chats .menu-chats-badge {
  position: absolute;
  right: 6px;
  top: 5px;
}

.menu-chats-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff4f6f;
  color: #fff;
  font-size: 0.72rem;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  font-weight: 700;
}

.side-btn:hover,
.side-btn.active {
  background: rgba(124, 187, 255, 0.16);
}

.side-btn-icon.active:not(:hover):not(:focus-visible) {
  background: transparent;
}

.platform-content {
  padding: 18px 24px 26px;
  overflow-y: auto;
  background: var(--content-bg);
}

.service-lock-card {
  margin: 0;
  padding: 18px 20px;
  width: min(720px, 92%);
  border-radius: 14px;
  border: 1px solid var(--lock-card-border);
  background:
    var(--lock-card-bg),
    radial-gradient(circle at 20% 10%, rgba(136, 193, 255, 0.18), transparent 52%);
  box-shadow:
    inset 0 0 16px rgba(192, 227, 255, 0.16),
    0 14px 30px rgba(5, 17, 37, 0.24);
  animation: service-lock-pop 0.5s ease-out both;
}

.service-lock-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--lock-title);
}

.service-lock-card p {
  margin: 0;
  color: var(--lock-text);
  line-height: 1.5;
  font-size: 0.95rem;
}

@keyframes service-lock-pop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#home-view > :not(.service-lock-card) {
  display: none !important;
}

#home-view.content-view.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  background: var(--home-panel-bg);
  border: 1px solid var(--home-panel-border);
  border-radius: 14px;
  padding: 20px;
}

.content-view {
  display: none;
}

.content-view.active {
  display: block;
}

.platform-topbar h2 {
  margin: 0;
  font-size: 1.4rem;
}

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

.chip {
  border: 1px solid rgba(81, 136, 190, 0.25);
  background: var(--chip-bg);
  color: var(--chip-text);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip.accent {
  background: linear-gradient(145deg, #5ab3ff, #8d8cff);
  color: #fff;
  border: 0;
}

.chat-view {
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.chat-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
  border: 1px solid var(--chat-shell-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--chat-shell-bg);
  min-width: 0;
}

.chat-list {
  border-right: 1px solid var(--chat-shell-border);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  min-width: 0;
  overflow-x: hidden;
}

.chat-list-title {
  font-weight: 700;
  color: var(--chat-list-title);
  padding: 4px 6px;
}

.chat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-add-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(132, 174, 214, 0.45);
  border-radius: 8px;
  background: rgba(227, 241, 255, 0.95);
  color: #2f5a86;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.chat-add-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.chat-add-box input {
  border: 1px solid rgba(132, 174, 214, 0.4);
  border-radius: 10px;
  padding: 8px 10px;
}

.chat-add-box button {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
}

.chat-add-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.8rem;
  color: #587ca4;
}

.chat-empty {
  padding: 10px 8px;
  color: #6a88ad;
  font-size: 0.88rem;
}

.chat-contact {
  border: 1px solid rgba(132, 174, 214, 0.3);
  background: #fff;
  border-radius: 12px;
  padding: 8px 44px 8px 9px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  cursor: pointer;
  transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}

.chat-contact:hover,
.chat-contact:focus-visible {
  background: var(--chat-contact-hover-bg);
  border-color: var(--chat-contact-hover-border);
  box-shadow: 0 6px 14px var(--chat-contact-hover-glow);
}

.chat-contact-row {
  display: block;
  position: relative;
  isolation: isolate;
  z-index: 1;
}

.chat-contact-row.menu-open {
  z-index: 120;
}

.chat-contact-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 8;
}

.chat-contact-action-btn {
  border: 1px solid rgba(132, 174, 214, 0.38);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  color: #3b5f88;
  font-size: 0.88rem;
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.chat-contact.active {
  border-color: rgba(89, 164, 235, 0.8);
  background: rgba(221, 240, 255, 0.8);
}

.chat-contact.unread {
  border-color: rgba(108, 172, 236, 0.55);
  background: linear-gradient(120deg, rgba(233, 244, 255, 0.9), rgba(246, 251, 255, 0.96), rgba(229, 243, 255, 0.9));
  background-size: 220% 220%;
  animation: unreadPulseGradient 3.2s ease-in-out infinite;
  box-shadow: 0 0 0 1px rgba(135, 186, 237, 0.14) inset;
}

.chat-contact.blocked {
  border-color: var(--chat-contact-blocked-border);
  background: var(--chat-contact-blocked-bg);
  box-shadow: 0 0 0 1px rgba(228, 122, 146, 0.16) inset;
}

.chat-contact.blocked:hover,
.chat-contact.blocked:focus-visible,
.chat-contact.blocked.active {
  border-color: var(--chat-contact-blocked-border);
  background: var(--chat-contact-blocked-bg);
  box-shadow: 0 6px 14px var(--chat-contact-blocked-glow), 0 0 0 1px rgba(228, 122, 146, 0.16) inset;
}

.chat-contact.blocked.unread {
  animation: none;
  background: var(--chat-contact-blocked-bg);
}

@keyframes unreadPulseGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.chat-contact-name {
  font-weight: 700;
  color: #102338;
  font-size: 1.02rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-contact-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-contact-status {
  font-size: 0.9rem;
  color: #7d8ea1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-contact-status.online {
  color: #23a455;
  font-weight: 600;
}

.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chat-typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: chatTypingDotPulse 0.95s ease-in-out infinite;
}

.chat-typing-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.chat-typing-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes chatTypingDotPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1px); }
}

.chat-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, hsl(var(--avatar-h), 80%, 64%), hsl(calc(var(--avatar-h) + 32), 82%, 56%));
  box-shadow: 0 4px 12px rgba(53, 98, 147, 0.18);
  flex: 0 0 auto;
}

.chat-contact-avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.chat-contact-delete-btn {
  color: #8a9db1;
}

.chat-contact-unread-count {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #3a95ff;
  box-shadow: 0 3px 8px rgba(51, 121, 204, 0.34);
}

.chat-contact-gear {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(132, 174, 214, 0.38);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  color: #3b5f88;
  font-size: 1.18rem;
  line-height: 1;
  opacity: 1;
  transform: none;
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease, filter 180ms ease;
  cursor: pointer;
}

.chat-contact-gear:hover,
.chat-contact-gear:focus-visible {
  filter: drop-shadow(0 0 7px rgba(171, 219, 255, 0.52));
  animation: menu-icon-active 1.15s ease-in-out infinite;
  transform: translateY(-0.4px) scale(1.05);
}

.chat-contact-gear.active {
  background: rgba(236, 246, 255, 0.95);
  border-color: rgba(99, 164, 230, 0.62);
}

.chat-contact-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 188px;
  background: #fff;
  border: 1px solid rgba(198, 214, 232, 0.9);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(13, 44, 78, 0.16);
  padding: 6px;
  z-index: 200;
  display: grid;
  gap: 2px;
}

.chat-contact-menu-item {
  border: 0;
  background: transparent;
  color: #14273d;
  text-align: left;
  font-size: 0.95rem;
  padding: 8px 9px;
  border-radius: 9px;
  cursor: pointer;
}

.chat-contact-menu-item-info {
  /* Keep second line slightly shifted right under the text */
  padding-left: 24px;
  text-indent: -12px;
}

.chat-contact-menu-item:hover {
  background: rgba(234, 244, 255, 0.72);
}

.chat-contact-menu-divider {
  height: 1px;
  background: rgba(173, 194, 216, 0.55);
  margin: 4px 2px;
}

.chat-contact-menu-item.danger {
  color: #ff2f49;
}

.chat-window {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  min-width: 0;
  background:
    radial-gradient(1200px 480px at -10% -15%, rgba(166, 220, 255, 0.35), transparent 60%),
    radial-gradient(980px 420px at 110% 8%, rgba(196, 210, 255, 0.32), transparent 62%),
    linear-gradient(180deg, #edf6ff 0%, #e8f3ff 100%);
}

.chat-window-header {
  padding: 12px;
  border-bottom: 1px solid rgba(132, 174, 214, 0.35);
  color: #2f527c;
  background: rgba(244, 250, 255, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-window-peer-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(143, 187, 231, 0.55);
  box-shadow: 0 2px 8px rgba(48, 97, 148, 0.2);
  flex: 0 0 auto;
}

.chat-window-empty {
  color: #6d8caf;
  font-size: 0.9rem;
  padding: 2px 0;
}

.notify-root {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 90;
  display: grid;
  gap: 8px;
}

body.call-overlay-active {
  overflow: hidden;
}

.call-panel {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  gap: 0;
  margin: 0;
  background: rgba(5, 12, 26, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #e8f4ff;
  box-sizing: border-box;
}

body.theme-sunset .call-panel:not(.call-panel--compact) {
  background: rgba(42, 20, 14, 0.9);
}

body.theme-dawn .call-panel:not(.call-panel--compact) {
  background: rgba(16, 26, 48, 0.9);
}

body.theme-night .call-panel:not(.call-panel--compact) {
  background: rgba(4, 8, 20, 0.93);
}

.call-panel.call-panel--compact {
  inset: auto;
  right: 14px;
  bottom: 92px;
  left: auto;
  top: auto;
  width: min(320px, calc(100vw - 24px));
  max-height: min(85vh, 560px);
  overflow: auto;
  padding: 12px;
  background: rgba(12, 31, 56, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  align-items: stretch;
  justify-content: flex-start;
  border: 1px solid rgba(129, 183, 241, 0.38);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(7, 19, 35, 0.4);
}

.call-panel-card {
  position: relative;
  width: min(420px, 100%);
  max-width: 100%;
  background: rgba(12, 31, 56, 0.96);
  border: 1px solid rgba(129, 183, 241, 0.42);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(4, 12, 28, 0.55);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
}

.call-panel-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.call-video-wrap {
  position: relative;
  width: 100%;
  max-width: min(360px, 100%);
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(6, 14, 28, 0.92);
  box-shadow: inset 0 0 0 1px rgba(129, 183, 241, 0.25);
}

.call-video-wrap.hidden {
  display: none !important;
}

.call-remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a1420;
}

.call-local-video {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28%;
  max-width: 120px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 24, 48, 0.75);
}

/* Видеозвонок (развёрнуто): область превью на всю ширину/высоту под текущее разрешение */
.call-panel.call-panel--video:not(.call-panel--compact) {
  align-items: stretch;
  justify-content: flex-start;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-panel-card {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 16px;
  box-sizing: border-box;
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-panel-hero {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-video-wrap {
  flex: 1 1 0;
  min-height: min(78vh, calc(100vw * 0.72));
  width: 100%;
  max-width: none;
  aspect-ratio: unset;
  border-radius: 14px;
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-local-video {
  width: min(26vw, 280px);
  max-width: min(30vw, 300px);
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-panel-text {
  flex: 0 0 auto;
}

.call-panel.call-panel--video:not(.call-panel--compact) .call-actions {
  flex: 0 0 auto;
}

.call-panel.call-panel--compact .call-video-wrap {
  display: none !important;
}

.call-conference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  width: 100%;
  max-width: 300px;
  justify-items: center;
  align-items: start;
}

.call-conf-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 140px;
}

.call-conf-tile--span-bottom {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 140px;
}

.call-conf-tile--solo {
  grid-column: 1 / -1;
  justify-self: center;
}

.call-conf-avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 3px;
  background: linear-gradient(
    145deg,
    hsla(var(--avatar-h, 200), 72%, 62%, 0.55),
    hsla(calc(var(--avatar-h, 200) + 38), 78%, 52%, 0.4)
  );
  box-shadow: 0 6px 18px rgba(4, 14, 32, 0.45);
}

.call-conf-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(10, 24, 48, 0.65);
}

.call-conf-nick {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(232, 244, 255, 0.95);
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
  max-width: 100%;
}

.call-conf-mic {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.95;
}

.call-conf-mic.call-conf-mic--off {
  opacity: 0.65;
  filter: grayscale(0.35);
}

.call-panel.call-panel--compact .call-panel-card.call-panel-card--conference {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  grid-template-columns: unset;
  grid-template-rows: unset;
}

.call-panel.call-panel--compact .call-panel-card.call-panel-card--conference .call-panel-hero {
  grid-column: unset;
  grid-row: unset;
  width: 100%;
}

.call-panel.call-panel--compact .call-panel-card.call-panel-card--conference .call-panel-text {
  grid-column: unset;
  grid-row: unset;
  width: 100%;
}

.call-panel.call-panel--compact .call-panel-card.call-panel-card--conference .call-actions {
  grid-column: unset;
  grid-row: unset;
  width: 100%;
}

.call-panel.call-panel--compact .call-conference-grid {
  max-width: none;
}

.call-panel-text {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: center;
}

.call-panel:not(.call-panel--compact) .call-panel-card {
  padding: 26px 22px 22px;
  gap: 18px;
}

.call-panel:not(.call-panel--compact) .call-panel-hero {
  margin-bottom: 2px;
}

.call-peer-avatar-wrap {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 3px;
  background: linear-gradient(
    145deg,
    hsla(var(--avatar-h, 200), 72%, 62%, 0.55),
    hsla(calc(var(--avatar-h, 200) + 38), 78%, 52%, 0.4)
  );
  box-shadow:
    0 12px 40px rgba(5, 18, 40, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.call-peer-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(10, 24, 48, 0.65);
}

.call-panel.call-panel--compact .call-panel-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 36px 0 0;
  width: 100%;
  align-items: stretch;
  gap: 10px;
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
}

.call-panel.call-panel--compact .call-panel-hero {
  grid-column: 1;
  grid-row: 1 / span 1;
  align-self: start;
  justify-content: center;
}

.call-panel.call-panel--compact .call-panel-text {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.call-panel.call-panel--compact .call-actions {
  grid-column: 1 / -1;
  grid-row: 2;
}

.call-panel.call-panel--compact .call-peer-avatar-wrap {
  width: 48px;
  height: 48px;
  padding: 2px;
}

.call-panel.call-panel--compact .call-panel-text {
  text-align: left;
}

.call-panel.call-panel--compact .call-actions {
  justify-content: flex-end;
}

.call-panel:not(.call-panel--compact) .call-actions {
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}

.call-view-toggle {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: rgba(240, 248, 255, 0.95);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.04) 45%,
    rgba(12, 40, 88, 0.45) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 6px 18px rgba(0, 8, 24, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.call-view-toggle:hover {
  filter: brightness(1.08);
  border-color: rgba(180, 210, 255, 0.35);
}

.call-panel.call-panel--compact .call-view-toggle {
  top: 4px;
  right: 4px;
  padding: 5px 9px;
  font-size: 0.78rem;
}

.call-panel.hidden {
  display: none;
}

.call-panel.hidden .call-view-toggle {
  display: none;
}

.call-title {
  font-weight: 700;
  font-size: 1rem;
}

.call-panel:not(.call-panel--compact) .call-title {
  font-size: 1.28rem;
  letter-spacing: 0.02em;
}

.call-status {
  font-size: 0.9rem;
  color: #b7d6f5;
}

.call-panel:not(.call-panel--compact) .call-status {
  font-size: 0.98rem;
  color: rgba(200, 228, 255, 0.92);
}

.call-record-notice {
  font-size: 0.84rem;
  color: #ffd78f;
  background: rgba(255, 173, 64, 0.12);
  border: 1px solid rgba(255, 173, 64, 0.4);
  border-radius: 8px;
  padding: 6px 8px;
}

.call-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.call-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(6, 28, 72, 0.42) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 6px 18px rgba(0, 8, 28, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.12s ease;
}

.call-panel:not(.call-panel--compact) .call-btn {
  padding: 12px 20px;
  border-radius: 14px;
  min-height: 46px;
}

.call-btn:hover {
  filter: brightness(1.07);
  box-shadow:
    0 8px 24px rgba(0, 10, 36, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.call-btn:active {
  transform: translateY(1px);
}

.call-btn.accept {
  background: linear-gradient(
    165deg,
    rgba(80, 220, 150, 0.52) 0%,
    rgba(42, 175, 115, 0.35) 45%,
    rgba(10, 70, 50, 0.5) 100%
  );
  border-color: rgba(140, 235, 195, 0.4);
}

.call-btn.reject {
  background: linear-gradient(
    165deg,
    rgba(255, 110, 125, 0.55) 0%,
    rgba(220, 65, 80, 0.38) 50%,
    rgba(90, 20, 35, 0.48) 100%
  );
  border-color: rgba(255, 160, 170, 0.38);
}

.call-btn.end {
  background: linear-gradient(
    165deg,
    rgba(255, 95, 110, 0.52) 0%,
    rgba(215, 55, 70, 0.4) 50%,
    rgba(85, 18, 30, 0.52) 100%
  );
  border-color: rgba(255, 150, 160, 0.4);
}

.call-btn.switch {
  background: linear-gradient(
    165deg,
    rgba(100, 165, 255, 0.52) 0%,
    rgba(55, 120, 235, 0.38) 50%,
    rgba(18, 45, 110, 0.5) 100%
  );
  border-color: rgba(160, 200, 255, 0.4);
}

.call-btn.merge {
  background: linear-gradient(
    165deg,
    rgba(155, 135, 255, 0.52) 0%,
    rgba(110, 90, 230, 0.38) 50%,
    rgba(45, 30, 120, 0.48) 100%
  );
  border-color: rgba(190, 175, 255, 0.38);
}

.call-btn.record {
  background: linear-gradient(
    165deg,
    rgba(255, 145, 95, 0.52) 0%,
    rgba(235, 95, 85, 0.38) 50%,
    rgba(120, 40, 30, 0.48) 100%
  );
  border-color: rgba(255, 190, 150, 0.38);
}

.call-btn.record.recording {
  background: linear-gradient(
    165deg,
    rgba(130, 140, 155, 0.5) 0%,
    rgba(85, 95, 110, 0.45) 100%
  );
  border-color: rgba(180, 190, 205, 0.35);
}

.call-btn.mute {
  background: linear-gradient(
    165deg,
    rgba(95, 155, 255, 0.5) 0%,
    rgba(55, 105, 220, 0.4) 50%,
    rgba(20, 45, 110, 0.48) 100%
  );
  border-color: rgba(150, 190, 255, 0.38);
  min-width: 46px;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.call-btn.mute.muted {
  background: linear-gradient(
    165deg,
    rgba(120, 128, 142, 0.48) 0%,
    rgba(75, 82, 95, 0.45) 100%
  );
  border-color: rgba(160, 168, 182, 0.32);
}

.call-btn.mute::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 2px;
  background: #ff3b30;
  transform: rotate(-27deg) scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.call-btn.mute.muted::after {
  transform: rotate(-27deg) scaleX(1);
  opacity: 1;
}

.notify-toast {
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(14, 33, 64, 0.95);
  color: #ecf5ff;
  border: 1px solid rgba(139, 194, 255, 0.4);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
}

.chat-messages {
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(237, 247, 255, 0.96) 0%, rgba(231, 242, 255, 0.96) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='220' viewBox='0 0 320 220'%3E%3Cg fill='none' stroke='%238cb2d8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='0.26'%3E%3Cpath d='M22 79q6-22 28-22h27q17 0 22 13l9 0q7 0 7 7v6q0 7-7 7h-8q-2 14-16 14H46q-16 0-20-15h-8q-6 0-6-6v-6q0-7 7-7h8q3-11 12-17'/%3E%3Cpath d='M58 104v13M83 104v13M100 86q8-2 9-10'/%3E%3Cpath d='M140 112q2-22 23-27q18-5 38 5q11 6 25 5l12 0q8 0 8 8v4q0 8-8 8h-13q-2 10-13 10h-47q-17 0-25-13'/%3E%3Cpath d='M174 124v12M204 124v12M154 92l-5-11M158 90l8-6'/%3E%3Cpath d='M262 63q11 0 17 8q5 7 4 17q-1 8-7 14q-6 6-14 6q-8 0-14-6q-6-6-7-14q-1-10 4-17q6-8 17-8z'/%3E%3Cpath d='M248 74l-6-8M276 74l6-8M255 93q7 5 14 0'/%3E%3Cpath d='M66 167q8-8 17-8q7 0 11 4q4 4 10 4q8 0 15-8q-1 10-8 16q-7 6-16 6q-10 0-17-5q-8-6-12-9'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, 260px 180px;
  background-repeat: no-repeat, repeat;
}

.chat-bubble {
  max-width: min(78%, 460px);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.92rem;
  display: grid;
  gap: 3px;
  position: relative;
  overflow: visible;
  min-width: 0;
}

.chat-bubble.incoming {
  background: var(--msg-incoming-bg);
  border: 1px solid var(--msg-incoming-border);
  color: var(--msg-incoming-text);
  box-shadow: 0 3px 10px var(--msg-incoming-shadow);
}

.chat-bubble.outgoing {
  margin-left: auto;
  background: var(--msg-outgoing-bg);
  color: var(--msg-outgoing-text);
  box-shadow: 0 4px 12px var(--msg-outgoing-shadow);
}

.chat-bubble.selected-forward {
  background: linear-gradient(135deg, rgba(112, 191, 255, 0.34), rgba(143, 128, 255, 0.34));
  border: 1px solid rgba(116, 173, 233, 0.78);
  box-shadow: 0 0 0 1px rgba(132, 193, 255, 0.24), 0 8px 18px rgba(60, 116, 172, 0.22);
}

.chat-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
}

/* Одна строка + «…»; полный текст в атрибуте title у элемента */
.chat-bubble-text.chat-bubble-text-ellipsis {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  max-width: 100%;
}

.chat-bubble-emoji-only {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 2px 4px !important;
  max-width: none;
}

.chat-bubble-emoji-only .chat-bubble-controls,
.chat-bubble-emoji-only .chat-bubble-meta {
  display: none !important;
}

.chat-bubble.incoming.chat-bubble-emoji-only .chat-bubble-controls {
  display: flex !important;
}

.chat-bubble.best-readonly.chat-bubble-emoji-only .chat-bubble-controls,
.chat-bubble.best-readonly.chat-bubble-emoji-only .chat-bubble-meta {
  display: flex !important;
}

.chat-bubble.best-readonly.chat-bubble-emoji-only .chat-bubble-meta {
  display: inline-flex !important;
}

.chat-bubble-text-emoji-large {
  font-size: clamp(2.6rem, 8vw, 3.2rem);
  line-height: 1;
}

.chat-bubble-text-emoji-large {
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  line-height: 1.05;
}

.chat-bubble-reaction-badge {
  position: absolute;
  top: 8px;
  transform: none;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 182, 218, 0.65);
  box-shadow: 0 4px 12px rgba(34, 71, 110, 0.18);
  z-index: 5;
  pointer-events: none;
}

.chat-bubble-reaction-out {
  left: -34px;
}

.chat-bubble-reaction-in {
  right: -34px;
}

.chat-bubble-meta {
  justify-self: end;
  font-size: 0.72rem;
  opacity: 0.9;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.chat-status-check {
  font-size: 0.85em;
  line-height: 1;
  font-weight: 700;
}

.chat-status-check-first {
  margin-right: -1px;
}

.chat-status-check-second {
  margin-left: -1px;
}

.chat-status-check-green {
  color: #40d46b;
}

.chat-status-check-white {
  color: #ffffff;
}

.chat-bubble-meta-incoming-time {
  margin-top: 1px;
  opacity: 0.78;
}

.chat-bubble-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.chat-bubble-controls-best {
  justify-content: flex-end;
}

.chat-msg-best-delete {
  font-size: 1rem;
  line-height: 1;
}

.chat-msg-star-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  margin-right: auto;
  opacity: 0.82;
}

.chat-msg-star-btn:hover,
.chat-msg-star-btn:focus-visible {
  opacity: 1;
}

.chat-msg-star-btn.active {
  color: #c9a227;
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.42), rgba(230, 194, 80, 0.28));
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45) inset, 0 2px 8px rgba(120, 90, 20, 0.2);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.55);
  opacity: 1;
}

.chat-bubble.best-readonly .chat-bubble-reaction-badge {
  display: none;
}

.chat-bubble.best-readonly {
  pointer-events: auto;
}

.best-chat-window .chat-messages {
  flex: 1;
  min-height: 0;
}

.chat-msg-delete-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-msg-timer-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  font-size: 0.86rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-msg-forward-select-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-msg-forward-select-btn.active {
  background: rgba(72, 180, 118, 0.78);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(193, 255, 215, 0.28) inset;
}

.chat-msg-status-badge {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  line-height: 1;
  padding: 2px 6px;
  font-weight: 700;
}

.chat-bubble.outgoing .chat-msg-status-badge.chat-msg-status-scheduled {
  font-variant-numeric: tabular-nums;
  background: rgba(120, 150, 255, 0.38);
  box-shadow: 0 0 0 1px rgba(200, 210, 255, 0.22) inset;
}

.chat-bubble.outgoing.chat-bubble-scheduled-out {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22) dashed;
}

.chat-msg-reaction-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-msg-reaction-btn.active {
  background: rgba(72, 180, 118, 0.78);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(193, 255, 215, 0.28) inset;
}

.chat-msg-play-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  color: inherit;
  font-size: 0.86rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-msg-play-btn.active {
  background: rgba(72, 180, 118, 0.78);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(193, 255, 215, 0.28) inset;
}

.chat-msg-timer-btn.active {
  background: rgba(230, 80, 94, 0.78);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 182, 190, 0.24) inset;
}

.chat-bubble.incoming .chat-msg-timer-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-bubble.incoming .chat-msg-forward-select-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-bubble.incoming .chat-msg-forward-select-btn.active {
  background: rgba(72, 180, 118, 0.84);
  color: #fff;
}

.chat-bubble.incoming .chat-msg-play-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-bubble.incoming .chat-msg-play-btn.active {
  background: rgba(72, 180, 118, 0.84);
  color: #fff;
}

.chat-bubble.incoming .chat-msg-timer-btn.active {
  background: rgba(226, 90, 105, 0.82);
  color: #fff;
}

.chat-bubble.incoming .chat-msg-delete-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-bubble.incoming .chat-msg-status-badge {
  background: rgba(39, 86, 131, 0.12);
}

.chat-bubble.incoming .chat-msg-reaction-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-msg-timer-menu {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(122, 172, 221, 0.46);
  border-radius: 10px;
  padding: 6px;
}

.chat-msg-reaction-menu {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(122, 172, 221, 0.46);
  border-radius: 10px;
  padding: 6px;
}

.chat-msg-reaction-option {
  border: 0;
  border-radius: 8px;
  background: rgba(234, 245, 255, 0.9);
  font-size: 1rem;
  line-height: 1;
  padding: 5px 4px;
  cursor: pointer;
  animation: reaction-option-float 2.6s ease-in-out infinite;
  animation-delay: var(--reaction-delay, 0s);
}

.chat-msg-reaction-option.active {
  background: rgba(72, 180, 118, 0.78);
  box-shadow: 0 0 0 1px rgba(193, 255, 215, 0.28) inset;
}

.chat-msg-reaction-option-text {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #184a78;
  text-transform: uppercase;
}

.chat-msg-reaction-option-text.active {
  color: #ffffff;
}

.chat-msg-reaction-option-clear {
  color: #9f3f4c;
  font-size: 0.85rem;
  font-weight: 700;
  animation: none;
}

@keyframes reaction-option-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

.chat-msg-timer-option {
  border: 0;
  border-radius: 8px;
  background: rgba(234, 245, 255, 0.9);
  color: #274f79;
  font-size: 0.78rem;
  padding: 4px 6px;
  cursor: pointer;
}

.chat-msg-timer-option:hover,
.chat-msg-timer-option:focus-visible {
  background: rgba(214, 236, 255, 0.95);
}

.chat-msg-timer-option-cancel {
  grid-column: 1 / -1;
  background: rgba(255, 229, 232, 0.9);
  color: #a93f4c;
}

.chat-msg-timer-option-cancel:hover,
.chat-msg-timer-option-cancel:focus-visible {
  background: rgba(255, 214, 219, 0.95);
}

.chat-compose {
  border-top: 1px solid rgba(132, 174, 214, 0.35);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  background: rgba(244, 250, 255, 0.76);
  backdrop-filter: blur(2px);
  position: relative;
}

.chat-compose textarea {
  border: 1px solid rgba(132, 174, 214, 0.4);
  border-radius: 10px;
  padding: 9px 11px;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 38px;
  max-height: calc(1.45em * 15);
  line-height: 1.45;
  resize: none;
  overflow-y: hidden;
}

.chat-compose button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
  width: auto;
  white-space: nowrap;
  justify-self: start;
}

.chat-schedule-btn {
  min-width: 42px;
  width: 42px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  background: linear-gradient(145deg, #5aa8f0, #7d8eef);
}

.chat-schedule-btn.hidden {
  display: none !important;
}

.chat-schedule-panel {
  position: absolute;
  right: 10px;
  bottom: 52px;
  z-index: 46;
  min-width: min(96vw, 300px);
  max-width: 96vw;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(122, 172, 221, 0.5);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(34, 71, 110, 0.22);
}

.chat-schedule-panel.hidden {
  display: none !important;
}

.chat-schedule-panel-inner {
  display: grid;
  gap: 10px;
}

.chat-schedule-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1c4a78;
}

.chat-schedule-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #31557d;
}

.chat-schedule-input {
  border: 1px solid rgba(132, 174, 214, 0.55);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1c3557;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.chat-schedule-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #b83232;
}

.chat-schedule-status[data-type="success"] {
  color: #1e7a45;
}

.chat-schedule-attach {
  justify-self: start;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid rgba(132, 174, 214, 0.65);
  background: rgba(244, 249, 255, 0.98);
  color: #31557d;
  cursor: pointer;
}

.chat-schedule-attach:hover {
  background: #fff;
}

.chat-schedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.chat-schedule-apply {
  background: linear-gradient(145deg, #66b5ff, #8b97ff) !important;
  color: #fff !important;
}

.chat-schedule-cancel {
  background: rgba(230, 238, 248, 0.95) !important;
  color: #31557d !important;
}

.chat-schedule-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #4a6b8f;
}

@media (pointer: coarse) {
  .chat-compose {
    backdrop-filter: none;
  }
}

.chat-attach-btn {
  min-width: 84px;
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

.chat-emoji-btn {
  min-width: 38px;
  width: 38px;
  height: 36px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}

.chat-emoji-btn.active {
  background: rgba(72, 180, 118, 0.86);
  box-shadow: 0 0 0 1px rgba(193, 255, 215, 0.34) inset;
}

.chat-compose-emoji-menu {
  position: absolute;
  left: 10px;
  bottom: 56px;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(122, 172, 221, 0.46);
  border-radius: 10px;
  padding: 7px;
  box-shadow: 0 10px 22px rgba(34, 71, 110, 0.22);
}

.chat-compose-emoji-menu.hidden {
  display: none !important;
}

.chat-compose-emoji-option {
  border: 0;
  border-radius: 8px;
  background: rgba(234, 245, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1;
  padding: 6px 4px;
  cursor: pointer;
  animation: reaction-option-float 2.6s ease-in-out infinite;
  animation-delay: var(--reaction-delay, 0s);
}

.chat-compose-emoji-option:hover,
.chat-compose-emoji-option:focus-visible {
  background: rgba(214, 236, 255, 0.95);
}

#chat-send-btn {
  padding-left: 12px;
  padding-right: 12px;
  margin-left: 6px;
}

.chat-attach-add-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(145deg, #7bbcff, #90a1ff);
}

@media (max-width: 900px) {
  .chat-compose {
    gap: 6px;
  }

  .chat-attach-btn {
    min-width: 72px;
    padding: 0 8px;
  }

  .chat-compose-emoji-menu {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: min(92vw, 300px);
  }

  #chat-send-btn {
    margin-left: 4px;
    padding-left: 10px;
    padding-right: 10px;
  }
}

.chat-attachment-info {
  flex-basis: 100%;
  order: 10;
  font-size: 0.8rem;
  color: #5478a0;
  background: rgba(220, 236, 252, 0.7);
  border: 1px solid rgba(132, 174, 214, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
}

.chat-attachment-info.drag-over {
  border-color: rgba(84, 155, 230, 0.72);
  background: rgba(212, 231, 251, 0.95);
}

.chat-pending-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #31557d;
}

.chat-pending-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(49, 85, 125, 0.12);
}

.chat-pending-file-row:last-child {
  border-bottom: 0;
}

.chat-pending-file-name {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
}

.chat-pending-file-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(180, 80, 80, 0.18);
  color: #8b2c2c;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chat-pending-file-remove:hover,
.chat-pending-file-remove:focus-visible {
  background: rgba(180, 80, 80, 0.28);
}

.chat-upload-progress {
  flex-basis: 100%;
  order: 11;
  font-size: 0.78rem;
  color: #31557d;
  padding: 4px 8px;
  font-weight: 500;
  white-space: pre-line;
  line-height: 1.35;
}

.chat-upload-progress.hidden {
  display: none !important;
}

.chat-file-pending {
  opacity: 0.92;
  text-decoration: none;
  cursor: default;
  font-style: italic;
}

.chat-file-link {
  margin-top: 4px;
  display: inline-block;
  font-size: 0.82rem;
  color: inherit;
  text-decoration: underline;
}

.chat-bubble .chat-file-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.chat-inline-player {
  margin-top: 6px;
  width: min(100%, 320px);
  max-width: 100%;
  display: block;
}

.forward-card {
  width: min(92vw, 520px);
}

.forward-content {
  display: grid;
  gap: 10px;
}

.forward-target-list {
  max-height: min(38vh, 236px);
  overflow-y: auto;
  display: grid;
  gap: 7px;
}

.forward-target-btn {
  border: 1px solid rgba(130, 174, 216, 0.44);
  border-radius: 10px;
  background: rgba(236, 246, 255, 0.88);
  color: #1e476f;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  min-height: 40px;
}

.forward-target-btn.active {
  background: linear-gradient(145deg, rgba(108, 180, 255, 0.2), rgba(139, 148, 255, 0.24));
  border-color: rgba(103, 165, 228, 0.8);
  box-shadow: 0 0 0 1px rgba(130, 193, 255, 0.3);
}

.forward-search-row {
  display: flex;
  gap: 8px;
}

.forward-search-row input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(132, 174, 214, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
}

.forward-search-row button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
}

.forward-target-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.86rem;
  color: #5478a0;
}

.chat-inline-image {
  margin-top: 4px;
  display: block;
  max-width: min(100%, 240px);
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid rgba(132, 174, 214, 0.36);
  object-fit: cover;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(57, 109, 161, 0.16);
}

.image-viewer-card {
  width: min(95vw, 760px);
  gap: 10px;
}

.image-viewer-body {
  background: rgba(233, 245, 255, 0.72);
  border: 1px solid rgba(141, 184, 226, 0.42);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.image-viewer-img {
  max-width: 100%;
  max-height: min(72vh, 640px);
  border-radius: 10px;
  object-fit: contain;
}

.image-viewer-nav-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(129, 178, 225, 0.52);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #23476e;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-nav-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.image-viewer-counter {
  text-align: center;
  font-size: 0.84rem;
  color: #456b93;
}

.image-viewer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.chat-transcribe-controls {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chat-transcribe-lang {
  border: 1px solid rgba(132, 174, 214, 0.4);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.75);
  color: #1a3d66;
}

.chat-transcribe-btn {
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.76rem;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
}

.chat-transcribe-status {
  font-size: 0.74rem;
  color: #5e7ea3;
}

.roulette-block {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(132, 174, 214, 0.35);
}

.roulette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.roulette-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.roulette-streams {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stream-card {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(132, 174, 214, 0.34);
}

.stream-card.large .stream-preview {
  min-height: 220px;
}

.stream-preview {
  width: 100%;
}

.gradient-a {
  background: linear-gradient(135deg, #73b6ff, #6e88ff, #58d8d0);
}

.gradient-b {
  background: linear-gradient(135deg, #ff9a7a, #ff6fb3, #8f89ff);
}

.stream-meta {
  padding: 10px;
  display: grid;
  gap: 2px;
}

.stream-meta span {
  color: #57779b;
  font-size: 0.9rem;
}

.feed-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.video-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(132, 174, 214, 0.3);
  border-radius: 12px;
  padding: 10px;
}

.video-card h4 {
  margin: 8px 0 4px;
  font-size: 0.98rem;
}

.video-card p {
  margin: 0;
  color: #587ca4;
  font-size: 0.86rem;
}

.thumb {
  height: 120px;
  border-radius: 10px;
}

.thumb.t1 {
  background: linear-gradient(135deg, #4fa1ff, #6f7fff);
}

.thumb.t2 {
  background: linear-gradient(135deg, #f58d55, #ff5f88);
}

.thumb.t3 {
  background: linear-gradient(135deg, #4ad6bc, #4393ff);
}

.thumb.t4 {
  background: linear-gradient(135deg, #7f85ff, #b672ff);
}

@media (max-width: 980px) {
  body.logged-in .platform-sidebar {
    padding-top: 108px;
  }
  .platform {
    grid-template-columns: var(--sidebar-rail-width) minmax(0, 1fr);
  }
  .platform-sidebar {
    flex-direction: column;
    overflow-x: visible;
    align-items: center;
    padding: 10px;
  }
  .brand {
    margin-bottom: 0;
  }
  .roulette-streams {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-icon-btn-size: 40px;
    --sidebar-rail-width: 72px;
  }

  .lang-panel {
    top: calc(4px + env(safe-area-inset-top, 0px));
    left: 0;
    width: var(--sidebar-rail-width);
    justify-content: center;
  }

  .user-panel {
    top: calc(50px + env(safe-area-inset-top, 0px));
    left: 0;
    right: auto;
    width: var(--sidebar-rail-width);
    grid-template-columns: auto;
    align-items: start;
    justify-items: center;
  }

  .current-user-card {
    padding: 0;
  }

  .current-user-avatar-trigger,
  .current-user-avatar {
    width: 38px;
    height: 38px;
  }

  .logout-btn {
    padding: 8px 10px;
    align-self: stretch;
  }

  body.logged-in .platform-sidebar {
    padding-top: 100px;
  }

  .platform-sidebar {
    flex-direction: column;
    overflow-x: visible;
    padding: 8px;
    gap: 6px;
  }

  .brand {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .side-btn {
    padding: 8px 10px;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .side-btn-subs::after {
    margin-top: 16px;
  }

  .side-btn-subs .subs-bell-icon {
    transform: translateY(-3px) scale(0.94);
  }

  .platform-sidebar .side-btn-subs {
    height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 8px) !important;
    min-height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 8px) !important;
    flex-basis: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 8px) !important;
  }

  .platform-content {
    padding: 12px 10px 14px;
  }

  .chat-view {
    height: 100%;
    min-height: 0;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 262px minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }

  .chat-list {
    border-right: 0;
    border-bottom: 1px solid rgba(132, 174, 214, 0.35);
    min-height: 0;
    overflow-y: auto;
  }

  .chat-window {
    min-height: 0;
  }

  .platform-topbar h2 {
    font-size: 1.05rem;
  }

  .top-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
  }

  .chip {
    padding: 6px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .roulette-header {
    flex-direction: column;
    align-items: stretch;
  }

  .roulette-header h3 {
    font-size: 0.95rem;
  }

  .stream-card.large .stream-preview {
    min-height: 160px;
  }

  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .thumb {
    height: 92px;
  }

  .video-card h4 {
    font-size: 0.85rem;
  }

  .video-card p {
    font-size: 0.76rem;
  }

  .settings-screen {
    padding: 10px;
  }

  .settings-card {
    width: min(96vw, 520px);
    max-height: 90vh;
    overflow-y: auto;
  }
}

@media (max-width: 1100px) and (pointer: coarse) {
  .user-panel {
    top: calc(64px + env(safe-area-inset-top, 0px));
  }

  body.logged-in .platform-sidebar {
    padding-top: 114px;
  }
}

.app-settings-card {
  gap: 12px;
  width: min(420px, 90vw);
}

.chat-user-info-card {
  gap: 10px;
}

.chat-user-info-content {
  display: grid;
  gap: 8px;
}

.chat-user-info-name {
  font-size: 1.05rem;
  color: #2d4f7a;
}

.chat-user-info-bio {
  margin: 0;
  color: #4e7097;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-settings-card {
  gap: 10px;
}

.chat-settings-content {
  display: grid;
  gap: 8px;
}

.chat-settings-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  color: #2d4f7a;
  font-weight: 700;
}

.chat-settings-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #579ee6;
}

.chat-settings-content label {
  color: #2d4f7a;
  font-weight: 700;
}

.chat-settings-select {
  width: 100%;
  border: 1px solid rgba(123, 163, 203, 0.45);
  border-radius: 10px;
  padding: 9px 11px;
  background: linear-gradient(145deg, #ffffff, #eef6ff);
  color: #27466d;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-settings-select:hover,
.chat-settings-select:focus-visible {
  border-color: rgba(90, 161, 233, 0.7);
  box-shadow: 0 0 0 3px rgba(104, 184, 255, 0.2);
  transform: translateY(-0.5px);
}

.avatar-crop-card {
  gap: 10px;
}

.avatar-crop-hint {
  color: #4e7097;
  font-size: 0.9rem;
  line-height: 1.35;
}

.avatar-crop-viewport {
  width: min(72vw, 300px);
  aspect-ratio: 1 / 1;
  margin: 2px auto 0;
  position: relative;
  border-radius: 18px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.45) 0%, rgba(238, 247, 255, 0.28) 60%, rgba(225, 237, 252, 0.32) 100%);
  border: 1px solid rgba(116, 161, 206, 0.3);
  overflow: hidden;
  touch-action: none;
}

.avatar-crop-image {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  max-height: none;
  will-change: transform;
  user-select: none;
  pointer-events: none;
}

.avatar-crop-ring {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 100vmax rgba(9, 19, 31, 0.35),
    inset 0 0 12px rgba(65, 121, 177, 0.32);
  pointer-events: none;
}

.avatar-crop-scale-wrap {
  display: grid;
  gap: 6px;
}

.avatar-crop-scale-wrap label {
  color: #2d4f7a;
  font-weight: 700;
}

#avatar-crop-scale {
  width: 100%;
}

.app-settings-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(146, 189, 228, 0.36);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.96), rgba(240, 248, 255, 0.94));
}

.app-settings-block-title {
  color: #2b4b75;
  font-weight: 800;
  text-align: center;
  font-size: 1.18rem;
}

.theme-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 10px;
}

.theme-option-btn {
  border: 1px solid rgba(129, 173, 216, 0.45);
  background: linear-gradient(145deg, #ffffff, #eaf4ff);
  color: #25466f;
  border-radius: 12px;
  padding: 10px 12px;
  width: min(340px, 100%);
  min-width: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.06rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.theme-option-btn:hover,
.theme-option-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(92, 166, 238, 0.72);
  box-shadow: 0 8px 16px rgba(35, 88, 146, 0.16);
}

.theme-option-btn.active {
  border-color: rgba(80, 157, 236, 0.95);
  box-shadow: 0 0 0 2px rgba(102, 183, 255, 0.22);
}

.app-settings-sound-block {
  margin-top: 2px;
}

.app-settings-tz-block {
  margin-top: 2px;
  border: 1px solid rgba(118, 186, 230, 0.42);
  background: linear-gradient(165deg, rgba(248, 252, 255, 0.98), rgba(232, 245, 255, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.app-settings-hint-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #4a6b8f;
  text-align: center;
}

.app-settings-timezone-select {
  border: 1px solid rgba(133, 177, 217, 0.48);
  background: rgba(255, 255, 255, 0.95);
  color: #234e78;
  border-radius: 12px;
  font-size: 0.95rem;
  padding: 11px 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}

.app-server-time-chip {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #31557d;
  text-align: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(214, 236, 255, 0.55);
  border: 1px solid rgba(132, 186, 228, 0.35);
  font-variant-numeric: tabular-nums;
}

.chat-schedule-server-time {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #4a6b8f;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(236, 246, 255, 0.75);
  border: 1px dashed rgba(132, 174, 214, 0.45);
  font-variant-numeric: tabular-nums;
}

.app-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.app-settings-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.app-settings-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  color: #2d4f7a;
  font-weight: 700;
}

.app-settings-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.app-settings-grid label {
  color: #2d4f7a;
  font-weight: 700;
  font-size: 1.05rem;
}

.app-settings-grid select {
  border: 1px solid rgba(133, 177, 217, 0.42);
  background: rgba(252, 254, 255, 0.96);
  color: #234e78;
  border-radius: 12px;
  font-size: 1rem;
  padding: 10px 12px;
}

.app-settings-grid select:disabled {
  opacity: 0.62;
}

.app-settings-play-btn {
  width: auto !important;
  min-width: 88px;
  border: 1px solid rgba(129, 173, 216, 0.48);
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #eaf4ff);
  color: #244970;
  font-weight: 700;
  font-size: 0.94rem;
  padding: 10px 10px;
  cursor: pointer;
}

.app-settings-play-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.app-settings-card .settings-actions {
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  justify-items: center;
}

.app-settings-card .settings-actions button {
  width: min(340px, 100%);
  font-size: 1.06rem;
}

body.theme-sunset {
  --main-screen-bg: radial-gradient(circle at top, #ffe9d8 0%, #ffe2c9 42%, #ffd6bb 100%);
  --main-screen-text: #5f3c2e;
  --sidebar-bg: linear-gradient(180deg, #8e5a3c, #a66b48);
  --sidebar-text: #fff3e8;
  --sidebar-border: rgba(255, 223, 196, 0.24);
  --content-bg: transparent;
  --home-panel-bg: rgba(255, 247, 236, 0.96);
  --home-panel-border: rgba(235, 190, 150, 0.58);
  --lock-card-bg: linear-gradient(165deg, rgba(159, 98, 66, 0.95), rgba(181, 118, 77, 0.93));
  --lock-card-border: rgba(255, 208, 168, 0.6);
  --lock-title: #fff7ef;
  --lock-text: #ffebd7;
  --chat-shell-bg: rgba(255, 246, 235, 0.95);
  --chat-shell-border: rgba(229, 181, 138, 0.56);
  --chat-list-title: #8a5c3b;
  --chat-contact-hover-bg: rgba(255, 241, 223, 0.96);
  --chat-contact-hover-border: rgba(227, 169, 113, 0.72);
  --chat-contact-hover-glow: rgba(226, 167, 109, 0.24);
  --msg-incoming-bg: rgba(255, 251, 247, 0.95);
  --msg-incoming-border: rgba(222, 172, 127, 0.44);
  --msg-incoming-text: #7a4b2f;
  --msg-incoming-shadow: rgba(171, 118, 79, 0.12);
  --msg-outgoing-bg: linear-gradient(145deg, #e3a06a, #d38658);
  --msg-outgoing-text: #fff8ef;
  --msg-outgoing-shadow: rgba(174, 103, 61, 0.2);
  --chat-contact-blocked-bg: rgba(255, 236, 233, 0.94);
  --chat-contact-blocked-border: rgba(225, 136, 124, 0.66);
  --chat-contact-blocked-glow: rgba(222, 128, 116, 0.22);
  --chip-bg: rgba(255, 242, 226, 0.92);
  --chip-text: #7a4c2f;
  --settings-bg: rgba(255, 245, 233, 0.97);
  --settings-text: #6d452b;
  --settings-border: rgba(230, 179, 133, 0.58);
  --lang-panel-bg: linear-gradient(165deg, rgba(140, 88, 55, 0.9), rgba(116, 70, 44, 0.88));
  --lang-panel-glow: rgba(255, 198, 138, 0.34);
  --lang-btn-bg: rgba(128, 80, 50, 0.9);
  --lang-btn-border: rgba(255, 205, 162, 0.45);
  --lang-btn-text: #fff3e7;
  --lang-btn-active-border: rgba(255, 220, 182, 0.95);
  --lang-btn-active-ring: rgba(255, 196, 141, 0.28);
  --scrollbar-track: rgba(255, 230, 205, 0.66);
  --scrollbar-thumb: rgba(225, 170, 125, 0.62);
  --scrollbar-thumb-hover: rgba(213, 154, 106, 0.74);
}

body.theme-sunset .chat-view {
  background: transparent;
}

body.theme-sunset .chat-list {
  background: rgba(255, 243, 229, 0.9);
}

body.theme-sunset .chat-add-btn {
  border-color: rgba(222, 165, 118, 0.52);
  background: rgba(255, 233, 210, 0.95);
  color: #8a5a37;
}

body.theme-sunset .chat-add-box input {
  border-color: rgba(221, 168, 123, 0.46);
  background: rgba(255, 245, 233, 0.96);
  color: #7b4e30;
}

body.theme-sunset .chat-empty,
body.theme-sunset .chat-add-status,
body.theme-sunset .chat-window-empty {
  color: #9a6a48;
}

body.theme-sunset .chat-contact {
  border-color: rgba(221, 170, 126, 0.44);
  background: rgba(255, 250, 244, 0.92);
}

body.theme-sunset .chat-contact.active {
  border-color: rgba(229, 166, 111, 0.74);
  background: rgba(255, 236, 214, 0.92);
}

body.theme-sunset .chat-contact.blocked,
body.theme-sunset .chat-contact.blocked.active,
body.theme-sunset .chat-contact.blocked.unread,
body.theme-sunset .chat-contact.blocked:hover,
body.theme-sunset .chat-contact.blocked:focus-visible {
  border-color: var(--chat-contact-blocked-border);
  background: var(--chat-contact-blocked-bg);
  box-shadow: 0 6px 14px var(--chat-contact-blocked-glow), 0 0 0 1px rgba(228, 122, 146, 0.16) inset;
}

body.theme-sunset .chat-contact.unread {
  border-color: rgba(227, 168, 109, 0.58);
  background: linear-gradient(120deg, rgba(255, 243, 226, 0.94), rgba(255, 249, 240, 0.98), rgba(255, 240, 218, 0.94));
  box-shadow: 0 0 0 1px rgba(225, 171, 117, 0.16) inset;
}

body.theme-sunset .chat-contact-name {
  color: #6f4427;
}

body.theme-sunset .chat-contact-status {
  color: #a27453;
}

body.theme-sunset .chat-contact-action-btn,
body.theme-sunset .chat-contact-gear {
  border-color: rgba(216, 162, 117, 0.48);
  background: rgba(255, 243, 230, 0.94);
  color: #8b5a36;
}

body.theme-sunset .chat-contact-gear.active {
  background: rgba(255, 232, 210, 0.95);
  border-color: rgba(229, 166, 111, 0.72);
}

body.theme-sunset .chat-contact-menu {
  background: rgba(255, 248, 239, 0.98);
  border-color: rgba(220, 170, 126, 0.72);
  box-shadow: 0 14px 30px rgba(120, 78, 49, 0.18);
}

body.theme-sunset .chat-contact-menu-item {
  color: #70462a;
}

body.theme-sunset .chat-contact-menu-item:hover {
  background: rgba(255, 234, 213, 0.76);
}

body.theme-sunset .chat-contact-menu-divider {
  background: rgba(214, 166, 126, 0.54);
}

body.theme-sunset .chat-window {
  background:
    radial-gradient(1200px 480px at -10% -15%, rgba(255, 191, 143, 0.24), transparent 62%),
    radial-gradient(980px 420px at 110% 8%, rgba(240, 173, 121, 0.2), transparent 64%),
    linear-gradient(180deg, #fff4e6 0%, #ffedda 100%);
}

body.theme-sunset .chat-window-header {
  border-bottom-color: rgba(219, 166, 121, 0.56);
  color: #84522f;
  background: rgba(255, 245, 234, 0.78);
}

body.theme-sunset .chat-messages {
  background:
    radial-gradient(900px 360px at 0% 0%, rgba(246, 187, 141, 0.2), transparent 62%),
    linear-gradient(180deg, rgba(255, 246, 237, 0.94), rgba(255, 240, 224, 0.95));
}

body.theme-sunset .chat-compose {
  background: rgba(255, 243, 230, 0.94);
  border-top-color: rgba(214, 164, 122, 0.54);
}

body.theme-sunset .chat-bubble.selected-forward {
  background: linear-gradient(135deg, rgba(255, 187, 129, 0.34), rgba(255, 134, 168, 0.28));
  border-color: rgba(224, 152, 112, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 197, 148, 0.26), 0 8px 18px rgba(182, 106, 69, 0.24);
}

body.theme-sunset .chat-compose textarea {
  background: rgba(255, 250, 244, 0.96);
  border-color: rgba(214, 164, 122, 0.5);
  color: #764a2d;
}

body.theme-sunset .chat-compose button {
  border-color: rgba(214, 164, 122, 0.5);
  background: rgba(255, 236, 214, 0.94);
  color: #7f4f30;
}

body.theme-sunset #chat-send-btn {
  background: linear-gradient(145deg, #e09a62, #cb7f4f);
  border-color: rgba(213, 152, 101, 0.64);
  color: #fff7ef;
}

body.theme-dawn {
  --main-screen-bg: radial-gradient(circle at top, #ffeaf3 0%, #ffdceb 42%, #ffd0e3 100%);
  --main-screen-text: #6d3252;
  --sidebar-bg: linear-gradient(180deg, #9d4d77, #b5638d);
  --sidebar-text: #fff1f8;
  --sidebar-border: rgba(255, 209, 231, 0.28);
  --content-bg: transparent;
  --home-panel-bg: rgba(255, 245, 251, 0.96);
  --home-panel-border: rgba(231, 165, 202, 0.58);
  --lock-card-bg: linear-gradient(165deg, rgba(172, 89, 135, 0.94), rgba(194, 108, 152, 0.92));
  --lock-card-border: rgba(255, 206, 231, 0.62);
  --lock-title: #fff3fa;
  --lock-text: #ffe0ef;
  --chat-shell-bg: rgba(255, 244, 251, 0.95);
  --chat-shell-border: rgba(228, 164, 200, 0.56);
  --chat-list-title: #965179;
  --chat-contact-hover-bg: rgba(255, 236, 247, 0.96);
  --chat-contact-hover-border: rgba(225, 150, 193, 0.72);
  --chat-contact-hover-glow: rgba(224, 142, 188, 0.24);
  --msg-incoming-bg: rgba(255, 250, 253, 0.96);
  --msg-incoming-border: rgba(225, 164, 196, 0.46);
  --msg-incoming-text: #7d4564;
  --msg-incoming-shadow: rgba(170, 103, 142, 0.12);
  --msg-outgoing-bg: linear-gradient(145deg, #e48ec1, #d97aac);
  --msg-outgoing-text: #fff7fc;
  --msg-outgoing-shadow: rgba(168, 81, 126, 0.2);
  --chat-contact-blocked-bg: rgba(255, 234, 241, 0.94);
  --chat-contact-blocked-border: rgba(227, 133, 166, 0.66);
  --chat-contact-blocked-glow: rgba(223, 121, 158, 0.24);
  --chip-bg: rgba(255, 237, 247, 0.92);
  --chip-text: #814868;
  --settings-bg: rgba(255, 245, 251, 0.97);
  --settings-text: #6f3d5a;
  --settings-border: rgba(227, 169, 201, 0.58);
  --lang-panel-bg: linear-gradient(165deg, rgba(144, 71, 112, 0.9), rgba(122, 58, 95, 0.88));
  --lang-panel-glow: rgba(255, 178, 220, 0.34);
  --lang-btn-bg: rgba(134, 65, 104, 0.9);
  --lang-btn-border: rgba(255, 198, 227, 0.45);
  --lang-btn-text: #fff2fa;
  --lang-btn-active-border: rgba(255, 220, 237, 0.95);
  --lang-btn-active-ring: rgba(255, 182, 222, 0.28);
  --scrollbar-track: rgba(255, 223, 240, 0.66);
  --scrollbar-thumb: rgba(221, 153, 193, 0.64);
  --scrollbar-thumb-hover: rgba(208, 132, 179, 0.76);
}

body.theme-dawn .chat-view {
  background: transparent;
}

body.theme-dawn .chat-list {
  background: rgba(255, 239, 248, 0.9);
}

body.theme-dawn .chat-add-btn {
  border-color: rgba(220, 155, 195, 0.52);
  background: rgba(255, 228, 244, 0.95);
  color: #8f4f72;
}

body.theme-dawn .chat-add-box input {
  border-color: rgba(221, 160, 196, 0.46);
  background: rgba(255, 244, 250, 0.96);
  color: #7b4463;
}

body.theme-dawn .chat-empty,
body.theme-dawn .chat-add-status,
body.theme-dawn .chat-window-empty {
  color: #9f5f82;
}

body.theme-dawn .chat-contact {
  border-color: rgba(220, 164, 198, 0.44);
  background: rgba(255, 249, 253, 0.92);
}

body.theme-dawn .chat-contact.active {
  border-color: rgba(229, 154, 194, 0.74);
  background: rgba(255, 233, 246, 0.92);
}

body.theme-dawn .chat-contact.blocked,
body.theme-dawn .chat-contact.blocked.active,
body.theme-dawn .chat-contact.blocked.unread,
body.theme-dawn .chat-contact.blocked:hover,
body.theme-dawn .chat-contact.blocked:focus-visible {
  border-color: var(--chat-contact-blocked-border);
  background: var(--chat-contact-blocked-bg);
  box-shadow: 0 6px 14px var(--chat-contact-blocked-glow), 0 0 0 1px rgba(228, 122, 146, 0.16) inset;
}

body.theme-dawn .chat-contact.unread {
  border-color: rgba(223, 155, 193, 0.58);
  background: linear-gradient(120deg, rgba(255, 238, 249, 0.94), rgba(255, 247, 252, 0.98), rgba(255, 232, 245, 0.94));
  box-shadow: 0 0 0 1px rgba(225, 171, 117, 0.16) inset;
}

body.theme-dawn .chat-contact-name {
  color: #6f3957;
}

body.theme-dawn .chat-contact-status {
  color: #a66d8b;
}

body.theme-dawn .chat-contact-action-btn,
body.theme-dawn .chat-contact-gear {
  border-color: rgba(215, 153, 188, 0.48);
  background: rgba(255, 240, 249, 0.94);
  color: #8d4f71;
}

body.theme-dawn .chat-contact-gear.active {
  background: rgba(255, 227, 242, 0.95);
  border-color: rgba(229, 154, 194, 0.72);
}

body.theme-dawn .chat-contact-menu {
  background: rgba(255, 246, 251, 0.98);
  border-color: rgba(220, 160, 196, 0.72);
  box-shadow: 0 14px 30px rgba(125, 70, 101, 0.18);
}

body.theme-dawn .chat-contact-menu-item {
  color: #70425c;
}

body.theme-dawn .chat-contact-menu-item:hover {
  background: rgba(255, 232, 246, 0.76);
}

body.theme-dawn .chat-contact-menu-divider {
  background: rgba(214, 153, 187, 0.54);
}

body.theme-dawn .chat-window {
  background:
    radial-gradient(1200px 480px at -10% -15%, rgba(255, 171, 214, 0.22), transparent 62%),
    radial-gradient(980px 420px at 110% 8%, rgba(241, 153, 204, 0.2), transparent 64%),
    linear-gradient(180deg, #fff1f8 0%, #ffe6f2 100%);
}

body.theme-dawn .chat-window-header {
  border-bottom-color: rgba(219, 154, 192, 0.56);
  color: #844d6a;
  background: rgba(255, 242, 249, 0.78);
}

body.theme-dawn .chat-messages {
  background:
    radial-gradient(900px 360px at 0% 0%, rgba(247, 173, 214, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(255, 244, 250, 0.94), rgba(255, 232, 244, 0.95));
}

body.theme-dawn .chat-compose {
  background: rgba(255, 239, 248, 0.94);
  border-top-color: rgba(214, 152, 187, 0.54);
}

body.theme-dawn .chat-bubble.selected-forward {
  background: linear-gradient(135deg, rgba(255, 168, 215, 0.34), rgba(255, 141, 189, 0.30));
  border-color: rgba(222, 136, 183, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 191, 227, 0.26), 0 8px 18px rgba(177, 95, 141, 0.24);
}

body.theme-dawn .chat-compose textarea {
  background: rgba(255, 249, 253, 0.96);
  border-color: rgba(214, 152, 187, 0.5);
  color: #764360;
}

body.theme-dawn .chat-compose button {
  border-color: rgba(214, 152, 187, 0.5);
  background: rgba(255, 232, 246, 0.94);
  color: #7f4865;
}

body.theme-dawn #chat-send-btn {
  background: linear-gradient(145deg, #de88ba, #c86fa2);
  border-color: rgba(214, 143, 182, 0.64);
  color: #fff6fb;
}

body.theme-night {
  --main-screen-bg: radial-gradient(circle at top, #0d1d34 0%, #0a1427 45%, #081020 100%);
  --main-screen-text: #d7e9ff;
  --sidebar-bg: linear-gradient(180deg, #081225, #0b1a31);
  --sidebar-text: #dcecff;
  --sidebar-border: rgba(155, 193, 232, 0.2);
  --content-bg: transparent;
  --home-panel-bg: rgba(16, 29, 48, 0.9);
  --home-panel-border: rgba(129, 165, 204, 0.48);
  --lock-card-bg: linear-gradient(165deg, rgba(20, 40, 70, 0.96), rgba(13, 29, 54, 0.95));
  --lock-card-border: rgba(121, 164, 214, 0.5);
  --lock-title: #ebf5ff;
  --lock-text: #c7ddf4;
  --chat-shell-bg: rgba(14, 26, 45, 0.9);
  --chat-shell-border: rgba(115, 154, 198, 0.42);
  --chat-list-title: #cbe3ff;
  --chat-contact-hover-bg: rgba(29, 54, 84, 0.96);
  --chat-contact-hover-border: rgba(118, 176, 235, 0.72);
  --chat-contact-hover-glow: rgba(86, 150, 216, 0.24);
  --msg-incoming-bg: rgba(15, 32, 53, 0.97);
  --msg-incoming-border: rgba(78, 122, 171, 0.44);
  --msg-incoming-text: #d8ebff;
  --msg-incoming-shadow: rgba(6, 14, 29, 0.46);
  --msg-outgoing-bg: linear-gradient(145deg, #2b588a, #324f78);
  --msg-outgoing-text: #eef7ff;
  --msg-outgoing-shadow: rgba(8, 21, 40, 0.4);
  --chat-contact-blocked-bg: rgba(63, 39, 52, 0.92);
  --chat-contact-blocked-border: rgba(214, 123, 144, 0.66);
  --chat-contact-blocked-glow: rgba(211, 115, 138, 0.2);
  --chip-bg: rgba(23, 42, 68, 0.9);
  --chip-text: #d2e6ff;
  --settings-bg: rgba(17, 31, 52, 0.95);
  --settings-text: #d9e9ff;
  --settings-border: rgba(109, 150, 196, 0.5);
  --lang-panel-bg: linear-gradient(165deg, rgba(8, 20, 39, 0.92), rgba(10, 26, 49, 0.9));
  --lang-panel-glow: rgba(120, 167, 222, 0.3);
  --lang-btn-bg: rgba(17, 34, 60, 0.92);
  --lang-btn-border: rgba(121, 163, 209, 0.42);
  --lang-btn-text: #e7f2ff;
  --lang-btn-active-border: rgba(147, 204, 255, 0.96);
  --lang-btn-active-ring: rgba(100, 176, 245, 0.28);
  --scrollbar-track: rgba(18, 35, 60, 0.72);
  --scrollbar-thumb: rgba(92, 131, 175, 0.62);
  --scrollbar-thumb-hover: rgba(117, 157, 203, 0.74);
}

body.theme-night .chat-view {
  background: transparent;
}

body.theme-night .chat-list {
  background: rgba(10, 22, 39, 0.82);
}

body.theme-night .chat-add-btn {
  border-color: rgba(106, 146, 190, 0.52);
  background: rgba(23, 44, 72, 0.92);
  color: #d4e9ff;
}

body.theme-night .chat-add-box input {
  border-color: rgba(109, 149, 193, 0.5);
  background: rgba(15, 31, 53, 0.92);
  color: #d8ecff;
}

body.theme-night .chat-add-box button {
  background: linear-gradient(145deg, #2d6fb3, #4f7bc2);
}

body.theme-night .chat-empty,
body.theme-night .chat-add-status,
body.theme-night .chat-window-empty {
  color: #a8c4e2;
}

body.theme-night .chat-contact {
  border-color: rgba(101, 140, 184, 0.45);
  background: rgba(16, 33, 56, 0.9);
}

body.theme-night .chat-contact.active {
  border-color: rgba(106, 173, 244, 0.72);
  background: rgba(26, 51, 82, 0.96);
}

body.theme-night .chat-contact.blocked,
body.theme-night .chat-contact.blocked.active,
body.theme-night .chat-contact.blocked.unread,
body.theme-night .chat-contact.blocked:hover,
body.theme-night .chat-contact.blocked:focus-visible {
  border-color: var(--chat-contact-blocked-border);
  background: var(--chat-contact-blocked-bg);
  box-shadow: 0 6px 14px var(--chat-contact-blocked-glow), 0 0 0 1px rgba(228, 122, 146, 0.16) inset;
}

body.theme-night .chat-contact.unread {
  border-color: rgba(105, 163, 229, 0.55);
  background: linear-gradient(120deg, rgba(20, 42, 69, 0.94), rgba(24, 48, 78, 0.98), rgba(19, 41, 68, 0.94));
  box-shadow: 0 0 0 1px rgba(105, 163, 229, 0.16) inset;
}

body.theme-night .chat-contact-name {
  color: #d9ecff;
}

body.theme-night .chat-contact-status {
  color: #98b3cf;
}

body.theme-night .chat-contact-action-btn,
body.theme-night .chat-contact-gear {
  border-color: rgba(97, 138, 183, 0.5);
  background: rgba(20, 39, 65, 0.95);
  color: #c9dff7;
}

body.theme-night .chat-contact-gear.active {
  background: rgba(33, 61, 95, 0.95);
  border-color: rgba(106, 173, 244, 0.68);
}

body.theme-night .chat-contact-menu {
  background: rgba(11, 23, 40, 0.98);
  border-color: rgba(99, 139, 183, 0.62);
  box-shadow: 0 14px 30px rgba(4, 10, 20, 0.45);
}

body.theme-night .chat-contact-menu-item {
  color: #d4e9ff;
}

body.theme-night .chat-contact-menu-item:hover {
  background: rgba(31, 58, 93, 0.72);
}

body.theme-night .chat-contact-menu-divider {
  background: rgba(104, 142, 184, 0.5);
}

body.theme-night .settings-upload-btn {
  background: rgba(26, 46, 73, 0.95);
  border-color: rgba(112, 157, 206, 0.58);
  color: #e7f3ff;
}

body.theme-night .settings-upload-btn:hover,
body.theme-night .settings-upload-btn:focus-visible {
  background: rgba(35, 60, 92, 0.96);
  border-color: rgba(143, 190, 240, 0.72);
}

body.theme-sunset .settings-card {
  border-color: rgba(217, 167, 127, 0.34);
  box-shadow: 0 16px 34px rgba(145, 93, 56, 0.22);
}

body.theme-sunset .settings-card input,
body.theme-sunset .settings-card select,
body.theme-sunset .settings-card textarea {
  border-color: rgba(219, 170, 130, 0.44);
  background: rgba(255, 249, 242, 0.96);
  color: #7a4e2f;
}

body.theme-sunset .settings-subsection {
  border-color: rgba(223, 177, 140, 0.38);
  background: rgba(255, 248, 239, 0.92);
}

body.theme-night .settings-card {
  border-color: rgba(106, 147, 192, 0.34);
  box-shadow: 0 18px 36px rgba(6, 16, 30, 0.52);
}

body.theme-night .settings-card input,
body.theme-night .settings-card select,
body.theme-night .settings-card textarea {
  border-color: rgba(102, 143, 189, 0.5);
  background: rgba(14, 30, 52, 0.96);
  color: #d8ecff;
}

body.theme-night .settings-subsection {
  border-color: rgba(95, 136, 183, 0.4);
  background: rgba(18, 35, 58, 0.9);
}

body.theme-night .chat-window {
  background:
    radial-gradient(1200px 480px at -10% -15%, rgba(68, 118, 181, 0.24), transparent 62%),
    radial-gradient(980px 420px at 110% 8%, rgba(89, 124, 185, 0.22), transparent 64%),
    linear-gradient(180deg, #0f233e 0%, #0c1d36 100%);
}

body.theme-night .chat-window-header {
  border-bottom-color: rgba(97, 136, 180, 0.55);
  color: #cfe6ff;
  background: rgba(17, 35, 59, 0.78);
}

body.theme-night .chat-messages {
  background:
    radial-gradient(900px 360px at 0% 0%, rgba(59, 108, 168, 0.2), transparent 62%),
    linear-gradient(180deg, rgba(12, 25, 43, 0.92), rgba(10, 22, 39, 0.95));
}

body.theme-night .chat-compose {
  background: rgba(15, 31, 53, 0.92);
  border-top-color: rgba(95, 134, 178, 0.55);
}

body.theme-night .chat-bubble.selected-forward {
  background: linear-gradient(135deg, rgba(80, 120, 176, 0.34), rgba(84, 93, 168, 0.32));
  border-color: rgba(98, 139, 203, 0.7);
  box-shadow: 0 0 0 1px rgba(122, 163, 224, 0.2), 0 8px 18px rgba(22, 36, 66, 0.5);
}

body.theme-night .chat-compose textarea {
  background: rgba(11, 25, 44, 0.95);
  border-color: rgba(95, 134, 178, 0.52);
  color: #d9ecff;
}

body.theme-night .chat-compose button {
  border-color: rgba(95, 134, 178, 0.52);
  background: rgba(26, 48, 77, 0.95);
  color: #d9ecff;
}

body.theme-night #chat-send-btn {
  background: linear-gradient(145deg, #2f6faf, #4778b9);
  border-color: rgba(111, 164, 224, 0.6);
}

.main-placeholder {
  width: 100%;
  height: 100%;
}

@media (max-height: 860px) {
  :root {
    --sidebar-icon-btn-size: clamp(30px, 3.7vh, 38px);
    --sidebar-label-space: clamp(8px, 1.2vh, 11px);
    --sidebar-rail-width: 76px;
  }

  .platform-sidebar {
    padding-top: 10px;
    gap: 5px;
  }

  body.logged-in .platform-sidebar {
    padding-top: 112px;
  }

  .user-panel {
    top: 40px;
  }

  .platform-content {
    padding-top: 12px;
    padding-bottom: 14px;
  }
}

@media (max-height: 740px) {
  :root {
    --sidebar-icon-btn-size: clamp(28px, 3.4vh, 34px);
    --sidebar-label-space: clamp(7px, 1vh, 9px);
    --sidebar-label-font-size: 0.624rem; /* было 0.48rem, +30% */
    --sidebar-rail-width: 72px;
  }

  .side-btn-icon::after {
    line-height: 1.02;
    margin-top: 1px;
  }

  .platform-sidebar {
    gap: 4px;
    padding: 8px 8px;
  }

  body.logged-in .platform-sidebar {
    padding-top: 94px;
  }

  .user-panel {
    top: 30px;
  }

  .current-user-avatar-trigger,
  .current-user-avatar {
    width: 34px;
    height: 34px;
  }
}

@media (max-height: 660px) {
  :root {
    --sidebar-icon-btn-size: 26px;
    --sidebar-label-space: 8px;
    --sidebar-label-font-size: 0.572rem; /* было 0.44rem, +30% */
    --sidebar-rail-width: 68px;
  }

  body.logged-in .platform-sidebar {
    padding-top: 82px;
  }
}

@media (pointer: coarse) {
  .lang-panel {
    top: calc(4px + env(safe-area-inset-top, 0px));
  }

  .user-panel {
    top: calc(64px + env(safe-area-inset-top, 0px));
  }

  body.logged-in .platform-sidebar {
    padding-top: 126px;
  }

  .side-btn-subs::after {
    margin-top: 13px;
  }

  .side-btn-subs .subs-bell-icon {
    transform: translateY(-4px) scale(0.92);
  }

  .platform-sidebar .side-btn-subs {
    height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 10px) !important;
    min-height: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 10px) !important;
    flex-basis: calc(var(--sidebar-icon-btn-size) + var(--sidebar-label-space) + 10px) !important;
  }
}

@media (pointer: coarse) and (max-height: 740px) {
  .user-panel {
    top: calc(58px + env(safe-area-inset-top, 0px));
  }

  body.logged-in .platform-sidebar {
    padding-top: 116px;
  }
}

@media (pointer: coarse) and (max-height: 660px) {
  .user-panel {
    top: calc(54px + env(safe-area-inset-top, 0px));
  }

  body.logged-in .platform-sidebar {
    padding-top: 108px;
  }
}

/* Тач-планшет (Android и др.): чуть больше gap между кнопками с подписями; ниже — с учётом max-height правил */
@media (pointer: coarse) and (min-width: 600px) {
  .platform-sidebar {
    gap: 11px;
  }
}

@media (pointer: coarse) and (min-width: 600px) and (max-height: 860px) {
  .platform-sidebar {
    gap: 8px;
  }
}

@media (pointer: coarse) and (min-width: 600px) and (max-height: 740px) {
  .platform-sidebar {
    gap: 7px;
  }
}

@keyframes spin {
  from {
    transform: rotate(0turn);
  }
  to {
    transform: rotate(1turn);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.76;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}


