#btn-unmute {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(16px, 2.5vw, 22px); /* responsive text */
  padding: clamp(12px, 2vw, 20px) clamp(18px, 3vw, 32px);
  border: none;
  border-radius: 16px;
  background: #A8164E;
  color: #fff;
  cursor: pointer;
  max-width: 90vw;   /* กันล้นจอ */
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  white-space: normal;
}

/* ===== ข้อความ ===== */
#btn-unmute .btn-text {
  word-break: break-word;
}

/* hover */
#btn-unmute:hover {
  background: #E7258A;
  transform: scale(1.08);
}

#btn-unmute:active {
  transform: scale(0.95);
}

/* pulse (ชัดขึ้น) */
@keyframes pulseStrong {
  0% { box-shadow: 0 0 0 0 rgba(255,59,48,0.7); }
  70% { box-shadow: 0 0 0 25px rgba(255,59,48,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,48,0); }
}

#btn-unmute.pulse {
  animation: pulseStrong 1.5s infinite;
}

/* ===== mobile ===== */
@media (max-width: 768px) {
  #btn-unmute {
    flex-direction: column; /* ไอคอนอยู่บน */
    gap: 6px;
    width: 85%;
  }
}

/* ===== จอเล็กมาก ===== */
@media (max-width: 400px) {
  #btn-unmute {
    font-size: 14px;
    padding: 12px;
  }
}

.video-js .vjs-control-bar {
  z-index: 10;
}

.video-loading[style*="display:none"] {
  pointer-events: none;
}

/* =====================================================
   STATUS
   ===================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 500;
}

.status-badge.waiting {
  background: #FEF3C7;
  color: #92400E;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0ad4e;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: .3; }
  100% { opacity: 1; }
}

/* =====================================================
   LIVE DOT – FORCE VISIBILITY (FIX)
   ===================================================== */

/* จุด LIVE สีแดง */
.live-dot {
  display: inline-block !important;
  width: 9px;
  height: 9px;
  min-width: 9px;
  min-height: 9px;

  border-radius: 50%;
  background-color: var(--live-red) !important;

  flex-shrink: 0;           /* กัน flex บีบ */
  vertical-align: middle;

  animation: live-blink 0.9s infinite;
}

/* animation แยกจาก status-dot */
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ป้องกัน reduced-motion ปิดการมองเห็น */
@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
    opacity: 1;
  }
}

/* =====================================================
   🎬 CONTROL BAR – FULL WIDTH 4 SCREEN
   ===================================================== */

.video-controls{
  position:absolute;
  left:0;
  bottom:0;

  width:100%;
  height:64px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  padding:0 18px;
  box-sizing:border-box;

  background:linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
  backdrop-filter:blur(6px);

  z-index:9999;
}

/* auto hide */
.video-controls.hide{
  opacity:0;
  pointer-events:none;
}

/* left */
.left-group{
  display:flex;
  align-items:center;
  gap:14px;
}

/* right */
.right-group{
  display:flex;
  align-items:center;
}

/* buttons */
.video-controls button{
  background:none;
  border:none;
  color:#fff;
  font-size:22px;
  cursor:pointer;

  width:46px;
  height:46px;
  border-radius:50%;
  transition:.2s;
}

.video-controls button:hover{
  background:rgba(255,255,255,.18);
  transform:scale(1.18);
}

/* divider */
.vc-divider{
  width:1px;
  height:22px;
  background:rgba(255,255,255,.35);
}

/* 📱 MOBILE BUTTON SIZE */
@media (max-width: 768px) {

  .video-controls {
    width: 95%;
    padding: 6px 8px;
    gap: 6px;
  }

  .left-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .right-group {
    display: flex;
    align-items: center;
  }

  #volumeSlider {
    width: 70px; /* ลดจากเดิม */
  }

  .live-label span {
    font-size: 12px;
    padding: 2px 6px;
  }

  .video-controls button {
    font-size: 14px;
  }

}



/* Overlay ครอบทั้ง liveContainer */
.fs-overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:9999;
  transition:opacity .3s;
}


