

:root {
  --md-sys-color-primary: #1a73e8;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eff4ff;
  --md-sys-color-on-primary-container: #185abc;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-dim: #edf1f7;
  --md-sys-color-surface-container: #f5f6fa;
  --md-sys-color-surface-container-high: #eff3f6;
  --md-sys-color-surface-container-highest: #e4e9f0;
  --md-sys-color-on-surface: #23272f;
  --md-sys-color-on-surface-variant: #5f7d95;
  --md-sys-color-outline: #d4d7de;
  --md-sys-color-outline-variant: #e4e9f0;
  --md-sys-color-error: #ea4335;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #fdecea;
  --md-sys-color-on-error-container: #c5221e;
  --md-sys-color-scrim: rgba(33, 33, 33, 0.55);
  --dialog-scrim-color: rgba(15, 23, 42, 0.55);

  --md-sys-elevation-1: 0 1px 2px rgba(35, 39, 47, 0.08), 0 1px 3px rgba(35, 39, 47, 0.06);
  --md-sys-elevation-2: 0 2px 6px rgba(35, 39, 47, 0.08), 0 4px 12px rgba(35, 39, 47, 0.06);
  --md-sys-elevation-3: 0 4px 16px rgba(35, 39, 47, 0.1), 0 8px 28px rgba(35, 39, 47, 0.08);

  --nav-width: 380px;
  --nav-header-height: 72px;
  --header-height: 64px;
  --composer-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --font-family: "Nunito", system-ui, -apple-system, sans-serif;
  --font-heading: "Poppins", system-ui, -apple-system, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-brand: "Comfortaa", system-ui, -apple-system, sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --md-ref-typeface-brand: "Poppins", system-ui, sans-serif;
  --md-ref-typeface-plain: "Nunito", system-ui, sans-serif;
  --md-sys-typescale-body-medium-font: "Nunito", system-ui, sans-serif;
  --md-sys-typescale-label-large-font: "Nunito", system-ui, sans-serif;

  --focus-ring: 0 0 0 2px var(--md-sys-color-surface), 0 0 0 4px rgba(26, 115, 232, 0.5);
  --focus-ring-inset: inset 0 0 0 2px rgba(26, 115, 232, 0.55);

  --chat-bubble-incoming: #eceef1;
  --chat-bubble-incoming-text: var(--md-sys-color-on-surface);
  --chat-bubble-outgoing: #1a73e8;
  --chat-bubble-outgoing-text: #ffffff;
  --chat-reaction-chip-outgoing: #e8f0fe;
  --chat-bubble-radius: 16px;
  --chat-bubble-radius-tight: 6px;
}

/* ── Keyboard focus (custom ring, no browser outline) ── */

:focus {
  outline: none;
}

md-filled-button:focus-visible,
md-outlined-button:focus-visible,
md-text-button:focus-visible,
md-icon-button:focus-visible,
md-switch:focus-visible,
button:focus-visible {
  box-shadow: var(--focus-ring);
}

.recent-room-item:focus-visible,
.chatroom-header-info:focus-visible,
.room-info-participant:focus-visible {
  box-shadow: var(--focus-ring-inset);
}

.recent-room-item:focus-visible {
  background: var(--md-sys-color-surface-container-high);
}

.chatroom-header-info:focus-visible {
  background: var(--md-sys-color-surface-container-high);
}

.room-info-participant:focus-visible:not(.room-info-participant--selected) {
  background: rgba(26, 115, 232, 0.08);
}

.list-message-sent-delete:focus-visible {
  opacity: 1;
  box-shadow: var(--focus-ring);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* ── Selection & cursors ── */

.whole-body {
  user-select: none;
  -webkit-user-select: none;
}

.whole-body img,
.whole-body svg,
.whole-body md-icon,
.whole-body .material-symbols-outlined,
button,
md-filled-button,
md-outlined-button,
md-text-button,
md-icon-button {
  user-select: none;
  -webkit-user-select: none;
}

.recent-rooms-list,
.recent-room-item,
.recent-room-item * {
  user-select: none;
  -webkit-user-select: none;
}

md-outlined-text-field,
md-filled-text-field,
textarea.message-input {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.whole-body :is(p, h1, h2, h3, h4, h5, h6, label, li, .dialog-subtitle) {
  cursor: default;
}

.whole-body span {
  cursor: default;
}

.whole-body :is(
  button,
  a,
  [role="button"],
  md-filled-button,
  md-outlined-button,
  md-text-button,
  md-icon-button,
  .recent-room-item,
  .app-menu-item,
  .list-message-sent-delete,
  .nav-backdrop,
  .chatroom-header-info,
  .nav-user-avatar,
  .room-info-participant
) {
  cursor: pointer;
}

.whole-body .room-info-participant,
.whole-body .room-info-participant * {
  cursor: pointer;
}

.whole-body .app-menu-item,
.whole-body .app-menu-item * {
  cursor: pointer;
}

.whole-body .recent-room-item,
.whole-body .recent-room-item * {
  cursor: pointer;
}

.whole-body .chatroom-header-info,
.whole-body .chatroom-header-info * {
  cursor: pointer;
}

.whole-body .list-message-reaction-chip,
.whole-body .list-message-reaction-chip--mine,
.whole-body .list-message-reaction-chip *,
.whole-body .list-message-reaction-chip--mine * {
  cursor: pointer;
}

*::selection {
  background-color: rgba(26, 115, 232, 0.2);
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-dim);
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.app-ready .main-chat-canvas {
  animation: canvasEnter var(--transition-slow) ease-out both;
}

body:not(.app-ready) .main-chat-canvas,
body:not(.app-ready) .nav-header,
body:not(.app-ready) .nav-join-section,
body:not(.app-ready) .create-room-enter,
body:not(.app-ready) .nav-actions-section,
body:not(.app-ready) .recent-rooms-section,
body:not(.app-ready) .vertical-divider1,
body:not(.app-ready) .welcome-logo,
body:not(.app-ready) .welcome-secure {
  opacity: 0;
}

body.app-ready .nav-header {
  animation: pageEnterUp 0.42s ease-out 0.08s both;
}

body.app-ready .nav-join-section {
  animation: pageEnterUp 0.42s ease-out 0.14s both;
}

body.app-ready .create-room-enter {
  animation: pageEnterUp 0.42s ease-out 0.2s both;
}

body.app-ready .nav-actions-section {
  animation: pageEnterUp 0.42s ease-out 0.14s both;
}

body.app-ready .recent-rooms-section {
  animation: pageEnterUp 0.42s ease-out 0.26s both;
}

body.app-ready .vertical-divider1 {
  animation: pageEnterFade 0.38s ease-out 0.18s both;
}

body.app-ready .welcome-logo {
  animation: pageEnterUp 0.52s ease-out 0.22s both, logoFloat 3s ease-in-out 0.82s infinite;
}

body.app-ready .welcome-secure {
  animation: pageEnterUp 0.48s ease-out 0.34s both;
}

@keyframes pageEnterUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageEnterFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.app-ready) .main-chat-canvas,
  body:not(.app-ready) .nav-header,
  body:not(.app-ready) .nav-join-section,
  body:not(.app-ready) .create-room-enter,
  body:not(.app-ready) .nav-actions-section,
  body:not(.app-ready) .recent-rooms-section,
  body:not(.app-ready) .vertical-divider1,
  body:not(.app-ready) .welcome-logo,
  body:not(.app-ready) .welcome-secure {
    opacity: 1;
  }

  body.app-ready .main-chat-canvas,
  body.app-ready .nav-header,
  body.app-ready .nav-join-section,
  body.app-ready .create-room-enter,
  body.app-ready .nav-actions-section,
  body.app-ready .recent-rooms-section,
  body.app-ready .vertical-divider1,
  body.app-ready .welcome-logo,
  body.app-ready .welcome-secure,
  .recent-room-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
  }
}

/* ── Material Web component layout ── */

md-filled-button,
md-outlined-button,
md-text-button,
md-icon-button,
md-filled-text-field,
md-outlined-text-field,
md-dialog {
  font-family: var(--font-family);
}

