:root {
  --bg: #000000;
  --surface: #0d0d0d;
  --elevated: #141414;
  --sidebar: #0a0a0a;
  --border: #2a2a2a;
  --accent: #c4b5fd;
  --accent-hot: #a78bfa;
  --accent-soft: rgba(167, 139, 250, 0.14);
  --text: #e8eaef;
  --muted: #9aa0a6;
  --danger: #f87171;
  --success: #81c784;
  --warning: #fbbf24;
  --radius: 8px;
  --radius-lg: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Lobby (Discord login vibe) ── */

.room__section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(167, 139, 250, 0.18), transparent),
    var(--bg);
}

.lobby-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.lobby-logo,
.sidebar-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  color: #000;
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 11px;
}

.lobby-brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lobby-brand p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.account-bar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.account-bar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-bar-meta {
  min-width: 0;
}

.account-bar-meta strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

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

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.sidebar-account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-account-role {
  margin-left: auto;
  flex-shrink: 0;
}

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.3;
}

.role-badge--admin {
  background: color-mix(in srgb, #e74c3c 22%, transparent);
  color: #f08070;
  border: 1px solid color-mix(in srgb, #e74c3c 40%, transparent);
}

.role-badge--mod {
  background: color-mix(in srgb, #3498db 22%, transparent);
  color: #6eb5f0;
  border: 1px solid color-mix(in srgb, #3498db 40%, transparent);
}

.role-badge--member {
  display: none;
}

.lobby-secure-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.lobby-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-join {
  display: flex;
  gap: 8px;
}

/* ── Buttons & inputs ── */

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  padding: 12px 16px;
}

.btn-primary:hover {
  background: var(--accent-hot);
}

.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--elevated) 80%, var(--accent) 20%);
  border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 10px;
}

input[type="text"],
textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input[type="text"] {
  flex: 1;
  padding: 12px 14px;
}

textarea {
  width: 100%;
  padding: 11px 14px;
  resize: none;
  line-height: 1.45;
  max-height: 200px;
  background: transparent;
  border: none;
}

textarea:focus {
  box-shadow: none;
}

textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Name dialog ── */

