:root {
  --font: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --bg: #080C14;
  --bg-top: #0F162A;
  --surface: #0D1322;
  --surface-hover: #131C32;
  --card: rgba(13, 19, 34, 0.92);
  --card-border: #1C2640;
  --input-bg: #0A0F1D;
  --input-border: #1F2B48;
  --input-focus: #8B5CF6;
  --ink: #F8FAFC;
  --ink-secondary: #CBD5E1;
  --muted: #94A3B8;
  --dim: #64748B;
  --accent: #8B5CF6;
  --accent-light: #C084FC;
  --pink: #EC4899;
  --orange: #FB923C;
  --blue: #38BDF8;
  --green: #4ADE80;
  --red: #F87171;
  --grad-primary: linear-gradient(90deg, #F472B6 0%, #A855F7 50%, #6366F1 100%);
  --grad-primary-hover: linear-gradient(90deg, #FB7185 0%, #C084FC 50%, #818CF8 100%);
  --grad-download: linear-gradient(90deg, #FB923C 0%, #EC4899 50%, #8B5CF6 100%);
  --grad-download-hover: linear-gradient(90deg, #FDBA74 0%, #F472B6 50%, #A855F7 100%);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 4px 20px rgba(168, 85, 247, 0.35);
  --shadow-dl: 0 4px 22px rgba(236, 72, 153, 0.4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% -10%, rgba(139, 92, 246, 0.22) 0%, rgba(8, 12, 20, 0.98) 55%),
    radial-gradient(circle at 10% 30%, rgba(236, 72, 153, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(56, 189, 248, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, a, input, select, label, .ep-btn, .ep-range-btn, .tab-link {
  touch-action: manipulation;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(8, 12, 20, 0.88);
  border-bottom: 1px solid var(--card-border);
}

.nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.35);
}

.brand-text strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-text strong span {
  background: linear-gradient(90deg, #F472B6, #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--grad-primary);
  padding: 1px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  margin-top: 2px;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Desktop Nav Tabs */
.desktop-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(13, 19, 34, 0.85);
  border: 1px solid var(--card-border);
  padding: 3px;
  border-radius: 10px;
}

.tab-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-link:hover {
  color: var(--ink);
}

.tab-link.on {
  background: var(--grad-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.35);
}

.btn-zalo-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 104, 255, 0.15);
  border: 1px solid rgba(0, 104, 255, 0.45);
  color: #38BDF8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-zalo-nav:hover {
  background: rgba(0, 104, 255, 0.25);
  border-color: #0084FF;
  box-shadow: 0 0 12px rgba(0, 132, 255, 0.35);
  color: #FFFFFF;
}

/* Header Language Selector (57 Ngon Ngu + Tu dong IP) */
.site-lang-wrap {
  position: relative;
}

.site-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(19, 27, 48, 0.92);
  border: 1px solid #253459;
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.site-lang-btn:hover {
  border-color: #8B5CF6;
  background: #1A2440;
}

.site-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(290px, calc(100vw - 24px));
  background: #0F172A;
  border: 1px solid #2A3A66;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.72);
  z-index: 300;
  overflow: hidden;
}

html[dir="rtl"] .site-lang-menu {
  right: auto;
  left: 0;
}

.site-lang-search-wrap {
  padding: 8px;
  border-bottom: 1px solid #1E293B;
  background: #0B1222;
}

.site-lang-search-wrap input {
  width: 100%;
  background: #141E36;
  border: 1px solid #253459;
  border-radius: 8px;
  padding: 7px 10px;
  color: #F8FAFC;
  font-size: 13px;
  outline: none;
}

.site-lang-search-wrap input:focus {
  border-color: #EC4899;
}

.site-lang-list {
  max-height: 290px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.site-lang-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #CBD5E1;
  font-size: 12.5px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}

.site-lang-opt:hover {
  background: rgba(139, 92, 246, 0.16);
  color: #FFFFFF;
}

.site-lang-opt.on {
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.25), rgba(139, 92, 246, 0.25));
  color: #FFFFFF;
  border: 1px solid rgba(236, 72, 153, 0.45);
}

.site-lang-opt small {
  font-size: 10.5px;
  font-weight: 700;
  color: #94A3B8;
  flex-shrink: 0;
}

/* Video Language Picker Row in Forms */
.lang-picker-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 34, 0.72);
  border: 1px solid #1E293B;
}

