/* ============================================================
   ORIGINAL DESKTOP STYLES
   ============================================================ */
:root{
  --bg:#05070d;
  --card:#0a0e18;
  --accent:#7fd8ff;
  --muted:#b8c7d9;
  --glass:rgba(160,200,255,0.06);
  --success:#6dffe7;
  --danger:#ff7aa8;
  --panel:rgba(10,14,24,0.8);
  --panel-border:rgba(160,200,255,0.25);
  --accent-glow:0 0 12px rgba(127,216,255,0.6);
  font-family:Inter,system-ui,Segoe UI,Roboto,"Helvetica Neue",Arial;
}

html,body{
  min-height:100%;
  height:auto;
  margin:0;
  overflow-x:hidden;
  overflow-y:auto;
  background-color:#020617;
  background-image:url('/images/mcf3.png');
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;
  background-attachment:fixed;
  color:#e9f6ff;
}

body::after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-1;
  background:
    radial-gradient(circle, rgba(120,200,255,0.35) 0%, transparent 60%) 10% 20%,
    radial-gradient(circle, rgba(120,200,255,0.25) 0%, transparent 60%) 80% 30%,
    radial-gradient(circle, rgba(120,200,255,0.20) 0%, transparent 60%) 50% 70%,
    radial-gradient(circle, rgba(120,200,255,0.30) 0%, transparent 60%) 30% 85%,
    radial-gradient(circle, rgba(120,200,255,0.18) 0%, transparent 60%) 70% 60%;
  background-size:180px 180px,140px 140px,200px 200px,160px 160px,120px 120px;
  animation:holoParticles 22s linear infinite;
  opacity:0.35;
  filter:blur(1px);
}

@keyframes holoParticles{
  0%{background-position:10% 20%,80% 30%,50% 70%,30% 85%,70% 60%;}
  50%{background-position:15% 25%,75% 35%,55% 65%,35% 80%,55% 55%;}
  100%{background-position:10% 20%,80% 30%,50% 70%,30% 85%,70% 60%;}
}

.container{
  position: relative;
  box-sizing: border-box;
  width: calc(100% - 21%);
  max-width:1100px;
  margin:36px 28px 36px 21%;
  padding:28px;
  overflow: visible;
  background:linear-gradient(180deg, rgba(0,16,122,0.05), transparent);
  border-radius:12px;
  box-shadow:0 8px 30px rgba(120,180,255,0.25);
}

.container-main{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(180px, 240px);
  gap:20px;
  align-items:start;
}

header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.logo{
  width:72px;
  height:56px;
  border-radius:8px;
  background:linear-gradient(135deg,#7fd8ff,#b0c4ff);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  color:#00121f;
  box-shadow:0 0 12px #7fd8ff, 0 0 24px #7fd8ff;
}

.container .actions{
  position:fixed;
  left:30px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:18px;
  width:15%;
}

button{
  background:#00e5ff;
  border:0;
  padding:10px 14px;
  border-radius:8px;
  color: white;
  font-weight:600;
  cursor:pointer;
  box-shadow:0 0 14px rgba(0,229,255,0.7), 0 0 28px rgba(0,229,255,0.35);
}

button.ghost{
  background:transparent;
  border:1px solid rgba(0,229,255,0.45);
  color: white;
}

.grid{
  display:grid;
  grid-template-columns:1f;
  width:100%;
  position:relative;
}

.gridContent{
  display:flex;
  flex-direction:row;
  gap:20px;
}
.card{
  background:var(--card);
  padding:18px;
  border-radius:10px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.05);
}

.hero{
  min-height:220px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.user-profile-card{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:16px;
  background:linear-gradient(180deg, rgba(127,216,255,0.08), rgba(160,200,255,0.04));
  border:1px solid rgba(127,216,255,0.2);
  border-radius:10px;
  align-items:center;
  text-align:center;
  max-width: 130px;
}

.user-profile-card.logged-in{
  flex-direction:column;
  align-items:flex-start;
  text-align:left;
}

.profile-avatar{
  width:56px;
  height:56px;
  border-radius:8px;
  background:linear-gradient(135deg,#1a2233,#0d1320);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#dfffff;
  font-weight:700;
  font-size:24px;
  border:1px solid rgba(160,200,255,0.25);
  flex-shrink:0;
}

.profile-avatar-img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:50%;
}

.profile-info{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1;
}

.profile-name{
  font-weight:600;
  font-size:16px;
  color:#e9ffff;
  margin:0;
}

.profile-status{
  font-size:12px;
  color:var(--muted);
  margin:0;
}

.profile-details{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:8px 0;
  border-top:1px solid rgba(127,216,255,0.1);
  border-bottom:1px solid rgba(127,216,255,0.1);
  margin-bottom:8px;
}

.profile-age{
  font-size:12px;
  color:var(--accent);
  font-weight:500;
}

.profile-bio{
  font-size:11px;
  color:var(--muted);
  line-height:1.4;
  max-width:200px;
}

.profile-stats{
  display:flex;
  gap:16px;
  font-size:12px;
}

.profile-stat{
  display:flex;
  flex-direction:column;
  gap:2px;
  align-items:center;
}

.profile-stat-value{
  font-weight:600;
  color:var(--accent);
}

.profile-stat-label{
  color:var(--muted);
  font-size:10px;
}

#dmSidebar,
#roomsSidebar{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  box-sizing:border-box;
  background:rgba(2,6,23,0.72);
  backdrop-filter:blur(8px);
  z-index:9999;
}

#dmSidebar .list-popup-panel,
#roomsSidebar .list-popup-panel{
  width:min(760px, 94vw);
  max-height:min(80vh, 720px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  gap:12px;
  box-sizing:border-box;
  background:linear-gradient(180deg, rgba(15,23,42,0.96), rgba(5,10,22,0.98));
  border:1px solid rgba(127,216,255,0.35);
  border-radius:14px;
  padding:18px;
  box-shadow:0 24px 70px rgba(0,0,0,0.5), 0 0 24px rgba(127,216,255,0.22);
}

#dmSidebar .side-panel-header,
#roomsSidebar .side-panel-header{
  flex-shrink:0;
  padding-bottom:10px;
  margin-bottom:0;
  border-bottom:1px solid rgba(160,200,255,0.15);
}

.dm-search{
  width:100%;
  background:rgba(160,200,255,0.05);
  border:1px solid rgba(160,200,255,0.25);
  padding:8px;
  border-radius:8px;
  color:#e6f6ff;
  margin-bottom:0;
}

.dm-list,
.rooms-list{
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  gap:10px;
  width:100%;
  min-height:0;
  overflow:auto;
  padding-right:4px;
}