md-switch {
  --md-switch-selected-track-color: var(--md-sys-color-primary);
  --md-switch-selected-hover-track-color: var(--md-sys-color-primary);
  --md-switch-selected-focus-track-color: var(--md-sys-color-primary);
  --md-switch-selected-pressed-track-color: var(--md-sys-color-primary);
  --md-switch-selected-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-hover-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-focus-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-pressed-handle-color: var(--md-sys-color-on-primary);
  --md-switch-track-color: var(--md-sys-color-surface-container-highest);
  --md-switch-track-outline-color: var(--md-sys-color-outline);
  --md-switch-handle-color: var(--md-sys-color-outline);
  --md-switch-hover-track-color: var(--md-sys-color-surface-container-highest);
  --md-switch-hover-track-outline-color: var(--md-sys-color-on-surface-variant);
  --md-switch-hover-handle-color: var(--md-sys-color-on-surface-variant);
  --md-switch-focus-track-color: var(--md-sys-color-surface-container-highest);
  --md-switch-focus-track-outline-color: var(--md-sys-color-on-surface-variant);
  --md-switch-focus-handle-color: var(--md-sys-color-on-surface-variant);
  --md-switch-pressed-track-color: var(--md-sys-color-surface-container-highest);
  --md-switch-pressed-track-outline-color: var(--md-sys-color-on-surface-variant);
  --md-switch-pressed-handle-color: var(--md-sys-color-on-surface-variant);
}

md-dialog.app-dialog:not(:defined) {
  display: none !important;
}

md-icon-button .material-symbols-outlined {
  font-size: 22px;
}

md-filled-button.join-room {
  flex-shrink: 0;
  --md-filled-button-container-shape: 999px;
  --md-filled-button-container-height: 40px;
  transition: transform var(--transition-fast);
}

md-outlined-text-field.join-roomid {
  flex: 1;
  min-width: 0;
  --md-outlined-text-field-container-shape: 20px;
  --md-outlined-text-field-top-space: 8px;
  --md-outlined-text-field-bottom-space: 8px;
  --md-outlined-text-field-leading-space: 16px;
  --md-outlined-text-field-trailing-space: 16px;
  --md-outlined-text-field-outline-color: var(--md-sys-color-outline);
  --md-outlined-text-field-focus-outline-color: var(--md-sys-color-primary);
  --md-outlined-text-field-hover-outline-color: #8da0ad;
  --md-outlined-text-field-input-text-size: 0.875rem;
  --md-outlined-text-field-label-text-size: 0.875rem;
}

.create-room-enter {
  width: calc(100% - 32px);
  margin: 0 auto 12px;
}

md-outlined-button.create-room {
  width: 100%;
  display: block;
  --md-outlined-button-container-shape: 999px;
  transition: transform var(--transition-fast);
}

.nav-actions-section {
  display: none;
}

.nav-actions-section md-filled-button.join-room,
.nav-actions-section md-outlined-button.create-room {
  flex: 1;
  min-width: 0;
  width: auto;
  --md-filled-button-container-shape: 999px;
  --md-outlined-button-container-shape: 999px;
}

.nav-actions-section md-filled-button.join-room {
  --md-filled-button-container-height: 40px;
}

.nav-actions-section md-outlined-button.create-room {
  display: inline-flex;
  --md-outlined-button-container-height: 40px;
}

md-filled-button.join-room:active,
md-outlined-button.create-room:active {
  transform: scale(0.99);
}

md-text-button.view-archive-toggle {
  min-width: 160px;
  --md-text-button-label-text-color: var(--md-sys-color-primary);
}


md-outlined-text-field.username,
md-outlined-text-field.roomid-input,
md-outlined-text-field.join-roomid-input {
  width: 100%;
  --md-outlined-text-field-container-shape: 12px;
}

md-filled-button.name-screen-continue,
md-filled-button.create-room-button,
md-filled-button.join-room-confirm {
  --md-filled-button-container-shape: 999px;
}

md-filled-button.room-info-delete-btn,
md-filled-button.delete-room-confirm {
  --md-filled-button-container-shape: 999px;
  --md-sys-color-primary: var(--md-sys-color-error-container);
  --md-sys-color-on-primary: var(--md-sys-color-on-error-container);
}

md-filled-button.room-info-delete-btn {
  width: 100%;
  margin-top: auto;
}

md-icon-button.message-attach-button,
md-icon-button.message-emoji-button,
md-icon-button.message-send-button {
  flex-shrink: 0;
  align-self: center;
}

md-icon-button.message-attach-button,
md-icon-button.message-emoji-button {
  --md-icon-button-state-layer-width: 46px;
  --md-icon-button-state-layer-height: 46px;
  --md-icon-button-icon-size: 24px;
}

md-icon-button.message-emoji-button {
  margin-inline-start: -10px;
}

md-icon-button.message-send-button {
  --md-icon-button-state-layer-width: 52px;
  --md-icon-button-state-layer-height: 52px;
  --md-icon-button-icon-size: 26px;
}

md-icon-button.message-attach-button .material-symbols-outlined,
md-icon-button.message-emoji-button .material-symbols-outlined {
  font-size: 24px;
}

md-icon-button.message-send-button .material-symbols-outlined {
  font-size: 26px;
}

.recent-room-item md-ripple {
  position: absolute;
  inset: 0;
}

.chatroom-header-info md-ripple {
  position: absolute;
  inset: 0;
}

/* ── Layout Shell ── */

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.whole-body {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--md-sys-color-surface-dim);
}

.whole-body > main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Loader ── */

.loader-screen {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
  max-width: none;
  max-height: none;
}

.loader-screen[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.loader-screen::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.loader-screen[open]::backdrop {
  animation: loaderBackdropIn 0.38s ease-out both;
}

.loader-image {
  width: 96px;
  height: 96px;
}

.loader-screen[open] .loader-image {
  animation:
    loaderContentIn 0.44s cubic-bezier(0.4, 0, 0.2, 1) both,
    loaderPulse 0.8s ease-in-out 0.44s infinite alternate;
}

.loader-screen.screen-visible {
  animation: none;
}

@keyframes loaderBackdropIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(6px);
  }
}

@keyframes loaderContentIn {
  from {
    opacity: 0;
    transform: scale(0.84) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes loaderPulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.88); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-screen[open]::backdrop {
    animation: none;
  }

  .loader-screen[open] .loader-image {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ── Main Canvas ── */

.main-chat-canvas {
  width: min(calc(100% - 32px), 1400px);
  height: min(calc(100% - 24px), 100%);
  margin: auto;
  display: flex;
  border-radius: var(--radius-lg);
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-2);
  overflow: hidden;
}

@keyframes canvasEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Navigation ── */

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--md-sys-color-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-medium);
}

.nav-area {
  width: var(--nav-width);
  min-width: var(--nav-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface);
  transition: transform var(--transition-medium);
}

.nav-header {
  height: var(--nav-header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: relative;
  overflow: visible;
}

.nav-logo {
  width: 148px;
  max-width: calc(100% - 48px);
  height: auto;
  flex-shrink: 1;
  min-width: 0;
  cursor: pointer;
}

.nav-user-avatar-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-user-avatar-wrap:is(:hover, :focus-within) {
  z-index: 5;
}

.nav-user-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--md-sys-elevation-1);
  background: transparent;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.nav-user-avatar-label {
  position: absolute;
  top: calc(100% + 6px);
  right: -6px;
  left: auto;
  z-index: 20;
  max-width: 160px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  box-shadow: var(--md-sys-elevation-2);
}

.nav-user-avatar-wrap:hover .nav-user-avatar-label,
.nav-user-avatar-wrap:focus-within .nav-user-avatar-label {
  opacity: 1;
}

.nav-user-avatar-label:empty {
  display: none;
}

.nav-user-avatar:hover {
  box-shadow: var(--md-sys-elevation-1), 0 0 0 4px var(--md-sys-color-outline);
}

.nav-user-avatar:active {
  transform: scale(0.99);
}

.nav-user-avatar:focus-visible {
  box-shadow: var(--md-sys-elevation-1), var(--focus-ring);
}

.nav-user-avatar md-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  --md-ripple-hover-opacity: 0;
  --md-ripple-focus-opacity: 0;
  --md-ripple-pressed-color: var(--md-sys-color-on-surface);
  --md-ripple-pressed-opacity: 0.12;
}

.nav-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-drag: none;
}

.nav-close-btn {
  display: none;
}

.nav-join-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 8px;
}

.nav-actions-section {
  align-items: center;
  gap: 10px;
  padding: 16px;
}

.recent-rooms-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  padding: 0 12px 0;
}

.recent-rooms-heading {
  margin: 0 0 8px;
  padding: 0 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.recent-rooms-pull {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.recent-rooms-pull__indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding-top: 6px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.55);
}

.recent-rooms-pull__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-1);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.recent-rooms-pull.is-ready .recent-rooms-pull__spinner {
  background: var(--md-sys-color-primary-container);
  box-shadow: var(--md-sys-elevation-2);
}

.recent-rooms-pull__icon {
  font-size: 20px;
  line-height: 1;
  color: var(--md-sys-color-on-surface-variant);
  transition: color 0.15s ease;
  will-change: transform;
}

