/* The run page's script column, update banner and toast. Tokens come from
   the shared sage landing theme. */
:root { --editor-ease: cubic-bezier(.2, .8, .2, 1); }

.run .text-button, .run .text-link { transition: background 150ms, border-color 150ms, color 150ms, transform 150ms; }
.run button:active:not(:disabled) { transform: translateY(1px); }
.run :focus-visible, .history :focus-visible { outline: 2px solid var(--sage-strong); outline-offset: 3px; }

.run .spread { gap: 20px; }
.run .script, .run .film { border-radius: 12px; }
.script-header { padding: 21px 22px 16px; font-size: 14px; }
.script-header > span:first-child { color: var(--ink); font-weight: 500; }
.run .script { display: flex; flex-direction: column; }
.run .script-header { flex: none; }
.run .script-scroll { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; margin: 0 10px; padding: 0 6px; }
.run .script-footer { position: sticky; bottom: 12px; left: auto; right: auto; order: 3; flex: none; margin: 8px 16px 16px; }
.run .script-footer[hidden] { display: none; }
.run .scene, .run .scene:last-child { padding: 14px 12px; border-top: 0; margin-bottom: 6px; }
.run .scene::before { inset: 0; border-radius: 8px; }
.run .scene-heading { padding-left: 0; grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; align-items: start; }
.run .scene-number { position: static; grid-column: 1; grid-row: 1 / span 2; width: 32px; height: 32px; font-size: 12px; }
.run .scene-title { grid-column: 2; grid-row: 1; }
.run .scene-heading .status-word { grid-column: 3; grid-row: 1; margin-top: 2px; }
.run .scene-duration { display: block; grid-column: 2; grid-row: 2; margin: 0; font-size: 10px; }
.run .scene-card, .run .scene-failure, .run .scene-chips { margin-left: 44px; }
.scene-title { color: var(--ink); line-height: 1.5; }
.scene-number { transition: background 180ms, color 180ms, border-color 180ms; }
.scene.is-current .scene-number { background: var(--sage); color: var(--paper); border-color: var(--sage); }
.scene-heading:hover .scene-number { border-color: var(--sage); }
.scene-heading .status-word.is-ready { color: var(--sage-strong); background: color-mix(in srgb, var(--sage) 13%, transparent); }

/* The panel's type scale: a small section label over the list, scene titles
   at a clear body weight, lengths in tabular figures so the times line up
   down the column, and one calm but unmistakable mark on the scene playing. */
.run .script-header { align-items: baseline; }
.run .script-header > span:first-child { font: 600 13.5px/1.4 var(--sans); letter-spacing: -.008em; color: var(--ink-2); }
.run #scene-count { font: 400 11px/1.5 var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.run .scene-title { font: 500 14px/1.45 var(--sans); color: var(--ink); }
.run .scene-heading:hover .scene-title { color: var(--ink-2); }
.run .scene-duration { font: 400 11px/16px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-4); }
.run .scene-number { border-radius: 8px; font: 500 12px/1 var(--sans); font-variant-numeric: tabular-nums; }
.run .scene.is-current::before { background: color-mix(in srgb, var(--sage) 11%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sage) 28%, transparent); }
.run .scene.is-current .scene-title { color: var(--ink); }

.script-footer { gap: 8px; }
.script-footer .text-button { border-style: dashed; border-color: var(--line-2); color: var(--ink-2); border-radius: 7px; }
.script-footer .text-button:hover { border-color: var(--sage); color: var(--ink); background: color-mix(in srgb, var(--sage) 7%, transparent); }
.under-frame { align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; min-height: 60px; }
#download-final:hover { background: var(--paper-2); border-color: var(--sage); }
#download-final { margin-left: auto; min-height: 38px; padding: 8px 12px; font-size: 12px; text-decoration: none; }
.narration-warning { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line-2); border-radius: 8px; }
.narration-warning[hidden] { display: none; }
.narration-warning > p:first-child { flex: 1 1 220px; margin: 0; color: var(--ink-2); font: 400 12px/1.6 var(--sans); }

