:root{
  --primary:#5a2982;
  --secondary:#fcaf1a;

  --bg:#fff;
  --page:#f6f7f9;
  --border:#e6e7eb;
  --text:#1f2328;
  --muted:#5b6472;

  --radius:14px;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
}
*{ box-sizing:border-box; }

/* si tu ne veux pas styler body global, mets ce bloc dans un wrapper page */
/* body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--page);
  color: var(--text);
  display:flex;
  justify-content:center;
  padding: 24px;
} */

/* ===== Layout ===== */
.ytLib{
  width: min(1120px, 100%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  display:grid;
  grid-template-columns: 1fr 360px;
  min-height: 520px;
}

/* Compact mode (1 video): playlist collapses automatically */
.ytLib.is-single{
  grid-template-columns: 1fr;
}

/* ===== Player side ===== */
.ytLib__player{
  padding: 16px;
  display:grid;
  gap: 12px;
  min-width: 0;
  background-image: linear-gradient(180deg, rgba(90,41,130,.06), transparent 55%);
}

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

/* .kicker{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .2px;
} */
/* .kicker::before{
  content:"";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--secondaryColor);
  box-shadow: 0 0 0 3px rgba(252,175,26,.22);
} */

.title{
  margin-top: 6px;
  /* font-size: 18px; */
  font-size: 1.2rem;
  /* font-weight: 800; */
  line-height: 1.15;
  min-width: 0;
  /* overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap; */
}

.actions{
  display:flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content:flex-end;
}

.btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 13px;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.06);
}
.btn:active{ transform: translateY(1px); }
.btn--primary{
  border-color: rgba(90,41,130,.35);
  background: rgba(90,41,130,.10);
  color: var(--primary);
  font-weight: 650;
}
.btn--ghost{
  border-color: rgba(255,255,255,.22);
  background: rgba(0,0,0,.25);
  color:#fff;
  box-shadow:none;
}

.frameWrap{
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow:hidden;
  background:#0b0d12;
  aspect-ratio: 16/9;
  box-shadow: 0 16px 40px rgba(0,0,0,.10);
}
.ytFrame{
  width: 100%;
  height: 100%;
  border: 0;
  display:block;
  background:#000;
}

.caption{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  min-height: 20px;
}

/* ===== Playlist side ===== */
.ytLib__playlist{
  border-left: 1px solid var(--border);
  background: #fff;
  display:flex;
  flex-direction: column;
  min-width: 0;
}

.ytLib.is-single .ytLib__playlist{
  display:none;
}

.plHead{
  padding: 14px 14px 10px;
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.02), transparent 60%);
}
.plTitle{
  font-weight: 800;
  letter-spacing:.2px;
}
.plCount{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background:#fafafa;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.plList{
  padding: 8px;
  overflow:auto;
  display:grid;
  gap: 8px;
}

.plItem{
  width:100%;
  border: 1px solid var(--border);
  background:#fff;
  border-radius: 14px;
  padding: 10px;
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  cursor:pointer;
  text-align:left;
}
.plItem:hover{
  border-color: rgba(90,41,130,.35);
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
}
.plItem[aria-current="true"]{
  border-color: rgba(90,41,130,.60);
  box-shadow: 0 0 0 3px rgba(90,41,130,.12);
}

.plThumb{
  border-radius: 12px;
  overflow:hidden;
  position:relative;
  background:#0b0d12;
  aspect-ratio: 16/9;
  align-self: start;
}
.plThumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
  filter:saturate(.95);
}
.plThumb::after{
  content:"";
  position:absolute;
  inset:auto auto 8px 8px;
  width: 26px;
  height: 18px;
  border-radius: 6px;
  background: rgba(0,0,0,.55);
  box-shadow: 0 6px 14px rgba(0,0,0,.20);
  pointer-events:none;
}
.plThumb::before{
  content:"";
  position:absolute;
  left: 17px;
  bottom: 12px;
  width:0;height:0;
  border-left: 8px solid rgba(255,255,255,.9);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  z-index: 1;
  pointer-events:none;
}

.plInfo{
  min-width:0;
  display:flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}
.plInfoTitle{
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  overflow:hidden;
  text-overflow: ellipsis;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.plInfoCaption{
  font-size: 13px;
  color: var(--muted);
  line-height: 1.25;
  overflow:hidden;
  text-overflow: ellipsis;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== Modal ===== */
.ytModal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display:none;
}
.ytModal[aria-hidden="false"]{ display:block; }

.ytModal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.78);
}

.ytModal__panel{
  position:absolute;
  inset: 0;
  display:grid;
  grid-template-rows: auto 1fr auto;
  padding: 14px;
  gap: 10px;
}

.ytModal__top{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  color:#fff;
  padding: 6px 6px 0;
}

.ytModal__title{
  min-width:0;
  font-size: 14px;
  color: rgba(255,255,255,.9);
  overflow:hidden;
  white-space:nowrap;
  text-overflow: ellipsis;
}

.ytModal__stage{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:0;
}

.ytModal__frameWrap{
  width: min(1300px, 96vw);
  height: min(78vh, 920px);
  border-radius: 18px;
  overflow:hidden;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.ytModal__frameWrap .ytFrame{ background:#000; }

.ytModal__captionRow{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 12px;
  padding: 0 6px 6px;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  line-height: 1.35;
}
.ytModal__count{
  flex:0 0 auto;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
  background: rgba(0,0,0,.18);
}

@media (max-width: 980px){
  .ytLib{ grid-template-columns: 1fr; }
  .ytLib__playlist{
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .plList{
    grid-auto-flow: column;
    grid-auto-columns: minmax(280px, 1fr);
    overflow:auto;
  }
  .plItem{ grid-template-columns: 110px 1fr; }
}

@media (max-width: 640px){
  body{ padding: 14px; }
  .ytTop{ flex-direction: column; align-items: stretch; }
  .actions{ justify-content:flex-end; }
  .title{ white-space: normal; }
  .ytModal__frameWrap{
    width: 96vw;
    height: 72vh;
    border-radius: 16px;
  }
}