.recent-rooms-pull.is-ready .recent-rooms-pull__icon {
  color: var(--md-sys-color-on-primary-container);
}

.recent-rooms-pull.is-refreshing .recent-rooms-pull__icon {
  animation: recentRoomsPullSpin 0.85s linear infinite;
}

.recent-rooms-pull.is-snapping .recent-rooms-list,
.recent-rooms-pull.is-refreshing .recent-rooms-list {
  transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1);
}

.recent-rooms-pull.is-refreshing .recent-rooms-pull__indicator {
  opacity: 1;
  transform: scale(1);
}

@keyframes recentRoomsPullSpin {
  to {
    transform: rotate(360deg);
  }
}

.recent-rooms-list {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline) transparent;
  -webkit-overflow-scrolling: touch;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .recent-rooms-pull.is-refreshing .recent-rooms-pull__icon {
    animation: none;
  }

  .recent-rooms-pull.is-snapping .recent-rooms-list,
  .recent-rooms-pull.is-refreshing .recent-rooms-list {
    transition: none;
  }
}

.recent-rooms-archive {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  padding: 12px 8px 16px;
}

.view-archive-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.view-archive-toggle {
  flex-shrink: 0;
}

.view-archive-dot {
  position: absolute;
  top: 8px;
  right: 28px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  display: none;
  pointer-events: none;
}

.view-archive-dot.is-visible {
  display: block;
}

.recent-rooms-list::-webkit-scrollbar {
  width: 4px;
}

.recent-rooms-list::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline);
  border-radius: 4px;
}

.recent-rooms-empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface-variant);
}

.recent-room-skeleton {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  pointer-events: none;
}

.recent-room-skeleton__avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
}

.recent-room-skeleton__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-room-skeleton__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-room-skeleton__name {
  flex: 1;
  max-width: 58%;
  height: 12px;
  border-radius: 999px;
}

.recent-room-skeleton__time {
  width: 44px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.recent-room-skeleton__preview {
  width: 82%;
  height: 10px;
  border-radius: 999px;
}

.recent-room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  animation: listItemIn 0.34s cubic-bezier(0.4, 0, 0.2, 1) both;
  animation-delay: calc(var(--enter-index, 0) * 85ms);
}

.recent-room-item--no-animate {
  animation: none;
}

.recent-room-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.recent-room-item-active,
.recent-room-item-active:hover {
  background: var(--md-sys-color-surface-container-high);
}

.recent-room-item:active {
  transform: scale(0.99);
}

@keyframes listItemIn {
  from {
    opacity: 0;
    translate: 0 6px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.recent-room-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-1);
}

.recent-room-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recent-room-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-room-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.recent-room-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-room-time-wrap {
  flex-shrink: 0;
  transform: translateY(-3px);
}

.recent-room-time {
  font-size: 11px;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface-variant);
}

.recent-room-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.recent-room-meta {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}

.recent-room-item:hover .recent-room-meta,
.recent-room-item:focus-within .recent-room-meta {
  cursor: pointer;
}

.recent-room-item:hover .recent-room-meta::after,
.recent-room-item:focus-within .recent-room-meta::after {
  content: "";
  position: absolute;
  top: -10px;
  bottom: -10px;
  right: -12px;
  left: -8px;
}

.recent-room-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  display: none;
}

.recent-room-unread.is-visible {
  display: block;
}

.recent-room-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.recent-room-item:hover .recent-room-menu-btn,
.recent-room-item:focus-within .recent-room-menu-btn {
  display: flex;
}

.recent-room-item:hover .recent-room-meta:hover .recent-room-menu-btn,
.recent-room-item:focus-within .recent-room-meta:hover .recent-room-menu-btn,
.recent-room-menu-btn:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
}

.recent-room-menu-btn:focus-visible {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--focus-ring);
}

.recent-room-menu-btn__icon {
  display: block;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recent-room-preview {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-context-menu,
.nav-profile-menu,
.chatroom-header-menu,
.chat-pinned-message-menu,
.message-context-menu,
.link-context-menu {
  position: fixed;
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 1px;
  min-width: 164px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-3);
}

.recent-context-menu.visible,
.message-context-menu.visible,
.link-context-menu.visible,
.nav-profile-menu.visible,
.chatroom-header-menu.visible,
.chat-pinned-message-menu.visible {
  display: flex;
  animation: menuIn 0.18s ease-out;
}

.recent-context-menu.is-closing,
.message-context-menu.is-closing,
.link-context-menu.is-closing,
.chat-pinned-message-menu.is-closing {
  display: flex;
  pointer-events: none;
  animation: menuOut 0.18s ease-in forwards;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes menuOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
}

.app-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: #8b9bab;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.app-menu-item[hidden] {
  display: none !important;
}

.app-menu-item md-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  --md-ripple-hover-opacity: 0;
  --md-ripple-focus-opacity: 0;
  --md-ripple-pressed-color: var(--md-sys-color-on-surface);
  --md-ripple-pressed-opacity: 0.1;
}

.app-menu-item:hover {
  background: var(--md-sys-color-surface-container-high);
  color: #6f8294;
}

.app-menu-item:focus-visible {
  background: var(--md-sys-color-surface-container-high);
  color: #6f8294;
  box-shadow: var(--focus-ring-inset);
}

.app-menu-item__icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: inherit;
  overflow: visible;
}

.recent-context-menu .app-menu-item__icon {
  width: 13px;
  height: 13px;
  stroke-width: 1.85;
}

.message-context-menu .app-menu-item__icon--symbol,
.link-context-menu .app-menu-item__icon--symbol {
  font-family: "Material Symbols Rounded";
  font-size: 16px;
  line-height: 1;
  width: 16px;
  height: 16px;
  stroke: none;
  fill: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.message-context-menu .app-menu-item__icon--symbol-outlined,
.link-context-menu .app-menu-item__icon--symbol-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.chat-pinned-message-menu .app-menu-item__icon--symbol {
  font-family: "Material Symbols Rounded";
  font-size: 14px;
  line-height: 1;
  width: 14px;
  height: 14px;
  stroke: none;
  fill: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.chat-pinned-message-menu .app-menu-item__icon--symbol-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.app-menu-item__label {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.app-menu-item--danger,
.recent-context-item-danger,
.message-context-item-danger {
  color: #d9665c;
}

.app-menu-item--danger:hover,
.app-menu-item--danger:focus-visible,
.recent-context-item-danger:hover,
.recent-context-item-danger:focus-visible,
.message-context-item-danger:hover,
.message-context-item-danger:focus-visible {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
}

.vertical-divider1 {
  width: 1px;
  background: var(--md-sys-color-outline-variant);
}

/* ── Screen Section ── */

.screen-section {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.welcome-screen,
.chat-screen {
  width: 100%;
  height: 100%;
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.welcome-menu-btn {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
}

.welcome-screen.screen-visible {
  animation: screenFadeIn var(--transition-medium) ease-out;
}

.welcome-logo {
  width: min(240px, 60vw);
  height: auto;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.welcome-secure {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(360px, 100%);
  margin-top: 36px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--md-sys-color-primary-container);
  box-shadow: var(--md-sys-elevation-1);
}

.welcome-secure-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.welcome-secure-description h5 {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-primary-container);
}

.welcome-secure-description h6 {
  margin: 0;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

/* ── Chat Screen ── */

.chat-screen {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.chat-screen.screen-visible {
  animation: screenFadeIn var(--transition-medium) ease-out;
}

@keyframes screenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-1);
  z-index: 10;
}

.mobile-menu-btn,
.mobile-back-btn,
.chatroom-more-btn,
.nav-close-btn {
  display: none;
  flex-shrink: 0;
}

.chatroom-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  margin-left: 4px;
  padding: 4px 8px 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chatroom-header-info:hover {
  background: var(--md-sys-color-surface-container-high);
}

.chatroom-avatar {
  width: 44px;
  height: 44px;
  margin-left: 0;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--md-sys-elevation-1);
}

.chatroom-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatroom-description {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chatroom-id {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatroom-powered-by {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatroom-copy-link,
.chatroom-share-link,
.chatroom-close-btn,
.message-send-button {
  flex-shrink: 0;
}

.chat-pinned-messages {
  flex-shrink: 0;
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  max-height: 148px;
  overflow-y: auto;
}

.chat-pinned-messages[hidden] {
  display: none !important;
}

.chat-pinned-messages__list {
  display: flex;
  flex-direction: column;
}

.chat-pinned-message-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  transition: background var(--transition-fast);
}

.chat-pinned-message-item,
.chat-pinned-message-item * {
  cursor: pointer;
}

.chat-pinned-message-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.chat-pinned-message-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--md-sys-color-primary);
  pointer-events: none;
}

.chat-pinned-message-item__icon svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.chat-pinned-message-item__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  pointer-events: none;
}

.chat-pinned-message-item__label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--md-sys-color-primary);
}

