/* Timeline comments and personal notes (SPEC 58 sections 1-2): the comment dots under the player, the player settings
   menu, the "at 2:15" chip on the comment box, My notes under the video and Library > Notes. Colours are the site's
   tokens, so light mode follows the device like everything else. */

/* The comment dots ------------------------------------------------------------------------------------------------- */

.comment-dots { position: relative; height: 24px; margin-top: 6px; }
.comment-dots[hidden], .comment-dots-off .comment-dots { display: none !important; }
.comment-dots-track, .comment-dots-list { position: absolute; left: 8px; right: 8px; }
.comment-dots-track {
  top: 50%; height: 4px; margin-top: -2px; overflow: hidden; border-radius: 2px;
  background: color-mix(in srgb, var(--text) 24%, transparent);
}
.comment-dots-fill {
  position: absolute; inset: 0; background: var(--accent);
  transform: scaleX(var(--fill, 0)); transform-origin: left center;
}
/* Beside a playlist panel or a replay's chat (social.js moves it into .watch-info, which has its own side padding) */
.watch-info > .comment-dots { margin: 8px -8px 0; }
/* With a chapter strip right below, it shows how far playback is: the dots' bar stays a plain line */
.comment-dots.has-chapters .comment-dots-fill { display: none; }
.comment-dots-list { top: 0; bottom: 0; margin: 0; padding: 0; list-style: none; }
.comment-dot-item { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.comment-dot-item[hidden] { display: none; }
/* social.js stacks overlapping dots most-liked on top (z-index); a focused one comes up so its ring shows */
.comment-dot-item:focus-within { z-index: 100 !important; }
.comment-dot {
  position: absolute; top: 50%; left: 0; width: 24px; height: 24px; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
}
.comment-dot-mark {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text); box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.12s;
}
.comment-dot:hover .comment-dot-mark, .comment-dot:focus-visible .comment-dot-mark, .comment-dot.is-open .comment-dot-mark {
  transform: scale(1.4); background: var(--accent-text);
}
.comment-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* The name and text of a dot, above it (social.js sets `left`) */
.comment-dot-tip {
  position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 6; transform: translateX(-50%);
  display: grid; gap: 2px; width: max-content; max-width: min(300px, calc(100vw - 32px)); padding: 7px 10px;
  border-radius: 8px; background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  font-size: 12.5px; line-height: 1.35; pointer-events: none; overflow-wrap: anywhere;
}
.comment-dot-tip[hidden] { display: none; }
.comment-dot-tip-head { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.comment-dot-tip-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-dot-tip-time { flex: none; font-variant-numeric: tabular-nums; opacity: 0.8; }
/* The comments right next to the dot (they overlap it), under its own */
.comment-dot-tip-more { display: grid; gap: 6px; margin-top: 4px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--bg) 30%, transparent); }
.comment-dot-tip-more[hidden] { display: none; }
.comment-dot-tip-entry { display: grid; gap: 2px; }

/* The player settings menu ------------------------------------------------------------------------------------------ */

.player-settings > summary.btn.player-settings-btn { width: 40px; padding: 0; border-radius: 999px; list-style: none; }
.player-settings > summary.btn::-webkit-details-marker { display: none; }
.player-settings[open] > summary.btn { background: var(--hover); }
.player-settings-pop { right: auto; left: 0; width: 240px; max-width: calc(100vw - 16px); }
.player-settings:not([open]) > .player-settings-pop { display: none; } /* (no box at all while closed: nothing to widen a phone's page) */
.player-settings-pop .player-setting { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px; border-radius: 8px; cursor: pointer; }
.player-settings-pop label.player-setting:hover { background: var(--surface-2); }
.player-settings-pop .check-row input { margin: 0; }

/* The "at 2:15" chip on the comment box ------------------------------------------------------------------------------ */

.comment-form .form-actions.has-at-chip { flex-wrap: wrap; row-gap: 6px; }
.comment-at-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; margin: 3px auto 3px 0; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
}
.comment-at-chip:hover { background: var(--surface-2); color: var(--text); }
.comment-at-chip[aria-pressed="true"] { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.comment-at-chip .icon { flex: none; }
.comment-at-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* A comment's moment, in its head (templates/_comment.html): a timestamp link like the ones in comments */
.comment-at-time { font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.comment-at-time:hover { text-decoration: underline; }

/* My notes under the video ------------------------------------------------------------------------------------------- */

.notes-box { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.notes-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.notes-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.notes-title .icon { flex: none; color: var(--text-2); }
.notes-count { color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.notes-add { height: 34px; padding: 0 14px; }
.notes-add .icon { flex: none; }
.notes-private { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.notes-private .icon { flex: none; }

.note-form { display: grid; gap: 8px; margin-top: 12px; }
.note-form[hidden] { display: none; }
.note-form-label { font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.note-form textarea, .note-edit textarea {
  display: block; width: 100%; min-height: 64px; max-height: 260px; resize: vertical; padding: 9px 11px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.note-form textarea:focus, .note-edit textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.note-form-row, .note-edit-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.note-form-row .btn, .note-edit-row .btn { height: 34px; padding: 0 14px; }
.note-counter { margin-right: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.note-counter.is-over { color: var(--danger-text); }
.note-error[hidden] { display: none; }

.notes-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.notes-list[hidden] { display: none; }
.note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 7px 4px; border-radius: 8px; }
.note:hover { background: var(--surface-2); }
.note-time {
  min-width: 3.4em; padding-top: 1px; color: var(--accent-text); font-weight: 700; font-variant-numeric: tabular-nums;
}
.note-time:hover { text-decoration: underline; }
.note-main { min-width: 0; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.note-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border: 0; border-radius: 999px;
  background: none; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.note-btn:hover { background: var(--hover); color: var(--text); }
.note-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.note.is-editing .note-body, .note.is-editing .note-actions { display: none; }
.note-edit { display: grid; gap: 8px; }
.note.flash { animation: note-flash 1.6s ease; }
@keyframes note-flash { from { background: var(--accent-soft); } }

/* Library > Notes ------------------------------------------------------------------------------------------------------ */

.notes-page-note { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.notes-page-note .icon { flex: none; }
.notes-videos { display: grid; gap: 22px; }
.notes-video { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.notes-video-head { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: start; }
.notes-video-head .thumb { border-radius: 10px; }
.notes-video-text { min-width: 0; padding-top: 2px; }
.notes-video-text .card-title { font-size: 15px; }
.notes-list-page { margin-top: 10px; }
.notes-more { display: flex; width: max-content; margin: 26px auto 0; }
.lib-notes-line { font-size: 14px; }

/* Phones ------------------------------------------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .comment-dots-track, .comment-dots-list { left: 16px; right: 16px; }
  .watch-info > .comment-dots { margin: 8px -16px 0; }
  .notes-video-head { grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 480px) {
  .notes-video-head { grid-template-columns: 112px minmax(0, 1fr); }
  .note { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .comment-dot-mark { transition: none; }
  .note.flash { animation: none; }
}
