.reel-switch {
  display: flex;
  gap: 6px;
  width: min(836px, 100%);
  margin: 0 auto 14px;
}
.reel-switch .sd-tab.is-on {
  background: #e8f1ff;
  border-color: #c6dbfb;
  color: #174c9e;
  box-shadow: none;
}
.reel-switch[hidden], .reel-editor [hidden], .reel-editor[hidden],
html[data-reel-editor="off"] [data-v-edit],
.studio.is-editing-video #sdGrid, .studio.is-editing-video #sdPlan,
.studio.is-editing-video #sdNote { display: none !important; }
.studio.is-editing-video .sd-head { align-items: flex-start; margin-bottom: 12px; }
.studio.is-editing-video .sd-title { font-size: clamp(20px, 2.8vw, 28px); }

.reel-editor {
  --reel-card: #fff;
  --reel-line: #e6e9f0;
  --reel-inset: #fff;
  --reel-tile: #f5f7fc;
  --reel-tile-hover: #eaf0fb;
  --reel-console-bg: radial-gradient(ellipse 60% 140% at 50% 0%, rgba(37, 99, 201, .12), transparent 70%),
    linear-gradient(180deg, #f3f6fc, #fbfcfe);
  display: grid;
  gap: 12px;
  width: min(836px, 100%);
  margin: 0 auto 20px;
  color: var(--ink);
}
html[data-theme="dark"] .reel-editor {
  --reel-card: #171a21;
  --reel-line: #262a34;
  --reel-inset: #12151c;
  --reel-tile: #1a1f2a;
  --reel-tile-hover: #222b3a;
  --reel-console-bg: radial-gradient(ellipse 60% 120% at 50% 0%, rgba(58, 120, 216, .16), transparent 70%),
    linear-gradient(180deg, #1b1f28, #171a21);
}
.reel-project-summary, .reel-panel-head, .reel-footer, .reel-play, .reel-clip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.reel-editor h3, .reel-editor h4, .reel-editor p { margin: 0; }
.reel-footer p, .reel-hint, .reel-panel-head > span, .reel-play > span, .reel-clip-length {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.reel-editor .btn { min-height: 38px; white-space: nowrap; font-size: 12px; }
.reel-editor .btn:disabled { cursor: default; opacity: .45; }
.reel-assistant {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--reel-line);
  border-radius: 22px;
  background: var(--reel-card);
}
.reel-console {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 10px 10px;
  background: var(--reel-console-bg);
  border: 1px solid var(--reel-line);
  border-radius: 18px;
}
.reel-editor .reel-console-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.reel-console-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5484d;
}
.reel-console-title:focus { outline: none; }
.reel-project-summary, .reel-examples {
  min-width: 0;
  border: 1px solid var(--reel-line);
  border-radius: 14px;
  background: var(--reel-inset);
}
.reel-project-summary { padding: 10px 12px; }
.reel-project-summary > div { display: grid; gap: 2px; min-width: 0; }
.reel-project-summary span { color: var(--muted); font-size: 11px; }
.reel-project-summary strong { font-size: 14px; }
.reel-editor .reel-project-summary .btn,
.reel-editor .reel-examples .btn {
  border: 1px solid transparent;
  background: var(--reel-tile);
  color: var(--ink);
}
.reel-editor .reel-project-summary .btn:hover:not(:disabled),
.reel-editor .reel-examples .btn:hover:not(:disabled) { background: var(--reel-tile-hover); }
.reel-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  margin: 0;
}
.reel-editor .reel-examples .btn {
  min-width: 0;
  padding: 5px;
  white-space: normal;
  line-height: 1.45;
}
.reel-entry { display: grid; gap: 6px; min-width: 0; padding: 0 4px; }
.reel-assistant textarea:placeholder-shown { direction: rtl; }
.reel-assistant-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reel-entry .reel-assistant-actions { justify-content: flex-end; }
.reel-assistant [data-reel-shot]:empty { display: none; }
.reel-draft, .reel-shot-form {
  display: grid;
  gap: 8px;
  padding: 11px;
  background: var(--reel-inset);
  border: 1px solid var(--reel-line);
  border-radius: 12px;
  font-size: 13px;
}
.reel-draft small { color: var(--muted); }
.reel-draft ol { margin: 0; padding-inline-start: 20px; }
.reel-draft p:empty { display: none; }
.reel-shot-form label { display: grid; gap: 4px; min-width: 0; }
.reel-shot-options, .reel-fit {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--reel-line);
  border-radius: 14px;
  background: var(--reel-inset);
  padding: 5px;
  margin: 0;
}
.reel-shot-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.reel-editor .reel-shot-choice {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 46px;
  padding: 5px;
  border: 0;
  border-radius: 12px;
  background: var(--reel-tile);
  color: var(--ink);
}
.reel-editor .reel-shot-choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.reel-editor .reel-shot-choice[aria-expanded="true"] {
  background: linear-gradient(180deg, #3a78d8, #1f4f9e);
  color: #fff;
}
.reel-shot-choice-label { font-size: 11px; font-weight: 650; }
.reel-shot-choice-value {
  display: block;
  position: relative;
  max-width: 100%;
  padding-inline-end: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}
.reel-shot-choice-value::after {
  content: "";
  position: absolute;
  inset-inline-end: 2px;
  top: 45%;
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-50%) rotate(45deg);
  opacity: .55;
}
.reel-shot-pop .vopt-check { justify-content: center; }
.reel-shot-reference {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--reel-line);
  border-radius: 12px;
  background: var(--reel-card);
}
.reel-shot-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.reel-shot-file small { display: block; margin-top: 2px; color: var(--muted); }
.reel-shot-preview.att-preview { width: 100px; height: 100px; cursor: default; }
.reel-shot-preview.att-preview button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  font-size: 18px;
  cursor: pointer;
}
.reel-shot-confirm.video-confirm-card {
  position: fixed;
  inset: auto 0 calc(12px + env(safe-area-inset-bottom, 0px)) 0;
  width: min(calc(100% - 24px), 420px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  opacity: 1;
  transform: none;
  overflow: auto;
}
.reel-shot-confirm::backdrop {
  background: rgba(15, 15, 19, .45);
  backdrop-filter: blur(3px);
}
html[data-theme="dark"] .reel-shot-confirm::backdrop { background: rgba(0, 0, 0, .55); }
.media-video-card .media-video-bar { flex-wrap: wrap; }
.reel-shot-confirm .video-confirm-cost { margin: 0 0 16px; }
.reel-shot-fallback { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reel-shot-fallback a { color: var(--ink); text-decoration: underline; }
.reel-cue-label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); }
.reel-editor :is(button, input, textarea, select):focus-visible { outline: 2px solid var(--accent, #3a78d8); outline-offset: 2px; }
.reel-workspace { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.reel-preview, .reel-panel, .reel-footer {
  min-width: 0;
  border: 1px solid var(--reel-line);
  border-radius: 16px;
  padding: 12px;
  background: var(--reel-card);
}
.reel-preview { display: grid; gap: 8px; }
.reel-stage {
  position: relative;
  isolation: isolate;
  width: min(100%, 210px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #12141a;
  color: #fff;
  container-type: inline-size;
}
.reel-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.reel-stage video.is-cover { object-fit: cover; }
.reel-empty { display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 12px; gap: 7px; }
.reel-empty span { font-size: 11px; color: #b1b6c2; }
.reel-overlay {
  position: absolute;
  inset-inline: 9.6%;
  bottom: 21.5%;
  color: white;
  text-align: center;
  font-size: 5cqw;
  font-weight: 800;
  text-shadow: 0 1px 2px #000, 1px 0 2px #000, -1px 0 2px #000;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.reel-title-overlay { top: 13.5%; bottom: auto; font-size: 6cqw; }
.reel-preview input[type="range"] { width: 100%; min-width: 0; margin: 0; }
.reel-controls, .reel-panel, .reel-timeline, .reel-captions { display: grid; gap: 8px; min-width: 0; }
.reel-panel h4 { font-size: 14px; }
.reel-timeline, .reel-captions { border: 0; margin: 0; padding: 0; }
.reel-strip { display: flex; gap: 4px; direction: ltr; }
.reel-strip:empty { display: none; }
.reel-strip > button {
  flex-basis: 0; min-width: 30px; min-height: 32px; padding: 1px;
  border: 1px solid var(--stroke); border-radius: 8px; background: var(--hover);
  color: var(--ink); font: inherit; font-size: 12px; cursor: pointer;
}
.reel-strip > button[aria-pressed="true"] {
  border-color: #3374cd; background: color-mix(in srgb, #3374cd 17%, var(--bg));
}
.reel-captions { max-height: 310px; overflow: auto; }
.reel-clip, .reel-cue {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}
.reel-clip.is-active { border-color: color-mix(in srgb, #377cdc 65%, var(--stroke)); }
.reel-clip-name {
  display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 80%;
  background: none; color: inherit; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 12px;
}
.reel-clip-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel-clip-index {
  display: grid; place-items: center; min-width: 24px; min-height: 24px;
  border-radius: 8px; background: var(--hover); font-weight: 800;
}
.reel-clip-length { white-space: nowrap; }
.reel-clip-actions, .reel-cue-times, .reel-order, .reel-footer-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.reel-caption-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.reel-editor :is(.reel-caption-actions .btn, .reel-shot-secondary) {
  border: 1px solid var(--reel-line);
  background: var(--reel-tile);
  color: var(--ink);
  white-space: normal;
}
.reel-editor :is(.reel-caption-actions .btn, .reel-shot-secondary):hover:not(:disabled) { background: var(--reel-tile-hover); }
.reel-order, .reel-cue-times button { margin-inline-start: auto; }
.reel-clip-actions label, .reel-cue-times label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.reel-editor :is(input[type="number"], select, textarea) {
  background: var(--bg); color: var(--ink); border: 1px solid var(--stroke); border-radius: 8px;
  font: inherit; font-size: 12px; padding: 5px; min-height: 32px; min-width: 0;
}
.reel-editor input[type="number"] { width: 64px; }
.reel-editor textarea { width: 100%; resize: vertical; }
.reel-editor .reel-entry textarea {
  min-height: 64px;
  padding: 9px 8px;
  border: 0;
  background: var(--reel-card);
  font-size: 14px;
  line-height: 1.8;
}
.reel-editor .reel-small { padding-inline: 8px; min-height: 34px; }
.reel-footer { flex-wrap: wrap; font-size: 13px; }
.reel-status { min-height: 0; color: var(--muted); font-size: 12px; }
.reel-status:empty { display: none; }
.reel-status.is-error { color: #c94646; }
.reel-replace {
  max-width: min(360px, 90vw); background: var(--bg); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: 16px; padding: 16px;
}
.reel-replace::backdrop { background: #05081088; }
.reel-replace p { margin: 8px 0 14px; font-size: 13px; }
.reel-replace form > div { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) {
  .reel-editor { gap: 10px; }
  .reel-assistant { padding: 8px; }
  .reel-console { padding-inline: 8px; }
  .reel-workspace { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .reel-stage { width: min(100%, 158px); }
  .reel-editor .btn { min-height: 42px; }
  .reel-footer-actions, .reel-footer-actions .btn { width: 100%; }
  .reel-shot-options { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .reel-shot-options .reel-shot-choice { grid-column: span 2; }
  .reel-shot-options .reel-shot-choice:nth-last-child(-n + 3) { grid-column: span 3; }
}
