/*
 * Librecord layout. Colours come from the Oldcord variables (vars.css).
 * The :root fallbacks below only apply if oldcord.css fails to load; the
 * Oldcord rules are more specific and win when present.
 */
:root {
  /* Base variables Discord itself normally defines and Oldcord builds on */
  --white-500: #fff;
  --white: #fff;
  --white-500-hsl: 0 0% 100%;
  --black-500-hsl: 0 0% 0%;
  --primary-200: #b9bbbe;
  --primary-230: #dcddde;
  --primary-400: #a3a6aa;
  --primary-300-hsl: 214 10% 70%;
  --primary-700-hsl: 216 7% 14%;
  --primary-900-hsl: 220 8% 6%;

  /* Fallbacks */
  --background-primary: #36393f;
  --background-secondary: #2f3136;
  --background-tertiary: #202225;
  --background-floating: #18191c;
  --background-modifier-accent: rgba(255, 255, 255, 0.06);
  --background-mod-subtle: rgba(79, 84, 92, 0.16);
  --background-mod-strong: rgba(79, 84, 92, 0.32);
  --message-background-hover: rgba(4, 4, 5, 0.07);
  --header-primary: #fff;
  --header-secondary: #b9bbbe;
  --text-default: #dcddde;
  --text-muted: #72767d;
  --channels-default: #8e9297;
  --interactive-text-default: #b9bbbe;
  --interactive-text-hover: #dcddde;
  --interactive-text-active: #fff;
  --brand-experiment: #7289da;
  --blurple: #7289da;
  --blurple-hover: #677bc4;
  --blurple-active: #5b6eae;
  --green: #43b581;
  --red: #f04747;
  --red-hover: #d84040;
  --input-background-default: rgba(0, 0, 0, 0.1);
  --elevation-low: 0 1px 0 rgba(4, 4, 5, 0.2), 0 1.5px 0 rgba(6, 6, 7, 0.05), 0 2px 0 rgba(4, 4, 5, 0.05);
  --elevation-high: 0 8px 16px rgba(0, 0, 0, 0.24);
  --font-primary: Whitney, "Helvetica Neue", "gg sans", Helvetica, Arial, sans-serif;
  --font-code: Consolas, "source code pro", monospace;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-primary);
  font-size: 16px;
  color: var(--text-default);
  background: var(--background-tertiary);
  -webkit-font-smoothing: antialiased;
}

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

#root {
  height: 100%;
}

/* ---------- buttons & inputs ---------- */

.btn {
  border: 0;
  border-radius: 3px;
  padding: 2px 16px;
  min-height: 38px;
  background: var(--blurple);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.17s ease;
}
.btn:hover {
  background: var(--blurple-hover);
}
.btn:active {
  background: var(--blurple-active);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.sm {
  min-height: 28px;
  padding: 2px 10px;
  font-size: 13px;
}
.btn.green {
  background: var(--green);
}
.btn.danger {
  background: var(--red);
}
.btn.danger:hover {
  background: var(--red-hover);
}
.btn.ghost {
  background: transparent;
  color: var(--interactive-text-default);
}
.btn.ghost:hover {
  background: var(--background-mod-subtle);
  color: var(--interactive-text-hover);
  text-decoration: underline;
}

.input {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  background: var(--background-tertiary);
  font-size: 16px;
  outline: none;
}
.input:focus {
  border-color: var(--brand-experiment);
}

label.field {
  display: block;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--header-secondary);
}
label.field .input {
  margin-top: 8px;
  text-transform: none;
  font-weight: 400;
}

.error {
  color: var(--red);
  font-size: 14px;
  min-height: 1.3em;
  margin: 0 0 12px;
}

/* ---------- auth ---------- */