.name-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--elevated);
  color: var(--text);
  max-width: min(400px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.name-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.name-dialog form {
  padding: 24px;
}

.name-dialog h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.name-dialog-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.name-dialog input {
  width: 100%;
  margin-bottom: 16px;
}

.name-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

[hidden] {
  display: none !important;
}

/* ── Chat layout (Discord shell) ── */

.chat__section {
  display: none;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  flex-direction: row;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.sidebar-nav-new {
  color: var(--accent);
  font-size: 13px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 10px 4px;
}

.dm-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dm-item {
  gap: 8px;
}

.dm-item-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.dm-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.dm-unread {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.online-dm-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.online-dm-item {
  gap: 8px;
  justify-content: flex-start;
}

.online-dm-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.online-dm-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.online-dm-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.online-dm-item:hover .online-dm-hint {
  opacity: 1;
}

.chat-status {
  font-size: 13px;
  color: var(--warning);
  padding: 8px 16px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 25%, var(--border));
}

.sidebar-channel {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.channel-hash {
  color: var(--muted);
  font-weight: 500;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-meta {
  padding: 0 10px;
  margin-bottom: auto;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge-secure {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}

.sidebar-members {
  margin-top: 12px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-members:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.sidebar-right {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.sidebar-right .members-head {
  padding: 16px 16px 0;
}

.sidebar-right .member-sidebar-list {
  padding: 0 10px 16px;
}

.members-head h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 8px 12px;
}

.member-sidebar-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-sidebar-group {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 8px 4px;
}

.member-sidebar-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius);
  padding: 2px 4px;
  position: relative;
}

.member-sidebar-item:hover {
  background: var(--accent-soft);
  z-index: 2;
}

.member-sidebar-admin {
  display: none;
  width: 100%;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px 6px 40px;
  box-sizing: border-box;
}

.member-sidebar-item:hover .member-sidebar-admin {
  display: flex;
}

.member-sidebar-admin .action-button {
  flex: 1 1 calc(33% - 4px);
  min-width: 52px;
  margin-left: 0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 10px;
  padding: 6px 6px;
  line-height: 1.2;
}

.staff-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.staff-controls .btn {
  white-space: nowrap;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

.chat-header-actions .shop-open-btn,
.chat-header-actions .casino-balance-pill,
.chat-header-actions .notify-bell-btn {
  flex-shrink: 0;
}

/* ── Notification bell ── */

.notify-bell-btn {
  position: relative;
  padding: 4px 8px;
}

.notify-bell-icon {
  font-size: 16px;
  line-height: 1;
}

.notify-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-hot);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notify-panel {
  position: fixed;
  top: 52px;
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 200;
  overflow: hidden;
}

.notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.notify-panel-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.notify-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.notify-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.notify-setting input {
  accent-color: var(--accent-hot);
}

.notify-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.notify-item-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.notify-item-btn:hover {
  background: var(--accent-soft);
}

.notify-item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
}

.notify-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.notify-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.notify-item-sub {
  font-size: 11px;
  color: var(--muted);
}

.notify-item-time {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.notify-item--ping .notify-item-title {
  color: var(--accent-hot);
}

.notify-empty {
  margin: 0;
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.group-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.group-item-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.group-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-add-btn {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.group-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: min(560px, 88vh);
  padding: 0;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.group-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.group-dialog-form {
  display: flex;
  flex-direction: column;
  max-height: min(560px, 88vh);
}

.group-dialog-form .gm-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.group-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.group-dialog-head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.group-dialog-head-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-hot);
  padding: 10px;
}

.group-dialog-head-text {
  min-width: 0;
  text-align: left;
}

.group-dialog-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.group-dialog-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.group-dialog-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--muted);
}

.group-dialog-close:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.group-dialog-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.group-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.group-dialog-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.group-dialog-field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.group-dialog-members-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-dialog-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}

.group-member-pick {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.group-member-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.group-member-option:last-child {
  border-bottom: none;
}

.group-member-option:hover {
  background: var(--accent-soft);
}

.group-member-option input {
  flex-shrink: 0;
  accent-color: var(--accent-hot);
}

.group-member-option-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.group-member-option-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.group-member-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.group-member-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.group-dialog-error {
  margin: 12px 0 0;
}

.group-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}

.group-dialog-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.group-dialog-label input {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.group-manage-btn {
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
}

.group-manage-dialog {
  width: min(380px, calc(100vw - 32px));
  max-height: min(520px, 85vh);
  padding: 0;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.group-manage-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.group-manage-form {
  display: flex;
  flex-direction: column;
  max-height: min(520px, 85vh);
}

.group-manage-form .gm-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.group-manage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.group-manage-head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.group-manage-head-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-hot);
  padding: 10px;
}

.group-manage-head-text {
  min-width: 0;
  text-align: left;
}

.group-manage-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-manage-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--muted);
}

.group-manage-close:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.group-manage-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.group-manage-section {
  padding: 14px 16px;
}

.group-manage-section + .group-manage-section {
  padding-top: 0;
}

.group-manage-rename {
  padding-bottom: 10px;
}

.group-manage-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.group-manage-members {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.group-manage-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.group-manage-member-avatar {
  flex-shrink: 0;
}

.group-manage-member-avatar.member-sidebar-avatar.avatar-frame-wrap {
  width: 36px;
  height: 36px;
}

.group-manage-member-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.group-manage-member-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.group-manage-member-title-row .shop-name-tag {
  margin-left: 0;
  flex-shrink: 1;
  max-width: 100%;
}

.group-manage-member-name {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-manage-owner-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hot);
}

.group-kick-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: #f87171;
}

.group-kick-btn:hover {
  background: color-mix(in srgb, #f87171 12%, transparent);
  color: #ef4444;
}

.group-manage-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 6px 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.group-manage-field-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.group-manage-field-row input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  box-shadow: none;
}

.group-manage-field-row input[type="text"]::placeholder {
  color: color-mix(in srgb, var(--muted) 85%, transparent);
}

.group-field-icon-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-width: 34px;
  margin: 0;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.group-field-icon-btn .gm-svg {
  color: #0a0a0a;
}

.group-field-save-btn {
  flex: 0 0 auto;
  height: 34px;
  margin: 0;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  line-height: 1;
}

.group-manage-error {
  margin: 0 16px 4px;
  text-align: left;
}

.group-manage-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.group-action-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.group-action-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.group-action-btn.btn-secondary .group-action-icon {
  color: var(--muted);
}

.group-action-btn.btn-danger .group-action-icon {
  color: rgba(255, 255, 255, 0.9);
}

