:root {
  --yt-bg: #0f0f0f;
  --yt-card: #212121;
  --yt-text: #f1f1f1;
  --yt-muted: #aaaaaa;
  --yt-red: #ff0000;
  --yt-border: rgba(255, 255, 255, 0.08);
  --font-family: 'Roboto', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--yt-bg);
  color: var(--yt-text);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

.youtube-app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--yt-bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Adjust padding on mobile viewports so content sits flush on small screens */
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  .youtube-app {
    box-shadow: none;
    min-height: 100vh;
  }
}

/* Header Bar styling */
.yt-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--yt-border);
}

.yt-logo-container {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.yt-logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.yt-utilities {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.util-icon {
  font-size: 20px;
  color: var(--yt-text);
  cursor: pointer;
}

/* YouTube Style Sign In Button */
.yt-signin-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #3ea6ff; /* YouTube signature blue color */
  border-radius: 100px;
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.78rem;
  font-family: var(--font-family);
  transition: background-color 0.2s ease;
}

.yt-signin-btn:hover {
  background-color: rgba(62, 166, 255, 0.1);
  border-color: transparent;
}

.signin-icon {
  font-size: 18px !important;
}


/* Ambient Backglow Wrapper */
.player-ambient-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden; /* Prevents ambient glow blur filter from expanding layout width */
}

.ambient-glow-layer {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 50%, transparent 70%);
  filter: blur(40px);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

.ambient-glow-layer.active {
  opacity: 1;
  animation: pulseGlow 8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
  0% { transform: scale(1); filter: blur(40px); }
  50% { transform: scale(1.05); filter: blur(50px); }
  100% { transform: scale(0.95); filter: blur(35px); }
}

/* Video Player Container */
.yt-player-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* Thumbnail Play screen */
.thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.blurred-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #22222b 0%, #0d0d12 100%);
  filter: blur(10px);
  z-index: 1;
}

.play-btn-circle {
  width: 56px;
  height: 56px;
  background-color: rgba(0, 0, 0, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
}

.yt-player-container:hover .play-btn-circle {
  transform: scale(1.08);
  background-color: var(--yt-red);
}

.play-icon-symbol {
  font-size: 32px;
  color: #fff;
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-weight: 500;
  z-index: 2;
}

/* Video Playback Screen */
.playback-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0b0b0d;
  z-index: 5;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Video Grain / Static overlays */
.static-noise-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 0);
  background-size: 8px 8px;
  z-index: 2;
  animation: jitterNoise 0.4s steps(4) infinite;
  pointer-events: none;
}

@keyframes jitterNoise {
  0% { background-position: 0 0; }
  25% { background-position: 2px 4px; }
  50% { background-position: -1px -3px; }
  75% { background-position: 4px 1px; }
  100% { background-position: 0 0; }
}

.scanlines-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.08;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 6px 100%;
  z-index: 3;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(255, 255, 255, 0.15);
  border-left-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 4;
}

.playback-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 5;
}

/* Progress bar slider */
.progress-bar {
  width: 100%;
  height: 3px;
  background-color: rgba(255, 255, 255, 0.2);
  position: relative;
  display: flex;
  align-items: center;
  transition: height 0.1s ease;
}

.yt-player-container:hover .progress-bar {
  height: 5px;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background-color: var(--yt-red);
}

.playhead-knob {
  position: absolute;
  left: 0;
  width: 10px;
  height: 10px;
  background-color: var(--yt-red);
  border-radius: 50%;
  transform: translateX(-50%);
  display: none;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

.yt-player-container:hover .playhead-knob {
  display: block;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.control-status-icon {
  font-size: 18px;
  color: #fff;
}

.time-stamp {
  font-size: 0.75rem;
  color: #fff;
  font-weight: 500;
}

/* Details and Info panel styling */
.yt-content-details {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.video-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--yt-text);
  padding: 0.2rem 0;
}

.channel-info-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
}

.avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-meta {
  display: flex;
  flex-direction: column;
}

.channel-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.subs-count {
  font-size: 0.75rem;
  color: var(--yt-muted);
}

.sub-btn {
  margin-left: auto;
  background-color: var(--yt-text);
  color: var(--yt-bg);
  border: none;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.5rem 1.1rem;
  border-radius: 100px;
  cursor: pointer;
}

/* Action scrolls */
.actions-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

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

