@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap");

:root {
  --bg: #04070d;
  --bg-soft: #0a1220;
  --surface: rgba(10, 16, 28, 0.92);
  --surface-2: rgba(13, 21, 36, 0.95);
  --line: rgba(95, 170, 255, 0.2);
  --line-strong: rgba(95, 170, 255, 0.5);
  --chat-frame-line: #1b344d;
  --accent: #00ddff;
  --accent-2: #00a2ff;
  --accent-soft: rgba(0, 221, 255, 0.18);
  --warn: #ffad49;
  --danger: #ff5f70;
  --text: #eaf3ff;
  --text-muted: #99afca;
  --text-soft: #6f87a4;
  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.52);
  --mobile-bottom-safe: max(env(safe-area-inset-bottom, 0px), 34px);
  --mobile-dock-lift: 20px;
  --mobile-dock-blur: rgba(6, 13, 24, 0.92);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background:
    radial-gradient(70rem 42rem at 120% -10%, rgba(0, 221, 255, 0.14), transparent 56%),
    radial-gradient(56rem 34rem at -10% 110%, rgba(0, 162, 255, 0.14), transparent 58%),
    repeating-linear-gradient(
      90deg,
      rgba(150, 200, 255, 0.03) 0,
      rgba(150, 200, 255, 0.03) 1px,
      transparent 1px,
      transparent 22px
    ),
    var(--bg);
  overscroll-behavior: none;
}

.container {
  width: min(1240px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 18px 20px 24px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  height: 100%;
  min-height: 0;
}

#chat {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card {
  max-width: 980px;
  margin: 0 auto;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.auth-card > p {
  color: var(--text-muted);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

form {
  display: grid;
  gap: 9px;
}

input,
textarea,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #071022;
  color: var(--text);
  font-size: 14px;
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 44px;
  max-height: 132px;
  resize: none;
  overflow-y: hidden;
  line-height: 1.35;
  font-family: inherit;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 221, 255, 0.42) rgba(5, 11, 20, 0.86);
}

textarea::-webkit-scrollbar {
  width: 6px;
}

textarea::-webkit-scrollbar-track {
  background: rgba(5, 11, 20, 0.86);
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 221, 255, 0.62), rgba(0, 132, 194, 0.62));
  border-radius: 999px;
}

input::placeholder,
textarea::placeholder {
  color: #7891b1;
  font-size: 11px;
  letter-spacing: -0.01em;
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(0, 221, 255, 0.16);
}

select {
  min-width: 112px;
  appearance: none;
}

button {
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
}

.icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 1.1rem;
}

.gear-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
}

.gear-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pill-btn {
  border-radius: var(--radius-md);
  padding: 11px 14px;
  background: linear-gradient(135deg, #11243a, #0c1a2e);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.link-btn {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-btn:hover:not(:disabled) {
  color: var(--text);
}

.register-panel {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.circle-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 0;
  background: linear-gradient(135deg, #102640, #0f1f33);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
}

.circle-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.circle-btn .emoji-icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.circle-btn .emoji-icon path:nth-of-type(1),
.circle-btn .emoji-icon path:nth-of-type(2) {
  stroke-linecap: round;
  stroke-width: 3.2;
}

.app-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(300px, calc(100vw - 20px));
  padding: 9px 11px;
  border: 1px solid rgba(0, 221, 255, 0.36);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 221, 255, 0.16), transparent 42%),
    linear-gradient(145deg, rgba(9, 18, 31, 0.98), rgba(4, 9, 17, 0.98));
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.48),
    0 0 18px rgba(0, 221, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #dff8ff;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px) scale(0.98);
  transition: opacity 120ms ease, transform 120ms ease;
}

.app-tooltip.measure,
.app-tooltip.show {
  opacity: 1;
}

.app-tooltip.show {
  transform: translateY(0) scale(1);
}

.app-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 9px;
  height: 9px;
  border-right: 1px solid rgba(0, 221, 255, 0.36);
  border-bottom: 1px solid rgba(0, 221, 255, 0.36);
  background: rgba(6, 13, 23, 0.98);
}

.app-tooltip[data-placement="top"]::after {
  bottom: -5px;
  transform: translateX(-50%) rotate(45deg);
}

.app-tooltip[data-placement="bottom"]::after {
  top: -5px;
  transform: translateX(-50%) rotate(225deg);
}

#menu-close,
#chat-actions-toggle,
#message-form .circle-btn,
#public-meet-form .circle-btn,
#contact-form .circle-btn {
  border-color: rgba(0, 221, 255, 0.7);
  background: linear-gradient(135deg, #0e3f5a, #0a5fa4);
  color: #eaffff;
  box-shadow: 0 0 14px rgba(0, 221, 255, 0.28);
}

.emoji-toggle.active {
  border-color: rgba(255, 173, 73, 0.85) !important;
  box-shadow: 0 0 18px rgba(255, 173, 73, 0.28) !important;
}

#menu-close:hover,
#chat-actions-toggle:hover,
#message-form .circle-btn:hover,
#public-meet-form .circle-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 221, 255, 0.45);
}

#contact-form .circle-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 221, 255, 0.45);
}

button:hover:not(:disabled) {
  border-color: var(--line-strong);
}

button:disabled {
  opacity: 0.48;
  cursor: default;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  border: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 221, 255, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(11, 20, 34, 0.98), rgba(8, 15, 27, 0.94));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  margin-bottom: 8px;
  position: relative;
  z-index: 12;
}

.update-btn,
.update-notice {
  margin-left: auto;
  border-color: rgba(255, 173, 73, 0.72);
  background: linear-gradient(135deg, rgba(72, 45, 18, 0.96), rgba(31, 24, 16, 0.96));
  color: #ffe2b8;
}

