/* The owner's channel editor on the desktop TV (static/js/tv/tv-editor.js).

   The desktop twin of the phone's (mobile-channel-editor.css): open page, no
   cards -- the room itself, big Archivo words, JetBrains Mono eyebrows, round
   controls and big thumbnail rows. Every colour is one of tv.css's room
   tokens (--room, --on-room, --room-dim, --faint, --track, --set-edge,
   --btn, --room-hl), so Light, Dark and the owner's page colour
   (page-colors.css) all carry through, alone or in a Split View pane.

   The editor sizes itself on its own width (container tved), not the
   window's, so a ~700px pane gets the one-column layout. */

.tv-room.is-editing { padding-top: 0; gap: 0; }
.tv-room.is-editing > :not(.tv-ed) { display: none; }
.tv-ed[hidden] { display: none; }

.tv-ed {
  --ed-danger: #e5484d;
  --ed-line: color-mix(in srgb, var(--on-room) 12%, transparent);
  --ed-fill: color-mix(in srgb, var(--on-room) 7%, transparent);
  --ed-fill-2: color-mix(in srgb, var(--on-room) 12%, transparent);
  container: tved / inline-size;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  color: var(--on-room);
  font-family: var(--wide);
}
:root[data-theme="light"] .tv-ed { --ed-danger: #c2261d; }

.tv-ed button { font: inherit; color: inherit; cursor: pointer; }
.tv-ed button:disabled { opacity: 0.38; cursor: default; }
.tv-ed button:focus-visible,
.tv-ed input:focus-visible,
.tv-ed textarea:focus-visible { outline: 3px solid var(--room-hl); outline-offset: 3px; }
.tv-ed p { margin: 0; }
.tv-ed__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tv-ed [hidden] { display: none !important; }

/* ------------------------------------------------------------------ bar */
.tv-ed__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0 14px;
  background: var(--room);
}
.tv-ed__label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--room-dim);
}
.tv-ed__round {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ed-fill);
  transition: background 0.14s ease, transform 0.14s ease;
}
.tv-ed__round:hover:not(:disabled) { background: var(--ed-fill-2); }
.tv-ed__round:active:not(:disabled) { transform: scale(0.94); }
.tv-ed__round--sm { width: 40px; height: 40px; font-size: 18px; line-height: 1; }
.tv-ed__watch,
.tv-ed__cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  /* The room's highlight: the owner's colour, swapped for white or black
     by tv.js when it would vanish against the room. */
  background: var(--room-hl, var(--btn));
  color: var(--room-on-hl, var(--on-btn));
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.tv-ed button.tv-ed__watch, .tv-ed button.tv-ed__cta { color: var(--room-on-hl, var(--on-btn)); }
.tv-ed__watch:hover:not(:disabled),
.tv-ed__cta:hover:not(:disabled) { filter: brightness(1.12); }
.tv-ed__watch:active:not(:disabled),
.tv-ed__cta:active:not(:disabled) { transform: scale(0.97); }
.tv-ed__cta.is-danger { background: var(--ed-danger); }
.tv-ed button.tv-ed__cta.is-danger { color: #ffffff; }
.tv-ed__cta--sm { height: 36px; padding: 0 16px; font-size: 13px; }
.tv-ed__ghost {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ed-fill);
  font-size: 15px;
  font-weight: 700;
}
.tv-ed__ghost.tv-ed__cta--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.tv-ed__ghost:hover { background: var(--ed-fill-2); }

/* --------------------------------------------------------------- layout */
.tv-ed__body {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding: 18px 0 72px;
}
.tv-ed__side {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ---------------------------------------------------------------- cover */
.tv-ed__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  background: var(--ed-fill);
  margin-bottom: 10px;
}
.tv-ed__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.tv-ed__cover:hover img { transform: scale(1.02); }
.tv-ed__cover-none {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--room-dim);
}
.tv-ed__cover.is-empty .tv-ed__cover-none { display: grid; }
.tv-ed__cover-cam {
  position: absolute;
  right: 12px;
  bottom: 12px;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  backdrop-filter: blur(8px);
}
.tv-ed__cover.is-empty .tv-ed__cover-cam { background: var(--room-hl, var(--btn)); color: var(--room-on-hl, var(--on-btn)); backdrop-filter: none; }
.tv-ed__cover.is-busy { opacity: 0.55; pointer-events: none; }