.chat-pinned-message-item__text {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--md-sys-color-on-surface-variant);
}

.chat-pinned-message-item__menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 28px;
  height: 28px;
  margin: -4px -6px -4px 0;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: auto;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.chat-pinned-message-item__menu-trigger:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.chat-pinned-message-item__menu-trigger svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.chat-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  --chat-snackbar-bottom: calc(var(--composer-height) + 20px);
}

.room-info-panel {
  position: relative;
  width: 300px;
  min-width: 300px;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  border-left: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  overflow-y: auto;
}

.room-info-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.chat-screen.info-open .room-info-panel {
  display: flex;
  animation: panelSlideIn 0.32s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chat-screen.info-open .room-info-panel.is-closing {
  animation: panelSlideOut 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes panelSlideIn {
  from {
    opacity: 0.94;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes panelSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0.94;
    transform: translateX(100%);
  }
}

.room-info-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 14px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-2);
}

.room-info-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-info-name {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.room-info-id {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.room-info-participants-label {
  width: 100%;
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.room-info-participants-list {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.room-info-empty {
  margin: 12px 0;
  text-align: center;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.room-info-participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--md-sys-color-surface-container-high);
  animation: listItemIn 0.22s ease-out both;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.room-info-participant:hover:not(.room-info-participant--selected) {
  background: rgba(26, 115, 232, 0.08);
}

.room-info-participant--selected {
  background: var(--md-sys-color-primary-container);
}

.room-info-participant--selected:hover {
  background: var(--md-sys-color-primary-container);
}

.room-info-participant md-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  --md-ripple-hover-opacity: 0;
  --md-ripple-focus-opacity: 0;
  --md-ripple-pressed-color: var(--md-sys-color-primary);
  --md-ripple-pressed-opacity: 0.12;
}

.room-info-participant-filter-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.room-info-participant-filter-dot.is-visible {
  opacity: 1;
  transform: scale(1);
}

.room-info-participant-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.room-info-participant-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-info-participant-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
  -webkit-user-select: text;
}

.room-info-participant-count {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
}

.room-info-participant--skeleton {
  pointer-events: none;
}

.skeleton-block {
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-surface-container-high) 0%,
    var(--md-sys-color-outline-variant) 50%,
    var(--md-sys-color-surface-container-high) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
}

.room-info-participant--skeleton .room-info-participant-avatar.skeleton-block {
  border-radius: 50%;
}

.skeleton-block--name {
  width: 72%;
  height: 12px;
}

.skeleton-block--count {
  width: 42%;
  height: 10px;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ── Messages ── */

.chat-list-section {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline) transparent;
}

.chat-list-loader {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-surface);
}

.chat-list-loader.is-visible {
  display: flex;
}

.chat-main:has(.chat-list-loader.is-visible) .chat-message-section {
  visibility: hidden;
  pointer-events: none;
}

.chat-list-loader__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px;
}

.chat-list-loader__lottie {
  width: 270px;
  height: 270px;
}

.chat-list-loader__message {
  margin: 0;
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0.01em;
  user-select: none;
  -webkit-user-select: none;
  transform: translateY(-90px);
  animation: chatLoaderTextPulse 1.2s ease-in-out infinite;
}

@keyframes chatLoaderTextPulse {
  0%,
  100% {
    transform: translateY(-90px) scale(1);
    opacity: 0.82;
  }

  50% {
    transform: translateY(-90px) scale(1.045);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-list-loader__message {
    animation: none;
  }
}

.chat-older-loader {
  display: none;
  justify-content: center;
  padding: 10px 0 4px;
}

.chat-older-loader.is-visible {
  display: flex;
}

.chat-older-loader__spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--md-sys-color-outline-variant);
  border-top-color: var(--md-sys-color-primary);
  border-radius: 50%;
  animation: chatListSpin 0.75s linear infinite;
}

@keyframes chatListSpin {
  to {
    transform: rotate(360deg);
  }
}

.chat-list-section::-webkit-scrollbar {
  width: 6px;
}

.chat-list-section::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline);
  border-radius: 6px;
}

.chat-list-section > main {
  display: flex;
  flex-direction: column;
}

.blank-message-top {
  height: 20px;
}

.blank-message-bottom {
  height: 16px;
}

.main-message-list {
  display: flex;
  flex-direction: column;
}

.main-message-list .list-message-recieve,
.main-message-list .list-message-sent,
.main-message-list .list-message-recieve > p,
.main-message-list .list-message-sent > p,
.main-message-list .list-message-recieve-name,
.main-message-list .list-message-sent-name {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.main-message-list .list-message-recieve-avatar,
.main-message-list .list-message-recieve-avatar-spacer,
.main-message-list .list-message-sent-avatar,
.main-message-list .list-message-sent-avatar-spacer,
.main-message-list .list-message-bubble-time,
.main-message-list .list-message-bubble-meta,
.main-message-list .list-message-status,
.main-message-list .list-message-date-box,
.main-message-list .list-message-date-box * {
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.main-message-list .list-message-reply,
.main-message-list .list-message-reply * {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.main-message-list .list-message-reaction-chip,
.main-message-list .list-message-reaction-chip--mine,
.main-message-list .list-message-reaction-chip *,
.main-message-list .list-message-reaction-chip--mine * {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.main-message-list a.list-message-link {
  cursor: pointer;
}

.main-message-list .list-message-sent-delete {
  cursor: pointer;
}

.main-message-list .list-message-sent-resend {
  cursor: pointer;
}

.list-message-recieve-box.list-message-enter,
.list-message-sent-box.list-message-enter {
  animation: messageIn 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.main-message-list.is-updating .list-message-recieve-box,
.main-message-list.is-updating .list-message-sent-box,
.main-message-list.is-updating .list-message-date-box {
  animation: none;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.list-message-recieve-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 8px 16px 0;
}

.list-message-recieve-box--continue {
  margin-top: 3px;
}

.list-message-recieve-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(85%, 560px);
  width: 100%;
}

.list-message-recieve-row.list-message-row--swipe-reply,
.list-message-sent-row.list-message-row--swipe-reply {
  position: relative;
}

.list-message-swipe-reply-slot {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.list-message-swipe-reply-icon {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
  opacity: 0;
  transform: scale(0.42);
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.list-message-swipe-reply-icon__glyph-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.list-message-swipe-reply-icon__glyph {
  display: block;
  font-family: "Material Symbols Rounded";
  font-size: 16px;
  line-height: 1;
  font-style: normal;
  font-weight: normal;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
  -webkit-font-smoothing: antialiased;
  transform: scale(0.625);
  transform-origin: center center;
}

.list-message-swipe-reply-icon.is-ready {
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container-highest);
}

.list-message-swipe-body {
  min-width: 0;
  flex: 1;
  will-change: transform;
}

.list-message-sent-row .list-message-swipe-body {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}

.list-message-swipe-body.is-snapping {
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-message-recieve-row.is-swiping .list-message-swipe-body,
.list-message-sent-row.is-swiping .list-message-swipe-body {
  transition: none;
}

.list-message-recieve-row.is-swiping,
.list-message-sent-row.is-swiping {
  touch-action: none;
}

.list-message-recieve-box.is-swipe-reply-active,
.list-message-sent-box.is-swipe-reply-active {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .list-message-swipe-body.is-snapping {
    transition: none;
  }
}

.list-message-recieve-avatar,
.list-message-recieve-avatar-spacer {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 1px;
}

.list-message-recieve-avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-1);
}

.list-message-recieve-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.list-message-sent-box {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  margin: 8px 0 0;
}

.list-message-sent-box--continue {
  margin-top: 3px;
}

.list-message-sent-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(85%, 560px);
  margin: 0 16px 0 0;
}

.list-message-sent-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
  flex: 1;
}

.list-message-sent-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 3px;
}

.list-message-sent-avatar,
.list-message-sent-avatar-spacer {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.list-message-sent-avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--md-sys-color-surface-container-high);
}

.list-message-recieve,
.list-message-sent {
  display: flex;
  flex-direction: column;
}

.list-message-recieve-name,
.list-message-sent-name {
  margin: 0 0 3px 2px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.list-message-sent-name {
  margin: 0;
  text-align: right;
}

.list-message-recieve {
  max-width: 100%;
  width: fit-content;
  margin: 0;
  padding-bottom: 4px;
  background: var(--chat-bubble-incoming);
  box-shadow: none;
  transition: background-color 0.2s ease;
}

.list-message-recieve--single {
  border-radius: var(--chat-bubble-radius-tight) var(--chat-bubble-radius) var(--chat-bubble-radius) var(--chat-bubble-radius);
}

.list-message-recieve--first {
  border-radius: var(--chat-bubble-radius-tight) var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius-tight);
}

