:root {
  color-scheme: dark;
  --bg: #030814;
  --text: #eaf2ff;
}

* {
  box-sizing: border-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: 4px;
  z-index: 50;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(10, 22, 50, 0.84), rgba(7, 16, 38, 0.82));
  border: 1px solid rgba(161, 214, 255, 0.22);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  overflow: visible;
}

.lang-btn {
  width: 0;
  height: 30px;
  border-radius: 8px;
  border: 0 solid rgba(161, 214, 255, 0.3);
  background: rgba(10, 23, 52, 0.9);
  color: #fff;
  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: rgba(125, 213, 255, 1);
  border-width: 1px;
  box-shadow: 0 0 0 3px rgba(89, 194, 255, 0.2);
  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;
  gap: 4px;
  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;
}

.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 {
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.13em;
  text-shadow: 0 0 10px rgba(142, 224, 255, 0.6);
}

.avatar-entry-sub {
  font-size: clamp(0.62rem, 1.1vw, 0.76rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.86;
}

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: radial-gradient(circle at top, #f7fbff 0%, #e8f5ff 40%, #dff3ff 100%);
  color: #1c3557;
  z-index: 20;
}

.platform {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
}

.platform-sidebar {
  background: linear-gradient(180deg, #0f2348, #122b57);
  color: #e8f3ff;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

body.logged-in .platform-sidebar {
  padding-top: 190px;
}

.user-panel {
  position: fixed;
  top: 44px;
  left: 4px;
  width: 220px;
  z-index: 55;
  display: none;
  gap: 8px;
}

body.logged-in .user-panel {
  display: grid;
}

.current-user-card {
  border: 1px solid rgba(145, 198, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.current-user-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 8px;
}

.current-user-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.current-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(190, 225, 255, 0.45);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.avatar-gear-btn {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(190, 225, 255, 0.5);
  background: #1f3f73;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.current-user-meta {
  min-width: 0;
}

.current-user-title {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.current-user-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f2f8ff;
}

.current-user-email {
  font-size: 0.82rem;
  color: #b7d8ff;
  word-break: break-word;
}

.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: center;
  padding: 18px;
}

.settings-screen.hidden {
  display: none;
}

.settings-card {
  width: min(460px, 95vw);
  background: rgba(255, 255, 255, 0.95);
  color: #2b4b75;
  border-radius: 14px;
  border: 1px solid rgba(148, 186, 222, 0.5);
  box-shadow: 0 18px 40px rgba(6, 22, 48, 0.25);
  padding: 16px;
  display: grid;
  gap: 8px;
}

.settings-card h3 {
  margin: 0 0 4px;
}

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.settings-avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(138, 181, 221, 0.5);
  object-fit: cover;
}

.settings-upload-btn {
  border: 1px solid rgba(123, 163, 203, 0.45);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 600;
}

.settings-card input,
.settings-card textarea,
.settings-card button {
  width: 100%;
  border-radius: 10px;
  font-size: 0.95rem;
}

.settings-card input,
.settings-card textarea {
  border: 1px solid rgba(123, 163, 203, 0.45);
  padding: 9px 11px;
}

.settings-card textarea {
  resize: vertical;
  min-height: 90px;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-actions button {
  padding: 10px 12px;
  border: 0;
  background: linear-gradient(145deg, #66b5ff, #8b97ff);
  color: #fff;
  cursor: pointer;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.side-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  color: #d9ebff;
  background: transparent;
  cursor: pointer;
}

#menu-chats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.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);
}

.platform-content {
  padding: 18px 24px 26px;
  overflow-y: auto;
}

.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: rgba(255, 255, 255, 0.75);
  color: #264b76;
  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: calc(100vh - 70px);
}

.chat-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
  border: 1px solid rgba(132, 174, 214, 0.35);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
}

.chat-list {
  border-right: 1px solid rgba(132, 174, 214, 0.35);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
}

.chat-list-title {
  font-weight: 700;
  color: #3a5f87;
  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 9px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}

.chat-contact-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: stretch;
  position: relative;
}

.chat-contact-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  position: relative;
}

.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;
}

@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;
}

.chat-contact-status.online {
  color: #23a455;
  font-weight: 600;
}

.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-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: 0.95rem;
  line-height: 1;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
  cursor: pointer;
}

.chat-contact-row:hover .chat-contact-gear,
.chat-contact-gear.active {
  opacity: 1;
  transform: translateX(0);
}

.chat-contact-gear.active {
  background: rgba(221, 240, 255, 0.95);
  border-color: rgba(99, 164, 230, 0.62);
}

.chat-contact-menu {
  position: absolute;
  top: 34px;
  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: 15;
  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: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;
  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);
}

