/* ═══════════════════════════════════════════════════
   YDH DASHBOARD HOME — Sprint v10.09
   Mục đích: Redesign trang chủ Dashboard
   Phụ thuộc: dashboard-sidebar.css (loaded trước)
   ═══════════════════════════════════════════════════ */

/* ── 1. LAYOUT SHELL ── */
.ytt-dash-home {
  padding: 20px 24px;
  height: 100%;
  overflow-y: auto;
  background: #0f0f18;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.2) transparent;
}
.ytt-dash-home::-webkit-scrollbar { width: 5px; }
.ytt-dash-home::-webkit-scrollbar-track { background: transparent; }
.ytt-dash-home::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 3px; }

/* ── 2. HERO ROW (Greeting + Time) ── */
.ydh-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ydh-greeting-h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #f0f0f0;
  margin: 0 0 4px;
}
.ydh-greeting-p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
  margin: 0;
}
.ydh-time-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 12px;
  padding: 10px 14px;
  flex-shrink: 0;
}
.ydh-time-icon { font-size: 1.2rem; }
.ydh-time-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-gold, #ffd700);
  white-space: nowrap;
}
.ydh-time-comment {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  margin-top: 1px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 3. SECTION CARD ── */
.ydh-section {
  background: rgba(22, 22, 32, 0.95);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.ydh-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ydh-section-head h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-gold, #ffd700);
  margin: 0;
  flex: 1;
}
.ydh-section-head > span:first-child { font-size: 1rem; }

/* ── 4. STAT GRID (override dashboard-sidebar.css) ── */
.ydh-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 0;
}
.ydh-stat-card {
  --sc: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 2px solid var(--sc);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.15s, border-color 0.15s;
  text-align: center;
}
.ydh-stat-card:hover { transform: translateY(-2px); border-color: var(--sc); }
.ydh-sc-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sc);
  line-height: 1.2;
}
.ydh-sc-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── 5. TWO-COLUMN LAYOUT ── */
.ydh-two-col {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}
.ydh-col-left, .ydh-col-right { min-width: 0; }

/* ── 6. MISSIONS ── */
.ydh-mission-list { display: flex; flex-direction: column; gap: 6px; }

.ydh-m-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  transition: background 0.15s;
}
.ydh-m-row:hover { background: rgba(255,255,255,0.04); }
.ydh-m-row.done {
  opacity: 0.55;
}
.ydh-m-row.done .ydh-m-name { text-decoration: line-through; }
.ydh-m-row.claimed {
  opacity: 0.5;
  pointer-events: none;
}

