:root {
  --rail: #1e1f22;
  --sidebar: #2b2d31;
  --chat: #313338;
  --raise: #383a40;
  --input: #383a40;
  --blurple: #5865f2;
  --blurple-hi: #4752c4;
  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b232;
  --link: #00a8fc;
  --text: #dbdee1;
  --text-hi: #f2f3f5;
  --text-dim: #949ba4;
  --text-mute: #80848e;
  --divider: #3f4147;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
  font-family: 'gg sans', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--chat);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #1a1b1e;
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ======================= calculator gate ======================= */

.calc-gate {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #0b0b0d;
}

.calc-gate[hidden] {
  display: none;
}

.calc-gate.unlocking {
  animation: fade 0.35s var(--ease) reverse both;
}

.calc {
  width: min(380px, 100%);
  padding: 20px;
  border-radius: 26px;
  background: #1c1c1e;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.calc-display {
  min-height: 96px;
  padding: 14px 12px 18px;
  text-align: right;
  font-size: 64px;
  font-weight: 300;
  color: #fff;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.ck {
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 500;
  color: #fff;
  background: #333336;
  transition: filter 0.1s var(--ease), transform 0.08s var(--ease);
}

.ck:hover {
  filter: brightness(1.15);
}

.ck:active {
  transform: scale(0.94);
}

.ck.fn {
  background: #a5a5a5;
  color: #000;
  font-weight: 600;
}

.ck.op {
  background: #ff9f0a;
  font-size: 34px;
}

.ck.op.active {
  background: #fff;
  color: #ff9f0a;
}

.ck.zero {
  grid-column: span 2;
  aspect-ratio: auto;
  border-radius: 40px;
  text-align: left;
  padding-left: 28px;
}

@media (max-width: 420px) {
  .calc-display {
    font-size: 52px;
  }
  .ck {
    font-size: 26px;
  }
}

/* ============================ boot loader ======================== */

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: #23272a;
  transition: opacity 0.5s var(--ease);
}

.boot.gone {
  opacity: 0;
  pointer-events: none;
}

.boot-logo {
  width: 120px;
  animation: boot-bounce 1.4s var(--ease) infinite;
}

.boot-logo svg {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes boot-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-14px) scale(1.04);
  }
  55% {
    transform: translateY(0) scale(0.98);
  }
}

.boot-bar {
  width: 190px;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.boot-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 6px;
  background: var(--blurple);
  animation: boot-load 1.1s var(--ease) infinite;
}

@keyframes boot-load {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(360%);
  }
}

.boot-tip {
  max-width: 340px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 0 20px;
}

/* ============================== auth ============================== */

.auth {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: #5865f2;
}

.auth[hidden] {
  display: none;
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: auth-bg-in 1s var(--ease) both;
}

@keyframes auth-bg-in {
  from {
    opacity: 0;
    transform: scale(1.06);
  }
}

.auth-wordmark {
  position: absolute;
  top: 32px;
  left: 40px;
  width: 124px;
  animation: fade-down 0.6s var(--ease) both;
}

.auth-card {
  position: relative;
  display: flex;
  gap: 40px;
  width: min(800px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 32px;
  border-radius: 8px;
  background: var(--sidebar);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  animation: card-in 0.55s var(--snap) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
}

.auth-card.shake {
  animation: shake 0.4s var(--ease);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-9px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(3px);
  }
}

.auth-main {
  flex: 1;
  min-width: 0;
}

.auth-head {
  text-align: center;
  margin-bottom: 20px;
}

.auth-head h1 {
  font-size: 24px;
  color: var(--text-hi);
}

.auth-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 15px;
}

.field {
  display: block;
  position: relative;
  margin-bottom: 18px;
}

.field span,
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field .req {
  color: var(--red);
  font-style: normal;
}

.field em {
  font-style: normal;
  text-transform: none;
  font-weight: 400;
}

.field input,
.field textarea,
.field select,
.modal input,
.modal textarea,
.modal select,
.edit-pass input {
  width: 100%;
  padding: 10px;
  border: 1px solid #1e1f22;
  border-radius: 3px;
  background: #1e1f22;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.edit-pass input:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
}

.field .hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-mute);
}

.forgot {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--link);
  text-decoration: none;
}
.forgot:hover {
  text-decoration: underline;
}

/* avatar picker */

.avatar-section {
  margin-bottom: 18px;
  animation: fade-down 0.35s var(--ease) both;
}

.avatar-section[hidden] {
  display: none;
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.avatar-opt {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  background: #1e1f22;
  transition: transform 0.22s var(--snap), border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

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

.avatar-opt:hover {
  transform: translateY(-3px) scale(1.08);
}

.avatar-opt.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.8);
  transform: scale(1.05);
}

