/* YouTube Android APK Official Dark Theme Tokens */
:root {
  --yt-bg: #0f0f0f;
  --yt-bg-elevated: #212121;
  --yt-surface: #272727;
  --yt-surface-hover: #3f3f3f;
  --yt-red: #ff0033;
  --yt-red-classic: #ff0000;
  --yt-text: #f1f1f1;
  --yt-text-secondary: #aaaaaa;
  --yt-text-muted: #717171;
  --yt-divider: rgba(255, 255, 255, 0.1);
  --yt-chip-active-bg: #f1f1f1;
  --yt-chip-active-fg: #0f0f0f;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background-color: var(--yt-bg);
  color: var(--yt-text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 56px);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--yt-divider);
}

.header-top {
  height: 50px;
  padding: 0 12px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-btn {
  background: transparent;
  border: none;
  padding: 4px 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.brand-wordmark {
  height: 21px;
  width: auto;
  display: block;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-icon-btn {
  background: transparent;
  border: none;
  color: var(--yt-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.yt-icon-btn:active {
  background: var(--yt-surface);
}

/* Search Bar Row */
.search-bar-row {
  height: 52px;
  padding: 6px 10px 6px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--yt-bg);
}

.search-bar-row[hidden] {
  display: none;
}

.search-container {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  background: var(--yt-bg-elevated);
  border-radius: 18px;
  padding: 0 6px 0 14px;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--yt-text);
  font-size: 15px;
  font-family: inherit;
  user-select: auto;
}

.search-input::placeholder {
  color: var(--yt-text-secondary);
}

.search-clear-btn,
.search-submit-btn {
  width: 32px;
  height: 32px;
  color: var(--yt-text-secondary);
}

.search-clear-btn[hidden] {
  display: none;
}

/* Category Chips */
.chips-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px 12px 10px 12px;
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  height: 32px;
  padding: 0 12px;
  background: var(--yt-surface);
  border: none;
  border-radius: 8px;
  color: var(--yt-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chip:active {
  background: var(--yt-surface-hover);
}

.chip.active {
  background: var(--yt-chip-active-bg);
  color: var(--yt-chip-active-fg);
  font-weight: 600;
}

/* Video Feed Grid */
.feed-container {
  padding: 16px 16px calc(72px + var(--safe-bottom)) 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px 16px;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 640px) {
  .feed-container {
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 0 calc(68px + var(--safe-bottom)) 0;
    gap: 8px;
  }
}

.video-card {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.video-card:active .thumb-wrapper {
  opacity: 0.9;
}

.thumb-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  background: #000;
  overflow: hidden;
  border-radius: 12px;
}

@media (max-width: 640px) {
  .thumb-wrapper {
    border-radius: 0;
  }
}

.thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.duration-badge.live {
  background: var(--yt-red);
  color: #fff;
  font-weight: 600;
}

.video-meta {
  padding: 10px 4px 4px 4px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

@media (max-width: 640px) {
  .video-meta {
    padding: 12px 12px 14px 12px;
  }
}

.channel-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.channel-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.video-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.32;
  color: var(--yt-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-subline {
  font-size: 12px;
  color: var(--yt-text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-more-btn {
  background: transparent;
  border: none;
  color: var(--yt-text);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: -2px;
  margin-right: -4px;
  opacity: 0.85;
}

/* Watch Screen / Player Modal */
.player-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--yt-bg);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding-top: var(--safe-top);
}

.player-modal.open {
  transform: translateY(0);
}

.video-viewport {
  position: sticky;
  top: 0;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  background: #000;
  z-index: 20;
  flex-shrink: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
}

@media (min-width: 768px) {
  .video-viewport {
    height: 56vh;
    max-height: 540px;
    padding-bottom: 0;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .video-viewport {
    height: 62vh;
    padding-bottom: 0;
  }
}

.player-overlay-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.player-overlay-btn:active {
  background: rgba(0, 0, 0, 0.8);
}

.video-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  object-fit: contain;
}

.player-details {
  padding: 12px 14px calc(24px + var(--safe-bottom)) 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--yt-text);
}

.player-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.player-stats-line {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.player-status-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-mode-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--yt-surface);
  color: var(--yt-text-secondary);
}

.player-mode-badge.direct {
  background: rgba(255, 255, 255, 0.12);
  color: var(--yt-text);
}

.quality-select {
  background-color: var(--yt-surface);
  color: var(--yt-text);
  border: none;
  border-radius: 16px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.quality-select[hidden] {
  display: none;
}

/* Channel Row & Official Subscribe Pill */
.player-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--yt-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  flex-shrink: 0;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-text {
  min-width: 0;
}

.author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--yt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-subscribe {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  border: none;
  background: #f1f1f1;
  color: #0f0f0f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-subscribe:active {
  opacity: 0.85;
}

.btn-subscribe.subscribed {
  background: var(--yt-surface);
  color: var(--yt-text);
}

/* Horizontal Action Pills */
.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.player-actions::-webkit-scrollbar {
  display: none;
}

.yt-segmented-pill {
  height: 36px;
  background: var(--yt-surface);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.yt-seg-btn {
  height: 100%;
  background: transparent;
  border: none;
  color: var(--yt-text);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.yt-seg-btn.active {
  color: #fff;
  font-weight: 700;
}

.yt-seg-btn:active {
  background: var(--yt-surface-hover);
}

.yt-seg-divider {
  width: 1px;
  height: 20px;
  background: var(--yt-divider);
}

.yt-pill-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--yt-surface);
  border: none;
  color: var(--yt-text);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.yt-pill-btn:active {
  background: var(--yt-surface-hover);
}

.yt-pill-btn[hidden] {
  display: none;
}

.yt-fallback-btn {
  width: fit-content;
  background: var(--yt-red);
  color: #fff;
}

.related-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--yt-text);
  margin-top: 6px;
}

.related-feed {
  padding: 0 !important;
  margin-top: 2px;
}

@media (max-width: 640px) {
  .related-feed {
    width: calc(100% + 28px);
    max-width: none;
    margin-left: -14px;
    margin-right: -14px;
  }
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(52px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--yt-bg);
  border-top: 1px solid var(--yt-divider);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 180;
}

/* Home Feed Shorts Shelf */
.shorts-shelf {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 0 10px 0;
  border-top: 4px solid rgba(255, 255, 255, 0.08);
  border-bottom: 4px solid rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

@media (max-width: 640px) {
  .shorts-shelf {
    padding: 8px 12px 14px 12px;
  }
}

.shorts-shelf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.shorts-shelf-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.shorts-shelf-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--yt-text);
}

.shorts-shelf-scroll {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shorts-shelf-scroll::-webkit-scrollbar {
  display: none;
}

.short-shelf-card {
  width: 152px;
  height: 270px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #181818;
  cursor: pointer;
}

.short-shelf-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.short-shelf-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(0, 0, 0, 0.88) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px 8px;
  gap: 3px;
}

.short-shelf-card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.short-shelf-card-views {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
}

/* Full-Screen Vertical Shorts Player Modal */
.shorts-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(52px + var(--safe-bottom));
  z-index: 150;
  background: #000;
  display: none;
  flex-direction: column;
  padding-top: var(--safe-top);
}

.shorts-modal.open {
  display: flex;
}

.shorts-top-bar {
  position: absolute;
  top: var(--safe-top);
  left: 0;
  right: 0;
  height: 54px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  pointer-events: none;
}

.shorts-top-left,
.shorts-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.shorts-wordmark {
  height: 20px;
  width: auto;
  display: block;
}

.shorts-top-btn {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

.shorts-quality-select {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.shorts-track {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shorts-track::-webkit-scrollbar {
  display: none;
}

.short-slide {
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #0f0f0f;
}

.short-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

@media (min-width: 641px) {
  .short-frame {
    height: calc(100% - 16px);
    width: auto;
    aspect-ratio: 9 / 16;
    max-width: 440px;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  }
}

.short-poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.short-video-host {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.shorts-video-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.short-tap-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: pointer;
}

.short-status-pill {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.short-status-pill[hidden] {
  display: none;
}

.short-info-overlay {
  position: absolute;
  left: 12px;
  right: 76px;
  bottom: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.short-gradient-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.78) 100%);
  z-index: 4;
  pointer-events: none;
}

.short-channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.short-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.short-channel-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.short-sub-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  border: none;
  background: #f1f1f1;
  color: #0f0f0f;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.short-sub-btn.subscribed {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.short-title {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.short-actions-rail {
  position: absolute;
  right: 10px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.short-action-btn {
  background: transparent;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.short-action-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
}

.short-action-btn.active .short-action-circle {
  background: rgba(255, 255, 255, 0.24);
}

.shorts-nav-arrows {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 641px) {
  .shorts-nav-arrows {
    display: flex;
  }
}

.shorts-arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--yt-surface);
  color: var(--yt-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.shorts-arrow-btn:hover {
  background: var(--yt-surface-hover);
}

/* YouTube "Tú" (You) Hub View */
.you-view {
  padding: 12px 14px calc(76px + var(--safe-bottom)) 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.you-view[hidden] {
  display: none;
}

.you-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.you-profile-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.you-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--yt-surface);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.you-profile-text {
  min-width: 0;
}

.you-display-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--yt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.you-handle-line {
  font-size: 13px;
  color: var(--yt-text-secondary);
  margin-top: 2px;
}

.you-pills-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.you-pills-strip::-webkit-scrollbar {
  display: none;
}

.you-guest-card {
  background: var(--yt-bg-elevated);
  border: 1px solid var(--yt-divider);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.you-guest-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--yt-text);
}

.you-guest-desc {
  font-size: 13px;
  color: var(--yt-text-secondary);
  line-height: 1.45;
}

.you-guest-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.you-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.you-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.you-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--yt-text);
}

.you-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.you-outline-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--yt-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.you-hscroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.you-hscroll::-webkit-scrollbar {
  display: none;
}

.you-mini-card {
  width: 156px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.you-mini-thumb {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
}

.you-mini-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.you-mini-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--yt-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.you-mini-sub {
  font-size: 11px;
  color: var(--yt-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.you-playlist-stack {
  width: 156px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.you-playlist-cover {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  background: #212121;
  border-top: 3px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.you-playlist-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.you-playlist-count {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.you-menu-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--yt-divider);
  padding-top: 8px;
}

.you-menu-row {
  background: transparent;
  border: none;
  color: var(--yt-text);
  padding: 12px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.you-menu-row-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.you-menu-row-sub {
  font-size: 13px;
  color: var(--yt-text-secondary);
}

/* Modals (Auth, Settings, Playlist Picker) */
.yt-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.yt-dialog-backdrop[hidden] {
  display: none;
}

.yt-dialog-card {
  width: 100%;
  max-width: 400px;
  background: var(--yt-bg-elevated);
  border: 1px solid var(--yt-divider);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}

.yt-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.yt-dialog-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--yt-text);
}

.yt-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--yt-bg);
  padding: 4px;
  border-radius: 10px;
}

.yt-auth-tab {
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--yt-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.yt-auth-tab.active {
  background: var(--yt-surface);
  color: var(--yt-text);
}

.yt-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yt-field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--yt-text-secondary);
}

.yt-input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--yt-divider);
  background: var(--yt-bg);
  color: var(--yt-text);
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  user-select: auto;
}