.auth {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--background-tertiary);
}
.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  border-radius: 5px;
  background: var(--background-primary);
  box-shadow: var(--elevation-high);
}
.auth-card h1 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 24px;
  color: var(--header-primary);
}
.auth-card .sub {
  margin: 0 0 20px;
  text-align: center;
  color: var(--header-secondary);
}
.auth-card .btn {
  width: 100%;
  min-height: 44px;
}
.auth-card .switch {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-card .switch a {
  color: var(--blue-345, #00b0f4);
  cursor: pointer;
}
.notice {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 3px;
  background: var(--background-secondary);
  border-left: 4px solid var(--blurple);
  font-size: 14px;
}

/* ---------- app shell ---------- */

.app {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.guilds {
  flex: 0 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  overflow-y: auto;
  background: var(--background-tertiary);
  scrollbar-width: none;
}
.guild {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--background-primary);
  color: var(--text-default);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: border-radius 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.guild:hover,
.guild.active {
  border-radius: 16px;
  background: var(--blurple);
  color: #fff;
}
.guild.add {
  color: var(--green);
  font-size: 24px;
}
.guild.add:hover {
  background: var(--green);
  color: #fff;
}
.guild.active::before,
.guild:hover::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 8px;
  border-radius: 0 4px 4px 0;
  background: #fff;
  transform: translateY(-50%);
  height: 20px;
}
.guild.active::before {
  height: 40px;
}
.guild-sep {
  width: 32px;
  height: 2px;
  flex: none;
  border-radius: 1px;
  background: var(--background-modifier-accent);
}

.sidebar {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  background: var(--background-secondary);
  min-width: 0;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  flex: none;
  font-weight: 600;
  color: var(--header-primary);
  box-shadow: var(--elevation-low);
}
.sidebar-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channels {
  flex: 1;
  overflow-y: auto;
  padding: 16px 8px;
}
.cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 4px 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--channels-default);
}
.icon-btn {
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 18px;
  line-height: 1;
  color: var(--interactive-text-default);
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--interactive-text-hover);
}
.channel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-bottom: 2px;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  text-align: left;
  font-weight: 500;
  color: var(--channels-default);
  cursor: pointer;
}
.channel .hash {
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
}
.channel:hover {
  background: var(--background-mod-subtle);
  color: var(--interactive-text-hover);
}
.channel.active {
  background: var(--background-mod-strong);
  color: var(--interactive-text-active);
}
.channel .del {
  margin-left: auto;
  visibility: hidden;
}
.channel:hover .del {
  visibility: visible;
}

.userpanel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 52px;
  padding: 0 8px;
  background: var(--background-secondary-alt, var(--background-tertiary));
}
.userpanel .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--header-primary);
}
.userpanel a,
.userpanel button {
  font-size: 12px;
  color: var(--interactive-text-default);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 3px;
}
.userpanel a:hover,
.userpanel button:hover {
  background: var(--background-mod-subtle);
  color: var(--interactive-text-hover);
}

.avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  user-select: none;
}
.avatar.lg {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-background-default, var(--background-primary));
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 48px;
  padding: 0 16px;
  font-weight: 600;
  color: var(--header-primary);
  box-shadow: var(--elevation-low);
}
.chat-header .hash {
  font-size: 24px;
  color: var(--text-muted);
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
}
.empty {
  padding: 32px 16px;
  color: var(--text-muted);
}
.empty h2 {
  margin: 0 0 8px;
  color: var(--header-primary);
}

.msg {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 2px 48px 2px 16px;
}
.msg.first {
  margin-top: 17px;
  padding-top: 2px;
}
.msg:hover {
  background: var(--message-background-hover, var(--background-message-hover));
}
.msg .gutter {
  flex: 0 0 40px;
}
.msg .time-hover {
  display: none;
  padding-top: 4px;
  font-size: 11px;
  text-align: center;
  color: var(--text-muted);
}
.msg:hover .time-hover {
  display: block;
}
.msg .body {
  min-width: 0;
  flex: 1;
}
.msg .meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.msg .author {
  font-weight: 500;
  color: var(--header-primary);
}
.msg .time {
  font-size: 12px;
  color: var(--text-muted);
}
.msg .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.375;
}
.msg .edited {
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
}
.msg .tools {
  position: absolute;
  top: -12px;
  right: 16px;
  display: none;
  border-radius: 4px;
  background: var(--background-primary);
  box-shadow: var(--elevation-low), 0 0 0 1px var(--background-modifier-accent);
}
.msg:hover .tools {
  display: flex;
}
.msg .tools button {
  border: 0;
  background: none;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--interactive-text-default);
  cursor: pointer;
}
.msg .tools button:hover {
  background: var(--background-mod-subtle);
  color: var(--interactive-text-hover);
}
.msg .tools button.danger:hover {
  color: var(--red);
}
.msg .edit-input {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--input-background-default);
  outline: none;
}
.msg .hint {
  font-size: 12px;
  color: var(--text-muted);
}