.custom-avatar span {
  display: block;
  padding: 9px;
  text-align: center;
  font-size: 13px;
  border: 1px dashed var(--divider);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.custom-avatar span:hover {
  border-color: var(--blurple);
  color: var(--text-hi);
  background: rgba(88, 101, 242, 0.1);
}

.auth-error {
  margin-bottom: 14px;
  padding: 9px 11px;
  border-radius: 5px;
  background: rgba(242, 63, 67, 0.12);
  border-left: 3px solid var(--red);
  color: #ffb3b5;
  font-size: 13px;
  animation: fade-down 0.25s var(--ease) both;
}

.auth-error[hidden] {
  display: none;
}

.btn-primary,
.btn-danger {
  position: relative;
  width: 100%;
  padding: 12px;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease), opacity 0.16s var(--ease);
}

.btn-primary {
  background: var(--blurple);
}
.btn-primary:hover {
  background: var(--blurple-hi);
}
.btn-danger {
  background: var(--red);
}
.btn-danger:hover {
  background: #c4383b;
}
.btn-primary:active,
.btn-danger:active {
  transform: scale(0.985);
}
.btn-primary:disabled,
.btn-danger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner[hidden] {
  display: none;
}

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

.auth-swap {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
}

.auth-swap button {
  color: var(--link);
  font-size: 13px;
}
.auth-swap button:hover {
  text-decoration: underline;
}

/* QR panel */

.auth-qr {
  flex: none;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8px;
}

.qr-frame {
  position: relative;
  width: 176px;
  height: 176px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.qr-frame canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.qr-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: #fff;
  padding: 3px;
}

.auth-qr h2 {
  margin-top: 18px;
  font-size: 20px;
  color: var(--text-hi);
}

.auth-qr p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.qr-passkey {
  margin-top: 12px;
  font-size: 14px;
  color: var(--link);
  text-decoration: none;
}
.qr-passkey:hover {
  text-decoration: underline;
}

/* ========================= onboarding =========================== */

.onboard-body {
  text-align: center;
  padding: 28px 24px;
}

.onboard-icon {
  font-size: 44px;
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  50% {
    transform: translateY(-7px);
  }
}

.onboard-body h2 {
  margin-top: 10px;
  font-size: 22px;
  color: var(--text-hi);
}

.onboard-sub {
  margin: 8px 0 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.onboard-body .field {
  text-align: left;
}

/* ========================= ban screen =========================== */

.ban-screen {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #1a1b1e;
  animation: fade 0.3s var(--ease) both;
}

.ban-screen[hidden] {
  display: none;
}

.ban-card {
  width: min(440px, 100%);
  text-align: center;
  animation: card-in 0.5s var(--snap) both;
}

.ban-face {
  width: 130px;
  margin: 0 auto 24px;
  animation: ban-shake 3s var(--ease) infinite;
}

@keyframes ban-shake {
  0%,
  90%,
  100% {
    transform: rotate(0);
  }
  93% {
    transform: rotate(-6deg);
  }
  96% {
    transform: rotate(6deg);
  }
}

.ban-card h1 {
  font-size: 26px;
  color: var(--text-hi);
}

.ban-card p {
  margin: 14px 0 26px;
  color: var(--text-dim);
  line-height: 1.5;
}

.ban-card .btn-danger {
  max-width: 260px;
  margin: 0 auto;
}

/* ============================== app =============================== */

.app {
  display: grid;
  grid-template-columns: 72px 240px 1fr 240px;
  height: 100dvh;
  animation: app-in 0.45s var(--ease) both;
}

.app[hidden] {
  display: none;
}

@keyframes app-in {
  from {
    opacity: 0;
    transform: scale(1.01);
  }
}

/* rail */

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  background: var(--rail);
}

.rail-home {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 32%;
  background: var(--blurple);
  transition: border-radius 0.2s var(--ease), transform 0.2s var(--snap);
}

/* Bigger outer shell, smaller white Discord logo inside. */
.rail-home-logo {
  width: 28px;
  height: auto;
}

.rail-home:hover {
  border-radius: 26%;
  transform: translateY(-2px);
}

.rail-server {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-hi);
  border-radius: 50%;
  background: #313338;
  transition: border-radius 0.22s var(--ease), transform 0.22s var(--snap),
    background 0.2s var(--ease);
}

.rail-server.admin {
  background: var(--sidebar);
}

.rail-server.add {
  background: var(--sidebar);
  color: var(--green);
  font-size: 24px;
}

.rail-server.add:hover {
  background: var(--green);
  color: #fff;
}

.rail-server .srv-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