.update-notice {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-weight: 900;
}

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

.topbar-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
  background: #081220;
  border: 1px solid rgba(0, 221, 255, 0.24);
  box-shadow: 0 0 18px rgba(0, 221, 255, 0.1);
}

.topbar-avatar.idle {
  opacity: 0.76;
}

.topbar-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.topbar-meta strong {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta span {
  color: var(--text-muted);
  font-size: 12px;
}

#conn-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

#conn-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--text-soft);
  box-shadow: 0 0 10px rgba(111, 135, 164, 0.35);
}

#conn-label[data-state="ok"]::before {
  background: #32f0a2;
  box-shadow: 0 0 12px rgba(50, 240, 162, 0.6);
}

#conn-label[data-state="pending"]::before {
  background: var(--warn);
  box-shadow: 0 0 12px rgba(255, 173, 73, 0.58);
}

#conn-label[data-state="error"]::before {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 95, 112, 0.58);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.chat-actions {
  position: relative;
  z-index: 40;
}

.chat-actions-toggle.active {
  border-color: rgba(255, 173, 73, 0.72) !important;
  box-shadow: 0 0 18px rgba(255, 173, 73, 0.24) !important;
}

.dots-icon {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -8px 0 currentColor, 0 8px 0 currentColor;
}

.chat-actions-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 210px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(95, 170, 255, 0.22);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 221, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(11, 22, 38, 0.98), rgba(5, 11, 20, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
}

.chat-actions-menu button {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: rgba(15, 32, 52, 0.82);
  color: var(--text);
  text-align: left;
}

.chat-actions-menu button:disabled {
  opacity: 0.42;
}

.chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 8px;
}

.contacts-panel,
.dialog-panel {
  border: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(10, 18, 31, 0.95), rgba(7, 13, 23, 0.95));
  padding: 10px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(95, 170, 255, 0.14),
    inset 0 -1px 0 rgba(95, 170, 255, 0.1);
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.contact-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.profile-hero {
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  position: relative;
}

.profile-actions {
  display: contents;
}

.app-version {
  margin: -4px 0 10px;
  color: var(--text-muted);
  font-size: 11px;
}

.profile-panel,
.profile-settings,
.settings-section {
  display: grid;
  gap: 9px;
}

.profile-panel .pill-btn,
.crop-actions .pill-btn {
  justify-content: center;
}

.account-handle {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(7, 16, 34, 0.72);
}

.account-handle span {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-handle strong {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-settings {
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(5, 11, 22, 0.52);
  max-height: min(560px, calc(100dvh - 250px));
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  min-height: 0;
}

.settings-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 2px;
  background: linear-gradient(180deg, rgba(5, 11, 22, 0.98), rgba(5, 11, 22, 0.72));
}

.settings-tab {
  min-height: 36px;
  border-radius: var(--radius-md);
  padding: 8px 9px;
  background: linear-gradient(135deg, #102033, #091626);
  color: var(--text-muted);
  font-size: 12px;
}

.settings-tab.active {
  border-color: rgba(0, 221, 255, 0.74);
  color: #eaffff;
  box-shadow: inset 0 0 0 1px rgba(0, 221, 255, 0.2), 0 0 14px rgba(0, 221, 255, 0.18);
}

.settings-section {
  padding: 10px;
  border: 1px solid rgba(95, 170, 255, 0.22);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(13, 26, 45, 0.55), rgba(6, 13, 25, 0.52));
}

.settings-section h3 {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-avatar,
.contact-avatar {
  display: block;
  object-fit: cover;
  background: #081220;
  border: 1px solid var(--line);
  box-shadow:
    inset 2px 2px 5px rgba(255, 255, 255, 0.08),
    inset -2px -2px 5px rgba(0, 0, 0, 0.28);
}

.profile-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.profile-side-action {
  display: none;
}

.profile-action-btn,
.profile-settings-toggle {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: rgba(0, 221, 255, 0.34) !important;
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.14), transparent 34%),
    rgba(4, 9, 17, 0.72) !important;
  color: #eaffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36), inset 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  backdrop-filter: blur(12px);
}

.profile-settings-toggle {
  right: 12px;
  bottom: 12px;
}

.menu-close-btn {
  top: 12px;
  right: 12px;
}

.profile-settings-toggle.active {
  border-color: rgba(255, 173, 73, 0.8);
  box-shadow: 0 0 18px rgba(255, 173, 73, 0.32);
}