.lang-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #CBD5E1;
  white-space: nowrap;
}

.lang-picker-label svg {
  color: #EC4899;
  flex-shrink: 0;
}

.video-lang-select {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  background-color: #131B30;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23CBD5E1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #253459;
  border-radius: 8px;
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 30px 7px 10px;
  outline: none;
  cursor: pointer;
}

html[dir="rtl"] .video-lang-select {
  background-position: left 10px center;
  padding: 7px 10px 7px 30px;
}

.video-lang-select:focus {
  border-color: #EC4899;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  transition: max-width 0.25s ease;
}

.container.is-watch {
  max-width: 1060px;
}

/* Supported Platforms Bar (Chi giu PineDrama & Douyin) */
.platforms-bar {
  margin: 10px 0 18px;
  background: rgba(13, 19, 34, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
}

.platforms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.platforms-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.platforms-note {
  font-size: 11px;
  font-weight: 700;
  color: #F472B6;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 5px;
  padding: 2px 7px;
}

.plat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.plat-chip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  user-select: none;
  transition: transform 0.15s ease;
}

.plat-chip:hover {
  transform: translateY(-1px);
}

.plat-chip img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.plat-label {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.plat-label b {
  font-weight: 700;
  white-space: nowrap;
}

.plat-label small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  white-space: nowrap;
}

@media (min-width: 561px) {
  .plat-label small::before {
    content: "• ";
    opacity: 0.75;
  }
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 14px 10px 18px;
}

.hero h1, .hero h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #FFFFFF 30%, #E2E8F0 60%, #C084FC 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--muted);
  margin: 0 auto;
  font-size: 13.5px;
  max-width: 620px;
}

/* Card Styles */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Form & Input Field */
.input-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 4px 6px 4px 12px;
  transition: all 0.2s ease;
}

.input-field-wrap:focus-within {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.input-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--accent-light);
  margin-right: 8px;
}

.input-field-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 6px 10px 0;
  min-width: 0;
}

html[dir="rtl"] .input-field-wrap input {
  padding: 10px 0 10px 6px;
}

.input-field-wrap input::placeholder {
  color: var(--dim);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-clear:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.btn-paste {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-paste:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* Download CTA Button */
.btn-download-primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 13px 20px;
  border: none;
  border-radius: 12px;
  background: var(--grad-download);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-dl);
  transition: all 0.25s ease;
  letter-spacing: 0.2px;
}

.btn-download-primary:hover {
  background: var(--grad-download-hover);
  box-shadow: 0 6px 26px rgba(236, 72, 153, 0.55);
  transform: translateY(-1px);
}

.btn-download-primary:active {
  transform: translateY(1px);
}

.btn-download-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Flash message */
.flash {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 9px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

/* Result Card */
.result-card {
  margin-top: 18px;
  scroll-margin-top: 72px;
  background: #090E1D;
  border: 1px solid #233054;
  border-radius: 14px;
  padding: 16px;
  animation: fadeInSlide 0.3s ease;
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}

.result-thumb-box {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 135px;
  border-radius: 10px;
  overflow: hidden;
  background: #060913;
  border: 1px solid var(--card-border);
}

.result-thumb-box > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-thumb-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  max-width: calc(100% - 12px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  overflow: hidden;
}

.result-thumb-badge img {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}

html[dir="rtl"] .result-thumb-badge {
  left: auto;
  right: 6px;
}

.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.result-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.badge-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-quality {
  background: #10243E;
  color: #60A5FA;
  border: 1px solid #2563EB;
}

.badge-nowm {
  background: #0D281C;
  color: #4ADE80;
  border: 1px solid #16A34A;
}

/* Action Buttons in Result */
.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .result-actions {
    grid-template-columns: 1fr 1fr;
  }
  .btn-action-primary {
    grid-column: 1 / -1;
  }
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-action-primary {
  background: var(--grad-download);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.35);
}

.btn-action-primary:hover {
  background: var(--grad-download-hover);
  box-shadow: 0 6px 22px rgba(236, 72, 153, 0.5);
}

.btn-action-ghost {
  background: #131A2D;
  border: 1px solid #233050;
  color: #E2E8F0;
}

.btn-action-ghost:hover {
  background: #19233D;
  border-color: var(--accent);
  color: #FFFFFF;
}

