html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

:root {
  --bg-main: #f5f7fc;
  --text-main: #1e2a44;
  --muted: #6e7b98;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --border: #e8ecf5;
  --message-bg: #ffffff;
  --message-border: rgba(55, 100, 240, 0.12);
  --message-shadow: rgba(41, 67, 133, 0.12);
}

html[data-theme="dark"] {
  --bg-main: #101522;
  --text-main: #e7eeff;
  --muted: #a3b2d4;
  --surface: #171f31;
  --surface-soft: #1b2439;
  --border: #263250;
  --message-bg: #1e2740;
  --message-border: rgba(113, 144, 255, 0.3);
  --message-shadow: rgba(0, 0, 0, 0.24);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  margin-bottom: 60px;
  background: var(--bg-main);
  color: var(--text-main);
}

.app-main-fluid {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
}

.footer {
  background-color: var(--surface) !important;
}

.nav-link,
.navbar-brand {
  color: var(--text-main) !important;
}

.app-navbar {
  margin-bottom: 0.8rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent) !important;
  box-shadow: 0 8px 24px rgba(24, 39, 83, 0.12);
  backdrop-filter: blur(10px);
}

.app-nav-shell {
  gap: 0.8rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding-right: 0.45rem;
}

.brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #f5f8ff;
  background: linear-gradient(140deg, #4d7aff, #735bff);
  box-shadow: 0 10px 20px rgba(74, 112, 255, 0.38);
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-nav-links {
  gap: 0.45rem;
}

.app-nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.42rem 0.9rem !important;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.app-nav-link:hover {
  border-color: rgba(98, 129, 255, 0.35);
  background: color-mix(in srgb, var(--surface-soft) 78%, #5f86ff 22%);
  transform: translateY(-1px);
}

.app-nav-link.active {
  border-color: rgba(78, 120, 255, 0.62);
  background: rgba(78, 120, 255, 0.17);
}

.nav-user {
  color: var(--text-main);
  font-size: 0.86rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.35rem 0.7rem;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-link {
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.nav-user-link:hover {
  color: var(--text-main);
  border-color: rgba(98, 129, 255, 0.45);
  transform: translateY(-1px);
}

.app-pill-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-main);
  padding-inline: 0.78rem;
  transition: transform 0.18s ease, filter 0.18s ease, border-color 0.2s ease;
}

.app-pill-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  border-color: rgba(98, 129, 255, 0.35);
}

.app-pill-btn-danger {
  border-color: rgba(216, 66, 66, 0.38);
}

.steam-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 139, 210, 0.3);
  background: linear-gradient(135deg, #1f4f8d, #2541a8);
  color: #f5f8ff;
  padding: 0.38rem 0.8rem;
  text-decoration: none;
  font-weight: 600;
}

.steam-login-btn:hover {
  color: #fff;
  filter: brightness(1.08);
}

.steam-login-btn-lg {
  padding: 0.72rem 1.1rem;
  font-size: 1rem;
  gap: 0.6rem;
  box-shadow: 0 10px 20px rgba(22, 64, 135, 0.28);
}

.steam-login-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 18px;
}

.steam-login-btn-lg .steam-login-icon {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}

.steam-login-btn-lg:hover {
  transform: translateY(-1px);
}

.landing-page {
  min-height: calc(100vh - 185px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0 2rem;
}

.landing-card {
  width: min(760px, 100%);
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(35, 48, 84, 0.12);
}

.landing-card h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
  color: var(--text-main);
}

.landing-subtitle {
  margin: 0.8rem 0 1.25rem;
  max-width: 42ch;
  color: var(--muted);
  line-height: 1.55;
}

.landing-error {
  margin: 0 0 1rem;
  color: #c73b3b;
}

.landing-error-hint {
  margin: -0.55rem 0 1rem;
  color: #d88a8a;
  font-size: 0.88rem;
  max-width: 54ch;
}

.landing-error-meta {
  margin: -0.78rem 0 1rem;
  color: #8fa0c8;
  font-size: 0.78rem;
}

.landing-actions {
  margin-bottom: 0;
}

.chat-page {
  height: calc(100dvh - 108px);
  min-height: 560px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0.25rem 0 1rem;
}

.chat-shell {
  width: min(1400px, 100%);
  height: 100%;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-soft) 0%, var(--surface) 40%);
  box-shadow: 0 18px 45px rgba(63, 79, 126, 0.18);
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0.9rem;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.chat-sidebar-head-spaced {
  margin-top: 0.85rem;
}

.chat-sidebar-head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.chat-online-count {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 0.15rem 0.48rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-dialog-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 36vh;
  overflow-y: auto;
}