.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;
}

.call-panel {
  position: fixed;
  right: 14px;
  bottom: 92px;
  width: min(320px, calc(100vw - 24px));
  background: rgba(12, 31, 56, 0.94);
  border: 1px solid rgba(129, 183, 241, 0.38);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(7, 19, 35, 0.4);
  color: #e8f4ff;
  padding: 12px;
  z-index: 95;
  display: grid;
  gap: 8px;
}

.call-panel.hidden {
  display: none;
}

.call-title {
  font-weight: 700;
  font-size: 1rem;
}

.call-status {
  font-size: 0.9rem;
  color: #b7d6f5;
}

.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;
}

.call-btn {
  border: 0;
  border-radius: 9px;
  padding: 7px 10px;
  color: #fff;
  font-size: 0.86rem;
  cursor: pointer;
}

.call-btn.accept {
  background: linear-gradient(145deg, #38c976, #25aa61);
}

.call-btn.reject {
  background: linear-gradient(145deg, #ff6b75, #e34753);
}

.call-btn.end {
  background: linear-gradient(145deg, #ff6b75, #db3d4a);
}

.call-btn.record {
  background: linear-gradient(145deg, #f47b4a, #e65555);
}

.call-btn.record.recording {
  background: linear-gradient(145deg, #7d8796, #5f6876);
}

.call-btn.mute {
  background: linear-gradient(145deg, #4f8dff, #4366e6);
  min-width: 42px;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.call-btn.mute.muted {
  background: linear-gradient(145deg, #6a6f7c, #4f5563);
}

.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;
  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;
}

.chat-bubble.incoming {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(132, 174, 214, 0.32);
  color: #31557d;
  box-shadow: 0 3px 10px rgba(62, 116, 168, 0.08);
}

.chat-bubble.outgoing {
  margin-left: auto;
  background: linear-gradient(145deg, #62b6ff, #8698ff);
  color: #fff;
  box-shadow: 0 4px 12px rgba(67, 116, 205, 0.16);
}

.chat-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble-meta {
  justify-self: end;
  font-size: 0.72rem;
  opacity: 0.9;
  letter-spacing: 0.04em;
}

.chat-bubble-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.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-bubble.incoming .chat-msg-delete-btn {
  background: rgba(39, 86, 131, 0.12);
}

.chat-compose {
  border-top: 1px solid rgba(132, 174, 214, 0.35);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: rgba(244, 250, 255, 0.76);
  backdrop-filter: blur(2px);
}

.chat-compose input[type="text"] {
  border: 1px solid rgba(132, 174, 214, 0.4);
  border-radius: 10px;
  padding: 9px 11px;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.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-attach-btn {
  min-width: 84px;
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

#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-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-file-link {
  margin-top: 4px;
  display: inline-block;
  font-size: 0.82rem;
  color: inherit;
  text-decoration: underline;
}

.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: 10px;
  }
  .platform {
    grid-template-columns: 1fr;
  }
  .platform-sidebar {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    align-items: center;
    padding: 10px;
  }
  .brand {
    margin-bottom: 0;
  }
  .roulette-streams {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .lang-panel {
    top: calc(4px + env(safe-area-inset-top, 0px));
    left: 4px;
  }

  .lang-btn {
    width: 30px;
    border-width: 1px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .user-panel {
    top: calc(44px + env(safe-area-inset-top, 0px));
    left: 4px;
    right: 4px;
    width: auto;
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .current-user-card {
    padding: 8px;
    gap: 3px;
  }

  .current-user-title {
    font-size: 0.66rem;
  }

  .current-user-row {
    grid-template-columns: 38px 1fr;
    gap: 7px;
  }

  .current-user-avatar-wrap,
  .current-user-avatar {
    width: 38px;
    height: 38px;
  }

  .current-user-name {
    font-size: 0.9rem;
  }

  .current-user-email {
    font-size: 0.78rem;
  }

  .logout-btn {
    padding: 8px 10px;
    align-self: stretch;
  }

  body.logged-in .platform-sidebar {
    padding-top: 8px;
  }

  .platform-sidebar {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding: 8px;
    gap: 6px;
  }

  .brand {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .side-btn {
    padding: 8px 10px;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .platform-content {
    padding: 168px 10px 14px;
  }

  .chat-view {
    height: auto;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    min-height: 68vh;
  }

  .chat-list {
    border-right: 0;
    border-bottom: 1px solid rgba(132, 174, 214, 0.35);
  }

  .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;
  }
}

.main-placeholder {
  width: 100%;
  height: 100%;
}

@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;
  }
}


