/* Visby CF Extra Bold */
@font-face {
  font-family: 'Visby CF';
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: local('Visby CF Extra Bold'), local('VisbyCF-ExtraBold'), url('fonts/VisbyCF-ExtraBold.ttf') format('truetype');
}

:root {
  --black: #000000; --white: #FFFFFF;
  --g1: #111111; --g2: #1c1c1c; --g3: #2c2c2c; --text: #e0e0e0; --line: #222;
  --brand: 'Visby CF', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --body: 'Visby CF', 'Visby CF Extra Bold', sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--black); color: var(--text); font: 800 15px/1.5 var(--body); }
h1, h2, h3, .brand { font-family: var(--brand); font-weight: 800; color: var(--white); }
.brand { font-weight: 900; letter-spacing: -.02em; font-size: 40px; }
.brand.sm { font-size: 24px; padding: 4px 8px 14px; }
.muted { color: #8a8a8a; font-size: 13px; }
.error { color: var(--white); font-size: 13px; min-height: 18px; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

/* Buttons: white fill / black text, inverts on hover */
.btn { background: var(--white); color: var(--black); border: 1px solid var(--white); padding: 10px 18px; font: 800 14px var(--brand); cursor: pointer; transition: background .15s, color .15s; }
@media (hover:hover){.btn:hover { background: var(--black); color: var(--white); }}
.btn:active { background: var(--black); color: var(--white); }
.btn:focus:not(:focus-visible){outline:none}
.btn:disabled{opacity:.5;cursor:default}
.btn.ghost { background: var(--black); color: var(--white); border-color: var(--g3); }
@media (hover:hover){.btn.ghost:hover { background: var(--white); color: var(--black); }}
.btn.ghost:active { background: var(--white); color: var(--black); }
.btn.sm { padding: 6px 14px; }
.icon { background: none; border: 0; color: var(--text); cursor: pointer; padding: 8px; font-size: 16px; }
.icon:hover { color: var(--white); }
input, textarea { background: var(--g1); color: var(--white); border: 1px solid var(--g3); padding: 10px 12px; font: inherit; width: 100%; resize: none; }
input:focus, textarea:focus { outline: none; border-color: var(--white); }


/* Post-auth loading screen */
.app-loading { position: fixed; inset: 0; z-index: 9999; background: var(--black); display: grid; place-items: center; padding: 24px; }
.app-loading-inner { display: grid; justify-items: center; gap: 18px; text-align: center; }
.app-loading-logo { width: min(78vw, 460px); height: auto; display: block; }
.app-loading-text { color: var(--white); font: 800 15px var(--body); letter-spacing: .02em; min-width: 92px; }
.app-loading-text::after { content: ''; display: inline-block; width: 18px; text-align: left; animation: loading-dots 1.2s steps(4,end) infinite; }
@keyframes loading-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } 100% { content: ''; } }
.whats-new-tab { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 13px; }
.whats-new-list { display: grid; gap: 18px; }
.whats-new-entry { border: 1px solid var(--line); background: var(--g1); padding: 14px; }
.whats-new-entry h3 { font-size: 16px; margin-bottom: 8px; }
.whats-new-entry ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.whats-new-entry li { color: var(--text); }
@media (max-width:760px) { .app-loading-logo { width: min(82vw, 360px); } .app-loading-inner { gap: 16px; } }

/* Auth */
.auth { position: fixed; inset: 0; background: var(--black); display: grid; place-items: center; z-index: 10; padding: 16px; }
.auth-box { width: 100%; max-width: 360px; display: grid; gap: 10px; }

/* Layout */
.app { display: grid; grid-template-columns: 72px 248px minmax(0, 1fr) 320px; height: 100vh; }
.servers { border-right: 1px solid var(--line); background: var(--black); padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; overflow-y: auto; }
.srv { width: 48px; height: 48px; border: 1px solid var(--g3); border-radius: 50%; background: var(--g1); color: var(--white); font: 800 16px var(--brand); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; overflow: hidden; }
.srv img{width:100%;height:100%;object-fit:cover;display:block;min-width:0;min-height:0;border-radius:inherit;}

