/* Reset + base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #fff;
  color: #0f0f10;
  min-height: 100vh;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { border: none; outline: 0; background: transparent; cursor: pointer; font: inherit; color: inherit; }

/* Layout */
.page {
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
@media (max-width: 480px) {
  .page { padding: 0 0 40px; }
}

/* Player wrapper */
.player-wrap { width: 100%; }
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}
@media (max-width: 480px) { .player { border-radius: 0; } }

.player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
  pointer-events: none; /* clicks bubble to overlay */
}

/* Big play overlay (initial state) */
.player .start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 3;
  transition: opacity 0.25s ease;
}
.player .start-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../img/poster.jpg");
  background-size: cover;
  background-position: center;
  z-index: -1;
}
.player .start-overlay .play-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}
.player .start-overlay:hover .play-btn { transform: scale(1.06); }
.player .start-overlay .play-btn svg { width: 36px; height: 36px; fill: #1890ff; margin-left: 5px; }
@media (max-width: 480px) {
  .player .start-overlay .play-btn { width: 64px; height: 64px; }
  .player .start-overlay .play-btn svg { width: 26px; height: 26px; }
}
.player.is-playing .start-overlay,
.player.is-paused .start-overlay,
.player.is-muted-autoplay .start-overlay { display: none; }

/* Unmute overlay — shown during muted autoplay until first gesture */
.player .unmute-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.32);
  z-index: 4;
  cursor: pointer;
  transition: opacity 0.25s ease;
}
.player .unmute-overlay[hidden] { display: none; }
.player .unmute-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  user-select: none;
  animation: unmute-pulse 2.6s ease-in-out infinite;
}
.player .unmute-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
}
.player .unmute-icon svg { width: 22px; height: 22px; }
@media (max-width: 480px) {
  .player .unmute-card { font-size: 14px; padding: 12px 18px; gap: 10px; }
}
@keyframes unmute-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* Pause click-catcher (covers video so clicks toggle pause but seeking is impossible) */
.player .click-catcher {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}
.player.is-paused .click-catcher::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: block;
}
.player.is-paused .click-catcher::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231890ff'><polygon points='8,5 19,12 8,19'/></svg>");
  background-repeat: no-repeat;
  background-position: 56% 50%;
  background-size: 36px 36px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 1;
}
@media (max-width: 480px) {
  .player.is-paused .click-catcher::before { width: 64px; height: 64px; background-size: 26px 26px; }
}

/* Bottom progress strip — read-only, no seek */
.player .progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 6px;
  background: rgba(0, 0, 0, 0.45);
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.08);
}
.player .progress .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff7a00 0%, #ffae3d 100%);
  box-shadow: 0 0 6px rgba(255, 138, 0, 0.55);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Resume overlay — shown when user returns within 7 days */
.player .resume-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #1849b8;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 36px;
  user-select: none;
}
.player .resume-overlay[hidden] { display: none; }
.player .resume-title {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.2px;
}
.player .resume-actions {
  display: flex;
  align-items: center;
  gap: 56px;
  flex-wrap: wrap;
  justify-content: center;
}
.player .resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 18px 10px 10px;
  border-radius: 999px;
  transition: background 0.18s ease, transform 0.15s ease;
}
.player .resume-btn:hover { background: rgba(255, 255, 255, 0.12); }
.player .resume-btn:active { transform: scale(0.98); }
.player .resume-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.player .resume-icon svg { width: 20px; height: 20px; color: #fff; }
.player .resume-btn[data-action="keep"] .resume-icon svg { margin-left: 3px; }
@media (max-width: 600px) {
  .player .resume-title { font-size: 22px; }
  .player .resume-actions { gap: 18px; flex-direction: column; }
  .player .resume-btn { font-size: 17px; }
  .player .resume-icon { width: 36px; height: 36px; }
  .player .resume-icon svg { width: 16px; height: 16px; }
}

/* Loading spinner */
.player.is-buffering .spinner { display: block; }
.player .spinner {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 4;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Title under video */
.video-title {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.4;
  margin: 18px 0 0;
  padding: 0 4px;
}
@media (max-width: 480px) {
  .video-title { font-size: 18px; line-height: 1.34; padding: 0 12px; margin-top: 12px; }
}

/* Channel row: avatar, name, views */
.channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  padding: 0 4px;
}
@media (max-width: 480px) { .channel-row { padding: 0 12px; } }
.channel-row .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.channel-row .name { font-weight: 700; font-size: 16px; }
.channel-row .views { font-size: 14px; color: #606060; font-weight: 400; margin-left: 12px; }
@media (max-width: 480px) { .channel-row .views { margin-left: 6px; font-size: 12px; } }

/* Action row */
.action-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
  padding: 0 4px;
}
@media (max-width: 480px) {
  .action-row { padding: 0 12px; justify-content: space-around; gap: 6px; }
}
.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e6e6e6;
  border-radius: 64px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
}
.action-pill svg { width: 14px; height: 14px; }
.action-pill.split > .left {
  display: inline-flex; align-items: center; gap: 4px;
  padding-right: 8px;
  border-right: 1px solid #836b6b;
}
.action-pill.split > .right {
  display: inline-flex; align-items: center;
  padding-left: 6px;
}
.action-pill .flip { transform: rotate(180deg); display: inline-block; }
.action-pill img { width: 24px; height: auto; max-height: 24px; }

