:root {
  --bg: #1f2228;
  --panel: #2a2f38;
  --panel-2: #323844;
  --text: #eef2ff;
  --muted: #aeb6cd;
  --accent: #4ec9a6;
  --accent-dark: #34a686;
  --danger: #ff7a7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Segoe UI, Tahoma, sans-serif;
  background: radial-gradient(circle at top, #2a3040 0%, var(--bg) 50%);
  color: var(--text);
  min-height: 100svh;
}

.app-shell {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  min-height: 100svh;
}

.app-shell:not(.chat-mode) {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.app-shell:not(.chat-mode) .chat-panel {
  display: none !important;
}

.app-shell.chat-mode {
  display: block;
  padding: 0;
}

.auth-panel {
  width: min(420px, 92vw);
  margin: auto;
  background: var(--panel);
  border: 1px solid #3d4658;
  border-radius: 14px;
  padding: clamp(18px, 3vw, 24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transition: transform 260ms ease, opacity 260ms ease;
  transform: translateX(0);
  opacity: 1;
}

.auth-panel.auth-swipe-out {
  transform: translateX(-64px);
  opacity: 0;
}

.auth-panel.auth-swipe-in {
  animation: authSwipeIn 240ms ease;
}

@keyframes authSwipeIn {
  from {
    transform: translateX(-48px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.auth-panel h1 {
  margin-top: 0;
  margin-bottom: 8px;
}

.auth-panel p {
  margin-top: 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid #49526a;
  background: #2d3441;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.tab-active {
  border-color: var(--accent);
  background: #283f3a;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.auth-form.auth-anim-out-left {
  animation: authFormOutLeft 170ms ease forwards;
}

.auth-form.auth-anim-out-right {
  animation: authFormOutRight 170ms ease forwards;
}

.auth-form.auth-anim-in-left {
  animation: authFormInLeft 180ms ease forwards;
}

.auth-form.auth-anim-in-right {
  animation: authFormInRight 180ms ease forwards;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.remember-row input[type='checkbox'] {
  width: 15px;
  height: 15px;
}

.auth-legal {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-legal-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  line-height: 1.35;
}

.auth-legal-item input[type='checkbox'] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
}

.auth-legal-item label {
  cursor: pointer;
  margin: 0;
}

.auth-legal-link-btn {
  display: inline;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

.auth-legal-link-btn:hover {
  color: var(--accent-dark);
}

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

.auth-actions button {
  border: 1px solid #4a5368;
  border-radius: 8px;
  padding: 9px 10px;
  background: #2d3441;
  color: var(--text);
  cursor: pointer;
}

.auth-actions button:hover {
  background: #3a4255;
}

.auth-form input,
.message-form input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #4a546c;
  background: #1f2430;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.password-input-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  align-self: stretch;
}

.password-input-wrap input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-right: 42px;
  box-sizing: border-box;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  border-radius: 6px;
  background: #3b4458;
  color: var(--text);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.password-toggle-btn:hover {
  background: #4a546c;
}

.eye-icon {
  width: 14px;
  height: 10px;
  border: 2px solid #d6def4;
  border-radius: 999px / 70%;
  position: relative;
}

.eye-icon::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #d6def4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.eye-icon::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 15px;
  background: #d6def4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(50deg);
  border-radius: 2px;
}

.password-toggle-btn.is-visible .eye-icon::after {
  display: none;
}

.auth-form button,
.message-form button {
  margin-top: 10px;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--accent);
  color: #0c1a16;
  font-weight: 700;
  cursor: pointer;
}

.auth-form button:hover,
.message-form button:hover {
  background: var(--accent-dark);
}

.auth-hidden,
.hidden {
  display: none;
}

@keyframes authFormOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-18px);
  }
}

@keyframes authFormOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(18px);
  }
}