/* Stats Row */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  background: rgba(13, 19, 34, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
}

.stat-card span {
  font-size: 11.5px;
  color: var(--dim);
}

html[dir="rtl"] .zalo-perks {
  text-align: right;
}

/* Zalo Community View (Y het download.zip) */
.zalo-card {
  text-align: center;
  padding: 24px 20px;
}

.zalo-qr-box {
  width: 220px;
  height: 220px;
  margin: 0 auto 18px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(0, 104, 255, 0.4);
  box-shadow: 0 8px 30px rgba(0, 104, 255, 0.25);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zalo-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.zalo-qr-box img:hover {
  transform: scale(1.03);
}

.zalo-title {
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0 0 6px;
}

.zalo-lead {
  font-size: 13.5px;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 16px;
}

.btn-zalo-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 12px;
  background: linear-gradient(90deg, #0068FF 0%, #0084FF 100%);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0, 104, 255, 0.4);
  transition: all 0.25s ease;
  width: 100%;
  max-width: 420px;
}

.btn-zalo-big:hover {
  background: linear-gradient(90deg, #0084FF 0%, #00A3FF 100%);
  box-shadow: 0 6px 28px rgba(0, 132, 255, 0.55);
  transform: translateY(-1px);
}

.zalo-perks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 22px;
  text-align: left;
}

@media (min-width: 540px) {
  .zalo-perks {
    grid-template-columns: 1fr 1fr;
  }
}

.zalo-perk-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(13, 19, 34, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
}

.zalo-perk-item svg {
  flex-shrink: 0;
  color: #38BDF8;
  margin-top: 2px;
}

/* Bottom Dock Navigation (Mobile sticky dock) */
.dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(8, 12, 20, 0.94);
  border-top: 1px solid var(--card-border);
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 6px;
}

.dock-inner {
  max-width: 500px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  gap: 4px;
}

.dock button {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 7px 4px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dock button svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.dock button.on {
  color: #FFFFFF;
  background: rgba(139, 92, 246, 0.16);
}

.dock button.on svg {
  color: var(--accent-light);
  transform: translateY(-1px);
}

.dock button:hover:not(.on) {
  color: var(--ink-secondary);
}

/* Watch shortcut button on Home result */
.btn-action-watch {
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #E9D5FF;
}

.btn-action-watch:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: #C084FC;
  color: #FFFFFF;
}

/* ===================================================================== */
/* XEM FULL TAP TAB (ADAPTIVE PORTRAIT/LANDSCAPE & PC/MOBILE UI)         */
/* ===================================================================== */

.watch-loading-card {
  margin-top: 16px;
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.watch-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(168, 85, 247, 0.22);
  border-top-color: #F472B6;
  border-right-color: #8B5CF6;
  animation: watchSpin 0.8s linear infinite;
}

.watch-spinner.small {
  width: 30px;
  height: 30px;
  border-width: 2.5px;
}

@keyframes watchSpin {
  to { transform: rotate(360deg); }
}

.watch-loading-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.watch-loading-sub {
  margin: 0;
  max-width: 460px;
  color: var(--muted);
  font-size: 13px;
}

.watch-skeleton-bars {
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.watch-skeleton-bars span {
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(28, 38, 64, 0.55) 25%, rgba(139, 92, 246, 0.22) 50%, rgba(28, 38, 64, 0.55) 75%);
  background-size: 200% 100%;
  animation: watchShimmer 1.3s ease-in-out infinite;
}

@keyframes watchShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.watch-stage {
  margin-top: 18px;
  scroll-margin-top: 72px;
  animation: fadeInSlide 0.25s ease;
}

.watch-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.watch-player-card {
  padding: 14px;
}

/* Adaptive Video Frame: Tự động co giãn theo Dọc 9:16 và Ngang 16:9 */
.player-frame {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #04070E;
  border: 1px solid #223056;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  transition: max-width 0.25s ease, aspect-ratio 0.25s ease;
}

.player-frame.is-portrait {
  max-width: 400px;
  aspect-ratio: 9 / 16;
  max-height: 76vh;
}

.player-frame.is-landscape {
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 72vh;
}

.player-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #04070E;
}

.player-fs-fab {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(8px);
  color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}

.player-fs-fab:hover {
  background: rgba(236, 72, 153, 0.85);
  transform: scale(1.06);
}

#watch-player-frame:fullscreen,
#watch-player-frame:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