.action-item {
  background-color: var(--yt-card);
  padding: 0.45rem 0.9rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.action-item .material-symbols-rounded {
  font-size: 18px;
  vertical-align: middle;
}

/* Description Details */
.desc-card {
  background-color: var(--yt-card);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.desc-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.desc-body {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #e4e4e7;
}

/* Comments Drawer Preview styling */
.yt-comments-preview {
  background-color: var(--yt-card);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
}

.comments-header {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.comments-header .count {
  color: var(--yt-muted);
  font-weight: 400;
}

.comment-preview-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.comment-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #3b82f6);
}

.comment-body-text {
  font-size: 0.78rem;
  color: #f1f1f1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 85%;
}

/* Up Next Section list */
.up-next-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
  border-top: 1px solid var(--yt-border);
  padding-top: 1rem;
}

.up-next-section h2 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--yt-muted);
  letter-spacing: 0.05em;
}

.up-next-card {
  display: flex;
  gap: 0.8rem;
  cursor: pointer;
}

.card-thumb {
  width: 140px;
  height: 80px;
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.card-thumb.card-1 {
  background: linear-gradient(135deg, #374151, #1f2937);
}

.card-thumb.card-2 {
  background: linear-gradient(135deg, #4b5563, #111827);
}

.card-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  font-weight: 500;
}

.card-meta-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-meta-details h3 {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--yt-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-channel {
  font-size: 0.72rem;
  color: var(--yt-muted);
}

.card-views {
  font-size: 0.72rem;
  color: var(--yt-muted);
}

/* Custom CSS-Constructed Video Thumbnails */
.thumbnail-graphic {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #180808 0%, #090303 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  z-index: 1;
  border: 2px solid #ef4444;
}

.warning-sign {
  font-size: 32px !important;
  color: #ef4444;
  animation: flashWarning 1.5s infinite alternate ease-in-out;
}

@keyframes flashWarning {
  from { opacity: 0.4; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.05); }
}

.graphic-title {
  font-family: var(--font-family);
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05em;
  text-align: center;
}

.graphic-sub {
  font-size: 0.7rem;
  color: var(--yt-muted);
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* Waveform simulation bars */
.waveform-mock {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 24px;
}

.waveform-mock .bar {
  width: 3px;
  height: 100%;
  background-color: #ef4444;
  border-radius: 100px;
  animation: bounceBar 1.2s infinite ease-in-out alternate;
}

.waveform-mock .bar:nth-child(2) { height: 60%; animation-delay: -0.4s; }
.waveform-mock .bar:nth-child(3) { height: 80%; animation-delay: -0.8s; }
.waveform-mock .bar:nth-child(4) { height: 40%; animation-delay: -0.2s; }
.waveform-mock .bar:nth-child(5) { height: 90%; animation-delay: -0.6s; }

@keyframes bounceBar {
  from { transform: scaleY(0.3); }
  to { transform: scaleY(1.1); }
}

/* Playback Waveform Container centering details */
.playback-waveform-container {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 4;
}

.playback-waveform-container .waveform-mock {
  height: 36px;
  gap: 6px;
}

.playback-waveform-container .waveform-mock .bar {
  width: 4px;
  background-color: #3ea6ff; /* Match active play blue color context */
  box-shadow: 0 0 10px rgba(62, 166, 255, 0.4);
}

.waveform-label {
  font-size: 0.65rem;
  color: var(--yt-muted);
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Custom Subtitles Overlay styling (Volume Bait) */
.yt-subtitles {
  position: absolute;
  bottom: 40px; /* Shift to bottom center mimicking YouTube CC */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  text-align: center;
  z-index: 4;
  pointer-events: none;
}

#subtitles-text {
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Red Viewport Flash Alert screamer animation */
.screamer-flash {
  animation: flashRedBorder 0.6s ease-out;
}

@keyframes flashRedBorder {
  0% { background-color: #ef4444; }
  100% { background-color: #0b0b0d; }
}



/* Up-next Card Thumbnail Inner Text Overlay */
.thumb-inner-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.65);
  border-radius: 8px;
}

.inner-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.05em;
}

.inner-sub {
  font-size: 0.52rem;
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

/* YouTube Style Slide-up Toast Notification */
.yt-toast {
  position: fixed;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #212121;
  color: #f1f1f1;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.yt-toast.visible {
  bottom: 24px;
  opacity: 1;
}