#serverList {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-server:hover {
  border-radius: 32%;
  transform: translateY(-2px);
  background: var(--blurple);
}

.rail-server.admin:hover {
  background: var(--yellow);
}

.rail-server.active {
  border-radius: 32%;
  background: #313338;
}

/* white dot to the RIGHT of the icon when it's the one you're viewing */
.rail-home.active::after,
.rail-server.active::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.rail-sep {
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--divider);
}

/* sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  font-weight: 700;
  color: var(--text-hi);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* DM-area nav row (like Friends / Nitro / Shop in Discord's DM home) */
.dm-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 15px;
  text-align: left;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.dm-nav:hover {
  background: #35373c;
  color: var(--text-hi);
}

.dm-nav-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.channel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.channel-group + .channel-group {
  margin-top: 16px;
}

.group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.channel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 2px;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 15px;
  text-align: left;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.channel.enter {
  animation: slide-right 0.3s var(--ease) both;
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
}

.channel:hover {
  background: #35373c;
  color: var(--text);
}

.channel.active {
  background: #404249;
  color: var(--text-hi);
}

.channel .hash {
  color: var(--text-dim);
  font-weight: 500;
  flex: none;
}

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

.channel .del {
  margin-left: auto;
  opacity: 0;
  font-size: 12px;
  color: var(--text-dim);
  transition: opacity 0.14s var(--ease), color 0.14s var(--ease);
}

.channel:hover .del {
  opacity: 1;
}
.channel .del:hover {
  color: var(--red);
}

.channel .dm-av {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.channel .unread {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.me-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #232428;
  cursor: pointer;
  transition: background 0.14s var(--ease);
}

.me-bar:hover {
  background: #35373c;
}

.me-info {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.me-info strong {
  display: block;
  font-size: 14px;
  color: var(--text-hi);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-info small {
  font-size: 12px;
  color: var(--text-dim);
}

/* avatars */

.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  overflow: hidden;
  background: #1e1f22;
}

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

.avatar.lg {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.avatar.xl {
  width: 80px;
  height: 80px;
  font-size: 34px;
}

/* chat */

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

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.chat-head .hash {
  font-size: 20px;
  color: var(--text-dim);
}

.chat-head strong {
  color: var(--text-hi);
}

.topic {
  padding-left: 8px;
  border-left: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic:empty {
  display: none;
}

.conn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
}

.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1.6s ease-in-out infinite;
}

.conn.online .dot {
  background: var(--green);
  animation: none;
}
.conn.offline .dot {
  background: var(--red);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.menu-btn {
  display: none;
}

/* messages */

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 16px 16px 8px;
}

/* Push content to the bottom so a near-empty channel starts at the bottom. */
.messages::before {
  content: '';
  margin-top: auto;
}

.msg {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 3px 48px 3px 8px;
  border-radius: 4px;
  transition: background 0.12s var(--ease);
}

.msg.enter {
  animation: msg-in 0.32s var(--ease) both;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.msg:hover {
  background: #2e3035;
}

.msg.pending {
  opacity: 0.55;
}

.msg.failed {
  background: rgba(242, 63, 67, 0.08);
}

.msg.grouped {
  margin-top: 0;
  padding-top: 1px;
}

.msg.grouped .avatar {
  visibility: hidden;
  height: 0;
}

.msg:not(.grouped) {
  margin-top: 14px;
}

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

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-author {
  font-weight: 600;
  color: var(--text-hi);
  cursor: pointer;
}

.msg-author:hover {
  text-decoration: underline;
}

.msg-author.admin {
  color: var(--yellow);
}

.bot-tag {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--blurple);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  text-transform: uppercase;
}

.msg-time {
  font-size: 11px;
  color: var(--text-dim);
}

.msg-text {
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-text strong {
  color: var(--text-hi);
}

.msg-text .edited {
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-mute);
}

.fwd-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

/* reply reference */

.reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  margin-left: 4px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}

.reply-ref::before {
  content: '';
  width: 28px;
  height: 10px;
  margin-top: 8px;
  border-left: 2px solid var(--divider);
  border-top: 2px solid var(--divider);
  border-top-left-radius: 6px;
  flex: none;
}

.reply-ref .ra {
  width: 16px;
  height: 16px;
  font-size: 9px;
}

.reply-ref b {
  color: var(--text);
  font-weight: 500;
}

.reply-ref span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

/* reactions */

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 8px;
  background: #2b2d31;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--text);
  transition: transform 0.14s var(--snap), background 0.14s var(--ease),
    border-color 0.14s var(--ease);
}

.reaction:hover {
  border-color: var(--text-dim);
}

