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

:root{
  --bg:#070916;
  --bg-soft:#0e1326;
  --bg-card:#121933;
  --bg-card-2:#171f3d;
  --border:#273055;
  --accent:#8e9cff;
  --accent2:#6df6d8;
  --accent3:#ff8ddd;
  --text:#f7f8ff;
  --muted:#9aa4d0;
  --danger:#ff6289;
  --owner-grad:linear-gradient(135deg,#ff8ddd,#ffffff,#77d6ff);
  --mod-grad:linear-gradient(135deg,#77d6ff,#6df6d8);
  --ann-grad:linear-gradient(135deg,#8e9cff,#ff8ddd);
}

body{
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:radial-gradient(circle at top,#202757,#070916 55%);
  color:var(--text);
  height:100vh;
  overflow:hidden;
  padding-top:32px;
}

.layout{
  display:flex;
  height:calc(100vh - 32px);
}

.brand-rail{
  width:290px;
  background:rgba(10,13,27,0.82);
  border-right:1px solid rgba(255,255,255,0.08);
  backdrop-filter:blur(16px);
  padding:16px 14px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.sidebar-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.logo{
  font-size:1.5rem;
  font-weight:800;
  letter-spacing:0.02em;
}

.logo-wrap{display:flex;flex-direction:column;gap:2px}
.logo-sub{display:none}

.conn-badge{
  font-size:0.78rem;
  color:var(--muted);
  margin-top:8px;
}

.rail-group{
  background:rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.06);
  border-radius:18px;
  padding:12px;
}
.rail-group.grow{flex:1;overflow:auto}

.panel-title{
  font-size:0.76rem;
  text-transform:uppercase;
  letter-spacing:0.14em;
  color:var(--muted);
  margin-bottom:8px;
}

.channel-list{display:flex;flex-direction:column;gap:6px}
.channel-btn{
  border:none;
  background:transparent;
  color:var(--muted);
  border-radius:12px;
  padding:10px 12px;
  display:flex;
  gap:10px;
  align-items:center;
  cursor:pointer;
  font-size:0.95rem;
  text-align:left;
}
.channel-btn:hover{background:#1a2244;color:var(--text)}
.channel-btn.active{
  background:linear-gradient(135deg,rgba(142,156,255,0.22),rgba(255,141,221,0.18));
  color:var(--text);
  box-shadow:0 8px 30px rgba(0,0,0,0.18);
}

.subsection{margin-top:8px}
.subsection-title{
  font-size:0.78rem;
  color:var(--muted);
  margin-bottom:4px;
}
.player-list{display:flex;flex-direction:column;gap:5px}
.player-row{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 8px;
  border-radius:12px;
}
.player-row:hover{background:#161d3c}

.avatar{
  width:30px;height:30px;border-radius:50%;object-fit:cover;background:#111320;
}
.avatar-wrap{position:relative;display:inline-block}
.status-dot{
  position:absolute;bottom:-2px;right:-2px;width:12px;height:12px;border-radius:50%;
  border:2px solid #050712;box-shadow:0 0 6px rgba(0,0,0,0.6);
}
.status-dot.online{background:#4dffff;box-shadow:0 0 8px #4dffff}
.status-dot.idle{background:#b47cff;box-shadow:0 0 8px #b47cff}
.status-dot.offline{background:#ff6ec7;opacity:0.55}

.tool-stack{display:flex;flex-direction:column;gap:8px}

.main{
  flex:1;
  display:flex;
  flex-direction:column;
  padding:16px 18px 12px;
}
.chime-header{
  padding:14px 18px;
  border-radius:20px;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.06);
  margin-bottom:10px;
}
.room-title{font-size:1.35rem;font-weight:700}
.room-sub{font-size:0.84rem;color:var(--muted);margin-top:3px}

.messages{
  flex:1;
  overflow-y:auto;
  padding:12px 6px 12px 0;
  border-radius:22px;
  background:
    radial-gradient(circle at top left,rgba(142,156,255,0.12),transparent 30%),
    radial-gradient(circle at bottom right,rgba(255,141,221,0.10),transparent 30%),
    #0b1021;
  border:1px solid rgba(255,255,255,0.06);
}
.msg-row{display:flex;padding:7px 14px;gap:10px}
.msg-row.self{justify-content:flex-end}
.msg-body{max-width:72%}
.msg-header{display:flex;align-items:baseline;gap:7px;margin-bottom:3px}
.msg-username{
  font-size:0.88rem;font-weight:700;background:none;border:none;color:var(--text);cursor:pointer;padding:0;
}
.msg-username:hover{text-decoration:underline}
.msg-meta{font-size:0.72rem;color:var(--muted)}
.msg-bubble{
  padding:10px 14px;border-radius:18px;font-size:0.95rem;background:#11182f;
  border:1px solid rgba(255,255,255,0.06);word-wrap:break-word;white-space:pre-wrap;
  box-shadow:0 10px 24px rgba(0,0,0,0.22);
}
.msg-row.self .msg-bubble{background:#162042}
.msg-bubble.owner{
  background:rgba(10,10,20,0.9);
  border-image:var(--owner-grad) 1;border-width:1px;border-style:solid;
}
.msg-bubble.mod{
  background:rgba(8,16,20,0.9);
  border-image:var(--mod-grad) 1;border-width:1px;border-style:solid;
}
.msg-bubble.whisper{background:rgba(102,51,153,0.40)}
.msg-img{max-width:260px;max-height:260px;border-radius:14px;display:block}

.reaction-bar{
  display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;
}
.reaction-chip{
  border:none;border-radius:999px;padding:5px 10px;background:#182240;color:var(--text);
  display:flex;gap:6px;align-items:center;cursor:pointer;font-size:0.78rem;
  border:1px solid rgba(255,255,255,0.06);
}
.reaction-chip:hover{transform:translateY(-1px)}
.reaction-chip.active{
  background:linear-gradient(135deg,rgba(142,156,255,0.26),rgba(109,246,216,0.22));
  border-color:rgba(109,246,216,0.45);
}

.msg-actions{margin-top:4px;font-size:0.72rem;display:flex;gap:4px}
.msg-act-btn{border:none;background:transparent;color:var(--muted);cursor:pointer}
.msg-act-btn:hover{color:var(--text)}

.input-bar{
  display:flex;align-items:center;gap:8px;margin-top:10px;padding:8px;
  border-radius:20px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.06);
}
.input-bar input[type="text"]{
  flex:1;background:#080c19;border-radius:999px;border:1px solid #22263a;padding:11px 14px;color:var(--text);font-size:0.93rem;
}
.file-label{
  cursor:pointer;display:flex;align-items:center;justify-content:center;width:40px;height:40px;
  border-radius:999px;background:#101426;border:1px solid #22263a;font-size:1.1rem;
}
.file-label input{display:none}

.primary-btn,.secondary-btn,.ghost-btn,.danger-btn{
  border-radius:999px;border:1px solid transparent;padding:9px 14px;font-size:0.86rem;cursor:pointer;
}
.primary-btn{background:linear-gradient(135deg,#b6beff,#8e9cff,#6df6d8);color:#050712;font-weight:700}
.secondary-btn{background:#12162a;color:var(--text);border-color:#22263a}
.ghost-btn{background:transparent;color:var(--muted);border-color:#22263a}
.danger-btn{background:var(--danger);color:#fff}
.full{width:100%}
.muted{color:var(--muted)}
.sm{font-size:0.8rem}
.hidden{display:none !important}

.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.tool-block{margin-top:10px}
.tool-label{font-size:0.78rem;color:var(--muted);margin-bottom:4px}
.tool-row{display:flex;gap:6px}
.tool-row input,.tool-row select,#owner-ann-input{
  flex:1;background:#080a15;border-radius:10px;border:1px solid #22263a;padding:6px 8px;color:var(--text);font-size:0.85rem;
}
#owner-ann-input{width:100%}

.top-ann-bar{
  position:fixed;top:0;left:0;right:0;height:32px;display:flex;align-items:center;justify-content:center;
  font-size:0.8rem;background:var(--ann-grad);color:#050712;z-index:10;box-shadow:0 4px 12px rgba(0,0,0,0.5);
}

.modal-backdrop{
  position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.72);z-index:20;
}
.modal{
  background:#080c19;border-radius:18px;padding:18px;width:340px;box-shadow:0 20px 40px rgba(0,0,0,0.6);border:1px solid #2a3050;
}
.modal-wide{width:700px}
.modal h2{font-size:1.05rem;margin-bottom:6px}
.modal label{display:block;font-size:0.8rem;margin-top:6px;margin-bottom:2px}
.modal input,.modal textarea,.modal select{
  width:100%;background:#050712;border-radius:10px;border:1px solid #22263a;padding:7px 8px;color:var(--text);font-size:0.86rem;
}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}
.error-text{font-size:0.78rem;color:var(--danger);min-height:1em;margin-top:3px}
.gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px;max-height:420px;overflow:auto}
.gallery-grid img{width:100%;border-radius:10px;object-fit:cover}
.modal-header-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}

.auth-tabs{display:flex;gap:8px;margin-bottom:12px}
.auth-tab{
  flex:1;padding:6px 8px;border-radius:8px;border:1px solid #22263a;background:#080a15;color:var(--muted);
  font-size:0.85rem;cursor:pointer;text-align:center;
}
.auth-tab.active{background:#11162a;color:var(--text);border-color:#3b4265}
.auth-panel{margin-top:4px}

@media (max-width: 900px){
  .brand-rail{width:240px}
  .tool-grid{grid-template-columns:1fr}
}


.profile-link{
  background:none;
  border:none;
  color:inherit;
  font:inherit;
  padding:0;
  cursor:pointer;
}
.profile-link:hover{
  text-decoration:underline;
}
.modal-profile-edit{
  width:420px;
}
.modal-profile-view{
  padding:0;
  overflow:hidden;
}
.profile-banner{
  height:160px;
  background:linear-gradient(135deg,#5bd4ff,#e66ad8,#6dffb5);
  background-size:cover;
  background-position:center;
}
.profile-banner.has-image{
  background-size:cover;
  background-position:center;
}
.profile-head{
  display:flex;
  gap:14px;
  align-items:flex-end;
  padding:0 18px;
  margin-top:-34px;
}
.profile-view-avatar{
  width:88px;
  height:88px;
  border-radius:24px;
  border:4px solid #080a15;
  background:#111320;
  object-fit:cover;
}
.profile-head-copy{
  padding-bottom:10px;
}
.profile-view-name{
  font-size:1.35rem;
  font-weight:700;
}
.profile-view-meta{
  color:var(--muted);
  font-size:0.84rem;
  margin-top:3px;
}
.profile-view-status{
  margin-top:10px;
  padding:8px 10px;
  border-radius:12px;
  background:#101426;
  border:1px solid #22263a;
}
.profile-view-section{
  padding:18px;
}
.profile-view-bio{
  margin-top:8px;
  padding:12px;
  border-radius:14px;
  background:#101426;
  border:1px solid #22263a;
  min-height:72px;
  white-space:pre-wrap;
}

/* RESET */
.msg-bubble{
  border:none !important;
  box-shadow:none !important;
}

/* FIXED GRADIENT BORDER (doesn't shrink text) */
.msg-bubble.owner{
  position:relative;
  border-radius:18px;
  background:#0e1122;
}

.msg-bubble.owner::before{
  content:"";
  position:absolute;
  inset:0;
  padding:2px;
  border-radius:18px;
  background:linear-gradient(135deg,#3a0ca3,#4361ee,#4895ef);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  pointer-events:none;
}

/* HARD LOCK */
html,body{overflow-x:hidden!important;max-width:100%;}
.layout{width:100%;overflow:hidden;}
.main{min-width:0;max-width:100%;overflow:hidden;}
.messages{overflow-x:hidden;width:100%;}
.msg-bubble{max-width:100%;word-break:break-word;}

.reaction-bar{margin-top:6px;display:flex;gap:6px;}
.reaction-chip{background:#1a2244;border:none;border-radius:8px;padding:2px 6px;color:#fff;cursor:pointer;}


/* clean emoji picker ui */
#emoji-picker{
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: min(360px, calc(100vw - 32px));
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  background: #0e1122;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  z-index: 9999;
}
#emoji-picker.hidden{
  display: none !important;
}
.emoji-pick-btn{
  border: none;
  background: #151b34;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 18px;
}
.emoji-pick-btn:hover{
  background: #212a52;
}
.reaction-plus{
  min-width: 34px;
  justify-content: center;
}