@keyframes authFormInLeft {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes authFormInRight {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message {
  margin-top: 12px;
  min-height: 20px;
}

.chat-panel {
  display: grid;
  grid-template-columns: 100px 230px 1fr 240px;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  transform: translateX(0);
  opacity: 1;
}

.chat-panel.chat-swipe-in {
  animation: chatSwipeIn 260ms ease;
}

.chat-panel.chat-swipe-out {
  animation: chatSwipeOut 240ms ease forwards;
}

@keyframes chatSwipeIn {
  from {
    transform: translateX(64px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes chatSwipeOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(48px);
    opacity: 0;
  }
}

.servers-column,
.channels-column,
.messages-column,
.presence-column {
  padding: 14px;
}

.servers-column {
  background: #1a1d23;
  border-right: 1px solid #343b4a;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.channels-column {
  background: var(--panel);
  border-right: 1px solid #41495e;
}

.messages-column {
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.presence-column {
  background: #272d39;
  border-left: 1px solid #41495e;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.presence-column h3 {
  margin: 6px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

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

.channels-header,
.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-drawer-toggle {
  display: none;
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  background: #3b4458;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

.mobile-drawer-toggle:hover {
  background: #4a546c;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 0;
  cursor: pointer;
  background: #3b4458;
  color: var(--text);
}

.icon-btn:hover {
  background: #4a546c;
}

#create-invite-btn {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
}

.list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.servers-column .list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.list button {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 8px;
  padding: 10px;
  background: #3a4153;
  color: var(--text);
  cursor: pointer;
}

.list button:hover {
  background: #4a5368;
}

.list button.active {
  background: #2d8d74;
}

.compact-list {
  margin-top: 0;
  max-height: 30%;
  overflow-y: auto;
}

.compact-list li {
  background: #31394b;
  border-radius: 8px;
  padding: 8px 10px;
}

.compact-list button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.compact-list button:hover {
  color: var(--accent);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot.online {
  background: #52d273;
  box-shadow: 0 0 0 2px rgba(82, 210, 115, 0.18);
}

.status-dot.offline {
  background: #7b849a;
}

.messages-list {
  flex: 1;
  min-height: 0;
  margin-top: 12px;
  border: 1px solid #46506b;
  border-radius: 10px;
  padding: 10px;
  overflow-y: auto;
  background: #2a3040;
}

.vc-panel {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 10px;
  flex: 0 0 auto;
  margin-top: 12px;
  border: 1px solid #46506b;
  border-radius: 10px;
  padding: 10px;
  background: #2a3040;
  max-height: 300px;
  overflow: hidden;
}

.vc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vc-panel-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.vc-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#vc-mute-btn,
#vc-deafen-btn,
#vc-close-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  background: #3b4458;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

#vc-mute-btn:hover,
#vc-deafen-btn:hover,
#vc-close-btn:hover {
  background: #4a546c;
}

.vc-control-on {
  background: #2d8d74 !important;
  color: #eafff8 !important;
}

.vc-stage {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 10px;
  min-height: 220px;
}

.vc-participants {
  background: #242a38;
  border: 1px solid #3f4860;
  border-radius: 8px;
  padding: 8px;
  min-height: 0;
  overflow: hidden;
}

.vc-status {
  margin: 0;
  border: 1px solid #3f4860;
  border-radius: 8px;
  background: #242a38;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.vc-participants h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

#vc-participants-list {
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
}

.vc-participant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vc-badges {
  display: flex;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.vc-speaking {
  box-shadow: 0 0 0 2px rgba(82, 210, 115, 0.35) inset;
  border-radius: 8px;
}

.vc-audio-sink {
  display: none;
}

.msg {
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #333b4f;
}

.msg.me {
  background: #2f5d50;
}

.msg-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.msg-actions {
  display: flex;
  gap: 8px;
}

.msg-action-btn {
  border: none;
  border-radius: 6px;
  background: #4a5368;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 8px;
}

.msg-action-btn:hover {
  background: #5a657d;
}

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

.create-server-btn {
  margin-top: 10px;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--accent);
  color: #0c1a16;
  font-weight: 700;
  cursor: pointer;
}

.create-server-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  background: #3b4458;
  color: var(--text);
}

.secondary-btn:hover {
  background: #4a546c;
}

.mobile-drawer-backdrop {
  display: none;
}

.server-options-menu {
  position: absolute;
  z-index: 60;
  width: 340px;
  background: #2d3441;
  border: 1px solid #4a5368;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  transform: translateX(-8px) scale(0.96);
  transform-origin: left center;
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.server-options-menu.open {
  transform: translateX(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.server-options-menu button {
  border: none;
  border-radius: 8px;
  background: #3a4153;
  color: #ffd4d4;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.server-options-menu button:hover {
  background: #4a5368;
}

.server-options-tabs {
  float: left;
  width: 88px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
  border-right: 1px solid #4a5368;
}

.server-tab {
  width: 100%;
  color: var(--text);
  background: #394157;
  font-size: 12px;
}

.server-tab.active {
  background: #2d8d74;
}

.server-options-content {
  margin-left: 98px;
  min-height: 170px;
}

.server-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.server-panel input {
  border: 1px solid #4a546c;
  background: #1f2430;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
}

#save-server-name-btn {
  color: #cde9ff;
}

.banned-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.banned-user-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: #363f54;
  border-radius: 8px;
  padding: 8px;
}

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

.unban-btn {
  color: #ffd4d4;
}

.user-options-menu {
  position: absolute;
  z-index: 65;
  min-width: 150px;
  background: #2d3441;
  border: 1px solid #4a5368;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  transform: translateX(8px) scale(0.96);
  transform-origin: right center;
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.user-options-menu.open {
  transform: translateX(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.user-options-menu button {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #3a4153;
  color: #ffd4d4;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.user-options-menu button:hover {
  background: #4a5368;
}

.account-panel {
  margin-top: auto;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #44506a;
  border-radius: 10px;
  background: #232936;
}

.account-info {
  min-width: 0;
}

.account-username {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.account-settings-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #3a4255;
  color: var(--text);
  cursor: pointer;
}

.account-settings-btn:hover {
  background: #4a5368;
}

.account-settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 170px;
  z-index: 70;
  background: #2d3441;
  border: 1px solid #4a5368;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.account-settings-menu button {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #3a4153;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}

.account-settings-menu button:hover {
  background: #4a5368;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.58);
  display: grid;
  place-items: center;
  padding: 16px;
}

.account-modal.hidden {
  display: none;
}

.account-settings-menu.hidden {
  display: none;
}

.account-modal-card {
  width: min(500px, 96vw);
  background: #2b323f;
  border: 1px solid #4a5368;
  border-radius: 12px;
  padding: 14px;
}

.account-modal.is-opening {
  animation: popupOverlayIn 160ms ease forwards;
}

.account-modal.is-opening .account-modal-card {
  animation: popupCardIn 170ms ease forwards;
}

.account-modal.is-closing {
  animation: popupOverlayOut 140ms ease forwards;
}

.account-modal.is-closing .account-modal-card {
  animation: popupCardOut 140ms ease forwards;
}

.account-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.account-modal-header h3 {
  margin: 0;
}

.account-modal-header button,
#account-save-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: #3b4458;
  color: var(--text);
  cursor: pointer;
}

#account-save-btn {
  background: var(--accent);
  color: #0c1a16;
  font-weight: 700;
}

.account-delete-btn {
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  background: #6a2f3a;
  color: #ffe5e5;
  cursor: pointer;
}

.account-delete-btn:hover {
  background: #7a3947;
}

.account-form {
  display: grid;
  gap: 8px;
}

.account-form input {
  border: 1px solid #4a546c;
  background: #1f2430;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.account-form .password-input-wrap input {
  width: 100%;
}

.account-form-message {
  margin: 10px 2px 2px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.friend-requests-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.friend-request-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  background: #31394b;
  border-radius: 8px;
  padding: 8px 10px;
}

.friend-request-meta {
  min-width: 0;
}

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

.friend-request-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-request-action {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.friend-request-accept {
  background: #2d8d74;
  color: #eafff8;
}

.friend-request-reject {
  background: #6a2f3a;
  color: #ffe5e5;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(0, 0, 0, 0.58);
  display: grid;
  place-items: center;
  padding: 16px;
}

.app-dialog.hidden {
  display: none;
}

.app-dialog-card {
  width: min(420px, 96vw);
  background: #2b323f;
  border: 1px solid #4a5368;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
  max-height: 82vh;
  overflow: auto;
}

.app-dialog.is-opening {
  animation: popupOverlayIn 160ms ease forwards;
}

.app-dialog.is-opening .app-dialog-card {
  animation: popupCardIn 170ms ease forwards;
}

.app-dialog.is-closing {
  animation: popupOverlayOut 140ms ease forwards;
}

.app-dialog.is-closing .app-dialog-card {
  animation: popupCardOut 140ms ease forwards;
}

.app-dialog-card h3 {
  margin: 0;
}

#app-dialog-message,
.app-dialog-body {
  margin: 0;
  color: var(--muted);
  white-space: normal;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
}

.app-dialog-body h1,
.app-dialog-body h2,
.app-dialog-body h3 {
  color: var(--text);
  margin: 1em 0 0.5em;
  font-size: 1.1em;
}

.app-dialog-body h1 { font-size: 1.25em; }
.app-dialog-body h2 { font-size: 1.15em; }

.app-dialog-body p {
  margin: 0.5em 0;
}

.app-dialog-body ul {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.app-dialog-body li {
  margin: 0.25em 0;
}

.app-dialog-body strong {
  color: var(--text);
  font-weight: 600;
}

.app-dialog-body a {
  color: var(--accent);
  text-decoration: underline;
}

#app-dialog-input {
  border: 1px solid #4a546c;
  background: #1f2430;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.app-dialog-actions button {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

#app-dialog-cancel-btn {
  background: #3b4458;
  color: var(--text);
}

#app-dialog-ok-btn {
  background: var(--accent);
  color: #0c1a16;
  font-weight: 700;
}

@keyframes popupOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popupOverlayOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes popupCardIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popupCardOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

@media (max-width: 980px) {
  .chat-panel {
    grid-template-columns: 80px 200px 1fr 200px;
  }
}

@media (max-width: 700px) {
  .chat-panel {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    min-height: 100svh;
    position: relative;
    overflow: hidden;
  }

  .servers-column,
  .channels-column,
  .presence-column {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 40;
    border-bottom: none;
    transition: transform 260ms ease;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  }

  .servers-column {
    left: 0;
    width: 84px;
    transform: translateX(calc(-100% - 24px));
  }

  .channels-column {
    left: 84px;
    width: min(74vw, 250px);
    transform: translateX(calc(-120% - 24px));
    border-right: 1px solid #41495e;
  }

  .presence-column {
    right: 0;
    width: min(78vw, 280px);
    transform: translateX(calc(100% + 24px));
  }

  .chat-panel.mobile-servers-open .servers-column,
  .chat-panel.mobile-servers-open .channels-column {
    transform: translateX(0);
  }

  .chat-panel.mobile-users-open .presence-column {
    transform: translateX(0);
  }

  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 260ms ease;
  }

  .chat-panel.mobile-servers-open .mobile-drawer-backdrop,
  .chat-panel.mobile-users-open .mobile-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .messages-header {
    gap: 8px;
  }

  .messages-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 16px;
  }

  .mobile-drawer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .messages-column {
    padding: 10px;
    z-index: 1;
  }

  .presence-actions {
    grid-template-columns: 1fr;
  }

  .create-server-btn {
    width: 100%;
  }

  .server-options-menu {
    width: min(92vw, 340px);
  }

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

  .message-form button {
    width: 100%;
  }

  .vc-panel {
    padding: 8px;
    max-height: none;
  }

  .vc-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .vc-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  #vc-mute-btn,
  #vc-deafen-btn,
  #vc-close-btn {
    width: 100%;
    padding: 10px 8px;
    font-size: 12px;
    margin: 0;
    text-align: center;
  }

  .vc-stage {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 8px;
  }

  .account-panel {
    margin-top: 12px;
  }

  #vc-participants-list {
    max-height: 140px;
  }
}

@media (max-width: 420px) {
  .vc-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #vc-close-btn {
    grid-column: 1 / -1;
  }
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
}

.auth-card {
  min-height: 500px;
  transition: all 0.2s ease;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}