.reaction.mine {
  background: rgba(88, 101, 242, 0.18);
  border-color: var(--blurple);
}

.reaction .count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.reaction.mine .count {
  color: #c9cdfb;
}

.reaction.pop {
  animation: react-pop 0.3s var(--snap);
}

@keyframes react-pop {
  40% {
    transform: scale(1.28);
  }
}

/* hover actions */

.msg-tools {
  position: absolute;
  top: -14px;
  right: 8px;
  display: none;
  gap: 2px;
  padding: 2px;
  background: var(--chat);
  border: 1px solid var(--divider);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.msg:hover .msg-tools {
  display: flex;
}

.msg-tools button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 14px;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.msg-tools button:hover {
  background: var(--raise);
  color: var(--text-hi);
}

/* read receipt */

.receipt {
  display: inline-flex;
  align-items: center;
  margin-left: 3px;
  font-size: 9px;
  letter-spacing: -1px;
  color: var(--text-mute);
  cursor: default;
  vertical-align: middle;
  transition: color 0.15s var(--ease);
}

.receipt.seen {
  color: var(--link);
  cursor: pointer;
}

.receipt.pending {
  color: var(--text-mute);
}

/* day + empty */

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.channel-intro {
  padding: 40px 8px;
  animation: msg-in 0.4s var(--ease) both;
}

.channel-intro .big-hash {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--raise);
  font-size: 36px;
  color: var(--text-hi);
  margin-bottom: 8px;
}

.channel-intro h2 {
  color: var(--text-hi);
  font-size: 28px;
}

.channel-intro p {
  margin-top: 6px;
  color: var(--text-dim);
}

/* ticket prompt block */

.ticket-prompt {
  margin-top: 8px;
}

.ticket-prompt button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 4px;
  background: var(--blurple);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}

.ticket-prompt button:hover {
  background: var(--blurple-hi);
  transform: translateY(-1px);
}

/* typing */

.typing {
  height: 22px;
  padding: 0 20px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: blink 1.2s infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* composer */

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

.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px 8px 0 0;
  background: #2b2d31;
  font-size: 13px;
  color: var(--text-dim);
  animation: fade-down 0.2s var(--ease) both;
}

.reply-bar[hidden] {
  display: none;
}

.reply-bar b {
  color: var(--text);
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--input);
  transition: box-shadow 0.2s var(--ease);
}

.composer-box:focus-within {
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.55);
}

.composer textarea {
  flex: 1;
  max-height: 180px;
  padding: 12px 0;
  border: none;
  background: none;
  outline: none;
  resize: none;
  line-height: 1.375;
}

.composer textarea::placeholder {
  color: var(--text-dim);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 16px;
  transition: color 0.14s var(--ease), background 0.14s var(--ease), transform 0.18s var(--snap);
}

.icon-btn:hover {
  color: var(--text-hi);
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.12);
}

.icon-btn.tiny {
  width: 20px;
  height: 20px;
  font-size: 13px;
}

.icon-btn.send {
  margin-bottom: 6px;
  color: var(--blurple);
}

.icon-btn.plus {
  margin-bottom: 6px;
}

/* members */

.members {
  padding: 16px 8px;
  background: var(--sidebar);
  overflow-y: auto;
}

.members h3 {
  padding: 0 8px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.14s var(--ease);
}

.member.enter {
  animation: slide-right 0.3s var(--ease) both;
}

.member:hover {
  background: #35373c;
}

.member.offline {
  opacity: 0.42;
}

.member-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member.is-admin .member-name {
  color: var(--yellow);
  font-weight: 600;
}

.badge-mini {
  width: 15px;
  height: 15px;
  flex: none;
}

.avatar-wrap {
  position: relative;
  flex: none;
}

.status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--sidebar);
  background: var(--text-mute);
  transition: background 0.25s var(--ease);
}

.status.on {
  background: var(--green);
}

.status.bot {
  background: var(--blurple);
}

/* ======================= profile popout ========================= */

.profile-card {
  position: relative;
  width: min(340px, 100%);
  border-radius: 8px;
  overflow: hidden;
  background: #232428;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.32s var(--snap) both;
}

.profile-banner {
  height: 90px;
  background: var(--blurple);
}

.profile-banner.mini {
  height: 60px;
  border-radius: 8px;
}

.profile-av-wrap {
  position: absolute;
  top: 52px;
  left: 18px;
  padding: 5px;
  border-radius: 50%;
  background: #232428;
}

