:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #11151d;
  --panel-2: #171c26;
  --line: #293142;
  --text: #f2f5f8;
  --muted: #98a4b7;
  --accent: #76e4b5;
  --accent-ink: #07150f;
  --danger: #ff7d8c;
  --warning: #ffc86b;
  /* Review mode reads as informational, not as a success state; the value was
     already used as a literal elsewhere in this file. */
  --info: #68b5ff;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --line-strong: #3a445a;
  /* One type scale. Before this there were 20+ ad-hoc font sizes, six of them
     crowded into 0.68–0.78rem, which made card hierarchy unreadable. */
  --fs-xs: .72rem;
  --fs-sm: .85rem;
  --fs-base: .95rem;
  --fs-lg: 1.1rem;
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; }
/* Flat surface on purpose: the page background, the card gradient and the
   blurred topbar used to compete for attention behind static data. */
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); padding: .68rem .9rem; cursor: pointer; }
button:hover, .button:hover { border-color: #4b5a70; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 750; }
button.danger { color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: var(--accent); }

.topbar { min-height: 64px; display: flex; align-items: center; gap: 1.4rem; padding: .75rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); background: rgba(9, 11, 16, .88); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.brand { color: var(--text); text-decoration: none; font-weight: 850; letter-spacing: -.035em; font-size: 1.12rem; }
.brand span { color: var(--accent); font-weight: 600; }
nav { display: flex; gap: .35rem; }
nav button { border: 0; background: transparent; color: var(--muted); }
nav button.nav-active { background: var(--panel-2); color: var(--text); }
.account { margin-left: auto; display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }

main { width: min(1500px, 100%); margin: 0 auto; padding: clamp(1rem, 2.5vw, 2rem); }
.center-card { width: min(520px, 100%); margin: 12vh auto; padding: 2.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.center-card h1 { margin: .3rem 0 1rem; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-weight: 750; letter-spacing: .1em; font-size: .72rem; }
.spinner { width: 28px; height: 28px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { margin: 1rem auto 0; width: min(900px, calc(100% - 2rem)); padding: .75rem 1rem; border-radius: 10px; border: 1px solid; }
.error { background: #2b141a; color: #ffd5db; border-color: #71313d; }
.save-status { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; min-height: 1.4rem; color: var(--muted); font-size: .83rem; }
.save-status.failed { color: var(--danger); }

.page-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; min-width: 0; flex-wrap: wrap; }
.page-title > * { min-width: 0; }
.page-title h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.5rem); letter-spacing: -.045em; }
.page-title p { margin: .35rem 0 0; color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
/* Elevation is carried by the border alone — no gradients, no drop shadows. */
.task-card, .panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.task-card { padding: 1.15rem; display: grid; gap: .85rem; }
.task-card h2 { font-size: 1.05rem; margin: 0; }
.meta-row { display: flex; gap: .5rem; align-items: center; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.pill { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: .25rem .55rem; color: var(--accent); }
.progress { height: 6px; background: #252c38; overflow: hidden; border-radius: 99px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.workspace-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.workspace-head h1 { margin: 0; font-size: 1.2rem; }
.workspace-head p { margin: .2rem 0 0; color: var(--muted); font-size: .85rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr); gap: 1rem; }
.video-panel { padding: .75rem; }
video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.shortcut-bar { display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .75rem; color: var(--muted); font-size: .78rem; }
kbd { border: 1px solid #48536a; border-bottom-width: 2px; border-radius: 5px; padding: .08rem .34rem; background: #202634; color: var(--text); }
.side-panel { min-width: 0; padding: 1rem; align-self: start; position: sticky; top: 80px; }
.side-panel h2 { margin: 0 0 .85rem; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: .9rem 0; }
.actions .primary { flex: 1; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
label { display: grid; gap: .32rem; color: var(--muted); font-size: .78rem; }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--line); background: #0c1017; color: var(--text); border-radius: 8px; padding: .65rem .7rem; }
select { text-overflow: ellipsis; }
textarea { min-height: 130px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; }
.annotation-list { margin-top: 1.15rem; border-top: 1px solid var(--line); padding-top: .9rem; display: grid; gap: .55rem; max-height: 270px; overflow: auto; }
.annotation-item { border: 1px solid var(--line); border-radius: 9px; padding: .65rem; display: grid; gap: .5rem; }
.annotation-item .row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.annotation-item button { padding: .35rem .5rem; font-size: .75rem; }
.candidate { padding: .85rem; border: 1px solid #35594d; background: #10231d; border-radius: 10px; }
.candidate strong { color: var(--accent); }
.source-audio-warning {
  display: grid;
  gap: .18rem;
  margin: .65rem 0;
  padding: .65rem .75rem;
  border: 1px solid #a96922;
  border-radius: 8px;
  color: #ffd9a1;
  background: #35230f;
  line-height: 1.35;
}
.source-audio-warning strong { color: #ffc66d; }
.source-audio-warning span { font-size: .78rem; }
.empty { color: var(--muted); border: 1px dashed var(--line); padding: 1rem; border-radius: 10px; text-align: center; }


.stack { display: grid; gap: .7rem; }

.wide { grid-column: 1 / -1; }

.subhead { margin: 1.1rem 0 .5rem; font-size: .95rem; }

/* Clip review queue (Задания → проверка живых клипов). */
.review-queue { display: grid; gap: 1rem; margin-top: .5rem; }
.review-card { max-width: 780px; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #10151d; }
.review-card-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .7rem; }
.review-card-head strong { font-size: 1.1rem; }
.review-embed { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #000; }
.review-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.review-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.review-actions button { min-height: 46px; flex: 1 1 auto; font-size: .95rem; font-weight: 650; }
.review-reasons { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.review-reasons[hidden] { display: none; }
.review-reason-chip { padding: .4rem .7rem; font-size: .82rem; }
.review-done { max-width: 780px; padding: 1.4rem; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.review-history { max-width: 780px; }
.review-history > summary { cursor: pointer; padding: .5rem 0; color: var(--muted); }
.review-history-list { display: grid; gap: .4rem; }
.review-history-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem .1rem; border-bottom: 1px solid var(--line); }
.review-history-link { overflow: hidden; color: #c9d1dc; text-overflow: ellipsis; white-space: nowrap; }
.pill.review-accept { color: var(--accent); border-color: #31594d; }
.pill.review-reject { color: var(--danger, #e5786d); border-color: #6b3630; }
.pill.review-unsure { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .65rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.compact { margin: .35rem 0; font-size: .78rem; }

.dev-badge, .dev-banner { color: #ffe2a8; background: #322613; border: 1px solid #755823; border-radius: 7px; padding: .35rem .55rem; font-size: .78rem; }

.inline-error { color: var(--danger); margin: .35rem 0; overflow-wrap: anywhere; }
.status-active, .status-verified, .status-completed { color: var(--accent); border-color: #31594d; }
.status-starting, .status-stopping, .status-pending, .status-created { color: var(--warning); border-color: #765b2d; }
.status-failed, .status-rejected { color: var(--danger); border-color: #71313d; }

.twitch-player-panel, .twitch-chat-panel { overflow: hidden; padding: 0; min-height: 420px; }
.twitch-player { width: 100%; height: 100%; min-height: 420px; background: #000; }
.twitch-chat-panel iframe { width: 100%; height: 100%; min-height: 420px; border: 0; display: block; }
.dev-player, .dev-chat { min-height: 420px; display: grid; place-items: center; white-space: pre-line; text-align: center; color: var(--muted); background: radial-gradient(circle, #1d1730, #08090d 68%); padding: 2rem; }
.dev-chat { background: #0e1018; }

.metric-box { background: #0c1017; border: 1px solid var(--line); border-radius: 9px; padding: .65rem .75rem; display: grid; gap: .25rem; min-width: 0; }
.metric-box span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.metric-box strong { overflow-wrap: anywhere; }
.create-clip-button { min-height: 68px; font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 850; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.live-lower-grid > .panel, .live-timeline-panel, .live-funnel { padding: 1rem; }

.candidate-live-card, .clip-live-card { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin-top: .65rem; background: #0c1017; }

.countdown { color: var(--warning); font-variant-numeric: tabular-nums; }

     

.funnel-row .metric-box { flex: 1 0 125px; }

  

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  
  .wide { grid-column: auto; }
  
  .twitch-chat-panel, .twitch-chat-panel iframe { min-height: 360px; }
  
  
  
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .account { font-size: .75rem; }
  main { padding: .8rem; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .task-grid { grid-template-columns: minmax(0, 1fr); }
  .field-grid { grid-template-columns: 1fr; }
  .workspace-head { align-items: flex-start; }
  .workspace-head > button { padding: .5rem; }
  
  .twitch-player, .twitch-player-panel { min-height: 300px; }
  .twitch-chat-panel, .twitch-chat-panel iframe { min-height: 320px; }
  
  
}

/* Pool-first live clipper */
/* Desktop clipper workspace is a static one-screen app: the page never
   scrolls; rail and stage scroll internally when needed. */
main.live-view {
  width: 100%;
  max-width: none;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* The topbar height is not a constant (wrapping, zoom): let flex hand the
   exact remaining space to the workspace instead of a calc() guess. */
body:has(main.live-view) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body:has(main.live-view) main.live-view {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.topbar nav button {
  position: relative;
  min-height: 42px;
  border-radius: 0;
  padding-inline: .9rem;
}

.topbar nav button.nav-active {
  background: transparent;
}

.topbar nav button.nav-active::after {
  position: absolute;
  right: .75rem;
  bottom: -.76rem;
  left: .75rem;
  height: 2px;
  background: var(--accent);
  content: "";
}

.live-pool-shell {
  position: relative;
  height: 100%;
  min-height: 0;
  background: #090b10;
}

.live-pool-layout {
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.live-channel-rail {
  min-width: 0;
  min-height: 0;
  padding: 16px 0 28px 12px;
  overflow-y: auto;
  border-right: 1px solid #293142;
  background: #0b0f16;
}

.live-rail-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 0 14px 13px 0;
}

.live-rail-head h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.live-channel-count {
  color: var(--muted);
  font-size: .75rem;
}

.live-rail-close,
.live-mobile-bar,
.live-rail-shade {
  display: none;
}

.live-channel-list {
  display: grid;
}

.live-channel-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  gap: 9px;
  padding: 8px 10px 8px 6px;
  border: 0;
  border-bottom: 1px solid #202734;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.live-channel-row:hover:not(:disabled) {
  border-color: #364152;
  background: #111722;
}

.live-channel-row.selected {
  border: 1px solid #31594d;
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  background: #101b1a;
}

.live-channel-row.occupied {
  opacity: .72;
}

.channel-avatar {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #354052;
  border-radius: 50%;
  object-fit: cover;
  background: #171c26;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800;
}

.live-channel-copy,
.live-channel-name-row,
.live-channel-secondary,
.live-channel-status {
  display: block;
  min-width: 0;
}

.live-channel-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.live-channel-name {
  overflow: hidden;
  color: var(--text);
  font-size: .86rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-indicator,
.presence-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--accent);
}

.live-channel-secondary {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-channel-status {
  margin-top: 3px;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 650;
}

.live-channel-status.status-occupied {
  color: #aab4c4;
}

.live-pool-empty {
  margin-right: 14px;
  padding: 20px 10px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
}

.live-stage {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  height: 100%;
  padding: 16px 16px 14px 18px;
  /* No scroll in the normal case: children shrink to fit. Auto is only the
     graceful fallback for windows shorter than the content minimums. */
  overflow-y: auto;
}

.live-welcome {
  width: min(560px, calc(100% - 32px));
  margin: 20vh auto 0;
  text-align: center;
}

.live-welcome h2 {
  margin: .3rem 0 .65rem;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.live-welcome > p:last-child {
  margin: 0;
  color: var(--muted);
}

.live-stream-head {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 0 0 auto;
  gap: 14px;
  margin: 0 0 12px 4px;
}

.channel-avatar.stream-avatar {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

.live-stream-copy {
  min-width: 0;
}

.live-stream-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-stream-name h1 {
  overflow: hidden;
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-stream-copy p,
.live-stream-copy small {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-stream-copy small {
  display: block;
  font-size: .72rem;
}

.lease-badge {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid #31594d;
  border-radius: 999px;
  color: var(--accent);
  font-size: .72rem;
  white-space: nowrap;
}

.lease-badge[data-connection="reconnecting"] {
  border-color: #765b2d;
  color: var(--warning);
}

.live-content-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) 286px;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  min-height: 0;
  gap: 16px;
}

.live-center-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 10px;
}

/* Player fills the remaining space as the largest centered 16:9 box — no
   stretched black container, no side bars from us. */
.live-player-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.live-player-shell {
  position: absolute;
  inset: 0;
  margin: auto;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  background: #000;
}

.live-player-shell .twitch-player,
.live-player-shell .twitch-player > div,
.live-player-shell iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.live-player-shell .dev-player {
  min-height: 100%;
  gap: 8px;
  background: #0d1119;
}

/* Assisted hint: a slim, non-floating alert strip. It only signals a moment;
   clipping is the one big button below. */
.assisted-host { flex: 0 0 auto; }
.assisted-host:empty { display: none; }

.assisted-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #33513f;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: #121b16;
}

.assisted-spark { font-size: 1.05rem; line-height: 1; }
.assisted-text { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.assisted-age { color: var(--muted); }
.assisted-dismiss { padding: .4rem .75rem; font-size: .82rem; }
.assisted-x {
  padding: .2rem .5rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.live-action-panel {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(220px, .9fr) minmax(280px, 1.3fr);
  align-items: center;
  gap: 24px;
  min-height: 92px;
  padding: 14px 24px;
  border: 1px solid #293142;
  border-radius: 10px;
  background: #10151d;
}

.presence-copy {
  min-width: 0;
}

.presence-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.presence-line strong {
  overflow: hidden;
  font-size: .87rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-dot {
  background: #596476;
}

.presence-dot.active {
  background: var(--accent);
}

.presence-time {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.presence-copy small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.create-clip-button {
  display: grid;
  min-height: 76px;
  place-items: center;
  gap: 3px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
}

.create-clip-button strong {
  font-size: 1.3rem;
}

.create-clip-button small {
  font-size: .76rem;
  font-weight: 500;
}

/* Bottom bar: hints toggle + personal tally, static under the action panel. */
.live-bottom-bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 10px 16px;
  border: 1px solid #232a37;
  border-radius: 10px;
  background: #0d121a;
}

.hints-toggle {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px 9px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 650;
}

.hints-toggle input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.hints-toggle .hints-hint { grid-column: 2; color: var(--muted); font-size: .72rem; font-weight: 400; }

.my-stats { display: flex; gap: 20px; margin-left: auto; }
.my-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.my-stat strong { font-size: 1.05rem; }
.my-stat small { color: var(--muted); font-size: .68rem; }

.live-chat-collapse {
  overflow: hidden;
  min-width: 0;
  height: 100%;
  min-height: 0;
  border: 1px solid #293142;
  border-radius: 10px;
  background: #10151d;
}

.live-chat-collapse > summary {
  padding: 14px 15px;
  border-bottom: 1px solid #293142;
  color: #c9d1dc;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.live-chat-collapse[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.live-chat-collapse .twitch-chat-panel,
.live-chat-collapse iframe,
.live-chat-collapse .dev-chat {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.live-chat-collapse iframe {
  display: block;
}

.live-clip-outcome {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 110px;
  overflow-y: auto;
}

/* Compact, auto-clearing capture card (no hanging panel). */
.clip-capture-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #2c3444;
  border-radius: 10px;
  background: #0d121a;
  font-size: .84rem;
}
.clip-capture-card > span { color: var(--muted); font-size: .76rem; }
.clip-capture-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.clip-capture-actions .editor-link { font-weight: 650; }
.clip-capture-actions .assisted-x { margin-left: auto; }
.clip-saved { padding: 8px 4px; }
.clip-saved-link { color: var(--accent); font-weight: 650; }

.live-auto-review {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 120px;
  overflow-y: auto;
}

.live-dev-diagnostics {
  flex: 0 0 auto;
}

.clip-outcome-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 8px 2px;
  color: var(--muted);
  font-size: .8rem;
}

.clip-outcome-line strong {
  color: var(--text);
}

.clip-outcome-line.clip-published strong,
.clip-outcome-line.clip-verified strong {
  color: var(--accent);
}

.clip-outcome-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.clip-outcome-actions button {
  padding: .45rem .65rem;
  font-size: .75rem;
}

.auto-review-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border-top: 1px solid #293142;
  font-size: .8rem;
}

.auto-review-panel .actions {
  margin: 0;
}

.live-dev-diagnostics {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #293142;
  border-radius: 9px;
  color: var(--muted);
  font-size: .75rem;
}

.live-dev-badge {
  width: fit-content;
  margin: -8px 0 12px 22px;
  padding: 5px 8px;
  border: 1px solid #755823;
  border-radius: 6px;
  background: #2a2113;
  color: #ffe2a8;
  font-size: .7rem;
}

.live-dev-diagnostics > summary {
  cursor: pointer;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.live-guide-trigger {
  position: fixed;
  z-index: 7;
  right: 16px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-color: #31594d;
  background: #0d1417;
}

.live-guide-trigger img {
  width: 21px;
  height: 21px;
}

.guide-overlay[hidden] {
  display: none;
}

.guide-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  overflow-y: auto;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 9, .86);
}

.guide-dialog {
  position: relative;
  width: min(820px, 100%);
  padding: 22px;
  border: 1px solid #354052;
  border-radius: 14px;
  background: #11151d;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .55);
}

.guide-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 7px 9px;
  background: rgba(9, 11, 16, .92);
  font-size: .75rem;
}

.guide-progress {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .75rem;
}

.guide-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #293142;
  border-radius: 10px;
  object-fit: cover;
  background: #090b10;
}

.guide-dialog h2 {
  margin: 16px 0 0;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  text-align: center;
}

.guide-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 1080px) {
  .live-content-grid { grid-template-columns: minmax(0, 1fr) 250px; }
  .live-action-panel { grid-template-columns: 1fr; gap: 12px; padding: 14px 18px; }
  .create-clip-button { min-height: 66px; }
}

@media (max-width: 800px) {
  /* Mobile keeps the scrolling flow: a fixed one-screen layout cannot hold
     player + CTA + chat on a phone. */
  body:has(main.live-view) { display: block; height: auto; overflow: visible; }
  main.live-view { height: auto; min-height: calc(100vh - 106px); overflow: visible; }
  .live-pool-shell { height: auto; min-height: calc(100vh - 106px); }
  .live-stage { display: block; height: auto; overflow: visible; }
  .live-content-grid { display: grid; }
  .live-center-column { display: block; }
  .live-player-area { position: static; aspect-ratio: 16 / 9; }
  .live-player-shell { position: static; margin: 0; max-width: none; max-height: none; width: 100%; height: 100%; }
  .live-chat-collapse { height: auto; }
  .live-clip-outcome, .live-auto-review { max-height: none; overflow: visible; }
  .live-mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid #293142;
    background: #0b0f16;
  }
  .live-rail-toggle { padding: .52rem .7rem; font-size: .78rem; }
  .live-mobile-channel { overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
  .live-pool-layout { display: block; min-height: 0; }
  .live-channel-rail {
    position: fixed;
    z-index: 32;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(330px, calc(100vw - 32px));
    padding: 22px 0 30px 14px;
    overflow-y: auto;
    border-right: 1px solid #354052;
    transform: translateX(-102%);
    transition: transform .18s ease;
  }
  .rail-open .live-channel-rail { transform: translateX(0); }
  .live-rail-close { display: block; margin-left: auto; padding: .45rem .55rem; font-size: .7rem; }
  .live-rail-shade {
    position: fixed;
    z-index: 31;
    inset: 0;
    display: none;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, .68);
  }
  .rail-open .live-rail-shade { display: block; }
  .live-stage { padding: 13px 12px 76px; }
  .live-stream-head { margin: 0 0 12px; gap: 10px; }
  .live-dev-badge { margin: -3px 0 10px; }
  .channel-avatar.stream-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .lease-badge { display: none; }
  .live-content-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .live-player-shell { border-radius: 8px; }
  .live-action-panel { margin-top: 8px; padding: 12px; }
  .presence-copy small { font-size: .68rem; }
  .create-clip-button { min-height: 64px; }
  .create-clip-button strong { font-size: 1.18rem; }
  .live-chat-collapse { min-height: 0; }
  .live-chat-collapse[open] { min-height: 360px; }
  .live-chat-collapse .twitch-chat-panel,
  .live-chat-collapse iframe,
  .live-chat-collapse .dev-chat { min-height: 315px; }
  .assisted-host { right: 8px; bottom: 8px; left: 8px; }
  
  
  
  .diagnostics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-guide-trigger { right: 10px; bottom: 12px; }
  .live-guide-trigger span { display: none; }
  .live-guide-trigger img { width: 23px; height: 23px; }
}

@media (max-width: 560px) {
  .topbar { min-height: 58px; padding: 8px 12px; }
  .topbar nav { order: 3; width: 100%; }
  .topbar nav button { min-height: 34px; padding: .35rem .6rem; font-size: .78rem; }
  .topbar nav button.nav-active::after { right: .5rem; bottom: -.5rem; left: .5rem; }
  .account { gap: 5px; }
  .account span { overflow: hidden; max-width: 84px; text-overflow: ellipsis; white-space: nowrap; }
  .account button { padding: .45rem .55rem; font-size: .7rem; }
  .live-stream-copy p { max-width: 260px; }
  .clip-outcome-line { align-items: flex-start; flex-direction: column; }
  .auto-review-panel { align-items: flex-start; flex-direction: column; }
  .guide-overlay { padding: 10px; }
  .guide-dialog { padding: 14px; }
  .guide-close { top: 8px; right: 8px; }
  .guide-progress { padding-right: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-channel-rail { transition: none; }
}

/* Review UX v2: очередь кандидатов, ползунок границ, отклонение с текстом. */
.review-cand-list { display: flex; flex-direction: column; gap: .3rem; max-height: 34vh; overflow-y: auto; margin-bottom: .8rem; padding-right: .2rem; }
.review-cand { display: flex; align-items: center; gap: .55rem; text-align: left; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; font: inherit; color: inherit; }
.review-cand:hover { border-color: var(--accent); }
.review-cand.done { opacity: .55; }
.review-cand.current { border-color: var(--accent); background: #10231d; opacity: 1; }
.cand-status { width: 1.2em; text-align: center; color: var(--accent); }
.review-cand.done .cand-status { color: inherit; }
.range-slider { position: relative; height: 30px; background: rgba(118, 228, 181, .12); border: 1px solid var(--line); border-radius: 8px; margin: .6rem 0 .2rem; }
.range-fill { position: absolute; top: 0; bottom: 0; background: rgba(118, 228, 181, .3); border-radius: 8px; pointer-events: none; }
.range-handle { position: absolute; top: -5px; width: 16px; height: 40px; margin-left: -8px; background: var(--accent); border-radius: 5px; cursor: ew-resize; touch-action: none; }
.range-handle:active { filter: brightness(1.15); }
/* Cluster review: one event, several arms that proposed it. Provenance is on
   screen on purpose — this is training mode, not the blind benchmark. */
.cluster-badge { margin-left: auto; font-size: var(--fs-xs); white-space: nowrap; }
.conf-single { color: var(--muted); }
.conf-corroborated { color: var(--accent); }
.conf-review { color: var(--warning); }
.conf-model-only { color: var(--info); }
.cluster-members { display: flex; flex-direction: column; gap: .3rem; margin: .7rem 0; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 8px; }
.cluster-member { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cluster-member-label { display: flex; align-items: center; gap: .35rem; margin: 0; cursor: pointer; }
.cluster-member-label input { margin: 0; }
.linkish { padding: 0 .2rem; border: 0; background: transparent; color: var(--info); font: inherit;
  cursor: pointer; text-decoration: underline dotted; }
.linkish:hover { color: var(--accent); }

.reject-reasons { display: flex; flex-wrap: wrap; gap: .4rem; }
.reject-reasons .reason { padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.reject-reasons .reason.selected { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.reject-note { width: 100%; resize: vertical; font: inherit; }
.note-field { display: block; font-size: .85rem; color: var(--muted); }
.note-field textarea { margin-top: .25rem; }

/* ==========================================================================
   Задания v2 — см. docs/design/TASKS_AND_ACCESS.md
   Режим (manual/review) несётся тремя каналами сразу: цветная рейка слева,
   бейдж и подпись словами. Цвет нигде не единственный носитель смысла.
   ========================================================================== */

.badge { display: inline-flex; align-items: center; gap: var(--sp-1); padding: .2rem .5rem;
  border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.badge-manual { color: var(--accent); background: rgba(118, 228, 181, .12); }
.badge-review { color: var(--info); background: rgba(104, 181, 255, .12); }
.badge-cluster { color: var(--warning); background: rgba(255, 200, 107, .12); }
.badge-quiet { color: var(--muted); border: 1px solid var(--line); }
.badge-warn { color: var(--warning); background: rgba(255, 200, 107, .12); }

.task-card { position: relative; overflow: hidden; }
.task-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line); }
.task-card.mode-manual::before { background: var(--accent); }
.task-card.mode-review::before { background: var(--info); }
.task-card.mode-cluster::before { background: var(--warning); }
.task-card:hover { border-color: var(--line-strong); }
.task-card.is-done { opacity: .72; }
.task-card.is-done::before { background: var(--line); }
.task-card .task-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.task-card h2 { font-size: var(--fs-lg); margin: 0; letter-spacing: -.02em; }
.task-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.task-count { font-size: var(--fs-sm); color: var(--muted); }
.task-count.is-idle { color: var(--warning); }

/* Группа заданий по одному VOD */
.vod-group { margin-bottom: var(--sp-6); }
.vod-group-head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap;
  padding-bottom: var(--sp-2); margin-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.vod-group-head h3 { margin: 0; font-size: var(--fs-base); font-weight: 700; letter-spacing: -.01em; }
.vod-group-head .vod-channel { color: var(--muted); font-size: var(--fs-sm); }

/* Полоса «Продолжить» */
.resume-card { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-4); margin-bottom: var(--sp-6); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--panel); }
.resume-card.mode-review { border-left-color: var(--info); }
.resume-card.mode-cluster { border-left-color: var(--warning); }
.resume-card .resume-text { min-width: 0; flex: 1 1 18rem; }
.resume-card .resume-text strong { display: block; font-size: var(--fs-base); }
.resume-card .resume-text span { color: var(--muted); font-size: var(--fs-sm); }

/* Свёрнутые выполненные */
.done-group { margin-top: var(--sp-8); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.done-group > summary { cursor: pointer; padding: var(--sp-3) var(--sp-4); display: flex; align-items: center;
  gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.done-group > summary::-webkit-details-marker { display: none; }
.done-group > summary::before { content: "▸"; color: var(--muted); }
.done-group[open] > summary::before { content: "▾"; }
.done-group > .task-grid { padding: 0 var(--sp-4) var(--sp-4); }

/* Пустое состояние — объясняет, а не молчит */
.empty-state { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: var(--sp-6); max-width: 46rem; }
.empty-state h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.empty-state p { margin: 0 0 var(--sp-3); color: var(--muted); font-size: var(--fs-base); line-height: 1.55; }
.empty-state p:last-child { margin-bottom: 0; }

/* Полоса режима внутри рабочего места */
.mode-strip { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4);
  border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius-md);
  background: var(--panel); font-size: var(--fs-sm); color: var(--muted); }
.mode-strip.mode-manual { border-left-color: var(--accent); }
.mode-strip.mode-review { border-left-color: var(--info); }
.mode-strip.mode-cluster { border-left-color: var(--warning); }
/* Счётчик читается как отдельный индикатор, а не как хвост строки: на широком
   экране он иначе теряется у правого края. */
.mode-strip .mode-saved { margin-left: auto; font-variant-numeric: tabular-nums;
  padding: .2rem .55rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font-weight: 650; }
.mode-strip .mode-saved.is-idle { color: var(--warning); border-color: #765b2d; background: rgba(255, 200, 107, .1); }

/* Отступы и типографика панели живут на самой панели, а не на контейнере
   страницы: иначе панель в голом контейнере теряет их и текст прижимается к
   рамке.

   :not() здесь не украшение: .video-panel и .side-panel объявлены ВЫШЕ в файле
   и задают свои отступы, поэтому правило с той же специфичностью, но ниже,
   молча перебивало бы их — рабочее место поехало бы вслед за остальными. */
.panel:not(.video-panel):not(.side-panel) { padding: 1rem; }
.panel:not(.side-panel) > h2 { margin: 0 0 .9rem; font-size: 1.05rem; }