.dm-sidebar-item{
  width:100%;
  box-sizing:border-box;
  padding:10px;
  border-radius:10px;
  background:rgba(160,200,255,0.08);
  border:1px solid rgba(160,200,255,0.12);
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.dm-sidebar-item:hover{
  background:rgba(160,200,255,0.15);
}

.dm-unread-badge{
  background:#7fd8ff;
  color:#00121f;
  padding:2px 6px;
  border-radius:6px;
  font-size:11px;
  font-weight:bold;
  flex-shrink:0;
}


.roster-list{
  display:flex;flex-direction:column;gap:8px;
  max-height:420px;overflow:auto;padding-right:6px;
  background-color: rgba(0,0,0,0.45);
  background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('/images/mcf1.png');
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;
  background-blend-mode: normal;
  border-radius:10px;
  padding:10px;
  border:1px solid rgba(160,200,255,0.2);
}

/* Roster and Story list backgrounds using mcf1.png */
#rosterPage,
#quickRoster,
#rosterList,
#archivesList,
#profileStories,
#profileRelationships,
#profileTimeline,
#profilePendingStories,
#archivesList.roster-list,
#rosterPage.roster-list {
  background-color: rgba(0,0,0,0.45);
  background-image: linear-gradient(rgba(0,0,0,0.58), rgba(0,0,0,0.58)), url('/images/mcf1.png');
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;
  border-radius:10px;
  padding:10px;
  border:1px solid rgba(160,200,255,0.2);
}

/* Make inner cards translucent so mcf1.png shows through */
#profileStories .story-item,
#profileRelationships .relationship-item,
#profileTimeline .timeline-item,
#profilePendingStories .story-item,
#archivesList .story-item,
#archivesList .roster-user,
.roster-list .roster-user,
#rosterPage .roster-user,
#quickRoster .user-row,
.roster-list .user-row {
  background: rgba(15, 23, 42, 0.78) !important;
  backdrop-filter: blur(2px);
  border: 1px solid rgba(127,216,255,0.18);
}

#profileStories .story-item.pending,
#profilePendingStories .story-item.pending {
  background: rgba(34, 34, 34, 0.85) !important;
}
.user-row {
  background: var(--glass);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: 0.2s;
}

.user-row:hover {
  background: rgba(0, 255, 255, 0.12);
  box-shadow: var(--accent-glow);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0, 255, 255, 0.15);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--accent);
  text-shadow: var(--accent-glow);
}
.status{width:10px;height:10px;border-radius:50%}
.status.online{background:var(--success)}
.status.offline{background:var(--muted)}

.small{font-size:13px;color:var(--muted)}

.chat-popup{
  position:fixed;
  right:28px;
  bottom:28px;
  width:650px;
  height:620px;
  background:linear-gradient(180deg,#050a16,#0a1324);
  border-radius:12px;
  border:1px solid rgba(160,200,255,0.12);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow:0 20px 60px rgba(120,180,255,0.25);
  cursor:default;
}

.chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid rgba(160,200,255,0.12);
  cursor:grab;
}

.chat-popup.shifted{
  transform:translate(-260px);
}

.chat-header:active{
  cursor:grabbing;
}

.chat-body{
  display:flex;
  flex:1;
  gap:10px;
  overflow:hidden;
}

.public-feed{
  flex:1;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
}

.online-list{
  width:160px;
  border-left:1px solid rgba(160,200,255,0.12);
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
}

.message{
  padding:8px 10px;
  border-radius:8px;
  background:rgba(160,200,255,0.06);
  max-width:78%;
  border:1px solid rgba(160,200,255,0.12);
}

.message.me{
  background:linear-gradient(90deg,rgba(127,216,255,0.20),rgba(176,196,255,0.12));
  align-self:flex-end;
  border-color:rgba(127,216,255,0.35);
}

.chat-input{
  display:flex;
  flex-wrap:wrap;
  padding:10px;
  border-top:1px solid rgba(160,200,255,0.12);
  gap:8px;
  width:110%;
}

