.mastro_yt_container{
  width:100%;
  box-sizing:border-box;
}
.mastro_yt_container *{
  box-sizing:border-box;
}

/* ===== LAYOUT: DESKTOP/TABLET (NO SLIDER) ===== */
.mastro_yt_slider{
  position:relative;
}

.mastro_yt_grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
  width:100%;
}

/* Tablet: 2 per row (1024px and smaller) */
@media (max-width: 1024px){
  .mastro_yt_grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

/* Small screens but still non-slider: 1 per row (when JS hasn't applied slider) */
@media (max-width: 600px){
  .mastro_yt_grid{
    grid-template-columns:1fr;
  }
}

/* Prevent theme forcing widths */
.mastro_yt_grid > .mastro_yt_item{
  width:auto;
  min-width:0;
}

/* ===== CARD ===== */
.mastro_yt_item{
  border-radius:12px;
  overflow:hidden;
  background:#F0F7FA;
  box-shadow:0 2px 12px rgba(0,0,0,.08);
}
.mastro_yt_link{
  display:block;
  text-decoration:none;
  color:inherit;
}
.mastro_yt_thumb_wrap{
  position:relative;
  aspect-ratio:16/9;
  overflow:hidden;
  background:#000;
}
.mastro_yt_thumb{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.mastro_yt_meta{
  padding:10px 12px;
}
.mastro_yt_title{
  font-size:14px;
  line-height:1.3;
  font-weight:600;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* ===== Notices ===== */
.mastro_yt_notice{
  padding:12px 14px;
  border-radius:10px;
  margin:12px 0;
}
.mastro_yt_notice_error{
  background:#ffecec;
  border:1px solid #f4b9b9;
  color:#7a1d1d;
}

/* ===== CONTROLS ROW (dots left, arrows right) ===== */
.mastro_yt_controls{
  display:none;
  margin-top:8px;
  align-items:center;
}

/* Dots */
.mastro_yt_dots{
  display:flex;
  gap:6px;
}
.mastro_yt_dot{
  width:6px;
  height:6px;
  border-radius:999px;
  border:0;
  padding:0;
  background:rgba(0,0,0,.25);
  cursor:pointer;
}
.mastro_yt_dot.is-active{
  background:rgba(0,0,0,.85);
}

/* Arrow buttons group */
.mastro_yt_nav_wrap{
  display:flex;
  gap:8px;
}

/* Base button styles */
.mastro_yt_nav{
  border:none;
  width:40px;
  height:40px;
  border-radius:999px;
  background:rgba(0,0,0,.55);
  color:#fff;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  line-height:1;
  font-weight:700;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}

/* Hover (where supported) */
.mastro_yt_nav:hover{
  background:rgba(0,0,0,.7);
}

/* ===== MOBILE SLIDER MODE =====
 * JS adds .is-mobile-slider ONLY on mobile (<= 767px).
 */
.mastro_yt_container.is-mobile-slider .mastro_yt_slider{
  position:relative;
}

.mastro_yt_container.is-mobile-slider .mastro_yt_grid{
  display:flex;
  gap:16px;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  padding-bottom:6px;
}

.mastro_yt_container.is-mobile-slider .mastro_yt_grid::-webkit-scrollbar{
  display:none;
}
.mastro_yt_container.is-mobile-slider .mastro_yt_grid{
  scrollbar-width:none;
}

/* 1 video per slide in mobile slider */
.mastro_yt_container.is-mobile-slider .mastro_yt_item{
  flex:0 0 100%;
  max-width:100%;
  scroll-snap-align:start;
}

/* Show controls row in slider mode (dots left, arrows right) */
.mastro_yt_container.is-mobile-slider .mastro_yt_controls{
  display:flex;
  justify-content:space-between;
}

/* ===== MODAL ===== */
.mastro_yt_modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:99999;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.mastro_yt_modal.is-open{
  display:flex;
}
.mastro_yt_modal_overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.68);
}
.mastro_yt_modal_dialog{
  position:relative;
  z-index:1;
  max-width:980px;
  width:92vw;
  background:#000;
  border-radius:14px;
  overflow:hidden;
}

/* Close button: make sure × is centered */
.mastro_yt_modal_close{
  all:unset;
  position:absolute;
  top:8px;
  right:10px;
  z-index:2;
  width:40px;
  height:40px;
  border-radius:999px;
  background:rgba(255,255,255,.14);
  color:#fff;
  font-size:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  cursor:pointer;
  box-sizing:border-box;
}

.mastro_yt_modal_iframe_wrap{
  aspect-ratio:16/9;
}
.mastro_yt_iframe{
  width:100%;
  height:100%;
  display:block;
}