.composer {
  flex: none;
  padding: 0 16px 24px;
}
.composer textarea {
  display: block;
  width: 100%;
  max-height: 50vh;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--background-mod-strong, rgba(79, 84, 92, 0.32));
  resize: none;
  outline: none;
  line-height: 1.375;
}
.composer .err {
  min-height: 0;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--red);
}

.members {
  flex: 0 0 240px;
  overflow-y: auto;
  padding: 24px 8px;
  background: var(--custom-channel-members-bg, var(--background-secondary));
}
.members h3 {
  margin: 0 8px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--channels-default);
}
.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  margin-bottom: 2px;
  border-radius: 4px;
  font-weight: 500;
  color: var(--channels-default);
}
.member:hover {
  background: var(--background-mod-subtle);
  color: var(--interactive-text-hover);
}
.member.offline {
  opacity: 0.4;
}
.member .dot {
  position: relative;
}
.badge {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--blurple);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
}

/* ---------- modal ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
}
.modal {
  width: 100%;
  max-width: 440px;
  border-radius: 5px;
  background: var(--background-primary);
  box-shadow: var(--elevation-high);
}
.modal-body {
  padding: 24px;
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--header-primary);
}
.modal p {
  margin: 0 0 16px;
  color: var(--header-secondary);
  font-size: 14px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-radius: 0 0 5px 5px;
  background: var(--modal-footer-background, var(--background-secondary));
}
.code {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 3px;
  background: var(--background-tertiary);
  font-family: var(--font-code);
  user-select: all;
}

/* ---------- admin ---------- */

.admin {
  display: flex;
  height: 100%;
}
.admin-nav {
  flex: 0 0 220px;
  padding: 24px 8px;
  background: var(--background-secondary);
}
.admin-nav h1 {
  margin: 0 10px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--channels-default);
}
.admin-nav .channel {
  padding: 6px 10px;
}
.admin-nav .sep {
  height: 1px;
  margin: 8px 10px;
  background: var(--background-modifier-accent);
}
.admin-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--background-primary);
}
.admin-main h2 {
  margin: 0 0 20px;
  color: var(--header-primary);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.stat {
  padding: 16px;
  border-radius: 5px;
  background: var(--background-secondary);
}
.stat b {
  display: block;
  font-size: 28px;
  color: var(--header-primary);
}
.stat span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--channels-default);
}
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.toolbar .input {
  max-width: 320px;
}
.table-wrap {
  overflow-x: auto;
  border-radius: 5px;
  background: var(--background-secondary);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--channels-default);
}
td {
  padding: 8px 12px;
  border-top: 1px solid var(--background-modifier-accent);
  vertical-align: middle;
}
td.content {
  max-width: 420px;
  overflow-wrap: anywhere;
}
td.actions {
  white-space: nowrap;
  text-align: right;
}
td.actions .btn {
  margin-left: 6px;
}
.pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--background-mod-strong);
  font-size: 11px;
}
.pill.ok {
  background: var(--green);
  color: #fff;
}
.pill.bad {
  background: var(--red);
  color: #fff;
}
.settings-form {
  max-width: 520px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.saved {
  margin-left: 12px;
  color: var(--green);
  font-size: 14px;
}

@media (max-width: 980px) {
  .members {
    display: none;
  }
}
@media (max-width: 700px) {
  .sidebar {
    flex-basis: 180px;
  }
  .admin {
    flex-direction: column;
  }
  .admin-nav {
    flex-basis: auto;
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
  }
  .admin-nav h1 {
    display: none;
  }
  .admin-main {
    padding: 16px;
  }
}

/* ---------- captcha ---------- */

.captcha {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.captcha-img {
  display: block;
  border-radius: 3px;
  background: #202225;
  max-width: 100%;
  height: auto;
}
.field .input {
  letter-spacing: 0.15em;
}

/* ---------- homepage ---------- */

.home-body {
  background: var(--background-tertiary);
  overflow-y: auto;
}
.btn.lg {
  min-height: 52px;
  padding: 2px 28px;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 28px;
}
a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.home-banner {
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  background: var(--blurple);
}
.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
}
.home-nav nav {
  display: flex;
  gap: 8px;
}
.home-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--header-primary);
  text-decoration: none;
}
.logo-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--blurple);
  color: #fff;
  font-size: 20px;
}
.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 24px 56px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.1;
  color: var(--header-primary);
}
.hero p {
  max-width: 600px;
  margin: 0 auto 28px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--header-secondary);
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.hero-cta .btn.ghost {
  background: var(--background-secondary);
}
.hero-cta .closed {
  padding: 14px 20px;
  border-radius: 28px;
  background: var(--background-secondary);
  color: var(--text-muted);
}
.hero .hero-stats {
  margin: 28px auto 0;
  font-size: 14px;
  color: var(--text-muted);
}
.hero-stats b {
  color: var(--header-primary);
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 56px;
}
.feature {
  padding: 24px;
  border-radius: 12px;
  background: var(--background-secondary);
}
.feature-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--blurple);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.feature h3 {
  margin: 0 0 8px;
  color: var(--header-primary);
}
.feature p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--header-secondary);
}
.home-final {
  max-width: 700px;
  margin: 0 auto 56px;
  padding: 40px 24px;
  border-radius: 16px;
  text-align: center;
  background: var(--background-primary);
}
.home-final h2 {
  margin: 0 0 20px;
  color: var(--header-primary);
}
.home-footer {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- profiles ---------- */

img.avatar { object-fit: cover; background: var(--background-secondary); }
.avatar.xl { width: 80px; height: 80px; font-size: 32px; }
.clickable, .member { cursor: pointer; }
.msg .author.clickable:hover { text-decoration: underline; }
.userpanel .name.clickable:hover { text-decoration: underline; }

.modal.profile-modal { max-width: 340px; overflow: hidden; }
.modal.profile-modal .modal-body { padding: 0 0 4px; }
.profile-banner { height: 60px; }
.profile-head { padding: 0 16px; margin-top: -46px; }
.profile-head .avatar { box-sizing: content-box; border: 6px solid var(--background-primary); }
.profile-name { display: flex; align-items: center; gap: 8px; padding: 8px 16px 0; font-size: 20px; font-weight: 700; color: var(--header-primary); word-break: break-word; }
.profile-sec { margin: 12px 16px 0; padding: 12px; border-radius: 4px; background: var(--background-secondary); }
.profile-sec h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; color: var(--header-secondary); }
.profile-sec div { font-size: 14px; white-space: pre-wrap; word-break: break-word; color: var(--header-secondary); }