/* ============================================================
   MESSAGE EDIT + REPLY
============================================================ */
.reply-bar{
  flex:1 1 100%;
  order:-1;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:var(--muted);
  background:rgba(127,216,255,0.08);
  border:1px solid rgba(127,216,255,0.25);
  border-radius:8px;
  padding:6px 10px;
  margin-bottom:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.reply-bar b{ color:var(--accent); font-weight:600; }
.reply-cancel{
  margin-left:auto;
  flex:0 0 auto;
  background:transparent;
  border:1px solid rgba(160,200,255,0.3);
  border-radius:6px;
  color:var(--muted);
  padding:2px 8px;
  font-size:12px;
  cursor:pointer;
  box-shadow:none;
}
.reply-cancel:hover{ color:#fff; border-color:var(--accent); }

.reply-preview{
  font-size:12px;
  color:var(--muted);
  background:rgba(160,200,255,0.08);
  border-left:3px solid var(--accent);
  padding:4px 8px;
  border-radius:4px;
  margin-bottom:6px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.reply-preview b{ color:var(--accent); }

.edited-marker{ color:var(--muted); font-style:italic; }

.message-actions{
  display:flex;
  gap:6px;
  margin-top:6px;
  opacity:0;
  transition:opacity 0.15s ease;
}
.message:hover .message-actions,
.message:focus-within .message-actions{ opacity:1; }

.msg-action{
  padding:2px 8px;
  border-radius:6px;
  background:transparent;
  border:1px solid rgba(160,200,255,0.25);
  color:var(--muted);
  font-size:11px;
  cursor:pointer;
  box-shadow:none;
}
.msg-action:hover{ color:#fff; border-color:var(--accent); background:rgba(127,216,255,0.1); }

.edit-box{
  margin-top:6px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.edit-input{
  width:100%;
  padding:6px 8px;
  border-radius:6px;
  border:1px solid rgba(127,216,255,0.5);
  background:rgba(127,216,255,0.06);
  color:#e9f6ff;
}
.edit-buttons{ display:flex; gap:6px; }

.pm-window{
  position:fixed;
  right:460px;
  bottom:28px;
  width:320px;
  height:360px;
  background:linear-gradient(180deg,#050a16,#0a1324);
  border-radius:10px;
  border:1px solid rgba(160,200,255,0.12);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow:0 20px 60px rgba(120,180,255,0.25);
}

.pm-header{
  padding:10px;
  border-bottom:1px solid rgba(160,200,255,0.12);
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.pm-body{
  flex:1;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
}

.pm-input{
  display:flex;
  padding:8px;
  border-top:1px solid rgba(160,200,255,0.12);
  gap:8px;
}
.small-btn{
  padding:6px 8px;
  border-radius:8px;
  background:rgba(160,200,255,0.06);
  border:1px solid rgba(160,200,255,0.25);
  color:var(--muted);
  cursor:pointer;
}

footer{
  margin-top:18px;
  color:var(--muted);
  font-size:13px;
  text-align:center;
}

/* Desktop app download button (footer) */
.download-app{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding:18px 16px;
  margin:18px auto 6px;
  max-width:480px;
  border:1px solid rgba(0,229,255,0.35);
  border-radius:12px;
  background:rgba(0,229,255,0.05);
  box-shadow:0 0 18px rgba(0,229,255,0.15);
}
.download-app-label{
  color:var(--muted);
  font-size:13px;
  letter-spacing:0.5px;
}
a.download-btn,
button.download-btn{
  display:inline-block;
  background:#00e5ff;
  color:#041018;
  font:inherit;
  font-weight:700;
  font-size:15px;
  padding:11px 22px;
  border:0;
  border-radius:8px;
  text-decoration:none;
  cursor:pointer;
  box-shadow:0 0 14px rgba(0,229,255,0.7), 0 0 28px rgba(0,229,255,0.35);
  transition:transform .12s ease, box-shadow .12s ease;
}
a.download-btn:hover,
button.download-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 0 18px rgba(0,229,255,0.9), 0 0 34px rgba(0,229,255,0.5);
}
.mobile-download-footer{
  border-color:rgba(127,216,255,0.28);
  background:rgba(127,216,255,0.045);
}
.app-store-coming-soon{ color:var(--muted); }
.download-platforms{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  justify-content:center;
  font-size:12px;
}
.download-platforms a{
  color:var(--accent);
  text-decoration:none;
  border-bottom:1px dotted rgba(127,216,255,0.4);
}
.download-platforms a:hover{ color:#fff; border-bottom-color:#fff; }
.download-platforms .sep{ color:var(--muted); opacity:0.6; }
.footer-brand{
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
}

#ageGate{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.95);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:9999;
  transition:opacity 1.2s ease;
}

#ageBox{
  background:#111;
  padding:40px;
  border-radius:10px;
  text-align:center;
  color:#fff;
}

#confirmBtn{
  margin-top:20px;
  padding:12px 24px;
  background:#e60000;
  border:none;
  border-radius:6px;
  color:#fff;
  font-size:16px;
  cursor:pointer;
}

#introGif{
  position:fixed;
  inset:0;
  background-size:cover;
  background-position:center;
  opacity:0;
  z-index:9998;
  transition:opacity 1.2s ease;
}

#storyPopup{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.85);
  display:none;
  justify-content:center;
  align-items:center;
  z-index:9999;
  backdrop-filter:blur(6px);
  animation:fadeIn 0.3s ease;
}

#storyPopup .modal-content{
  background:#111;
  padding:30px;
  width:480px;
  max-width:90%;
  border-radius:12px;
  box-shadow:0 0 25px rgba(0,150,255,0.4);
  border:1px solid rgba(0,150,255,0.4);
  color:#fff;
  animation:scaleIn 0.25s ease;
}

#storyPopup h2{
  margin-top:0;
  margin-bottom:20px;
  font-size:22px;
  text-align:center;
  color:#00aaff;
}

#storyDate{
  width:100%;
  padding:10px;
  background:#222;
  border:1px solid #444;
  border-radius:6px;
  color:#fff;
  margin-bottom:15px;
}

#storyEditor{
  width:100%;
  background:#181818;
  border:1px solid #333;
  border-radius:8px;
  padding:12px;
  color:#fff;
  font-size:14px;
  resize:vertical;
  font-family:monospace;
}

#storyLoadBtn,
#storySaveBtn,
#storyCloseBtn{
  padding:10px 18px;
  margin-top:15px;
  margin-right:10px;
  border:none;
  border-radius:6px;
  cursor:pointer;
  font-size:14px;
}

#storyLoadBtn{background:#0077ff;color:#fff;}
#storySaveBtn{background:#00cc66;color:#fff;}
#storyCloseBtn{background:#444;color:#ddd;}

#storyLoadBtn:hover{background:#3399ff;}
#storySaveBtn:hover{background:#00e67a;}
#storyCloseBtn:hover{background:#555;}

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

@keyframes scaleIn{
  from{transform:scale(0.9);opacity:0;}
  to{transform:scale(1);opacity:1;}
}

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.85);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.modal-content{
  background:#111;
  padding:30px;
  border-radius:12px;
  width:400px;
  text-align:center;
  color:#fff;
  border:1px solid #00aaff;
}

.modal-content button{
  margin:10px;
  padding:10px 20px;
  border-radius:6px;
  border:none;
  cursor:pointer;
}

#approveStoryBtn{
  background:#00cc66;
  color:#fff;
}

#denyStoryBtn{
  background:#cc0000;
  color:#fff;
}

#profilePendingStories{
  margin-top:20px;
}

.story-item.pending{
  background:#222;
  border-left:4px solid #ffaa00;
}

.story-item.pending.tiny{
  background:#222;
  border-left:4px solid #ffaa00;
  padding:6px;
  font-size:12px;
}

.message.system{
  background:#222;
  border-left:4px solid #ffaa00;
  padding:10px;
  margin:10px 0;
  border-radius:6px;
  color:#fff;
}

.system-msg button{
  margin-top:10px;
}

#profileStories .story-item,
#profileRelationships .relationship-item,
#profileTimeline .timeline-item{
  background:#1a1a1a;
  padding:10px;
  margin-bottom:10px;
  border-radius:6px;
  border-left:4px solid #00aaff;
}

.timeline-item{
  border-left-color:#ffaa00;
}

.timeline-date{
  font-size:11px;
  opacity:0.7;
}

.timeline-desc{
  font-size:14px;
}

.holo-avatar{
  position:relative;
  border-radius:12px;
  overflow:hidden;
  border:2px solid rgba(0,150,255,0.55);
  box-shadow:
    0 0 8px rgba(0,150,255,0.6),
    0 0 16px rgba(0,150,255,0.4),
    inset 0 0 10px rgba(0,150,255,0.3);
}

.holo-avatar::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(
    120deg,
    rgba(0,150,255,0.15),
    rgba(255,255,255,0.15),
    rgba(0,150,255,0.15)
  );
  mix-blend-mode:overlay;
  animation:holoShimmer 4s linear infinite;
  pointer-events:none;
}

@keyframes holoShimmer{
  0%{opacity:0.4;transform:translateX(-20%);}
  50%{opacity:0.8;transform:translateX(20%);}
  100%{opacity:0.4;transform:translateX(-20%);}
}

