.twitch-overlay{
  position:fixed;
  inset:auto auto 6rem auto;
  background:rgba(12,18,36,0.95);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px;
  box-shadow:0 22px 48px rgba(4,7,12,0.6);
  display:flex;
  flex-direction:column;
  min-width:320px;
  min-height:190px;
  overflow:hidden;
  z-index:1200;
  color:#f5f7ff;
  font-family:"Inter","Segoe UI",system-ui,-apple-system,sans-serif;
  transition:opacity .18s ease,transform .18s ease;
  opacity:1;
}

.twitch-overlay.is-hidden{
  opacity:0;
  pointer-events:none;
  transform:translateY(12px) scale(.98);
}

.twitch-overlay.dragging,
.twitch-overlay.resizing{
  user-select:none;
  cursor:grabbing;
}

.twitch-overlay-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  padding:.55rem .85rem;
  background:rgba(14,20,36,0.92);
  border-bottom:1px solid rgba(255,255,255,0.06);
  cursor:grab;
}

.twitch-overlay-title{
  display:flex;
  align-items:center;
  gap:.5rem;
  font-weight:600;
  font-size:.92rem;
  letter-spacing:.01em;
}

.twitch-overlay-title::before{
  content:"";
  width:.55rem;
  height:.55rem;
  border-radius:999px;
  background:linear-gradient(135deg,#ff4d4d,#ff914d);
  box-shadow:0 0 10px rgba(255,77,77,0.5);
}

.twitch-overlay-actions{
  display:flex;
  align-items:center;
  gap:.4rem;
}

.twitch-overlay-btn{
  appearance:none;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(32,40,64,0.85);
  color:#f5f7ff;
  border-radius:6px;
  padding:.35rem .6rem;
  font-size:.75rem;
  font-weight:600;
  cursor:pointer;
  transition:background .15s ease,border-color .15s ease,transform .15s ease;
}

.twitch-overlay-btn:hover{
  background:rgba(51,62,96,0.92);
  border-color:rgba(255,255,255,0.22);
}

.twitch-overlay-btn:active{
  transform:scale(.96);
}

.twitch-overlay-btn[data-active="true"]{
  background:rgba(103,76,233,0.9);
  border-color:rgba(178,160,255,0.8);
}

.twitch-overlay-body{
  flex:1;
  display:flex;
  background:rgba(10,14,28,0.88);
  overflow:hidden;
}

.twitch-player-wrap{
  flex:1;
  position:relative;
  min-width:0;
}

.twitch-player-wrap iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
}

.twitch-chat-wrap{
  width:320px;
  max-width:60vw;
  border-left:1px solid rgba(255,255,255,0.06);
  background:rgba(15,22,40,0.95);
}

.twitch-chat-wrap[hidden]{
  display:none;
}

.twitch-chat-wrap iframe{
  width:100%;
  height:100%;
  border:0;
}

.twitch-overlay-resizer{
  position:absolute;
  width:18px;
  height:18px;
  bottom:0;
  right:0;
  cursor:nwse-resize;
  background:linear-gradient(135deg,rgba(255,255,255,0.14) 30%,rgba(255,255,255,0));
}

.twitch-overlay.chat-open{
  min-width:520px;
}

.twitch-overlay-tab{
  position:fixed;
  right:1.1rem;
  top:45vh;
  display:flex;
  align-items:center;
  gap:.45rem;
  padding:.45rem .75rem;
  border-radius:999px 0 0 999px;
  background:#6752e5;
  color:#f9fbff;
  border:1px solid rgba(255,255,255,0.1);
  box-shadow:0 12px 30px rgba(7,10,25,0.35);
  cursor:pointer;
  font-size:.78rem;
  font-weight:600;
  letter-spacing:.02em;
  transition:background .15s ease,transform .18s ease;
  z-index:1199;
}

.twitch-overlay-tab:hover{
  background:#7a64f0;
}

.twitch-overlay-tab:active{
  transform:translateY(-50%) scale(.97);
}

.twitch-overlay-tab .arrow{
  font-size:.9rem;
}

.twitch-overlay.is-hidden + .twitch-overlay-tab .arrow{
  transform:none;
}

body.twitch-overlay-no-select{
  user-select:none !important;
  cursor:grabbing;
}

@media (max-width:900px){
  .twitch-overlay{
    min-width:280px;
  }
  .twitch-overlay.chat-open{
    min-width:420px;
  }
  .twitch-chat-wrap{
    width:260px;
  }
}

@media (max-width:700px){
  .twitch-overlay.chat-open{
    min-width:360px;
  }
  .twitch-chat-wrap{
    display:none !important;
  }
}