.chat-dialog-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: inherit;
  text-decoration: none;
  padding: 0.48rem 0.58rem;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 0.52rem;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-dialog-item:hover {
  color: inherit;
  border-color: rgba(98, 129, 255, 0.55);
  transform: translateY(-1px);
}

.chat-dialog-item.active {
  border-color: rgba(78, 120, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(78, 120, 255, 0.16);
}

.chat-dialog-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.chat-dialog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-dialog-body {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.chat-dialog-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.chat-dialog-title-line strong {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-dialog-title-line time {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.chat-dialog-preview {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-online-users {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-items: stretch;
}

.online-user {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.5rem 0.58rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  min-height: 0;
}

.online-user strong {
  font-size: 0.9rem;
  line-height: 1.2;
  font-weight: 700;
  margin: 0;
}

.online-user-name-line {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.online-user-game {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-user-self {
  border-color: rgba(78, 120, 255, 0.7);
}

.online-user-muted {
  margin-left: 0;
  color: #c73b3b;
  font-style: normal;
  font-size: 0.72rem;
  border: 1px solid rgba(199, 59, 59, 0.35);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.online-user-chat-link {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  text-decoration: none;
  color: var(--text-main);
  background: var(--surface);
}

.online-user-chat-link:hover {
  color: var(--text-main);
  border-color: rgba(78, 120, 255, 0.55);
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  position: relative;
  min-height: 0;
}

.chat-top {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, var(--surface-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}

.chat-header {
  padding: 1rem 1.4rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  position: relative;
}

.chat-header::after {
  content: "";
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(98, 129, 255, 0.45), transparent);
}

.chat-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-main);
  letter-spacing: 0.01em;
  animation: header-fade 360ms ease;
}

.chat-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  animation: header-fade 420ms ease;
}

@keyframes header-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.selection-bar {
  margin: 0 1.4rem 0.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selection-actions {
  display: inline-flex;
  gap: 0.4rem;
}

.typing-indicator {
  margin: 0 1.4rem 0.6rem;
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
}

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 0.8rem 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  opacity: 1;
  transition: opacity 120ms ease;
  background:
    radial-gradient(circle at top right, rgba(77, 117, 255, 0.08), transparent 30%),
    radial-gradient(circle at bottom left, rgba(135, 196, 255, 0.16), transparent 35%);
}

.chat-messages-initializing {
  opacity: 0;
}

.message-card {
  width: fit-content;
  max-width: min(76ch, 100%);
  padding: 0.6rem 0.8rem 1.15rem;
  border-radius: 14px;
  background-color: var(--message-bg);
  border: 1px solid var(--message-border);
  box-shadow: 0 5px 14px var(--message-shadow);
  position: relative;
  transform-origin: bottom right;
}

.message-own {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(78, 120, 255, 0.12), var(--message-bg));
}

.message-selected {
  border-color: rgba(80, 134, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(80, 134, 255, 0.26), 0 5px 14px var(--message-shadow);
  background: linear-gradient(180deg, rgba(93, 142, 255, 0.18), var(--message-bg));
}

.message-jump-highlight {
  animation: jump-highlight 1.4s ease;
}

.message-removed {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 220ms ease, transform 220ms ease;
}

.message-head {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  column-gap: 0.55rem;
  color: var(--text-main);
}

.message-head strong {
  font-size: 0.93rem;
  min-width: 0;
}

.message-body {
  margin: 0.25rem 0 0;
  color: var(--text-main);
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-reply {
  appearance: none;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  margin: 0.35rem 0 0.15rem;
  padding: 0.35rem 0.5rem;
  border-left: 3px solid rgba(78, 120, 255, 0.7);
  background: rgba(78, 120, 255, 0.08);
  color: var(--muted);
  border-radius: 8px;
  font-size: 0.82rem;
}

.message-reply:hover {
  background: rgba(78, 120, 255, 0.16);
}

.message-meta {
  position: absolute;
  right: 0.55rem;
  bottom: 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  user-select: none;
  opacity: 0.95;
}

.message-meta time {
  font-size: 0.72rem;
}

.message-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  line-height: 1;
}

.status-icon {
  font-weight: 700;
  letter-spacing: -0.06em;
}

.status-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(110, 123, 152, 0.35);
  border-top-color: rgba(110, 123, 152, 0.95);
  animation: spin-status 460ms linear infinite;
}

.message-status-sending {
  color: #7b8bab;
}

.message-status-sent {
  color: #6f7f9f;
}

.message-status-delivered {
  color: #3c6fd9;
}

.message-status-read {
  color: #1ca65f;
}

.message-status-failed {
  color: #cc4b4b;
}

.message-pending {
  opacity: 0.92;
  filter: saturate(0.94);
}

.message-failed {
  border-color: rgba(204, 75, 75, 0.6);
}

.message-confirmed {
  animation: message-ack 180ms ease;
}

.message-attachments {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.45rem;
  max-width: min(560px, 100%);
}

.message-attachment {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: block;
  background: color-mix(in srgb, var(--surface-soft) 84%, #4f78ff 16%);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.message-attachment:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 53, 105, 0.2);
}

.message-attachment img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.message-link-preview {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: 116px 1fr;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: color-mix(in srgb, var(--surface-soft) 88%, #4f78ff 12%);
  max-width: min(560px, 100%);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.message-link-preview:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 126, 255, 0.45);
  box-shadow: 0 10px 20px rgba(32, 50, 102, 0.18);
}

.message-link-image {
  width: 100%;
  height: 100%;
  min-height: 86px;
  object-fit: cover;
  background: var(--surface-soft);
}

.message-link-content {
  padding: 0.52rem 0.62rem;
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.message-link-content strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.message-link-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.28;
}

.message-link-content span {
  color: var(--muted);
  font-size: 0.74rem;
}

.message-enter {
  animation: message-rise 300ms cubic-bezier(.21, .8, .35, 1) both;
}

.message-own.message-enter {
  animation: message-rise-own 220ms cubic-bezier(.22, .74, .26, 1) both;
}

@keyframes message-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes message-rise-own {
  from {
    opacity: 0;
    transform: translateY(8px) translateX(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes message-ack {
  from {
    filter: saturate(1.3);
    transform: translateY(1px) scale(0.995);
  }
  to {
    filter: saturate(1);
    transform: translateY(0) scale(1);
  }
}

@keyframes spin-status {
  to {
    transform: rotate(360deg);
  }
}

@keyframes jump-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(80, 134, 255, 0.6);
  }
  40% {
    box-shadow: 0 0 0 4px rgba(80, 134, 255, 0.42);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(80, 134, 255, 0);
  }
}

.chat-form {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.4rem 1.25rem;
  display: grid;
  gap: 0.85rem;
  position: relative;
}

.upload-dropzone {
  border: 1px dashed rgba(102, 133, 255, 0.55);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: color-mix(in srgb, var(--surface-soft) 74%, #5e81ff 26%);
  color: var(--text-main);
  display: grid;
  gap: 0.2rem;
  animation: upload-zone-show 180ms ease;
}

.upload-dropzone strong {
  font-size: 0.92rem;
}

.upload-dropzone span {
  color: var(--muted);
  font-size: 0.78rem;
}

@keyframes upload-zone-show {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.upload-queue {
  display: grid;
  gap: 0.5rem;
  max-height: 210px;
  overflow-y: auto;
}

.upload-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 0.38rem 0.45rem;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 0.55rem;
}

.upload-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.upload-content {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}

.upload-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.upload-line strong {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-line span {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.upload-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(110, 123, 152, 0.18);
  overflow: hidden;
}

.upload-progress span {
  display: block;
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4e78ff, #6d5dff);
  transition: width 120ms linear;
}

.upload-error {
  margin: 0;
  color: #c73b3b;
  font-size: 0.73rem;
}

.upload-remove {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-main);
  font-size: 1.05rem;
  line-height: 1;
}

.upload-remove:hover {
  border-color: rgba(194, 78, 78, 0.45);
  color: #d24f4f;
}

.reply-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.reply-preview strong {
  font-size: 0.84rem;
}

.reply-preview p {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.chat-row {
  display: grid;
  gap: 0.35rem;
}

.chat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.chat-input {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0.63rem 0.75rem;
  width: 100%;
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input:focus {
  border-color: #4e78ff;
  box-shadow: 0 0 0 3px rgba(78, 120, 255, 0.15);
}

.chat-compose {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
}

.chat-attach {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text-main);
  width: 42px;
  min-height: 42px;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 600;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.chat-attach:hover {
  transform: translateY(-1px);
  border-color: rgba(78, 120, 255, 0.5);
}

.chat-attach:disabled {
  opacity: 0.6;
  transform: none;
}

.chat-send {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #4e78ff, #6b5dff);
  color: #fff;
  font-weight: 600;
  padding: 0 1.2rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.chat-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.chat-send:disabled {
  opacity: 0.65;
  transform: none;
  cursor: not-allowed;
}

.chat-notice {
  margin: 0.4rem 0 0;
  font-size: 0.86rem;
  color: #c73b3b;
}

.scroll-bottom-btn {
  position: absolute;
  right: 1.25rem;
  bottom: 5.5rem;
  z-index: 4;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  font-size: 1.1rem;
  line-height: 1;
}

.scroll-bottom-btn:hover {
  transform: translateY(-1px);
}

.message-context-menu {
  position: fixed;
  z-index: 1050;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.22);
  padding: 0.3rem;
  display: grid;
  gap: 0.15rem;
}

.message-context-menu button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  padding: 0.38rem 0.5rem;
  color: var(--text-main);
  font-size: 0.88rem;
}

.message-context-menu button:hover:enabled {
  background: var(--surface-soft);
}

.message-context-menu button:disabled {
  opacity: 0.45;
}

.message-context-menu button.danger {
  color: #d14545;
}

.message-avatar,
.online-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 0.72rem;
  color: var(--muted);
}

.online-avatar {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: visible;
}

.online-avatar img {
  border-radius: 50%;
}

.online-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #21c55d;
  border: 2px solid var(--surface-soft);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.message-avatar img,
.online-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  font-weight: 700;
}

.admin-page {
  display: grid;
  gap: 1rem;
}

.admin-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.admin-block h1,
.admin-block h2 {
  margin: 0 0 0.6rem;
}

.admin-muted {
  color: var(--muted);
  margin: 0;
}

.admin-table {
  margin-bottom: 0;
  color: var(--text-main);
}

.admin-cell-wrap {
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-error-details {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.7rem;
  max-height: 52vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.admin-inline-form {
  display: inline;
}

.admin-notice {
  margin: 0.5rem 0 0;
  color: #26732f;
  font-weight: 600;
}

.admin-mute-list {
  display: grid;
  gap: 0.45rem;
}

.admin-mute-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: var(--surface-soft);
}

.profile-avatar-link {
  text-decoration: none;
  color: inherit;
}

.profile-avatar-link:hover {
  filter: brightness(1.04);
}

.profile-page {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  padding-bottom: 1rem;
}

.profile-card {
  --profile-accent: #4e78ff;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(35, 48, 84, 0.12);
}

.profile-owner-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem 0;
}

.profile-edit-toggle-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.profile-edit-toggle-btn:hover {
  color: var(--text-main);
  border-color: rgba(98, 129, 255, 0.45);
  transform: translateY(-1px);
}

.profile-hero {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--profile-accent) 26%, transparent), transparent 38%),
    linear-gradient(180deg, var(--surface-soft), var(--surface));
}

.profile-avatar-wrap {
  width: 88px;
  height: 88px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  border: 2px solid color-mix(in srgb, var(--profile-accent) 54%, var(--border));
  background: var(--surface-soft);
}

.profile-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.profile-main {
  min-width: 0;
}

.profile-main h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.profile-headline {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.profile-meta {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.profile-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0.2rem 0.58rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-bio-block {
  padding: 1rem 1.25rem 1.2rem;
}

.profile-bio-block h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.profile-bio-block p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.profile-favorite-game {
  margin-top: 0.65rem;
  color: var(--muted);
}

.profile-edit-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  padding: 1rem 1.1rem;
}

.profile-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.profile-edit-head h2 {
  margin: 0;
  font-size: 1rem;
}

.profile-edit-form {
  display: grid;
  gap: 0.72rem;
}

.profile-edit-form label {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.profile-save-btn {
  width: fit-content;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #4e78ff, #6b5dff);
  color: #fff;
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.profile-edit-actions {
  display: flex;
  justify-content: flex-start;
}

.profile-saved {
  color: #1ea55e;
  font-size: 0.82rem;
  font-weight: 600;
}

.profile-readonly-note {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
}

@media (max-width: 860px) {
  .landing-card {
    padding: 1.4rem;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    height: calc(100dvh - 96px);
    min-height: 500px;
  }

  .chat-page {
    height: auto;
    min-height: calc(100dvh - 92px);
  }

  .chat-sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 34vh;
  }

  .chat-messages {
    padding: 0.75rem 1rem 0.9rem;
  }

  .chat-header {
    padding: 0.85rem 1rem 0.65rem;
  }

  .selection-bar,
  .typing-indicator {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .chat-form {
    padding: 0.8rem 1rem 0.95rem;
  }

  .chat-compose {
    grid-template-columns: auto 1fr auto;
  }

  .chat-send {
    min-height: 42px;
    padding-inline: 1rem;
  }

  .message-link-preview {
    grid-template-columns: 1fr;
  }

  .message-link-image {
    max-height: 170px;
  }

  .profile-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .profile-avatar-wrap,
  .profile-avatar {
    width: 72px;
    height: 72px;
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }
}