.edit-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.edit-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.edit-btns .hint { flex-basis: 100%; font-size: 12px; color: var(--header-secondary); }
textarea.input { resize: vertical; font-family: inherit; }

/* ---------- server customisation ---------- */

.guild { background: var(--guild-color, var(--background-primary)); }
.guild:hover, .guild.active { background: var(--guild-color, var(--blurple)); }
.guild.add { background: var(--background-primary); }
.guild.add:hover { background: var(--green); }
.guild-icon { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.guild::before { pointer-events: none; }
.guild { overflow: visible; }
.guild-icon { border-radius: inherit; }
.avatar.square { border-radius: 16px; }
.header-tools { display: flex; gap: 4px; flex: none; }
.color-input { width: 64px; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; }
.field .code { display: block; margin: 6px 0 8px; }
.modal-foot { align-items: center; }

/* ---------- animated background (homepage + login) ----------
 * Put the GIF at public/img/bg.gif. If it's missing the dark colour shows.
 * A dark gradient on top keeps text readable and fades the edges into the page colour. */
.home-body, .auth { position: relative; isolation: isolate; }
.home-body::before, .auth::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(32, 34, 37, 0.35), rgba(32, 34, 37, 0.7)),
    var(--bg-url, none) center / cover no-repeat,
    var(--background-tertiary);
}
.hero h1, .hero p { text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.home-body { background: var(--background-tertiary); }
.auth { background: transparent; }
.feature, .home-final {
  background: rgba(47, 49, 54, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--background-modifier-accent);
}
.auth-card { background: rgba(54, 57, 63, 0.88); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
@media (prefers-reduced-motion: reduce) {
  .home-body::before, .auth::before { background: linear-gradient(rgba(32,34,37,.8), var(--background-tertiary)), var(--background-tertiary); }
}

/* ---------- roles & moderation ---------- */

.role-dot { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%; }
.role-pill { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 4px 0; padding: 2px 8px; border-radius: 12px; background: var(--background-tertiary); font-size: 12px; color: var(--header-primary); }
.role-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; cursor: pointer; color: var(--header-primary); }
.mod-h { margin: 12px 0 8px; font-size: 12px; text-transform: uppercase; color: var(--header-secondary); }
.mod-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.mod-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; background: var(--background-secondary); }
.mod-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--header-primary); }
label.perm { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; color: var(--header-primary); }
label.perm .hint { color: var(--header-secondary); font-size: 12px; }
.modal-body { max-height: 75vh; overflow-y: auto; }
.member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feature-icon { background: none; }
.feature-icon img { width: 100%; height: 100%; border-radius: 12px; display: block; }