/* ปุ่ม Fullscreen ขวาล่าง */
.fs-btn{
  pointer-events:auto;
  position:absolute;
  right:16px;
  bottom:16px;
  color:#fff;
  border:none;
  padding:12px 20px;
  font-size:16px;
  border-radius:28px;
}

.video-controls,
.video-tab,
.fs-btn {
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
}

/* iPhone safe area */
@supports (padding: env(safe-area-inset-bottom)) {
  .fs-btn{
    bottom:calc(16px + env(safe-area-inset-bottom));
    right:calc(16px + env(safe-area-inset-right));
  }
}

/* auto-hide */
.fs-overlay.hide{
  opacity:0;
}

/* ปิด control ของ HTML5 video */
video::-webkit-media-controls {
  display: none !important;
}

video::-webkit-media-controls-enclosure {
  display: none !important;
}

/* video.js */
.video-js .vjs-control-bar {
  display: none !important;
}

#videoControls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;

  opacity: 0;
  transform: translateY(100%);
  transition: all 0.3s ease;
}

#videoControls.show {
  opacity: 1;
  transform: translateY(0);
}

/* gradient */
#videoControls::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  z-index: -1;
}

#videoControls button {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

/* ===============================
   VIDEO TAB – ALL IN ONE
   =============================== */

.video-tab {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  z-index: 30;
  transition: .3s;
}

/* auto hide support */
.video-tab.hide {
  opacity: 0;
  pointer-events: none;
}

/* live badge */
.video-tab .tab-live {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,59,59,.15);
  color: #ff3b3b;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.video-tab .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff3b3b;
  animation: livePulse 1.2s infinite;
}

/* buttons */
.video-tab .tab-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: .2s;
}

.video-tab .tab-btn:hover {
  background: rgba(255,255,255,.15);
}

.tab-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.25);
  margin: 0 4px;
}

/* mobile */
@media (max-width:768px){
  .video-tab {
    bottom: 50%;
    right: 50%;
    transform: translate(50%,50%);
  }
}

/* live dot animation */
@keyframes livePulse {
  0%   { opacity: 1; }
  50%  { opacity: .3; }
  100% { opacity: 1; }
}
}

/* =====================================================
   ✅ FULLSCREEN – KEEP ORIGINAL VIDEO RATIO
   Mobile / Tablet / video.js
   ===================================================== */

/* fullscreen ของ video.js */
.video-js.vjs-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #000;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* ตัว video จริง */
.video-js.vjs-fullscreen video,
.video-js.vjs-fullscreen .vjs-tech {
  width: 100% !important;
  height: 100% !important;

  /* ⭐ สำคัญ: ไม่ crop ไม่ยืด */
  object-fit: contain !important;

  /* ❌ ไม่ fix ratio */
  aspect-ratio: auto !important;

  background: #000;
}

/* ยกเลิก constraint จาก layout เดิม */
.video-js.vjs-fullscreen .video-wrapper {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
}

/* ปิดผลของ zoom ทุกกรณี */
.video-js.vjs-fullscreen,
.video-js.vjs-fullscreen * {
  zoom: 1 !important;
}

.feedback-btn {
  display: flex;
  align-items: center;
  gap: 8px;

  background: var(--led-blue);
  color: #fff;

  padding: 12px 18px;
  border-radius: 999px;
  border: none;

  font-size: 14px;
  font-weight: 600;
  cursor: pointer;

  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transition: .2s;
}

.feedback-btn:hover {
  background: var(--led-pink-dark);
  transform: translateY(-2px);
}

.feedback-btn:active {
  transform: translateY(0);
  opacity: .9;
}

.feedback-btn .fb-icon {
  font-size: 18px;
  line-height: 1;
}

/* ===============================
   📱 MOBILE – ICON ONLY + AUTO HIDE
   =============================== */