.rel-rival{
  border-left:4px solid #ff3b3b;
  background:rgba(255,60,60,0.08);
}

.rel-friend{
  border-left:4px solid #3bff6b;
  background:rgba(60,255,120,0.08);
}

.rel-opponent{
  border-left:4px solid #ff9f3b;
  background:rgba(255,160,60,0.08);
}

.rel-tagteam{
  border-left:4px solid #3b9fff;
  background:rgba(60,160,255,0.08);
}

.rel-dating{
  border-left:4px solid #ff3bbd;
  background:rgba(255,60,180,0.08);
}

.rel-married{
  border-left:4px solid #a03bff;
  background:rgba(160,60,255,0.08);
}

.rel-sibling{
  border-left:4px solid #3bffd7;
  background:rgba(60,255,220,0.08);
}

.rel-parent{
  border-left:4px solid #ffd83b;
  background:rgba(255,220,60,0.08);
}

.rel-owner{
  border-left:4px solid #c0c0c0;
  background:rgba(200,200,200,0.08);
}

.popup{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  background:rgba(10,10,20,0.95);
  backdrop-filter:blur(6px);
  z-index:9999;
  overflow-y:auto;
  padding:20px;
  display:none;
}

.popup.active{
  display:block;
}

.popup h2,
.popup h3{
  margin-top:0;
  color:#fff;
  text-align:center;
}

.popup .close-btn{
  position:absolute;
  top:12px;
  right:12px;
  background:#ff3b3b;
  color:#fff;
  border:none;
  padding:8px 12px;
  border-radius:6px;
}

#profilePopup{
  display:none;
}

#profilePopup.active{
  display:block;
}

#profilePopup img{
  width:120px;
  height:120px;
  border-radius:12px;
  display:block;
  margin:0 auto 20px;
}

#profilePopup .section{
  background:rgba(255,255,255,0.05);
  padding:12px;
  border-radius:8px;
  margin-bottom:12px;
}

#supportPopup.popup{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  background:rgba(10,10,20,0.92);
  backdrop-filter:blur(8px);
  display:none;
  overflow-y:auto;
  padding:40px;
  z-index:9999;
}

#supportPopup.active{
  display:block;
}

#supportPopup .close-btn{
  position:absolute;
  top:20px;
  right:20px;
  background:#ff3b3b;
  color:#fff;
  border:none;
  padding:10px 16px;
  border-radius:6px;
  font-size:14px;
  cursor:pointer;
}

.support-mobile{
  width:600px;
  max-width:90%;
  margin:0 auto;
  background:rgba(255,255,255,0.05);
  padding:30px;
  border-radius:12px;
  box-shadow:0 0 20px rgba(0,0,0,0.4);
  overflow-y:auto;
}

#supportPopup h2{
  text-align:center;
  color:#fff;
  margin-top:0;
  margin-bottom:25px;
  font-size:28px;
}

#supportPopup .pm-section{
  background:rgba(255,255,255,0.06);
  padding:20px;
  border-radius:10px;
  margin-bottom:20px;
}

#supportPopup label{
  color:#fff;
  font-size:15px;
  margin-bottom:8px;
  display:block;
}

#supportPopup input,
#supportPopup select,
#supportPopup textarea{
  width:100%;
  padding:12px;
  border-radius:8px;
  border:none;
  background:#1a1a25;
  color:#fff;
  font-size:15px;
  margin-top:6px;
}

#supportPopup textarea{
  resize:vertical;
}

#supportPopup #srSubmit{
  width:100%;
  padding:14px;
  border-radius:10px;
  border:none;
  font-size:18px;
  background:#3b9fff;
  color:#fff;
  cursor:pointer;
  margin-top:10px;
}

#supportPopup #srSubmit:hover{
  background:#5ab0ff;
}

/* ============================================================
   RESPONSIVE UI SPLIT
   The page ships both a mobile UI (#mainUI) and a desktop UI
   (.container). On small screens we show the mobile UI and
   hide the desktop container; on larger screens the reverse.
   Without this, #mainUI is never displayed (the loaded JS never
   reveals it) so the mobile .actions stay invisible.
   ============================================================ */
@media (max-width: 768px) {
  .container { display: none; }
  #mainUI {
    display: block;
    min-height: 100vh;
    overflow-y: auto;
  }
}

#userProfileCard {
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing:border-box;
    width:100%;
    max-width:none;
    margin:0;
    background: rgba(15, 23, 42, 0.8);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
    position: relative;
}

#layoutWrapper {
    position: relative;
    width: 100%;
}

#modalLogin,
#modalRegister,
#modalAdmin,
#modalAdminPassword,
#modalEditProfile {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
}

#modalLogin > div,
#modalAdminPassword > div {
  background:#111;
  padding:20px;
  border-radius:10px;
  width:360px;
  border:1px solid rgba(127,216,255,0.3);
}

#modalRegister > div {
  background:#111;
  padding:18px;
  border-radius:10px;
  width:520px;
  max-height:90vh;
  overflow:auto;
  border:1px solid rgba(127,216,255,0.3);
}

#modalAdmin > div {
  background:#0a0e18;
  padding:24px;
  border-radius:12px;
  width:min(900px, 95vw);
  max-height:90vh;
  overflow:auto;
  border:1px solid rgba(127,216,255,0.35);
  color:#e9f6ff;
}

#adminTable {
  width:100%;
  border-collapse:collapse;
  margin-top:12px;
  font-size:13px;
}

#adminTable th,
#adminTable td {
  border-bottom:1px solid rgba(160,200,255,0.15);
  padding:8px;
  text-align:left;
}

#adminSearch {
  width:100%;
  margin:10px 0;
  padding:8px;
  border-radius:6px;
  border:1px solid rgba(160,200,255,0.25);
  background:rgba(160,200,255,0.05);
  color:#e6f6ff;
}

.modal-overlay {
  position:fixed;
  inset:0;
  background:rgba(2,6,23,0.75);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.modal-box {
  background:#111;
  padding:24px;
  border-radius:12px;
  width:min(720px, 92vw);
  max-height:85vh;
  overflow:auto;
  border:1px solid rgba(127,216,255,0.35);
  color:#fff;
}

.modal-scroll {
  max-height:60vh;
  overflow:auto;
  line-height:1.5;
  font-size:13px;
  color:#cde;
}

.badge,
#dmBadge {
  background:#7fd8ff;
  color:#00121f;
  padding:1px 6px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  margin-left:4px;
}

.chat-image {
  max-width:220px;
  border-radius:8px;
  margin-top:6px;
  cursor:pointer;
  display:block;
}

