* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: black;
  overflow: hidden;
  touch-action: none;
  font-family: system-ui, -apple-system;
}

#player {
  position: fixed;
  inset: 0;
  background: black;
  overflow: hidden;
  touch-action: none;
}

video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top;
  background: black;
  will-change: transform;
}

video.hidden {
  opacity: 0;
  pointer-events: none;
}

video.visible {
  opacity: 1;
}

/* 🔘 SIDE CONTROLS */
#controls {
  position: fixed;
  right: 16px;
  bottom: 10px;
  z-index: 10;

  display: flex;
  flex-direction: column;
  gap: 10px;

  align-items: flex-end; /* ✅ FIX: keeps all buttons flush right */
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}

/* 🔲 TIKTOK STYLE BUTTONS */
#controls button {
  width: 38px;
  height: 38px;
  padding: 0;

  border-radius: 10px; /* squircle border */
  background: transparent;
  color: #ffffff;
  border: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  font-size: 24px;
  backdrop-filter: none;
  filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.6));
  
  transition: transform 0.15s ease, opacity 0.15s ease;
  margin-bottom: 18px; /* space for text below */
  position: relative;
}

#controls button i {
  margin-top: 2px;
}

.btn-count {
  position: absolute;
  bottom: -18px;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.liked i {
  color: #ff2b54;
  animation: heartPop 0.3s ease;
}
.disliked i {
  color: #ffa500;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* 🔊 SOUND BUTTON — BIGGER (inside column now) */
#controls #soundToggle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  

  padding: 0;

  background: transparent !important;
  border: 2px solid #ffffff !important;
  border-radius: 10px;

  color: #ffffff;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  backdrop-filter: blur(6px);
  box-shadow: none !important;

  font-size: 18px; /* adjust icon size if needed */
  margin-top: 5px;
  margin-right: -12px;
  margin-bottom: 2px;
}

/* 🟢 WHATSAPP, WEB & SHARE BUTTONS — BIGGER */
#controls #whatsappBtn, #controls #webBtn, #controls #shareBtn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  margin-bottom: 8px;
  margin-right: -12px;
}

#controls #whatsappBtn img, #controls #webBtn img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.6));
  transition: transform 0.15s ease;
}

#controls #whatsappBtn:active img, #controls #webBtn:active img {
  transform: scale(0.9);
}

#controls #shareBtn i {
  font-size: 28px;
}

/* stop pulse while pressed */
#soundToggle:active {
  animation: none;
}

@keyframes soundPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* animation helper */
.animate {
  transition: transform 0.25s ease-out;
}

/* 🔒 NEXT VIDEO LOCK */
#nextLock {
  position: fixed;
  left: 10px;
  bottom: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  filter: drop-shadow(0 0 4px rgba(255, 204, 0, 0.6));
  z-index: 9999;
}

#nextLock.locked {
  opacity: 1;
  animation: lockPulse 1.4s ease-in-out infinite;
}

#nextLock.unlocked {
  animation: unlockPop 0.35s ease-out forwards;
}

@keyframes lockPulse {
  0%   { transform: scale(0.9); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(0.9); }
}

@keyframes unlockPop {
  0%   { opacity: 1; transform: scale(1); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(0.6); }
}

/* 🎮 TAP CONTROLS OVERLAY */
#tapControls {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  pointer-events: none;
  opacity: 0;
  z-index: 9998;
}

#tapControls.visible {
  opacity: 1;
  pointer-events: auto;
}

/* FACEBOOK / iOS STYLE CONTROLS */
.ctrl {
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: #ffffff;

  transform: scale(0.85);
  animation: ctrlPulse 1.6s ease-in-out infinite;
  transition: transform 0.2s ease, opacity 0.25s ease;
  user-select: none;
}

.ctrl-back,
.ctrl-fwd {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.ctrl-play i {
  font-size: 26px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.ctrl-play.morph i {
  transform: scale(0.6);
  opacity: 0;
}

.ctrl:active,
#controls button:active {
  transform: scale(0.92);
}

#tapControls.visible .ctrl {
  transform: scale(1);
}

#tapControls.hiding .ctrl {
  opacity: 0;
  transform: scale(0.6);
}

@keyframes ctrlPulse {
  0%   { transform: scale(0.95); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(0.95); }
}

/* 🇸🇴 PROGRESS BAR */
#progressWrap {
  position: fixed;
  left: 0;
  bottom: 60px;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.15);
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#progressWrap.visible {
  opacity: 1;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: #4AA3FF;
  box-shadow:
    0 0 6px rgba(74,163,255,0.9),
    0 0 12px rgba(74,163,255,0.7);
  transition: width 0.08s linear;
}

.playing #progressBar {
  animation: glowPulse 1.4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%   { box-shadow: 0 0 4px rgba(74,163,255,0.5); }
  50%  { box-shadow: 0 0 12px rgba(74,163,255,1); }
  100% { box-shadow: 0 0 4px rgba(74,163,255,0.5); }
}

/* 💬 COMMENT SECTION (White Background) */
#commentPanel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70vh;
  background: #ffffff;
  z-index: 10000;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: translateY(100%);
  color: #000;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
}

#commentPanel.visible {
  transform: translateY(0);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.panel-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.panel-header button {
  background: none;
  border: none;
  font-size: 20px;
  color: #555;
  cursor: pointer;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px 20px;
}