#watch-player-frame:fullscreen video,
#watch-player-frame:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
}

.watch-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-floating-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
  z-index: 4;
}

.player-floating-badge span {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #F8FAFC;
}

.player-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(4, 7, 14, 0.8);
  backdrop-filter: blur(4px);
  color: #E2E8F0;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 16px;
}

.watch-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.watch-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ep-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid #253459;
  background: #131B30;
  color: #E2E8F0;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-ep-nav:hover:not(:disabled) {
  background: #1C2847;
  border-color: var(--accent);
  color: #FFFFFF;
}

.btn-ep-nav:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.watch-now-pill {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-light);
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 6px 11px;
  border-radius: 8px;
}

.watch-autonext {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}

.watch-autonext input {
  accent-color: #A855F7;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.watch-dl-bar {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watch-dl-bar .btn-action-primary {
  width: 100%;
  padding: 12px 14px;
}

.watch-dl-subrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.watch-dl-subrow:empty {
  display: none;
}

/* Series Poster Banner */
.series-banner {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 14px;
}

.series-poster-wrap {
  position: relative;
  flex-shrink: 0;
  width: 92px;
  height: 124px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid #2A3862;
  background: #060913;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.series-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.series-poster-count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #FFFFFF;
  padding: 4px 4px 3px;
  background: linear-gradient(to top, rgba(8, 12, 20, 0.95), rgba(8, 12, 20, 0.4));
}

.series-meta-info {
  flex: 1;
  min-width: 0;
}

.series-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.35;
}

.series-ep-caption {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Episodes Selector Panel */
.episodes-panel {
  padding: 14px;
}

.episodes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.episodes-heading strong {
  display: block;
  font-size: 14.5px;
  color: #FFFFFF;
}

.episodes-sub {
  font-size: 12px;
  color: var(--muted);
}

.ep-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ep-range-btn {
  border: 1px solid #233054;
  background: #101729;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ep-range-btn.on {
  background: rgba(139, 92, 246, 0.22);
  border-color: #A855F7;
  color: #FFFFFF;
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 3px;
}

.ep-grid::-webkit-scrollbar {
  width: 6px;
}

.ep-grid::-webkit-scrollbar-thumb {
  background: #253359;
  border-radius: 6px;
}

.ep-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 7px 6px;
  border-radius: 10px;
  border: 1px solid #202C4D;
  background: #0D1426;
  color: #CBD5E1;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.ep-btn:hover {
  border-color: #8B5CF6;
  background: #15203C;
  color: #FFFFFF;
}

.ep-btn.on {
  background: var(--grad-primary);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 3px 12px rgba(168, 85, 247, 0.4);
}

.ep-btn.watched:not(.on) {
  border-color: rgba(139, 92, 246, 0.4);
  color: #C084FC;
}

.ep-btn-tag {
  font-size: 9.5px;
  font-weight: 700;
  opacity: 0.82;
}

/* Views display toggle */
.view {
  display: none;
  scroll-margin-top: 72px;
}

.view.on {
  display: block;
}

.foot {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  margin-top: 24px;
}

.foot a {
  color: var(--muted);
  text-decoration: none;
}

