/* THE SIMPLE AD EDITOR (Basecamp 10511347167), public/clean-edit.js.
   The preview and the timeline sit on one dark console, the machine's own
   panel; the changes and the producer's box are ordinary clean cards under
   it. Every rule is scoped to the clean layout (tests/clean-layout.test.mjs). */

html[data-layout="clean"] .ce {
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; max-width: 1160px; margin: 0 auto; min-width: 0;
}
html[data-layout="clean"] .ce-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
}
html[data-layout="clean"] .ce-head-l { grid-column: 1 / -1; min-height: 0; }
html[data-layout="clean"] .ce-head-l .cl-back { display: inline-flex; }
html[data-layout="clean"] .ce-title { font-size: 24px; min-width: 0; }
html[data-layout="clean"] .ce-save { white-space: nowrap; }
/* A phone: no room for a title beside the button, and the console is what
   says where you are. The button takes the whole row under the way back. */
@media (max-width: 599px) {
  html[data-layout="clean"] .ce-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[data-layout="clean"] .ce-head { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  html[data-layout="clean"] .ce-save { width: 100%; }
  html[data-layout="clean"] .ce-frame { height: min(36vh, 520px); height: min(36svh, 520px); }
}
html[data-layout="clean"] .ce-save:disabled { opacity: 0.45; cursor: default; }
html[data-layout="clean"] .ce-notice {
  margin: 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--amber-wash); color: var(--ink); font-size: 15.5px; line-height: 1.4;
}
html[data-layout="clean"] .ce-notice[hidden],
html[data-layout="clean"] .ce-meter[hidden],
html[data-layout="clean"] .ce-say[hidden],
html[data-layout="clean"] .ce-tray[hidden],
html[data-layout="clean"] .ce-changes[hidden] { display: none; }
html[data-layout="clean"] .ce-meter {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px;
}
html[data-layout="clean"] .ce-none-acts { margin: 0 0 14px; padding: 0 22px; }

/* ---------- the console: preview over timeline ---------- */
html[data-layout="clean"] .ce-console {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  background: var(--panel); color: var(--panel-ink);
  border-radius: var(--radius); padding: 14px 0 10px;
}
html[data-layout="clean"] .ce-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; }
html[data-layout="clean"] .ce-frame {
  position: relative; overflow: hidden; background: #000;
  height: min(46vh, 520px); height: min(46svh, 520px); aspect-ratio: 9 / 16; max-width: 100%;
  border-radius: 6px; box-shadow: 0 0 0 1px rgba(239, 232, 218, 0.12);
}
html[data-layout="clean"] .ce-frame video,
html[data-layout="clean"] .ce-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
html[data-layout="clean"] .ce-frame [hidden] { display: none; }
html[data-layout="clean"] .ce-cap {
  position: absolute; left: 8%; right: 8%; bottom: 18%;
  text-align: center; font-family: var(--font-text); font-weight: 800;
  font-size: 17px; line-height: 1.2; color: #fff; text-wrap: balance;
  text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
html[data-layout="clean"] .ce-cap[hidden] { display: none; }
html[data-layout="clean"] .ce-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  background: rgba(23, 20, 15, 0.62); color: #fff;
  transition: opacity .2s;
}
html[data-layout="clean"] .ce-play svg { width: 26px; height: 26px; }
html[data-layout="clean"] .ce-play:hover { background: rgba(23, 20, 15, 0.82); }
html[data-layout="clean"] .ce-playing .ce-play { opacity: 0; }
html[data-layout="clean"] .ce-playing .ce-frame:hover .ce-play,
html[data-layout="clean"] .ce-playing .ce-play:focus-visible { opacity: 1; }
html[data-layout="clean"] .ce-time {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.04em; color: var(--panel-ink);
  font-variant-numeric: tabular-nums;
}
html[data-layout="clean"] .ce-time [data-now] { color: var(--panel-ink-strong); }