.btn-danger {
  background: color-mix(in srgb, #ef4444 85%, #000);
  color: #fff;
  border: 1px solid color-mix(in srgb, #ef4444 60%, transparent);
}

.btn-danger:hover {
  background: #dc2626;
}

.member-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-align: left;
  font-family: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 6px 4px;
  cursor: pointer;
  color: inherit;
}

.member-sidebar-btn--self {
  cursor: default;
}

.member-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.member-sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-sidebar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.member-sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.member-sidebar-bio {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.message--bot {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: var(--radius);
  margin: 2px 0;
  padding-right: 8px;
}

.message--bot .msg-avatar,
.avatar--bot {
  border: none;
  box-shadow: none;
  background: color-mix(in srgb, #f1c40f 14%, var(--elevated));
}

.message--bot .msg-avatar .avatar-inner,
.avatar--bot .avatar-inner {
  background: transparent;
}

.message--bot .msg-avatar {
  font-size: 16px;
}

.message--bot h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f1c40f;
}

.bot-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, #5865f2 35%, transparent);
  color: #aeb8ff;
  border: 1px solid color-mix(in srgb, #5865f2 50%, transparent);
}

.msg-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-slash-cmd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.playing-card-emoji {
  display: inline-block;
  font-size: 1.65em;
  line-height: 1;
  vertical-align: middle;
  margin: 0 1px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.casino-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-right: 8px;
}

.casino-coin-icon,
.channel-casino-icon {
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.channel-casino-icon {
  vertical-align: middle;
}

.casino-channel-view {
  flex-shrink: 0;
  max-height: 42vh;
  overflow-y: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--sidebar) 80%, var(--surface));
}

.casino-channel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-dialog {
  display: none;
}

.right-panel-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.profile-panel {
  position: relative;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.profile-panel-close {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.profile-panel-close:hover {
  background: rgba(0, 0, 0, 0.75);
}

.profile-panel-banner {
  height: 96px;
  background: linear-gradient(135deg, #5865f2 0%, #3a4ab8 50%, #7289da 100%);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.profile-panel-banner--custom {
  background-color: var(--elevated);
}

.dm-retention-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 16px 12px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  flex-shrink: 0;
}

.dm-retention-notice-text {
  flex: 1;
}

.dm-retention-notice-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.dm-retention-notice-dismiss:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.profile-panel-avatar-wrap {
  padding: 0 16px;
  margin-top: -40px;
  position: relative;
  z-index: 1;
}

.profile-panel-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid var(--sidebar);
  background: var(--elevated);
  color: var(--accent);
  font-size: 28px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.profile-panel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-panel-body {
  padding: 12px 16px 20px;
}

.profile-panel-name {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.profile-panel-user {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.profile-panel-role {
  display: inline-block;
  margin-bottom: 12px;
}

.profile-panel-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.profile-panel-section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.profile-panel-bio {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.profile-panel-bio--empty {
  color: var(--muted);
  font-style: italic;
}

.profile-panel-dm {
  width: 100%;
  margin-top: 4px;
}

.profile-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.profile-panel-group-btn {
  width: 100%;
}

.profile-panel-self-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent-hot);
}

.header-avatar {
  cursor: pointer;
}

.header-avatar:hover {
  opacity: 0.9;
}

.member-sidebar-btn--self {
  cursor: pointer;
}

.member-sidebar-btn--self:hover {
  background: var(--accent-soft);
}

.group-pick-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.group-pick-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.group-pick-form {
  padding: 0;
}

.group-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.group-pick-head h2 {
  margin: 0;
  font-size: 16px;
}

.group-pick-sub {
  margin: 0;
  padding: 10px 16px 0;
  font-size: 12px;
  color: var(--muted);
}

.group-pick-list {
  list-style: none;
  margin: 0;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.group-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.group-pick-item:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.group-pick-item-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.group-pick-error {
  margin: 0 16px 12px;
}

.dm-pins-bar {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface));
}

.dm-pins-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-hot);
  margin-bottom: 8px;
}

.dm-pins-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dm-pin-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius);
  background: var(--elevated);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.dm-pin-item:hover {
  background: var(--accent-soft);
}

.dm-pin-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-hot);
}