.profile-inner {
  padding: 44px 18px 18px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-name-row h2 {
  font-size: 20px;
  color: var(--text-hi);
}

.profile-badges {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.profile-badges .badge {
  width: 22px;
  height: 22px;
}

.profile-tag {
  font-size: 13px;
  color: var(--text-dim);
}

.profile-divider {
  height: 1px;
  margin: 12px 0;
  background: var(--divider);
}

.profile-section {
  margin-bottom: 12px;
}

.profile-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-hi);
  margin-bottom: 4px;
}

.profile-section p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.profile-actions button {
  flex: 1;
  padding: 9px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}

.profile-actions .msg-btn {
  background: var(--blurple);
  color: #fff;
}
.profile-actions .msg-btn:hover {
  background: var(--blurple-hi);
}
.profile-actions .edit-btn {
  background: var(--raise);
  color: var(--text-hi);
}
.profile-actions .edit-btn:hover {
  background: #4e5058;
}

.profile-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
}

.edit-preview {
  position: relative;
  margin-bottom: 30px;
}

.edit-preview .avatar {
  position: absolute;
  bottom: -22px;
  left: 12px;
  border: 5px solid var(--chat);
}

/* ============================= modals ============================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
  animation: fade 0.2s var(--ease) both;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop.closing {
  animation: fade 0.18s var(--ease) reverse both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(640px, 100%);
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: var(--chat);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.32s var(--snap) both;
}

.modal.small {
  width: min(440px, 100%);
}

.modal-backdrop.closing .modal,
.modal-backdrop.closing .profile-card {
  animation: modal-in 0.18s var(--ease) reverse both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
}

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

.modal-head h2 {
  font-size: 18px;
  color: var(--text-hi);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.modal-body .btn-primary {
  margin-top: 4px;
}

.edit-pass {
  margin: 4px 0 18px;
}

.edit-pass input {
  margin-bottom: 8px;
}

input[type='color'] {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

/* admin */

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--divider);
}

.admin-tab {
  padding: 8px 14px;
  border-radius: 4px 4px 0 0;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}

.admin-tab:hover {
  color: var(--text);
}

.admin-tab.active {
  color: var(--text-hi);
  box-shadow: inset 0 -2px 0 var(--blurple);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--raise);
  transition: transform 0.16s var(--ease);
}

.admin-user.enter {
  animation: slide-right 0.3s var(--ease) both;
}

.admin-user.banned {
  opacity: 0.55;
  border-left: 3px solid var(--red);
}

.admin-user .who {
  flex: 1;
  min-width: 0;
}

.admin-user .who strong {
  display: block;
  color: var(--text-hi);
}

.admin-user .who small {
  color: var(--text-dim);
  font-size: 12px;
}

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

.chip {
  padding: 6px 11px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: #4e5058;
  color: var(--text-hi);
  transition: background 0.14s var(--ease), transform 0.14s var(--snap);
}

.chip:hover {
  transform: translateY(-2px);
}
.chip.warn:hover {
  background: var(--yellow);
  color: #111;
}
.chip.danger:hover {
  background: var(--red);
}
.chip.good:hover {
  background: var(--green);
}
.chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* tickets */

.ticket {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--raise);
  border-left: 3px solid var(--blurple);
  animation: slide-right 0.3s var(--ease) both;
}

.ticket.closed {
  opacity: 0.5;
  border-left-color: var(--text-mute);
}

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

.ticket-top strong {
  flex: 1;
  min-width: 0;
  color: var(--text-hi);
}

.ticket-kind {
  flex: none;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--blurple);
  color: #fff;
}

.ticket-kind.feature {
  background: var(--green);
}

.ticket-meta {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.ticket-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.ticket .chip.good {
  background: var(--green);
}

.admin-empty {
  padding: 30px;
  text-align: center;
  color: var(--text-dim);
}

/* ====================== context menu ============================ */

.context-menu {
  position: fixed;
  z-index: 80;
  min-width: 200px;
  padding: 6px;
  border-radius: 6px;
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: ctx-in 0.14s var(--ease) both;
}

.context-menu[hidden] {
  display: none;
}

@keyframes ctx-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
}

.ctx-reactions {
  display: flex;
  gap: 2px;
  padding: 4px;
  margin-bottom: 4px;
}

.ctx-reactions button {
  flex: 1;
  padding: 5px;
  border-radius: 4px;
  font-size: 18px;
  transition: background 0.12s var(--ease), transform 0.12s var(--snap);
}

.ctx-reactions button:hover {
  background: var(--raise);
  transform: scale(1.2);
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 8px;
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  transition: background 0.1s var(--ease), color 0.1s var(--ease);
}

.ctx-item .ci-icon {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
}

.ctx-item:hover {
  background: var(--blurple);
  color: #fff;
}

.ctx-item:hover .ci-icon {
  color: #fff;
}

.ctx-item.danger:hover {
  background: var(--red);
}