.avatar-upload {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: linear-gradient(135deg, #11243a, #0c1a2e);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-align: center;
}

.avatar-upload input {
  display: none;
}

.avatar-cropper {
  margin-top: 10px;
  display: grid;
  gap: 9px;
}

.avatar-cropper canvas {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  touch-action: none;
  cursor: grab;
  background: #04070d;
  box-shadow:
    inset 2px 2px 5px rgba(255, 255, 255, 0.08),
    inset -2px -2px 5px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(0, 221, 255, 0.18);
}

.crop-scale {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.crop-scale input {
  padding: 0;
}

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

.avatar-status {
  display: none;
  margin: 2px 0 4px;
  padding: 9px 10px;
  border: 1px solid rgba(0, 221, 255, 0.38);
  border-radius: var(--radius-md);
  background: rgba(0, 221, 255, 0.08);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.avatar-status.show {
  display: block;
}

.avatar-status.error {
  border-color: rgba(255, 95, 112, 0.68);
  background: rgba(255, 95, 112, 0.1);
  color: #ffb9c1;
}

.contact-invite-tools,
.admin-tools {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.settings-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.mini-btn {
  min-height: 30px;
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: linear-gradient(135deg, #102640, #0f1f33);
  color: var(--text);
  font-size: 12px;
}

.device-requests {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255, 173, 73, 0.62);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 173, 73, 0.16), transparent 42%),
    rgba(12, 19, 31, 0.88);
}

.device-requests-head {
  display: grid;
  gap: 2px;
}

.device-requests-head strong {
  color: #ffdcae;
}

.device-requests-head span,
.device-request-meta span {
  color: var(--text-muted);
  font-size: 12px;
}

.device-request-list,
.device-request {
  display: grid;
  gap: 8px;
}

.device-request {
  padding: 9px;
  border: 1px solid rgba(255, 173, 73, 0.28);
  border-radius: var(--radius-md);
  background: rgba(5, 11, 22, 0.56);
}

.device-request-meta {
  display: grid;
  gap: 2px;
}

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

.device-request-actions .pill-btn {
  justify-content: center;
  padding-inline: 10px;
}

.danger-btn {
  border-color: rgba(255, 95, 112, 0.48);
}

.trusted-devices,
.trusted-devices-list {
  display: grid;
  gap: 8px;
}

.key-status {
  margin: 0;
  padding: 7px 8px;
  border: 1px solid rgba(0, 221, 255, 0.26);
  border-radius: var(--radius-sm);
  background: rgba(0, 221, 255, 0.06);
  color: #9defff;
  font-size: 12px;
}

.key-status.warning {
  border-color: rgba(255, 173, 73, 0.32);
  background: rgba(255, 173, 73, 0.08);
  color: #ffdcae;
}

.public-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid rgba(255, 173, 73, 0.66);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  background: rgba(255, 173, 73, 0.12);
  color: #ffdcae;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.public-badge.compact {
  margin-bottom: 2px;
}

.public-room-form,
.public-room-list,
.public-room-card {
  display: grid;
  gap: 8px;
}

.public-room-form {
  grid-template-columns: 1fr auto;
}

.public-room-form .pill-btn {
  grid-column: 1 / -1;
  justify-content: center;
}

.public-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.public-room-card {
  padding: 10px;
  border: 1px solid rgba(95, 170, 255, 0.24);
  border-radius: var(--radius-md);
  background: rgba(5, 11, 22, 0.56);
}

.public-room-card.expired {
  border-color: rgba(255, 173, 73, 0.38);
}

.public-room-card > span:not(.public-badge) {
  color: var(--text-muted);
  font-size: 12px;
}

.public-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.public-room-actions .mini-btn {
  text-decoration: none;
}

.public-room-members {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.public-room-members > span {
  color: var(--text-muted);
  font-size: 12px;
}

.public-room-member {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px;
  border: 1px solid rgba(95, 170, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(7, 16, 30, 0.58);
}

.public-room-member img {
  width: 28px;
  height: 28px;
  border-radius: 11%;
  object-fit: cover;
}

.public-room-member span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-room-member-form {
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.public-room-member-form input,
.public-room-member-form .mini-btn {
  min-height: 34px;
}

.public-room-member-form input {
  padding: 8px 10px;
  font-size: 12px;
}

.public-room-member-form .mini-btn {
  padding: 0;
}

.public-meet {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.public-meet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.public-meet-titlebox {
  min-width: 0;
  flex: 1;
}

.public-meet-head h1 {
  margin: 8px 0 5px;
}

.public-meet-head p {
  margin: 0;
  color: var(--text-muted);
}

.public-meet-guests {
  margin-top: 5px !important;
  color: #ffdcae !important;
  font-size: 12px;
}

.public-meet-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.public-back {
  text-decoration: none;
  border-color: rgba(255, 173, 73, 0.48);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 173, 73, 0.17), transparent 48%),
    linear-gradient(135deg, #13243c, #0e1b2e);
  color: #ffdcae;
  white-space: nowrap;
}

.public-copy-link {
  border-color: rgba(0, 221, 255, 0.42);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 221, 255, 0.16), transparent 48%),
    linear-gradient(135deg, #13243c, #0e1b2e);
  color: #bdf7ff;
  white-space: nowrap;
}

.public-meet-members {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 173, 73, 0.72) rgba(8, 13, 21, 0.98);
}

.public-meet-members::-webkit-scrollbar {
  height: 8px;
}

.public-meet-members::-webkit-scrollbar-track {
  background: rgba(8, 13, 21, 0.98);
  border-radius: 999px;
}

.public-meet-members::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(255, 173, 73, 0.92), rgba(0, 221, 255, 0.72));
  border-radius: 999px;
  border: 2px solid rgba(8, 13, 21, 0.98);
}

.public-meet-member {
  min-width: 82px;
  max-width: 120px;
  display: grid;
  justify-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 7px 8px;
  border: 1px solid rgba(255, 173, 73, 0.26);
  border-radius: var(--radius-md);
  background: rgba(255, 173, 73, 0.07);
}

.public-meet-member img {
  width: 38px;
  height: 38px;
  border-radius: 11%;
  object-fit: cover;
}