/* ---------- the timeline ---------- */
html[data-layout="clean"] .ce-deck { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
html[data-layout="clean"] .ce-tl { position: relative; min-width: 0; }
html[data-layout="clean"] .ce-scroll {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: none; touch-action: pan-x; outline: none;
  -webkit-user-select: none; user-select: none;
}
html[data-layout="clean"] .ce-scroll::-webkit-scrollbar { display: none; }
html[data-layout="clean"] .ce-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--panel-ink); }
html[data-layout="clean"] .ce-track { position: relative; height: 168px; min-width: 100%; }
html[data-layout="clean"] .ce-ruler { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
html[data-layout="clean"] .ce-tick {
  position: absolute; top: 10px; width: 1px; height: 5px; background: rgba(239, 232, 218, 0.28);
  font-family: var(--font-mono); font-size: 10px; color: rgba(239, 232, 218, 0.55);
}
html[data-layout="clean"] .ce-tick.big { top: 0; height: 15px; padding-left: 4px; line-height: 10px; background: rgba(239, 232, 218, 0.4); white-space: nowrap; }
html[data-layout="clean"] .ce-lane { position: absolute; left: 0; right: 0; }
html[data-layout="clean"] .ce-lane-b { top: 22px; height: 44px; }
html[data-layout="clean"] .ce-lane-a { top: 70px; height: 58px; }
html[data-layout="clean"] .ce-lane-s { top: 132px; height: 30px; }

html[data-layout="clean"] .ce-clip {
  position: absolute; top: 0; bottom: 0; box-sizing: border-box;
  border-radius: 5px; overflow: hidden; cursor: pointer; outline: none;
  touch-action: pan-x;
}
html[data-layout="clean"] .ce-clip:focus-visible { box-shadow: 0 0 0 2px var(--panel-ink-strong); }
html[data-layout="clean"] .ce-a {
  background: #efe8da; color: #17140f; border: 1px solid rgba(23, 20, 15, 0.35);
  padding: 6px 10px; display: flex; align-items: center;
}
html[data-layout="clean"] .ce-words {
  font-size: 13.5px; line-height: 1.25; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  pointer-events: none;
}
html[data-layout="clean"] .ce-b { background: #3a3329; border: 1px solid rgba(239, 232, 218, 0.22); }
html[data-layout="clean"] .ce-film {
  position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; background-position: left center;
  opacity: 0.9; pointer-events: none;
}
html[data-layout="clean"] .ce-film video { width: 100%; height: 100%; object-fit: cover; display: block; }
html[data-layout="clean"] .ce-film:not([style]) {
  background-image: repeating-linear-gradient(90deg, rgba(239, 232, 218, 0.1) 0 26px, rgba(239, 232, 218, 0.03) 26px 30px);
}
html[data-layout="clean"] .ce-btitle {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 7px;
  font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); pointer-events: none;
}
/* Picked: a white ring, and it owns the touch so a drag moves it. */
html[data-layout="clean"] .ce-clip.on { box-shadow: 0 0 0 2px #fff; z-index: 2; touch-action: none; cursor: grab; }
html[data-layout="clean"] .ce-a.on { cursor: default; padding: 6px 22px; }
html[data-layout="clean"] .ce-grip {
  display: none; position: absolute; top: 0; bottom: 0; width: 18px;
  background: #fff; cursor: ew-resize; touch-action: none;
}
html[data-layout="clean"] .ce-grip::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 18px; margin: -9px 0 0 -1px;
  border-radius: 1px; background: #17140f;
}
html[data-layout="clean"] .ce-grip-in { left: 0; border-radius: 4px 0 0 4px; }
html[data-layout="clean"] .ce-grip-out { right: 0; border-radius: 0 4px 4px 0; }
html[data-layout="clean"] .ce-a.on .ce-grip,
html[data-layout="clean"] .ce-b.on .ce-grip { display: block; }
/* Changing which part of a video plays: the clip stays put, its footage slides. */
html[data-layout="clean"] .ce-slipping .ce-b.on .ce-grip { display: none; }
html[data-layout="clean"] .ce-slipping .ce-b.on { cursor: ew-resize; box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(239, 232, 218, 0.35); }
html[data-layout="clean"] .ce-console .ce-slip[aria-pressed="true"] { background: var(--panel-ink-strong); color: #17140f; border-color: var(--panel-ink-strong); }
/* A bigger target than the drawing, for a thumb. */
html[data-layout="clean"] .ce-grip::before { content: ""; position: absolute; top: -8px; bottom: -8px; left: -10px; right: -10px; }

html[data-layout="clean"] .ce-wave {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; gap: 2px; overflow: hidden;
  border-radius: 4px; background: rgba(121, 181, 135, 0.12); padding: 0 2px; box-sizing: border-box;
}
html[data-layout="clean"] .ce-wave i { flex: 0 0 3px; border-radius: 1px; background: #79b587; opacity: 0.85; }

/* The playhead: fixed in the middle, the record red. */
html[data-layout="clean"] .ce-head-line {
  position: absolute; left: 50%; top: -4px; bottom: -2px; width: 2px; margin-left: -1px;
  background: var(--cl-rec); pointer-events: none; z-index: 3;
}
html[data-layout="clean"] .ce-head-line::before {
  content: ""; position: absolute; left: -5px; top: 0; width: 12px; height: 8px;
  background: var(--cl-rec); clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* ---------- the bar under the timeline ---------- */
html[data-layout="clean"] .ce-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 0 16px; min-height: 44px;
}
html[data-layout="clean"] .ce-add {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 10px;
  border-radius: 999px; border: 0; cursor: pointer;
  background: var(--panel-ink-strong); color: #17140f;
  font-family: var(--font-text); font-size: 15px; font-weight: 700;
}
html[data-layout="clean"] .ce-add svg { width: 20px; height: 20px; }
html[data-layout="clean"] .ce-add:hover { background: #fff; }
html[data-layout="clean"] .ce-sel { display: contents; }
html[data-layout="clean"] .ce-console .ce-act {
  background: transparent; color: var(--panel-ink-strong); border-color: rgba(239, 232, 218, 0.36);
  font-size: 14.5px; padding: 8px 14px;
}
html[data-layout="clean"] .ce-console .ce-act:hover { background: rgba(239, 232, 218, 0.08); border-color: rgba(239, 232, 218, 0.7); color: var(--panel-ink-strong); }
html[data-layout="clean"] .ce-console .ce-act:disabled { opacity: 0.4; cursor: default; }
html[data-layout="clean"] .ce-hint { flex-basis: 100%; order: 5; font-size: 13.5px; color: rgba(239, 232, 218, 0.7); }
html[data-layout="clean"] .ce-zoom { margin-left: auto; display: flex; gap: 2px; }
html[data-layout="clean"] .ce-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
html[data-layout="clean"] .ce-icon svg { width: 21px; height: 21px; }
html[data-layout="clean"] .ce-console .ce-icon:hover { background: rgba(239, 232, 218, 0.1); }
html[data-layout="clean"] .ce-say { margin: 0; padding: 0 16px; font-size: 14px; color: var(--panel-ink); }
html[data-layout="clean"] .ce-busy .ce-scroll { opacity: 0.75; }
html[data-layout="clean"] .ce-cutting .ce-deck,
html[data-layout="clean"] .ce-cutting .ce-lower { pointer-events: none; opacity: 0.55; }

/* ---------- changes and the producer ---------- */
html[data-layout="clean"] .ce-lower { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
html[data-layout="clean"] .ce-lower .cl-card { padding: 16px 18px 12px; gap: 8px; }
/* The global h2 is a dashed section break; inside these cards it is the card's name. */
html[data-layout="clean"] .ce h2,
html[data-layout="clean"] .ce-tray h2 { border-top: 0; margin: 0; padding-top: 0; }
html[data-layout="clean"] .ce-change-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
html[data-layout="clean"] .ce-change {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--rule-soft);
}
html[data-layout="clean"] .ce-change-say { font-size: 16px; line-height: 1.35; color: var(--ink); min-width: 0; flex: 1 1 200px; }
html[data-layout="clean"] .ce-by {
  display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 3px; vertical-align: 1px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink-2);
}
html[data-layout="clean"] .ce-undo { font-size: 14.5px; min-height: 36px; }
html[data-layout="clean"] .ce-hist {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; min-height: 32px;
}
html[data-layout="clean"] .ce-hist::-webkit-details-marker { display: none; }
html[data-layout="clean"] .ce-hist-n { font-family: var(--font-text); font-size: 14.5px; letter-spacing: normal; text-transform: none; color: var(--muted); }
html[data-layout="clean"] .ce-changes[open] { display: flex; flex-direction: column; }
html[data-layout="clean"] .ce-reset { align-self: flex-start; font-size: 14.5px; color: var(--muted); }
html[data-layout="clean"] .ce-ask-form { display: flex; flex-direction: column; gap: 10px; }
html[data-layout="clean"] .ce-ask-row { display: flex; align-items: flex-start; gap: 8px; }
html[data-layout="clean"] .ce-ask-text {
  flex: 1 1 auto; min-width: 0; resize: vertical; min-height: 64px;
  font-family: var(--font-text); font-size: 16px; line-height: 1.4; color: var(--ink);
  background: var(--surface); border: 1px solid var(--cl-line); border-radius: var(--radius-btn); padding: 10px 12px;
}
html[data-layout="clean"] .ce-ask-text:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
html[data-layout="clean"] .ce-mic { border: 1px solid var(--cl-line); width: 46px; height: 46px; color: var(--ink); }
html[data-layout="clean"] .ce-mic[hidden] { display: none; }
html[data-layout="clean"] .ce-mic:hover { background: var(--paper-4); }
html[data-layout="clean"] .ce-mic.on { background: var(--cl-rec); border-color: var(--cl-rec); color: #fff; animation: ce-listen 1.4s ease-in-out infinite; }
@keyframes ce-listen { 50% { box-shadow: 0 0 0 6px rgba(224, 74, 50, 0.18); } }
html[data-layout="clean"] .ce-ask-acts { display: flex; }
html[data-layout="clean"] .ce-reply:empty { display: none; }
html[data-layout="clean"] .ce-reply { border-top: 1px dashed var(--cl-line); padding-top: 10px; }
html[data-layout="clean"] .ce-reply-say { margin: 0 0 6px; font-size: 16px; line-height: 1.45; color: var(--ink); }
html[data-layout="clean"] .ce-reply-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
html[data-layout="clean"] .ce-reply-list li { position: relative; padding-left: 18px; font-size: 15px; line-height: 1.4; color: var(--ink-2); }
html[data-layout="clean"] .ce-reply-list li::before {
  content: ""; position: absolute; left: 0; top: 0.45em; width: 8px; height: 8px; border-radius: 2px;
}
html[data-layout="clean"] .ce-done::before { background: var(--cl-lamp-ok); }
html[data-layout="clean"] .ce-not::before { background: var(--amber); }

/* ---------- the clip tray ---------- */
html[data-layout="clean"].ce-tray-open body { overflow: hidden; }
html[data-layout="clean"] .ce-tray { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
html[data-layout="clean"] .ce-tray-scrim { position: absolute; inset: 0; background: var(--scrim); }
html[data-layout="clean"] .ce-tray-sheet {
  position: relative; width: 100%; max-width: 720px; max-height: 82vh; max-height: 82svh;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-radius: 14px 14px 0 0; padding: 8px 16px calc(12px + var(--safe-b, 0px));
  box-shadow: var(--shadow-lift);
}
html[data-layout="clean"] .ce-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
html[data-layout="clean"] .ce-tray-title {
  margin: 0; font-family: var(--font-text); font-size: 19px; font-weight: 700;
  letter-spacing: normal; text-transform: none; color: var(--ink);
}
html[data-layout="clean"] .ce-tray-head .ce-icon:hover { background: var(--paper-4); }
html[data-layout="clean"] .ce-tray-grid {
  flex: 1 1 auto; overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 4px 0 10px;
}
html[data-layout="clean"] .ce-tile {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 0; min-width: 0;
  background: none; border: 0; cursor: pointer; color: var(--ink); font-family: var(--font-text);
}
html[data-layout="clean"] .ce-tile-pic {
  position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden;
  background: var(--paper-2); box-shadow: 0 0 0 1px var(--rule);
}
html[data-layout="clean"] .ce-tile-pic img,
html[data-layout="clean"] .ce-tile-pic video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
html[data-layout="clean"] .ce-tile-pic [hidden] { display: none; }
html[data-layout="clean"] .ce-tile[aria-pressed="true"] .ce-tile-pic { box-shadow: 0 0 0 3px var(--ink); }
html[data-layout="clean"] .ce-tile-now {
  position: absolute; left: 4px; top: 4px; padding: 1px 5px; border-radius: 3px;
  background: rgba(23, 20, 15, 0.75); color: #fff; font-size: 11px; font-weight: 600;
}
html[data-layout="clean"] .ce-tile-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
html[data-layout="clean"] .ce-tile-len { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
html[data-layout="clean"] .ce-tray-none { grid-column: 1 / -1; padding: 10px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
html[data-layout="clean"] .ce-tray-none p { margin: 0; font-size: 16px; color: var(--ink-2); }
html[data-layout="clean"] .ce-tray-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap;
  border-top: 1px solid var(--rule-soft); padding-top: 10px;
}
html[data-layout="clean"] .ce-tray-say { margin: 0; font-size: 14.5px; color: var(--muted); flex: 1 1 180px; }
html[data-layout="clean"] .ce-tray-foot .btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- a desk ---------- */
@media (min-width: 900px) {
  html[data-layout="clean"] .view:has(.ce) { max-width: 1160px; padding: 28px 40px 48px; }
  html[data-layout="clean"] .ce-head { padding-right: 56px; }
  html[data-layout="clean"] .ce-title { font-size: 30px; }
  html[data-layout="clean"] .ce-console {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 8px; padding: 18px 0 14px;
  }
  html[data-layout="clean"] .ce-stage { padding: 0 8px 0 20px; }
  html[data-layout="clean"] .ce-frame { height: min(60vh, 540px); }
  html[data-layout="clean"] .ce-track { height: 200px; }
  html[data-layout="clean"] .ce-lane-b { top: 24px; height: 54px; }
  html[data-layout="clean"] .ce-lane-a { top: 84px; height: 70px; }
  html[data-layout="clean"] .ce-lane-s { top: 160px; height: 34px; }
  html[data-layout="clean"] .ce-lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 20px; }
  html[data-layout="clean"] .ce-lower .ce-ask { grid-column: 1; grid-row: 1; }
  html[data-layout="clean"] .ce-lower .ce-changes { grid-column: 2; grid-row: 1; }
  html[data-layout="clean"] .ce-tray { align-items: center; }
  html[data-layout="clean"] .ce-tray-sheet { border-radius: 12px; max-height: 76vh; padding-bottom: 14px; }
  html[data-layout="clean"] .ce-tray-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-layout="clean"] .ce-mic.on { animation: none; }
}