@media (max-width: 768px) {

  .feedback-btn {
    width: 50px;
    height: 50px;
    padding: 0;

    border-radius: 50%;
    justify-content: center;

    font-size: 22px;

    /* เริ่มต้นซ่อน */
    opacity: 0;
    pointer-events: none;
  }

  /* แสดง */
  .feedback-btn.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* ซ่อนถาวรตอน fullscreen */
  .feedback-btn.fullscreen-hide {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ซ่อนข้อความ เหลือแต่ icon */
  .feedback-btn .fb-text {
    display: none;
  }
}

.yt-playpause{
  position:fixed;
  bottom:30px;
  left:50%;
  transform:translateX(-50%);
  z-index:999999;
  background:rgba(0,0,0,.75);
  color:#fff;
  border:0;
  font-size:22px;
  padding:14px 22px;
  border-radius:50px;
  cursor:pointer;
  transition:.2s;
}
.yt-playpause:hover{
  background:#ff0000;
}

/* ✅ ปลด crop เฉพาะ fullscreen เท่านั้น */
#live-container:fullscreen .video-wrapper,
#live-container:-webkit-full-screen .video-wrapper{
  overflow: visible !important;
  aspect-ratio: auto !important;
}

.volume-control {
  background: rgba(0,0,0,0.45); /* โปร่ง */
  backdrop-filter: blur(6px);   /* glass effect */
  -webkit-backdrop-filter: blur(6px);
  padding: 8px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
   opacity: 0.6;
  transition: opacity 0.2s ease;
}

.volume-control:hover {
  opacity: 1;
}

.volume-control button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

#volumeSlider {
  width: 120px;
  cursor: pointer;
}

/* container control */
.control-bar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.6);
  padding: 8px 12px;
  border-radius: 20px;
  max-width: 95vw;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

/* mobile */
@media (max-width: 768px) {
  .control-bar {
    width: 90%;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
  }

  .control-bar button {
    font-size: 16px;
  }

  #volumeSlider {
    width: 80px;
  }
}

.control-bar {
  pointer-events: auto;
}

.video-container {
  position: relative;
}

@media (max-width: 768px) {

  .video-controls {
    width: 95%;
    padding: 6px 8px;
    gap: 6px;
  }

  .left-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .right-group {
    display: flex;
    align-items: center;
  }

  #volumeSlider {
    width: 70px; /* ลดจากเดิม */
  }

  .live-label span {
    font-size: 12px;
    padding: 2px 6px;
  }

  .video-controls button {
    font-size: 14px;
  }

}

.no-live-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

/* ================= POPUP ================= */
#statusPopup {
  position: absolute;
  top: 50%;
  left: 50%;
   transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#statusPopup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#statusPopup.hide {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
}

.status-icon {
  width: clamp(60px, 12vw, 100px);
  height: clamp(60px, 12vw, 100px);

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);

  color: #fff;
  font-size: clamp(24px, 5vw, 42px);

  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* ================= CURSOR ================= */
.hide-cursor {
  cursor: none;
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
  #statusPopup {
    width: 80px;
    height: 80px;
    font-size: 36px;
  }
}

/* ================= LOADING ================= */
.yt-loading {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  color: #fff;
  font-size: 14px;
}

/* วงกลมแดง */
.yt-spinner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff0000 40%, transparent 41%);
  position: relative;
  margin-bottom: 12px;
}

/* pulse */
.yt-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255,0,0,0.6);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.8);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}


.offline-box {
  position: absolute;
  inset: 0;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.offline-body {
  text-align: center;
}

.offline-body img {
  width: 100px;
  margin-bottom: 16px;
}

.offline-text {
  font-size: 18px;
  margin-bottom: 8px;
}

.offline-status {
  color: #ff3b3b;
  font-weight: bold;
  margin-bottom: 10px;
}

.offline-status .dot {
  width: 8px;
  height: 8px;
  background: #ff3b3b;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}

.offline-footer {
  margin-top: 20px;
  font-size: 14px;
}

.reconnect-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  transition: all 0.3s ease;
}

.reconnect-bar.hidden {
  opacity: 0;
  pointer-events: none;
}

.reconnect-bar.show {
  opacity: 1;
}

/* ===============================
   FULLSCREEN POPUP FIX
=============================== */
#live-container:fullscreen #statusPopup,
#live-container:-webkit-full-screen #statusPopup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  z-index: 999999;
}

/* กัน video กลบ */
.video-js {
  z-index: 1;
}

#statusPopup {
  z-index: 999999;
}

:fullscreen .live-info {
    display: none !important;
}

/* สำหรับ Safari / iOS */
:-webkit-full-screen .live-info {
    display: none !important;
}