.public-meet-member span {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-meet-messages {
  margin-top: 0;
}

.public-meet-note {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(255, 173, 73, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255, 173, 73, 0.07);
  color: #ffdcae;
  line-height: 1.35;
}

.public-message {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  border-left: 1px solid rgba(255, 173, 73, 0.26);
  border-right: 1px solid rgba(255, 173, 73, 0.26);
  border-radius: var(--radius-md);
  border-color: rgba(255, 173, 73, 0.26);
}

.public-message time {
  display: inline;
  margin-bottom: 0;
  font-size: 12px;
  line-height: normal;
}

.trusted-device {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(95, 170, 255, 0.24);
  border-radius: var(--radius-md);
  background: rgba(5, 11, 22, 0.56);
}

.trusted-device.current {
  border-color: rgba(0, 221, 255, 0.54);
  box-shadow: inset 0 0 0 1px rgba(0, 221, 255, 0.14);
}

.trusted-device-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.trusted-device-meta strong,
.trusted-device-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-fingerprint {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 6px;
  border: 1px solid rgba(0, 221, 255, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(0, 221, 255, 0.07);
  color: #9defff;
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.device-fingerprint.missing {
  border-color: rgba(255, 173, 73, 0.3);
  background: rgba(255, 173, 73, 0.08);
  color: #ffdcae;
}

.trusted-device-meta span,
.trusted-devices-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.trusted-device-actions {
  display: flex;
  justify-content: flex-end;
}

.device-current-badge {
  padding: 5px 8px;
  border: 1px solid rgba(0, 221, 255, 0.42);
  border-radius: var(--radius-sm);
  color: #7ee7ff;
  font-size: 11px;
  font-weight: 700;
}

.contact-invite-tools .pill-btn,
.admin-tools .pill-btn {
  justify-content: center;
}

.contact-code-output {
  font-size: 12px;
}

.contacts {
  margin-top: 8px;
  display: grid;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 8px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.contact-item {
  width: 100%;
  align-self: start;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(132deg, rgba(16, 27, 44, 0.96), rgba(12, 21, 36, 0.95));
  color: var(--text);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11%;
  flex: 0 0 auto;
}

.contact-name {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.contact-name strong,
.contact-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-name small {
  color: var(--text-muted);
  font-size: 11px;
}

.contact-item.active {
  border-color: rgba(0, 221, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(0, 221, 255, 0.28), 0 0 16px rgba(0, 221, 255, 0.2);
}

.contact-item.public-room-contact {
  border-color: rgba(255, 173, 73, 0.58);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 173, 73, 0.15), transparent 48%),
    linear-gradient(132deg, rgba(30, 22, 13, 0.96), rgba(14, 20, 32, 0.95));
}

.contact-item.public-room-contact:hover {
  border-color: rgba(255, 173, 73, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 173, 73, 0.2), 0 0 16px rgba(255, 173, 73, 0.12);
}

.contact-item.public-room-contact.expired {
  opacity: 0.78;
}

.contact-item.public-room-create {
  border-color: rgba(255, 173, 73, 0.66);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 173, 73, 0.16), transparent 48%),
    linear-gradient(132deg, rgba(30, 22, 13, 0.98), rgba(14, 20, 32, 0.96));
}

.contact-item.public-room-create.active,
.contact-item.public-room-create:hover {
  border-color: rgba(255, 173, 73, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 173, 73, 0.22), 0 0 16px rgba(255, 173, 73, 0.12);
}

.contact-item.public-room-create.locked {
  opacity: 0.78;
}

.public-room-create-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 173, 73, 0.76);
  border-radius: 11%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.12), transparent 35%),
    rgba(255, 173, 73, 0.13);
  color: #ffdcae;
  font-size: 24px;
  font-weight: 900;
}

.public-room-inline-form {
  padding: 10px;
  border: 1px solid rgba(255, 173, 73, 0.42);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 173, 73, 0.12), transparent 44%),
    rgba(7, 14, 25, 0.78);
}

.public-room-inline-form select,
.public-room-inline-form input {
  min-width: 0;
}

.public-room-avatar-editor {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 8px;
}

.public-room-avatar-preview {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 173, 73, 0.48);
  border-radius: 11%;
  object-fit: cover;
  background: #081220;
}

.public-room-avatar-upload {
  padding: 10px;
}

.public-room-cropper {
  margin-top: 0;
}

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

.public-room-inline-actions .pill-btn {
  justify-content: center;
}

.public-room-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 173, 73, 0.58);
  border-radius: 11%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(255, 173, 73, 0.13);
  color: #ffdcae;
  font-size: 21px;
  font-weight: 800;
}

.public-room-avatar.image {
  display: block;
  object-fit: cover;
}

.public-room-list-badge {
  border: 1px solid rgba(255, 173, 73, 0.66);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  background: rgba(255, 173, 73, 0.12);
  color: #ffdcae;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.badge {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 173, 73, 0.14);
  border: 1px solid rgba(255, 173, 73, 0.76);
  color: #ffdcae;
  font-size: 12px;
  text-align: center;
}

#notif-enable {
  width: 100%;
  justify-content: center;
}

.install-btn {
  width: 100%;
  justify-content: center;
}

.sidebar-actions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.logout-mobile {
  width: 100%;
  justify-content: center;
}

.room-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-toggle {
  display: none !important;
}

.search-toggle.active {
  border-color: rgba(255, 173, 73, 0.72);
  box-shadow: 0 0 14px rgba(255, 173, 73, 0.2);
}

.history-search {
  grid-column: 1 / -1;
  justify-self: stretch;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, 34px) auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  padding: 8px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 173, 73, 0.12), transparent 36%),
    rgba(7, 15, 27, 0.72);
}

.history-search input {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 12px;
}

.history-search .mini-btn {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#history-search-status {
  min-width: 54px;
  color: var(--text-muted);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.messages {
  position: relative;
  margin-top: 10px;
  border: 0;
  border-radius: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 0;
  background:
    linear-gradient(160deg, rgba(8, 14, 24, 0.96), rgba(7, 12, 20, 0.96)),
    repeating-linear-gradient(
      0deg,
      rgba(120, 180, 255, 0.035) 0,
      rgba(120, 180, 255, 0.035) 1px,
      transparent 1px,
      transparent 24px
    );
  scrollbar-gutter: stable;
}

.history-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-loading::before {
  content: ">";
  margin-right: 8px;
  color: var(--accent);
  animation: history-loading-pulse 0.9s steps(2, end) infinite;
}

@keyframes history-loading-pulse {
  50% {
    opacity: 0.24;
  }
}

#messages {
  margin-left: -10px;
  margin-right: -10px;
  overflow-x: hidden;
}