.comment-item {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.comment-author {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.comment-text {
  font-size: 15px;
  color: #111;
  margin-top: 2px;
}

.panel-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  background: #fff;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding-right: 15px;
}

.input-wrap:focus-within {
  border-color: #4AA3FF;
  background: #fff;
}

.input-wrap input {
  flex: 1;
  padding: 12px 15px;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
}

#sendCommentBtn {
  background: none;
  border: none;
  color: #4AA3FF;
  font-size: 18px;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}

#sendCommentBtn:active {
  transform: scale(0.9);
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 5px;
}

.comment-actions button {
  background: none;
  border: none;
  color: #777;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.comment-actions button.liked {
  color: #ff2b54;
}

.comment-actions button.disliked {
  color: #ffa500;
}

/* 💬 REPLIES & EMOJIS */
.reply-list {
  margin-left: 30px;
  margin-top: 10px;
  border-left: 2px solid #eee;
  padding-left: 10px;
}

.reply-item {
  margin-bottom: 10px;
}

.reply-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0f0f0;
  padding: 8px 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #555;
}

.reply-indicator.hidden {
  display: none;
}

#cancelReplyBtn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 14px;
}

.panel-footer {
  position: relative;
}

#emojiToggleBtn {
  background: none;
  border: none;
  color: #777;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  margin-left: 5px;
}

.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
  margin-bottom: 10px;
}

.emoji-picker.hidden {
  display: none;
}

.emoji {
  font-size: 24px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
}

.emoji:active {
  transform: scale(0.8);
}

/* 🔐 AUTH MODALS */
#authModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#authModalOverlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-box {
  background: #fff;
  width: 90%;
  max-width: 380px;
  padding: 25px;
  border-radius: 16px;
  position: relative;
  display: none;
  flex-direction: column;
  color: #000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.auth-box.visible-form {
  display: flex;
}

.auth-box h3 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 22px;
}

.auth-box input[type="text"],
.auth-box input[type="email"],
.auth-box input[type="password"] {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  background: #f9f9f9;
}

.primary-btn {
  background: #ff2b54;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

.switch-auth {
  text-align: center;
  margin-top: 15px;
  font-size: 14px;
  color: #666;
}

.switch-auth span {
  color: #4AA3FF;
  font-weight: 600;
  cursor: pointer;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
}

.terms-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  font-size: 13px;
  color: #555;
}

.terms-wrap span {
  color: #4AA3FF;
  text-decoration: underline;
  cursor: pointer;
}

.terms-box .terms-content {
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ==========================================
   ⚙️ VIDEO QUALITY SELECTOR AESTHETICS
   ========================================== */

#qualitySelectorWrap {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 10002;
  opacity: 0.2;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Dynamic Opacity based on Controls Visibility state or Hover/Active focus */
body.controls-visible #qualitySelectorWrap,
#qualitySelectorWrap:hover,
#qualitySelectorWrap.active {
  opacity: 1;
}

/* Premium Glassmorphic Selector Trigger Button */
#qualityBtn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 9px; /* squircle border compatible with regional buttons */
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

#qualityBtn i {
  font-size: 12px;
  color: #4AA3FF; /* subtle cyan/blue tint */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#qualityBtn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

#qualityBtn:active {
  transform: translateY(1px);
}

/* Rotate icon when dropdown is active */
#qualitySelectorWrap.active #qualityBtn i {
  transform: rotate(90deg);
}

/* Premium Dark Translucent Dropdown Menu */
#qualityMenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 140px;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  
  /* Initial hidden state with smooth scaling slide transition */
  transform: translateY(-10px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#qualityMenu.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Individual Dropdown Quality Option items */
.quality-option {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quality-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.quality-option.active {
  background: rgba(74, 163, 255, 0.2);
  color: #4AA3FF;
  font-weight: 600;
}

.quality-option.active::after {
  content: "✓";
  font-size: 12px;
  font-weight: bold;
}

/* ==========================================
   🔍 TIKTOK SEARCH & INFO OVERLAY AESTHETICS
   ========================================== */

#searchContainer {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10002;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}

#searchToggleBtn {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

#searchToggleBtn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

#searchToggleBtn:active {
  transform: scale(0.95);
}

#searchBar {
  display: flex;
  align-items: center;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  padding: 2px 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  height: 40px;
}

#searchBar.visible {
  width: 260px;
  opacity: 1;
  pointer-events: auto;
}

#searchInput {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 6px;
  font-size: 14px;
  width: 100%;
  outline: none;
}

#searchInput::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#searchClearBtn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#searchClearBtn:hover {
  color: #ffffff;
}

/* 🎥 TIKTOK VIDEO INFO OVERLAY */
#videoInfo {
  position: fixed;
  left: 16px;
  bottom: 16px; /* Sits at the very bottom center-left area */
  right: 80px;  /* Leaves space for the controls panel on the right */
  z-index: 9997;
  color: #ffffff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}

#videoTitle {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  color: #ffffff;
}

#videoDescriptionContainer {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
  display: inline;
}

.see-more-btn {
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  margin-left: 6px;
  text-decoration: underline;
  display: inline-block;
  background: rgba(0, 0, 0, 0.2);
  padding: 0px 6px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.see-more-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.see-more-btn.hidden {
  display: none;
}

/* 💎 PREMIUM GLASSMORPHIC HUD FADE & SLIDE ANIMATIONS */
.hud-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#videoInfo.hud-hidden,
#controls.hud-hidden {
  transform: translateY(15px); /* Slide down at bottom of screen */
}

#searchContainer.hud-hidden,
#qualitySelectorWrap.hud-hidden {
  transform: translateY(-15px); /* Slide up at top of screen */
}