.list-message-recieve--middle {
  border-radius: var(--chat-bubble-radius-tight) var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius-tight);
}

.list-message-recieve--last {
  border-radius: var(--chat-bubble-radius-tight) var(--chat-bubble-radius) var(--chat-bubble-radius) var(--chat-bubble-radius);
}

.list-message-recieve > p,
.list-message-sent > p {
  margin: 10px 16px 4px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.list-message-recieve > p {
  color: var(--chat-bubble-incoming-text);
}

.list-message-sent > p {
  color: var(--chat-bubble-outgoing-text);
}

.list-message-reply {
  display: flex;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.list-message-reply--received {
  background: rgba(26, 115, 232, 0.1);
}

.list-message-reply--sent {
  background: rgba(255, 255, 255, 0.16);
}

.list-message-reply__bar {
  width: 3px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
}

.list-message-reply--sent .list-message-reply__bar {
  background: rgba(255, 255, 255, 0.92);
}

.list-message-reply__content {
  min-width: 0;
  flex: 1;
}

.list-message-reply__name {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.list-message-reply--received .list-message-reply__name {
  color: var(--md-sys-color-primary);
}

.list-message-reply--sent .list-message-reply__name {
  color: rgba(255, 255, 255, 0.92);
}

.list-message-reply__text {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-message-reply--received .list-message-reply__text {
  color: var(--md-sys-color-on-surface-variant);
}

.list-message-reply--sent .list-message-reply__text {
  color: rgba(255, 255, 255, 0.82);
}

.list-message-reply + p {
  margin-top: 6px;
}

.list-message-recieve-box.list-message-reply-target,
.list-message-sent-box.list-message-reply-target {
  animation: replyTargetRowHighlight 0.5s ease-out;
  border-radius: 8px;
}

.list-message-recieve-box.list-message-highlight,
.list-message-sent-box.list-message-highlight {
  animation: replyHighlight 2s ease-out;
  border-radius: 8px;
}

.list-message-recieve-box.list-message-context-active .list-message-recieve {
  background: #e2e6eb;
}

.list-message-sent-box.list-message-context-active .list-message-sent {
  background: #1669cf;
}

@keyframes replyTargetRowHighlight {
  0% { background-color: transparent; }
  10% { background-color: rgba(26, 115, 232, 0.14); }
  72% { background-color: rgba(26, 115, 232, 0.14); }
  100% { background-color: transparent; }
}

@keyframes replyHighlight {
  0% { background-color: transparent; }
  10% { background-color: rgba(26, 115, 232, 0.14); }
  82% { background-color: rgba(26, 115, 232, 0.14); }
  100% { background-color: transparent; }
}

.list-message-recieve > p > a.list-message-link {
  color: var(--md-sys-color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 0 -3px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.list-message-recieve > p > a.list-message-link:hover {
  background-color: rgba(26, 115, 232, 0.12);
  color: #1558b0;
}

.list-message-recieve > p > a.list-message-link:active {
  background-color: rgba(26, 115, 232, 0.22);
  color: #0f4a96;
}

.list-message-sent {
  max-width: 100%;
  width: fit-content;
  margin: 0;
  padding-bottom: 4px;
  background: var(--chat-bubble-outgoing);
  box-shadow: none;
  overflow: visible;
  transition: background-color 0.2s ease;
}

.list-message-sent--single {
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius);
}

.list-message-sent--first {
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius-tight);
}

.list-message-sent--middle {
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius-tight) var(--chat-bubble-radius-tight);
}

.list-message-sent--last {
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius-tight) var(--chat-bubble-radius) var(--chat-bubble-radius);
}

.list-message-sent > p > a.list-message-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 0 -3px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.list-message-sent > p > a.list-message-link:hover {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.list-message-sent > p > a.list-message-link:active {
  background-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.list-message-sent-delete {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 4px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  overflow: hidden;
  opacity: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.list-message-sent-delete md-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  --md-ripple-hover-opacity: 0;
  --md-ripple-focus-opacity: 0;
  --md-ripple-pressed-color: var(--md-sys-color-error);
  --md-ripple-pressed-opacity: 0.14;
}

.list-message-sent-delete img {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.list-message-sent-resend {
  flex-shrink: 0;
  align-self: flex-end;
  margin: 0 6px 8px 0;
  padding: 4px 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius-full);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.list-message-sent-resend:hover {
  background: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-primary);
}

.list-message-sent-resend:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.list-message-sent-box:hover > .list-message-sent-delete,
.list-message-sent-box:focus-within > .list-message-sent-delete {
  opacity: 0.7;
}

.list-message-sent-box:hover > .list-message-sent-delete:hover,
.list-message-sent-box:focus-within > .list-message-sent-delete:focus-visible {
  opacity: 1;
  background: var(--md-sys-color-surface-container-high);
}

.list-message-bubble-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.list-message-bubble-wrap--sent {
  justify-content: flex-end;
  align-self: flex-end;
}

.list-message-bubble-wrap .list-message-recieve,
.list-message-bubble-wrap .list-message-sent {
  flex-shrink: 1;
  min-width: 0;
}

.list-message-react-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  overflow: hidden;
  opacity: 0;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.list-message-react-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.list-message-recieve-box:hover .list-message-react-btn,
.list-message-recieve-box:focus-within .list-message-react-btn,
.list-message-sent-box:hover .list-message-react-btn,
.list-message-sent-box:focus-within .list-message-react-btn,
.list-message-react-btn:focus-visible {
  opacity: 0.72;
}

.list-message-react-btn:hover,
.list-message-react-btn:focus-visible {
  opacity: 1 !important;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-high);
}

.list-message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: -8px;
  margin-inline-start: 8px;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.list-message-reactions--sent {
  justify-content: flex-end;
  margin-inline-start: 0;
  margin-inline-end: 8px;
}

.list-message-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 20px;
  max-width: 100%;
  padding: 1px 6px;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  background: var(--chat-bubble-incoming);
  font-family: var(--font-family);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transform-origin: center center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
}

.list-message-reaction-chip:hover {
  transform: scale(1.04);
}

.list-message-reaction-chip--enter {
  animation: messageReactionPopIn 0.34s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
  transition: none;
}

@keyframes messageReactionPopIn {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }

  55% {
    opacity: 1;
    transform: scale(1.14);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .list-message-reaction-chip--enter {
    animation: none;
  }
}

.list-message-reactions--sent .list-message-reaction-chip,
.list-message-reactions--sent .list-message-reaction-chip--mine {
  background: var(--chat-reaction-chip-outgoing);
}

.list-message-reaction-chip--mine {
  background: var(--chat-bubble-incoming);
  border-color: #ffffff;
}

.list-message-reaction-chip__emojis {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.list-message-reaction-chip__group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.list-message-reaction-chip__emoji {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.list-message-reaction-chip__overflow {
  font-size: 10px;
  font-weight: 600;
  color: var(--chat-bubble-incoming-text);
  flex-shrink: 0;
}

.list-message-reaction-chip__count {
  font-size: 10px;
  font-weight: 600;
  color: var(--chat-bubble-incoming-text);
}

.reaction-details-dialog-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.reaction-details-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.reaction-details-list.is-scrollable {
  max-height: min(352px, 45vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.reaction-details-list.is-scrollable::-webkit-scrollbar {
  width: 6px;
}

.reaction-details-list.is-scrollable::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
}

.reaction-details-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
  padding: 4px 2px;
  overflow: hidden;
}

.reaction-details-item__emoji {
  flex-shrink: 0;
  width: 28px;
  font-size: 1.125rem;
  line-height: 1;
  text-align: center;
}

.reaction-details-item__name {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  color: var(--md-sys-color-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reaction-details-item__remove {
  flex-shrink: 0;
  margin-inline-start: auto;
  --md-icon-button-state-layer-width: 36px;
  --md-icon-button-state-layer-height: 36px;
  --md-icon-button-icon-size: 20px;
}

.message-reaction-picker {
  position: fixed;
  z-index: 1001;
  display: none;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-3);
}

.message-reaction-picker.visible {
  display: flex;
  animation: reactionPickerIn 0.16s ease-out;
}

.message-reaction-picker.is-closing {
  display: flex;
  pointer-events: none;
  animation: reactionPickerOut 0.14s ease-in forwards;
}

@keyframes reactionPickerIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reactionPickerOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
}

.message-reaction-picker__quick {
  display: flex;
  align-items: center;
  gap: 0;
}

.message-reaction-picker__emoji,
.message-reaction-picker__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.message-reaction-picker__emoji:hover,
.message-reaction-picker__more:hover,
.message-reaction-picker__emoji:focus-visible,
.message-reaction-picker__more:focus-visible {
  background: var(--md-sys-color-surface-container-high);
  transform: scale(1.08);
}

.message-reaction-picker__emoji.is-selected {
  background: var(--chat-bubble-incoming);
}

.message-reaction-picker__emoji.is-selected:hover,
.message-reaction-picker__emoji.is-selected:focus-visible {
  background: #dfe3e8;
}

.message-reaction-picker__more {
  font-size: 22px;
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
}

.message-reaction-emoji-panel {
  position: fixed;
  z-index: 1002;
  display: none;
  flex-direction: column;
  width: min(360px, calc(100vw - 24px));
  height: min(420px, calc(100vh - 24px));
  border-radius: 16px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-3);
  overflow: hidden;
}

.message-reaction-emoji-panel.visible {
  display: flex;
  animation: reactionPickerIn 0.16s ease-out;
}

.message-reaction-emoji-panel.is-closing {
  display: flex;
  pointer-events: none;
  animation: reactionPickerOut 0.14s ease-in forwards;
}

.message-reaction-emoji-panel__tabs {
  display: block;
  width: 100%;
  flex-shrink: 0;
  --md-primary-tab-container-color: transparent;
  --md-primary-tab-container-height: 40px;
  --md-primary-tab-with-icon-and-label-text-container-height: 40px;
  --md-primary-tab-icon-size: 20px;
  --md-divider-color: var(--md-sys-color-outline-variant);
}

.message-reaction-emoji-panel__tabs md-primary-tab {
  cursor: pointer;
  min-width: 44px;
  --md-primary-tab-container-height: 40px;
  --md-primary-tab-with-icon-and-label-text-container-height: 40px;
  --md-primary-tab-icon-size: 20px;
}

.message-reaction-emoji-panel__tabs md-primary-tab md-icon,
.message-reaction-emoji-panel__tabs md-primary-tab md-icon .material-symbols-outlined {
  cursor: pointer;
}

.message-reaction-emoji-panel__tabs md-icon .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.message-reaction-emoji-panel__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px;
  padding: 0 12px;
  min-height: 38px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-low);
}

.message-reaction-emoji-panel__search-icon {
  font-size: 18px;
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
}

.message-reaction-emoji-panel__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  outline: none;
}

