/* ===== Видеоревью — mobile-first, design tokens ===== */
:root {
  /* colour */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e6eaf1;
  --border: #e0e4ec;
  --border-strong: #cdd3de;
  --text: #16233d;
  --text-muted: #6b778c;
  --accent: #3b6ef5;
  --accent-weak: #eaf0ff;
  --accent-contrast: #ffffff;
  --danger: #e0483d;
  --danger-weak: #fdecea;
  --ok: #2f9e5f;
  --ok-weak: #e7f6ee;
  --warn: #b26a00;
  --warn-weak: #fff3d6;
  --purple: #7b5cff;
  --purple-weak: #f2effe;
  --blue: #2b6cb0;
  --blue-weak: #e3effb;
  --flash: #fff7cc;
  --hl: #fff3b0;
  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  /* radii */
  --r-sm: 7px; --r-md: 10px; --r-lg: 14px; --radius: 10px;
  /* elevation */
  --shadow: 0 1px 2px rgba(16, 35, 71, 0.08), 0 1px 3px rgba(16, 35, 71, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 35, 71, 0.12);
  --shadow-lg: 0 12px 32px rgba(16, 35, 71, 0.20);
  /* motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur: 0.16s;
  --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); padding: 8px 12px; min-height: var(--tap);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
button:hover { border-color: var(--border-strong); background: var(--surface-2); }
button:active { transform: translateY(0.5px); }
button.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); box-shadow: 0 1px 2px rgba(59,110,245,0.35); }
button.primary:hover { background: #2f60e0; border-color: #2f60e0; }
button.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
button.danger:hover { background: var(--danger-weak); }
button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: var(--r-sm); }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* icon buttons — compact, conventional action glyphs */
.icon-btn {
  min-height: 34px; height: 34px; width: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent; border-radius: var(--r-sm);
  font-size: 15px; line-height: 1; color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.ok { color: var(--ok); }
.icon-btn.ok:hover { background: var(--ok-weak); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-weak); }
.icon-btn svg.ic { display: block; }

input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 10px;
  width: 100%; min-height: var(--tap);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
textarea { resize: vertical; }
label { display: block; font-size: 13px; color: var(--text-muted); margin: 8px 0 4px; }
a { color: var(--accent); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.error { color: var(--danger); font-size: 14px; margin: 8px 0; }
.warn { color: #a06a00 !important; }

/* ===== header ===== */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { font-weight: 700; cursor: pointer; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.topbar .who-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== avatars ===== */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex: none;
  background-size: cover; background-position: center;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ===== auth ===== */
.auth-wrap { max-width: 420px; margin: 40px auto; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== videos list ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 14px; }
.video-list { display: grid; gap: 10px; }
.video-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.video-item .vi-main { flex: 1; min-width: 0; cursor: pointer; }
.video-item .vi-title { font-weight: 600; }
.video-item .vi-sub { font-size: 13px; color: var(--text-muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { font-size: 18px; font-weight: 700; margin: 6px 0 12px; }

/* role badges / breadcrumb / member chips */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; vertical-align: middle;
  color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 8px;
}
.topbar .crumb { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.member-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px 3px 3px;
}
.member-chip .mc-role { font-size: 10px; color: var(--accent); font-weight: 600; }

/* reactions */
.c-reacts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.react-chip { font-size: 12px; min-height: 24px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.react-chip.mine { border-color: var(--accent); background: #e6ebff; }
.react-add { position: relative; display: inline-flex; }
.react-toggle { font-size: 12px; min-height: 24px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--text-muted); cursor: pointer; }
.react-palette { display: none; position: absolute; bottom: 100%; left: 0; margin-bottom: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; box-shadow: var(--shadow); z-index: 12; }
.react-add.open .react-palette { display: flex; flex-wrap: wrap; gap: 2px; width: 232px; }
.react-opt { font-size: 17px; min-height: 32px; width: 32px; padding: 0; border: none; background: transparent; cursor: pointer; border-radius: 50%; }
.react-opt:hover { background: var(--surface-2); }

/* assignee */
.assignee { display: inline-flex; align-items: center; gap: 2px; }
.assignee-chip { font-size: 12px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.assign-list { display: flex; flex-direction: column; gap: 4px; max-height: 52vh; overflow: auto; }
.assign-opt { display: flex; align-items: center; gap: 8px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; min-height: 40px; }
.assign-opt:hover { background: var(--surface-2); }

/* version selector */
.version-select { width: auto; min-height: 30px; padding: 2px 6px; font-size: 13px; }

/* frame editor (screenshot + drawing) */
.fe-backdrop { z-index: 60; }
.fe { background: var(--surface); border-radius: var(--radius); width: min(96vw, 1100px); max-height: 94vh; display: flex; flex-direction: column; padding: 10px; box-shadow: var(--shadow); }
.fe-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; }
.fe-toolbar .spacer { flex: 1; }
.fe-tools, .fe-colors { display: flex; gap: 4px; align-items: center; }
.fe-tool { min-height: 34px; min-width: 38px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.fe-tool.active { border-color: var(--accent); background: #e6ebff; }
.fe-color { width: 26px; height: 26px; min-height: 26px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.fe-color.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.fe-canvas-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #111; border-radius: 8px; overflow: auto; }
.fe-canvas-wrap canvas { max-width: 100%; max-height: 74vh; touch-action: none; cursor: crosshair; background: #000; }
.fe-size { display: flex; align-items: center; gap: 6px; padding: 0 4px; }
.fe-size .fe-size-a { font-weight: 800; font-size: 15px; color: var(--text-muted); }
.fe-size input[type="range"] { width: 92px; }
.fe-textinput {
  position: absolute; z-index: 5; margin: 0; padding: 0 2px; box-sizing: content-box;
  border: 1px dashed rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.28);
  color: #fff; outline: none; resize: none; overflow: hidden; border-radius: 3px;
  line-height: 1.2; font-weight: 700;
}
.fe-textinput::placeholder { color: rgba(255, 255, 255, 0.6); }
.fe-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ===== review layout (mobile-first) ===== */
.review { display: flex; flex-direction: column; }
.splitter { display: none; }

.player-sticky { position: sticky; top: 0; z-index: 20; background: #000; }
.player-box { position: relative; width: 100%; background: #000; aspect-ratio: 16 / 9; }
.player-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-box #yt-player, .player-box #vk-player, .player-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-box canvas.overlay { position: absolute; pointer-events: none; z-index: 2; }

/* Shield over embedded players (YouTube/VK): captures all pointer events so the
   platform's own chrome (progress bar, title, "Watch on YouTube", share…) never
   appears. Only the central band is clickable — it toggles play/pause via our
   own player API. Top and bottom strips stay fully blocked. */
.player-shield { position: absolute; inset: 0; z-index: 3; cursor: default; }
.player-shield-center { position: absolute; left: 0; right: 0; top: 12%; bottom: 24%; cursor: pointer; }

.tc-badge {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: #101317; color: #fff; padding: 6px 10px; font-variant-numeric: tabular-nums;
}
.tc-badge .tc-now { font-size: 19px; font-weight: 700; letter-spacing: 0.5px; }
.tc-badge .ctrls { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tc-badge .skip {
  background: #23272e; color: #fff; border-color: #3a3f47;
  min-height: 34px; padding: 4px 8px; font-size: 13px; border-radius: 7px; min-width: 40px;
}
.tc-badge .skip:hover { background: #2d323b; }
.tc-badge .play-btn { background: var(--accent); color: #fff; border-color: var(--accent); min-height: 34px; min-width: 44px; border-radius: 7px; }
.tc-badge .ctrl-sep { width: 1px; align-self: stretch; background: #3a3f47; margin: 3px 5px; }
.tc-badge .speed-btn { background: #1b2733; border-color: #3d6bd6; color: #cfe0ff; font-weight: 700; min-width: 48px; }
.tc-badge .speed-btn:hover { background: #22384f; }
/* custom volume slider */
.tc-badge .vol { width: 68px; min-height: 0; height: 26px; padding: 0; background: transparent; border: none; accent-color: var(--accent); cursor: pointer; }
.tc-badge .vol:focus { box-shadow: none; }
/* custom scrubber cursor */
.timeline { cursor: pointer; }
.timeline.scrubbing { cursor: grabbing; }
.player-box:fullscreen { width: 100vw; height: 100vh; }
.player-box:fullscreen video { object-fit: contain; }

/* timeline */
.timeline-wrap { background: #14171c; padding: 8px 10px 10px; }
.timeline-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; }
/* time ruler ticks */
.timeline .tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.08); transform: translateX(-0.5px); pointer-events: none; z-index: 1; }
.timeline .tl-tick-label { position: absolute; top: 1px; left: 3px; font-size: 9px; line-height: 1; color: rgba(255,255,255,0.5); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline {
  position: relative; height: 48px; min-width: 100%;
  background: #23272e; border-radius: 6px; cursor: pointer; overflow: hidden;
}
.timeline .played { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(54,109,226,0.22); }
.timeline .playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; z-index: 4; }
.timeline .mark.range { position: absolute; height: 6px; border-radius: 3px; opacity: 0.95; cursor: pointer; }
.timeline .mark.range::after { content: ""; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.timeline .mark.range:hover { outline: 1px solid #fff; }
.timeline .dot {
  position: absolute; bottom: 4px; width: 11px; height: 11px; border-radius: 50%;
  transform: translateX(-50%); border: 1.5px solid rgba(255,255,255,0.6); cursor: pointer;
}
.timeline .dot::after { content: ""; position: absolute; left: -8px; right: -8px; top: -8px; bottom: -8px; }
.timeline .dot:hover { border-color: #fff; }
/* closed comments read paler than open ones */
.timeline .dot.closed { opacity: 0.4; }

.tl-zoom { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tl-zbtn {
  background: #23272e; color: #fff; border: 1px solid #3a3f47;
  min-height: 28px; min-width: 34px; padding: 2px 8px; font-size: 13px; border-radius: 6px;
}
.tl-zbtn:hover { background: #2d323b; }
.tl-zlabel { color: #c7ccd4; font-size: 12px; min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

/* ===== review body ===== */
.review-body { display: flex; flex-direction: column; }
.review-title-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 6;
}
.review-title-bar .rt-title { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters {
  display: flex; gap: 6px; padding: 8px 12px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 41px; z-index: 5;
}
.filters button[data-f] { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.filters button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filters .user-filter { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; max-width: 160px; }
.filters .spacer { flex: 1; }

/* ===== comments feed ===== */
.feed { padding: 8px 10px 150px; display: flex; flex-direction: column; gap: 6px; }
.comment {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-2) 10px; box-shadow: var(--shadow);
  border-left: 3px solid var(--author, var(--border));
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.comment.root:hover { box-shadow: var(--shadow-md); }
.comment.reply { box-shadow: none; background: var(--surface-2); }
/* status stripe by state */
.comment.st-done { border-left-color: var(--ok); }
.comment.st-request { border-left-color: var(--warn); }
.comment.st-titre { border-left-color: var(--blue); }
.comment.done { opacity: 0.72; }
.comment.done .c-tc, .comment.done .c-body { color: var(--text-muted); }
.comment.linkhl { box-shadow: 0 0 0 2px var(--accent); }
.comment.flash { animation: flash 2s ease; }
@keyframes flash { from { background: var(--flash); } to { background: var(--surface); } }
/* playback highlight: light yellow, slow 5s fade */
.comment.tc-hl { animation: tcHighlight 5s ease-out; }
@keyframes tcHighlight { 0% { background: var(--hl); box-shadow: 0 0 0 2px var(--hl); } 100% { background: var(--surface); box-shadow: var(--shadow); } }
/* just-posted own comment: orange flash, 3s fade */
.comment.just-posted { animation: justPosted 3s ease-out; }
@keyframes justPosted { 0% { background: #ffdcae; box-shadow: 0 0 0 2px #ff9f1c; } 100% { background: var(--surface); box-shadow: var(--shadow); } }

/* root comments: timecode tag in a left gutter, content on the right */
.comment.root { display: flex; gap: 8px; align-items: flex-start; }
.comment .c-left { flex: 0 0 auto; width: 58px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding-top: 1px; }
.comment .c-main { flex: 1 1 auto; min-width: 0; }
.comment .c-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment .c-name { font-weight: 600; font-size: 13.5px; }
.comment .c-time { color: var(--text-muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.comment .c-left .c-tc {
  display: block; text-align: center; line-height: 1.2; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--accent); cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 4px; background: var(--surface-2);
}
.comment .c-left .frag-btn { align-self: center; }
.comment .c-tc:hover { background: #e6ebff; }
.comment .c-body { margin: 5px 0; word-break: break-word; font-size: 14px; }
.comment .c-ref { font-size: 12.5px; margin-top: 3px; }
.comment .c-actions { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.comment .c-done-label { font-size: 12px; color: var(--ok); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.comment .c-done-label .ic { width: 14px; height: 14px; }

/* ⋯ overflow menu */
.more-wrap { position: relative; display: inline-flex; }
.more-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); padding: 4px; min-width: 180px; flex-direction: column; gap: 2px;
}
.more-wrap.open .more-menu { display: flex; animation: menuPop 0.13s var(--ease); }
@keyframes menuPop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: var(--r-sm); padding: 8px 10px; min-height: 38px;
  color: var(--text); font-size: 13.5px;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-weak); }
.menu-item .ic { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.menu-item.danger .ic { color: var(--danger); }
.avatar.xs { width: 18px; height: 18px; font-size: 9px; }

.tc-link { cursor: pointer; color: var(--accent); text-decoration: underline; font-variant-numeric: tabular-nums; }
.frag-btn {
  cursor: pointer; color: var(--accent); font-size: 12px; border: 1px solid var(--border);
  border-radius: 5px; padding: 0 5px; background: var(--surface-2); min-height: 20px; line-height: 18px;
}

/* attachments */
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0; }
.att { position: relative; }
.att-thumb img {
  width: 92px; height: 92px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); display: block;
}
.att-file a {
  display: inline-block; font-size: 12.5px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; text-decoration: none;
}
.att-del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; min-height: 20px; padding: 0;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--border); font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--danger);
}

/* nested reply branches */
.branch { margin: 6px 0 2px; padding-left: 10px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.branch-toggle {
  align-self: flex-start; background: transparent; border: none; color: var(--accent);
  font-size: 12.5px; min-height: 26px; padding: 2px 4px; cursor: pointer;
}
.branch-toggle:hover { text-decoration: underline; }

/* ===== compose bar ===== */
.compose {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
}
.compose .reply-banner { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.compose .range-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.compose .range-chip { font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.compose .files-chip { font-size: 12.5px; color: var(--text-muted); }
.compose-previews { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.compose-previews.hidden { display: none; }
.cp-thumb { position: relative; width: 64px; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.cp-thumb.warn { border-color: #e5484d; box-shadow: 0 0 0 1px #e5484d; }
.cp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, 0.62); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; cursor: pointer;
}
.cp-del:hover { background: #e5484d; }

/* @mention autocomplete + highlight */
.compose-actions .compose-ta-wrap { position: relative; flex: 1 1 auto; display: flex; }
.compose-ta-wrap > textarea { width: 100%; }
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 40; min-width: 220px; max-width: 320px;
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-md, 0 6px 20px rgba(0,0,0,.18)); padding: 4px; overflow: hidden;
}
.mention-menu.hidden { display: none; }
.mention-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: none; background: none; border-radius: 6px; cursor: pointer; font-size: 13.5px; text-align: left; color: var(--text);
}
.mention-item.active, .mention-item:hover { background: var(--surface-2, #eef1f6); }
.mention { color: var(--accent, #366de2); font-weight: 600; }

/* notification bell + panel */
.notif-wrap { position: relative; display: inline-flex; }
.notif-btn { position: relative; border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 8px; }
.notif-btn:hover { background: var(--surface-2, #eef1f6); }
.notif-badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: #e5484d; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border-radius: 8px;
}
.notif-badge.hidden { display: none; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 340px; max-width: 92vw; max-height: 70vh; overflow-y: auto;
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.22));
}
.notif-panel.hidden { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; position: sticky; top: 0; background: var(--surface, #fff); }
.notif-head .link { border: none; background: none; color: var(--accent, #366de2); cursor: pointer; font-size: 12.5px; }
.notif-empty { padding: 22px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-row { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.notif-row:hover { background: var(--surface-2, #eef1f6); }
.notif-row.unread { background: rgba(54,109,226,.07); }
.notif-row.unread:hover { background: rgba(54,109,226,.12); }
.notif-line { font-size: 13px; color: var(--text); }
.notif-actor { font-weight: 700; }
.notif-snip { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; opacity: .85; }
.compose textarea { min-height: 44px; max-height: 140px; }
.compose .compose-actions { display: flex; gap: 6px; align-items: flex-end; }
.compose .compose-actions .spacer { flex: 1; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 22, 46, 0.5); backdrop-filter: blur(3px);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: modalFade var(--dur) var(--ease);
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  background: var(--surface); border-radius: var(--r-lg); max-width: 480px; width: 100%;
  padding: 20px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto;
  animation: modalPop 0.2s var(--ease);
}
.modal > h3:first-of-type { padding-right: 34px; } /* room for the close X */
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* supported-sources hint in the add-video modal */
.src-hint { margin: 8px 0 2px; padding: 10px 12px; background: var(--surface-2, #f2f4f8); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; color: var(--text-muted); }
.src-hint-title { font-weight: 700; color: var(--text); margin-bottom: 5px; }
.src-hint ul { margin: 0; padding-left: 18px; }
.src-hint li { margin: 2px 0; }
.src-hint li b { color: var(--text); font-weight: 600; }
.src-hint-note { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--border); }
/* unified modal header with close button */
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-x { position: absolute; top: 14px; right: 14px; z-index: 2; width: 32px; height: 32px; min-height: 32px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--text-muted); font-size: 15px; line-height: 1; padding: 0; }
.modal-x:hover { background: var(--surface-3); color: var(--text); }
.invite-code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #172b4d; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 4px 14px rgba(9,30,66,0.28); font-size: 14px; max-width: 90vw; text-align: center; opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* filter counts + review progress */
.f-count { font-size: 11px; font-variant-numeric: tabular-nums; opacity: 0.65; margin-left: 1px; }
.filters button.active .f-count { opacity: 0.9; }
.rt-progress { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* hover link: comment ↔ timeline mark */
.comment.linkhl { box-shadow: 0 0 0 2px var(--accent); }
.timeline .dot.linkhl { outline: 2px solid #fff; z-index: 6; transform: translateX(-50%) scale(1.35); }
.timeline .mark.linkhl { outline: 2px solid #fff; outline-offset: 1px; z-index: 6; }

/* empty feed */
.feed-empty { text-align: center; color: var(--text-muted); padding: 34px 18px; }
.feed-empty .fe-emoji { font-size: 36px; margin-bottom: 6px; opacity: 0.85; }
.feed-empty p { margin: 6px 0; }
.feed-empty p:first-of-type { color: var(--text); font-weight: 600; font-size: 15px; }

/* hotkeys cheatsheet */
.hk-table { width: 100%; border-collapse: collapse; }
.hk-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.hk-key { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; width: 132px; color: var(--accent); font-weight: 600; }

/* delete pushed to bottom-right of the comment */
.c-actions-spacer { flex: 1 1 auto; min-width: 8px; }
.c-actions .c-del { margin-left: auto; }

/* "edited by/when" note */
.c-edited { color: var(--text-muted); font-style: italic; }

/* whole-video (general) comment */
#btn-general.active { background: #7b5cff; color: #fff; border-color: #7b5cff; }
.comment.general { display: block; border-left: 3px solid #7b5cff; background: #f5f2ff; }
.comment.general.done { opacity: 0.66; }

/* inline type label at the start of the comment line (request / titre / pinned) */
.comment .c-type { font-weight: 700; }
.comment .c-type-req { color: #b26a00; }
.comment .c-type-titre { color: #2b6cb0; }
.comment .c-type-pin { color: #6a4bd6; }
.timeline .tl-req {
  position: absolute; bottom: 2px; width: 16px; height: 16px; transform: translateX(-50%);
  border: 1.5px solid; border-radius: 4px; background: #14171c;
  font-size: 12px; font-weight: 800; line-height: 13px; text-align: center; cursor: pointer;
}
.timeline .tl-req.closed { opacity: 0.4; }
.timeline .tl-req.linkhl { outline: 2px solid #fff; }
/* titres marks (T) */
.timeline .tl-titre {
  position: absolute; width: 16px; height: 16px; transform: translateX(-50%);
  border: 1.5px solid; border-radius: 4px; background: #14171c;
  font-size: 11px; font-weight: 800; line-height: 13px; text-align: center; cursor: pointer;
}
.timeline .tl-titre.closed { opacity: 0.4; }
.timeline .tl-titre.linkhl { outline: 2px solid #fff; }

/* radio group (add-version modal) */
.radio-group { display: flex; flex-direction: column; gap: 4px; }
.radio-group label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 0; cursor: pointer; }
.radio-group input { width: auto; min-height: 0; }

/* selective export */
.select-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: #eef2ff; border-bottom: 1px solid var(--border); font-size: 13px; position: sticky; top: 0; z-index: 6; }
.select-bar .spacer { flex: 1; }
.comment.selecting { position: relative; }
.comment .sel-check { width: 18px; height: 18px; min-height: 0; flex: none; margin-right: 2px; align-self: flex-start; margin-top: 4px; cursor: pointer; }

/* image lightbox */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox-img { max-width: 96vw; max-height: 94vh; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.lightbox-close { position: fixed; top: 14px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff; border: none; font-size: 18px; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
input[type="color"] { padding: 2px; cursor: pointer; }

/* ===== desktop ===== */
@media (min-width: 900px) {
  .review { flex-direction: row; height: calc(100vh - 53px); }
  .player-col { flex: 0 0 62%; max-width: 62%; display: flex; flex-direction: column; background: #000; }
  .player-sticky { position: static; flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
  .player-box { aspect-ratio: auto; flex: 1 1 auto; min-height: 0; }

  .splitter {
    display: block; flex: 0 0 6px; background: var(--border); cursor: col-resize;
    position: relative; z-index: 15;
  }
  .splitter:hover, .splitter:active { background: var(--accent); }

  .review-body { flex: 1 1 auto; min-width: 0; height: 100%; }
  .feed { flex: 1; overflow-y: auto; padding-bottom: 12px; }
  .compose { position: static; border-top: 1px solid var(--border); }
  .review-title-bar { position: static; }
  .filters { position: static; }
}

/* ===== mobile polish (#9): bottom-sheet modals, bigger touch targets ===== */
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; width: 100%; border-radius: 16px 16px 0 0; max-height: 90vh; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheetUp 0.24s var(--ease); }
  .modal-x { top: 12px; right: 12px; }
  .comment .c-actions .icon-btn { min-height: 38px; height: 38px; width: 38px; }
  .comment .sel-check { width: 22px; height: 22px; }
  .filters { gap: 5px 6px; }
  .fe-tool, .fe-color { min-height: 40px; }
  .lightbox-close { top: 10px; right: 10px; }
}