.ydh-m-check {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.ydh-m-row.done .ydh-m-check,
.ydh-m-row.claimed .ydh-m-check {
  background: rgba(76,175,80,0.2);
  border-color: #4caf50;
  color: #4caf50;
}
.ydh-m-row.done .ydh-m-check::after,
.ydh-m-row.claimed .ydh-m-check::after { content: '✓'; }

.ydh-m-info {
  flex: 1;
  min-width: 0;
}
.ydh-m-name {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.ydh-m-prog-wrap {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.ydh-m-prog-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold,#ffd700), #ff9800);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.ydh-m-prog-text {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  margin-top: 3px;
  display: block;
}

.ydh-m-reward {
  font-size: 0.7rem;
  font-weight: 600;
  color: #66bb6a;
  white-space: nowrap;
  flex-shrink: 0;
}

.ydh-m-claim-btn {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(76,175,80,0.5);
  background: rgba(76,175,80,0.1);
  color: #66bb6a;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ydh-m-claim-btn:disabled {
  border-color: rgba(255,255,255,0.1);
  background: transparent;
  color: rgba(255,255,255,0.2);
  cursor: not-allowed;
}
.ydh-m-claim-btn:not(:disabled):hover {
  background: rgba(76,175,80,0.25);
  border-color: #66bb6a;
}
.ydh-m-claim-btn.loading { animation: ydh-pulse 0.8s infinite; }
@keyframes ydh-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── 7. PROGRESS SECTION (keep + style) ── */
.ydh-progress-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.ydh-progress-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 80px; height: 80px;
}
.ydh-ring-percent {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 15px;
  font-weight: 700;
  color: #66bb6a;
}
.ydh-progress-info { flex: 1; min-width: 0; }
.ydh-progress-title { font-size: 0.85rem; font-weight: 600; color: #f0f0f0; margin-bottom: 4px; }
.ydh-progress-desc { font-size: 0.75rem; color: rgba(255,255,255,0.45); line-height: 1.4; }

.ydh-meta-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 8px;
}
.ydh-meta-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ydh-meta-val { font-size: 1.1rem; font-weight: 700; }
.ydh-meta-label { font-size: 0.65rem; color: rgba(255,255,255,0.4); }

/* ── 8. COMMUNITY LIST ── */
.ydh-community-list { display: flex; flex-direction: column; gap: 8px; }
.ydh-comm-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  transition: background 0.15s;
}
.ydh-comm-card:hover { background: rgba(255,255,255,0.04); }
.ydh-comm-icon { font-size: 1.3rem; flex-shrink: 0; }
.ydh-comm-info { flex: 1; min-width: 0; }
.ydh-comm-name { font-size: 0.8rem; font-weight: 600; color: #e0e0e0; margin-bottom: 2px; }
.ydh-comm-desc { font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.ydh-comm-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ydh-comm-btn {
  --bc: rgba(255,255,255,0.4);
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--bc) 50%, transparent);
  background: color-mix(in srgb, var(--bc) 12%, transparent);
  color: var(--bc);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.ydh-comm-btn:hover {
  background: color-mix(in srgb, var(--bc) 22%, transparent);
  border-color: var(--bc);
}

/* ── 9. MUSIC PLAYER ── */
.ydh-music-section .ydh-section-head { margin-bottom: 10px; }

.ydh-music-pip-toggle {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.ydh-music-pip-toggle:hover { color: #f0f0f0; border-color: rgba(255,255,255,0.25); }

.ydh-music-inline {
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-bottom: 10px;
  display: none; /* Ẩn cho đến khi có bài */
}
.ydh-music-inline.has-player { display: block; }
.ydh-music-inline iframe,
.ydh-music-inline #ydh-yt-player-wrap {
  width: 100% !important;
  height: 100% !important;
  border: none;
  display: block;
}

.ydh-music-track-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  margin-bottom: 8px;
  min-height: 44px;
}
.ydh-music-thumb-wrap {
  width: 44px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}
.ydh-music-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.ydh-music-meta { flex: 1; min-width: 0; }
.ydh-music-title {
  font-size: 0.8rem;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.ydh-music-idx { font-size: 0.68rem; color: rgba(255,255,255,0.35); margin-top: 2px; }

.ydh-music-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ydh-mctrl-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ydh-mctrl-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.ydh-mc-play {
  width: 36px; height: 36px;
  background: rgba(212,175,55,0.15);
  border-color: rgba(212,175,55,0.4);
  color: var(--accent-gold,#ffd700);
  font-size: 13px;
}
.ydh-mc-play:hover { background: rgba(212,175,55,0.28); }
.ydh-mc-vol-wrap {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.ydh-mc-vol-slider {
  -webkit-appearance: none;
  width: 70px; height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  outline: none;
  cursor: pointer;
}
.ydh-mc-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent-gold,#ffd700);
  cursor: pointer;
}

.ydh-music-playlist {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.2) transparent;
}
.ydh-music-playlist::-webkit-scrollbar { width: 4px; }
.ydh-music-playlist::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 2px; }

.ydh-pl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}
.ydh-pl-item:hover { background: rgba(255,255,255,0.06); }
.ydh-pl-item.playing { background: rgba(212,175,55,0.1); }
.ydh-pl-item.playing .ydh-pl-title { color: var(--accent-gold,#ffd700); }
.ydh-pl-thumb {
  width: 32px; height: 24px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
}
.ydh-pl-title {
  flex: 1;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ydh-pl-del {
  opacity: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(239,83,80,0.15);
  color: #ef5350;
  font-size: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.ydh-pl-item:hover .ydh-pl-del { opacity: 1; }

.ydh-music-add-row {
  display: flex;
  gap: 6px;
}
.ydh-music-url-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.75rem;
  color: #e0e0e0;
  outline: none;
  min-width: 0;
}
.ydh-music-url-input::placeholder { color: rgba(255,255,255,0.25); }
.ydh-music-url-input:focus { border-color: rgba(212,175,55,0.4); }
.ydh-music-add-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212,175,55,0.3);
  background: rgba(212,175,55,0.1);
  color: var(--accent-gold,#ffd700);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ydh-music-add-btn:hover { background: rgba(212,175,55,0.2); }

/* Thông báo không có bài nhạc */
.ydh-music-empty {
  text-align: center;
  padding: 16px 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
}

/* ── 10. FLOATING PiP ── */
#ydh-music-pip {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  background: #1a1a28;
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.8);
  z-index: 9995;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}
#ydh-music-pip[hidden] { display: none !important; }

.ydh-pip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.3);
  cursor: grab;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ydh-pip-header:active { cursor: grabbing; }