.dialog-panel > #messages {
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 1px solid var(--chat-frame-line);
  border-right: 1px solid var(--chat-frame-line);
  border-radius: var(--radius-lg);
  padding-top: 0;
}

.dialog-panel > #messages.messages-home {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  scrollbar-gutter: auto;
}

.messages-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 2px;
}

.messages-bottom::before {
  content: "";
  flex: 1 0 auto;
  min-height: 0;
}

.messages-bottom > * {
  flex: 0 0 auto;
}

.messages-bottom > .message:last-child {
  margin-bottom: 8px;
}

.messages-bottom + .message-form {
  margin-top: 2px;
}

.message {
  margin-bottom: 8px;
  width: fit-content;
  max-width: min(76%, 720px);
  min-width: 84px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(14, 25, 41, 0.97), rgba(11, 21, 35, 0.96));
  overflow-wrap: anywhere;
}

.message-in {
  margin-left: 0;
  margin-right: auto;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: linear-gradient(145deg, rgba(14, 25, 41, 0.98), rgba(9, 18, 31, 0.97));
}

.message-out {
  margin-left: auto;
  margin-right: 0;
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 221, 255, 0.1), transparent 44%),
    linear-gradient(145deg, rgba(13, 37, 58, 0.98), rgba(8, 24, 42, 0.97));
}

.message.search-match {
  border-color: rgba(255, 173, 73, 0.58);
}

.message.search-current {
  box-shadow: inset 0 0 0 1px rgba(255, 173, 73, 0.42), 0 0 18px rgba(255, 173, 73, 0.18);
}

.message mark {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 173, 73, 0.34);
  color: #fff3dc;
}

.system-message {
  max-width: min(82%, 760px);
  margin-left: auto;
  margin-right: auto;
  border-style: dashed;
  border-left: 1px dashed var(--line);
  border-right: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(0, 221, 255, 0.08), rgba(255, 173, 73, 0.08));
  color: var(--text-muted);
  text-align: center;
}

.system-message p {
  margin: 0 0 4px;
}

.home-screen {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(18px, 5vw, 46px);
  border: 1px solid rgba(0, 221, 255, 0.18);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 221, 255, 0.16), transparent 34%),
    radial-gradient(circle at 92% 92%, rgba(255, 173, 73, 0.12), transparent 32%),
    rgba(5, 11, 22, 0.42);
}

.home-kicker {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(0, 221, 255, 0.38);
  border-radius: var(--radius-sm);
  color: #9defff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-screen h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 5vw, 52px);
  line-height: 0.95;
}

.home-screen p,
.home-note {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.home-update {
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 173, 73, 0.38);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 173, 73, 0.14), transparent 42%),
    rgba(255, 173, 73, 0.07);
}

.home-update div {
  display: grid;
  gap: 2px;
}

.home-update strong {
  color: #ffdcae;
}

.home-update span {
  color: var(--text-muted);
  font-size: 12px;
}

.home-hints {
  max-width: 720px;
  min-height: 132px;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 12px 13px;
  border: 1px solid rgba(0, 221, 255, 0.3);
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, rgba(0, 221, 255, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 221, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 100% 0%, rgba(0, 221, 255, 0.12), transparent 38%),
    rgba(3, 10, 18, 0.76);
  background-size: 22px 22px, 22px 22px, auto, auto;
  box-shadow:
    inset 0 0 0 1px rgba(0, 221, 255, 0.06),
    0 0 24px rgba(0, 221, 255, 0.08);
  color: #9effff;
  text-shadow: 0 0 10px rgba(0, 221, 255, 0.18);
}

.home-hint-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6eefff;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-hint-head span:last-child {
  margin-left: auto;
  color: rgba(255, 173, 73, 0.84);
}

.home-hint-led {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #00ffbd;
  box-shadow: 0 0 12px rgba(0, 255, 189, 0.9);
  animation: hintPulse 1.4s ease-in-out infinite;
}

.home-hints strong {
  color: #d7ffff;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.2;
}

.home-hints p {
  max-width: 100%;
  min-height: 3.9em;
  color: #8de9dc;
  font-size: 12px;
  line-height: 1.45;
}

.home-hints[data-kind="warning"],
.home-hints[data-kind="public"] {
  border-color: rgba(255, 173, 73, 0.34);
  color: #ffdcae;
}

.home-hints[data-kind="warning"] .home-hint-led,
.home-hints[data-kind="public"] .home-hint-led {
  background: var(--warn);
  box-shadow: 0 0 12px rgba(255, 173, 73, 0.85);
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 720px;
}

.home-stat {
  padding: 12px;
  border: 1px solid rgba(95, 170, 255, 0.22);
  border-radius: var(--radius-md);
  background: rgba(7, 16, 30, 0.64);
  color: inherit;
  text-align: left;
  cursor: default;
}

.home-stat.is-action {
  cursor: pointer;
}

.home-stat.is-action:hover,
.home-stat.is-action:focus-visible {
  border-color: rgba(0, 221, 255, 0.48);
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 221, 255, 0.12), transparent 42%),
    rgba(7, 16, 30, 0.76);
  outline: none;
}

.home-grid strong {
  display: block;
  color: #ffdcae;
  font-size: 24px;
}

.home-grid span {
  color: var(--text-muted);
  font-size: 12px;
}

.home-note {
  padding: 10px 12px;
  border: 1px solid rgba(255, 173, 73, 0.24);
  border-radius: var(--radius-md);
  background: rgba(255, 173, 73, 0.07);
}

.message strong {
  color: #7ee7ff;
}

.message time {
  display: block;
  margin-bottom: 3px;
  font-size: 8px;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}

.message p {
  margin-bottom: 0;
  width: fit-content;
  max-width: 100%;
}