.foot a:hover {
  color: var(--accent-light);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 4px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.foot-links a:hover,
.foot-links a:focus-visible {
  color: var(--accent-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Desktop Adaptive Layout (>= 769px & >= 880px) */
@media (min-width: 769px) {
  .dock {
    display: none;
  }
  .container {
    padding-bottom: 44px;
  }
  .nav {
    max-width: 1060px;
  }
}

@media (min-width: 880px) {
  .watch-workspace.mode-portrait {
    display: grid;
    grid-template-columns: minmax(310px, 410px) 1fr;
    align-items: start;
    gap: 20px;
  }
  .watch-workspace.mode-portrait .ep-grid {
    max-height: 455px;
  }
}

/* Mobile Responsive Adjustments (<= 768px) */
@media (max-width: 768px) {
  .desktop-tabs {
    display: none;
  }
  .container {
    padding: 12px 12px 92px;
    overflow-x: clip;
  }
  .nav {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand {
    gap: 8px;
    min-width: 0;
  }
  .brand img {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
  }
  .brand-text {
    min-width: 0;
  }
  .brand-text strong {
    font-size: 15.5px;
    line-height: 1.15;
    white-space: nowrap;
  }
  .brand-badge {
    font-size: 8.5px;
    padding: 1px 5px;
    letter-spacing: 0.35px;
  }
  .btn-zalo-nav {
    padding: 6px 9px;
    font-size: 11px;
    gap: 4px;
  }
  .site-lang-btn {
    padding: 6px 8px;
    font-size: 11px;
    gap: 4px;
  }
  .nav-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .dock-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .hero {
    padding: 10px 4px 14px;
  }
  .hero h1, .hero h2 {
    font-size: 21px;
    line-height: 1.25;
  }
  .hero p {
    font-size: 12.5px;
    line-height: 1.45;
  }
  .card {
    padding: 14px;
    border-radius: 14px;
  }
  .input-field-wrap {
    padding: 3px 5px 3px 10px;
  }
  .input-field-wrap input {
    font-size: 16px;
    padding: 8px 6px 8px 0;
  }
  html[dir="rtl"] .input-field-wrap input {
    padding: 8px 0 8px 6px;
  }
  .site-lang-search-wrap input,
  .video-lang-select {
    font-size: 16px;
  }
  .lang-picker-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 9px 10px;
  }
  .lang-picker-label {
    font-size: 12px;
  }
  .video-lang-select {
    flex: none;
    max-width: 100%;
    width: 100%;
    padding: 8px 32px 8px 10px;
  }
  html[dir="rtl"] .video-lang-select {
    padding: 8px 10px 8px 32px;
  }
  .stats {
    gap: 10px;
  }
  .stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 11px 8px;
    min-height: 66px;
  }
  .stat-card strong {
    font-size: 19px;
  }
  .stat-card span {
    font-size: 11px;
    line-height: 1.3;
  }
  .btn-paste {
    padding: 5px 10px;
    font-size: 11px;
  }
  .btn-download-primary {
    font-size: 14px;
    padding: 12px;
  }
  .zalo-qr-box {
    width: 180px;
    height: 180px;
  }
  .player-frame.is-portrait {
    max-width: 100%;
    max-height: 68vh;
  }
  .player-frame.is-landscape {
    max-height: 52vh;
  }
  .watch-controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .watch-nav-group {
    justify-content: space-between;
  }
  .watch-right-controls {
    width: 100%;
    justify-content: space-between;
  }
  .watch-autonext {
    justify-content: flex-end;
  }
  .watch-dl-subrow {
    grid-template-columns: 1fr;
  }
  .series-poster-wrap {
    width: 78px;
    height: 106px;
  }
  .series-title {
    font-size: 14.5px;
  }
  .ep-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    max-height: 300px;
  }
  .ep-btn {
    min-height: 44px;
    padding: 6px 4px;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .site-lang-menu {
    position: fixed;
    top: 56px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: 340px;
    margin-left: auto;
  }
  html[dir="rtl"] .site-lang-menu {
    left: 12px;
    right: 12px;
    margin-left: 0;
    margin-right: auto;
  }
  .platforms-bar {
    padding: 10px 11px;
    margin: 6px 0 14px;
  }
  .platforms-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin-bottom: 9px;
  }
  .platforms-title {
    font-size: 10.5px;
    letter-spacing: 0.6px;
  }
  .platforms-note {
    font-size: 11px;
    padding: 3px 8px;
    line-height: 1.3;
  }
  .plat-scroll {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
  }
  .plat-chip {
    min-width: 0;
    padding: 8px 10px;
    gap: 8px;
  }
  .plat-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }
  .plat-label b {
    font-size: 12px;
    line-height: 1.25;
  }
  .plat-label small {
    font-size: 10.5px;
    line-height: 1.2;
  }
}

@media (max-width: 420px) {
  .lang-auto-prefix {
    display: none;
  }
  .nav {
    padding: 8px 10px;
    gap: 6px;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .brand-text strong {
    font-size: 15px;
  }
  .stat-card span {
    font-size: 10.5px;
  }
  .result-card {
    padding: 12px;
  }
  .result-header {
    gap: 11px;
  }
  .result-thumb-box {
    width: 84px;
    height: 116px;
  }
  .watch-nav-group {
    gap: 6px;
  }
  .btn-ep-nav {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .watch-now-pill {
    padding: 6px 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .series-banner {
    padding: 12px;
    gap: 11px;
    align-items: flex-start;
  }
}