.ydh-pip-title {
  flex: 1;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ydh-pip-actions { display: flex; gap: 4px; }
.ydh-pip-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.ydh-pip-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

#ydh-pip-body {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}
#ydh-pip-body iframe,
#ydh-pip-body #ydh-yt-player-wrap { width: 100% !important; height: 100% !important; border: none !important; display: block; }

.ydh-pip-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
}
.ydh-pip-ctrl-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.ydh-pip-ctrl-btn:hover { background: rgba(255,255,255,0.15); }
.ydh-pip-ctrl-btn.play-btn {
  width: 32px; height: 32px;
  background: rgba(212,175,55,0.15);
  border-color: rgba(212,175,55,0.4);
  color: var(--accent-gold,#ffd700);
}

/* PiP minimized state */
#ydh-music-pip.pip-minimized #ydh-pip-body,
#ydh-music-pip.pip-minimized .ydh-pip-controls { display: none; }

/* ── 11. SECTION TITLE (compat override) ── */
.ydh-section-title { display: none; } /* Đã thay bằng ydh-section-head */

/* ── 12. RESPONSIVE ── */
@media (max-width: 1100px) {
  .ydh-two-col { grid-template-columns: 1fr; }
  .ydh-stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .ytt-dash-home { padding: 12px 14px; }
  .ydh-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ydh-hero-row { flex-direction: column; align-items: flex-start; }
  .ydh-time-badge { width: 100%; }
  #ydh-music-pip { right: 8px; bottom: 64px; width: calc(100vw - 16px); }
  /* Transcript mobile */
  .ydh-transcript-hint { display: none; }
  .ydh-transcript-body { height: 220px; }
  .ydh-ts-seg { padding: 6px 8px; }
  .ydh-zh { padding: 1px 3px; font-size: 1.05em; }
  #ydh-word-popup { min-width: 200px; max-width: calc(100vw - 24px); left: 12px !important; }
  .ydh-wp-lookup { width: 100%; text-align: center; }
}
@media (max-width: 480px) {
  .ydh-stat-grid { gap: 7px; }
  .ydh-sc-val { font-size: 1.1rem; }
  .ydh-m-name { font-size: 0.75rem; }
  .ydh-m-claim-btn { padding: 3px 8px; }
}

/* ── REPEAT BUTTON ───────────────────────────────────────────────────────── */
@keyframes ydh-repeat-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(139,92,246,.45); }
  50%       { box-shadow: 0 2px 18px rgba(139,92,246,.75), 0 0 8px rgba(167,139,250,.4); }
}
@keyframes ydh-repeat-spin-in {
  from { transform: rotate(-60deg) scale(0.7); opacity: 0; }
  to   { transform: rotate(0deg) scale(1); opacity: 1; }
}