.message-deleted {
  opacity: 0.72;
  border-style: dashed;
}

.message-deleted p {
  color: var(--text-muted);
  font-style: italic;
}

.message-edited {
  display: block;
  margin-top: 4px;
  color: rgba(148, 170, 198, 0.78);
  font-size: 9px;
  line-height: 1;
  text-align: right;
}

.message-action-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 6px;
  border: 1px solid rgba(0, 221, 255, 0.34);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 221, 255, 0.14), transparent 38%),
    rgba(6, 14, 26, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38), 0 0 24px rgba(0, 221, 255, 0.12);
}

.message-action-menu button {
  width: 100%;
  justify-content: flex-start;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.message-action-menu button:hover {
  background: rgba(0, 221, 255, 0.12);
}

.message-action-menu button.danger {
  color: #ffd8de;
}

.message-action-menu button.danger:hover {
  background: rgba(255, 95, 112, 0.16);
}

.message-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  position: relative;
}

.message-edit-status {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 173, 73, 0.36);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 173, 73, 0.12), transparent 42%),
    rgba(8, 14, 25, 0.94);
  color: #ffdcae;
  font-size: 12px;
  font-weight: 800;
}

.message-edit-status .mini-btn {
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
}

.public-meet-form {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.message-input-shell {
  position: relative;
  min-width: 0;
}

.message-input-shell textarea {
  padding-right: 50px;
}

.message-input-shell.has-text textarea {
  padding-right: 14px;
}

.message-image {
  position: absolute;
  top: 0;
  right: 3px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: #9edaff;
  box-shadow: none;
}

.message-image svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.message-image:hover {
  color: #eaffff;
  background: transparent;
  filter: none;
  transform: none;
  box-shadow: none;
}

.message-image:focus,
.message-image:focus-visible,
.message-image:active {
  outline: none;
  color: #eaffff;
  background: transparent;
  filter: none;
  transform: none;
  box-shadow: none;
}

.message-input-shell.has-text .message-image {
  opacity: 0;
  pointer-events: none;
}

.message-mic {
  border-color: rgba(255, 173, 73, 0.72) !important;
  background: linear-gradient(135deg, #3b2510, #8a4a12) !important;
  box-shadow: 0 0 14px rgba(255, 173, 73, 0.24) !important;
  color: #fff3d7 !important;
}

.message-mic.recording {
  border-color: rgba(255, 95, 112, 0.86) !important;
  background: linear-gradient(135deg, #4c111b, #a32336) !important;
  box-shadow: 0 0 18px rgba(255, 95, 112, 0.42) !important;
  animation: voice-pulse 1s ease-in-out infinite;
}

.message-mic.sending {
  opacity: 0.72;
  cursor: wait;
}

@keyframes voice-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

.voice-message {
  min-width: min(420px, 88vw);
}

.image-message {
  max-width: min(72%, 560px);
  padding: 8px;
}

.image-content {
  display: grid;
  gap: 7px;
}

.image-download-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.image-download-link:focus,
.image-download-link:focus-visible {
  outline: none;
}

.image-placeholder {
  display: grid;
  min-width: 190px;
  min-height: 112px;
  place-items: center;
  border: 1px dashed rgba(0, 221, 255, 0.24);
  border-radius: calc(var(--radius-md) - 4px);
  background:
    linear-gradient(135deg, rgba(0, 221, 255, 0.09), rgba(255, 173, 73, 0.05)),
    rgba(0, 0, 0, 0.18);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-content img {
  display: block;
  max-width: min(100%, 520px);
  max-height: min(58vh, 520px);
  border-radius: calc(var(--radius-md) - 4px);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.24);
}

.image-mark,
.image-meta {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
}

.image-mark {
  width: fit-content;
  padding: 3px 5px;
  border: 1px solid rgba(0, 221, 255, 0.36);
  border-radius: var(--radius-sm);
  color: #a7f4ff;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-error {
  color: #ffd8de;
  font-size: 12px;
}

.voice-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: min(640px, 100%);
}

.voice-mark {
  padding: 3px 5px;
  border: 1px solid rgba(255, 173, 73, 0.48);
  border-radius: var(--radius-sm);
  color: #ffdcae;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-content audio {
  width: 100%;
  height: 34px;
  color-scheme: dark;
}

.media-loading {
  opacity: 0.72;
}

.voice-meta {
  color: var(--text-muted);
  font-size: 10px;
  min-width: 31px;
  text-align: right;
}

.voice-error {
  min-width: 0;
  color: #ffd8de;
  font-size: 11px;
}

.voice-recording-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 95, 112, 0.42);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 95, 112, 0.16), transparent 42%),
    rgba(8, 14, 25, 0.94);
  color: #ffe9ee;
}

.voice-recording-bar.sending {
  border-color: rgba(255, 173, 73, 0.42);
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 173, 73, 0.14), transparent 42%),
    rgba(8, 14, 25, 0.94);
}

.voice-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ff5f70;
  box-shadow: 0 0 12px rgba(255, 95, 112, 0.72);
  animation: voice-dot-pulse 1s ease-in-out infinite;
}

.voice-recording-bar.sending .voice-dot {
  background: #ffad49;
  box-shadow: 0 0 12px rgba(255, 173, 73, 0.62);
}

@keyframes voice-dot-pulse {
  0%,
  100% {
    transform: scale(0.78);
    opacity: 0.68;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

.voice-recording-bar strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-recording-bar time {
  justify-self: start;
  color: #ffd8de;
  font-size: 13px;
}

.voice-cancel {
  border-color: rgba(255, 95, 112, 0.5);
  color: #ffe9ee;
}

.emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  width: min(360px, 100%);
  max-height: min(360px, 46dvh);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(0, 221, 255, 0.42);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 221, 255, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(10, 20, 36, 0.98), rgba(4, 8, 15, 0.98));
  box-shadow: var(--shadow);
}

