/* Discord-style community UI: settings screens, member list, member cards, roles, voice.
   Loaded after discord.css. Everything here is additive. */

:root {
  --d-bg: #313338; --d-side: #2b2d31; --d-dark: #1e1f22; --d-hover: #35373c; --d-sel: #404249;
  --d-text: #dbdee1; --d-head: #f2f3f5; --d-muted: #949ba4; --d-blurple: #5865f2; --d-green: #23a55a; --d-red: #f23f43;
  --d-font: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- sidebar extras ---------- */
.rail-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.sidebar.has-banner .server-banner { flex: none; height: 96px; background-size: cover; background-position: center; border-top-left-radius: 8px; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; }
.menu button:disabled { opacity: .5; cursor: default; }
.menu button:disabled:hover { background: transparent; color: #b5bac1; }
.menu button svg { flex: none; }
.userpanel .icon-action { color: #b5bac1; }
.userpanel .icon-action.on-red { color: var(--d-red); }
.userpanel .icon-action svg { display: block; }
.nav-item.voice { color: #949ba4; }
.nav-item.voice svg { flex: none; color: #80848e; }
.nav-item.voice.active { background: #404249; color: #fff; }
.voice-cat { padding-top: 8px; }
.vusers { list-style: none; margin: 0 0 4px; padding: 0 0 0 28px; }
.vuser { display: flex; align-items: center; gap: 8px; min-height: 28px; color: #b5bac1; font-size: 14px; border-radius: 4px; padding: 2px 6px; }
.vuser .avatar { width: 24px; height: 24px; font-size: 11px; transition: box-shadow .12s; }
.vuser.speaking .avatar { box-shadow: 0 0 0 2px var(--d-green); }
.vuser .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vstat { color: #f23f43; display: grid; }
.vstat svg { width: 16px; height: 16px; }
.voicepanel { flex: none; padding: 8px 10px; background: #232428; border-top: 1px solid rgba(0, 0, 0, .28); }
.vp-top { display: flex; align-items: center; gap: 8px; }
.vp-text { flex: 1; min-width: 0; }
.vp-state { color: var(--d-green); font-weight: 600; font-size: 13px; }
.vp-name { color: #b5bac1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- member list ---------- */
.members { flex: none; width: 240px; overflow-y: auto; background: var(--d-side); padding: 8px 8px 16px; border-left: 1px solid rgba(0, 0, 0, .2); font-family: var(--d-font); }
.mp-label { padding: 24px 8px 4px; color: var(--d-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.mp-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 8px; border-radius: 4px; text-align: left; color: #b5bac1; }
.mp-row:hover { background: var(--d-hover); }
.mp-row.off { opacity: .45; }
.mp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 16px; }
.mp-crown { color: #f0b132; display: grid; }
.mp-timeout { color: var(--d-muted); display: grid; }
.mp-row .avatar { position: relative; }
.mp-row .avatar .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--d-side); }
#membersBtn.on { color: #fff; }
@media (max-width: 1000px) { .members { display: none; } }

/* ---------- member card ---------- */
.mcard { position: fixed; z-index: 300; width: 300px; background: #111214; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-family: var(--d-font); color: var(--d-text); animation: dlg-in .14s ease; }
.mcard-banner { height: 60px; }
.mcard-av { position: absolute; top: 20px; left: 16px; width: 80px; height: 80px; font-size: 32px; border: 6px solid #111214; }
.mcard-av .dot { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; border: 4px solid #111214; }
.mcard-body { margin: 56px 12px 12px; padding: 12px; background: #1e1f22; border-radius: 8px; }
.mcard-name { font-size: 20px; font-weight: 700; color: var(--d-head); }
.mcard-tag { color: #f0b132; font-size: 12px; font-weight: 600; margin-top: 2px; }
.mcard-h { margin: 12px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--d-head); }
.mcard-warn { margin-top: 10px; padding: 6px 8px; border-radius: 4px; background: rgba(240, 177, 50, .12); color: #f0b132; font-size: 13px; }
.mcard-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips.grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; background: #2b2d31; border-radius: 8px; font-size: 12px; color: var(--d-text); }
.chip-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* ---------- buttons, fields ---------- */
.cbtn { padding: 8px 14px; min-height: 34px; border-radius: 3px; background: #4e5058; color: #fff; font-size: 14px; font-weight: 500; transition: background .12s, opacity .12s; font-family: var(--d-font); }
.cbtn:hover { background: #6d6f78; }
.cbtn.primary { background: var(--d-blurple); }
.cbtn.primary:hover { background: #4752c4; }
.cbtn.success { background: #248046; }
.cbtn.success:hover { background: #1a6334; }
.cbtn.danger { background: #da373c; }
.cbtn.danger:hover { background: #a12828; }
.cbtn.warn { background: #b5651d; }
.cbtn.warn:hover { background: #8f4f15; }
.cbtn.ghost { background: transparent; color: var(--d-text); }
.cbtn.ghost:hover { text-decoration: underline; background: transparent; }
.cbtn.sm { padding: 4px 10px; min-height: 28px; font-size: 13px; }
.cbtn.block { width: 100%; }
.danger-text { color: var(--d-red) !important; }
.cbtn:disabled { opacity: .5; cursor: not-allowed; }
.cfield { display: block; margin: 0 0 20px; }
.clabel { display: block; margin-bottom: 8px; color: #b5bac1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.cfield small, .cnote { display: block; margin: 4px 0 8px; color: var(--d-muted); font-size: 13px; }
.cinput { width: 100%; padding: 10px; background: #1e1f22; border: 0; border-radius: 3px; color: var(--d-text); font: 16px var(--d-font); }
.cinput:focus { outline: 2px solid var(--d-blurple); outline-offset: 0; }
textarea.cinput { resize: vertical; min-height: 90px; }
.cerror { color: var(--d-red); min-height: 18px; margin: 4px 0; font-size: 14px; }
.cfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.cfoot.left { justify-content: flex-start; margin-top: 24px; }
.crow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.crow .cinput { flex: 1; min-width: 200px; }
.ccheck { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; font-size: 15px; }
.ccheck input { width: 18px; height: 18px; accent-color: var(--d-blurple); }
.tag { padding: 1px 6px; border-radius: 4px; background: #5865f2; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.tag.warn { background: #b5651d; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.swatch { width: 52px; height: 36px; border-radius: 6px; border: 2px solid transparent; transition: transform .1s; }
.swatch:hover { transform: scale(1.06); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--d-blurple); }
.range { width: 100%; accent-color: var(--d-blurple); }

/* ---------- small modals ---------- */
.cmodal-bg { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .7); display: grid; place-items: center; animation: fade-in .12s ease; }
.cmodal { width: min(440px, 94vw); max-height: 90dvh; overflow: auto; background: var(--d-bg); color: var(--d-text); border-radius: 4px; font-family: var(--d-font); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: dlg-in .16s ease; }
.cmodal.wide { width: min(620px, 94vw); }
.cmodal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0 20px; }
.cmodal-head h2 { margin: 0; font-size: 20px; color: var(--d-head); }
.cmodal-x { color: var(--d-muted); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 4px; }
.cmodal-x:hover { color: var(--d-head); background: var(--d-hover); }
.cmodal-body { padding: 16px 20px 20px; }
.ctypes { display: grid; gap: 8px; margin-bottom: 20px; }
.ctype { display: flex; flex-direction: column; text-align: left; padding: 12px 14px; background: #2b2d31; border-radius: 6px; border: 1px solid transparent; }
.ctype strong { color: var(--d-head); }
.ctype small { color: var(--d-muted); }
.ctype:hover { background: var(--d-hover); }
.ctype.on { background: #404249; border-color: var(--d-blurple); }
.rolepick { max-height: 50dvh; overflow: auto; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- full-screen settings (server + user) ---------- */
body.fs-open { overflow: hidden; }
.fs { position: fixed; inset: 0; z-index: 250; display: flex; background: var(--d-bg); color: var(--d-text); font-family: var(--d-font); animation: fade-in .14s ease; }
.fs-nav { flex: 1 1 30%; display: flex; justify-content: flex-end; background: var(--d-side); overflow-y: auto; }
.fs-nav-in { width: 218px; padding: 60px 6px 60px 20px; }
.fs-heading { padding: 6px 10px; color: var(--d-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-label { padding: 12px 10px 4px; color: var(--d-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.fs-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 10px; margin-bottom: 2px; border-radius: 4px; text-align: left; font-size: 16px; font-weight: 500; color: #b5bac1; }
.fs-item:hover { background: var(--d-hover); color: var(--d-text); }
.fs-item.on { background: var(--d-sel); color: #fff; }
.fs-item.danger { color: var(--d-red); }
.fs-item.danger:hover { background: rgba(242, 63, 67, .12); color: var(--d-red); }
.fs-sep { border: 0; height: 1px; background: #3f4147; margin: 8px 10px; }
.fs-main { flex: 1 1 70%; position: relative; display: flex; overflow: hidden; }
.fs-content { flex: 0 1 740px; padding: 60px 10px 80px 40px; overflow-y: auto; scrollbar-width: thin; }
.fs-close { position: absolute; top: 60px; left: calc(min(740px, 100%) + 60px); display: grid; justify-items: center; gap: 4px; width: 36px; color: var(--d-muted); font-size: 13px; font-weight: 700; }
.fs-close svg { width: 36px; height: 36px; padding: 8px; border: 2px solid currentColor; border-radius: 50%; box-sizing: border-box; }
.fs-close:hover { color: var(--d-head); }
.fs-title { margin: 0 0 20px; font-size: 20px; font-weight: 700; color: var(--d-head); }
.fs-h3 { margin: 28px 0 8px; font-size: 16px; color: var(--d-head); }
.fs-sub { margin: -12px 0 20px; color: var(--d-muted); }
.fs-split { display: flex; gap: 32px; align-items: flex-start; }
.fs-split.even > * { flex: 1; }
.fs-left { flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) {
  .fs { flex-direction: column; }
  .fs-nav { flex: none; justify-content: flex-start; overflow-x: auto; }
  .fs-nav-in { display: flex; gap: 4px; width: auto; padding: 12px; align-items: center; }
  .fs-heading, .fs-label, .fs-sep { display: none; }
  .fs-item { width: auto; white-space: nowrap; margin: 0; }
  .fs-content { padding: 20px 16px 80px; }
  .fs-close { top: 10px; right: 10px; left: auto; width: 28px; }
  .fs-split { flex-direction: column; }
}

/* server profile preview */
.pv { flex: none; width: 300px; background: #1e1f22; border-radius: 8px; overflow: hidden; position: relative; padding-bottom: 14px; }
.pv-banner { height: 88px; background-size: cover; background-position: center; }
.pv-icon { position: relative; margin: -36px 0 0 16px; width: 72px; height: 72px; border-radius: 22px; border: 6px solid #1e1f22; background: var(--d-blurple); display: grid; place-items: center; font-weight: 700; font-size: 24px; color: #fff; overflow: hidden; box-sizing: content-box; width: 60px; height: 60px; }
.pv-icon img { width: 100%; height: 100%; object-fit: cover; }
.pv-name { margin: 8px 16px 0; font-weight: 700; font-size: 18px; color: var(--d-head); word-break: break-word; }
.pv-meta { margin: 2px 16px 0; color: var(--d-muted); font-size: 13px; }
.pv-desc { margin: 10px 16px 0; color: #b5bac1; font-size: 14px; word-break: break-word; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-top: 24px; background: #111214; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.savebar > span { flex: 1; font-size: 14px; }

/* lists */
.clist { display: grid; gap: 2px; margin-top: 16px; }
.crow-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; background: #2b2d31; border-radius: 4px; }
.crow-item:hover { background: #2f3136; }
.ci-ico { width: 20px; text-align: center; color: #80848e; font-weight: 700; }
.ci-name { font-weight: 600; color: var(--d-head); white-space: nowrap; }
.ci-sub { flex: 1; min-width: 0; color: var(--d-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-acts { display: flex; gap: 6px; margin-left: auto; flex: none; }
.crow-item .chips { margin-left: 8px; }
@media (max-width: 700px) { .crow-item { flex-wrap: wrap; } .ci-acts { margin-left: 0; } }

/* roles */
.roles-wrap { display: flex; gap: 24px; align-items: flex-start; }
.roles-side { flex: none; width: 200px; display: grid; gap: 2px; }
.roles-side .cbtn { margin-bottom: 8px; }
.role-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; text-align: left; color: #b5bac1; font-weight: 500; }
.role-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-item:hover { background: var(--d-hover); }
.role-item.on { background: var(--d-sel); color: #fff; }
.roles-edit { flex: 1; min-width: 0; }
.perm { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid #3f4147; }
.perm-text { flex: 1; min-width: 0; }
.perm-text strong { display: block; color: var(--d-head); font-size: 16px; }
.perm-text small { color: var(--d-muted); font-size: 13px; }
.switch { position: relative; flex: none; width: 40px; height: 24px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .knob { position: absolute; inset: 0; border-radius: 12px; background: #80848e; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: var(--d-green); }
.switch input:checked + .knob::after { transform: translateX(16px); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .knob { opacity: .5; }
@media (max-width: 700px) { .roles-wrap { flex-direction: column; } .roles-side { width: 100%; } }

/* account + voice settings */
.acct { background: #1e1f22; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.acct-banner { height: 100px; background: var(--d-blurple); }
.acct-av { margin: -40px 16px 0; width: 80px; height: 80px; font-size: 32px; border: 6px solid #1e1f22; box-sizing: content-box; width: 80px; height: 80px; }
.acct-name { margin: -48px 0 0 124px; padding-bottom: 12px; font-size: 20px; font-weight: 700; color: var(--d-head); min-height: 48px; display: flex; align-items: flex-end; }
.acct-rows { margin: 8px 16px 16px; padding: 16px; background: #2b2d31; border-radius: 8px; display: grid; gap: 16px; }
.acct-val { color: var(--d-head); font-size: 16px; }
.mictest { margin-top: 24px; }
.meter { flex: 1; height: 8px; min-width: 120px; background: #1e1f22; border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--d-green); transition: width .06s linear; }

/* Server icon stretch fix: pin the image inside its frame */
.rail-btn { overflow: hidden; }
.rail-btn.active, .rail-btn:hover { overflow: hidden; }
.rail-btn img,
.pv-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  display: block;
}
.pv-icon { position: relative; overflow: hidden; }