/* CTA button — hidden by default, revealed when video ends */
.cta-wrap { padding: 0 4px; }
@media (max-width: 480px) { .cta-wrap { padding: 0 12px; } }
.cta {
  display: none;
  margin: 16px auto;
  width: 100%;
  max-width: 520px;
  background: #1890ff;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  padding: 14px 18px;
  border-radius: 16px;
  text-decoration: none;
  transition: background 0.25s ease;
  animation: pulse 3s infinite linear;
}
.cta:hover { background: #0e6cc5; }
.cta.is-revealed { display: block; }

/* Sticky bottom-of-viewport CTA — appears with main CTA, hides when main is in view */
.sticky-cta {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translateY(140%);
  width: calc(100% - 24px);
  max-width: 520px;
  background: #1890ff;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  padding: 14px 18px;
  border-radius: 16px;
  text-decoration: none;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
  display: none;
}
.sticky-cta.is-revealed {
  display: block;
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  animation: sticky-pulse 3s infinite ease-in-out;
}
.sticky-cta.is-revealed.is-near-main {
  transform: translateX(-50%) translateY(140%);
  opacity: 0;
  pointer-events: none;
  animation: none;
}
@keyframes sticky-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.05); }
  50%      { box-shadow: 0 10px 32px rgba(24, 144, 255, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08); }
}
.sticky-cta:hover { background: #0e6cc5; }
@media (max-width: 480px) {
  .sticky-cta { font-size: 15px; padding: 13px 16px; bottom: 10px; }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.92; }
  100% { transform: scale(1); opacity: 1; }
}

/* Comments */
.comments-header {
  font-size: 16px;
  font-weight: 600;
  margin: 28px 0 12px;
  padding: 0 4px;
}
@media (max-width: 480px) { .comments-header { padding: 0 12px; } }

/* Comment spacing — matches YouTube mobile exactly:
   thread gap 16px, avatar 36px, author 13/18, text 14/20, actions h36 mt4 */
.comments { display: flex; flex-direction: column; gap: 16px; padding: 0 4px; }
@media (max-width: 480px) { .comments { padding: 0 12px; } }

.comment-block { display: flex; flex-direction: column; gap: 16px; }
.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: Roboto, Arial, sans-serif;
}
.comment-row .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.comment-row.parent .avatar { width: 36px; height: 36px; }
.comment-row .body { flex: 1; min-width: 0; }
.comment-row .meta {
  font-size: 13px;
  line-height: 18px;
  color: #606060;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.comment-row .meta .user { color: #0f0f10; font-weight: 500; }
.comment-row .text {
  margin-top: 0;
  font-size: 14px;
  line-height: 20px;
  color: #0f0f10;
  word-break: break-word;
}
.comment-row .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  height: 36px;
}
.comment-row .actions .like,
.comment-row .actions .dislike {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #606060;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 999px;
}
.comment-row .actions .dislike svg { transform: rotate(180deg); }
.comment-row .actions .count { font-size: 12px; line-height: 1; }
.comment-row .actions .reply {
  font-size: 14px;
  font-weight: 500;
  color: #0f0f10;
  padding: 0 12px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  margin-left: 4px;
}
.comment-replies {
  padding-left: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* margin-top: 0 — .comment-block { gap: 16px } already spaces parent → replies */
}
@media (max-width: 480px) { .comment-replies { padding-left: 48px; } }
.comment-replies .comment-row .avatar { width: 24px; height: 24px; }

/* Footer */
.footer {
  margin-top: 48px;
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: #606060;
}
.footer .links { display: inline-flex; gap: 8px; margin-top: 8px; }
.footer a:hover { text-decoration: underline; }

/* Hide native controls fallback */
video::-webkit-media-controls,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-play-button,
video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