.room-item {
  width:100%;
  box-sizing:border-box;
  padding:10px;
  margin-bottom:0;
  border-radius:10px;
  background:rgba(160,200,255,0.08);
  border:1px solid rgba(160,200,255,0.12);
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}

.room-item:hover {
  background:rgba(160,200,255,0.15);
}

.room-members-panel {
  width:160px;
  border-left:1px solid rgba(160,200,255,0.12);
  padding:12px;
  overflow:auto;
}

.room-member {
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:8px;
}

.room-member-status {
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--muted);
}
.room-member-status.online { background:var(--success); }

.roster-user {
  display:flex;
  gap:12px;
  align-items:center;
  padding:10px;
  border-radius:8px;
  background:rgba(160,200,255,0.06);
  margin-bottom:8px;
  cursor:pointer;
}
.roster-user:hover {
  background:rgba(160,200,255,0.14);
}

.avatar-img,
.avatar-fallback {
  border-radius:8px;
  object-fit:cover;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,255,255,0.15);
  border:1px solid var(--accent);
  color:var(--accent);
  font-weight:700;
}

.message-row {
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin-bottom:8px;
}
.message-row.me {
  flex-direction:row-reverse;
}

.side-close-btn {
  background:transparent;
  border:1px solid rgba(180,220,255,0.2);
  color:var(--muted);
  border-radius:6px;
  padding:4px 8px;
  cursor:pointer;
}

.side-panel-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  font-weight:700;
}

input, select, textarea {
  background:rgba(160,200,255,0.05);
  border:1px solid rgba(160,200,255,0.25);
  border-radius:6px;
  color:#e6f6ff;
  padding:8px;
  box-sizing:border-box;
}

#modalLogin input,
#modalRegister input,
#modalRegister select,
#modalRegister textarea,
#modalEditProfile input,
#modalEditProfile select,
#modalEditProfile textarea,
#modalAdminPassword input {
  width:100%;
  margin:6px 0;
}

/* ============================================================
   FORUMS
   ============================================================ */
.forum-overlay {
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  box-sizing:border-box;
  background:rgba(2,6,23,0.78);
  backdrop-filter:blur(8px);
  z-index:10020;
}

#newForumModal { z-index:10030; }
#forumThreadPopup { z-index:10025; }

.forum-panel {
  width:min(760px, 94vw);
  max-height:min(86vh, 760px);
  box-sizing:border-box;
  background:linear-gradient(180deg, rgba(15,23,42,0.98), rgba(5,10,22,0.99));
  border:1px solid rgba(127,216,255,0.38);
  border-radius:14px;
  padding:18px;
  color:#e9f6ff;
  box-shadow:0 24px 70px rgba(0,0,0,0.58), 0 0 24px rgba(127,216,255,0.2);
}

.forum-list-panel,
.forum-thread-panel {
  display:flex;
  flex-direction:column;
  gap:12px;
}

.forum-list-panel {
  min-height:min(420px, 70vh);
}

.forum-form-panel {
  width:min(560px, 94vw);
}

.forum-thread-panel {
  width:min(820px, 95vw);
  height:min(760px, 88vh);
}

.forum-panel-header {
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  padding-bottom:12px;
  border-bottom:1px solid rgba(160,200,255,0.18);
}

.forum-panel-header h3 {
  margin:0;
}

.forum-thread-title {
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:center;
}

#forumsList.forum-list {
  flex:1 1 auto;
  min-height:0;
  max-height:none;
  margin:0;
}

.forum-list-item {
  display:block;
  width:100%;
  margin:0;
  padding:12px;
  text-align:left;
  color:#e9f6ff;
  background:rgba(15,23,42,0.82);
  border:1px solid rgba(127,216,255,0.2);
  border-radius:10px;
  box-shadow:none;
}

.forum-list-item:hover,
.forum-list-item:focus-visible {
  background:rgba(0,229,255,0.13);
  border-color:rgba(127,216,255,0.55);
  box-shadow:0 0 14px rgba(127,216,255,0.18);
  outline:none;
}

.forum-list-item-heading,
.forum-reply-actions,
.forum-form-actions,
.forum-panel-actions {
  display:flex;
  align-items:center;
  gap:10px;
}

.forum-list-item-heading {
  justify-content:space-between;
}

.forum-list-title {
  min-width:0;
  color:#dff8ff;
  font-size:16px;
  font-weight:700;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.forum-reply-count {
  flex:0 0 auto;
  color:#7fd8ff;
  font-size:12px;
  font-weight:600;
}

.forum-list-excerpt {
  margin-top:6px;
  color:#c9d8e8;
  font-size:13px;
  line-height:1.4;
  word-break:break-word;
}

.forum-list-meta,
.forum-post-meta {
  margin-top:8px;
  color:var(--muted);
  font-size:12px;
}

.forum-panel-actions,
.forum-form-actions {
  justify-content:flex-end;
}

.forum-field {
  margin-top:14px;
}

.forum-field label {
  display:block;
  margin-bottom:6px;
  color:var(--muted);
  font-size:13px;
}

.forum-field input,
.forum-field textarea,
.forum-reply-composer textarea {
  width:100%;
}

.forum-field textarea,
.forum-reply-composer textarea {
  resize:vertical;
}

.forum-error {
  min-height:18px;
  margin-top:10px;
  color:#fca5a5;
  font-size:13px;
}

.forum-thread-content {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding-right:4px;
}

.forum-original-post,
.forum-replies {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.forum-replies-heading {
  margin:18px 0 8px;
  color:#7fd8ff;
  font-size:13px;
  font-weight:700;
}

.forum-post {
  padding:12px;
  border:1px solid rgba(160,200,255,0.18);
  border-radius:10px;
  background:rgba(15,23,42,0.72);
}

.forum-original-card {
  border-color:rgba(127,216,255,0.42);
  background:linear-gradient(135deg, rgba(16,45,73,0.76), rgba(15,23,42,0.84));
}

.forum-reply-card {
  margin-left:18px;
}

.forum-post-meta {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  margin-top:0;
}

.forum-post-author {
  color:#dff8ff;
  font-weight:700;
}

.forum-post-handle,
.forum-post-date {
  color:var(--muted);
}

.forum-post-body {
  margin-top:8px;
  color:#e9f6ff;
  font-size:14px;
  line-height:1.55;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.forum-reply-composer {
  flex:0 0 auto;
  padding-top:12px;
  border-top:1px solid rgba(160,200,255,0.18);
}

.forum-reply-actions {
  justify-content:space-between;
  margin-top:8px;
}

.forum-reply-actions .forum-error {
  margin-top:0;
}

.forum-empty {
  padding:14px;
  text-align:center;
}

.forum-panel button:disabled {
  opacity:0.6;
  cursor:not-allowed;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

@media (max-width: 560px) {
  .forum-overlay { padding:12px; }
  .forum-panel { padding:14px; width:96vw; }
  .forum-thread-panel { height:90vh; }
  .forum-reply-card { margin-left:0; }
  .forum-reply-actions { align-items:flex-end; flex-direction:column; }
  .forum-reply-actions .forum-error { align-self:stretch; }
}

/* ============================================================
   DM NOTIFICATION POPUP (top of mobile + desktop views)
============================================================ */
#dmNotification{
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  display: none;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: min(480px, calc(100vw - 28px));
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(10,22,44,0.97), rgba(4,10,24,0.97));
  border: 1px solid rgba(127,216,255,0.5);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.65), 0 0 20px rgba(127,216,255,0.28);
  color: #e9f6ff;
  cursor: pointer;
  animation: dmNotifIn 0.3s ease;
}

#dmNotification:hover{
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(0,0,0,0.65), 0 0 28px rgba(127,216,255,0.45);
}

