/* ═══════════════════════════════════════════════════════════════════════════
   watch.css — Watch Page v2 (YouTube-style public page)
   ═══════════════════════════════════════════════════════════════════════════ */

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ── Video ──────────────────────────────────────────────────────────────── */
.watch-video-box {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.watch-video-box video { width: 100%; height: 100%; display: block; }
.watch-no-video {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.75rem; height: 100%; min-height: 280px; color: var(--text-3);
}

/* ── Up-next overlay ────────────────────────────────────────────────────── */
.upnext-overlay {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(0, 0, 0, 0.82);
  display: flex; align-items: center; justify-content: center;
}
.upnext-inner { text-align: center; max-width: 340px; padding: 1rem; }
.upnext-label { color: #ccc; font-size: 0.85rem; margin-bottom: 0.6rem; }
.upnext-label span { color: #fff; font-weight: 700; }
.upnext-thumb-wrap {
  width: 280px; max-width: 100%; aspect-ratio: 16/9; margin: 0 auto;
  border-radius: 8px; overflow: hidden; background: #111;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.upnext-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.upnext-title {
  color: #fff; font-weight: 600; font-size: 0.95rem; margin: 0.6rem 0 0.9rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.upnext-actions { display: flex; gap: 0.6rem; justify-content: center; }

/* ── Title + action row ─────────────────────────────────────────────────── */
.watch-title { font-size: 1.35rem; font-weight: 700; margin: 0.9rem 0 0.6rem; }

.watch-action-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem;
}
.watch-channel { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.watch-channel-avatar {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-weight: 700; font-size: 0.85rem; text-decoration: none;
}
.watch-channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.watch-channel-meta { min-width: 0; }
.watch-channel-name {
  font-weight: 700; font-size: 0.95rem; color: var(--text); text-decoration: none;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.watch-channel-name:hover { color: var(--accent); }
.watch-channel-subs { font-size: 0.75rem; color: var(--text-3); }

.watch-subscribe-btn {
  margin-left: 0.5rem; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem;
  border-radius: 20px; padding: 8px 16px; transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.watch-subscribe-btn:hover { filter: brightness(1.1); }
.watch-subscribe-btn.subscribed {
  background: var(--bg-3); color: var(--text-2); font-weight: 600;
}

.watch-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.like-pill {
  display: flex; align-items: center; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
}
.like-btn, .dislike-btn {
  display: flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--text-2); cursor: pointer; padding: 8px 14px; font-size: 0.85rem;
  font-weight: 600;
}
.like-btn:hover, .dislike-btn:hover { background: var(--bg-3); color: var(--text); }
.like-btn.active, .dislike-btn.active { color: var(--accent); }
.like-btn i, .dislike-btn i { font-size: 1.05rem; }
.like-sep { width: 1px; align-self: stretch; background: var(--border); }

.watch-pill-btn {
  display: flex; align-items: center; gap: 6px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 20px; color: var(--text-2);
  cursor: pointer; padding: 8px 16px; font-size: 0.85rem; font-weight: 600;
}
.watch-pill-btn:hover { background: var(--bg-3); color: var(--text); }

/* ── Description box ────────────────────────────────────────────────────── */
.watch-desc-box {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 1.4rem;
}
.watch-desc-meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; align-items: center;
  font-size: 0.82rem; color: var(--text-3);
}
.watch-desc-meta strong { color: var(--text); }
.watch-wwb-badge { color: var(--accent); font-weight: 600; }
.watch-desc-text {
  font-size: 0.85rem; color: var(--text-2); margin: 0.6rem 0 0; max-width: 720px;
  white-space: pre-line;
}
.watch-members { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.watch-member-chip {
  display: flex; align-items: center; gap: 0.4rem; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px;
  font-size: 0.8rem;
}
.watch-member-link { color: var(--text); text-decoration: none; font-weight: 600; }
.watch-member-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Comments ───────────────────────────────────────────────────────────── */
.watch-comments { margin-top: 0.5rem; }
.wc-header { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1rem; }
.wc-count { font-weight: 700; font-size: 1rem; }
.wc-sort { display: flex; align-items: center; gap: 0.35rem; color: var(--text-3); font-size: 0.85rem; }
.wc-sort select {
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 0.82rem; cursor: pointer;
}

.wc-composer { display: flex; gap: 0.7rem; margin-bottom: 1.4rem; }
.wc-comp-avatar {
  width: 36px; height: 36px; font-size: 0.7rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.wc-comp-body { flex: 1; min-width: 0; }
.wc-comp-input {
  width: 100%; background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 0.88rem; font-family: inherit; resize: none;
  padding: 6px 2px; outline: none; overflow: hidden;
}
.wc-comp-input:focus { border-bottom-color: var(--accent); }
.wc-comp-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

.wc-loading { color: var(--text-3); font-size: 0.85rem; padding: 0.6rem 0; }
.wc-spin { display: inline-block; animation: wc-rotate 1s linear infinite; }
@keyframes wc-rotate { to { transform: rotate(360deg); } }

.wc-item { display: flex; gap: 0.7rem; margin-bottom: 1.1rem; }
.wc-item-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-weight: 700; font-size: 0.68rem;
}
.wc-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wc-item.wc-reply .wc-item-avatar { width: 26px; height: 26px; font-size: 0.55rem; }
.wc-item-body { flex: 1; min-width: 0; }
.wc-item-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.wc-item-name { font-weight: 700; font-size: 0.82rem; color: var(--text); }
.wc-item-name.is-owner {
  background: var(--bg-3); border-radius: 10px; padding: 1px 8px;
}
.wc-item-time { font-size: 0.72rem; color: var(--text-3); }
.wc-item-text { font-size: 0.87rem; color: var(--text-2); margin: 2px 0 4px; white-space: pre-line; word-break: break-word; }
.wc-item-actions { display: flex; align-items: center; gap: 0.25rem; }
.wc-act-btn {
  display: flex; align-items: center; gap: 4px; background: none; border: none;
  color: var(--text-3); cursor: pointer; font-size: 0.75rem; padding: 4px 7px;
  border-radius: 12px;
}
.wc-act-btn:hover { background: var(--bg-3); color: var(--text); }
.wc-act-btn.active { color: var(--accent); }
.wc-act-btn i { font-size: 0.95rem; }
.wc-replies { margin-top: 0.5rem; }
.wc-replies-toggle {
  background: none; border: none; color: var(--accent); font-weight: 600;
  font-size: 0.8rem; cursor: pointer; padding: 4px 8px; border-radius: 12px;
  display: flex; align-items: center; gap: 4px;
}
.wc-replies-toggle:hover { background: var(--bg-3); }
.wc-replies-list { margin-top: 0.4rem; }
.wc-reply-composer { display: flex; gap: 0.5rem; margin: 0.5rem 0 0.8rem; }
.wc-edit-area { width: 100%; }
.wc-edit-input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.87rem; font-family: inherit;
  resize: vertical; min-height: 56px; padding: 8px; outline: none;
}
.wc-edit-input:focus { border-color: var(--accent); }
.wc-edited-tag { font-size: 0.7rem; color: var(--text-3); font-style: italic; }
.wc-empty { color: var(--text-3); font-size: 0.87rem; padding: 0.6rem 0; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.watch-side { min-width: 0; }
.autoplay-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.35rem 0.25rem 0.75rem;
}
.autoplay-label { font-size: 0.85rem; font-weight: 700; color: var(--text-2); }
.autoplay-toggle {
  width: 40px; height: 22px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent); position: relative; transition: background 0.15s;
  flex-shrink: 0;
}
.autoplay-toggle[aria-checked="false"] { background: var(--bg-3); }
.autoplay-knob {
  position: absolute; top: 3px; left: 21px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left 0.15s;
}
.autoplay-toggle[aria-checked="false"] .autoplay-knob { left: 3px; }

.suggestion-list { display: flex; flex-direction: column; gap: 0.6rem; }
.sug-card {
  display: flex; gap: 0.6rem; text-decoration: none; border-radius: 10px;
  padding: 4px; transition: background 0.12s;
}
.sug-card:hover { background: var(--bg-2); }
.sug-thumb {
  width: 168px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
  background: var(--bg-3); flex-shrink: 0;
}
.sug-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sug-thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 1.6rem;
}
.sug-meta { min-width: 0; padding-top: 2px; }
.sug-title {
  font-size: 0.85rem; font-weight: 600; color: var(--text); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sug-owner { font-size: 0.75rem; color: var(--text-3); margin-top: 3px; }
.sug-views { font-size: 0.72rem; color: var(--text-3); }

/* ── Video cards + horizontal rows (Channel + Play Zone, video_rows.js) ─── */
.chan-card { text-decoration: none; border-radius: 10px; transition: background 0.12s; padding: 4px; }
.chan-card:hover { background: var(--bg-2); }
.chan-thumb {
  position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 10px;
  overflow: hidden; background: var(--bg-3);
}
.chan-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chan-thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.chan-card.previewing .chan-thumb video { opacity: 1; }
.chan-thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 2rem;
}
.chan-ctrl {
  position: absolute; bottom: 8px; right: 8px; z-index: 3;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s;
}
.chan-thumb:hover .chan-ctrl { opacity: 1; }
@media (pointer: coarse) { .chan-card.previewing .chan-ctrl { opacity: 1; } }
.chan-btn {
  width: 32px; height: 32px; border: none; border-radius: 8px; cursor: pointer;
  background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.chan-btn:hover { background: rgba(0, 0, 0, 0.92); }
.chan-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-top: 6px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chan-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }

.channel-row {
  display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.channel-row .chan-card { flex: 0 0 260px; scroll-snap-align: start; }
.channel-row::-webkit-scrollbar { height: 8px; }
.channel-row::-webkit-scrollbar-track { background: transparent; }
.channel-row::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
.channel-row::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* Custom always-visible scroll indicator (mobile). Native mobile scrollbars
   are overlay-style and ALWAYS auto-hide — they cannot be forced to stay —
   so a JS-driven bar under each row replaces them. Hidden on desktop. */
.row-indicator { display: none; }
@media (max-width: 768px) {
  .channel-row { scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 0.3rem; }
  .channel-row .chan-card { flex: 0 0 100%; scroll-snap-align: center; }
  .channel-row::-webkit-scrollbar { display: none; }
  .row-indicator {
    display: block; position: relative; height: 4px; margin: 2px 2px 10px;
    background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden;
  }
  .row-indicator-thumb {
    position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
    background: var(--accent); border-radius: 2px;
  }
}

/* ── Sign-in dialog ─────────────────────────────────────────────────────── */
.signin-overlay {
  position: fixed; inset: 0; z-index: 7000;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.signin-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.4rem 1.5rem; max-width: 330px; width: calc(100% - 2rem);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.signin-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.4rem; }
.signin-text { font-size: 0.85rem; color: var(--text-3); margin-bottom: 1.1rem; }
.signin-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* ── Unmute hint (muted-autoplay fallback) ──────────────────────────────── */
.unmute-hint {
  position: absolute; top: 14px; left: 14px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.75); color: #fff; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px; padding: 8px 14px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer;
}
.unmute-hint:hover { background: rgba(0, 0, 0, 0.9); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.watch-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); color: var(--text); border: 1px solid var(--accent);
  border-radius: 10px; padding: 9px 16px; font-size: 0.85rem; z-index: 7500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .watch-layout { grid-template-columns: 1fr; }
  .watch-side { margin-top: 0.5rem; }
  .sug-thumb { width: 148px; }
}
@media (max-width: 480px) {
  .watch-layout { padding: 0.75rem 0.6rem 2rem; }
  .watch-title { font-size: 1.1rem; }
  .sug-thumb { width: 128px; }
}