.dm-pin-text {
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.msg-pin {
  position: absolute;
  top: 4px;
  right: 28px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.message:hover .msg-pin,
.msg-pin--active {
  opacity: 1;
}

.msg-pin:hover {
  background: var(--accent-soft);
}

.msg-pin--active {
  opacity: 1;
  filter: saturate(1.2);
}

.msg-game-share {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(100%, 360px);
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.msg-game-share:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--elevated));
}

.msg-game-share-cover {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}

.msg-game-share-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.msg-game-share-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-hot);
}

.msg-game-share-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-game-share-play {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.message--highlight {
  animation: msg-highlight 1.6s ease;
}

@keyframes msg-highlight {
  0%,
  100% {
    background: transparent;
  }
  20% {
    background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
  }
}

.profile-panel-dm {
  width: 100%;
  margin-top: 12px;
}

.member-sidebar-item--active {
  background: var(--accent-soft);
}

.member-sidebar-item--active .member-sidebar-btn {
  color: var(--text);
}

.sidebar-account {
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius);
}

.sidebar-account:hover {
  background: var(--accent-soft);
}

.member-sidebar-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-sidebar-user {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-channel-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-channel-btn .channel-speaker {
  font-size: 12px;
  opacity: 0.85;
}

.voice-channel-btn.connected {
  color: var(--success);
}

.voice-channel-users {
  list-style: none;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.voice-channel-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  width: 100%;
}

.voice-channel-user-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.voice-channel-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}

.voice-panel-head h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.voice-panel-head p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.voice-panel-users {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.voice-panel-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.voice-panel-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.voice-panel-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-panel-user-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.voice-panel-user-name {
  font-size: 15px;
  font-weight: 600;
}

.voice-panel-user-sub {
  font-size: 12px;
  color: var(--muted);
}

.voice-panel-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 20px 0;
}

.voice-panel-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
}

#textPanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.chat-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.chat-header-titles {
  min-width: 0;
}