.yt-input:focus {
  border-color: #f1f1f1;
}

.yt-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.yt-color-dots {
  display: flex;
  gap: 6px;
}

.yt-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.yt-color-dot.active {
  border-color: #fff;
  transform: scale(1.1);
}

.yt-form-error {
  font-size: 12px;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
  padding: 8px 10px;
  border-radius: 8px;
}

.yt-form-error[hidden] {
  display: none;
}

.yt-primary-submit {
  height: 40px;
  border-radius: 20px;
  border: none;
  background: #f1f1f1;
  color: #0f0f0f;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.yt-form-hint {
  font-size: 11px;
  color: var(--yt-text-secondary);
  line-height: 1.4;
}

.yt-devices-info {
  font-size: 12px;
  color: var(--yt-text-secondary);
  margin-top: 8px;
}

.yt-settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--yt-divider);
  padding-top: 10px;
}

.yt-settings-actions[hidden] {
  display: none;
}

.yt-setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  cursor: pointer;
}

.yt-setting-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.yt-setting-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--yt-text);
}

.yt-setting-sub {
  font-size: 11px;
  line-height: 1.35;
  color: var(--yt-text-secondary);
}

.yt-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.yt-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.yt-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.2s ease;
}

.yt-switch-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.yt-switch input:checked + .yt-switch-slider {
  background: #3ea6ff;
}