@keyframes dmNotifIn{
  from{ opacity:0; transform:translateX(-50%) translateY(-12px); }
  to{ opacity:1; transform:translateX(-50%) translateY(0); }
}

.dm-notif-icon{
  font-size: 22px;
  flex-shrink: 0;
}

.dm-notif-text{
  flex: 1;
  min-width: 0;
}

.dm-notif-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.dm-notif-user{
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
  word-break: break-word;
}

/* MOBILE: stretch across the top of the screen */
@media (max-width: 768px){
  #dmNotification{
    top: 10px;
    left: 8px;
    right: 8px;
    transform: none;
    min-width: 0;
    max-width: none;
    width: auto;
    animation-name: dmNotifInMobile;
  }

  @keyframes dmNotifInMobile{
    from{ opacity:0; transform:translateY(-12px); }
    to{ opacity:1; transform:translateY(0); }
  }
}

/* ============================================================
   EXTRA PROFILE PHOTOS
   ============================================================ */
.profile-gallery-section,
.self-profile-photos {
  margin-top: 18px;
}

.profile-gallery-section h3,
.self-profile-photos h3 {
  margin: 0 0 10px;
}

.profile-photo-manager {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(127, 216, 255, 0.28);
  border-radius: 10px;
  background: rgba(127, 216, 255, 0.06);
}

.profile-photo-manager > button {
  align-self: flex-start;
}

.profile-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 14px;
  width: 100%;
}

/* --- Holographic octagonal frames ---------------------------------- */
.profile-photo-grid {
  --holo-cut: 24%;
  --holo-octagon: polygon(
    var(--holo-cut) 0%,
    calc(100% - var(--holo-cut)) 0%,
    100% var(--holo-cut),
    100% calc(100% - var(--holo-cut)),
    calc(100% - var(--holo-cut)) 100%,
    var(--holo-cut) 100%,
    0% calc(100% - var(--holo-cut)),
    0% var(--holo-cut)
  );
}

.profile-photo-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
  filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.42))
          drop-shadow(0 0 8px rgba(127, 216, 255, 0.22));
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* Outer holographic frame */
.profile-photo-tile::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: 0;
  clip-path: var(--holo-octagon, none);
  background: conic-gradient(
    from var(--holo-angle, 0deg),
    #7fd8ff, #a78bfa, #ff6ad5, #ffd166, #4ade80, #22d3ee, #7fd8ff
  );
  background-size: 100% 100%;
  animation: holoFrameSpin var(--holo-speed, 9s) linear infinite;
  animation-delay: var(--holo-delay, 0s);
  opacity: 0.92;
}

/* Inner bevel so the frame reads as a hard-edged octagon ring */
.profile-photo-tile::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  pointer-events: none;
  clip-path: var(--holo-octagon, none);
  background: linear-gradient(
    118deg,
    transparent 34%,
    rgba(255, 255, 255, 0.42) 47%,
    rgba(255, 255, 255, 0.08) 53%,
    transparent 66%
  );
  background-size: 260% 260%;
  mix-blend-mode: screen;
  animation: holoSheen var(--holo-sheen-speed, 6s) ease-in-out infinite;
  animation-delay: var(--holo-delay, 0s);
}

.profile-photo-tile img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: var(--holo-octagon, none);
  background: rgba(2, 8, 20, 0.85);
}

.profile-photo-tile:hover,
.profile-photo-tile:focus-visible {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5))
          drop-shadow(0 0 16px rgba(127, 216, 255, 0.6));
  outline: none;
}

.profile-photo-tile:hover::before,
.profile-photo-tile:focus-visible::before {
  opacity: 1;
  animation-duration: 3.2s;
}

/* Every tile gets its own holographic signature */
.profile-photo-tile:nth-child(6n + 1) {
  --holo-cut: 22%;
  --holo-speed: 9s;
  --holo-sheen-speed: 6s;
  --holo-delay: 0s;
  --holo-hue: 0deg;
}
.profile-photo-tile:nth-child(6n + 2) {
  --holo-cut: 26%;
  --holo-speed: 12s;
  --holo-sheen-speed: 7.5s;
  --holo-delay: -1.4s;
  --holo-hue: 55deg;
}
.profile-photo-tile:nth-child(6n + 3) {
  --holo-cut: 19%;
  --holo-speed: 7.5s;
  --holo-sheen-speed: 5.2s;
  --holo-delay: -2.8s;
  --holo-hue: 120deg;
}
.profile-photo-tile:nth-child(6n + 4) {
  --holo-cut: 28%;
  --holo-speed: 14s;
  --holo-sheen-speed: 8.4s;
  --holo-delay: -4.1s;
  --holo-hue: 190deg;
}
.profile-photo-tile:nth-child(6n + 5) {
  --holo-cut: 24%;
  --holo-speed: 10.5s;
  --holo-sheen-speed: 6.8s;
  --holo-delay: -5.6s;
  --holo-hue: 250deg;
}
.profile-photo-tile:nth-child(6n + 6) {
  --holo-cut: 21%;
  --holo-speed: 8.2s;
  --holo-sheen-speed: 5.9s;
  --holo-delay: -3.3s;
  --holo-hue: 305deg;
}

.profile-photo-tile::before {
  filter: hue-rotate(var(--holo-hue, 0deg)) saturate(1.25);
}

@property --holo-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes holoFrameSpin {
  from { --holo-angle: 0deg; }
  to   { --holo-angle: 360deg; }
}