.ydh-repeat-btn {
  position: relative;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s,
              color 0.2s, transform 0.1s !important;
}
.ydh-repeat-btn:active { transform: scale(0.82) !important; }
.ydh-repeat-btn i { pointer-events: none; }

/* Badge số / ký hiệu ∞ */
.ydh-repeat-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  font-size: 8.5px; font-weight: 800;
  line-height: 14px; text-align: center;
  pointer-events: none;
  animation: ydh-repeat-spin-in 0.2s ease;
  letter-spacing: 0;
}

/* Trạng thái ×1 — Blue */
.ydh-repeat-btn.repeat-1x {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: rgba(96,165,250,.7);
  color: #fff;
  box-shadow: 0 2px 10px rgba(59,130,246,.45);
}
.ydh-repeat-btn.repeat-1x .ydh-repeat-badge { background: #fff; color: #1d4ed8; }
.ydh-repeat-btn.repeat-1x:hover { background: linear-gradient(135deg,#60a5fa,#3b82f6); }

/* Trạng thái ×2 — Teal/Cyan */
.ydh-repeat-btn.repeat-2x {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  border-color: rgba(34,211,238,.7);
  color: #fff;
  box-shadow: 0 2px 10px rgba(6,182,212,.45);
}
.ydh-repeat-btn.repeat-2x .ydh-repeat-badge { background: #fff; color: #0284c7; }
.ydh-repeat-btn.repeat-2x:hover { background: linear-gradient(135deg,#22d3ee,#06b6d4); }

/* Trạng thái ∞ — Purple glow pulse */
.ydh-repeat-btn.repeat-inf {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border-color: rgba(167,139,250,.7);
  color: #fff;
  animation: ydh-repeat-pulse 2s ease-in-out infinite;
}
.ydh-repeat-btn.repeat-inf .ydh-repeat-badge {
  background: #fff; color: #7c3aed;
  font-size: 10px;
}
.ydh-repeat-btn.repeat-inf:hover { background: linear-gradient(135deg,#a78bfa,#8b5cf6); }

/* ── SCOPE SELECTOR ──────────────────────────────────────────────────────── */
.ydh-repeat-scope {
  display: none; /* JS toggle */
  gap: 6px;
  margin-bottom: 10px;
  animation: ydh-scope-slide 0.2s ease;
}
@keyframes ydh-scope-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ydh-scope-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.45);
  font-size: 11.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.ydh-scope-btn i { font-size: 10px; }
.ydh-scope-btn:active { transform: scale(0.95); }
.ydh-scope-btn:not(.active):hover {
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.8);
  border-color: rgba(255,255,255,.15);
}
.ydh-scope-btn.active {
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.08));
  border-color: rgba(212,175,55,.45);
  color: var(--accent-gold,#ffd700);
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(212,175,55,.2);
}

/* PiP repeat button — kế thừa màu từ trạng thái hiện tại */
#ydh-pip-repeat.repeat-1x { background: linear-gradient(135deg,#3b82f6,#1d4ed8); border-color: rgba(96,165,250,.6); color:#fff; }
#ydh-pip-repeat.repeat-2x { background: linear-gradient(135deg,#06b6d4,#0284c7); border-color: rgba(34,211,238,.6); color:#fff; }
#ydh-pip-repeat.repeat-inf { background: linear-gradient(135deg,#8b5cf6,#7c3aed); border-color: rgba(167,139,250,.6); color:#fff; animation: ydh-repeat-pulse 2s ease-in-out infinite; }

/* ── CC / SUBTITLE BUTTON ─────────────────────────────────────────────────── */
.ydh-cc-btn { transition: background .2s, color .2s, border-color .2s, transform .1s !important; }
.ydh-cc-btn:active { transform: scale(0.82) !important; }
.ydh-cc-btn.cc-active {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: rgba(52,211,153,.7);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16,185,129,.4);
}
.ydh-cc-btn.cc-loading {
  background: rgba(251,191,36,.12);
  border-color: rgba(251,191,36,.4);
  color: #fbbf24;
}

/* ── PIP TRANSCRIPT BODY ─────────────────────────────────────────────────── */
.ydh-pip-ts-body {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
  scroll-behavior: smooth;
}
.ydh-pip-ts-body::-webkit-scrollbar { width: 3px; }
.ydh-pip-ts-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.ydh-pip-ts-body .ydh-ts-seg { font-size: 0.73rem; padding: 4px 10px; line-height: 1.4; }
.ydh-pip-ts-body .ydh-ts-seg.active { border-left: 2px solid #d4af37; color: #ffe066; }

/* ── TRANSCRIPT WRAP ─────────────────────────────────────────────────────── */
.ydh-transcript-wrap {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  animation: ydh-scope-slide 0.25s ease;
}
.ydh-transcript-wrap.visible { display: flex; }

.ydh-transcript-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.ydh-transcript-icon { font-size: 14px; }
.ydh-transcript-label {
  font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,.8);
}
.ydh-transcript-lang-badge {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px; font-weight: 700;
  background: rgba(212,175,55,.2);
  color: var(--accent-gold,#ffd700);
  border: 1px solid rgba(212,175,55,.3);
  display: none;
}
.ydh-transcript-lang-badge.visible { display: inline; }
.ydh-transcript-hint {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255,255,255,.3);
  white-space: nowrap;
}

.ydh-transcript-body {
  height: 160px;
  overflow-y: auto;
  padding: 10px 12px;
  scroll-behavior: smooth;
}
.ydh-transcript-body::-webkit-scrollbar { width: 4px; }
.ydh-transcript-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.ydh-transcript-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  color: rgba(255,255,255,.4);
  font-size: 13px; gap: 8px;
}

/* Segment dòng phụ đề */
.ydh-ts-seg {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,.5);
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  cursor: default;
  border-left: 2px solid transparent;
}
.ydh-ts-seg.active {
  background: rgba(212,175,55,.1);
  color: rgba(255,255,255,.95);
  border-left-color: var(--accent-gold,#ffd700);
}
.ydh-ts-seg:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.7); }
.ydh-ts-time {
  font-size: 10px;
  color: rgba(255,255,255,.25);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ydh-ts-time:hover { color: var(--accent-gold,#ffd700); }

/* ── CHINESE WORD SPANS ──────────────────────────────────────────────────── */
.ydh-zh { cursor: pointer; border-radius: 2px; transition: background .12s, color .12s; }
.ydh-zh:hover {
  background: rgba(212,175,55,.25);
  color: #ffd700;
  outline: 1px solid rgba(212,175,55,.4);
}
.ydh-zh.hovered { background: rgba(212,175,55,.35); color: #ffe066; }

/* Word lookup popup */
#ydh-word-popup {
  position: fixed;
  z-index: 99999;
  background: linear-gradient(135deg, #1e1b38, #161228);
  border: 1px solid rgba(212,175,55,.35);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 140px;
  max-width: 220px;
  box-shadow: 0 8px 28px rgba(0,0,0,.55);
  pointer-events: auto;
  animation: ydh-popup-in .15s ease;
}
@keyframes ydh-popup-in {
  from { opacity: 0; transform: translateY(4px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#ydh-word-popup .ydh-wp-hanzi {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 2px;
}
#ydh-word-popup .ydh-wp-pinyin {
  font-size: 12px;
  color: #fbbf24;
  margin-bottom: 6px;
  min-height: 16px;
}
#ydh-word-popup .ydh-wp-lookup {
  display: inline-block;
  padding: 5px 12px;
  background: linear-gradient(135deg, var(--primary-red,#c0392b), #a93226);
  color: #fff;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: center;
  transition: opacity .15s;
}
#ydh-word-popup .ydh-wp-lookup:hover { opacity: .85; }
#ydh-word-popup .ydh-wp-lookup:active { transform: scale(.96); }