.yt-switch input:checked + .yt-switch-slider::before {
  transform: translateX(18px);
}

.yt-playlist-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.yt-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--yt-surface);
  border: none;
  border-radius: 10px;
  color: var(--yt-text);
  font-size: 14px;
  cursor: pointer;
}

.yt-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.yt-pill-btn.active {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 600;
}

.nav-item {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--yt-text);
  font-size: 10px;
  font-weight: 400;
  padding: 4px 2px;
  cursor: pointer;
}

.nav-icon-wrap {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .icon-fill {
  display: none;
}

.nav-item.active .icon-outline {
  display: none;
}

.nav-item.active .icon-fill {
  display: block;
}

.nav-item.active .nav-label {
  font-weight: 600;
}

/* Channels Bar (Subscriptions view) */
.channels-bar {
  padding: 10px 12px 6px 12px;
  background: var(--yt-bg);
  border-bottom: 1px solid var(--yt-divider);
}

.channels-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.channels-scroll::-webkit-scrollbar {
  display: none;
}

.channel-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 60px;
}

.channel-bubble-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--yt-surface);
  border: 2px solid transparent;
}

.channel-bubble.active .channel-bubble-avatar {
  border-color: #f1f1f1;
}

.channel-bubble-name {
  font-size: 11px;
  color: var(--yt-text-secondary);
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* History Bar */
.history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--yt-bg);
  border-bottom: 1px solid var(--yt-divider);
}

