*{box-sizing:border-box}
:root{
  color-scheme:dark;
  --bg:#000000;
  --panel:#11131a;
  --panel2:#171923;
  --border:#292c37;
  --text:#f4f5f8;
  --muted:#9298a8;
  --accent:#9147ff;
  --chat-width:340px
}
html,body{
  margin:0;
  width:100%;
  height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  overflow:hidden
}
button,input{font:inherit}
button{color:inherit}
.workspace{
  width:100vw;
  height:100vh;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  /* padding:8px; */
  background:var(--bg)
}
.workspace.with-chat{
  grid-template-columns:minmax(0,1fr) 8px var(--chat-width)
}
.grid{
  min-width:0;
  min-height:0;
  display:grid;
  /* gap:8px; */
  grid-column:1
}
.grid.layout-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid.layout-3{
  grid-template-columns:repeat(4,minmax(0,1fr));
  grid-template-rows:repeat(2,minmax(0,1fr))
}
.grid.layout-3>.slot:nth-child(1){grid-column:1 / 3;grid-row:1}
.grid.layout-3>.slot:nth-child(2){grid-column:3 / 5;grid-row:1}
.grid.layout-3>.slot:nth-child(3){grid-column:2 / 4;grid-row:2}
.grid.layout-4{
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,minmax(0,1fr))
}
.slot{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:hidden;
  /* border:1px solid var(--border); */
  /* border-radius:9px; */
  background:#0e1015
}
.slot.empty{cursor:pointer}
.slot.empty::after{
  content:"+";
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  color:transparent;
  font-size:42px;
  transition:.15s
}
.slot.empty:hover::after{
  color:#aaa;
  background:#1f1f1f
}
.player-host{
  position:absolute;
  inset:0;
  background:#000
}
.player-host iframe,
.player-host video{
  width:100%;
  height:100%;
  display:block;
  border:0;
  background:#000
}
.player-host video{object-fit:contain}
.player-message{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:28px;
  text-align:center;
  color:#c7cad4;
  line-height:1.5;
  background:#0e1015
}
.player-message[hidden]{display:none}
.slot-controls{
  position:absolute;
  z-index:10;
  top:8px;
  left:8px;
  right:8px;
  display:flex;
  justify-content:space-between;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s
}
.slot:hover .slot-controls{opacity:1}
.slot-controls .side{
  display:flex;
  gap:6px
}
.icon-btn,
.chat header button{
  width:32px;
  height:32px;
  border:1px solid #444;
  background:#08090ddd;
  color:#fff;
  border-radius:7px;
  cursor:pointer
}
.slot-controls .icon-btn{pointer-events:auto}
.kick-controls{
  position:absolute;
  z-index:9;
  left:50%;
  bottom:10px;
  transform:translateX(-50%);
  display:flex;
  align-items:center;
  gap:6px;
  opacity:0;
  transition:opacity .15s
}
.slot:hover .kick-controls{opacity:1}
.kick-controls button{
  min-width:38px;
  height:32px;
  border:1px solid #444;
  border-radius:7px;
  background:#08090ddd;
  color:#fff;
  cursor:pointer;
  font-weight:800
}
.kick-controls .live-btn{
  padding:0 10px;
  color:#fff
}
.kick-controls .live-btn.at-live{
  border-color:#e91916;
  background:#b01412e6
}
.chat-splitter{
  grid-column:2;
  min-width:8px;
  cursor:col-resize;
  position:relative;
  touch-action:none
}
.chat-splitter::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:3px;
  width:2px;
  border-radius:2px;
  background:#343743;
  transition:background .15s
}
.chat-splitter:hover::after,
.chat-splitter.dragging::after{
  background:#9147ff
}
.chat-splitter.hidden{display:none}
.chat{
  grid-column:3;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  border:1px solid var(--border);
  border-radius:9px;
  overflow:hidden;
  background:#0e0e10
}
.chat.hidden{display:none}
.chat>header{
  flex:0 0 44px;
  height:44px;
  padding:0 10px 0 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
  font-weight:800
}
#chatBody{
  flex:1 1 auto;
  min-height:0;
  position:relative;
  overflow:hidden;
  background:#0e0e10
}
#chatBody>iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  border:0
}
.chat-placeholder{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  text-align:center;
  color:var(--muted)
}

.btn,
.platform,
.options button{
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  border-radius:8px;
  padding:9px 12px;
  cursor:pointer;
  font-weight:700;
  transition:border-color .15s,background .15s,filter .15s
}
.btn:hover,
.platform:hover,
.options button:hover{
  filter:brightness(1.08)
}
.platform.active{
  border-color:var(--accent);
  background:#1d1728;
  color:#fff
}
.add-card .platforms{
  display:flex;
  gap:8px;
  padding:15px 17px 0
}
.add-card .platform{
  flex:1
}
.add-card form .primary{
  min-width:92px
}