.srv:hover, .srv.active { background: var(--white); color: var(--black); }
.sidebar { border-right: 1px solid var(--line); background: var(--g1); padding: 14px 10px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.tabs, #channels { display: grid; gap: 2px; }
.tab, .chan { background: none; border: 0; color: var(--text); text-align: left; padding: 9px 10px; font: 800 15px var(--body); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.tab:hover, .chan:hover { background: var(--g2); color: var(--white); }
.tab.active, .chan.active { background: var(--white); color: var(--black); }
.section-title { font-size: 14px; padding: 8px 10px; border-top: 1px solid var(--line); }
.pill { background: var(--white); color: var(--black); font: 800 11px var(--brand); padding: 1px 7px; margin-left: auto; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.me .who { flex: 1; min-width: 0; line-height: 1.2; }
.me .who b { display: block; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto; }
#view-channel { overflow: hidden; }
.bar { position: sticky; top: 0; z-index: 2; background: var(--black); border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.bar h2 { font-size: 20px; }
.menu-btn { display: none; }
.right { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; display: grid; align-content: start; gap: 14px; }
.right > div { display: grid; gap: 14px; }
.search { position: relative; }
.search i { position: absolute; left: 12px; top: 13px; color: #777; }
.search input { padding-left: 34px; }
.card { border: 1px solid var(--line); background: var(--g1); padding: 12px; }
.card h3 { font-size: 17px; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.row .grow { flex: 1; min-width: 0; }
.row b { color: var(--white); }
.tag { cursor: pointer; display: block; padding: 5px 0; }
.tag:hover b { text-decoration: underline; }

/* Avatars & presence */
.avatar { width: 40px; height: 40px; flex: none; background: var(--white); color: var(--black); display: grid; place-items: center; font: 800 16px var(--brand); position: relative; border-radius: 50%; }
.dot { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border: 2px solid var(--g1); background: var(--white); }
.dot.idle { background: var(--black); border-color: var(--white); }
.dot.offline { background: var(--g3); }

/* Feed */
.composer { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.composer-body { flex: 1; }
.composer textarea { background: transparent; border: 0; border-bottom: 1px solid var(--g3); font-size: 17px; padding: 8px 0; }
.composer-foot { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 10px; }
.composer-foot .composer-tools { margin-right: auto; }
.composer-foot .attach-menu { top: calc(100% + 6px); bottom: auto; }
.post { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.post:hover { background: var(--g1); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; gap: 8px; align-items: baseline; }
.post-head b { color: var(--white); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 8px; }
.hash { color: var(--white); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; gap: 22px; }
.act { background: none; border: 0; color: #8a8a8a; cursor: pointer; font: 800 13px var(--body); display: flex; gap: 6px; align-items: center; padding: 4px 0; }
.act:hover, .act.on { color: var(--white); }
.act.on i { font-weight: 900; }
.thread { margin-top: 10px; border-left: 1px solid var(--g3); padding-left: 12px; display: grid; gap: 10px; }
.reply-box { display: flex; gap: 8px; }
.reply-box input { padding: 7px 10px; }
.empty { padding: 40px 16px; text-align: center; color: #777; }

/* Channel chat */
.messages { flex: 1; overflow-y: auto; padding: 12px 0; }
.msg { display: flex; gap: 12px; padding: 6px 16px; position: relative; }
.msg:hover { background: var(--g1); }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-head b { color: var(--white); }
.badge { border: 1px solid var(--white); color: var(--white); font: 800 10px var(--brand); padding: 0 6px; text-transform: lowercase; }
.msg-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-tools { position: absolute; right: 16px; top: -4px; display: none; background: var(--black); border: 1px solid var(--g3); }
.msg:hover .msg-tools { display: flex; }
.msgbox { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; }


.music-player{display:flex;align-items:center;gap:10px;margin-top:8px;padding:9px 10px;background:var(--g1);border:1px solid var(--g3);max-width:520px}.music-player>.icon{flex:0 0 32px;width:32px;height:32px;padding:0}.music-main{min-width:0;flex:1;display:grid;gap:4px}.music-title{font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.music-progress{width:100%;accent-color:var(--white);height:4px}.music-times{display:flex;justify-content:space-between;color:#777;font:10px var(--body)}.music-volume{color:#aaa}.music-player:hover{border-color:#777}.msgbox input[type="text"],.msgbox input:not([type]){min-width:0}.msgbox #msg-text{flex:1}.msgbox #btn-music{margin-left:2px}

/* Profile */
.profile-head { padding: 20px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.profile-head .avatar { width: 72px; height: 72px; font-size: 30px; }
.profile-head h3 { font-size: 24px; }
.profile-actions { display: flex; gap: 8px; }.profile-theme-editor{border:1px solid var(--g3);background:var(--g1);padding:12px;display:grid;gap:10px}.profile-theme-title{font:800 14px var(--brand);color:var(--white)}.profile-theme-colors{display:grid;grid-template-columns:1fr 1fr;gap:10px}.profile-theme-colors label{min-width:0}.profile-theme-colors input[type=color]{width:100%;height:42px;padding:4px;cursor:pointer}.profile-theme-editor input[type=range]{accent-color:var(--white)}.profile-theme-preview{height:70px;border:1px solid var(--g3);border-radius:8px;background:#090909;box-shadow:inset 0 0 0 1px rgba(255,255,255,.04)}


.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--white); color: var(--black); padding: 10px 18px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Responsive */
@media (max-width: 1100px) { .app { grid-template-columns: 72px 232px minmax(0, 1fr); } .right { display: none; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .sidebar { position: fixed; left: 64px; top: 0; bottom: 0; width: 248px; z-index: 5; transform: translateX(-120%); transition: transform .2s; }
  body.drawer .sidebar { transform: none; }
  .menu-btn { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* POLO2XYZ feature overlays — preserves the files(2).zip visual language */
.server-head{display:flex;align-items:center;border-top:1px solid var(--line)}
.server-head .section-title{flex:1;border-top:0}
.channel-group{padding:4px 0 8px}
.channel-group-title{display:flex;align-items:center;justify-content:space-between;color:#8a8a8a;text-transform:uppercase;font:800 10px var(--brand);padding:7px 10px;letter-spacing:.08em}
.channel-group-title button{font-size:12px;padding:3px}
.chan-tools{margin-left:auto;display:none}.chan:hover .chan-tools{display:block}
.manage-grid{display:grid;gap:10px}.manage-row{border:1px solid var(--line);padding:10px;background:var(--g1);display:flex;gap:10px;align-items:center}.manage-row .grow{flex:1;min-width:0}
.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:18px}.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.78)}.modal-card{position:relative;width:min(560px,96vw);max-height:90vh;overflow:auto;background:var(--black);border:1px solid var(--g3);box-shadow:0 20px 80px #000;padding:0}.modal-head{position:sticky;top:0;z-index:2;background:var(--black);border-bottom:1px solid var(--line);padding:14px 16px;display:flex;align-items:center;justify-content:space-between}.modal-head h2{font-size:20px}.modal-body{display:grid;gap:12px;padding:16px}.modal-body label{display:grid;gap:6px;font-size:12px;color:#aaa;font-weight:700}.modal-body textarea{min-height:90px}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.media-preview{width:100%;height:130px;object-fit:cover;border:1px solid var(--g3);background:var(--g1)}.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;max-height:260px;overflow:auto}.emoji-pick{border:1px solid transparent;background:var(--g1);font-size:22px;aspect-ratio:1;cursor:pointer}.emoji-pick:hover{border-color:var(--white);background:var(--g2)}.emoji-img{width:24px;height:24px;object-fit:contain;vertical-align:middle}.composer-tools{display:flex;align-items:center;gap:8px}.composer-tools .icon{padding:5px}.poll-option{display:flex;gap:6px}.poll-option input{flex:1}.profile-banner{width:100%;height:150px;object-fit:cover;background:var(--g1);border:1px solid var(--line)}
.profile-banner-empty{background:transparent!important;border-color:transparent!important;}.profile-large-avatar{width:88px;height:88px;border:2px solid var(--white);object-fit:cover;background:var(--white)}.poll-card{border:1px solid var(--g3);padding:12px;margin:8px 0;display:grid;gap:8px}.poll-choice{background:var(--g1);border:1px solid var(--g3);color:var(--white);padding:9px;text-align:left;cursor:pointer}.poll-choice:hover{border-color:var(--white)}.poll-bar{height:5px;background:var(--g3);overflow:hidden}.poll-fill{height:100%;background:var(--white)}
.avatar img,.me .avatar img{width:100%;height:100%;object-fit:cover;display:block;border-radius:50%}.profile-large-avatar{border-radius:50%;overflow:hidden}.modal-card select{background:var(--g1);color:var(--white);border:1px solid var(--g3);padding:10px 12px;font:inherit}.btn:disabled{opacity:.35;cursor:not-allowed}.btn:disabled:hover{background:var(--white);color:var(--black)}

.attach-wrap{position:relative;flex:0 0 auto}.attach-btn{width:34px;height:34px;padding:0}.attach-menu{position:absolute;left:0;bottom:42px;z-index:30;min-width:165px;background:var(--black);border:1px solid var(--g3);box-shadow:0 14px 40px #000;padding:6px}.attach-menu button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;color:var(--white);padding:10px 11px;text-align:left;cursor:pointer;font:600 13px var(--body)}.attach-menu button:hover{background:var(--g1)}.attach-menu i{width:18px;text-align:center;color:#aaa}.attach-menu button:hover i{color:var(--white)}
.media-card{margin-top:8px;max-width:520px;border:1px solid var(--g3);background:var(--g1);overflow:hidden}.media-card img,.media-card video{display:block;width:100%;max-height:360px;object-fit:contain;background:#000}.media-card .media-caption{padding:8px 10px;font-size:12px;color:#aaa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.member-context{position:fixed;z-index:150;min-width:175px;background:var(--black);border:1px solid var(--g3);box-shadow:0 18px 50px #000;padding:5px}.member-context button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;color:var(--white);padding:9px 10px;text-align:left;cursor:pointer;font:600 13px var(--body)}.member-context button:hover{background:var(--g1)}.member-context button i{width:16px;color:#aaa}.member-context .context-title{padding:7px 10px 8px;border-bottom:1px solid var(--line);margin-bottom:4px;font:800 12px var(--brand);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.member-row{cursor:context-menu}.member-row:hover{background:var(--g1)}
.modal-auth-switch{display:flex;gap:8px;margin:4px 0 2px}.modal-auth-switch .btn{flex:1}

.media-embed{margin-top:8px;max-width:520px;border:1px solid var(--g3);background:var(--black);overflow:hidden}.media-embed img{display:block;max-width:100%;max-height:420px;width:auto;height:auto}.media-embed video{display:block;width:100%;max-height:420px;background:#000}/* Desktop only: keep the image/GIF frame snug to the media, not the post width.
   Retain original mobile media styling and existing video player. */
@media (min-width:761px){
  .media-embed.image-embed{display:table;width:auto;max-width:min(520px,100%);border:0;background:transparent;overflow:visible}
  .image-embed img{object-fit:contain;max-width:100%;max-height:420px;width:auto;height:auto;border:1px solid var(--g3);box-sizing:border-box}
}
.video-embed{border-radius:2px}

/* Exact polo2. Broadcast logo sizing */
.brand-lockup{display:flex;align-items:center;gap:7px;min-width:0;flex:0 0 auto;}
.app-version{font:800 12px/1 var(--body);color:#8a8a8a;white-space:nowrap;letter-spacing:-.01em;}
.brand-logo {
  display: block;
  object-fit: contain;
  object-position: left center;
}
.brand-logo-auth {
  display: block;
  width: 340px;
  max-width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  object-position: left center;
  margin: 0 0 18px 0;
}
.brand-logo-sidebar {
  display: block;
  width: 150px !important;
  min-width: 150px;
  max-width: 150px !important;
  height: 44px !important;
  max-height: 44px !important;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 44px;
  margin: 0 0 0 0;
}
@media (max-width: 700px) {
  .brand-logo-auth {
    width: min(340px, 100%);
    max-height: 105px;
  }
  .brand-logo-sidebar {
    width: 125px !important;
    min-width: 125px;
    max-width: 125px !important;
    height: 37px !important;
    max-height: 37px !important;
    flex-basis: 37px;
  }
}

/* Direct messages */
.dm-layout{display:grid;grid-template-columns:minmax(210px,280px) minmax(0,1fr);height:calc(100vh - 58px);min-height:420px}.dm-list{border-right:1px solid var(--line);overflow:auto}.dm-list-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--black);z-index:1}.dm-row{width:100%;display:flex;gap:10px;align-items:center;padding:10px 12px;background:transparent;color:var(--white);border:0;border-bottom:1px solid var(--line);text-align:left;cursor:pointer}.dm-row:hover,.dm-row.active{background:var(--g1)}.dm-row .grow{min-width:0}.dm-row .grow b,.dm-row .muted{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dm-chat{display:flex;flex-direction:column;min-width:0}.dm-chat-head{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line);min-height:52px}.dm-chat-head .avatar{flex:0 0 34px;width:34px;height:34px}.dm-messages{flex:1;overflow-y:auto;padding:12px 0}.dm-msg{display:flex;gap:10px;padding:7px 14px}.dm-msg:hover{background:var(--g1)}.dm-msg .avatar{flex:0 0 34px;width:34px;height:34px}.dm-compose{display:flex;gap:8px;padding:12px 14px;border-top:1px solid var(--line)}.dm-compose input{flex:1;min-width:0}.dm-user-pick{width:100%;border:1px solid var(--line);background:var(--g1);color:var(--white);padding:9px;cursor:pointer;text-align:left}.dm-user-pick:hover{border-color:var(--white)}
@media (max-width:760px){.dm-layout{grid-template-columns:1fr}.dm-list{max-height:38vh;border-right:0;border-bottom:1px solid var(--line)}.dm-chat{min-height:55vh}}

.profile-link,.profile-click-avatar,[data-profile-uid]{cursor:pointer}.profile-link:hover{text-decoration:underline}.profile-identity{display:flex;align-items:center;gap:14px}.profile-identity h3{margin:0;display:flex;align-items:center;flex-wrap:wrap;gap:7px;line-height:1.15;min-width:0}.profile-badges{flex-wrap:wrap;min-width:0;max-width:100%}.notification-actions{display:flex;gap:7px;margin-top:8px}.profile-actions{flex-wrap:wrap}
@media (max-width:760px){.app{grid-template-columns:52px minmax(0,1fr)}.servers{padding-top:8px}.srv{width:40px;height:40px}.sidebar{left:52px;width:min(86vw,280px)}.bar{padding:10px 12px}.composer,.post{padding-left:12px;padding-right:12px}.msgbox,.dm-compose{padding:9px 10px}.profile-head{padding:12px}.profile-banner{height:105px}.profile-large-avatar{width:72px;height:72px}.profile-identity{align-items:flex-start}.profile-identity>div:last-child{min-width:0}.profile-identity h3{gap:6px}.profile-actions .btn{flex:1;min-width:105px}.modal{padding:8px}.modal-card{width:100%;max-height:94vh}.dm-layout{height:calc(100vh - 52px)}.dm-list{max-height:32vh}.dm-compose input{font-size:16px}.dm-compose .btn{padding:7px 10px}.post-head{flex-wrap:wrap}.actions{gap:14px}}
@media (max-width:430px){.brand-logo-sidebar{width:115px!important;min-width:115px;max-width:115px!important}.sidebar{padding:10px 8px}.me{padding:8px}.me .who{font-size:13px}.avatar{width:36px;height:36px}.post,.msg{gap:8px}.dm-chat-head{padding:8px 10px}}


.admin-badge.custom-badge{width:22px;height:22px;min-width:22px;min-height:22px;padding:0;border-radius:50%;vertical-align:middle;overflow:hidden;flex:0 0 22px}
.admin-badge.custom-badge img{width:100%;height:100%;object-fit:contain;display:block}
.admin-badge.custom-badge.badge-image-error{font-size:10px}
.admin-badge-form{display:grid;grid-template-columns:1fr 1.4fr;gap:12px;align-items:end}
.admin-badge-form label{margin:0}
.admin-badge-form .modal-actions{grid-column:1/-1;margin-top:0}
.admin-badge-preview-wrap{display:flex;align-items:center;gap:10px;min-height:42px}
.custom-badge-preview{min-width:42px;justify-content:center}
.custom-badge-preview img{width:20px;height:20px;object-fit:contain}
.admin-custom-badges{display:flex;flex-direction:column;gap:8px}
.admin-custom-badge{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:12px;border:1px solid var(--border);background:#0e0e0e;padding:10px;border-radius:7px}
.admin-custom-badge-info{min-width:0}
.admin-badge-url{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
@media(max-width:700px){.admin-badge-form{grid-template-columns:1fr}.admin-badge-form .modal-actions{grid-column:auto}.admin-custom-badge{grid-template-columns:auto 1fr}.admin-custom-badge>.btn{grid-column:1/-1;justify-self:start}}
\n/* Admin portal */
.admin-login-link{position:fixed;top:18px;right:22px;border:1px solid var(--border);background:rgba(0,0,0,.55);color:#fff;padding:10px 14px;border-radius:7px;cursor:pointer;font-weight:700;z-index:20}.admin-login-link:hover{background:#fff;color:#000}
.admin-portal{position:fixed;inset:0;background:#070707;color:#fff;z-index:500;overflow:auto}.admin-topbar{height:72px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;background:#090909;z-index:2}.admin-brand{display:flex;gap:12px;align-items:center}.admin-brand>i{font-size:25px}.admin-brand strong{display:block;font-size:17px}.admin-brand span{display:block;color:#888;font-size:12px;margin-top:2px}.admin-top-actions{display:flex;align-items:center;gap:10px}.admin-shell{display:grid;grid-template-columns:230px 1fr;min-height:calc(100vh - 72px)}.admin-nav{border-right:1px solid var(--border);padding:18px 12px;background:#0d0d0d}.admin-nav-item{display:flex;align-items:center;gap:11px;width:100%;padding:12px 14px;border:0;background:transparent;color:#aaa;text-align:left;border-radius:6px;cursor:pointer;font-weight:700;margin-bottom:5px}.admin-nav-item:hover,.admin-nav-item.active{background:#fff;color:#000}.admin-main{padding:30px;max-width:1400px;width:100%;box-sizing:border-box}.admin-view{max-width:1200px}.admin-page-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.admin-page-head h1{margin:0 0 5px;font-size:27px}.admin-page-head p{margin:0}.admin-stats{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin-bottom:20px}.admin-stat{border:1px solid var(--border);background:#0e0e0e;padding:18px;border-radius:7px}.admin-stat .num{font-size:29px;font-weight:800;margin-top:8px}.admin-stat .label{font-size:12px;color:#888}.admin-grid-two{display:grid;grid-template-columns:1fr 1fr;gap:16px}.admin-card{border:1px solid var(--border);background:#0e0e0e;padding:18px;border-radius:7px;margin-bottom:16px}.admin-card h3{margin:0 0 12px}.admin-actions{display:flex;flex-wrap:wrap;gap:9px}.admin-toolbar{display:flex;gap:10px;margin-bottom:15px}.admin-toolbar input{flex:1;min-width:0}.admin-list{display:grid;gap:10px}.admin-user{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:14px;align-items:center;border:1px solid var(--border);background:#0e0e0e;padding:12px;border-radius:7px}.admin-user-info{min-width:0}.admin-user-info b{display:inline-flex;align-items:center;gap:7px}.admin-user-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}.admin-user-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.admin-user-actions select{width:150px}.admin-badge{display:inline-flex;align-items:center;justify-content:center;border:1px solid #555;border-radius:50%;width:22px;height:22px;min-width:22px;min-height:22px;box-sizing:border-box;padding:0;font-size:10px;font-weight:800;margin-right:0;vertical-align:middle;flex:0 0 22px}.admin-badge.icon-badge{color:#fff;background:transparent}.admin-badge.icon-badge i{font-size:10px;line-height:1}.profile-badges{display:inline-flex;align-items:center;gap:6px;vertical-align:middle;white-space:nowrap;margin:0}.profile-badges .admin-badge{margin-right:0}.profile-badges .icon-badge:hover,.profile-badges .custom-badge:hover{background:#fff;color:#000}.profile-badges .custom-badge{width:22px;height:22px;min-width:22px;min-height:22px;padding:0;border-radius:50%;box-sizing:border-box;justify-content:center;overflow:visible}.profile-badges .custom-badge img{width:100%;height:100%;object-fit:contain;border-radius:50%;display:block;pointer-events:none}.profile-badges .verified-icon{margin-left:0;width:22px;height:22px;min-width:22px;min-height:22px;flex:0 0 22px}.verified-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;min-width:22px;min-height:22px;box-sizing:border-box;border:1px solid #fff;border-radius:50%;font-size:11px;line-height:1;font-weight:900;color:#fff;vertical-align:middle;flex:0 0 22px}.verified-icon:hover{background:#fff;color:#000}.admin-badge.verified{border-color:#fff}.admin-badge.moderator,.admin-badge.administrator,.admin-badge.developer,.admin-badge.early,.admin-badge.custom{border-color:#555}.admin-badge.icon-badge:hover{background:#fff;color:#000}.badge-hover-name{position:relative}.badge-hover-name::after{content:attr(data-badge-name);position:absolute;left:50%;bottom:calc(100% + 8px);transform:translateX(-50%) translateY(3px);opacity:0;pointer-events:none;white-space:nowrap;background:#111;color:#fff;border:1px solid #555;border-radius:5px;padding:5px 8px;font-size:11px;font-weight:700;line-height:1;z-index:1000;box-shadow:0 6px 18px rgba(0,0,0,.35);transition:opacity .12s ease,transform .12s ease}.badge-hover-name::before{content:"";position:absolute;left:50%;bottom:calc(100% + 3px);transform:translateX(-50%);opacity:0;pointer-events:none;border:5px solid transparent;border-top-color:#555;z-index:1001;transition:opacity .12s ease}.badge-hover-name:hover::after,.badge-hover-name:hover::before{opacity:1}.badge-hover-name:hover::after{transform:translateX(-50%) translateY(0)}.profile-badges .badge-hover-name{overflow:visible;z-index:2}.profile-badges .badge-hover-name:hover{z-index:20}.profile-badges .badge-hover-name::after,.profile-badges .badge-hover-name::before{pointer-events:none}.badge-catalog{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}.admin-check{display:flex!important;flex-direction:row!important;align-items:center;gap:8px}.admin-check input{width:auto!important}.admin-security-ok{display:inline-flex;gap:7px;align-items:center;padding:7px 10px;border:1px solid #365c40;border-radius:5px;color:#8fda9c;background:#0c170f}.admin-empty{border:1px dashed var(--border);padding:25px;text-align:center;color:#777;border-radius:7px}.admin-report{border:1px solid var(--border);background:#0e0e0e;padding:14px;border-radius:7px;display:flex;justify-content:space-between;gap:14px}.admin-report-actions{display:flex;gap:7px;align-items:center}.admin-announcement{margin:0 0 16px;padding:12px 16px;border-bottom:1px solid var(--border);background:#111;color:#fff}
@media(max-width:800px){.admin-shell{grid-template-columns:1fr}.admin-nav{border-right:0;border-bottom:1px solid var(--border);display:flex;overflow-x:auto;padding:8px}.admin-nav-item{white-space:nowrap;width:auto;margin:0}.admin-main{padding:18px}.admin-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-grid-two{grid-template-columns:1fr}.admin-topbar{padding:0 12px}.admin-top-actions .muted{display:none}.admin-user{grid-template-columns:auto 1fr}.admin-user-actions{grid-column:1/-1;justify-content:flex-start}.admin-login-link{top:10px;right:10px;font-size:12px;padding:8px 10px}}

@media (max-width:760px){
  body.drawer::after{content:"";position:fixed;inset:0;z-index:4;background:rgba(0,0,0,.58);}
  .sidebar{z-index:6;}
  .menu-btn{position:relative;z-index:7;}
}

.message-link{color:var(--accent,#5865f2);text-decoration:underline;overflow-wrap:anywhere}.message-link:hover{text-decoration-thickness:2px}

/* v1.1.0 responsive/performance polish */
html{overflow:hidden}
body{min-width:0;overflow:hidden;overscroll-behavior:none}
button,input,textarea,select{touch-action:manipulation}
button,.btn,.icon,.tab,.chan,.srv{min-height:40px}
.app{min-width:0}
.servers,.sidebar,.right,.view,.messages,.dm-list,.dm-messages,.admin-portal{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.post,.msg,.dm-msg{content-visibility:auto;contain-intrinsic-size:72px}
.post-text,.msg-text{overflow-wrap:anywhere;word-break:break-word}
.media-embed,.post-media,.message-media{max-width:100%;height:auto}

/* Desktop: use the full browser width. Keep all four desktop columns visible. */
@media (min-width:1101px){
  .app{grid-template-columns:72px 248px minmax(0,1fr) 320px;justify-content:stretch}
  .center{width:100%;min-width:0}
}

/* Tablet */
@media (min-width:761px) and (max-width:1100px){
  .app{grid-template-columns:60px 220px minmax(0,1fr)}
  .servers{padding-left:6px;padding-right:6px}
  .srv{width:44px;height:44px}
  .sidebar{padding-left:8px;padding-right:8px}
  .right{display:none}
}

/* Phone */
@media (max-width:760px){
  html,body{height:100%;height:100dvh}
  body{font-size:14px}
  .app{height:100dvh;grid-template-columns:52px minmax(0,1fr)}
  .servers{width:52px;padding:8px 6px;gap:8px}
  .srv{width:40px;height:40px;min-height:40px;font-size:14px}
  .center{height:100dvh;min-width:0}
  .bar{min-height:52px;padding:8px 10px;gap:8px}
  .bar h2{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .menu-btn{display:grid;place-items:center;width:40px;height:40px;min-width:40px;padding:8px;flex:none}
  .sidebar{left:52px;width:min(86vw,300px);max-width:calc(100vw - 52px);padding:10px 8px;padding-bottom:calc(10px + env(safe-area-inset-bottom));}
  body.drawer .sidebar{box-shadow:16px 0 40px rgba(0,0,0,.45)}
  .tab,.chan{min-height:44px;padding:10px}
  .me{padding:9px 8px}
  .composer{gap:9px;padding:10px 10px}
  .composer .avatar{width:36px;height:36px}
  .composer textarea{font-size:16px;line-height:1.45;min-height:42px;max-height:180px}
  .composer-foot{gap:7px;flex-wrap:wrap}
  .composer-tools{gap:4px}
  .composer-tools .icon{min-width:40px;min-height:40px}
  .composer-foot .btn{min-width:64px}
  .post{padding:12px 10px;gap:9px}
  .post .avatar,.msg .avatar{width:36px;height:36px}
  .post-head{gap:6px;line-height:1.35}
  .actions{gap:16px;flex-wrap:wrap}
  .act{min-height:36px}
  .messages{padding-bottom:4px}
  .msg{padding:7px 10px;gap:9px}
  .msg-tools{display:none!important}
  .msgbox{padding:8px 10px;padding-bottom:calc(8px + env(safe-area-inset-bottom));gap:6px;position:sticky;bottom:0;background:var(--black);z-index:3}
  .msgbox input{font-size:16px;min-height:42px}
  .msgbox .btn{min-width:42px;padding:8px 11px}
  .msgbox .btn i+*{display:none}
  .attach-btn{min-width:40px;min-height:40px}
  .attach-menu{max-width:calc(100vw - 20px)}
  .music-player{width:100%;max-width:100%;gap:8px}
  .music-player>.icon{min-width:34px;min-height:34px}
  .profile-head{padding:12px 10px}
  .profile-head h3{font-size:21px}
  .profile-actions{gap:6px}
  .profile-actions .btn{min-height:42px}
  .profile-banner{height:min(28vw,120px)}
  .profile-large-avatar{width:72px;height:72px}
  .modal{padding:0;place-items:end center}
  .modal-card{width:100%;max-width:none;max-height:92dvh;border-left:0;border-right:0;border-bottom:0;border-radius:14px 14px 0 0;padding-bottom:env(safe-area-inset-bottom)}
  .modal-head{padding:12px 14px}
  .modal-body{padding:14px}
  .modal-actions{flex-wrap:wrap}
  .modal-actions .btn{flex:1;min-width:120px}
  .dm-layout{height:calc(100dvh - 52px);min-height:0;grid-template-rows:minmax(0,34dvh) minmax(0,1fr)}
  .dm-list{max-height:none;min-height:0;border-right:0;border-bottom:1px solid var(--line)}
  .dm-chat{min-height:0}
  .dm-messages{min-height:0}
  .dm-compose{padding:8px 10px;padding-bottom:calc(8px + env(safe-area-inset-bottom));position:sticky;bottom:0;background:var(--black);z-index:3}
  .dm-compose input{font-size:16px;min-height:42px}
  .dm-compose .btn{min-height:42px}
  .right{display:none!important}
  .toast{bottom:calc(12px + env(safe-area-inset-bottom));max-width:calc(100vw - 24px);text-align:center}
}

@media (max-width:430px){
  .brand-logo-sidebar{width:115px!important;min-width:115px;max-width:115px!important}
  .sidebar{width:min(90vw,290px)}
  .composer{padding-left:8px;padding-right:8px}
  .post{padding-left:8px;padding-right:8px}
  .post .avatar,.msg .avatar{width:34px;height:34px}
  .profile-actions .btn{min-width:0;padding:9px 10px;font-size:12px}
  .dm-layout{grid-template-rows:minmax(0,30dvh) minmax(0,1fr)}
  .admin-stats{grid-template-columns:1fr 1fr}
}

/* Admin portal mobile/desktop polish */
@media (max-width:800px){
  .admin-portal{height:100dvh}
  .admin-topbar{min-height:64px;height:auto;padding:10px 12px;gap:8px}
  .admin-brand strong{font-size:15px}
  .admin-brand span{font-size:11px}
  .admin-top-actions{gap:6px}
  .admin-top-actions .btn{min-height:40px;padding:8px 10px}
  .admin-shell{min-height:calc(100dvh - 64px)}
  .admin-nav{position:sticky;top:0;z-index:3;overflow-x:auto;scrollbar-width:none}
  .admin-nav::-webkit-scrollbar{display:none}
  .admin-nav-item{min-height:42px;flex:0 0 auto}
  .admin-main{padding:14px 12px;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
  .admin-page-head{align-items:flex-start;gap:10px;flex-direction:column}
  .admin-page-head h1{font-size:23px}
  .admin-toolbar{position:sticky;top:0;z-index:2;background:#070707;padding:6px 0}
  .admin-toolbar input{font-size:16px}
  .admin-user-actions .btn,.admin-actions .btn{min-height:42px}
  .admin-report{flex-direction:column}
  .admin-report-actions{justify-content:flex-start;flex-wrap:wrap}
}

@media (prefers-reduced-motion: reduce){
  .sidebar,.modal-card{transition:none!important}
}


/* v1.1.5 mobile hardening */
@media (max-width:760px){
  html,body{width:100%;min-width:0;overflow:hidden;overscroll-behavior:none;}
  .app{height:100dvh;min-height:0;grid-template-columns:52px minmax(0,1fr);}
  .center{height:100dvh;min-width:0;}
  .view{min-height:0;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;padding-bottom:env(safe-area-inset-bottom);}
  #view-channel{height:100%;overflow:hidden;}
  #view-channel .messages{min-height:0;overflow-x:hidden;overflow-y:auto;padding-bottom:8px;}
  .msgbox{padding-bottom:calc(9px + env(safe-area-inset-bottom));}
  .msgbox .btn,.dm-compose .btn,.composer-foot .btn{min-height:40px;}
  .msgbox .icon,.composer-tools .icon,.actions .act,.bar .icon{min-width:40px;min-height:40px;}
  .msgbox #msg-text{font-size:16px;}
  .composer textarea{font-size:16px;}
  .sidebar{left:52px;width:min(84vw,300px);padding-bottom:calc(12px + env(safe-area-inset-bottom));}
  body.drawer::after{content:"";position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:4;}
  .sidebar{z-index:6;}
  .menu-btn{z-index:7;}
  .bar{min-height:52px;gap:8px;}
  .bar h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .bar .btn{flex:0 0 auto;white-space:nowrap;}
  .post,.msg,.dm-msg{max-width:100%;overflow:hidden;}
  .post-body,.grow{min-width:0;overflow-wrap:anywhere;}
  .post-head,.msg-head{flex-wrap:wrap;}
  .media-embed,.media-card,.music-player{max-width:100%;}
  .media-embed img{max-width:100%;height:auto;}
  .media-card video{max-height:55vh;}
  .profile-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
  .profile-actions .btn{min-width:0;width:100%;}
  .profile-banner{height:100px;}
  .profile-identity{min-width:0;}
  .profile-identity>div{min-width:0;}
  .profile-identity h3,.profile-identity .muted{overflow-wrap:anywhere;}
  .modal{padding:8px;padding-bottom:calc(8px + env(safe-area-inset-bottom));}
  .modal-card{width:100%;max-width:100%;max-height:calc(100dvh - 16px);}
  .modal-body{padding:14px;}
  .modal-actions{flex-wrap:wrap;}
  .modal-actions .btn{flex:1;min-width:120px;}
  .emoji-grid{grid-template-columns:repeat(6,1fr);} 
  .attach-menu{max-width:calc(100vw - 24px);}
  .dm-layout{height:calc(100dvh - 52px);min-height:0;}
  .dm-list{max-height:34dvh;min-height:110px;}
  .dm-chat{min-height:0;height:66dvh;}
  .dm-messages{min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;}
  .dm-compose{padding-bottom:calc(9px + env(safe-area-inset-bottom));}
}
@media (max-width:430px){
  .brand-logo-sidebar{width:105px!important;min-width:105px;max-width:105px!important;}
  .servers{gap:8px;}
  .srv{width:38px;height:38px;}
  .sidebar{left:52px;width:calc(100vw - 64px);max-width:300px;}
  .post,.msg{padding-left:10px;padding-right:10px;}
  .profile-actions{grid-template-columns:1fr;}
  .profile-actions .btn{min-height:40px;}
  .actions{gap:10px;flex-wrap:wrap;}
  .actions .act{min-width:42px;}
  .dm-list{max-height:31dvh;}
  .dm-chat{height:69dvh;}
}


/* v1.1.7 mobile feature parity — desktop layout/rules are intentionally untouched */
.mobile-header-btn{display:none;margin-left:auto;flex:0 0 40px;width:40px;height:40px;}
@media (max-width:760px){
  .mobile-header-btn{display:grid;place-items:center;}
  .bar h2{min-width:0;}
  #channel-topic{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .mobile-feature-list{display:grid;gap:8px;}
  .mobile-feature-card{border:1px solid var(--line);background:var(--g1);padding:10px;display:flex;align-items:center;gap:10px;min-width:0;}
  .mobile-feature-card .grow{min-width:0;}
  .mobile-feature-card .grow b,.mobile-feature-card .grow .muted{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .mobile-feature-card .avatar{flex:0 0 38px;width:38px;height:38px;}
  .mobile-feature-card .btn{margin-left:auto;flex:0 0 auto;}
}

/* v1.1.8 mobile-only drawer: hide the server rail/sidebar until the hamburger is pressed.
   Desktop/tablet layouts are intentionally unchanged. */
@media (max-width:760px){
  .app{grid-template-columns:minmax(0,1fr);}
  .servers{
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    width:52px;
    z-index:6;
    transform:translateX(-120%);
    transition:transform .2s;
  }
  .sidebar{
    position:fixed;
    left:52px;
    top:0;
    bottom:0;
    width:min(84vw,300px);
    max-width:calc(100vw - 52px);
    z-index:6;
    transform:translateX(-120%);
    transition:transform .2s;
  }
  body.drawer .servers,
  body.drawer .sidebar{transform:none;}
  body.drawer .servers{box-shadow:8px 0 24px rgba(0,0,0,.35);}
  body.drawer .sidebar{box-shadow:16px 0 40px rgba(0,0,0,.45);}
}
@media (max-width:430px){
  .servers{width:52px;}
  .sidebar{left:52px;width:calc(100vw - 52px);max-width:none;}
}


/* v1.3.55 server rail icons: circular clipping for image/GIF media */
/* v1.1.9 server icons, banners, and invite previews */
.server-head{gap:10px;padding:8px 10px;}
.server-icon{width:38px;height:38px;flex:0 0 38px;border:1px solid var(--line);background:var(--g1);display:grid;place-items:center;font-weight:800;overflow:hidden;}
.server-icon-button{padding:0;color:inherit;cursor:pointer;border-radius:10px;transition:border-color .14s,box-shadow .14s,transform .14s}.server-icon-button:hover{border-color:#fff;box-shadow:0 0 14px rgba(255,255,255,.16);transform:translateY(-1px)}
.server-icon img{width:100%;height:100%;object-fit:cover;display:block;}
.server-title-wrap{min-width:0;flex:1;}
.server-title-wrap .section-title{padding:0;border:0;margin:0;}
.server-description{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;}
.server-banner{height:110px;width:100%;background-size:cover;background-position:center;background-repeat:no-repeat;border-bottom:1px solid var(--line);background-color:var(--g1);overflow:hidden;display:block;}
.invite-preview{border:1px solid var(--line);background:var(--g1);overflow:hidden;}
.invite-banner{height:150px;background-size:cover;background-position:center;background-color:var(--g2);}
.invite-server-row{display:flex;gap:12px;padding:16px;align-items:flex-start;}
.invite-server-icon{width:64px;height:64px;flex:0 0 64px;border:1px solid var(--line);background:var(--black);display:grid;place-items:center;font-size:24px;font-weight:800;overflow:hidden;}
.invite-server-icon img{width:100%;height:100%;object-fit:cover;display:block;}
.invite-preview h3{margin:0 0 4px;}
.invite-preview p{margin:4px 0 0;line-height:1.45;}
@media (max-width:760px){
  .server-banner{height:90px;}
  .server-head{padding:8px 10px;}
  .server-icon{width:34px;height:34px;flex-basis:34px;}
  .invite-banner{height:120px;}
  .invite-server-row{padding:12px;}
  .invite-server-icon{width:56px;height:56px;flex-basis:56px;}
}


/* v1.2.1 Discord-style server settings */
.server-settings-wrap{display:flex;flex-direction:column;gap:0;max-height:70vh;overflow:auto;border:1px solid var(--line);background:var(--black);}
.server-settings-hero{height:120px;background-size:cover;background-position:center;background-color:var(--g2);position:relative;border-bottom:1px solid var(--line);}
.server-settings-icon{position:absolute;left:16px;bottom:-30px;width:68px;height:68px;border:3px solid var(--black);background:var(--g1);display:grid;place-items:center;font-size:26px;font-weight:800;overflow:hidden;}
.server-settings-icon img{width:100%;height:100%;object-fit:cover;display:block;}
.server-settings-summary{padding:38px 16px 14px;border-bottom:1px solid var(--line);}
.server-settings-summary h3{margin:0 0 4px;font-size:20px;}
.server-settings-summary p{margin:0;line-height:1.45;white-space:pre-wrap;word-break:break-word;}
.server-settings-section{padding:14px 12px;border-bottom:1px solid var(--line);}
.server-settings-section:last-child{border-bottom:0;}
.server-settings-section>h3{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 8px;padding:0 4px;}
.settings-row{width:100%;border:1px solid transparent;background:transparent;color:var(--text);display:flex;align-items:center;justify-content:space-between;text-align:left;padding:11px 10px;gap:12px;border-radius:7px;cursor:pointer;}
.settings-row:hover{background:var(--g1);border-color:var(--line);}
.settings-row>span:first-child{display:flex;align-items:center;gap:12px;min-width:0;}
.settings-row>span:first-child>i{width:22px;text-align:center;color:var(--muted);}
.settings-row b,.settings-row small{display:block;}
.settings-row small{color:var(--muted);font-size:11px;margin-top:2px;line-height:1.35;}
.settings-row.danger{color:#ff7676;}
.settings-toggle{font-size:11px;font-weight:800;color:var(--muted);border:1px solid var(--line);padding:4px 7px;border-radius:999px;flex:none;}
.settings-toggle.on{color:var(--text);background:var(--g2);}
.settings-info-banner{height:150px;background-size:cover;background-position:center;background-color:var(--g2);border:1px solid var(--line);margin-bottom:12px;}
.settings-info-head{display:flex;gap:12px;align-items:center;}
.settings-info-icon{width:64px;height:64px;flex:0 0 64px;border:1px solid var(--line);background:var(--g1);display:grid;place-items:center;font-size:24px;font-weight:800;overflow:hidden;}
.settings-info-icon img{width:100%;height:100%;object-fit:cover;display:block;}
.settings-info-head h2{margin:0 0 4px;}
.settings-info-head p{margin:0;white-space:pre-wrap;word-break:break-word;}
.settings-stats{display:flex;gap:20px;margin-top:14px;padding-top:12px;border-top:1px solid var(--line);}
.settings-stats span{color:var(--muted);font-size:12px;}
.settings-stats b{color:var(--text);}
.role-select{background:var(--black);color:var(--text);border:1px solid var(--line);padding:7px 8px;border-radius:5px;min-width:130px;}
@media(max-width:760px){
  .server-settings-wrap{max-height:68vh;}
  .server-settings-hero{height:100px;}
  .server-settings-icon{width:58px;height:58px;left:12px;bottom:-26px;font-size:22px;}
  .server-settings-summary{padding:34px 12px 12px;}
  .settings-row{min-height:54px;padding:10px 8px;}
  .settings-row small{font-size:10px;}
  .settings-info-banner{height:120px;}
  .role-select{min-width:112px;max-width:125px;}
}

/* v1.2.2 custom server roles */
.member-role-group{display:grid;gap:2px;margin:10px 0 14px}.member-role-heading{display:flex;align-items:center;gap:7px;padding:4px 8px;text-transform:uppercase;font-size:10px;font-weight:800;letter-spacing:.08em}.role-dot{width:7px;height:7px;border-radius:50%;flex:none}.custom-role-card{display:flex;align-items:center;gap:10px;border:1px solid var(--line);padding:9px;border-radius:7px;background:var(--g1)}.custom-role-swatch{width:34px;height:34px;border-radius:6px;background:var(--role1);flex:none}.custom-role-swatch.gradient{background:linear-gradient(135deg,var(--role1),var(--role2))}.role-toolbar{display:flex;justify-content:flex-end;margin-bottom:10px}.role-list{display:grid;gap:7px;margin-bottom:14px}.role-section-title{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:12px 0 7px}.role-preview{padding:12px;border:1px solid var(--line);background:var(--g1);border-radius:7px;font-size:18px}.role-preview.gradient b{background:linear-gradient(90deg,var(--role1),var(--role2));-webkit-background-clip:text;background-clip:text;color:transparent}.role-permissions{display:grid;gap:8px;border:1px solid var(--line);padding:10px;background:var(--g1)}.role-permissions>b{font-size:12px;text-transform:uppercase;color:var(--muted)}.role-permissions label{display:flex!important;grid-template-columns:none!important;align-items:center;gap:8px;font-size:13px!important;color:var(--text)!important}.role-permissions input{width:16px;height:16px}.role-member-row{margin-bottom:2px}
/* v1.2.4 Discord-style role/member management */
.role-assignment-list{display:grid;gap:6px;max-height:52vh;overflow:auto;border:1px solid var(--line);padding:8px;background:var(--g1)}
.role-assignment-row{display:flex!important;align-items:center;gap:10px;padding:9px;border:1px solid transparent;background:var(--black);color:var(--text)!important;cursor:pointer}
.role-assignment-row:hover{border-color:var(--g3)}
.role-assignment-row input{width:16px;height:16px;flex:none}
.role-permission-group{display:grid;gap:7px;padding:9px 0;border-top:1px solid var(--line)}
.role-permission-group:first-of-type{border-top:0}
.role-permission-group strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}

.check-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;cursor:pointer}.check-row input{accent-color:var(--accent)}


/* v1.3.13 black X-Spaces-style voice room + speaking glow */
.channel-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.voice-count{margin-left:auto;font-size:10px;min-width:18px;text-align:center;border-radius:9px;padding:2px 6px;background:var(--g2);color:var(--muted)}
.voice-room{width:100%;min-height:100%;background:#000;color:#fff;display:flex;flex-direction:column;border:1px solid #202020;overflow:hidden}
.voice-space-head{height:64px;display:grid;grid-template-columns:64px 1fr 76px;align-items:center;border-bottom:1px solid #242424;padding:0 16px;background:#000;position:sticky;top:0;z-index:2}
.voice-back,.voice-leave-top{border:0;background:transparent;color:#fff;cursor:pointer;font:inherit}
.voice-back{width:40px;height:40px;border-radius:50%;font-size:18px}.voice-back:hover{background:#181818}
.voice-space-title{text-align:center;display:flex;flex-direction:column;gap:2px}.voice-space-title strong{font-size:18px}.voice-space-title span{font-size:12px;color:#aaa}
.voice-leave-top{color:#fff;font-weight:800;text-align:right}.voice-leave-top:hover{color:#ff4d4d;text-decoration:underline}
.voice-space-body{flex:1;overflow:auto;padding:22px 22px 100px;background:#000}
.voice-space-intro{display:flex;align-items:center;gap:14px;max-width:900px;margin:0 auto 22px;padding:4px 0}
.voice-space-icon{width:54px;height:54px;border-radius:16px;background:#fff;color:#000;display:grid;place-items:center;font-size:20px;flex:none}
.voice-space-intro h3{margin:0 0 3px;font-size:20px}.voice-space-intro p{margin:0;color:#aaa;font-size:13px}
.voice-members{max-width:900px;margin:auto;display:grid;grid-template-columns:repeat(4,minmax(110px,1fr));gap:28px 20px;align-content:start}
.voice-member{min-width:0;display:flex;flex-direction:column;align-items:center;gap:8px;border:0;background:transparent;padding:4px;cursor:default;text-align:center}
.voice-avatar-wrap{position:relative;border-radius:50%;padding:4px;transition:box-shadow .16s ease,transform .16s ease}.voice-avatar-wrap.is-speaking{box-shadow:0 0 0 2px #fff,0 0 12px 3px rgba(255,255,255,.9),0 0 26px 7px rgba(255,255,255,.28);transform:scale(1.035)}
.voice-avatar{width:76px;height:76px;border-radius:50%;overflow:hidden;background:#151515;border:1px solid #555;display:grid;place-items:center;font-size:25px;font-weight:800;color:#fff}.voice-avatar img{width:100%;height:100%;object-fit:cover}.voice-avatar.is-muted{opacity:.7}
.voice-mic-off{position:absolute;right:-1px;bottom:-1px;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;background:#fff;color:#000;border:2px solid #000;font-size:10px}
.voice-member-meta{display:flex;flex-direction:column;gap:2px;min-width:0}.voice-member-meta b{font-size:14px;max-width:125px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.voice-member-meta span{font-size:12px;color:#999}
.voice-empty{grid-column:1/-1;text-align:center;color:#888;padding:50px 10px}
.voice-space-footer{border-top:1px solid #242424;background:#000;padding:12px 16px 14px;display:grid;justify-items:center;gap:9px;position:sticky;bottom:0;z-index:3}
.voice-status{font-size:12px;color:#aaa;font-weight:700}.voice-controls{display:flex;align-items:center;justify-content:center;gap:14px}
.voice-round{width:50px;height:50px;border-radius:50%;border:1px solid #fff;background:#fff;color:#000;display:grid;place-items:center;cursor:pointer;font-size:17px;box-shadow:0 0 0 0 rgba(255,255,255,0);transition:transform .12s ease,box-shadow .12s ease,background .12s ease}.voice-round:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 0 12px rgba(255,255,255,.45)}.voice-round:disabled{opacity:.28;cursor:not-allowed;box-shadow:none}.voice-round-danger{background:#e53935;color:#fff;border-color:#e53935}.voice-round-danger:hover:not(:disabled){background:#ff4b47;border-color:#ff4b47;box-shadow:0 0 16px rgba(229,57,53,.55)}
.voice-note{font-size:10px;color:#777;text-align:center}
.channel-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.channel-permission-editor{display:grid;gap:10px;max-height:40vh;overflow:auto;border:1px solid var(--line);padding:10px;background:var(--g1);border-radius:8px}
.channel-role-perms{display:grid;grid-template-columns:1fr repeat(7,minmax(80px,auto));gap:7px;align-items:center;padding:9px;border-bottom:1px solid var(--line)}
.channel-role-perms:last-child{border-bottom:0}
.channel-role-perms label{display:flex!important;align-items:center;gap:5px;font-size:11px!important;color:var(--muted)!important}
.channel-role-perms input{width:15px;height:15px;accent-color:var(--accent)}
@media(max-width:760px){
  .voice-space-head{grid-template-columns:48px 1fr 60px;padding:0 10px}.voice-space-title strong{font-size:16px}
  .voice-space-body{padding:16px 12px 90px}.voice-members{grid-template-columns:repeat(4,minmax(66px,1fr));gap:24px 6px}.voice-avatar{width:64px;height:64px;font-size:21px}.voice-member-meta b{font-size:12px;max-width:78px}.voice-member-meta span{font-size:10px}.voice-space-intro{padding:2px 2px 10px}.voice-space-icon{width:46px;height:46px;border-radius:13px}.voice-space-intro h3{font-size:17px}.voice-space-footer{padding:10px 10px 12px}.voice-controls{gap:10px}.voice-round{width:46px;height:46px}
  .channel-edit-grid{grid-template-columns:1fr}
  .channel-permission-editor{max-height:48vh}
  .channel-role-perms{grid-template-columns:1fr 1fr;gap:6px}
  .channel-role-perms b{grid-column:1/-1}
}

/* Discord-style context menus */
.context-menu{position:fixed;z-index:500;min-width:220px;max-width:280px;background:#0b0b0b;color:#fff;border:1px solid #2a2a2a;border-radius:8px;padding:6px;box-shadow:0 18px 60px rgba(0,0,0,.72);backdrop-filter:blur(10px)}
.context-menu .context-title{padding:8px 10px 9px;border-bottom:1px solid #242424;margin-bottom:4px;font:800 12px var(--body);color:#aaa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.context-menu .context-item{display:flex;align-items:center;gap:11px;width:100%;border:0;border-radius:5px;background:transparent;color:#f5f5f5;padding:9px 10px;text-align:left;cursor:pointer;font:600 13px var(--body)}
.context-menu .context-item i{width:17px;text-align:center;color:#aaa}
.context-menu .context-item:hover{background:#1d1d1d}
.context-menu .context-item:hover i{color:#fff}
.context-menu .context-item.danger{color:#ff6b6b}
.context-menu .context-item.danger i{color:#ff6b6b}
.context-menu .context-item:disabled{opacity:.42;cursor:not-allowed}
.context-menu .context-separator{height:1px;background:#242424;margin:5px 4px}
.message-pin{display:inline-flex;align-items:center;gap:4px;margin-left:6px;font-size:10px;color:#aaa}
.msg{position:relative}
@media (max-width:700px){.context-menu{min-width:210px;max-width:calc(100vw - 16px);border-radius:10px;padding:7px}.context-menu .context-item{padding:11px 10px;font-size:14px}.context-menu .context-title{font-size:12px}}

/* v1.3.42 — Profile follower/following/server stats are always white */
#profile-follow-stats{color:#fff!important;opacity:1!important}
.profile-popout-card .profile-popout-stats{color:#fff!important;opacity:1!important}
/* v1.3.21 — Profile popouts on microblogging + server surfaces, adapted to polo2xyz black/white UI */
.profile-popout{position:fixed;inset:0;z-index:480;pointer-events:none;display:flex;padding:12px}
.profile-popout[hidden]{display:none!important}
.profile-popout-card{position:fixed;left:12px;top:12px;width:min(360px,calc(100vw - 24px));max-height:min(680px,calc(100vh - 24px));overflow:auto;background:#090909;color:#fff;border:1px solid #333;border-radius:8px;box-shadow:0 24px 70px rgba(0,0,0,.72);pointer-events:auto;animation:profilePopIn .12s ease-out;scrollbar-width:thin;scrollbar-color:#333 transparent}
@keyframes profilePopIn{from{opacity:0;transform:translateY(4px) scale(.985)}to{opacity:1;transform:none}}
.profile-popout-close{position:absolute;right:9px;top:9px;z-index:5;width:30px;height:30px;border-radius:50%;background:rgba(0,0,0,.62);color:#fff;border:1px solid #444;backdrop-filter:blur(8px)}
.profile-popout-banner{display:block;width:100%;height:118px;object-fit:cover;background:#171717;border:0}
.profile-popout-banner-empty{background:transparent!important;border:0!important;}
.profile-popout-content{position:relative;padding:0 15px 14px}.profile-popout-card .profile-popout-handle{color:rgba(255,255,255,.72)}.profile-popout-card .profile-popout-bio{border-top-color:rgba(255,255,255,.18);color:#fff}.profile-popout-card .profile-popout-stats{color:rgba(255,255,255,.72)}.profile-popout-card .profile-popout-full{color:rgba(255,255,255,.72)}.profile-popout-card .profile-role-pill{background:rgba(0,0,0,.22);border-color:rgba(255,255,255,.22);color:#fff}
.profile-popout-avatar{width:82px;height:82px;border:4px solid #090909;border-radius:50%;background:#111;display:grid;place-items:center;overflow:hidden;margin-top:-43px;font-weight:900;font-size:25px;position:relative;z-index:2}
.profile-popout-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.profile-popout-name-row{display:flex;align-items:flex-start;gap:8px;margin-top:7px}
.profile-popout-names{min-width:0}
.profile-popout-display{font-size:20px;font-weight:900;line-height:1.15;display:flex;align-items:center;flex-wrap:wrap;gap:6px}
.profile-popout-handle{font-size:13px;color:#aaa;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-popout-badges{display:inline-flex;align-items:center;gap:5px;vertical-align:middle;position:relative;z-index:4}
.profile-popout-badges .admin-badge,.profile-popout-badges .verified-icon{width:21px;height:21px;min-width:21px;min-height:21px;flex-basis:21px}
.profile-popout-badges .badge-hover-name::after{z-index:1200}
.profile-popout-badges .badge-hover-name::before{z-index:1201}
.profile-popout-roles{display:flex;flex-wrap:wrap;gap:5px;margin-top:10px}
.profile-role-pill{display:inline-flex;align-items:center;gap:5px;border:1px solid #303030;background:#111;border-radius:999px;padding:4px 7px;color:#ddd;font-size:10px;font-weight:800}
.profile-role-pill i{font-size:7px}
.profile-popout-bio{margin-top:12px;padding-top:12px;border-top:1px solid #252525;font-size:13px;line-height:1.45;color:#ddd;word-break:break-word}
.profile-popout-stats{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:11px;color:#999;font-size:11px}
.profile-popout-stats .status-dot{width:7px;height:7px;border-radius:50%;background:#777;display:inline-block;margin-left:2px}
.profile-popout-stats .status-dot.online{background:#fff;box-shadow:0 0 7px rgba(255,255,255,.6)}
.profile-popout-stats .status-dot.idle{background:#aaa}
.profile-popout-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:13px}
.profile-popout-actions .btn{flex:1;min-width:105px}
.profile-popout-edit{width:100%}
.profile-popout-edit-primary{background:#fff!important;color:#080808!important;border-color:#fff!important;font-weight:900;min-height:40px}
.profile-popout-edit-primary:hover{background:#e9e9e9!important;color:#000!important}
.unified-profile-popout .profile-popout-actions{margin-top:13px}
.profile-popout-full{width:100%;margin-top:8px;border:0;background:transparent;color:#aaa;padding:7px;cursor:pointer;font:700 11px var(--body)}
.profile-popout-full:hover{color:#fff}
.profile-popout-loading,.profile-popout-error{width:min(360px,calc(100vw - 24px));padding:20px;background:#090909;border:1px solid #333;border-radius:8px;color:#aaa;pointer-events:auto;box-shadow:0 24px 70px rgba(0,0,0,.72)}
@media(max-width:760px){
  .profile-popout{align-items:flex-end;padding:8px}
  .profile-popout-card{position:relative;left:auto!important;top:auto!important;width:100%;max-width:none;max-height:calc(100dvh - 16px);border-radius:12px 12px 8px 8px}
  .profile-popout-banner{height:120px}
  .profile-popout-content{padding:0 14px 14px}
  .profile-popout-display{font-size:19px}
  .profile-popout-actions .btn{min-width:90px}
}

/* Server profile popout */
.server-popout-card{width:min(370px,calc(100vw - 24px));}
.server-popout-avatar{border-radius:16px;width:86px;height:86px;margin-top:-44px;font-size:24px;}
.server-popout-avatar img{border-radius:12px;}
.profile-popout-server-meta{display:flex;align-items:center;gap:14px;margin-top:10px;color:#aaa;font-size:12px;}
.profile-popout-server-meta span{display:inline-flex;align-items:center;gap:5px;}
.profile-popout-server-meta i{color:#fff;font-size:11px;}
.server-popout-owner{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:12px;padding:10px 11px;border:1px solid #242424;border-radius:8px;background:#0d0d0d;font-size:12px;}
.server-popout-owner .muted:first-child{width:100%;text-transform:uppercase;letter-spacing:.07em;font-size:10px;}
.server-popout-card .profile-popout-actions .btn{min-width:110px;}
@media (max-width:760px){.server-popout-card{width:100%;max-width:none;border-radius:12px 12px 0 0;}.server-popout-avatar{width:74px;height:74px;margin-top:-37px;}}

/* Friend removal confirmation */
.unfriend-confirm{text-align:center;padding:8px 4px 2px}.unfriend-icon{width:48px;height:48px;margin:0 auto 10px;border:1px solid #444;border-radius:50%;display:grid;place-items:center;background:#111;color:#fff}.unfriend-confirm h3{font-size:19px;margin:0 0 6px}.unfriend-confirm p{margin:0 auto;max-width:360px;line-height:1.45}.unfriend-actions{display:flex;gap:8px;margin-top:18px}.unfriend-actions .btn{flex:1}.unfriend-actions .btn.danger{background:#fff;color:#000;border-color:#fff}.unfriend-actions .btn.danger:hover{background:#e9e9e9;color:#000}

/* Full profile uses the same customizable profile theme as the popout. */
#view-profile{background-size:cover;background-position:center;background-attachment:fixed}
#view-profile .profile-head{background:rgba(0,0,0,.14);backdrop-filter:blur(2px)}
#view-profile #profile-posts{background:rgba(0,0,0,.08)}

/* Messages friends rail */
.dm-friends-section{border-top:1px solid var(--line);margin-top:8px;padding:10px 0 16px}.dm-friends-title{display:flex;align-items:center;justify-content:space-between;padding:4px 14px 8px;text-transform:uppercase;letter-spacing:.08em;font-size:11px;color:var(--muted)}.dm-friend-row{width:100%;display:flex;align-items:center;gap:10px;padding:9px 12px;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--white);text-align:left;cursor:pointer}.dm-friend-row:hover{background:var(--g1)}.dm-friend-row .avatar{width:34px;height:34px;flex:0 0 34px}.dm-friend-row .grow{min-width:0}.dm-friend-row .grow b,.dm-friend-row .muted{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dm-friend-row .status-dot{margin-left:auto}.dm-friends-empty{padding:8px 14px;margin:0}.dm-unread-pill{margin-left:auto;min-width:22px;text-align:center}.dm-chat-unread{margin-left:auto;background:var(--white);color:var(--black);border-radius:999px;padding:4px 9px;font:800 11px var(--brand);white-space:nowrap}.dm-head-identity{min-width:0}

/* v1.3.33 unified friends rail + full-page DM chat */
.mobile-friends-rail{display:flex;flex-direction:column;align-items:center;gap:7px;width:100%;padding-bottom:4px}
.mobile-rail-divider{display:block;width:30px;height:1px;background:#2a2a2a;margin:1px 0 2px}
.mobile-friend-avatar{display:grid;position:relative;place-items:center;width:40px;height:40px;min-height:40px;padding:0;border:1px solid #292929;border-radius:50%;background:#111;color:#fff;overflow:visible;cursor:pointer;font-weight:800;font-size:13px}
.mobile-friend-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
.mobile-friend-avatar:hover{border-color:#fff}
.mobile-friend-status{position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:50%;border:2px solid #000;background:#555}
.mobile-friend-status.online{background:#fff}.mobile-friend-status.idle{background:#aaa}.mobile-friend-status.dnd{background:#777}.mobile-friend-status.offline{background:#333}
.dm-mobile-back{display:none}
/* v1.3.48 — profile-opened DMs use the same stable full chat canvas on desktop + mobile */
body.dm-chat-open .right{display:none!important;}
/* v1.3.50 — DM desktop restores the server rail + sidebar + full chat canvas */
@media(min-width:761px){
  body.dm-chat-open .app{grid-template-columns:72px 219px minmax(0,1fr)!important;}
  body.dm-chat-open .servers{display:flex!important;}
  body.dm-chat-open .sidebar{width:auto;min-width:0;}
  body.dm-chat-open .center{height:100vh;min-height:0;}
}
body.dm-chat-open .dm-layout{grid-template-columns:minmax(0,1fr);height:calc(100vh - 58px);min-height:0;}
body.dm-chat-open .dm-list{display:none!important;}
body.dm-chat-open .dm-chat{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;overflow:hidden;}
body.dm-chat-open .dm-chat-head{flex:0 0 auto;min-height:52px;background:var(--black);position:relative;z-index:2;}
body.dm-chat-open .dm-mobile-back{display:grid;place-items:center;width:40px;height:40px;min-width:40px;margin-right:2px;}
body.dm-chat-open #view-dms .bar{display:none;}
body.dm-chat-open #dm-messages{flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto;padding:12px 0;}
body.dm-chat-open .dm-msg{display:flex;gap:12px;padding:7px 16px;position:relative;max-width:none;}
body.dm-chat-open .dm-msg .avatar{flex:0 0 40px;width:40px;height:40px;}
body.dm-chat-open .dm-msg .post-body{flex:1;min-width:0;}
body.dm-chat-open .dm-msg:hover{background:var(--g1);}
body.dm-chat-open .dm-compose{flex:0 0 auto;position:relative;bottom:auto;padding:12px 14px;padding-bottom:calc(12px + env(safe-area-inset-bottom));background:var(--black);z-index:3;}
@media(max-width:760px){
  body.dm-chat-open .app{grid-template-columns:52px minmax(0,1fr)!important;height:100dvh;min-height:0;}
  body.dm-chat-open .center{height:100dvh;min-height:0;}
  body.dm-chat-open #view-dms{display:flex!important;position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100dvh;z-index:5;background:var(--black);overflow:hidden;}
  body.dm-chat-open .dm-layout{display:flex;flex:1;flex-direction:column;width:100%;height:100%;min-height:0;}
  body.dm-chat-open .dm-chat-head{min-height:64px;padding:10px 12px;}
  body.dm-chat-open #dm-messages{padding:8px 0;}
  body.dm-chat-open .dm-msg{gap:10px;padding:7px 10px;}
  body.dm-chat-open .dm-msg .avatar{flex-basis:38px;width:38px;height:38px;}
  body.dm-chat-open .dm-compose{padding:8px 10px;padding-bottom:calc(8px + env(safe-area-inset-bottom));} 
  body.dm-chat-open .dm-compose input{min-height:42px;font-size:16px;}
  body.dm-chat-open .dm-compose .btn{min-height:42px;}
}

/* v1.3.38 — reliable animated image/GIF profile backgrounds */
#view-profile.profile-themed{position:relative;isolation:isolate;background-color:#090909;}
#view-profile.profile-themed > :not(.profile-theme-bg){position:relative;z-index:1;}
#view-profile.profile-themed .profile-theme-bg{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;background:transparent;}
#view-profile.profile-themed .profile-theme-bg-media{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;}
.profile-popout-card{isolation:isolate;}
.profile-popout-card > .profile-popout-theme-media{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;z-index:0;pointer-events:none;}
.profile-popout-card > .profile-popout-close{position:absolute;right:9px;top:9px;z-index:10;}
.profile-popout-card > .profile-popout-banner,.profile-popout-card > .profile-popout-content{position:relative;z-index:2;}
.profile-popout-card > .profile-popout-content{background:rgba(0,0,0,.18);}

/* v1.3.45 — profile @handle is white on full profile and popout */
.profile-identity .profile-handle{color:#fff!important;}
.profile-popout-card .profile-popout-handle{color:#fff!important;}

.poll-choice{width:100%;display:grid;gap:6px}.poll-choice.selected{outline:1px solid var(--white)}.poll-option-label,.poll-option-meta{position:relative;z-index:1}.poll-option-meta{font-size:12px;opacity:.75}.poll-bar{margin-top:2px}.poll-fill{display:block;background:var(--white);opacity:.25}

.notification-state{display:inline-block;margin-left:8px;white-space:nowrap}

.site-announcement-bar{position:fixed;top:0;left:0;right:0;z-index:180;display:flex;align-items:center;gap:10px;padding:calc(8px + env(safe-area-inset-top,0px)) 14px 8px;background:var(--white);color:var(--black);font:800 13px var(--brand);border-bottom:1px solid var(--g3)}
.site-announcement-bar[hidden]{display:none}
.site-announcement-bar span{flex:1;min-width:0;overflow-wrap:anywhere}
.site-announcement-close{min-height:0!important;background:transparent;border:0;color:var(--black);font-size:20px;line-height:1;padding:2px 6px;cursor:pointer}


/* Friends feature temporarily disabled while messaging remains open to everyone. */
.friends-coming-soon-btn:disabled{opacity:.55;background:var(--g2);color:var(--muted);border-color:var(--g3);cursor:not-allowed;}
.friends-coming-soon .dm-friends-title{color:var(--muted);}
.friends-coming-soon-card{display:flex;align-items:center;gap:9px;margin:0 12px;padding:12px;border:1px solid var(--g3);background:var(--g1);color:var(--muted);border-radius:8px;font-size:13px;}
.friends-coming-soon-card i{font-size:14px;opacity:.7;}
.friends-coming-soon-inline{display:inline-block;margin-left:8px;opacity:.7;}

/* v1.3.83 — beta release */
#message-count{display:inline-block;min-width:22px;text-align:center}.dm-chat-head{display:flex;align-items:center;gap:8px;}
@media(max-width:760px){#message-count{min-width:20px;padding:2px 6px;font-size:10px}.dm-chat-unread{font-size:10px;padding:3px 7px;}}

/* v1.3.90: disabled username control */
#pf-handle:disabled{opacity:.55;cursor:not-allowed;}

/* v1.3.95 persistent voice call bar */
.voice-call-bar{position:fixed;left:calc(250px + 14px);right:calc(300px + 14px);bottom:14px;z-index:450;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;background:#090909;color:#fff;border:1px solid #292929;border-radius:12px;box-shadow:0 14px 40px rgba(0,0,0,.65);backdrop-filter:blur(12px)}
.voice-call-info{display:flex;align-items:center;gap:10px;min-width:0}.voice-call-info>div{display:flex;flex-direction:column;min-width:0}.voice-call-info strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.voice-call-info span:not(.voice-call-icon){font-size:10px;color:#aaa;margin-top:2px}.voice-call-icon{width:32px;height:32px;border-radius:9px;background:#fff;color:#000;display:grid;place-items:center;flex:none;font-size:12px}.voice-call-actions{display:flex;align-items:center;gap:7px;flex:none}.voice-call-btn{width:34px;height:34px;border-radius:50%;border:1px solid #444;background:#161616;color:#fff;display:grid;place-items:center;cursor:pointer}.voice-call-btn:hover{background:#252525}.voice-call-end{background:#e53935;border-color:#e53935}.voice-call-end:hover{background:#ff4b47}
@media(max-width:760px){.voice-call-bar{left:10px;right:10px;bottom:10px;padding:9px 10px}.voice-call-btn{width:36px;height:36px}.voice-call-icon{width:30px;height:30px}}

/* v1.3.95 persistent voice call bar */
.voice-call-bar{position:fixed;left:264px;right:314px;bottom:14px;z-index:450;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;background:#090909;color:#fff;border:1px solid #292929;border-radius:12px;box-shadow:0 14px 40px rgba(0,0,0,.65);backdrop-filter:blur(12px)}
.voice-call-info{display:flex;align-items:center;gap:10px;min-width:0}.voice-call-info>div{display:flex;flex-direction:column;min-width:0}.voice-call-info strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.voice-call-info span:not(.voice-call-icon){font-size:10px;color:#aaa;margin-top:2px}.voice-call-icon{width:32px;height:32px;border-radius:9px;background:#fff;color:#000;display:grid;place-items:center;flex:none;font-size:12px}.voice-call-actions{display:flex;align-items:center;gap:7px;flex:none}.voice-call-btn{width:34px;height:34px;border-radius:50%;border:1px solid #444;background:#161616;color:#fff;display:grid;place-items:center;cursor:pointer}.voice-call-btn:hover{background:#252525}.voice-call-end{background:#e53935;border-color:#e53935}.voice-call-end:hover{background:#ff4b47}
@media(max-width:760px){.voice-call-bar{left:10px;right:10px;bottom:10px;padding:9px 10px}.voice-call-btn{width:36px;height:36px}.voice-call-icon{width:30px;height:30px}}

/* v1.3.95 persistent voice call bar */
.voice-call-bar{position:fixed;left:264px;right:314px;bottom:14px;z-index:450;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;background:#090909;color:#fff;border:1px solid #292929;border-radius:12px;box-shadow:0 14px 40px rgba(0,0,0,.65);backdrop-filter:blur(12px)}
.voice-call-info{display:flex;align-items:center;gap:10px;min-width:0}.voice-call-info>div{display:flex;flex-direction:column;min-width:0}.voice-call-info strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.voice-call-info span:not(.voice-call-icon){font-size:10px;color:#aaa;margin-top:2px}.voice-call-icon{width:32px;height:32px;border-radius:9px;background:#fff;color:#000;display:grid;place-items:center;flex:none;font-size:12px}.voice-call-actions{display:flex;align-items:center;gap:7px;flex:none}.voice-call-btn{width:34px;height:34px;border-radius:50%;border:1px solid #444;background:#161616;color:#fff;display:grid;place-items:center;cursor:pointer}.voice-call-btn:hover{background:#252525}.voice-call-end{background:#e53935;border-color:#e53935}.voice-call-end:hover{background:#ff4b47}
@media(max-width:760px){.voice-call-bar{left:10px;right:10px;bottom:10px;padding:9px 10px}.voice-call-btn{width:36px;height:36px}.voice-call-icon{width:30px;height:30px}}

/* v1.3.97 — persistent Discord-style voice controls above the profile sidebar */
.voice-user-panel{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:8px 10px 0;padding:8px 9px;background:#0d0d0d;border:1px solid #292929;border-radius:10px;box-shadow:0 8px 20px rgba(0,0,0,.35);min-width:0;}
.voice-user-panel-main{display:flex;align-items:center;gap:8px;min-width:0;flex:1;}
.voice-user-panel-icon{width:30px;height:30px;display:grid;place-items:center;border-radius:8px;background:#fff;color:#000;flex:none;font-size:12px;}
.voice-user-panel-text{display:flex;flex-direction:column;min-width:0;line-height:1.15;}
.voice-user-panel-text strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.voice-user-panel-text span{font-size:10px;color:#aaa;margin-top:2px;}
.voice-user-panel-actions{display:flex;align-items:center;gap:4px;flex:none;}
.voice-user-panel-actions button{width:29px;height:29px;padding:0;border:1px solid #333;border-radius:7px;background:#171717;color:#fff;display:grid;place-items:center;cursor:pointer;font-size:11px;}
.voice-user-panel-actions button:hover{background:#262626;}
.voice-user-panel-actions button.danger{background:#8f2626;border-color:#a83232;}
.voice-user-panel-actions button.danger:hover{background:#b83232;}
@media(max-width:760px){.voice-user-panel{margin:7px 7px 0;padding:7px 8px;}.voice-user-panel-actions button{width:30px;height:30px;}}

/* v1.3.98: keep the persistent voice controls in the sidebar so they never cover message composers. */
.voice-call-bar{display:none!important;}
.voice-user-panel{margin-top:auto;}
.voice-user-panel[hidden]{display:none;}
.voice-user-panel[hidden] + .me{margin-top:auto;}
.voice-user-panel:not([hidden]) + .me{margin-top:0;}


/* v1.3.99 — voice channels temporarily disabled */
.voice-coming-soon{opacity:.42!important;cursor:not-allowed!important;color:#777!important;}
.voice-coming-soon:hover{background:transparent!important;color:#777!important;}
.voice-coming-soon .channel-label{color:#888;}
.channel-coming-soon{margin-left:auto;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:#666;white-space:nowrap;}

/* Cross-device usability adjustments: retain the original visual language. */
.channel-live-dot{margin-left:auto;color:#55d59a;font-size:10px}
.notification-friend-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.friends-list{max-height:280px;overflow-y:auto}
button,input,textarea,select{touch-action:manipulation}
@media (max-width:760px){
 html,body{max-width:100%;overflow-x:hidden}
 .app,.main,.content,.view,.dm-layout,.dm-chat{min-width:0}
 .sidebar{z-index:40;max-width:calc(100vw - 52px)}
 .modal-card{max-width:calc(100vw - 16px);overflow-y:auto;overscroll-behavior:contain}
 .profile-actions,.profile-popout-actions{display:flex;flex-wrap:wrap;gap:8px}
 .profile-actions button,.profile-popout-actions button{min-height:40px}
 .dm-row,.chan{min-height:44px}
 .notification-friend-actions button{min-height:40px}
 #messages,#dm-messages{overscroll-behavior:contain}
 .voice-controls{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}
 .voice-room{min-width:0;max-width:100%}
 .voice-space-body{min-height:0;overflow-y:auto}
}
@media (max-width:430px){
 .bar h2{font-size:clamp(15px,4.5vw,19px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .profile-head,.post,.composer{max-width:100%;min-width:0}
 .post-body,.msg-body{min-width:0;overflow-wrap:anywhere}
}

/* v1.5: Desktop/mobile feed modes, bookmarks, and DM message actions. */
.feed-modes{display:flex;border-bottom:1px solid var(--line)}
.feed-mode{flex:1;min-height:46px;border:0;border-bottom:2px solid transparent;background:transparent;color:#888;font:800 13px var(--brand);cursor:pointer}
.feed-mode.active{border-bottom-color:var(--white);color:var(--white)}
.feed-mode:hover{background:var(--g1);color:var(--white)}
.actions{flex-wrap:wrap;column-gap:20px;row-gap:8px}
.dm-msg-actions{display:flex;gap:16px;margin-top:7px;opacity:.8}
.dm-msg-actions .act{font-size:11px}
.dm-msg-actions .act:hover{opacity:1}
.shared-post .post{border:1px solid var(--line);padding:12px}
@media(max-width:760px){
  .feed-mode{min-height:48px}
  .dm-msg-actions{opacity:1}
  .dm-msg-actions .act{min-height:34px;padding:6px}
  .actions{column-gap:15px}
  #bookmark-posts{min-width:0}
}

.drawer-close{display:none}
@media(max-width:760px){
  .drawer-close{display:grid;place-items:center;margin-left:auto;flex:none;width:40px;height:40px}
  .brand-lockup{width:100%}
}
/* Touch-safe X-style action buttons remain usable if icon CDN is unavailable. */
.actions .act{min-width:36px;min-height:40px;justify-content:center}
@media(max-width:760px){.actions .act{min-width:40px;min-height:44px}}

/* v2.0.0 Beta mobile zoom correction. Safari auto-magnifies focused text inputs
   smaller than 16px. Maintain normal viewport scale and leave pinch zoom enabled. */
@media (max-width: 760px), (pointer: coarse) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  textarea,
  select,
  [contenteditable="true"] { font-size: 16px !important; }
}

/* v2.0.0 Beta: server rail image alignment on desktop and mobile.
   Native buttons have horizontal padding, which shrank icon images to ovals. */
.srv { padding:0; flex:0 0 auto; }
.srv img { width:100%; height:100%; object-fit:cover; border-radius:50%; pointer-events:none; }
@media (max-width:430px) {
  .srv { width:40px; height:40px; min-width:40px; min-height:40px; }
}

/* v2.0.0 Beta: URL-based post attachment preview; matches existing monochrome composer. */
.post-attachment-preview{margin-top:9px;max-width:100%;min-width:0}
.post-attachment-chip{display:flex;align-items:center;gap:9px;background:var(--g1);color:var(--white);border:1px solid var(--g3);padding:4px 5px 4px 10px;min-width:0;max-width:100%;font:600 12px var(--body)}
.post-attachment-chip>i{color:#bbb;flex:none}
.post-attachment-chip span{flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.post-attachment-chip .icon{flex:0 0 32px;min-width:32px;min-height:32px;width:32px;height:32px;padding:0}

/* v2.0.0 Beta — server icon ONLY: prevent portrait/landscape images from
   inheriting an intrinsic grid-track size (notably in mobile Safari).
   The .servers rail, navigation buttons, spacings and layout are unchanged. */
.srv[data-server] {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}
.srv[data-server] > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  pointer-events: none;
}

/* v2.0.0 Beta: keep customized profile GIF/image backgrounds visible while
   scrolling long posts. A zero-height sticky layer prevents the background
   from taking up space or scrolling away; the view clips it to its own area. */
#view-profile.profile-themed > .profile-theme-bg{
  position:sticky;
  top:0;
  right:auto;
  bottom:auto;
  left:auto;
  width:100%;
  height:0;
  min-height:0;
  flex:0 0 0px;
  align-self:stretch;
  overflow:visible;
  z-index:0;
  pointer-events:none;
}
#view-profile.profile-themed > .profile-theme-bg > .profile-theme-bg-media{
  position:absolute;
  top:0;
  right:0;
  bottom:auto;
  left:0;
  width:100%;
  height:100dvh;
  max-height:100dvh;
  object-fit:cover;
}
/* A transparent GIF should reveal the profile theme, not an opaque black
   fill from the post's image wrapper. Videos keep their existing backdrop.
   Scoped to customized profiles: normal feed/media styling stays intact. */
#view-profile.profile-themed .media-embed.image-embed,
#view-profile.profile-themed .media-embed.image-embed img{
  background:transparent;
}

/* v2.0.0 Beta: mobile Explore search stays open during typing. */
.explore-search{min-width:0;display:grid;gap:9px}
.explore-search>label{color:#aaa;font-weight:700;font-size:12px}
.explore-search-row{display:flex;min-width:0;gap:8px;align-items:stretch}
.explore-search-row input{flex:1;min-width:0;font-size:16px}
.explore-search-row .btn{flex:none}
.explore-search-results{min-width:0;display:grid;gap:5px;max-height:260px;overflow:auto;overscroll-behavior:contain}
.explore-search-results>.muted{padding:8px 1px;margin:0}
.explore-results-heading{color:#aaa;font-size:12px;padding:7px 0 3px}
.explore-post-result{width:100%;min-width:0;border:1px solid var(--line);background:var(--g1);color:var(--white);padding:10px;text-align:left;display:grid;gap:3px;cursor:pointer}
.explore-post-result b,.explore-post-result span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.explore-post-result span{color:#aaa;font-size:12px}
.explore-post-result:hover,.explore-post-result:focus-visible{border-color:var(--white)}
@media(max-width:760px){.explore-search-row input{font-size:16px!important}.explore-search-row .btn{min-height:44px}}

/* Explore search stays inside its dialog until the visitor explicitly opens the feed. */
#mobile-search-view-feed{justify-self:start;max-width:100%;min-height:40px}
#mobile-explore-results .explore-results-heading{font-size:12px;color:#aaa;padding:3px 0}

/* v2.1.0 Beta — user settings, deliberately scoped to the new view. */
.account-settings-layout{display:grid;grid-template-columns:195px minmax(0,1fr);min-height:0;flex:1;max-width:1100px;width:100%;margin:0 auto;}
.account-settings-nav{display:flex;flex-direction:column;gap:3px;padding:16px 10px;border-right:1px solid var(--line);min-width:0;}
.account-settings-nav button{display:flex;align-items:center;gap:12px;text-align:left;border:0;background:transparent;color:var(--text);font:inherit;padding:12px;border-radius:8px;cursor:pointer;min-height:46px;white-space:nowrap;}
.account-settings-nav button i{width:18px;text-align:center;}
.account-settings-nav button:hover{background:var(--g2);}
.account-settings-nav button.active{background:var(--white);color:var(--black);}
.account-settings-main{padding:20px;min-width:0;overflow-y:auto;overscroll-behavior:contain;}
.account-settings-main>h2{font-size:23px;margin:0 0 16px;}
.account-settings-content{display:grid;gap:14px;max-width:680px;}
.account-setting-card{padding:18px;background:var(--g1);border:1px solid var(--g3);display:grid;gap:14px;border-radius:10px;min-width:0;}
.account-setting-card>h3{margin:0;font-size:17px;}
.account-setting-card .btn{justify-self:start;display:inline-flex;align-items:center;gap:8px;}
.account-setting-identity{display:flex;align-items:center;gap:12px;min-width:0;overflow-wrap:anywhere;}
.account-setting-identity .avatar{flex:none;}
.account-setting-identity>div:last-child{min-width:0;}
.account-setting-card label:not(.account-setting-check){display:grid;gap:6px;font-size:13px;color:var(--muted);min-width:0;}
.account-setting-card select{font:inherit;background:var(--black);color:var(--white);border:1px solid var(--g3);padding:12px;max-width:100%;min-width:0;border-radius:6px;}
.account-setting-check{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:10px 0;cursor:pointer;border-bottom:1px solid var(--line);}
.account-setting-check:last-of-type{border-bottom:0;}
.account-setting-check span{display:grid;gap:2px;min-width:0;}
.account-setting-check strong{color:var(--white);font-size:14px;}
.account-setting-check small{font:inherit;color:var(--muted);font-size:12px;line-height:1.4;}
.account-setting-check input{width:20px;height:20px;flex:none;accent-color:#fff;}
.account-setting-test{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
.mic-test-level{height:12px;width:130px;border:1px solid var(--g3);background:var(--black);border-radius:9px;overflow:hidden;}
.mic-test-level span{display:block;width:0;height:100%;background:var(--white);transition:width .08s;}
.settings-danger{border-color:#a66!important;color:#ff9999!important;}
.account-switch-list{display:grid;gap:8px;margin:14px 0;}
.account-switch-row{display:flex;align-items:center;gap:10px;border:1px solid var(--g3);background:var(--g1);padding:12px;min-width:0;border-radius:8px;}
.account-slot-avatar{display:grid;place-items:center;width:40px;height:40px;flex:none;border-radius:50%;background:var(--white);color:var(--black);font-size:17px;}
.account-switch-details{min-width:0;flex:1;}
.account-switch-details strong,.account-switch-details small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.account-switch-details small{font-size:12px;color:var(--muted);}
.account-slot-active{font-size:11px;color:var(--muted);padding:6px;border:1px solid var(--g3);border-radius:6px;}
body.pref-reduced-motion *,body.pref-reduced-motion *::before,body.pref-reduced-motion *::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important;}
body.pref-compact-posts .post{padding-top:7px!important;padding-bottom:7px!important;}
body.pref-hide-notification-badges #message-count,body.pref-hide-notification-badges #notif-count{display:none!important;}
@media(max-width:760px){
  .account-settings-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);}
  .account-settings-nav{flex-direction:row;overflow-x:auto;overflow-y:hidden;padding:9px 10px;gap:5px;border-right:0;border-bottom:1px solid var(--line);scrollbar-width:thin;-webkit-overflow-scrolling:touch;}
  .account-settings-nav button{font-size:13px;min-height:44px;padding:9px 12px;flex:none;}
  .account-settings-main{padding:14px 12px calc(20px + env(safe-area-inset-bottom));}
  .account-settings-main>h2{font-size:20px;margin-bottom:12px;}
  .account-setting-card{padding:14px;gap:12px;}
  .account-settings-main input,.account-settings-main select,.account-switch-list input{font-size:16px!important;}
  .account-setting-check{min-height:52px;}
  .account-switch-row{padding:10px;}
  .settings-back{margin-left:auto;}
}
@media(max-width:350px){.account-settings-nav button{padding:9px}.account-settings-main{padding:10px}.settings-back{padding:6px 8px!important;font-size:12px!important}.account-switch-row .btn{padding:6px 8px!important;}}

/* v2.1.5 Beta — independent colored/gradient display names and image/GIF avatar frames */
.custom-display-name{display:inline;max-width:100%;overflow-wrap:anywhere;border-radius:5px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.custom-display-name.has-name-background{padding:2px 5px;line-height:1.55}
.custom-name-text{display:inline;overflow-wrap:anywhere}
/* A frame is purely decorative: never changes click/touch target size or avatar crop. */
.avatar[data-decor-avatar-uid],.profile-click-avatar[data-decor-avatar-uid],.profile-popout-avatar[data-decor-avatar-uid]{position:relative;overflow:visible!important;isolation:isolate}
.avatar[data-decor-avatar-uid]>img:not(.profile-frame-overlay),.profile-click-avatar[data-decor-avatar-uid]>.profile-large-avatar,.profile-popout-avatar[data-decor-avatar-uid]>img:not(.profile-frame-overlay){border-radius:50%;object-fit:cover}
.avatar[data-decor-avatar-uid]>img.profile-frame-overlay,.profile-click-avatar[data-decor-avatar-uid]>img.profile-frame-overlay,.profile-popout-avatar[data-decor-avatar-uid]>img.profile-frame-overlay{position:absolute!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;width:125%!important;height:125%!important;max-width:none!important;max-height:none!important;object-fit:contain!important;border:0!important;border-radius:0!important;background:transparent!important;pointer-events:none!important;z-index:3!important;display:block}
.profile-click-avatar[data-decor-avatar-uid]{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.profile-popout-avatar[data-decor-avatar-uid]>.profile-frame-overlay{z-index:5!important}
/* The status indicator stays above profile frames. */
.avatar[data-decor-avatar-uid]>.dot{z-index:6}
.display-decoration-editor{border:1px solid var(--g3);background:var(--g1);padding:14px;display:grid;gap:12px;min-width:0}
.display-decoration-editor .profile-theme-title{margin:4px 0 0}
.display-decoration-editor .decoration-picker-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.decoration-picker-row input[type=color]{height:42px;width:100%;padding:4px;cursor:pointer;min-width:0}
.display-decoration-editor input[type=range]{width:100%;accent-color:var(--white)}
.display-decoration-editor output{font-size:12px;color:var(--muted)}
.decoration-preview{min-height:78px;display:flex;align-items:center;gap:16px;padding:16px 18px;border:1px solid var(--g3);background:#090909;min-width:0;overflow:visible}
.decoration-preview strong{min-width:0;overflow-wrap:anywhere;line-height:1.55}
.decoration-preview>.avatar{flex:0 0 44px;width:44px;height:44px}
.display-decoration-editor [hidden]{display:none!important}
@media(max-width:430px){.display-decoration-editor{padding:10px;gap:10px}.decoration-preview{padding:12px;gap:12px}.display-decoration-editor .decoration-picker-row{gap:6px}}

/* Broadcast v2.2.5 Beta: personal music (independent of servers, voice and AutoMod). */
.personal-music{border:1px solid var(--line);background:var(--black);padding:9px;border-radius:12px;margin-top:auto;min-width:0;display:grid;gap:7px;flex-shrink:0}
.personal-music[hidden]{display:none!important}
.personal-music + .me{margin-top:0}
.music-now{display:flex;align-items:center;gap:9px;min-width:0;width:100%;padding:0;border:0;background:transparent;color:var(--white);text-align:left;cursor:pointer}
.music-art{width:42px;height:42px;border:1px solid #565656;border-radius:8px;background:#232323;display:grid;place-items:center;flex:none;font-size:18px}
.music-now-details{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.music-now-details strong,.music-now-details small{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.music-now-details strong{font-size:13px}
.music-now-details small{color:#aaa;font-size:11px}
.music-expand{font-size:11px;color:#aaa;flex:none}
.personal-music input[type="range"],.music-library-card input[type="range"]{display:block;min-width:0;width:100%;height:15px;padding:0;margin:0;accent-color:#fff;cursor:pointer}
.music-compact-actions{display:flex;justify-content:center;align-items:center;gap:12px}
.music-compact-actions button,.music-library-card button{cursor:pointer}
.music-compact-actions button{border:none;background:transparent;color:var(--white);border-radius:8px;width:36px;height:32px;display:grid;place-items:center}
.music-compact-actions .music-play-main{background:#fff;color:#050505;border-radius:50%;width:34px;height:34px}
.music-compact-actions button:disabled{opacity:.35;cursor:default}
.music-library-backdrop{position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,.78);display:flex;align-items:center;justify-content:center;padding:20px;box-sizing:border-box}
.music-library-backdrop[hidden]{display:none!important}
.music-library-card{background:#101010;color:#fff;border:1px solid #484848;border-radius:16px;width:min(100%,580px);max-height:min(90dvh,850px);overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:13px;box-sizing:border-box;box-shadow:0 24px 90px #000b}
.music-library-heading{display:flex;justify-content:space-between;align-items:start;gap:12px}
.music-library-heading h2{font:800 22px var(--brand)}
.music-library-heading p,.music-library-note{font-size:12px;line-height:1.5;color:#aaa;margin:3px 0 0}
.music-library-heading button{background:transparent;border:0;color:inherit;width:36px;height:36px;flex:none;font-size:19px}
.music-library-tools{display:flex;gap:8px;flex-wrap:wrap}
.music-action,.music-link-form button{cursor:pointer;border-radius:8px;border:1px solid #666;color:#fff;background:#222;font-weight:700;font-size:13px;min-height:40px;display:flex;justify-content:center;align-items:center;gap:8px;padding:8px 14px;box-sizing:border-box}
.music-action:focus-within,.music-library-card button:focus-visible,.music-now:focus-visible{outline:2px solid white;outline-offset:2px}
.music-link-form{display:grid;gap:6px}
.music-link-form label{font-weight:700;font-size:12px}
.music-link-form>div{display:flex;gap:8px;min-width:0}
.music-link-form input{min-width:0;flex:1;background:#080808;color:#fff;border:1px solid #494949;border-radius:8px;padding:10px;font-size:16px;height:41px;box-sizing:border-box}
.music-link-form button{min-width:64px}
.music-library-options{display:flex;align-items:center;flex-wrap:wrap;gap:9px}
.music-library-options button{border:1px solid #666;background:transparent;color:#eee;padding:8px 10px;border-radius:6px}
.music-library-options button[aria-pressed="true"],.music-library-options button[data-mode]:not([data-mode="off"]){background:white;color:black}
.music-library-options label{display:flex;align-items:center;gap:8px;margin-left:auto;width:125px}
.music-time{text-align:right;color:#aaa;font-size:12px}
.music-library-list-heading{display:flex;align-items:center;gap:10px;border-top:1px solid #333;padding-top:12px;font-size:13px}
.music-library-list-heading span{color:#aaa;font-size:12px}
.music-library-list-heading button{margin-left:auto;background:transparent;color:#ddd;border:none;text-decoration:underline;font-size:12px}
.music-track-list{display:grid;gap:4px;max-height:240px;overflow:auto}
.music-track-row{display:flex;align-items:center;gap:4px;min-width:0;background:#191919;border-radius:7px}
.music-track-row.active{border:1px solid #eee;background:#292929}
.music-track-select{background:transparent;border:0;padding:9px 10px;display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-width:0;flex:1;text-align:left;color:white}
.music-track-select strong,.music-track-select span{display:block;max-width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.music-track-select strong{font-size:13px}
.music-track-select span{color:#aaa;font-size:11px}
.music-track-remove{border:0;color:#ddd;background:transparent;font-size:22px;min-width:40px;min-height:40px}
.music-empty{font-size:13px;color:#aaa;padding:12px 0}
.music-status{color:#ccc;min-height:1em;font-size:12px;margin:0}
@media (max-width:760px){
  .music-library-backdrop{padding:0;align-items:flex-end}
  .music-library-card{width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - 18px);padding:16px 16px calc(16px + env(safe-area-inset-bottom));border-radius:16px 16px 0 0;overscroll-behavior:contain}
  .music-compact-actions button{min-height:38px}
  .music-action{flex:1;min-width:105px}
}
@media (max-width:340px){.music-library-card{padding-inline:12px}.music-link-form button{min-width:55px;padding-inline:9px}}

.music-art{overflow:hidden}.music-art img{width:100%;height:100%;object-fit:cover;display:block;border-radius:7px}.music-link-form>input{width:100%;min-width:0;background:#080808;color:#fff;border:1px solid #494949;border-radius:8px;padding:10px;font-size:16px;box-sizing:border-box}

.music-connect-dropbox{min-height:40px;border:1px solid #555;border-radius:8px;background:#242424;color:#fff;font-weight:700;cursor:pointer;font-size:13px;padding:8px 14px;align-self:flex-start}


/* v2.2.6 — responsive login and loading videos (original app layout unchanged). */
.startup-media{position:fixed;inset:0;z-index:1;pointer-events:none;background:#000;overflow:hidden;isolation:isolate}
.startup-video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;opacity:0;background:#000;transition:opacity .18s ease}
.startup-fallback{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(78vw,420px);height:auto;object-fit:contain;opacity:.95}
body.startup-video-playing .startup-video{opacity:1}
body.startup-video-playing .startup-fallback{opacity:0}
/* Preserve the original login controls while showing the animation around them. */
.auth{background:transparent}
.auth-box{padding:18px;background:rgba(0,0,0,.90);border:1px solid #252525;box-shadow:0 12px 55px rgba(0,0,0,.66);max-height:calc(100dvh - 36px);overflow-y:auto;overscroll-behavior:contain}
.app-loading{background:rgba(0,0,0,.08)}
.app-loading-inner{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:12px;padding-bottom:max(35px,env(safe-area-inset-bottom));pointer-events:none}
.app-loading-logo{width:min(64vw,340px)}
body.startup-video-playing .app-loading-logo{display:none}
.app-loading-text{color:#fff;background:rgba(0,0,0,.65);padding:6px 14px;border-radius:4px;text-shadow:0 1px 4px #000}
.startup-loading-help{display:grid;justify-items:center;gap:10px;color:#fff;text-align:center;pointer-events:auto;font-size:13px;max-width:300px;background:rgba(0,0,0,.92);padding:12px;border:1px solid #333}
.startup-loading-help p{margin:0}
/* Loading/login video falls back to the original logo when reduced motion is requested. */
@media(prefers-reduced-motion:reduce){.startup-video{display:none!important}.startup-fallback,.app-loading-logo{display:block!important}body.startup-video-playing .startup-fallback{opacity:.95}}
@media(max-width:760px){.startup-fallback{width:min(82vw,320px)}.auth{align-items:end;padding:12px 12px max(18px,env(safe-area-inset-bottom))}.auth-box{width:100%;max-width:420px;max-height:min(76dvh,710px);padding:16px}.app-loading-inner{padding-bottom:max(55px,env(safe-area-inset-bottom))}}

/* v2.2.7 — quiet, app-style scrollbars and collapsible members rail */
:root{color-scheme:dark}
.servers,.sidebar,.right,.view,.messages,.dm-list,.dm-messages,.account-settings-main,.modal-card,.music-library-card{scrollbar-width:thin;scrollbar-color:#555 #151515}
.servers::-webkit-scrollbar,.sidebar::-webkit-scrollbar,.right::-webkit-scrollbar,.view::-webkit-scrollbar,.messages::-webkit-scrollbar,.dm-list::-webkit-scrollbar,.dm-messages::-webkit-scrollbar,.account-settings-main::-webkit-scrollbar,.modal-card::-webkit-scrollbar,.music-library-card::-webkit-scrollbar{width:6px;height:6px}
.servers::-webkit-scrollbar-track,.sidebar::-webkit-scrollbar-track,.right::-webkit-scrollbar-track,.view::-webkit-scrollbar-track,.messages::-webkit-scrollbar-track,.dm-list::-webkit-scrollbar-track,.dm-messages::-webkit-scrollbar-track{background:transparent}
.servers::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb,.right::-webkit-scrollbar-thumb,.view::-webkit-scrollbar-thumb,.messages::-webkit-scrollbar-thumb,.dm-list::-webkit-scrollbar-thumb,.dm-messages::-webkit-scrollbar-thumb{background:#555;border-radius:12px}
.servers::-webkit-scrollbar-thumb:hover,.sidebar::-webkit-scrollbar-thumb:hover,.right::-webkit-scrollbar-thumb:hover,.view::-webkit-scrollbar-thumb:hover,.messages::-webkit-scrollbar-thumb:hover{background:#888}
.members-sidebar-toggle{margin-left:auto;flex:0 0 36px;min-width:36px;min-height:36px;display:grid;place-items:center}
@media(min-width:1101px){.app.members-rail-closed{grid-template-columns:72px 248px minmax(0,1fr)}.app.members-rail-closed>.right{display:none}}
@media(max-width:1100px){.members-sidebar-toggle{display:none}}
.image-embed .image-embed-fallback{display:none;padding:10px 12px;overflow-wrap:anywhere}
.image-embed.is-broken img{display:none}
.image-embed.is-broken .image-embed-fallback{display:block}
.message-link{color:#9acaff;text-decoration:underline;overflow-wrap:anywhere}

/* v2.2.7 Beta: responsive animated login background, shared by web/mobile/Electron. */
#auth.auth{position:fixed;inset:0;isolation:isolate;background:#090909;overflow-y:auto}
#auth.auth::before{content:"";position:fixed;inset:-9%;z-index:-1;pointer-events:none;background:#111 url("login-background.png") center center / cover no-repeat;animation:poloLoginDrift 18s ease-in-out infinite alternate;will-change:transform}
#auth.auth::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(135deg,rgba(0,0,0,.28),rgba(0,0,0,.54))}
#auth .auth-box{position:relative;background:rgba(0,0,0,.80);border:1px solid rgba(255,255,255,.20);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
@keyframes poloLoginDrift{from{transform:scale(1) translate3d(-1%,0,0)}to{transform:scale(1.12) translate3d(1.5%,-1%,0)}}
@media(max-width:760px){#auth.auth::before{background-position:center center}#auth .auth-box{background:rgba(0,0,0,.84)}}
@media(prefers-reduced-motion:reduce){#auth.auth::before{animation:none;transform:none}}

/* v2.2.7 Beta — looping login background video for mobile, web and Electron. */
#auth.auth{position:fixed;inset:0;isolation:isolate;background:#090909;overflow-x:hidden}
#auth.auth::before{animation:none!important;transform:none!important;inset:0;background:#111 url("login-background.png") center/cover no-repeat;z-index:-2}
#auth.auth::after{z-index:-1;background:linear-gradient(135deg,rgba(0,0,0,.20),rgba(0,0,0,.50))}
#auth .polo-login-background-video{position:fixed;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;z-index:-2;pointer-events:none;display:block}
#auth .auth-box,#auth .admin-login-link{position:relative;z-index:1}
@media (max-width:760px){#auth .polo-login-background-video{object-position:center}}
@media (prefers-reduced-motion:reduce){#auth .polo-login-background-video{display:none}}

/* P2B external link cards */
.p2b-link-preview{display:flex;overflow:hidden;max-width:490px;min-height:72px;margin:9px 0 4px;border:1px solid #353535;border-left:3px solid #a5a5a5;border-radius:10px;background:#181818;color:#f3f3f3;text-decoration:none!important;align-items:stretch;transition:border-color .15s,background .15s}.p2b-link-preview:hover{border-color:#777;background:#232323}.p2b-preview-image{width:116px;min-height:76px;max-height:140px;object-fit:cover;flex-shrink:0}.p2b-preview-details{padding:10px 13px;min-width:0;display:flex;flex-direction:column;gap:4px}.p2b-preview-domain{font-size:11px;color:#a6a6a6;overflow-wrap:anywhere}.p2b-preview-title{font-size:14px;line-height:1.35;overflow-wrap:anywhere}.p2b-preview-description{font-size:12px;color:#b9b9b9;line-height:1.35;overflow-wrap:anywhere}@media(max-width:480px){.p2b-preview-image{width:90px}.p2b-link-preview{max-width:100%}}

/* v2.2.7 combined repair: readable permission controls on desktop, EXE, mobile. */
.channel-permission-editor{display:block!important;max-height:min(55vh,540px)!important;overflow-y:auto!important;overflow-x:hidden!important;min-width:0!important;padding:12px!important;box-sizing:border-box!important}
.channel-permission-editor>.muted{white-space:normal!important;overflow-wrap:anywhere;margin:0 0 12px!important}
.channel-role-perms{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))!important;gap:12px!important;align-items:stretch!important;min-width:0!important;padding:14px 0!important}
.channel-role-perms>.role-name{grid-column:1/-1!important;white-space:normal!important;overflow-wrap:anywhere}
.channel-role-perms label{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:7px!important;min-width:0!important;width:auto!important;white-space:normal!important;font-size:12px!important;line-height:1.4!important;overflow-wrap:anywhere}
.channel-role-perms select{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;min-height:36px!important;box-sizing:border-box!important;padding:7px 10px!important;font-size:12px!important}
#edit-ch-perms,#edit-ch-perms *{box-sizing:border-box}
#edit-ch-perms{min-width:0;max-width:100%}
@media(max-width:600px){.channel-role-perms{grid-template-columns:repeat(auto-fit,minmax(min(100%,135px),1fr))!important;gap:10px!important}.channel-permission-editor{max-height:45vh!important;padding:9px!important}}
.dm-msg .media-card img,.dm-msg .media-embed img{display:block;max-width:min(100%,440px);max-height:400px;object-fit:contain;border-radius:8px}
.dm-msg .media-card video{max-width:100%;max-height:400px}

/* v2.3.1: compact, no-overflow channel role overrides and resilient DM images */
.channel-permission-editor{width:100%;max-width:100%;overflow-x:clip!important}
.channel-role-perms{grid-template-columns:repeat(auto-fit,minmax(min(100%,155px),1fr))!important}
.channel-role-perms label{overflow:hidden;min-width:0!important}
.channel-role-perms select{appearance:auto;max-width:100%!important;text-overflow:ellipsis}
.dm-attachment-image .dm-image-fallback{display:none;font-size:12px;padding:8px}
.dm-attachment-image:has(img[src=""]) .dm-image-fallback{display:block}
.dm-attachment-image img{max-width:100%;height:auto}
@media(max-width:480px){.channel-role-perms{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}.channel-role-perms label{font-size:11px!important}.dm-attachment-image{max-width:100%}}

/* v2.3.2: desktop web DMs — constrain grid/flex heights so message list scrolls. */
@media (min-width:761px) {
  #view-dms { min-height:0; overflow:hidden; }
  #view-dms > .bar { flex:0 0 auto; }
  #view-dms .dm-layout,
  body.dm-chat-open #view-dms .dm-layout {
    flex:1 1 auto;
    height:auto;
    min-height:0;
    max-height:100%;
    overflow:hidden;
  }
  #view-dms .dm-chat { min-height:0; overflow:hidden; }
  #view-dms #dm-messages { flex:1 1 0; min-height:0; overflow-y:auto; overflow-x:hidden; }
}


/* POLO2 Android v0.1.1 Beta: mobile viewport and adaptive layout patch.
   Phone-only overrides: preserve desktop/Windows styling and application logic. */
@media screen and (max-width:760px) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  html,body { width:100%; max-width:100%; overflow-x:hidden; }
  #app.app { width:100%; max-width:100%; min-width:0; overflow-x:hidden; }
  #app .center, #app .view, #app .bar, #app .composer,
  #app .post, #app .post-body, #app .dm-layout, #app .dm-list,
  #app .dm-chat, #app .messages, #app .msg, #app .msg-body {
    box-sizing:border-box; min-width:0; max-width:100%;
  }
  #app .center { overflow-x:hidden; }
  #app .bar { display:flex; align-items:center; min-width:0; padding:8px 9px; gap:6px; }
  #app .bar h2 { min-width:0; flex:1 1 auto; font-size:clamp(14px,4vw,17px); line-height:1.2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #app .bar .btn { flex:0 1 auto; max-width:52%; min-width:0; padding:8px 9px; font-size:clamp(11px,3.1vw,13px); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #app .menu-btn { flex:0 0 38px; width:38px; min-width:38px; }
  #app .composer { padding:9px 8px; gap:8px; }
  #app .composer textarea { min-width:0; width:100%; font-size:16px; }
  #app .composer-foot, #app .composer-tools { min-width:0; max-width:100%; flex-wrap:wrap; }
  #app .composer-foot button, #app .composer-tools button { max-width:100%; }
  #app .post { padding:10px 8px; gap:7px; }
  #app .post .avatar, #app .msg .avatar { width:32px; height:32px; flex:0 0 32px; }
  #app .post-head { min-width:0; flex-wrap:wrap; column-gap:5px; row-gap:2px; line-height:1.3; }
  #app .post-text, #app .msg-body, #app .dm-msg, #app .notification,
  #app .post-body { overflow-wrap:anywhere; word-break:normal; }
  #app .actions { display:flex; flex-wrap:wrap; column-gap:9px; row-gap:3px; min-width:0; }
  #app .act { min-width:0; padding:5px 4px; font-size:12px; }
  #app .post img, #app .post video, #app .msg img, #app .msg video,
  #app .dm-msg img, #app .dm-msg video { max-width:100%; height:auto; }
  #app .media-card, #app .p2b-link-preview { max-width:100%; min-width:0; }
  #app .sidebar { max-width:calc(100vw - 52px); box-sizing:border-box; overflow-x:hidden; }
  #app .sidebar .tab, #app .sidebar .chan { min-width:0; font-size:14px; padding:8px 9px; gap:8px; overflow-wrap:anywhere; }
  #app .sidebar .brand-lockup, #app .sidebar .server-head { min-width:0; max-width:100%; }
  #app .sidebar .section-title { min-width:0; overflow-wrap:anywhere; }
  #view-dms .dm-layout { min-height:0; min-width:0; max-width:100%; }
  #view-dms .dm-list { min-width:0; max-width:100%; }
  #view-dms .dm-list-head { min-width:0; padding:9px 8px; gap:6px; flex-wrap:wrap; }
  #view-dms .dm-list-head > * { max-width:100%; min-width:0; }
  #view-dms .dm-chat { min-width:0; }
  #view-dms .dm-msg { min-width:0; max-width:100%; }
  #view-dms .dm-compose { min-width:0; max-width:100%; }
  #view-dms .dm-compose input { min-width:0; font-size:16px; }
  #app .modal-card { width:min(100%,560px); max-width:100%; box-sizing:border-box; }
  #app input, #app select, #app textarea { max-width:100%; box-sizing:border-box; }
}
@media screen and (max-width:390px) {
  #app .bar { padding-inline:6px; gap:4px; }
  #app .bar .btn { padding-inline:6px; }
  #app .post { padding-inline:6px; }
  #app .actions { column-gap:5px; }
  #app .sidebar .tab, #app .sidebar .chan { font-size:13px; }
}
@media screen and (min-width:761px) and (max-width:1100px) {
  #app .center, #app .view, #app .post, #app .dm-layout { min-width:0; max-width:100%; }
  #app .post img, #app .post video { max-width:100%; height:auto; }
}

/* POLO2 Android v0.1.2 Beta: adaptive bottom navigation and compact phone UI.
   Scoped to <=760px: desktop and Electron layout remain unchanged. */
.p2b-mobile-nav { display:none; }
@media screen and (max-width:760px) {
  :root { --p2b-mobile-nav-height: 62px; }
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  html,body { max-width:100%; overflow-x:hidden; }
  #app.app { grid-template-columns:minmax(0,1fr)!important; width:100%; height:100dvh; overflow:hidden; }
  #app > .servers { display:none!important; }
  #app > .sidebar { left:0!important; width:min(88vw,330px)!important; max-width:100vw!important; z-index:30; }
  body.drawer #app > .sidebar { left:0!important; }
  #app .center { width:100%; height:100dvh; min-width:0; min-height:0; padding-bottom:calc(var(--p2b-mobile-nav-height) + env(safe-area-inset-bottom)); }
  #app .view { min-width:0; min-height:0; overflow-x:hidden; }
  .p2b-mobile-nav:not([hidden]) {
    display:grid; grid-template-columns:repeat(5,minmax(0,1fr));
    position:fixed; z-index:24; bottom:0; left:0; right:0;
    min-height:calc(var(--p2b-mobile-nav-height) + env(safe-area-inset-bottom));
    padding:5px max(5px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left));
    background:#080808; border-top:1px solid #353535;
    box-shadow:0 -4px 22px rgba(0,0,0,.4);
  }
  .p2b-mobile-nav button {
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
    min-width:0; min-height:49px; padding:5px 2px; border:0; border-radius:9px;
    color:#a7a7a7; background:transparent; font:700 10px/1.2 var(--body); cursor:pointer;
  }
  .p2b-mobile-nav button i { font-size:18px; line-height:1.2; }
  .p2b-mobile-nav button.active { color:#fff; background:#242424; }
  .p2b-mobile-nav button[data-mobile-view="create"] i { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; color:#000; background:#fff; font-size:17px; }
  .p2b-mobile-nav button[data-mobile-view="create"] span { font-size:9px; }
  #app .bar { min-height:48px; padding:7px 10px; }
  #app .bar h2 { font-size:clamp(15px,4vw,18px); }
  #app .bar .btn { font-size:12px; }
  #app .composer { gap:8px; padding:10px; }
  #app .composer .avatar { width:34px; height:34px; flex-basis:34px; }
  #app .composer textarea { font-size:16px; }
  #app .post { padding:10px; gap:8px; }
  #app .post .avatar { width:34px; height:34px; flex-basis:34px; }
  #app .post-head { flex-wrap:wrap; font-size:13px; gap:4px; }
  #app .post-text { font-size:14px; line-height:1.45; }
  #app .actions { gap:5px 8px; justify-content:space-between; }
  #app .actions .act { min-width:0; min-height:38px; font-size:12px; padding:5px 3px; }
  #app .post, #app .post-body, #app .msg, #app .dm-msg { overflow-wrap:anywhere; }
  #app .feed-modes button { font-size:13px; }
  #view-notifs #notifs { font-size:13px; }
  #view-notifs #notifs > * { overflow-wrap:anywhere; }
  #view-dms .dm-layout { display:flex; flex:1; flex-direction:column; height:auto; min-height:0; }
  body:not(.dm-chat-open) #view-dms .dm-list { display:block; flex:1; width:100%; max-height:none; min-height:0; overflow-y:auto; }
  body:not(.dm-chat-open) #view-dms .dm-chat { display:none!important; }
  body.dm-chat-open #view-dms { z-index:26; padding-bottom:0; }
  body.dm-chat-open #view-dms .dm-chat { display:flex!important; flex:1; }
  body.dm-chat-open #view-dms .dm-layout { height:100%; }
  body.dm-chat-open .p2b-mobile-nav { display:none!important; }
  #view-settings .account-settings-layout { min-height:0; flex:1; overflow:hidden; grid-template-rows:auto minmax(0,1fr); }
  #view-settings .account-settings-nav { min-width:0; max-width:100%; padding:7px 8px; }
  #view-settings .account-settings-nav button { font-size:12px; padding:8px 10px; min-height:40px; }
  #view-settings .account-settings-main { min-width:0; overflow-x:hidden; padding:12px 10px calc(18px + env(safe-area-inset-bottom)); }
  #view-settings .account-settings-main > h2 { font-size:19px; }
  #view-settings .account-settings-content, #view-settings .account-setting-card { min-width:0; max-width:100%; }
  #view-settings .account-settings-main input:not([type="checkbox"]):not([type="radio"]),
  #view-settings .account-settings-main select,
  #view-settings .account-settings-main textarea { min-width:0; max-width:100%; width:100%; font-size:16px!important; text-overflow:ellipsis; }
  #view-settings .account-settings-main h3 { font-size:17px; }
  #view-settings .account-settings-main p { overflow-wrap:anywhere; font-size:13px; }
  #music-library .music-library-card { width:calc(100vw - 16px); max-width:100%; max-height:calc(100dvh - 20px); overflow-x:hidden; overflow-y:auto; }
  #music-library .music-library-card h2 { font-size:clamp(19px,6vw,25px); }
  #music-library .music-link-form, #music-library .music-link-form > div { min-width:0; max-width:100%; }
  #music-library input:not([type="checkbox"]):not([type="range"]), #music-library button { max-width:100%; }
  #music-library .music-link-form input { min-width:0; flex:1 1 0; font-size:16px; }
  #music-library .music-link-form button { flex:0 0 auto; }
  #auth.auth { align-items:start; justify-items:center; overflow-y:auto; padding:calc(14px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)); }
  #auth .auth-box { align-self:start; width:min(100%,420px); max-width:100%; max-height:none; overflow:visible; padding:16px 14px; gap:10px; margin:32px auto 12px; }
  #auth .brand-logo-auth { display:block; width:min(100%,290px); max-width:100%; height:auto; object-fit:contain; }
  #auth .auth-box input { width:100%; min-width:0; font-size:16px; min-height:44px; }
  #auth .auth-box .btn { width:100%; min-height:43px; font-size:14px; }
  #auth .auth-box p { overflow-wrap:anywhere; }
  #app .toast { bottom:calc(var(--p2b-mobile-nav-height) + 12px + env(safe-area-inset-bottom)); }
}
@media screen and (max-width:360px) {
  :root { --p2b-mobile-nav-height:58px; }
  .p2b-mobile-nav button { font-size:9px; }
  .p2b-mobile-nav button i { font-size:16px; }
  #app .post { padding:8px 6px; gap:6px; }
  #app .bar { gap:4px; padding:6px; }
}

/* POLO2 Android v0.1.3 Beta — phone-only server rail recovery + compact layout.
   No changes to desktop/Electron or Firebase data logic. */
@media screen and (max-width:760px) {
  :root { --p2b-mobile-nav-height:56px; }
  body { font-size:13px; line-height:1.38; }
  /* The v0.1.2 rule hid the real server rail; restore it inside the drawer. */
  #app > .servers { display:flex!important; position:fixed; top:0; bottom:0; left:0;
    width:52px; z-index:45; transform:translateX(-125%); overflow-y:auto; }
  body.drawer #app > .servers { transform:none; }
  #app > .sidebar { position:fixed; top:0; bottom:0; left:52px!important;
    width:min(calc(100vw - 52px),285px)!important; max-width:calc(100vw - 52px)!important;
    z-index:46; transform:translateX(-125%); }
  body.drawer #app > .sidebar { left:52px!important; transform:none; }
  #app > .servers .srv { width:39px; height:39px; font-size:13px; }
  #app > .sidebar .tab, #app > .sidebar .chan { font-size:12px; padding:7px 8px; }
  #app > .sidebar .brand-logo-sidebar { width:106px!important; min-width:106px!important; max-width:106px!important; }
  #app > .sidebar .app-version { font-size:10px; }
  #app > .sidebar .personal-music { font-size:12px; }
  .p2b-mobile-nav:not([hidden]) { z-index:25; }
  .p2b-mobile-nav button { font-size:10px; min-height:43px; gap:2px; padding:3px 1px; }
  .p2b-mobile-nav button i { font-size:17px; }
  #app .bar { min-height:42px; padding:5px 9px; }
  #app .bar h2 { font-size:16px; }
  #app .bar .btn { font-size:12px; padding:6px 8px; }
  #app .composer { padding:7px 8px; gap:7px; }
  #app .composer .avatar, #app .post .avatar { width:30px; height:30px; flex-basis:30px; }
  #app .composer textarea { font-size:14px; line-height:1.4; }
  #app .post { padding:8px; gap:6px; }
  #app .post-head { font-size:12px; }
  #app .post-text { font-size:13px; line-height:1.4; }
  #app .actions { gap:3px 6px; }
  #app .actions .act { font-size:11px; min-height:33px; padding:3px 2px; }
  #app .feed-modes button { font-size:12px; padding-block:8px; }
  #view-notifs #notifs, #view-notifs #notifs > * { font-size:12px; line-height:1.35; }
  #view-notifs #notifs > * { padding-block:8px; }
  #view-dms .dm-list, #view-dms .dm-chat { font-size:12px; }
  #view-settings .account-settings-nav button { font-size:11px; padding:6px 8px; min-height:35px; }
  #view-settings .account-settings-main { font-size:12px; padding:9px 8px 16px; }
  #view-settings .account-settings-main > h2 { font-size:17px; }
  #view-settings .account-settings-main h3 { font-size:15px; }
  #view-settings .account-settings-main p { font-size:12px; line-height:1.4; }
  #view-settings .account-settings-main input:not([type=checkbox]):not([type=radio]),
  #view-settings .account-settings-main select { font-size:14px!important; min-width:0; }
  #auth .auth-box { margin:8px auto 12px; padding:12px; gap:8px; }
  #auth .brand-logo-auth { width:min(100%,215px); max-height:76px; margin-bottom:6px; }
  #auth .auth-box input { font-size:14px; min-height:40px; padding:8px 10px; }
  #auth .auth-box .btn { font-size:13px; min-height:40px; padding:8px 10px; }
  #auth .auth-box p { font-size:12px; }
  #music-library .music-library-card { padding:12px; gap:9px; }
  #music-library .music-library-card h2 { font-size:19px; }
  #music-library .music-library-card p, #music-library .music-library-card label { font-size:12px; line-height:1.4; }
  #music-library .music-action { min-width:0; padding:9px 7px; font-size:12px; }
  #music-library .music-link-form input { font-size:14px; height:38px; padding:7px; }
  #music-library .music-link-form button, #music-library .music-library-options button { font-size:12px; padding:7px; }
  #music-library .music-library-options { gap:6px; }
  #music-library .music-library-options label { width:min(100%,125px); }
  #app .profile-head { padding:10px 8px; gap:6px; }
  #app .profile-head h3 { font-size:18px; }
  #app .profile-large-avatar { width:64px; height:64px; }
  #app .profile-head .btn { font-size:12px; padding:7px 9px; }
  #app .profile-head .post { background:rgba(0,0,0,.78); }
}

/* POLO2 Android v0.1.4 Beta — compact mobile sizing pass.
   CSS-only: no changes to Firebase, server/channel routing, or desktop UI. */
@media screen and (max-width:760px) {
  :root { --p2b-mobile-nav-height: 58px; }
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  body { font-size:12px; line-height:1.38; }
  #app .bar { min-height:40px; padding:5px 8px; gap:5px; }
  #app .bar h2 { font-size:15px; line-height:1.25; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #app .bar .btn { font-size:11px; padding:6px 7px; }
  #app .bar .icon { font-size:15px; }
  #app .composer { padding:7px 8px; gap:6px; }
  #app .composer textarea { font-size:13px; min-height:48px; }
  #app .post { padding:8px 7px; gap:6px; }
  #app .post-head { font-size:11px; line-height:1.3; gap:3px; }
  #app .post-text { font-size:12px; line-height:1.42; }
  #app .post .avatar, #app .composer .avatar { width:29px; height:29px; flex-basis:29px; }
  #app .actions { gap:2px 5px; }
  #app .actions .act { font-size:11px; padding:5px 2px; min-width:30px; min-height:36px; }
  #app .feed-modes button { font-size:12px; padding:8px 4px; }
  #app .msg { padding:6px 8px; gap:7px; font-size:12px; line-height:1.38; }
  #app .msg .avatar { width:28px; height:28px; flex-basis:28px; }
  #app .msgbox { gap:5px; padding:6px 7px; }
  #app .msgbox input { min-width:0; font-size:14px; min-height:40px; }
  #app .msgbox .btn { font-size:12px; padding:7px 8px; min-width:40px; }
  #view-notifs #notifs, #view-notifs #notifs > * { font-size:12px; line-height:1.35; }
  #view-notifs #notifs > * { padding:7px 8px; }
  #app .profile-head { padding:9px 8px; gap:5px; }
  #app .profile-head h3 { font-size:17px; }
  #app .profile-head .avatar, #app .profile-large-avatar { width:58px; height:58px; }
  #app .profile-head .btn { font-size:12px; padding:7px 8px; }
  #app .profile-banner { height:95px; }
  #app > .sidebar .tab, #app > .sidebar .chan { font-size:12px; padding:7px 8px; }
  #app > .sidebar .section-title { font-size:11px; }
  #app > .servers .srv { width:38px; height:38px; }
  #auth .auth-box { padding:12px; gap:7px; }
  #auth .auth-box input { font-size:14px; min-height:40px; }
  #auth .auth-box .btn { font-size:13px; min-height:40px; }
  #music-library .music-library-card { width:calc(100vw - 20px); max-width:430px; padding:11px; gap:8px; }
  #music-library .music-library-card h2 { font-size:18px; line-height:1.2; }
  #music-library .music-library-card p, #music-library .music-library-card label { font-size:11px; line-height:1.4; }
  #music-library .music-action { font-size:12px; padding:8px 6px; min-width:0; }
  #music-library .music-link-form input { font-size:14px; min-width:0; }
  #music-library .music-link-form button { font-size:12px; }
  .p2b-mobile-nav:not([hidden]) { grid-template-columns:repeat(5,minmax(0,1fr)); padding-left:3px; padding-right:3px; }
  .p2b-mobile-nav button { box-sizing:border-box; width:100%; min-width:0; min-height:48px; padding:5px 0; gap:3px; font-size:9px; line-height:1.1; overflow:hidden; }
  .p2b-mobile-nav button i { font-size:17px; line-height:1.15; flex-shrink:0; }
  .p2b-mobile-nav button span { display:block; width:100%; min-width:0; white-space:nowrap; text-align:center; font-size:9px; font-weight:700; letter-spacing:-.25px; }
}
@media screen and (max-width:360px) {
  .p2b-mobile-nav button span { font-size:8px; letter-spacing:-.4px; }
}

/* Phase 4.3: Admin portal overlays the shared modal otherwise (500 vs 100). */
#admin-portal:not([hidden]) ~ #modal:not([hidden]) { z-index: 650; }
#admin-portal:not([hidden]) ~ #toast { z-index: 700; }

/* Keep the Admin badge checkbox rows horizontal inside the shared modal. */
#admin-portal:not([hidden]) ~ #modal .modal-body label.check-row { display:flex; flex-direction:row; align-items:center; }

/* Phase 4.5: prevent phone reply input from squeezing the submit label. */
#app .reply-box {display:flex;align-items:stretch;min-width:0;max-width:100%;gap:8px;}
#app .reply-box input {flex:1 1 0;min-width:0;width:100%;}
#app .reply-box button {flex:0 0 auto;min-width:58px;white-space:nowrap;overflow-wrap:normal;word-break:normal;}
#app .post-author-badges,#app .message-author-badges {display:inline-flex;align-items:center;flex-wrap:wrap;gap:3px;vertical-align:middle;}

/* Phase 4.5.1 — GIF/static custom badge recovery in full profiles and popouts.
   A failed image stays visible as the badge's first letter, not an empty ring. */
.admin-badge.custom-badge .badge-image-fallback{display:none;font-size:11px;font-weight:800;align-items:center;justify-content:center;width:100%;height:100%}
.admin-badge.custom-badge.badge-image-error img{display:none!important}
.admin-badge.custom-badge.badge-image-error .badge-image-fallback{display:flex}

/* Phase 4.5.4: prevent broken custom GIF/image badges from being empty rings.
   Scope strictly to custom badges; built-ins and profile layout are unchanged. */
.admin-badge.custom-badge{position:relative;isolation:isolate;}
.admin-badge.custom-badge img[data-p2b-custom-badge-image]{width:100%;height:100%;object-fit:contain;display:block;border-radius:50%;}
.admin-badge.custom-badge.badge-image-error{background:rgba(0,0,0,.85)!important;color:#fff!important;border-color:rgba(255,255,255,.85)!important;}
.admin-badge.custom-badge.badge-image-error .badge-image-fallback{display:flex!important;position:absolute;inset:0;z-index:1;font-size:10px;line-height:1;font-weight:800;align-items:center;justify-content:center;color:#fff;pointer-events:none;}
.admin-badge.custom-badge.badge-image-error img[data-p2b-custom-badge-image]{display:none!important;}
.p4-custom-badge-admin-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end;}
@media(max-width:700px){.p4-custom-badge-admin-actions{grid-column:1/-1;justify-content:flex-start;}}


/* Phase 4.5.5: Only the verified checkmark is shown next to feed authors.
   Custom/developer/admin badges remain exclusive to profile views. */
#posts .post-head .feed-verified-badge{display:inline-flex;align-items:center;flex:0 0 auto;vertical-align:middle}
#posts .post-head .feed-verified-badge:empty{display:none}
#posts .post-head .feed-verified-badge .verified-icon{width:17px;height:17px;min-width:17px;min-height:17px;flex:0 0 17px;font-size:10px;line-height:1}