.history-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--yt-text);
}

/* Spinner */
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--yt-text);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 48px auto;
  grid-column: 1 / -1;
}

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

/* iOS Install Banner */
.ios-banner {
  background: var(--yt-bg-elevated);
  border-bottom: 1px solid var(--yt-divider);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ios-banner-text {
  font-size: 12px;
  line-height: 1.4;
  color: var(--yt-text-secondary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}


/* Custom YouTube Touch Player Controls */
.player-controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  touch-action: none;
  overscroll-behavior: contain;
}

.player-controls-overlay.is-controls-visible {
  opacity: 1;
  pointer-events: auto;
}

.player-controls-overlay.iframe-mode {
  background: transparent;
  pointer-events: none;
  opacity: 1;
}

.player-controls-overlay.iframe-mode .player-center-play,
.player-controls-overlay.iframe-mode .player-controls-bottom,
.player-controls-overlay.iframe-mode .player-controls-top-right {
  display: none;
}

.player-controls-overlay.iframe-mode .player-close-btn {
  pointer-events: auto;
}

.player-controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
}

.player-controls-top .player-overlay-btn {
  position: static;
}

.player-controls-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-top-toggle {
  background: rgba(0, 0, 0, 0.45);
  border: none;
  border-radius: 14px;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.autoplay-track {
  width: 28px;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.35);
  position: relative;
  display: block;
}