.message-reaction-emoji-panel__search-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
}

.message-reaction-emoji-panel__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 12px 12px;
}

.message-reaction-emoji-panel__title {
  margin: 0 0 8px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.message-reaction-emoji-panel__empty {
  margin: 24px 0;
  text-align: center;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}

.message-reaction-emoji-panel__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: hidden;
  overflow-x: hidden;
  padding: 2px 2px 6px 0;
  align-content: start;
}

.message-reaction-emoji-panel__grid.is-scrollable {
  overflow-y: auto;
}

.message-reaction-emoji-panel__grid.is-scrollable::-webkit-scrollbar {
  width: 6px;
}

.message-reaction-emoji-panel__grid.is-scrollable::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--md-sys-color-outline-variant);
}

.message-reaction-emoji-panel__emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transform-origin: center center;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.message-reaction-emoji-panel__emoji:hover,
.message-reaction-emoji-panel__emoji:focus-visible {
  background: var(--md-sys-color-surface-container-high);
  transform: scale(1.06);
}

.list-message-bubble-time {
  display: block;
  align-self: flex-end;
  padding: 0 12px 8px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
}

.list-message-bubble-foot {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  align-self: flex-end;
  padding: 0 12px 8px;
}

.list-message-bubble-foot .list-message-bubble-time {
  display: inline;
  padding: 0;
}

.list-message-bubble-time-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
}

.list-message-bubble-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  line-height: 0;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
}