.ctx-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--divider);
}

.ctx-sub {
  position: relative;
}

.ctx-submenu {
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 190px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 6px;
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: ctx-in 0.12s var(--ease) both;
}

.ctx-sub-label {
  padding: 6px 8px 4px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ======================= emoji picker =========================== */

.emoji-pop {
  position: fixed;
  z-index: 85;
  width: 340px;
  max-width: calc(100vw - 24px);
  height: 400px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background: #2b2d31;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: emoji-in 0.18s var(--snap) both;
}

.emoji-pop[hidden] {
  display: none;
}

@keyframes emoji-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

.emoji-search {
  margin: 12px;
  padding: 9px 12px;
  border-radius: 4px;
  border: none;
  background: #1e1f22;
  outline: none;
}

.emoji-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.emoji-cat {
  padding: 8px 6px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: #2b2d31;
}

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

.emoji-grid button {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 6px;
  transition: background 0.1s var(--ease), transform 0.1s var(--snap);
}

.emoji-grid button:hover {
  background: var(--raise);
  transform: scale(1.18);
}

.emoji-none {
  padding: 30px;
  text-align: center;
  color: var(--text-dim);
}

/* toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 95;
}

.toast {
  padding: 12px 16px;
  border-radius: 6px;
  background: var(--raise);
  color: var(--text-hi);
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-left: 3px solid var(--blurple);
  animation: toast-in 0.35s var(--snap) both;
}

.toast.err {
  border-left-color: var(--red);
}
.toast.ok {
  border-left-color: var(--green);
}
.toast.out {
  animation: toast-out 0.3s var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
}

/* ============================ badges ============================== */

.badge-mini,
.badge,
.bt-icon {
  object-fit: contain;
}

.badge-manager h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-hi);
  margin-bottom: 6px;
}

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

.badge-toggle {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 6px;
  background: #1e1f22;
  opacity: 0.4;
  filter: grayscale(1);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--snap), filter 0.15s var(--ease);
}

.badge-toggle:hover {
  transform: translateY(-2px) scale(1.06);
  opacity: 0.85;
}

.badge-toggle.on {
  opacity: 1;
  filter: none;
  background: rgba(88, 101, 242, 0.2);
  box-shadow: inset 0 0 0 1px var(--blurple);
}

.badge-toggle .bt-icon {
  width: 100%;
  height: 100%;
}

/* ========================= message images ======================== */

.msg-image {
  display: block;
  margin-top: 6px;
  max-width: min(400px, 100%);
  max-height: 320px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.msg-image:hover {
  transform: scale(1.008);
  filter: brightness(1.05);
}

.attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px 8px 0 0;
  background: #2b2d31;
  animation: fade-down 0.2s var(--ease) both;
}

.attach-preview[hidden] {
  display: none;
}

.attach-preview img {
  max-height: 64px;
  max-width: 120px;
  border-radius: 6px;
}

/* ========================== mentions ============================= */

.mention {
  padding: 0 2px;
  border-radius: 3px;
  color: #c9cdfb;
  background: rgba(88, 101, 242, 0.22);
  font-weight: 500;
  cursor: pointer;
}

.mention:hover {
  background: var(--blurple);
  color: #fff;
}

.mention-pop {
  position: fixed;
  z-index: 85;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 8px;
  background: #2b2d31;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: emoji-in 0.14s var(--snap) both;
}

.mention-pop[hidden] {
  display: none;
}

.mention-label {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 4px;
  color: var(--text);
  text-align: left;
}

.mention-item .avatar {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.mention-item.active,
.mention-item:hover {
  background: var(--blurple);
  color: #fff;
}

/* ======================== hypesquad quiz ======================== */

.quiz-prog {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.quiz-q {
  font-size: 18px;
  color: var(--text-hi);
  margin-bottom: 14px;
}

.quiz-answer {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--raise);
  color: var(--text);
  text-align: left;
  font-size: 15px;
  transition: background 0.14s var(--ease), transform 0.14s var(--snap);
}

.quiz-answer:hover {
  background: var(--blurple);
  color: #fff;
  transform: translateX(3px);
}

.quiz-result {
  text-align: center;
  padding: 12px;
  animation: modal-in 0.4s var(--snap) both;
}

.quiz-badge {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 12px;
  animation: bob 2.6s ease-in-out infinite;
}

.quiz-result h2 {
  color: var(--text-hi);
  margin-bottom: 16px;
}

/* ========================= coach tooltips ======================== */

.coach-tip {
  position: fixed;
  z-index: 120;
  width: 280px;
  max-width: calc(100vw - 20px);
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--blurple);
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: emoji-in 0.25s var(--snap) both;
}