.autoplay-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #aaa;
  position: absolute;
  top: -1px;
  left: 0;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.player-top-toggle.active .autoplay-track {
  background: rgba(255, 255, 255, 0.6);
}

.player-top-toggle.active .autoplay-knob {
  transform: translateX(12px);
  background: #fff;
}

.player-center-row {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.player-center-step {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.player-center-step:active {
  transform: scale(0.92);
}

.player-center-step:disabled {
  opacity: 0.35;
  cursor: default;
}

.player-center-play {
  align-self: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.56);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.player-seek-ripple {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 16px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  z-index: 28;
}

.player-seek-ripple.left { left: 16%; }
.player-seek-ripple.right { right: 16%; }

.player-controls-bottom {
  padding: 0 10px 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-time-text {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-bottom-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-controls-bottom .player-fs-btn,
.player-controls-bottom .player-pip-btn {
  position: static;
  width: 30px;
  height: 30px;
}

.player-controls-bottom .player-pip-btn.active {
  color: #3ea6ff;
}

.player-progress-wrap {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.player-progress-bg {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.player-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.5);
}

.player-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--yt-red);
}

.player-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--yt-red);
  pointer-events: none;
}

/* Watch Title & Description Trigger */
.player-title-btn {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.player-more-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--yt-text);
  margin-left: 6px;
}

/* Comments Preview Card inside Watch */
.watch-comments-card {
  background: var(--yt-bg-elevated);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

.watch-comments-card:active {
  background: var(--yt-surface);
}

.watch-comments-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-comments-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--yt-text);
}

.watch-comments-count {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.watch-comments-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--yt-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.comment-mini-text {
  font-size: 13px;
  line-height: 1.3;
  color: var(--yt-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Floating Miniplayer Bar (YouTube Mobile: 56px tall above bottom-nav) */
.miniplayer-bar {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(56px + var(--safe-bottom));
  height: 56px;
  background: var(--yt-bg-elevated);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.7);
  z-index: 185;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.miniplayer-bar[hidden] {
  display: none;
}

.mini-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.16);
  z-index: 3;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yt-red);
}

.mini-video-slot {
  width: 100px;
  height: 56px;
  background: #000;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.mini-video-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-meta {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-channel {
  font-size: 11px;
  color: var(--yt-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-ctrl-btn {
  width: 40px;
  height: 44px;
}

/* Bottom Sheets (Settings, Comments, Description, Card Menu) */
.yt-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 320;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.yt-sheet-backdrop[hidden] {
  display: none;
}

.yt-sheet-card {
  width: 100%;
  max-width: 560px;
  background: var(--yt-bg-elevated);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 8px 16px calc(18px + var(--safe-bottom)) 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 75vh;
  overflow-y: auto;
}

.yt-sheet-tall {
  max-height: 78vh;
}

.yt-sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  align-self: center;
  margin-bottom: 2px;
}

.yt-sheet-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--yt-text-secondary);
}

.yt-sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yt-sheet-action-row {
  background: transparent;
  border: none;
  color: var(--yt-text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  padding: 12px 4px;
  cursor: pointer;
  border-radius: 8px;
}

.yt-sheet-action-row:active {
  background: var(--yt-surface);
}

.card-menu-header {
  font-size: 13px;
  color: var(--yt-text-secondary);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--yt-divider);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--yt-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.comment-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comment-meta {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.comment-author.creator {
  background: var(--yt-surface);
  color: var(--yt-text);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.comment-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--yt-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-stats {
  font-size: 11px;
  color: var(--yt-text-secondary);
  margin-top: 2px;
}

.desc-title-block {
  font-size: 16px;
  font-weight: 700;
  color: var(--yt-text);
  line-height: 1.3;
}

.desc-stats-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.desc-stat-pill {
  background: var(--yt-surface);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--yt-text);
}

.desc-chapters-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.desc-chapter-btn {
  background: var(--yt-surface);
  border: none;
  border-radius: 8px;
  color: var(--yt-text);
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  flex-shrink: 0;
  cursor: pointer;
}

.desc-body-text {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--yt-text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Channel View */
.channel-view {
  padding-bottom: 12px;
}

.channel-view[hidden] {
  display: none;
}

.channel-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--yt-divider);
}

.channel-banner {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
  background: var(--yt-surface);
}

.channel-header-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.channel-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.channel-big-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--yt-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Shorts thin bottom red progress line */
.shorts-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 25;
  pointer-events: none;
}