@keyframes holoSheen {
  0%   { background-position: 0% 50%; opacity: 0.25; }
  45%  { opacity: 0.75; }
  100% { background-position: 200% 50%; opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-photo-tile::before,
  .profile-photo-tile::after {
    animation: none;
  }
  .profile-photo-tile {
    transition: none;
  }
}

.profile-photo-edit-tile {
  cursor: default;
}

.profile-photo-remove {
  position: absolute;
  z-index: 3;
  top: 9%;
  right: 9%;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.94);
  color: #fff;
  font-size: 21px;
  line-height: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.profile-photo-remove:hover,
.profile-photo-remove:focus-visible {
  background: #ef4444;
}

.profile-photo-remove:disabled {
  opacity: 0.55;
  cursor: wait;
}

.profile-photo-empty {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px dashed rgba(127, 216, 255, 0.22);
  border-radius: 8px;
  text-align: center;
}

.profile-photo-error {
  color: #fca5a5 !important;
}

@media (max-width: 560px) {
  .profile-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .profile-photo-manager > button {
    width: 100%;
  }
}

/* ============================================================
   H3 — GLOWING MULTICOLORED NEON TEXT
   ============================================================ */
h3{
  background-image:linear-gradient(90deg,#ff2d95,#ffb800,#00ff88,#00e5ff,#a55cff,#ff2d95) !important;
  background-size:200% 100% !important;
  background-position:0% 50% !important;
  background-repeat:repeat-x !important;
  -webkit-background-clip:text !important;
  background-clip:text !important;
  -webkit-text-fill-color:transparent !important;
  color:transparent !important;
  animation:mcfNeonFlow 8s linear infinite;
  filter:drop-shadow(0 0 4px rgba(255,45,149,.9)) drop-shadow(0 0 10px rgba(0,229,255,.75)) drop-shadow(0 0 22px rgba(165,92,255,.6));
}

@keyframes mcfNeonFlow{
  0%{background-position:0% 50%;}
  100%{background-position:100% 50%;}
}

@media (prefers-reduced-motion: reduce){
  h3{
    animation:none;
  }
}

/* ============================================================
   3D POPUP SURFACES
   Layered edge highlights, inset depth and cast shadows give every
   dialog a raised, physical panel while preserving the neon theme.
   ============================================================ */
:root {
  --popup-edge-bright: rgba(160, 225, 255, 0.78);
  --popup-edge-mid: rgba(54, 145, 205, 0.56);
  --popup-edge-dark: rgba(1, 8, 22, 0.96);
  --popup-depth: rgba(1, 7, 19, 0.92);
  --popup-surface-top: rgba(23, 38, 62, 0.99);
  --popup-surface-bottom: rgba(5, 11, 25, 0.99);
}

/* Dimmed stage makes the raised panel and its cast shadow readable. */
.modal-overlay,
.forum-overlay,
#dmSidebar,
#roomsSidebar,
#modalLogin,
#modalRegister,
#modalAdmin,
#modalAdminPassword,
#modalEditProfile,
#modalRoster,
#modalArchives,
#modalViewProfile,
#modalAccountSettings,
#storyPopup,
#ageGate,
.popup {
  background-color: rgba(1, 4, 14, 0.82) !important;
  background-image: radial-gradient(circle at 50% 42%, rgba(44, 142, 210, 0.15), transparent 48%) !important;
  backdrop-filter: blur(10px) brightness(0.72);
  -webkit-backdrop-filter: blur(10px) brightness(0.72);
}

/* The visible popup cards. Includes legacy dialogs whose panels only
   have inline styles, alongside the newer reusable panel classes. */
.list-popup-panel,
.forum-panel,
.modal-box,
.modal-content,
.support-mobile,
#ageBox,
#modalLogin > div,
#modalRegister > div,
#modalAdmin > div,
#modalAdminPassword > div,
#modalEditProfile > div,
#modalRoster > div,
#modalArchives > div,
#modalViewProfile > div,
#modalAccountSettings > div {
  position: relative;
  background: linear-gradient(145deg, var(--popup-surface-top) 0%, rgba(10, 22, 41, 0.99) 48%, var(--popup-surface-bottom) 100%) !important;
  border: 1px solid var(--popup-edge-bright) !important;
  outline: 1px solid rgba(2, 8, 20, 0.9);
  outline-offset: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.14),
    inset 2px 0 0 rgba(106, 204, 255, 0.1),
    inset -3px 0 0 rgba(0, 6, 20, 0.5),
    inset 0 -5px 0 rgba(0, 5, 17, 0.76),
    0 7px 0 var(--popup-depth),
    0 18px 22px rgba(0, 0, 0, 0.48),
    0 34px 78px rgba(0, 0, 0, 0.68),
    0 0 30px rgba(74, 184, 255, 0.24) !important;
}

/* A bevel catches light along the upper face without blocking controls. */
.list-popup-panel::before,
.forum-panel::before,
.modal-box::before,
.modal-content::before,
.support-mobile::before,
#ageBox::before,
#modalLogin > div::before,
#modalRegister > div::before,
#modalAdmin > div::before,
#modalAdminPassword > div::before,
#modalEditProfile > div::before,
#modalRoster > div::before,
#modalArchives > div::before,
#modalViewProfile > div::before,
#modalAccountSettings > div::before {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  top: 4px;
  left: 14px;
  right: 14px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(210, 244, 255, 0.72), transparent);
  box-shadow: 0 1px 7px rgba(91, 200, 255, 0.5);
}

/* Headers look seated into the front face of the panel. */
.side-panel-header,
.forum-panel-header,
.modal-header,
.chat-header {
  border-bottom-color: rgba(121, 210, 255, 0.58) !important;
  box-shadow: 0 2px 0 rgba(0, 5, 16, 0.72), 0 3px 8px rgba(0, 0, 0, 0.28);
}

/* Chat windows and notifications are also floating popup surfaces. */
.chat-popup,
#dmNotification {
  border: 1px solid var(--popup-edge-bright) !important;
  outline: 1px solid rgba(1, 7, 19, 0.86);
  outline-offset: 2px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.12),
    inset 2px 0 0 rgba(91, 198, 255, 0.1),
    inset -3px 0 0 rgba(0, 5, 18, 0.55),
    inset 0 -4px 0 rgba(0, 4, 15, 0.7),
    0 6px 0 rgba(1, 7, 18, 0.92),
    0 22px 55px rgba(0, 0, 0, 0.68),
    0 0 28px rgba(72, 190, 255, 0.3) !important;
}