.emoji-group {
  display: grid;
  gap: 6px;
}

.emoji-group strong {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.emoji-item {
  min-height: 38px;
  border-radius: var(--radius-md);
  background: rgba(8, 18, 32, 0.82);
  font-size: 21px;
  line-height: 1;
}

.emoji-item:hover {
  background: rgba(0, 221, 255, 0.12);
}

.status {
  display: none;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.status.show {
  display: block;
}

.status.error {
  color: var(--danger);
}

.status.warning {
  padding: 9px 10px;
  border: 1px solid rgba(255, 173, 73, 0.5);
  border-radius: var(--radius-md);
  background: rgba(255, 173, 73, 0.1);
  color: #ffdcae;
}

.top-status {
  max-width: min(62vw, 620px);
  line-height: 1.2;
}

.menu-overlay {
  display: none;
}

.mobile-only {
  display: none;
}

.auth-card,
.contacts,
.messages,
.profile-settings,
.emoji-picker,
.contacts-panel,
.public-meet {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 221, 255, 0.72) rgba(8, 13, 21, 0.98);
}

.auth-card::-webkit-scrollbar,
.contacts::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.profile-settings::-webkit-scrollbar,
.emoji-picker::-webkit-scrollbar,
.contacts-panel::-webkit-scrollbar,
.public-meet::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.auth-card::-webkit-scrollbar-track,
.contacts::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.profile-settings::-webkit-scrollbar-track,
.emoji-picker::-webkit-scrollbar-track,
.contacts-panel::-webkit-scrollbar-track,
.public-meet::-webkit-scrollbar-track {
  background: rgba(8, 13, 21, 0.98);
  border-radius: 999px;
}

.auth-card::-webkit-scrollbar-thumb,
.contacts::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.profile-settings::-webkit-scrollbar-thumb,
.emoji-picker::-webkit-scrollbar-thumb,
.contacts-panel::-webkit-scrollbar-thumb,
.public-meet::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 221, 255, 0.9), rgba(0, 162, 255, 0.9));
  border-radius: 999px;
  border: 2px solid rgba(8, 13, 21, 0.98);
}

.auth-card::-webkit-scrollbar-thumb:hover,
.contacts::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover,
.profile-settings::-webkit-scrollbar-thumb:hover,
.emoji-picker::-webkit-scrollbar-thumb:hover,
.contacts-panel::-webkit-scrollbar-thumb:hover,
.public-meet::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #31e7ff, #2aaeff);
}