.shorts-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yt-red);
}

/* ApexStream Download Dialog */
.dl-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 85vh;
}

.dl-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--yt-bg);
  padding: 4px;
  border-radius: 12px;
}

.dl-type-tab {
  height: 36px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--yt-text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.dl-type-tab.active {
  background: #f1f1f1;
  color: #0f0f0f;
}

.dl-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.dl-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--yt-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--yt-text);
  text-align: left;
  cursor: pointer;
}

.dl-option-row.active {
  border-color: #3ea6ff;
  background: rgba(62, 166, 255, 0.12);
}

.dl-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dl-option-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--yt-text);
}

.dl-option-sub {
  font-size: 11px;
  color: var(--yt-text-secondary);
}

.dl-option-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dl-option-size {
  font-size: 12px;
  font-weight: 600;
  color: var(--yt-text-secondary);
}

.dl-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--yt-text-secondary);
  position: relative;
}

.dl-option-row.active .dl-radio-dot {
  border-color: #3ea6ff;
}

.dl-option-row.active .dl-radio-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #3ea6ff;
}

/* Cast Modal (YouTube TV / DIAL / AirPlay) */
#btnRefresh.cast-active,
#btnPlayerCast.cast-active {
  color: #3ea6ff;
}

.cast-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cast-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--yt-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cast-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 170px;
  overflow-y: auto;
}

.cast-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--yt-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--yt-text);
}

.cast-device-row.active {
  border-color: #3ea6ff;
  background: rgba(62, 166, 255, 0.12);
}

.cast-device-btn {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
}

.cast-device-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-device-sub {
  font-size: 11px;
  color: var(--yt-text-secondary);
}

.cast-remote-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(62, 166, 255, 0.12);
  border: 1px solid rgba(62, 166, 255, 0.35);
}

.cast-remote-bar[hidden] {
  display: none;
}

.cast-remote-btns {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
}

.cast-viewport-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.cast-viewport-overlay[hidden] {
  display: none;
}

.player-controls-overlay.cast-mode.is-controls-visible {
  pointer-events: none;
}

.player-controls-overlay.cast-mode.is-controls-visible .player-controls-top,
.player-controls-overlay.cast-mode.is-controls-visible .player-center-row,
.player-controls-overlay.cast-mode.is-controls-visible .player-controls-bottom {
  pointer-events: auto;
}

.cast-vp-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.45);
}

.cast-vp-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.72) 100%);
}

.cast-vp-info {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 56px 38px;
  text-align: center;
}

.cast-vp-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 15, 15, 0.82);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(62, 166, 255, 0.55);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cast-vp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff0000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 1.5px solid #0f0f0f;
  pointer-events: none;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 2px;
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  border: none;
  color: #f1f1f1;
  width: 100%;
}

.notif-item.unread {
  background: rgba(62, 166, 255, 0.12);
}

.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ea6ff;
  flex-shrink: 0;
}

.notif-dot.read {
  visibility: hidden;
}

.notif-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item.unread .notif-title {
  font-weight: 700;
}

.notif-sub {
  font-size: 11px;
  color: var(--yt-text-secondary);
  margin-top: 3px;
}

.notif-thumb {
  width: 72px;
  height: 41px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #202020;
}