/* Raised controls reinforce the depth without changing layout. */
.list-popup-panel button,
.forum-panel button,
.modal-box button,
.modal-content button,
.support-mobile button,
#ageBox button,
#modalLogin > div button,
#modalRegister > div button,
#modalAdmin > div button,
#modalAdminPassword > div button,
#modalEditProfile > div button,
#modalRoster > div button,
#modalArchives > div button,
#modalViewProfile > div button,
#modalAccountSettings > div button,
.chat-popup button {
  border-top: 1px solid rgba(220, 247, 255, 0.58);
  border-bottom: 2px solid rgba(0, 24, 48, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 0 rgba(0, 12, 29, 0.88), 0 6px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.list-popup-panel button:active,
.forum-panel button:active,
.modal-box button:active,
.modal-content button:active,
.support-mobile button:active,
#modalLogin > div button:active,
#modalRegister > div button:active,
#modalAdmin > div button:active,
#modalAdminPassword > div button:active,
#modalEditProfile > div button:active,
#modalRoster > div button:active,
#modalArchives > div button:active,
#modalViewProfile > div button:active,
#modalAccountSettings > div button:active,
.chat-popup button:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(0, 10, 24, 0.9);
}

@media (max-width: 768px) {
  .list-popup-panel,
  .forum-panel,
  .modal-box,
  .modal-content,
  .support-mobile,
  #modalLogin > div,
  #modalRegister > div,
  #modalAdmin > div,
  #modalAdminPassword > div,
  #modalEditProfile > div,
  #modalRoster > div,
  #modalArchives > div,
  #modalViewProfile > div,
  #modalAccountSettings > div {
    outline-offset: 2px;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.14),
      inset 2px 0 0 rgba(106, 204, 255, 0.1),
      inset -2px 0 0 rgba(0, 6, 20, 0.5),
      inset 0 -4px 0 rgba(0, 5, 17, 0.76),
      0 5px 0 var(--popup-depth),
      0 15px 20px rgba(0, 0, 0, 0.5),
      0 26px 55px rgba(0, 0, 0, 0.64),
      0 0 22px rgba(74, 184, 255, 0.22) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .list-popup-panel button,
  .forum-panel button,
  .modal-box button,
  .modal-content button,
  .support-mobile button,
  .chat-popup button {
    transition: none;
  }
}

/* ============================================================
   3D PRIMARY ACTION BUTTONS
   The main navigation controls use a beveled face, a solid lower edge,
   and a cast shadow so they feel raised and visibly depress on click.
   ============================================================ */
.actions > button {
  --action-depth: #00394c;
  --action-shadow: rgba(0, 0, 0, 0.58);
  --action-glow: rgba(0, 229, 255, 0.42);
  position: relative;
  isolation: isolate;
  border: 1px solid #40eaff;
  border-top-color: #b8fbff;
  border-bottom-color: #00546b;
  background-color: #008ba8;
  background-image:
    linear-gradient(112deg, transparent 16%, rgba(255, 255, 255, 0.32) 36%, transparent 53%),
    linear-gradient(180deg, #20d7e9 0%, #0097b7 48%, #00677f 72%, #004e65 100%);
  background-position: 120% 0, 0 0;
  background-size: 220% 100%, 100% 100%;
  background-repeat: no-repeat;
  color: #f4fdff;
  letter-spacing: 0.025em;
  text-shadow: 0 1px 0 #002b38, 0 0 7px rgba(215, 251, 255, 0.46);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.48),
    inset 2px 0 0 rgba(255, 255, 255, 0.1),
    inset -2px 0 0 rgba(0, 25, 40, 0.32),
    inset 0 -3px 0 rgba(0, 31, 44, 0.58),
    0 6px 0 var(--action-depth),
    0 9px 13px var(--action-shadow),
    0 0 17px var(--action-glow);
  transform: translateY(-3px);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 160ms ease,
    background-position 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.actions > button.ghost {
  --action-depth: #020a18;
  --action-glow: rgba(83, 195, 255, 0.28);
  border-color: #459bc3;
  border-top-color: #a8ddf4;
  border-bottom-color: #102d43;
  background-color: #10283d;
  background-image:
    linear-gradient(112deg, transparent 16%, rgba(255, 255, 255, 0.2) 36%, transparent 53%),
    linear-gradient(180deg, #274c67 0%, #17354d 48%, #0b2438 73%, #071827 100%);
  color: #dff7ff;
}

@media (hover: hover) {
  .actions > button:hover:not(:disabled) {
    filter: brightness(1.13) saturate(1.12);
    background-position: -35% 0, 0 0;
    transform: translateY(-5px);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.56),
      inset 2px 0 0 rgba(255, 255, 255, 0.12),
      inset -2px 0 0 rgba(0, 25, 40, 0.3),
      inset 0 -3px 0 rgba(0, 31, 44, 0.56),
      0 8px 0 var(--action-depth),
      0 13px 18px var(--action-shadow),
      0 0 24px var(--action-glow);
  }
}

.actions > button:active:not(:disabled) {
  filter: brightness(0.94);
  transform: translateY(3px);
  box-shadow:
    inset 0 3px 6px rgba(0, 20, 34, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 0 var(--action-depth),
    0 3px 5px rgba(0, 0, 0, 0.42),
    0 0 10px var(--action-glow);
}

.actions > button:focus-visible {
  outline: 2px solid #e5fcff;
  outline-offset: 5px;
}

.actions > button:disabled {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 0 var(--action-depth),
    0 4px 7px rgba(0, 0, 0, 0.34);
}

@media (prefers-reduced-motion: reduce) {
  .actions > button {
    transition: none;
  }
}

/* ============================================================
   POPUP GROW / SHRINK ANIMATIONS
   Every popup, modal, overlay and side panel grows out of the
   button that opened it and shrinks back into that button when
   it closes. Driven by /js/popup-dissolve.js, which toggles the
   helper classes below and sets --popup-origin-x/y.
   ============================================================ */
@keyframes popupDissolveIn {
  from {
    opacity: 0.25;
    transform: scale(0.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes popupDissolveOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.04);
  }
}

.popup-dissolve-in,
.popup-dissolve-out {
  transform-origin: var(--popup-origin-x, 50%) var(--popup-origin-y, 50%);
}

.popup-dissolve-in {
  animation: popupDissolveIn 280ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.popup-dissolve-out {
  /* Hold the popup on screen for the length of the shrink-out. The custom
     property carries the display value the popup used while it was open. */
  display: var(--popup-dissolve-display, flex) !important;
  visibility: visible !important;
  pointer-events: none;
  animation: popupDissolveOut 240ms cubic-bezier(0.4, 0, 0.7, 0.4) both;
}

@media (prefers-reduced-motion: reduce) {
  .popup-dissolve-in,
  .popup-dissolve-out {
    animation: none;
  }
}
