/* AI feed — docs/features/ai-feed.md. The page reuses the main feed's own classes
   (desktop_video.css, mobile_video.css, vertical_video_scroll.css); this file only
   adds what the new workflow needs, scoped to .ai-feed-app. */

/* One clip, never a scrolling list. */
.ai-feed-app .af-feed { overflow: hidden !important; scroll-snap-type: none; }
.ai-feed-app .desktop-video-slide { scroll-snap-align: none; }

/* Topic chip: a native <select> covers the feed's settings chip. */
.ai-feed-app .af-topic-chip { position: relative; cursor: pointer; }
.ai-feed-app .af-topic-chip select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  font-size: 16px; /* stops iOS zooming in on focus */
}
.ai-feed-app .settings-scroll-container { display: flex; align-items: center; gap: 12px; }
.ai-feed-app .af-pos { color: var(--text-secondary, #babdc1); font-size: 13px; white-space: nowrap; }

/* Player: the AI cut plays inside the feed's own player box. */
.ai-feed-app video { width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.ai-feed-app .af-mode { pointer-events: none; z-index: 20; }
.ai-feed-app .af-mode.raw { color: var(--text-primary, #fff); }
.ai-feed-app .af-big-play {
  position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .9); color: #333; font-size: 28px; cursor: pointer; z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.ai-feed-app .af-big-play i { margin-left: 5px; }
.ai-feed-app .af-big-play[hidden] { display: none; }
.ai-feed-app .af-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .12); z-index: 20; }
.ai-feed-app .af-progress > div { height: 100%; width: 0; background: var(--accent, #ecc879); }

/* Badges reuse the feed's intensity / emotion badge look where they can. */
.ai-feed-app .af-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.ai-feed-app .af-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(236, 200, 121, .35); color: var(--accent, #ecc879);
}
.ai-feed-app .af-badge.viral { color: #ff9b8f; border-color: rgba(255, 107, 107, .4); }
.ai-feed-app .af-badge.bounty { color: #ffb3a8; border-color: rgba(255, 107, 107, .45); }

/* Next is the main action of this feed. */
.ai-feed-app .desktop-action-btn.af-next-btn { background: var(--accent, #ecc879); color: #0d1824; border-color: var(--accent, #ecc879); }
.ai-feed-app .content-action-btn.af-next-btn i { color: var(--accent, #ecc879); }
.ai-feed-app .desktop-action-btn.on, .ai-feed-app .content-action-btn.on i { color: var(--accent, #ecc879); }
.ai-feed-app .desktop-action-btn:disabled, .ai-feed-app .content-action-btn:disabled { opacity: .35; cursor: default; }
.ai-feed-app .af-rail-count, .ai-feed-app .af-rail-label { display: block; font-size: 10px; line-height: 1; margin-top: 2px; color: var(--text-secondary, #babdc1); }

/* Why AI picked this clip: the desktop description box; a compact block on phones. */
.ai-feed-app .af-why .description-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ai-feed-app .af-why h3 i { color: var(--accent, #ecc879); margin-right: 4px; }
.ai-feed-app .af-why-topic { color: var(--text-secondary, #babdc1); font-size: 13px; }
.ai-feed-app .video-content-info .af-why { margin: 8px 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(236, 200, 121, .07); border: 1px solid rgba(236, 200, 121, .25); }
.ai-feed-app .af-why-head { font-size: 12px; font-weight: 700; color: var(--accent, #ecc879); margin-bottom: 3px; }
.ai-feed-app .af-why-head span { color: var(--text-secondary, #babdc1); font-weight: 500; }
.ai-feed-app .af-why-text { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* Transcript = the cut editor (docs/features/ai-feed.md § Editing the cut). A checkbox per line
   (on = kept, empty = cut, "–" = some words cut), click a word to cut it, highlight words to cut
   them, the time label plays from there. Struck-through = cut inside the clip; grey = outside it. */
.ai-feed-app .af-transcript .af-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; margin: 0 0 10px; padding: 2px 4px; border-radius: 6px; }
.ai-feed-app .af-transcript .af-line.now { outline: 1px solid var(--accent, #ecc879); outline-offset: 2px; }
.ai-feed-app .af-chk {
  width: 20px; height: 20px; margin-top: 2px; border-radius: 5px; border: 1.5px solid rgba(255, 255, 255, .35);
  background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; color: #0d1824; font-size: 12px;
}
.ai-feed-app .af-line[data-state=on] .af-chk { background: #4caf7a; border-color: #4caf7a; }
.ai-feed-app .af-line[data-state=on] .af-chk::after { content: "\2713"; font-weight: 700; }
.ai-feed-app .af-line[data-state=part] .af-chk { background: var(--accent, #ecc879); border-color: var(--accent, #ecc879); }
.ai-feed-app .af-line[data-state=part] .af-chk::after { content: "\2013"; font-weight: 700; }
.ai-feed-app .af-transcript .txt { user-select: text; line-height: 1.5; }
.ai-feed-app .af-w { cursor: pointer; border-radius: 3px; }
.ai-feed-app .af-w:hover { background: rgba(236, 200, 121, .18); }
.ai-feed-app .af-w.cut { color: #e57373; text-decoration: line-through; text-decoration-color: #e57373; opacity: .8; }
.ai-feed-app .af-w.out { opacity: .4; }
.ai-feed-app .af-line.kept .af-w:not(.cut):not(.out) { color: var(--text-primary, #fff); }
.ai-feed-app .af-t { background: none; border: 0; color: var(--text-secondary, #babdc1); font-size: 11px; cursor: pointer; padding: 3px 0 0; opacity: .7; }
.ai-feed-app .af-t:hover { color: var(--accent, #ecc879); opacity: 1; }
.ai-feed-app .af-cut-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; font-size: 12px; color: var(--text-secondary, #babdc1); border-bottom: 1px solid rgba(236, 200, 121, .2); }
.ai-feed-app .af-cut-head b { color: var(--text-primary, #fff); }
.ai-feed-app .af-cut-head em { color: var(--accent, #ecc879); font-style: normal; }
.ai-feed-app .af-reset { background: none; border: 1px solid rgba(236, 200, 121, .45); color: var(--accent, #ecc879); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.ai-feed-app .af-hint { opacity: .7; }
.ai-feed-app .desktop-sidebar-content { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ai-feed-app .desktop-sidebar .af-transcript { flex: 1; min-height: 0; }
.ai-feed-app .desktop-sidebar .af-transcript { overflow-y: auto; position: relative; }
.ai-feed-app .af-sheet .transcript-panel-header { position: relative; }
.ai-feed-app .af-sheet-close { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #fff; font-size: 18px; }
.ai-feed-app .af-sheet { height: calc(62vh / var(--ui-zoom, 1)); }
.ai-feed-app .af-sheet .transcript-content { overflow-y: auto; flex: 1; padding: 16px 20px; position: relative; }
/* The feed hides chip values on phones; the topic is the whole point of this chip. */
.ai-feed-app .af-topic-chip .setting-value { display: inline !important; max-width: calc(46vw / var(--ui-zoom, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* PC "phone size": a 9:16 player (centre crop, like a reel) with the title, buttons and
   why box beside it, all inside the one screen. "Full frame" is the feed's own layout. */
.ai-feed-app .af-portrait { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.ai-feed-app .af-portrait .desktop-video-container {
  height: calc(calc(100vh / var(--ui-zoom, 1)) - 230px); max-height: 760px; min-height: 360px;
  width: auto; aspect-ratio: 9 / 16; margin-bottom: 0;
}
.ai-feed-app .af-portrait video { object-fit: cover; object-position: center; }
.ai-feed-app .af-portrait .af-info { min-width: 0; }
.ai-feed-app .af-portrait .desktop-action-group { flex-wrap: wrap; }

/* Rating (docs/features/ai-feed.md § Ratings). */
.ai-feed-app .af-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.ai-feed-app .af-rate-label { font-size: 13px; color: var(--text-secondary, #babdc1); margin-right: 2px; }
.ai-feed-app .af-rate-btn, .ai-feed-app .af-reason {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--text-primary, #fff);
  border: 1px solid rgba(236, 200, 121, .35); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.ai-feed-app .af-rate-btn.good.on { background: #2e7d4f; border-color: #2e7d4f; }
.ai-feed-app .af-rate-btn.bad.on { background: #8e2f2f; border-color: #8e2f2f; }
.ai-feed-app .af-reasons { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.ai-feed-app .af-reasons[hidden] { display: none; }
.ai-feed-app .af-reason { padding: 4px 10px; font-size: 12px; color: var(--text-secondary, #babdc1); }
.ai-feed-app .af-reason.on { background: rgba(255, 107, 107, .18); border-color: rgba(255, 107, 107, .6); color: #ffb3a8; }
.ai-feed-app .af-rate-saved { font-size: 12px; color: var(--accent, #ecc879); }
.ai-feed-app .video-content-info .af-rate { margin: 0 0 8px; }
.ai-feed-app .video-content-info .af-rate-label { display: none; }

/* AI Feed tab in the top bar, left of New. */
.nav-tab.nav-tab-ai i { color: var(--accent, #ecc879); margin-right: 4px; }
.nav-tab.nav-tab-ai.active i { color: inherit; }

/* A line's whole box plays from there on click (words still toggle the cut). */
.ai-feed-app .af-transcript .af-line { cursor: pointer; }
.ai-feed-app .af-transcript .af-line:hover { background: rgba(236, 200, 121, .06); }
.header-ai-btn i { color: var(--accent, #ecc879); }
/* Phone tab row: AI Feed as a compact wand tab before New. */
.feed-tab.feed-tab-ai { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
.feed-tab.feed-tab-ai i { color: var(--accent, #ecc879); }
.feed-tab.feed-tab-ai.active i { color: inherit; }

/* Two players (§ Two players): the standby sits exactly under the active one, invisible but
   still decoding (opacity, not visibility/display, so its parked frame is ready to show). */
.ai-feed-app .af-vid.af-standby { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 0; }
.ai-feed-app .af-vid:not(.af-standby) { position: relative; z-index: 1; }

/* Swipe / Next: the outgoing clip slides away while the new one slides in, like the feeds. */
.af-slide-ghost { position: fixed; margin: 0; z-index: 50; pointer-events: none; will-change: transform; overflow: hidden; }
.af-slide-ghost canvas { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