.coach-tip[hidden] {
  display: none;
}

.coach-tip p {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.coach-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.coach-skip {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.coach-skip:hover {
  color: #fff;
}

.coach-next {
  padding: 7px 16px;
  border-radius: 4px;
  background: #fff;
  color: var(--blurple);
  font-weight: 600;
  font-size: 13px;
}

.coach-highlight {
  position: relative;
  z-index: 121;
  outline: 3px solid var(--blurple);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ==================== categories + drag ========================= */

.channel[draggable='true'] {
  cursor: grab;
}

.channel.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.channel-list {
  min-height: 6px;
}

.new-category {
  display: block;
  width: calc(100% - 16px);
  margin: 6px 8px 2px;
  padding: 7px;
  border-radius: 4px;
  border: 1px dashed var(--divider);
  color: var(--text-dim);
  font-size: 13px;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease), background 0.14s var(--ease);
}

.new-category[hidden] {
  display: none;
}

.new-category:hover {
  color: var(--text-hi);
  border-color: var(--blurple);
  background: rgba(88, 101, 242, 0.1);
}

.group-label .icon-btn.tiny {
  color: var(--text-dim);
}

.group-label .icon-btn.tiny:hover {
  color: var(--text-hi);
}

/* ========================= nitro modal ========================== */

.nitro-body {
  text-align: center;
  padding: 28px 24px;
}

.nitro-hero {
  width: 64px;
  height: 64px;
  object-fit: contain;
  animation: bob 2.6s ease-in-out infinite;
}

.nitro-body h2 {
  margin-top: 10px;
  font-size: 22px;
  color: var(--text-hi);
}

.nitro-sub {
  margin: 8px 0 16px;
  color: var(--text-dim);
  font-size: 14px;
}

.nitro-steps {
  text-align: left;
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

.nitro-steps strong {
  color: var(--text-hi);
}

/* ====================== system notices ========================== */

.sys-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.sys-notice.enter {
  animation: msg-in 0.3s var(--ease) both;
}

.sys-text::before {
  content: '➜ ';
  color: var(--green);
}

.sys-time {
  font-size: 11px;
  color: var(--text-mute);
}

/* ==================== DM notification pills ===================== */

#dmPills {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

#dmPills:empty {
  display: none;
}

.dm-pill {
  overflow: visible;
}

.dm-pill .srv-icon {
  border-radius: inherit;
}

.rail-badge.dm-count {
  bottom: -4px;
  right: -4px;
  border: 3px solid var(--rail);
}

.server-caret {
  font-size: 12px;
  color: var(--text-dim);
}

.server-caret[hidden] {
  display: none;
}

.composer textarea:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ===================== rail badges + mentions =================== */

.rail-badge {
  position: absolute;
  bottom: -3px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 3px solid var(--rail);
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.rail-badge[hidden] {
  display: none;
}

.pill-label {
  pointer-events: none;
}

.mention-all {
  background: rgba(88, 101, 242, 0.28);
  color: #c9cdfb;
}

/* ===================== create DM modal ========================== */

.dm-modal-hint {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}

.dm-group-name {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #1e1f22;
  border-radius: 4px;
  background: #1e1f22;
  outline: none;
}

.dm-member-pick {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.dm-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s var(--ease);
}

.dm-pick-row:hover {
  background: var(--raise);
}

.dm-pick-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--blurple);
}

.group-av {
  background: var(--blurple) !important;
  color: #fff;
}

/* ===================== DM profile panel ========================= */

.app.home.dm-open {
  grid-template-columns: 72px 240px 1fr 340px;
}

.dm-profile {
  background: var(--sidebar);
  overflow-y: auto;
}

.dm-profile[hidden] {
  display: none;
}

.dmp-banner {
  height: 100px;
  background: var(--blurple);
}

.dmp-av-wrap {
  position: relative;
  height: 0;
}

.dmp-av-wrap .avatar {
  position: absolute;
  left: 16px;
  top: -46px;
  border: 6px solid var(--sidebar);
  background: #1e1f22;
}

.dmp-body {
  padding: 56px 16px 16px;
}

.dmp-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dmp-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-hi);
}

.dmp-badges {
  display: inline-flex;
  gap: 4px;
}

.dmp-badges .badge {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.dmp-tag {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.dmp-card {
  padding: 12px;
  border-radius: 8px;
  background: #232428;
}

.dmp-section + .dmp-section {
  margin-top: 12px;
}

.dmp-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-hi);
  margin-bottom: 4px;
}

.dmp-section p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dmp-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s var(--ease);
}

.dmp-member:hover {
  background: var(--raise);
}