.chat-header h2 {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-actions {
  display: flex;
  gap: 4px;
}

.admin-controls {
  display: none;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Messages (Discord flat style) ── */

.message__area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message {
  display: flex;
  gap: 16px;
  padding: 4px 16px 4px 72px;
  margin: 0 -16px;
  position: relative;
  border-radius: 4px;
  max-width: none;
}

.message:hover {
  background: color-mix(in srgb, var(--elevated) 65%, transparent);
}

.msg-avatar {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.msg-avatar:not(.avatar-frame-wrap) {
  border: 1px solid var(--border);
}

.message--bot .msg-avatar .avatar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  border: none;
}

.message.outgoing .msg-avatar {
  background: color-mix(in srgb, var(--accent) 22%, var(--elevated));
  color: var(--accent-hot);
}

.msg-body {
  min-width: 0;
  flex: 1;
  position: relative;
}

.message h4 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.375;
  margin-bottom: 2px;
  color: var(--accent);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.message h4 .shop-name-tag {
  margin-left: 0;
  text-transform: none;
}

.message.outgoing h4 {
  color: var(--accent-hot);
}

.message--system h4 {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.message--system p {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.message--system .msg-avatar {
  color: var(--muted);
  font-size: 18px;
  border: none;
  background: transparent;
}

.message--system .msg-avatar--system .avatar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.system-event-icon {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.message p {
  font-size: 15px;
  line-height: 1.375;
  color: color-mix(in srgb, var(--text) 92%, transparent);
  max-width: none;
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.message img,
.message video {
  margin-top: 6px;
  border-radius: var(--radius);
  max-width: min(400px, 100%);
  border: 1px solid var(--border);
}

.message audio {
  margin-top: 6px;
  width: min(320px, 100%);
}

.message.incoming video,
.message.outgoing video {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

/* ── Composer ── */

.channel-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.typing-indicator {
  font-size: 13px;
  color: var(--accent);
  padding: 4px 20px 8px;
  font-style: italic;
  min-height: 22px;
  flex-shrink: 0;
}

.typing-indicator:not([hidden]) {
  opacity: 1;
}

.casino-balance-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.coin-icon {
  font-size: 14px;
}

.casino-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--elevated);
  color: var(--text);
}

.casino-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.casino-dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.casino-dialog-head h2 {
  margin: 0;
  flex: 1;
}

.casino-balance-line {
  width: 100%;
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.casino-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.casino-tab {
  flex: 1;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.casino-tab.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

.casino-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}

.casino-panel input[type="number"] {
  width: 100px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--sidebar);
  color: var(--text);
}

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

.casino-result {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

.casino-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}

.casino-error {
  color: #f08070;
  font-size: 13px;
  margin-top: 12px;
}

.casino-close {
  margin-top: 16px;
  width: 100%;
}

.casino-table {
  font-size: 14px;
  line-height: 1.8;
}

.bj-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.casino-cards-inline {
  font-size: 18px;
  letter-spacing: 2px;
}

.casino-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 80px;
}

.casino-card {
  width: 52px;
  height: 72px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--sidebar);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.casino-card.held {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

.message .msg-body {
  position: relative;
}

.msg-delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.message:hover .msg-delete {
  opacity: 1;
}

.msg-delete:hover {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
}

.user-mod {
  color: var(--accent-hot);
}

.user-mod::after {
  content: " · mod";
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.action-button.mod {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.action-button.mod:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.composer {
  padding: 0 16px 24px;
}

.composer-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.composer-row .input-area {
  flex: 1;
  min-width: 0;
}

.composer-game-btn {
  flex-shrink: 0;
  width: 48px;
  min-height: 48px;
  height: auto;
  align-self: stretch;
  margin-bottom: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  color: var(--accent-hot);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.composer-game-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

.composer-game-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.composer-game-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-share-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: min(560px, 88vh);
  padding: 0;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.game-share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.game-share-form {
  display: flex;
  flex-direction: column;
  max-height: min(560px, 88vh);
}

.game-share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.game-share-head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.game-share-head-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-hot);
  padding: 10px;
}

.game-share-head-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.game-share-head-text {
  min-width: 0;
}

.game-share-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.game-share-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.game-share-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
}

.game-share-search-wrap {
  padding: 12px 16px 0;
}

.game-share-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.game-share-search:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.game-share-list-wrap {
  padding: 12px 16px 16px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.game-share-list {
  max-height: min(360px, 52vh);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-share-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.game-share-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.game-share-item-cover {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
}

.game-share-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-share-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.game-share-item-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-share-item-author {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-share-empty,
.game-share-more {
  margin: 0;
  padding: 16px 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.game-share-error {
  margin: 0 16px 16px;
}

.input-area {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2px 4px;
  transition: border-color 0.15s;
}

.input-area:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.composer.dragover .input-area {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ── Modal (member list) ── */

.modal {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--elevated);
  border: 1px solid var(--border);
  margin: 8vh auto;
  padding: 20px 20px 16px;
  border-radius: var(--radius-lg);
  width: min(360px, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content-wide {
  width: min(420px, 92vw);
}

.modal-content h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.member-list {
  list-style: none;
}

.member-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.member-list-item:hover {
  background: var(--accent-soft);
}

.member-list-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.member-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.member-list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-list-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.member-list-user {
  font-size: 12px;
  color: var(--muted);
}

.member-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.member-dialog {
  max-width: min(440px, 92vw);
  padding-bottom: 8px;
}

.member-dialog-head {
  padding: 24px 24px 0;
}

.member-dialog .name-dialog-actions {
  padding: 8px 24px 20px;
}

.member-picker-list {
  list-style: none;
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px 12px;
}

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.member-picker-item:hover {
  background: var(--accent-soft);
}

.member-picker-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.member-picker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-picker-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-picker-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.member-picker-user {
  font-size: 12px;
  color: var(--muted);
}

.member-picker-empty {
  padding: 16px 24px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--accent) 12%, var(--elevated));
  border-top: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
}

.voice-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.voice-bar-info span:first-child {
  font-size: 14px;
  font-weight: 600;
}

.voice-bar-state {
  font-size: 12px;
  color: var(--success);
}

.voice-bar--muted {
  background: color-mix(in srgb, var(--warning) 12%, var(--elevated));
  border-top-color: color-mix(in srgb, var(--warning) 30%, var(--border));
}

.voice-bar--muted .voice-bar-state {
  color: var(--warning);
}

.btn-muted-active {
  color: var(--warning) !important;
  background: color-mix(in srgb, var(--warning) 18%, transparent) !important;
}

.voice-mute-badge {
  margin-left: auto;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}

.voice-channel-user--muted,
.voice-panel-user--muted {
  opacity: 0.75;
}

.voice-channel-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.voice-bar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.voice-incoming {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.voice-incoming-card {
  width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.voice-incoming-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.voice-incoming-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-incoming-label {
  font-size: 12px;
  color: var(--muted);
}

.voice-incoming-name {
  font-size: 16px;
  font-weight: 700;
}

.voice-incoming-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.modal-content ul {
  list-style: none;
}

.modal-content ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: background 0.15s;
}

.modal-content ul li:hover {
  background: var(--accent-soft);
}

.user-name {
  color: var(--text);
}

.user-admin {
  color: var(--accent);
  font-weight: 600;
}

.user-admin::after {
  content: " · admin";
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* ── Action buttons ── */

.action-button {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-left: 4px;
}

.action-button.kick {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.action-button.kick:hover {
  background: color-mix(in srgb, var(--danger) 32%, transparent);
}

.action-button.block {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}

.action-button.block:hover {
  background: color-mix(in srgb, var(--warning) 28%, transparent);
}

.action-button.dm {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.action-button.dm:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.action-button.voice {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}

.action-button.voice:hover {
  background: color-mix(in srgb, var(--success) 28%, transparent);
}

.action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Scrollbar ── */

.message__area::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.member-sidebar-list::-webkit-scrollbar {
  width: 8px;
}

.message__area::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track,
.member-sidebar-list::-webkit-scrollbar-track {
  background: transparent;
}

.message__area::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.member-sidebar-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.message__area::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.member-sidebar-list::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 60%, var(--border));
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .sidebar-right {
    display: none;
  }

  .chat__section.profile-open .sidebar-right {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 92vw);
    z-index: 100;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
  }

  .chat__section.profile-open #memberPanelView {
    display: none;
  }

  .chat__section.profile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
  }
}

@media (max-width: 768px) {
  .chat__section {
    flex-direction: column;
  }

  .sidebar-left {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-head {
    border-bottom: none;
    margin-bottom: 0;
    padding: 0;
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-channel {
    margin: 0;
    flex: 1;
    min-width: 0;
  }

  .sidebar-meta {
    padding: 0;
    margin-bottom: 0;
  }

  .sidebar-members {
    margin-top: 0;
    width: auto;
    padding: 8px 10px;
  }

  .message {
    padding-left: 56px;
  }

  .msg-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
    left: 12px;
  }

  .composer {
    padding-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .lobby-card {
    padding: 24px 18px;
  }

  .lobby-join {
    flex-direction: column;
  }

  .admin-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.msg-mention {
  display: inline;
  padding: 0 2px;
  margin: 0 1px;
  border: none;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-hot);
  font: inherit;
  cursor: pointer;
  vertical-align: baseline;
}

.msg-mention:hover {
  background: color-mix(in srgb, var(--accent-hot) 25%, transparent);
  text-decoration: underline;
}

.msg-mention--self {
  background: color-mix(in srgb, var(--accent-hot) 30%, transparent);
  color: #fff;
}

.chat-status--ping {
  color: var(--accent-hot);
  font-weight: 600;
}

.mention-picker {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 6px);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.composer {
  position: relative;
}

.mention-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.mention-picker-item.active,
.mention-picker-item:hover {
  background: var(--accent-soft);
  color: var(--accent-hot);
}

/* Avatar frames — keep message avatars absolutely positioned */
.avatar-frame-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
  border: none;
  background: transparent;
  box-shadow: none;
}

.avatar-frame-f0 {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.msg-avatar.avatar-frame-wrap,
.member-sidebar-avatar.avatar-frame-wrap,
.sidebar-account-avatar.avatar-frame-wrap,
.header-avatar.avatar-frame-wrap {
  border: none;
  background: transparent;
}

.profile-panel-avatar.avatar-frame-wrap {
  border: 6px solid var(--sidebar);
  background: transparent;
}

.msg-avatar.avatar-frame-wrap {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.avatar-frame-wrap .avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--elevated);
  color: var(--accent);
  font-weight: 700;
  border: none;
  box-shadow: none;
}

.avatar-inner--initial {
  line-height: 1;
  user-select: none;
  text-shadow: none;
}

.message.outgoing .msg-avatar.avatar-frame-wrap .avatar-inner {
  background: color-mix(in srgb, var(--accent) 22%, var(--elevated));
  color: var(--accent-hot);
}

.sidebar-account-avatar.avatar-frame-wrap .avatar-inner {
  background: var(--accent-soft);
}

.avatar-frame-wrap .avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-frame-wrap .avatar-inner img.avatar-icon,
.msg-bot-icon,
.avatar-icon {
  width: 68%;
  height: 68%;
  max-width: 68%;
  max-height: 68%;
  object-fit: contain;
  display: block;
}

.profile-panel-avatar img.avatar-icon {
  width: 62%;
  height: 62%;
  max-width: 62%;
  max-height: 62%;
}

.msg-avatar.avatar-frame-wrap,
.member-sidebar-avatar.avatar-frame-wrap,
.sidebar-account-avatar.avatar-frame-wrap,
.header-avatar.avatar-frame-wrap,
.profile-panel-avatar.avatar-frame-wrap {
  /* sizes set per context below; msg-avatar position set above */
}

.member-sidebar-avatar.avatar-frame-wrap,
.sidebar-account-avatar.avatar-frame-wrap,
.header-avatar.avatar-frame-wrap,
.group-manage-member-avatar.avatar-frame-wrap {
  position: relative;
  width: 40px;
  height: 40px;
}

.group-manage-member-avatar.avatar-frame-wrap {
  width: 36px;
  height: 36px;
}

.sidebar-account-avatar.avatar-frame-wrap {
  width: 32px;
  height: 32px;
}

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

.avatar-frame-f1 {
  padding: 2px;
  background: linear-gradient(135deg, #f7d774, #b8860b);
  box-shadow: 0 0 8px rgba(247, 215, 116, 0.45);
}

.avatar-frame-f2 {
  padding: 2px;
  background: linear-gradient(135deg, #a78bfa, #22d3ee);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.55);
  animation: frame-neon 2s ease-in-out infinite alternate;
}

.avatar-frame-f3 {
  padding: 3px;
  background: linear-gradient(135deg, #e0f2fe, #6366f1, #c084fc);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.avatar-frame-f4 {
  padding: 2px;
  background: linear-gradient(135deg, #fb923c, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.avatar-frame-f5 {
  padding: 2px;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45);
}

@keyframes frame-neon {
  from { filter: brightness(1); }
  to { filter: brightness(1.15); }
}

/* Name tags */
.shop-name-tag,
.shop-tag-preview {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  line-height: 1.35;
  white-space: nowrap;
  max-width: 100%;
}

.shop-name-tag--compact {
  font-size: 9px;
  padding: 1px 5px;
  letter-spacing: 0.01em;
}

.shop-name-tag--mini {
  font-size: 8px;
  padding: 0 4px;
  letter-spacing: 0;
}

.shop-name-tag--micro {
  font-size: 7px;
  padding: 0 3px;
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-tag-t1 { background: #7c3aed; color: #fff; }
.shop-tag-t2 { background: #ec4899; color: #fff; }
.shop-tag-t3 { background: linear-gradient(135deg, #cbd5e1, #64748b); color: #0f172a; }
.shop-tag-t4 { background: linear-gradient(135deg, #a78bfa, #6366f1); color: #fff; }

.member-sidebar-title-row .shop-name-tag,
.group-manage-member-title-row .shop-name-tag {
  margin-left: 0;
}

.msg-body h4 .shop-name-tag {
  font-size: 9px;
  padding: 0 5px;
}

/* Shop dialog */
.shop-open-btn {
  margin-right: 6px;
}

.shop-dialog {
  border: none;
  padding: 0;
  max-width: 520px;
  width: calc(100vw - 32px);
  max-height: min(640px, 90vh);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  margin: auto;
  inset: unset;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

.shop-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.shop-dialog-inner {
  padding: 16px;
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 12px;
}

.shop-inventory-heading {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 8px 0 0;
}

.shop-inventory-heading:first-child {
  margin-top: 0;
}

.shop-inventory-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 16px 0;
}

.shop-dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.shop-dialog-head h2 {
  margin: 0;
  flex: 1;
}

.shop-balance-line {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.shop-close {
  margin-left: auto;
}

.shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.shop-tab {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.shop-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-hot);
  color: var(--accent-hot);
}

.shop-hint,
.shop-error {
  font-size: 12px;
  margin: 0 0 10px;
  color: var(--muted);
}

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

.shop-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-card h3 {
  font-size: 13px;
  margin: 0;
}

.shop-card-price {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.shop-card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
}

.shop-card-preview .avatar-frame-wrap {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.shop-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.shop-dialog-foot {
  display: flex;
  justify-content: flex-end;
}