/* ------------------------------------------------------------ the words */
.tv-ed__eye {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--room-dim);
}
.tv-ed__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--room-dim); flex: none; }
.tv-ed__dot.is-live { background: var(--ed-danger); box-shadow: 0 0 10px var(--ed-danger); animation: tv-cr-pulse 2s ease-in-out infinite; }
.tv-ed__name {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--on-room);
  font-family: var(--wide);
  font-size: clamp(34px, 3.4vw, 52px);
  font-weight: 900;
  font-stretch: 112%;
  letter-spacing: -0.025em;
  line-height: 1.02;
}
.tv-ed__name::placeholder, .tv-ed__desc::placeholder { color: var(--room-dim); opacity: 0.7; }
.tv-ed__name:hover, .tv-ed__desc:hover { background: var(--ed-fill); }
.tv-ed__desc {
  width: 100%;
  min-height: 30px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--room-text-2);
  font-family: var(--wide);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
  resize: none;
  overflow: hidden;
}
.tv-ed__saverow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tv-ed__stats { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; color: var(--room-dim); }
.tv-ed__block { display: flex; flex-direction: column; gap: 12px; padding-top: 22px; margin-top: 8px; border-top: 1.5px solid var(--ed-line); }
.tv-ed__note { font-size: 14px; line-height: 1.5; color: var(--room-dim); }
.tv-ed__note strong { color: var(--on-room); font-weight: 800; }
.tv-ed__access { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-ed__pill {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ed-fill);
  font-size: 15px;
  font-weight: 800;
}
.tv-ed__pill:hover { background: var(--ed-fill-2); }
.tv-ed button.tv-ed__pill.is-on { background: var(--on-room); color: var(--room); }
.tv-ed__draft { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tv-ed__danger { gap: 10px; }
.tv-ed__delete {
  align-self: flex-start;
  height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
}
.tv-ed button.tv-ed__delete { color: var(--ed-danger); }
.tv-ed__delete:hover { text-decoration: underline; text-underline-offset: 4px; }
.tv-ed__warn { font-size: 15px; font-weight: 700; line-height: 1.45; }

/* -------------------------------------------------------- running order */
.tv-ed__order { min-width: 0; }
.tv-ed__orderhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
}
.tv-ed__h {
  margin: 0 0 6px;
  font-family: var(--wide);
  font-size: 30px;
  font-weight: 900;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tv-ed__rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tv-ed__row {
  position: relative;
  display: grid;
  grid-template-columns: 40px 34px 176px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 6px;
  border-radius: 20px;
  background: var(--room);
  transition: background 0.14s ease;
}
.tv-ed__row:hover { background: var(--ed-fill); }
.tv-ed.is-dragging .tv-ed__row:not(.is-lifted) { transition: transform 0.18s ease; }
.tv-ed.is-dragging, .tv-ed.is-dragging * { cursor: grabbing !important; user-select: none; }
.tv-ed__row.is-lifted {
  z-index: 3;
  background: var(--set);
  box-shadow: 0 22px 50px var(--set-shadow), inset 0 0 0 2px var(--room-hl);
}
.tv-ed__grip {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--room-dim);
  cursor: grab !important;
  touch-action: none;
}
.tv-ed__grip:hover { background: var(--ed-fill); color: var(--on-room); }
.tv-ed__num { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--room-dim); text-align: right; }
.tv-ed__thumb {
  position: relative;
  display: block;
  width: 176px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0b0b0c;
}
.tv-ed__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tv-ed__kindmark {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.tv-ed__thumb.is-none .tv-ed__kindmark { display: grid; }
.tv-ed__dur {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.tv-ed__copy { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.tv-ed__kind { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--room-dim); }
.tv-ed__title {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: text !important;
}
.tv-ed__title:hover { text-decoration: underline; text-decoration-color: var(--room-dim); text-underline-offset: 4px; }
.tv-ed__titleinput {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ed-fill);
  color: var(--on-room);
  font-family: var(--wide);
  font-size: 17px;
  font-weight: 700;
}
.tv-ed__tools { display: flex; align-items: center; gap: 6px; }
.tv-ed__wait { padding: 30px 4px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; color: var(--room-dim); }
.tv-ed__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 36px 0; }
.tv-ed__empty-title { font-size: 26px; font-weight: 900; font-stretch: 112%; letter-spacing: -0.02em; }

/* The narrower editor: a ~700px Split View pane or a small window. */
@container tved (max-width: 980px) {
  .tv-ed__body { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .tv-ed__side { position: static; }
  .tv-ed__cover { max-width: 560px; }
}
@container tved (max-width: 640px) {
  .tv-ed__row { grid-template-columns: 34px 124px minmax(0, 1fr); grid-template-areas: "grip thumb copy" "grip tools tools"; gap: 8px 12px; padding: 10px 8px 10px 2px; }
  .tv-ed__grip { grid-area: grip; width: 34px; }
  .tv-ed__num { display: none; }
  .tv-ed__thumb { grid-area: thumb; width: 124px; }
  .tv-ed__copy { grid-area: copy; }
  .tv-ed__tools { grid-area: tools; justify-content: flex-end; }
  .tv-ed__title { font-size: 16px; }
  .tv-ed__orderhead { flex-wrap: wrap; align-items: center; }
  .tv-ed__name { font-size: 34px; }
}

/* ---------------------------------------------- control room additions */
/* The owner's Watch on a monitor: tapping the monitor edits it. */
.tv-cr__play {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 15px;
  background: var(--btn);
  color: var(--on-btn);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tv-cr__play:hover { filter: brightness(1.12); }
.tv-cr__play:focus-visible { outline: 3px solid var(--room-hl); outline-offset: 2px; }

/* The name and its line are the page's own headline, edited in place --
   not the near-white field page-colors.css gives every input on a page
   colour. (:not(#x) lifts these over its :root[data-page-color]:not(#pc).) */
:root:not(#x) .tv-ed #tv-ed-name,
:root:not(#x) .tv-ed #tv-ed-desc { background-color: transparent; color: var(--on-room); }
:root:not(#x) .tv-ed #tv-ed-desc { color: var(--room-text-2); }
:root:not(#x) .tv-ed #tv-ed-name:hover,
:root:not(#x) .tv-ed #tv-ed-desc:hover,
:root:not(#x) .tv-ed #tv-ed-name:focus,
:root:not(#x) .tv-ed #tv-ed-desc:focus { background-color: var(--ed-fill); }
:root:not(#x) .tv-ed :is(#tv-ed-name, #tv-ed-desc)::placeholder { color: var(--room-dim); opacity: 0.8; }
