/* ============================================================
   Watch — immersive entry viewer (app/watch.html)
   Mobile: a full-viewport snap stage (previous / current /
   next entry) followed by "More from this contest". The
   current slide carries the info overlay + action rail.
   Desktop: a centred 9:16 player, side panel, keyboard nav.
   ============================================================ */

.watch-stage { position: relative; }

/* fixed top chrome (back + contest link) above the viewer */
.watch-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 0;
  pointer-events: none;
}
.watch-top > * { pointer-events: auto; }
.watch-back {
  background: rgba(12, 8, 5, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.watch-contest-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(244, 239, 230, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(12, 8, 5, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s;
}
.watch-contest-link:hover { border-color: rgba(244, 176, 33, 0.5); color: var(--gold); }

/* ---------- snap viewer (mobile) ---------- */
.watch-viewer {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  outline: none;
}
.watch-viewer::-webkit-scrollbar { display: none; }

.watch-slide {
  --feed-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #050403;
}
.slide-media { position: absolute; inset: 0; }
.slide-ken {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.slide-video, .slide-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050403;
}
/* Controlled scrim: light at the top, a stronger bottom band so the
   overlay stays readable on bright and high-detail videos alike,
   without ever turning the video into a dark card. */
.watch-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(5, 4, 3, 0.5) 0%,
    rgba(5, 4, 3, 0) 20%,
    rgba(5, 4, 3, 0) 50%,
    rgba(5, 4, 3, 0.55) 76%,
    rgba(5, 4, 3, 0.86) 100%);
  pointer-events: none;
}

/* current slide: info + rail above the nav */
.watch-info {
  position: absolute;
  left: 16px;
  right: 86px;
  bottom: var(--feed-bottom);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.watch-participant { display: inline-flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; }
.watch-participant img {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 176, 33, 0.55);
  object-fit: cover;
  flex: none;
}
.wp-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.wp-city {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(244, 239, 230, 0.68);
}
.watch-title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.watch-desc {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(244, 239, 230, 0.8);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* hostile/long input robustness (stage #023 §10) */
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.watch-more {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  -webkit-tap-highlight-color: transparent;
}
.watch-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(244, 239, 230, 0.62);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.watch-stats svg { width: 11px; height: 11px; color: var(--gold); }

/* compact meta chips over the video — readable on any content */
.watch-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.watch-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(12, 8, 5, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(244, 239, 230, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.watch-meta-item svg { width: 11px; height: 11px; color: var(--gold); }

.watch-rail {
  position: absolute;
  right: 10px;
  bottom: var(--feed-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; }
.act-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(12, 8, 5, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s, background 0.2s, color 0.2s;
}
.act-circle svg { width: 21px; height: 21px; }
.act:active .act-circle { transform: scale(0.9); }
.act.vote.on .act-circle { background: rgba(244, 176, 33, 0.16); border-color: rgba(244, 176, 33, 0.7); color: var(--gold); }
.act.vote.on svg { fill: var(--gold); }
.act-count, .act-label { font-size: 12px; font-weight: 700; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.act.vote.pop .act-circle { animation: heart-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes heart-pop { 40% { transform: scale(1.18); } }
.act-profile { padding: 3px; margin-right: -3px; margin-bottom: -3px; }
.act-profile img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 176, 33, 0.6);
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* neighbour slides: a quiet peek label */
.watch-peek {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.watch-peek-name { font-size: 14px; font-weight: 700; }
.watch-peek-title { font-size: 12.5px; color: rgba(244, 239, 230, 0.7); }

/* ---------- related section (after the immersive part) ---------- */
.watch-related { padding: 22px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 26px); scroll-snap-align: none; }
.watch-related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ---------- "More" bottom sheet ---------- */
.watch-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 4, 3, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.watch-sheet-backdrop[hidden] { display: none; }
.watch-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 78dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px 24px;
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.watch-sheet-bar {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px auto 10px;
}
.watch-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.watch-sheet-entry { font-size: 17px; font-weight: 800; line-height: 1.3; margin-bottom: 8px; }
.watch-sheet-desc { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 16px; overflow-wrap: anywhere; word-break: break-word; max-height: 40dvh; overflow-y: auto; }
.watch-sheet-rows { display: flex; flex-direction: column; }
.watch-sheet-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--line);
}
.watch-sheet-rows span { color: var(--muted); font-weight: 600; }
.watch-sheet-rows b { font-weight: 700; }
.watch-sheet-rows a { color: var(--gold); font-weight: 700; }
body.sheet-open { overflow: hidden; }

/* ---------- desktop ---------- */
.watch-aside { display: none; }

/* #017B recomposition: the portrait stage fills the viewport height
   (it sizes its own 9:16 column), the aside is a related metadata +
   action panel vertically centred against it — not a phone floating
   in black space. */
@media (min-width: 1024px) {
  .watch-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(340px, 400px) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    height: calc(100dvh - var(--topbar-h));
    padding: 12px 36px 16px;
    max-width: 1680px;
    margin: 0 auto;
  }
  .watch-top { top: calc(var(--topbar-h) + 20px); left: 50%; right: auto; transform: translateX(-50%); padding: 0; }
  .watch-viewer {
    height: min(calc(100dvh - var(--topbar-h) - 28px), 86vh);
    aspect-ratio: 9 / 16;
    width: auto;
    overflow: hidden;
    scroll-snap-type: none;
    border-radius: var(--r-lg);
    border: 1px solid rgba(244, 176, 33, 0.22);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(244, 176, 33, 0.07);
    grid-column: 2;
    grid-row: 1;
  }
  .watch-slide {
    --feed-bottom: 24px;
    height: 100%;
    border-radius: var(--r-lg);
  }
  .watch-slide[data-kind="prev"], .watch-slide[data-kind="next"] { display: none; }
  .watch-related { display: none; }
  /* the aside carries the full metadata + actions on desktop — the
     in-video overlay stays mobile-only so the stage reads clean */
  .watch-info, .watch-rail { display: none; }
  .watch-aside {
    display: block;
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
  }
  .watch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .watch-participant { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
  .watch-participant img { width: 44px; height: 44px; }
  .watch-title { font-size: 22px; margin-top: 16px; }
  .watch-desc { font-size: 14px; color: var(--muted); margin-top: 8px; -webkit-line-clamp: unset; overflow-wrap: anywhere; word-break: break-word; }
  .watch-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
  .watch-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
  .vote-cta { min-width: 150px; }
  .vote-cta.on { background: var(--gold-faint); border: 1px solid rgba(244, 176, 33, 0.5); color: var(--gold); }
  .vote-cta.on svg { fill: var(--gold); }
  .watch-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
  }
  .wsg-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .wsg-cell span { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
  .wsg-cell b { font-size: 14px; font-weight: 800; }
  .watch-enter {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.02);
  }
  .watch-enter .h3 { margin-bottom: 4px; }
  .watch-enter .btn { margin-top: 12px; }

  .watch-related-grid { display: none; }
}

/* skeletons */
.watch-skeleton { display: flex; flex-direction: column; gap: 14px; }
.sk-player { aspect-ratio: 9 / 16; border-radius: var(--r-lg); }
.sk-line { height: 16px; width: 60%; }
.sk-line.short { width: 35%; }

/* ---------- comments (social features #025) ---------- */
.comments-sheet .sheet-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.comments-sheet .sheet-body { flex: 1 1 auto; overflow: hidden; }

.comments-count-badge {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.comments-composer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.comments-composer .comment-av { width: 34px; height: 34px; font-size: 13px; }
.comments-input-wrap { flex: 1; min-width: 0; }
.comments-input {
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--txt);
  background: var(--card);
  border: 1px solid var(--line);
  outline: none;
}
.comments-input:focus { border-color: rgba(244, 176, 33, 0.6); }
.comments-composer-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; justify-content: flex-end; }
.comments-hint { font-size: 11.5px; color: var(--muted); }
.comments-err { color: var(--danger); font-size: 12.5px; margin-top: 6px; }
.comments-guest {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  flex: none;
}
.comments-guest p { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.comments-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 18px;
  min-height: 120px;
  overscroll-behavior: contain;
}
.comment {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.comment:last-child { border-bottom: 0; }
.comment-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.comment-av.av-initial { width: 36px; height: 36px; font-size: 14px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-name { font-size: 13.5px; font-weight: 700; }
.comment-time { font-size: 11.5px; color: var(--muted); }
.comment-body {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--txt);
  white-space: pre-wrap;      /* line breaks survive; rendered as TEXT */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.comment-del {
  align-self: flex-start;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.comment-del svg { width: 14px; height: 14px; }
.comment-del:hover { color: var(--danger); background: rgba(248, 113, 113, 0.1); }

.comments-empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 12px;
}
.comments-empty .empty-icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--gold-faint);
  border: 1px solid rgba(244, 176, 33, 0.3);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold);
  margin-bottom: 10px;
}
.comments-empty .empty-icon svg { width: 20px; height: 20px; }
.comments-empty h3 { font-size: 15px; color: var(--txt); font-weight: 700; }
.comments-empty p { font-size: 13px; margin-top: 4px; }

.comments-footer { padding: 10px 18px 16px; text-align: center; flex: none; }
.comments-skeleton { padding: 12px 0; }
.comments-skeleton .skeleton { height: 14px; border-radius: 7px; margin-bottom: 10px; }
.comments-load-err { text-align: center; color: var(--muted); padding: 20px 12px; font-size: 13px; }