/* ---------- friends ---------- */

.guild.friends-btn { font-size: 22px; }
.fa-icon { display: inline-flex; width: 1.15em; height: 1em; }
.fa-icon svg { width: 100%; height: 100%; }
.count-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  border: 3px solid var(--background-tertiary);
  box-sizing: content-box;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}
.count-badge.inline { position: static; display: inline-block; margin-left: 6px; border: 0; height: 16px; line-height: 16px; min-width: 16px; vertical-align: middle; }

.modal.friends-modal { max-width: 520px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--background-modifier-accent); }
.tab { border: 0; border-radius: 4px; padding: 4px 12px; background: none; font-size: 14px; font-weight: 500; color: var(--interactive-text-default); cursor: pointer; }
.tab:hover { background: var(--background-mod-subtle); color: var(--interactive-text-hover); }
.tab.active { background: var(--background-mod-strong, rgba(79, 84, 92, 0.32)); color: #fff; }
.tab.add { margin-left: auto; background: var(--green); color: #fff; }
.tab.add:hover { background: #3ca374; }
.tab.add.active { background: none; color: var(--green); }

.friends-content { min-height: 120px; max-height: 50vh; overflow-y: auto; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 4px; border-radius: 4px; background: var(--background-secondary); }
.friend-row:hover { background: var(--background-mod-subtle); }
.friend-info { flex: 1; min-width: 0; }
.friend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--header-primary); }
.friend-info .hint, .empty-hint { font-size: 12px; color: var(--header-secondary); }
.empty-hint { margin: 24px 0; text-align: center; }
.add-friend { display: flex; gap: 8px; }
.success { min-height: 18px; margin: 8px 0 0; font-size: 13px; color: var(--green); }
.friend-slot { display: inline-flex; gap: 8px; }

/* ---------- @mentions ---------- */

.mention { padding: 0 2px; border-radius: 3px; background: rgba(114, 137, 218, 0.3); color: #dee0fc; font-weight: 500; cursor: pointer; }
.mention:hover { background: rgba(114, 137, 218, 0.8); color: #fff; }
.mention.me { background: rgba(250, 166, 26, 0.3); color: #ffd9a0; }
.mention.me:hover { background: rgba(250, 166, 26, 0.75); color: #fff; }
.msg.mentioned { background: rgba(250, 166, 26, 0.08); box-shadow: inset 3px 0 0 #faa61a; }
.msg.mentioned:hover { background: rgba(250, 166, 26, 0.12); }

.composer-box { position: relative; }
.mention-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; padding: 8px; border-radius: 6px; background: var(--background-tertiary); box-shadow: var(--elevation-high); max-height: 300px; overflow-y: auto; }
.mention-pop[hidden] { display: none; }
.mention-head { padding: 4px 8px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--header-secondary); }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 4px; cursor: pointer; color: var(--header-primary); }
.mention-item.active, .mention-item:hover { background: var(--background-mod-strong, rgba(79, 84, 92, 0.4)); }
.mention-item .avatar { width: 24px; height: 24px; font-size: 12px; }
.mention-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mention-item .hint { font-size: 12px; color: var(--green); }
.channel .count-badge.inline { margin-left: auto; border: 0; flex: none; }
.channel .count-badge.inline + .del { margin-left: 6px; }

/* ---------- v11: statuses, DMs, unread, typing, topics, nicknames ---------- */

/* status dots on avatars */
.av-wrap { position: relative; display: inline-flex; flex: none; }
.status-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid var(--background-secondary);
  box-sizing: content-box;
  background: #747f8d;
  pointer-events: auto;
}
.status-dot.online { background: #43b581; }
.status-dot.idle { background: #faa61a; }
.status-dot.dnd { background: #f04747; }
.status-dot.offline { background: #747f8d; }
.av-wrap.lg .status-dot { width: 12px; height: 12px; }
.av-wrap.xl .status-dot { width: 16px; height: 16px; right: 0; bottom: 0; border-width: 5px; border-color: var(--background-primary); }
.userpanel .status-dot { border-color: var(--background-secondary-alt, var(--background-tertiary)); }
.members .status-dot { border-color: var(--custom-channel-members-bg, var(--background-secondary)); }
.friend-row .status-dot { border-color: var(--background-secondary); }
.status-dot.inline { position: static; display: inline-block; border: 0; width: 10px; height: 10px; flex: none; }
.member.offline .status-dot { display: none; }

/* member list: nickname + custom status line */
.member-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.member-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; color: var(--header-secondary); }

/* user panel */
.userpanel .name-wrap { flex: 1; min-width: 0; line-height: 1.2; }
.userpanel .name-wrap .name { flex: none; }
.userpanel .name-wrap .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--header-secondary); }
.userpanel .name-wrap .sub:hover { text-decoration: underline; }
.userpanel .av-wrap.clickable { cursor: pointer; }

/* status popover */
.status-pop {
  position: fixed;
  left: 80px;
  bottom: 60px;
  z-index: 60;
  width: 250px;
  padding: 6px;
  border-radius: 6px;
  background: var(--background-tertiary);
  box-shadow: var(--elevation-high);
}
.status-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 3px;
  background: none;
  text-align: left;
  color: var(--interactive-text-default);
  font-size: 14px;
  cursor: pointer;
}
.status-opt b { font-weight: 600; color: var(--header-primary); }
.status-opt .hint { display: block; font-size: 12px; color: var(--text-muted); }
.status-opt:hover { background: var(--blurple); }
.status-opt:hover b, .status-opt:hover .hint { color: #fff; }
.status-opt.active b { color: var(--blurple); }
.status-opt.active:hover b { color: #fff; }
.status-sep { height: 1px; margin: 4px 6px; background: var(--background-modifier-accent); }
.status-emoji { width: 10px; display: inline-flex; justify-content: center; }

/* unread markers (white = unread, like classic Discord) */
.channel { position: relative; }
.channel .ch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel.unread { color: var(--interactive-text-active, #fff); font-weight: 600; }
.channel.unread::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: #fff;
  transform: translateY(-50%);
}
.channel .del + .del { margin-left: 4px; }
.channel .del.edit { font-size: 14px; }
.guild.unread:not(.active):not(:hover)::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: #fff;
  transform: translateY(-50%);
}

/* home view: Friends link + DM list */
.channel.home-link { gap: 12px; padding: 8px; font-size: 15px; }
.channel.home-link .fa-icon { width: 22px; font-size: 18px; }
.channel.dm-row { gap: 12px; padding: 5px 8px; }
.dm-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.dm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; color: var(--header-secondary); }
.channel.dm-row .count-badge.inline { margin-left: auto; }
.dm-empty { padding: 4px 8px; font-size: 13px; color: var(--text-muted); }
.guild.dm-guild { background: none; padding: 0; overflow: visible; }
.guild.dm-guild .avatar { width: 48px; height: 48px; border-radius: 50%; font-size: 18px; transition: border-radius 0.15s ease; }
.guild.dm-guild:hover .avatar { border-radius: 16px; }
.app.home .members { display: none; }
.friends-page { max-width: 760px; padding: 0 20px; }
.empty.dm-start .avatar { margin-bottom: 12px; }
.empty.dm-start h2 { margin-top: 0; }

/* channel header topic */
.chat-header { min-width: 0; }
.chat-header .topic {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--background-modifier-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 400;
  color: var(--header-secondary);
}
.chat-header .header-edit { margin-left: auto; font-size: 13px; }
.chat-header .hash .fa-icon { font-size: 20px; }

/* typing indicator under the composer */
.composer { padding-bottom: 4px; }
.composer[hidden] { display: none; }
.typing { display: flex; align-items: center; gap: 4px; height: 20px; padding: 0 2px; overflow: hidden; white-space: nowrap; font-size: 13px; color: var(--text-default); }
.typing b { font-weight: 700; color: var(--header-primary); }
.typing-dots { display: inline-flex; gap: 3px; margin-right: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--header-primary); opacity: 0.3; animation: typing-blink 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }

/* profile extras */
.profile-custom { padding: 2px 16px 0; font-size: 14px; color: var(--header-secondary); word-break: break-word; }
.profile-sec .nick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--header-primary); }
.mention-user { font-weight: 400; }
.userpanel { gap: 4px; }
.userpanel .av-wrap { margin-right: 4px; }
.userpanel .name-wrap { min-width: 44px; }
.userpanel a, .userpanel button { padding: 4px 3px; }
.userpanel a, .userpanel button { white-space: nowrap; }