.list-message-bubble-star--enter {
  animation: messageBubbleStarEnter 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.list-message-bubble-star--exit {
  animation: messageBubbleStarExit 0.18s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes messageBubbleStarEnter {
  from {
    opacity: 0;
    transform: scale(0.35);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes messageBubbleStarExit {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .list-message-bubble-star--enter,
  .list-message-bubble-star--exit {
    animation: none;
  }
}

.list-message-bubble-star svg {
  display: block;
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.list-message-recieve .list-message-bubble-star {
  color: var(--md-sys-color-on-surface-variant);
}

.list-message-bubble-star--sent {
  color: rgba(255, 255, 255, 0.82);
}

.list-message-bubble-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  line-height: 0;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
}

.list-message-bubble-pin--enter {
  animation: messageBubblePinEnter 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.list-message-bubble-pin--exit {
  animation: messageBubblePinExit 0.18s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes messageBubblePinEnter {
  from {
    opacity: 0;
    transform: scale(0.35);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes messageBubblePinExit {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .list-message-bubble-pin--enter,
  .list-message-bubble-pin--exit {
    animation: none;
  }
}

.list-message-bubble-pin svg {
  display: block;
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.list-message-recieve .list-message-bubble-pin {
  color: var(--md-sys-color-on-surface-variant);
}

.list-message-bubble-pin--sent {
  color: rgba(255, 255, 255, 0.82);
}

.list-message-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  align-self: flex-end;
  padding: 0 10px 8px 12px;
  min-height: 16px;
  overflow: visible;
}

.list-message-bubble-meta .list-message-bubble-time {
  display: inline;
  padding: 0;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 14px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.list-message-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 15px;
  height: 15px;
  overflow: visible;
}

.list-message-status-icon {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  display: block;
  width: 15px;
  height: 15px;
  font-size: 15px;
  line-height: 15px;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.list-message-status-icon[hidden] {
  display: none;
}

.list-message-status-icon--delivered {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.list-message-recieve .list-message-bubble-time {
  color: var(--md-sys-color-on-surface-variant);
}

.list-message-sent .list-message-bubble-time {
  color: rgba(255, 255, 255, 0.82);
}

.list-message-sent .list-message-status-icon {
  color: rgba(255, 255, 255, 0.82);
}

.list-message-date-box {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.list-message-date {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-1);
}

.list-message-date > p {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--md-sys-color-on-surface-variant);
}

/* ── Composer ── */

.chat-message-section {
  min-height: var(--composer-height);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  padding: 10px 16px 12px;
  background: var(--md-sys-color-surface);
  box-shadow: 0 -1px 3px rgba(35, 39, 47, 0.06);
  z-index: 10;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-message-section.has-reply-bar {
  gap: 8px;
}

.message-reply-bar-slot {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 1, 1);
}

.message-reply-bar-slot.is-expanded {
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-reply-bar-slot__inner {
  overflow: hidden;
  min-height: 0;
}

.message-reply-bar {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 8px;
  padding-left: 50px;
  border-radius: 16px;
  background: var(--md-sys-color-surface-container-high);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.24s ease-in,
    transform 0.3s cubic-bezier(0.4, 0, 1, 1);
}

.message-reply-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.24s ease-out,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-reply-bar[hidden] {
  display: none !important;
}

.message-reply-bar__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  margin: 0;
  border-radius: 0;
  background: rgb(54, 141, 240);
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-reply-bar__content {
  flex: 1;
  min-width: 0;
  align-self: center;
}

.message-reply-bar__label {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface-variant);
}

.message-reply-bar__name {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

.message-reply-bar__icon {
  font-family: "Material Symbols Rounded";
  font-size: 12px;
  line-height: 1;
  color: #ffffff;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.message-reply-bar__preview {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-bar__cancel {
  flex-shrink: 0;
  align-self: center;
}

.message-composer {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 4px 6px 4px 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 28px;
  background: var(--md-sys-color-surface-container);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.message-composer:has(.message-input:focus),
.message-composer:has(.message-input:focus-visible) {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface);
}

.message-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
  padding: 0;
  margin: 0;
  max-height: 120px;
  overflow-y: auto;
  field-sizing: content;
}

.message-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
}

/* ── Material Dialogs ── */

md-dialog.app-dialog {
  z-index: 1200;
  --md-dialog-container-color: var(--md-sys-color-surface);
  --md-dialog-container-shape: 28px;
  --md-dialog-headline-color: var(--md-sys-color-on-surface);
  --md-dialog-headline-font: var(--font-heading);
  --md-dialog-headline-size: 1.5rem;
  --md-dialog-headline-line-height: 2rem;
  --md-dialog-headline-weight: 400;
  --md-dialog-supporting-text-color: var(--md-sys-color-on-surface-variant);
  --md-dialog-supporting-text-font: var(--font-family);
  --md-dialog-supporting-text-size: 0.875rem;
  --md-dialog-supporting-text-line-height: 1.25rem;
  --md-dialog-supporting-text-weight: 400;
  width: min(520px, calc(100vw - 32px)) !important;
  max-width: min(560px, calc(100vw - 32px)) !important;
  min-width: min(420px, calc(100vw - 32px)) !important;
}

md-dialog.settings-dialog,
md-dialog.profile-dialog,
md-dialog.delete-room-dialog,
md-dialog.delete-message-dialog,
md-dialog.forward-message-dialog,
md-dialog.reaction-details-dialog,
md-dialog#name-dialog {
  width: min(520px, calc(100vw - 32px)) !important;
  max-width: min(560px, calc(100vw - 32px)) !important;
  min-width: min(420px, calc(100vw - 32px)) !important;
}

md-dialog.create-room-dialog,
md-dialog.join-room-dialog {
  width: min(560px, calc(100vw - 32px)) !important;
  max-width: min(560px, calc(100vw - 32px)) !important;
  min-width: min(440px, calc(100vw - 32px)) !important;
}

md-dialog.app-dialog [slot="headline"] {
  width: 100%;
  display: block;
  text-align: left;
  font-size: var(--md-dialog-headline-size);
  font-weight: var(--md-dialog-headline-weight);
  line-height: var(--md-dialog-headline-line-height);
  color: var(--md-dialog-headline-color);
  cursor: default;
}

.dialog-header-logo {
  width: min(120px, 36vw);
  height: auto;
  display: block;
}

md-dialog.create-room-dialog .dialog-content,
md-dialog.join-room-dialog .dialog-content {
  gap: 24px;
}

md-dialog.create-room-dialog .dialog-header-logo,
md-dialog.join-room-dialog .dialog-header-logo {
  margin-bottom: 0;
}

md-dialog.create-room-dialog .dialog-subtitle {
  margin: 0;
  text-align: left;
}

md-dialog.create-room-dialog [slot="actions"],
md-dialog.join-room-dialog [slot="actions"] {
  padding-top: 0;
}

md-dialog.app-dialog [slot="content"] {
  width: 100%;
}

md-dialog.profile-dialog [slot="content"],
md-dialog.settings-dialog [slot="content"] {
  padding-top: 24px !important;
  padding-bottom: 24px !important;
  padding-left: 32px !important;
  padding-right: 32px !important;
  box-sizing: border-box;
}

md-dialog.app-dialog [slot="actions"] {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 8px;
}

.dialog-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}

.profile-dialog-content {
  align-items: center;
}

.profile-dialog-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-2);
}

.profile-dialog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-drag: none;
}

md-outlined-text-field.profile-username-input {
  width: 100%;
  --md-outlined-text-field-container-shape: 12px;
}

.settings-dialog-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.settings-dialog-title {
  flex: 1;
  min-width: 0;
}

md-dialog.settings-dialog .settings-dialog-close {
  flex-shrink: 0;
  margin-right: -8px;
}

.settings-dialog-content {
  gap: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 4px 0;
}

.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.settings-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.settings-row-hint {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.settings-notifications-switch {
  flex-shrink: 0;
}

.settings-install-section {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.settings-install-button {
  width: 100%;
  --md-filled-button-container-shape: 12px;
}

.dialog-subtitle {
  margin: 0;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface-variant);
}

.delete-room-dialog-content {
  gap: 16px;
}

.delete-room-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.delete-room-dialog-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.delete-room-dialog-name {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface);
  word-break: break-word;
}

.dialog-logo {
  width: min(220px, 70vw);
  height: auto;
  align-self: flex-start;
}

.name-dialog-headline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.name-dialog-logo {
  width: min(100px, 28vw);
  height: auto;
  display: block;
}

.name-dialog-label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface-variant);
}

.name-dialog-content {
  gap: 0;
}

.forward-message-dialog-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.forward-message-preview {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eceef1;
  border: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-room-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(320px, 45vh);
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.forward-room-item {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 14px 8px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.forward-room-item:hover:not(.forward-room-item--disabled) {
  background: var(--md-sys-color-surface-container-high);
}

.forward-room-item:active:not(.forward-room-item--disabled) {
  transform: scale(0.995);
}

.forward-room-item md-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  cursor: pointer;
  --md-ripple-hover-opacity: 0;
  --md-ripple-focus-opacity: 0;
  --md-ripple-pressed-color: var(--md-sys-color-on-surface);
  --md-ripple-pressed-opacity: 0.1;
}

.forward-room-item md-checkbox {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-left: 2px;
  pointer-events: none;
  cursor: pointer;
}

.forward-room-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  cursor: pointer;
}

.forward-room-item .forward-room-avatar {
  position: relative;
  z-index: 1;
  pointer-events: none;
  cursor: pointer;
}

.forward-room-name {
  min-width: 0;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-room-participants {
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-room-item--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.forward-room-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-1);
}

.forward-room-empty {
  margin: 8px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  text-align: center;
}

/* ── Snackbar ── */

.crackify-snackbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: var(--md-sys-elevation-3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-main .crackify-snackbar {
  position: absolute;
  bottom: var(--chat-snackbar-bottom);
  left: 16px;
  z-index: 12;
}

main > .crackify-snackbar {
  position: fixed;
  bottom: 28px;
  left: 24px;
  z-index: 1300;
  max-width: min(360px, calc(100vw - 48px));
}

.crackify-snackbar.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.crackify-snackbar__icon {
  display: none !important;
  font-size: 20px;
  flex-shrink: 0;
  color: #34a853;
  font-variation-settings: "FILL" 1, "wght" 600;
}

.crackify-snackbar__icon[hidden] {
  display: none !important;
}

.crackify-snackbar.is-success .crackify-snackbar__icon:not([hidden]) {
  display: block !important;
}

.crackify-snackbar__text {
  min-width: 0;
}

/* ── Tooltips ── */

.tippy-box[data-theme~="chatroom-link"] {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-2);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-surface);
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  :root {
    --nav-width: 360px;
  }

  .main-chat-canvas {
    width: calc(100% - 16px);
    height: calc(100% - 12px);
    border-radius: var(--radius-md);
  }

  .room-info-panel {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 768px) {
  :root {
    --composer-height: 62px;
    --chat-bubble-radius: 14px;
    --chat-bubble-radius-tight: 5px;
  }

  body {
    overflow: hidden;
  }

  .main-chat-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    display: block;
    overflow: hidden;
  }

  .nav-backdrop {
    display: none !important;
  }

  .nav-area {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    height: 100%;
    box-shadow: none;
    transform: none !important;
  }

  .nav-close-btn,
  .mobile-menu-btn,
  .welcome-menu-btn {
    display: none !important;
  }

  .vertical-divider1 {
    display: none;
  }

  .screen-section {
    position: fixed;
    inset: 0;
    z-index: 110;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform var(--transition-medium);
    pointer-events: none;
    background: var(--md-sys-color-surface);
    box-shadow: -4px 0 24px rgba(35, 39, 47, 0.12);
  }

  body.mobile-chat-open .screen-section {
    transform: translateX(0);
    pointer-events: auto;
  }

  body.mobile-chat-open {
    overflow-x: hidden;
  }

  .welcome-screen {
    display: none !important;
  }

  .mobile-back-btn {
    display: inline-flex;
  }

  .chatroom-more-btn {
    display: inline-flex;
  }

  .chatroom-avatar {
    margin-left: 0;
  }

  .chatroom-copy-link,
  .chatroom-share-link,
  .chatroom-close-btn {
    display: none !important;
  }

  .list-message-recieve-row,
  .list-message-sent-row {
    max-width: 100%;
    width: 100%;
  }

  .list-message-recieve-box {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0 16px;
    box-sizing: border-box;
    -webkit-touch-callout: none;
  }

  .list-message-sent-box {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0 16px;
    box-sizing: border-box;
    -webkit-touch-callout: none;
  }

  .list-message-recieve,
  .list-message-sent {
    max-width: 100%;
  }

  .list-message-recieve > p,
  .list-message-sent > p {
    margin: 8px 12px 3px;
    font-size: 12px;
    line-height: 1.4;
  }

  .list-message-recieve-name,
  .list-message-sent-name {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .list-message-recieve-avatar,
  .list-message-recieve-avatar-spacer {
    width: 28px;
    height: 28px;
  }

  .list-message-recieve-row,
  .list-message-sent-row {
    gap: 6px;
  }

  .list-message-recieve-box,
  .list-message-sent-box {
    margin-top: 6px;
  }

  .list-message-recieve-box {
    padding: 0 12px;
  }

  .list-message-sent-box {
    padding: 0 12px;
  }

  .list-message-sent-row {
    margin-right: 0;
  }

  .list-message-reply {
    margin: 6px 10px 0;
    padding: 5px 7px;
    gap: 6px;
    border-radius: 8px;
  }

  .list-message-reply__name {
    font-size: 10px;
  }

  .list-message-reply__text {
    font-size: 11px;
  }

  .list-message-bubble-time,
  .list-message-bubble-foot {
    padding: 0 10px 6px;
    font-size: 9px;
  }

  .list-message-bubble-foot {
    gap: 2px;
  }

  .list-message-status {
    font-size: 9px;
  }

  .list-message-status-icon {
    width: 14px;
    height: 14px;
  }

  .list-message-reaction-chip {
    min-height: 18px;
    padding: 1px 5px;
    font-size: 10px;
  }

  .list-message-reaction-chip__emoji {
    font-size: 11px;
  }

  .list-message-reaction-chip__count,
  .list-message-reaction-chip__overflow {
    font-size: 9px;
  }

  .list-message-reactions {
    gap: 3px;
    margin-inline-start: 6px;
  }

  .list-message-reactions--sent {
    margin-inline-end: 6px;
  }

  .list-message-react-btn {
    width: 24px;
    height: 24px;
  }

  .list-message-react-btn svg {
    width: 16px;
    height: 16px;
  }

  .list-message-bubble-wrap {
    gap: 4px;
  }

  .blank-message-bottom {
    height: 12px;
  }

  .list-message-date > p {
    font-size: 10px;
  }

  .chat-pinned-messages {
    max-height: 128px;
  }

  .chat-pinned-message-item {
    min-height: 48px;
    padding: 10px 12px;
    gap: 10px;
  }

  .chat-pinned-message-item__label {
    font-size: 0.6875rem;
  }

  .chat-pinned-message-item__text {
    font-size: 0.8125rem;
  }

  .chat-message-section {
    padding: 8px 12px 10px;
  }

  .message-composer {
    min-height: 46px;
    padding: 3px 4px;
    border-radius: 24px;
    gap: 2px;
  }

  .message-input {
    font-size: 0.875rem;
    line-height: 1.45;
    max-height: 100px;
  }

  md-icon-button.message-attach-button,
  md-icon-button.message-emoji-button {
    --md-icon-button-state-layer-width: 40px;
    --md-icon-button-state-layer-height: 40px;
    --md-icon-button-icon-size: 22px;
  }

  md-icon-button.message-emoji-button {
    margin-inline-start: -8px;
  }

  md-icon-button.message-attach-button .material-symbols-outlined,
  md-icon-button.message-emoji-button .material-symbols-outlined {
    font-size: 22px;
  }

  md-icon-button.message-send-button {
    --md-icon-button-state-layer-width: 46px;
    --md-icon-button-state-layer-height: 46px;
    --md-icon-button-icon-size: 24px;
  }

  md-icon-button.message-send-button .material-symbols-outlined {
    font-size: 24px;
  }

  .message-reply-bar {
    padding: 6px;
    padding-left: 44px;
    border-radius: 14px;
  }

  .message-reply-bar__accent {
    width: 36px;
  }

  .message-reply-bar__label {
    font-size: 0.6875rem;
  }

  .message-reply-bar__preview {
    font-size: 0.75rem;
  }

  .crackify-snackbar {
    gap: 8px;
    max-width: min(300px, calc(100% - 24px));
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 10px;
  }

  .chat-main .crackify-snackbar {
    left: 12px;
  }

  .chat-main {
    --chat-snackbar-bottom: calc(var(--composer-height) + 12px);
  }

  main > .crackify-snackbar {
    bottom: 20px;
    left: 16px;
    max-width: min(300px, calc(100vw - 32px));
  }

  .crackify-snackbar__icon {
    font-size: 16px;
  }

  .message-reaction-emoji-panel {
    width: min(360px, calc(100vw - 16px));
    height: min(380px, calc(100dvh - 24px));
  }

  .message-reaction-emoji-panel__body {
    order: 1;
    flex: 1;
    min-height: 0;
    padding: 12px 12px 0;
  }

  .message-reaction-emoji-panel__search {
    order: 2;
    flex-shrink: 0;
    margin: 8px 12px;
  }

  .message-reaction-emoji-panel__tabs {
    order: 3;
    flex-shrink: 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
  }

  .chat-screen.info-open .room-info-panel {
    position: fixed;
    inset: 0;
    z-index: 220;
    width: 100%;
    min-width: 0;
    border-left: none;
    background: var(--md-sys-color-surface);
    animation: panelSlideUp 0.32s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .chat-screen.info-open .room-info-panel.is-closing {
    animation: panelSlideDown 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes panelSlideUp {
    from {
      opacity: 0.94;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes panelSlideDown {
    from {
      opacity: 1;
      transform: translateY(0);
    }
    to {
      opacity: 0.94;
      transform: translateY(100%);
    }
  }

  .welcome-logo {
    width: min(200px, 55vw);
  }

  .welcome-secure {
    margin-top: 28px;
  }

  .nav-join-section,
  .create-room-enter {
    display: none !important;
  }

  .nav-actions-section {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
  }

  .nav-actions-section md-filled-button.join-room,
  .nav-actions-section md-outlined-button.create-room {
    --md-filled-button-container-height: 36px;
    --md-outlined-button-container-height: 36px;
    --md-filled-button-label-text-size: 0.8125rem;
    --md-outlined-button-label-text-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  :root {
    --composer-height: 58px;
    --chat-bubble-radius: 12px;
    --chat-bubble-radius-tight: 4px;
  }

  .nav-actions-section {
    padding: 8px 10px;
    gap: 6px;
  }

  .nav-actions-section md-filled-button.join-room,
  .nav-actions-section md-outlined-button.create-room {
    --md-filled-button-container-height: 34px;
    --md-outlined-button-container-height: 34px;
  }

  .chat-header {
    padding: 0 8px 0 4px;
    gap: 4px;
  }

  .chatroom-id {
    font-size: 13px;
  }

  .chatroom-powered-by {
    font-size: 11px;
  }

  .chat-message-section {
    padding: 6px 8px 8px;
  }

  .list-message-recieve-box,
  .list-message-sent-box {
    padding: 0 10px;
    margin-top: 5px;
  }

  .list-message-recieve > p,
  .list-message-sent > p {
    margin: 7px 10px 3px;
    font-size: 11.5px;
    line-height: 1.38;
  }

  .list-message-recieve-avatar,
  .list-message-recieve-avatar-spacer {
    width: 26px;
    height: 26px;
  }

  .list-message-recieve-row,
  .list-message-sent-row {
    gap: 5px;
  }

  .message-composer {
    min-height: 42px;
    border-radius: 22px;
  }

  .message-input {
    font-size: 0.8125rem;
    max-height: 88px;
  }

  md-icon-button.message-attach-button,
  md-icon-button.message-emoji-button {
    --md-icon-button-state-layer-width: 36px;
    --md-icon-button-state-layer-height: 36px;
    --md-icon-button-icon-size: 20px;
  }

  md-icon-button.message-emoji-button {
    margin-inline-start: -6px;
  }

  md-icon-button.message-attach-button .material-symbols-outlined,
  md-icon-button.message-emoji-button .material-symbols-outlined {
    font-size: 20px;
  }

  md-icon-button.message-send-button {
    --md-icon-button-state-layer-width: 42px;
    --md-icon-button-state-layer-height: 42px;
    --md-icon-button-icon-size: 22px;
  }

  md-icon-button.message-send-button .material-symbols-outlined {
    font-size: 22px;
  }

  .message-reply-bar {
    padding: 5px;
    padding-left: 40px;
    border-radius: 12px;
  }

  .message-reply-bar__accent {
    width: 32px;
  }

  .message-reply-bar__preview {
    font-size: 0.6875rem;
  }

  md-dialog.app-dialog,
  md-dialog.create-room-dialog,
  md-dialog.join-room-dialog {
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .crackify-snackbar {
    gap: 6px;
    max-width: min(280px, calc(100% - 20px));
    padding: 7px 12px;
    font-size: 11px;
    border-radius: 8px;
  }

  .chat-main .crackify-snackbar {
    left: 10px;
  }

  .chat-main {
    --chat-snackbar-bottom: calc(var(--composer-height) + 10px);
  }

  main > .crackify-snackbar {
    bottom: 16px;
    left: 12px;
    max-width: min(280px, calc(100vw - 24px));
  }

  .crackify-snackbar__icon {
    font-size: 15px;
  }
}