.dmp-member .avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.dmp-member span {
  font-size: 14px;
  color: var(--text);
}

.dmp-add {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  background: var(--blurple);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.14s var(--ease);
}

.dmp-add:hover {
  background: var(--blurple-hi);
}

.dmp-mutual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #232428;
  color: var(--text);
  font-size: 14px;
}

/* big-avatar DM intro header */
.channel-intro .avatar.xl {
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
}

.intro-tag {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 4px;
}

/* ===================== home / friends view ====================== */

.app.home {
  grid-template-columns: 72px 240px 1fr;
}

.app.home .members {
  display: none;
}

#homeNav[hidden],
#serverChannels[hidden] {
  display: none;
}

.dm-search {
  padding: 8px 2px 12px;
}

.dm-search input {
  width: 100%;
  padding: 7px 9px;
  border: none;
  border-radius: 4px;
  background: #1e1f22;
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.dm-nav.active {
  background: #404249;
  color: var(--text-hi);
}

.dm-nav-emoji {
  width: 24px;
  text-align: center;
  font-size: 18px;
}

.chat-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

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

.friends-view[hidden] {
  display: none;
}

.friends-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.friends-title {
  font-weight: 700;
  color: var(--text-hi);
}

.friends-hint {
  padding-left: 12px;
  border-left: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-dim);
}

.friends-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.friend-search {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 20px;
  border: none;
  border-radius: 4px;
  background: #1e1f22;
  color: var(--text);
  outline: none;
}

.friends-count {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-top: 1px solid var(--divider);
  cursor: pointer;
  transition: background 0.14s var(--ease);
}

.friend-row:hover {
  background: #35373c;
  border-radius: 8px;
  border-top-color: transparent;
}

.friend-info {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.friend-info strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-hi);
  font-size: 15px;
}

.friend-info small {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
}

.friend-msg {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: #2b2d31;
  font-size: 16px;
  transition: background 0.14s var(--ease), transform 0.14s var(--snap);
}

.friend-row:hover .friend-msg {
  background: #1e1f22;
}

.friend-msg:hover {
  transform: scale(1.1);
}

/* ===================== image lightbox =========================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
  animation: fade 0.18s var(--ease) both;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.24s var(--snap) both;
}

/* ===================== create server ============================ */

.server-icon-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.server-icon-pick .avatar.xl {
  font-size: 30px;
  color: var(--text-dim);
  border: 2px dashed var(--divider);
  background: #1e1f22;
}

.dmp-kick {
  margin-left: auto;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 12px;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.dmp-member:hover .dmp-kick {
  color: var(--text-hi);
}

.dmp-kick:hover {
  background: var(--red);
  color: #fff;
}

/* ===================== overflow / no-blowout ==================== */

/* Flex/grid columns must be allowed to shrink so their content scrolls
   internally instead of stretching the whole page past the viewport. */
.app > * {
  min-height: 0;
  min-width: 0;
}

.chat,
.chat-content,
.friends-view,
.messages {
  min-width: 0;
  min-height: 0;
}

.msg,
.msg-body,
.friends-body {
  min-width: 0;
  max-width: 100%;
}

.msg-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.friend-info,
.me-info,
.dmp-body {
  min-width: 0;
}

/* ===================== in-site dialog =========================== */

.dialog-card {
  padding: 20px;
}

.dialog-card h2 {
  font-size: 20px;
  color: var(--text-hi);
  margin-bottom: 8px;
}

.dialog-card p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 16px;
}

#dialogInput {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid #1e1f22;
  border-radius: 3px;
  background: #1e1f22;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

#dialogInput:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
}

#dialogInput[hidden] {
  display: none;
}

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

.dialog-actions .btn-primary,
.dialog-actions .btn-danger {
  width: auto;
  padding: 10px 18px;
}

.dialog-cancel {
  padding: 10px 16px;
  border-radius: 4px;
  color: var(--text);
  font-weight: 600;
  transition: background 0.14s var(--ease);
}

.dialog-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ===================== profile popout position ================== */

.modal-backdrop.pop {
  background: transparent;
  place-items: start;
}

.modal-backdrop.pop .profile-card {
  position: fixed;
}

/* ============================ responsive ========================== */

@media (max-width: 1000px) {
  .members {
    display: none;
  }
  .app {
    grid-template-columns: 72px 240px 1fr;
  }
}

@media (max-width: 820px) {
  .auth-card {
    flex-direction: column;
    gap: 24px;
    width: min(460px, 100%);
  }
  .auth-qr {
    width: 100%;
    border-top: 1px solid var(--divider);
    padding-top: 20px;
  }
}

@media (max-width: 640px) {
  .app {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: grid;
  }

  .avatar-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