@media (min-width: 1025px) {
  .contacts-panel .profile-hero {
    display: grid;
    grid-template-columns: minmax(0, 148px) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .contacts-panel .profile-avatar {
    width: 100%;
    max-width: 148px;
  }

  .profile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
  }

  .profile-actions .profile-settings-toggle,
  .profile-actions .profile-side-action {
    position: static;
    right: auto;
    bottom: auto;
    display: inline-flex;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
  }

  .public-room-create-toggle {
    border-color: rgba(255, 173, 73, 0.66) !important;
    background:
      radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.13), transparent 35%),
      linear-gradient(135deg, rgba(61, 37, 15, 0.92), rgba(122, 68, 18, 0.82)) !important;
    color: #ffdcae;
    box-shadow: 0 0 14px rgba(255, 173, 73, 0.18);
  }

  .public-room-create-toggle.active {
    border-color: rgba(255, 173, 73, 0.96) !important;
    box-shadow: 0 0 20px rgba(255, 173, 73, 0.32);
  }

  .public-room-create-toggle.locked {
    opacity: 0.52;
  }

  .dialog-panel > .messages-bottom {
    padding-bottom: 18px;
    border-color: var(--chat-frame-line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dialog-panel > .messages-bottom + .message-form {
    margin-top: -18px;
    gap: 6px;
    padding: 16px 6px 8px;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background:
      linear-gradient(180deg, rgba(5, 11, 20, 0), rgba(5, 11, 20, 0.46) 10px, rgba(5, 11, 20, 0.92) 24px, rgba(5, 11, 20, 0.99) 100%),
      radial-gradient(circle at 18% 28px, rgba(0, 221, 255, 0.055), transparent 34px);
    box-shadow: 0 -5px 14px rgba(0, 0, 0, 0.18);
    isolation: isolate;
    z-index: 4;
  }

  .dialog-panel > .messages-bottom + .message-form::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(5, 11, 20, 0.26);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.22) 8px, rgba(0, 0, 0, 0.72) 20px, #000 38px);
    -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.22) 8px, rgba(0, 0, 0, 0.72) 20px, #000 38px);
  }

  .dialog-panel > .messages-bottom + .message-form::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-right: 1px solid var(--chat-frame-line);
    border-bottom: 1px solid var(--chat-frame-line);
    border-left: 1px solid var(--chat-frame-line);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .dialog-panel > .messages-bottom + .message-form > * {
    position: relative;
    z-index: 1;
  }

  .dialog-panel > .messages-bottom + .message-form > .emoji-picker {
    position: absolute;
    left: 6px;
    bottom: calc(100% + 8px);
    z-index: 10;
    width: min(360px, calc(100% - 12px));
  }

  .dialog-panel > .messages-bottom + .message-form .circle-btn {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .container {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .card {
    border-radius: 0;
    height: 100%;
    padding: 8px;
  }

  #chat,
  .public-meet {
    border-bottom: 0;
    background:
      radial-gradient(42rem 22rem at 100% 0%, rgba(0, 221, 255, 0.1), transparent 58%),
      linear-gradient(180deg, rgba(10, 18, 32, 0.98), rgba(5, 11, 21, 0.98));
  }

  #chat {
    padding: 8px 0 0;
  }

  .public-meet {
    padding-bottom: 0;
  }

  .auth-card {
    width: 100%;
    max-width: none;
    padding-bottom: calc(8px + var(--mobile-bottom-safe));
  }

  .auth-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .topbar {
    margin-left: 8px;
    margin-right: 8px;
  }

  .dialog-panel {
    min-height: 0;
    height: 100%;
    padding: 8px 0 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background:
      linear-gradient(180deg, rgba(10, 18, 31, 0.96), rgba(5, 11, 20, 0.96)),
      linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.24) 100%);
  }

  .room-meta {
    grid-template-columns: 1fr;
    gap: 6px;
    font-size: 11px;
    padding: 0 8px;
  }

  .history-search {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) repeat(3, 34px) auto;
  }

  .home-screen {
    align-content: center;
    gap: 8px;
    margin-inline: 8px;
    padding: 10px;
  }

  .home-kicker {
    padding: 4px 6px;
    font-size: 10px;
  }

  .home-screen h2 {
    font-size: clamp(22px, 8vw, 34px);
    line-height: 1;
  }

  .home-screen p,
  .home-note,
  .home-hints p {
    font-size: 11px;
    line-height: 1.32;
  }

  .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .home-stat {
    padding: 7px 6px;
  }

  .home-grid strong {
    font-size: 18px;
  }

  .home-grid span {
    font-size: 10px;
  }

  .home-note {
    padding: 7px 8px;
  }

  .home-hints {
    min-height: 118px;
    padding: 10px;
  }

  .home-hint-head {
    font-size: 9px;
  }

  .messages {
    margin-top: 6px;
    padding: 6px 0 calc(14px + var(--mobile-bottom-safe));
    border-bottom: 0;
    border-radius: 0;
    scrollbar-gutter: auto;
  }

  .messages-bottom {
    padding-bottom: 18px;
  }

  .messages-bottom + .message-form {
    margin-top: -18px;
  }

  #messages {
    margin-left: 0;
    margin-right: 0;
    border: 0;
    border-radius: 0;
  }

  .message {
    width: fit-content;
    max-width: calc(86% - 4px);
    min-width: 80px;
  }

  .message.voice-message {
    max-width: calc(92% - 2px);
    min-width: min(72vw, 394px);
  }

  .voice-content {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
  }

  .voice-mark {
    padding-inline: 4px;
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  .voice-meta {
    font-size: 9px;
    min-width: 27px;
  }

  .message-in {
    margin-left: 0;
  }

  .message-out {
    margin-right: 0;
  }

  .message-form {
    margin: 0;
    padding: 9px 8px calc(9px + var(--mobile-bottom-safe) + var(--mobile-dock-lift));
    border-top: 1px solid var(--line);
    background:
      linear-gradient(180deg, rgba(5, 11, 20, 0), rgba(5, 11, 20, 0.52) 14px, rgba(5, 11, 20, 0.96) 34px, rgba(5, 11, 20, 0.99) 100%),
      radial-gradient(circle at 16% 38px, rgba(0, 221, 255, 0.12), transparent 42px);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
  }

  .message-form::before {
    content: none;
  }

  .public-meet {
    border-radius: 0;
    gap: 8px;
  }

  .public-meet-note {
    font-size: 11px;
  }

  .public-meet-head {
    align-items: stretch;
    flex-direction: column;
  }

  .public-meet-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .public-meet-messages {
    padding-bottom: calc(14px + var(--mobile-bottom-safe) + var(--mobile-dock-lift));
  }

  .public-meet-form {
    margin-bottom: 0;
  }

  .public-copy-link,
  .public-back {
    justify-content: center;
    white-space: normal;
  }

  .public-meet-member {
    min-width: 76px;
  }

  .emoji-picker {
    width: 100%;
    max-height: min(330px, 44dvh);
  }

  .mobile-only {
    display: inline-flex;
  }

  .contacts-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 360px);
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    z-index: 40;
    padding-top: 8px;
    padding-bottom: calc(14px + var(--mobile-bottom-safe));
    overflow: auto;
  }

  .contacts-panel .profile-hero {
    margin: 0 0 10px;
    border-radius: var(--radius-lg);
    overflow: visible;
    min-height: 0;
    max-height: none;
  }

  .contacts-panel .profile-avatar {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    object-fit: cover;
    object-position: center;
  }

  .profile-settings {
    max-height: calc(100dvh - 250px - var(--mobile-bottom-safe));
  }

  .sidebar-actions {
    padding-bottom: var(--mobile-bottom-safe);
  }

  body.menu-open .contacts-panel {
    transform: translateX(0);
  }

  .menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 12, 0.82);
    z-index: 30;
  }

  body.menu-open .menu-overlay {
    display: block;
  }
}
.call-panel {
  flex-shrink: 0;
  padding: 14px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(0, 221, 255, 0.055), transparent 65%);
  min-width: 0;
}
.call-heading, .call-controls, .call-peers, .call-admission {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.call-heading { justify-content: space-between; }
.call-heading h2 { margin: 0; font-size: 16px; color: var(--accent); }
.call-heading time, .call-disclosure { font-size: 11px; color: var(--text-muted); }
#call-status { font-size: 13px; margin: 10px 0; }
.call-disclosure { line-height: 1.5; }
.call-controls button, .call-controls input, .call-admission button { min-height: 44px; }
.call-controls input { width: min(100%, 260px); min-width: 0; }
.call-leave { color: var(--danger); }
.call-peers { margin-top: 10px; }
.call-peer { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; }
.call-waiting:empty, .call-peers:empty { display: none; }
.call-admission { margin-top: 8px; padding: 8px; border-left: 2px solid var(--warn); font-size: 12px; overflow-wrap: anywhere; }
.call-panel audio { display: none; }
