:root{
  --bg0:#0b0f19;
  --bg1:#0f172a;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.085);
  --stroke:rgba(255,255,255,.12);
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent1:#00f5d4; /* neon mint */
  --accent2:#ff2a6d; /* neon pink */
  --accent3:#7c3aed; /* purple */
  --good:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;
  --radius:18px;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(255,42,109,.22), transparent 60%),
    radial-gradient(900px 600px at 85% 25%, rgba(0,245,212,.18), transparent 55%),
    radial-gradient(800px 500px at 55% 90%, rgba(124,58,237,.18), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow:hidden;
}

a{color:inherit; text-decoration:none}
button, input, select{font:inherit}

.wrap{
  height:100%;
  display:flex;
  justify-content:center;
}

.shell{
  width:min(1120px, 100%);
  height:100%;
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
  padding:14px;
}

@media (max-width: 980px){
  body{overflow:auto}
  .shell{
    grid-template-columns: 1fr;
    height:auto;
  }
}

.panel{
  border:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(10px);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--stroke);
  background: linear-gradient(90deg, rgba(255,42,109,.14), rgba(0,245,212,.10));
}

.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:800;
  letter-spacing:.2px;
}
.logo{
  width:34px;height:34px;border-radius:12px;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,.9), rgba(255,255,255,.0) 45%),
    linear-gradient(135deg, var(--accent2), var(--accent1));
  box-shadow: 0 10px 30px rgba(255,42,109,.25);
}
.badge{
  font-size:12px;
  color: rgba(255,255,255,.88);
  padding:4px 8px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  background:rgba(0,0,0,.18);
}

.subtle{color:var(--muted); font-size:12px}

.content{
  padding:16px;
}

.h1{font-size:26px; margin:0 0 6px 0; line-height:1.1}
.p{margin:0 0 12px 0; color:var(--muted); line-height:1.4}

.grid{
  display:grid;
  gap:12px;
}

.card{
  padding:14px;
  border:1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(0,0,0,.16);
}

.field{display:flex; flex-direction:column; gap:6px}
label{font-size:12px; color:var(--muted)}
input, select{
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color:var(--text);
  outline:none;
}
input:focus, select:focus{border-color: rgba(0,245,212,.55); box-shadow: 0 0 0 4px rgba(0,245,212,.12)}

.btnrow{display:flex; gap:10px; flex-wrap:wrap}
.btn{
  display:inline-flex;
  align-items:center; justify-content:center;
  gap:8px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  user-select:none;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active{transform: translateY(1px) scale(.99)}
.btn.primary{
  border-color: rgba(0,245,212,.35);
  background: linear-gradient(135deg, rgba(255,42,109,.20), rgba(0,245,212,.18));
}
.btn.danger{border-color: rgba(239,68,68,.4)}
.btn.ghost{background: transparent}
.btn small{opacity:.9; font-weight:600; font-size:12px}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  max-height: 220px;
  overflow:auto;
  padding-right:4px;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease;
  font-size:13px;
}
.chip i{
  width:10px;height:10px;border-radius:3px;
  background: rgba(255,255,255,.2);
}
.chip.on{
  border-color: rgba(0,245,212,.55);
  background: rgba(0,245,212,.12);
}
.chip.on i{background: linear-gradient(135deg, var(--accent2), var(--accent1))}

.hr{height:1px;background:rgba(255,255,255,.10); margin:12px 0}

.chat{
  display:flex;
  flex-direction:column;
  height:calc(100% - 0px);
}
.chat-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid var(--stroke);
  background: rgba(0,0,0,.12);
}
.roomtitle{font-weight:800}
.pills{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.pill{
  font-size:12px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.88);
}

.stream{
  flex:1;
  padding:14px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg{
  max-width: 78%;
  padding:10px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  line-height:1.35;
  position:relative;
}
.msg .meta{
  font-size:12px; color:rgba(255,255,255,.72);
  margin-bottom:4px; display:flex; gap:8px; align-items:center;
}
.msg.me{
  align-self:flex-end;
  border-color: rgba(0,245,212,.25);
  background: linear-gradient(135deg, rgba(255,42,109,.18), rgba(0,245,212,.14));
}
.msg.me .meta{justify-content:flex-end}
.msg .dot{
  width:6px;height:6px;border-radius:999px;
  background: rgba(255,255,255,.35);
}
.msg.me .dot{background: rgba(0,245,212,.65)}

.composer{
  padding:12px;
  border-top:1px solid var(--stroke);
  background: rgba(0,0,0,.14);
  display:flex;
  gap:10px;
  align-items:flex-end;
}
textarea{
  flex:1;
  resize:none;
  min-height:44px;
  max-height:120px;
  padding:12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color: var(--text);
  outline:none;
}
textarea:focus{border-color: rgba(255,42,109,.55); box-shadow: 0 0 0 4px rgba(255,42,109,.12)}

.smallbtn{
  width:44px;height:44px;border-radius:16px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;
}
.smallbtn.primary{
  border-color: rgba(0,245,212,.45);
  background: linear-gradient(135deg, rgba(0,245,212,.18), rgba(124,58,237,.18));
}
.kbd{
  font-size:12px;
  color:rgba(255,255,255,.75);
  border:1px solid rgba(255,255,255,.16);
  padding:2px 6px;
  border-radius:8px;
  background: rgba(0,0,0,.25);
}

.roomlist{
  list-style:none; padding:0; margin:0;
  display:flex; flex-direction:column; gap:6px;
  max-height: 420px; overflow:auto; padding-right:4px;
}
.roomitem{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 10px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  cursor:pointer;
}
.roomitem.active{
  border-color: rgba(255,42,109,.45);
  background: rgba(255,42,109,.10);
}
.roomitem .left{display:flex; gap:10px; align-items:center}
.hash{
  width:28px;height:28px;border-radius:12px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  display:flex;align-items:center;justify-content:center;
  color: rgba(255,255,255,.85);
  font-weight:900;
}
.count{font-size:12px; color:rgba(255,255,255,.7)}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.14);
  padding:10px 12px;
  border-radius: 14px;
  color: rgba(255,255,255,.9);
  font-size:13px;
  max-width:min(560px, 92vw);
  box-shadow: var(--shadow);
  display:none;
}

.footerhint{margin-top:10px}

@media (max-width: 680px){
  body{overflow:auto}
  .shell{grid-template-columns: 1fr; height:auto}
  .chatgrid{grid-template-columns: 1fr !important;}
  .roomlist{max-height: 240px}
}