.primary{
  background:var(--accent);
  border-color:var(--accent)
}
.modal{
  position:fixed;
  inset:0;
  z-index:60;
  display:grid;
  place-items:center;
  padding:20px;
  background:#000b
}
.modal.hidden{display:none}
.card{
  width:min(640px,100%);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:13px;
  box-shadow:0 20px 70px #0008
}
.card>header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:15px 17px;
  border-bottom:1px solid var(--border)
}
.card h2{
  margin:0;
  font-size:17px
}
.close-modal{
  border:0;
  background:transparent;
  color:#ddd;
  font-size:25px;
  cursor:pointer
}
.groups{
  padding:18px;
  display:grid;
  gap:20px
}
.groups label{
  display:block;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  margin-bottom:9px
}
.options{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:9px
}
.options button{height:65px}
.platforms{
  display:flex;
  gap:8px;
  padding:15px 17px 0
}
.platform{
  flex:1;
  color:var(--muted)
}
.platform.active{
  border-color:var(--accent);
  color:#fff
}
form{
  display:flex;
  gap:8px;
  padding:16px 17px 8px
}
form input{
  flex:1;
  min-width:0;
  background:#0b0d12;
  color:#fff;
  border:1px solid var(--border);
  border-radius:8px;
  padding:11px;
  outline:0
}
.hint{
  padding:0 17px 17px;
  color:var(--muted);
  font-size:11px;
  line-height:1.5
}
.toast{
  position:fixed;
  z-index:80;
  bottom:18px;
  left:50%;
  transform:translateX(-50%);
  padding:10px 14px;
  border:1px solid var(--border);
  background:var(--panel2);
  border-radius:8px;
  max-width:min(650px,90vw);
  text-align:center;
  box-shadow:0 12px 35px #0008
}
.toast.hidden{display:none}
@media(max-width:760px){
  :root{--chat-width:260px}
  .workspace.with-chat{
    grid-template-columns:minmax(0,1fr) 7px var(--chat-width)
  }
}


/* v1.4 — graficzne podglądy układów */
.options button{
  height:82px;
  display:grid;
  place-items:center;
  padding:9px;
}
.layout-preview{
  width:82px;
  height:52px;
  display:grid;
  gap:3px;
  padding:3px;
  border:1px solid #444854;
  border-radius:6px;
  background:#0c0e13;
}
.layout-preview>i{
  display:block;
  min-width:0;
  min-height:0;
  border-radius:2px;
  background:#5a5e6b;
}
.preview-2{
  grid-template-columns:repeat(2,1fr)
}
.preview-3{
  grid-template-columns:repeat(4,1fr);
  grid-template-rows:repeat(2,1fr)
}
.preview-3>i:nth-child(1){grid-column:1/3;grid-row:1}
.preview-3>i:nth-child(2){grid-column:3/5;grid-row:1}
.preview-3>i:nth-child(3){grid-column:2/4;grid-row:2}
.preview-4{
  grid-template-columns:repeat(2,1fr);
  grid-template-rows:repeat(2,1fr)
}
.preview-2-chat{
  grid-template-columns:1fr 1fr .7fr
}
.preview-2-chat .mini-chat{
  background:#9147ff
}
.preview-3-chat{
  grid-template-columns:repeat(4,1fr) .85fr;
  grid-template-rows:repeat(2,1fr)
}
.preview-3-chat>i:nth-child(1){grid-column:1/3;grid-row:1}
.preview-3-chat>i:nth-child(2){grid-column:3/5;grid-row:1}
.preview-3-chat>i:nth-child(3){grid-column:2/4;grid-row:2}
.preview-3-chat>.mini-chat{grid-column:5;grid-row:1/3;background:#9147ff}
.preview-4-chat{
  grid-template-columns:1fr 1fr .85fr;
  grid-template-rows:repeat(2,1fr)
}
.preview-4-chat>i:nth-child(1){grid-column:1;grid-row:1}
.preview-4-chat>i:nth-child(2){grid-column:2;grid-row:1}
.preview-4-chat>i:nth-child(3){grid-column:1;grid-row:2}
.preview-4-chat>i:nth-child(4){grid-column:2;grid-row:2}
.preview-4-chat>.mini-chat{grid-column:3;grid-row:1/3;background:#9147ff}


/* v1.5 — stabilne modale i przyciski */
.close-modal{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  flex:0 0 34px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:#ddd;
  font-size:25px;
  line-height:1;
  cursor:pointer
}
.close-modal:hover{
  border-color:var(--border);
  background:#ffffff08
}
.add-card{
  max-width:560px
}
.layout-card{
  max-width:640px
}







/* v1.8 — zachowujemy layout v1.6.2 i pełne natywne UI Twitch */
.twitch-player-api,
.twitch-player-api iframe{
  width:100% !important;
  height:100% !important
}
