:root{
  --ia-bg0:#07070a;
  --ia-bg1:#0b0b10;
  --ia-bg2:#0f1016;
  --ia-panel:#0c0d12;
  --ia-panel2:#10121a;

  --ia-line:rgba(255,255,255,0.07);
  --ia-line2:rgba(255,255,255,0.10);

  --ia-text:#e9e9f2;
  --ia-muted:#a7a7bc;

  --ia-purple:#7c3aed;   /* purple buttons */
  --ia-purple2:#a78bfa;  /* hover glow */
  --ia-green:#22c55e;

  --ia-radius:16px;
  --ia-radius2:12px;
  --ia-shadow: 0 18px 60px rgba(0,0,0,0.55);
}

.ia-msg-shell{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ia-text);

  /* Reddit-dark base + soft Discord-ish gradients */
  background:
    radial-gradient(900px 480px at 20% 0%, rgba(124,58,237,0.10), transparent 60%),
    radial-gradient(900px 480px at 90% 10%, rgba(167,139,250,0.08), transparent 60%),
    linear-gradient(180deg, var(--ia-bg1), var(--ia-bg0));

  border: 1px solid var(--ia-line);
  border-radius: var(--ia-radius);
  overflow: hidden;
  box-shadow: var(--ia-shadow);


  /*
    Make the shell self-contained so only the message log scrolls.
    Using viewport math avoids reliance on parent container heights.
  */
  height: min(760px, calc(100vh - 260px));
  max-height: calc(100vh - 260px);
  min-height: 520px;
}

/* Mobile: account for top tabs + bottom nav (use dvh to avoid address-bar jump) */
@media (max-width: 820px){
  .ia-msg-shell{
    height: calc(100dvh - 220px);
    max-height: calc(100dvh - 220px);
    min-height: 420px;
  }
}

.ia-msg-shell *{ box-sizing:border-box; }

.ia-msg-title{
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: none;
  color: var(--ia-text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons: Discord-like pill + purple gradient */
.ia-msg-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(124,58,237,0.95), rgba(99,102,241,0.85));
  color: #fff;
  border: 1px solid rgba(167,139,250,0.35);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0,0,0,0.35);
  transition: transform .08s ease, filter .12s ease, border-color .12s ease;
  text-decoration: none;
}
.ia-msg-btn:hover{
  filter: brightness(1.06);
  border-color: rgba(167,139,250,0.60);
}
.ia-msg-btn:active{
  transform: translateY(1px);
}
.ia-msg-btn[disabled]{
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.ia-msg-empty{
  padding: 14px;
  color: var(--ia-muted);
  font-size: 13px;
}

/* Unread badge injected into Chat nav */
.ia-msg-badge-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ia-msg-badge{
  position:absolute;
  /* Slight overlap on the icon's top-right corner */
  top: -7px;
  right: -3px;
  transform: translate(48%,-48%);
  min-width:14px;
  height:14px;
  padding:0 4px;
  border-radius:999px;
  line-height:14px;
  font-size:10px;
  font-weight:700;
  background:#d11;
  color:#fff;
  box-shadow:0 0 0 2px rgba(0,0,0,.6);
  z-index:20;
}

@media (max-width: 820px){
  .ia-msg-badge{
    top: -6px;
    right: -2px;
    transform: translate(52%,-52%);
  }
}