.video-update { border-radius: 10px; border-color: color-mix(in srgb, var(--sage) 45%, var(--line)); gap: 16px; }
.video-update::before { content: ''; width: 7px; height: 7px; flex: none; background: var(--sage); border-radius: 50%; }
.video-update p { flex: 1; }

/* The update banner: honest copy, retry only when it can work. */
.video-update-actions { display: flex; gap: 12px; align-items: center; flex: none; }
.video-update.is-failed { border-color: color-mix(in srgb, var(--oxide) 40%, var(--line)); }
.video-update.is-failed::before { background: var(--oxide); }
.video-update .text-link { font-size: 12px; }
.video-update .scene-retry[hidden], .video-update .text-link[hidden] { display: none; }

/* Rows: chips say what arrived with a version; the card holds the words. */
.scene-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.scene-chips:empty { display: none; }
.chip-tag { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font: 500 10px/1.5 var(--sans); letter-spacing: .02em; }
.chip-tag.is-new { border-color: var(--sage); background: var(--sage); color: var(--paper); }
.chip-tag.is-note { color: var(--ink-3); border-style: dashed; }
.scene-heading .status-word.is-unchanged { color: var(--ink-4); border-color: transparent; }
.scene-card { margin-top: 6px; }
.scene-card > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 0; color: var(--ink-3); font: 500 12px/1.4 var(--sans); cursor: pointer; list-style: none; }
.scene-card > summary::-webkit-details-marker { display: none; }
/* The disclosure turns a chevron rather than a text triangle. */
.scene-card > summary > .icon { flex: none; color: var(--ink-4); transition: transform 150ms var(--editor-ease); }
.scene-card[open] > summary > .icon { transform: rotate(90deg); }
.scene-card > summary:hover > .icon { color: var(--ink-2); }
.scene-card > summary:hover { color: var(--ink); }
.scene-card[hidden] { display: none; }
.scene-card-body { padding: 6px 0 4px; }
.scene-card[open] .scene-card-body { animation: editor-reveal 160ms var(--editor-ease); }
.scene-card.is-readonly .scene-beats .beat { margin-left: 0; }
.scene-card-note { margin: 10px 0 0; color: var(--ink-3); font: 400 11px/1.55 var(--sans); }
.scene-card-note:empty { display: none; }
.scene.is-extra .scene-heading { display: grid; cursor: default; }
.scene.is-extra .scene-number { border-style: dashed; color: var(--ink-3); }

/* A toast for what just happened, with one action. */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; display: flex; align-items: center; gap: 16px; box-sizing: border-box; width: max-content; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font: 400 13px/1.5 var(--sans); box-shadow: 0 12px 36px #0004; transform: translateX(-50%); animation: toast-in 220ms var(--editor-ease); }
.toast[hidden] { display: none; }
.toast .text-link { color: var(--paper); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast .text-link[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }

.history .sheet-header { border-bottom-color: var(--line); }
.history .sheet-title { font-size: 32px; letter-spacing: -.02em; }
.history .filter { border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); padding: 12px 14px; font: 400 13px/1.5 var(--sans); }
.history .sheet-filter { padding-block: 20px 10px; }
.history .history-empty { color: var(--ink-3); font: 400 14px/1.7 var(--sans); text-align: center; padding: 40px 18px; }
.history .row:hover { background: color-mix(in srgb, var(--sage) 8%, var(--paper)); }
.history .row-question { font-size: 14px; }
.history .row { border-radius: 8px; }
.row-menu-actions { border-radius: 8px; }
.row-menu-actions button { border-radius: 4px; }

@keyframes editor-reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .run .spread { gap: 14px; }
  .scene-card > summary { min-height: 36px; }
  .video-update { gap: 10px; padding: 12px; font-size: 12px; }
  .under-frame { gap: 8px; }
  #download-final { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-card[open] .scene-card-body, .toast { animation: none !important; }
}
