/* tokens.css */
* {
  box-sizing: border-box;
}
:root {
  color-scheme: light;
  --accent: #1f3a5c;
  --accent-strong: #16293f;
  --accent-soft: #eaf1fa;
  --accent-border: #bed0e6;
  --highlight: #2a63a4;
  --ink: #14171c;
  --ink-2: #39404b;
  --muted: #5b6472;
  --faint: #6f7886;
  --bg: #f1f5fb;
  --surface: #fff;
  --surface-2: #f2f5f9;
  --line: #e6eaf0;
  --line-strong: #d3dae3;
  --line-hover: #bfc6cf;
  --line-focus: #7c90ab;
  --danger: #a8362f;
  --success: #46705a;
  --studio-mobile-nav-height: 76px;
  --shadow: 0 2px 6px #1018280f, 0 1px 2px #10182808;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.6 "Segoe UI",
    system-ui,
    -apple-system,
    "PingFang SC",
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
button,
a,
input,
textarea,
select,
summary {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--highlight);
  box-shadow: 0 0 0 3px #2a63a422;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
button svg {
  flex-shrink: 0;
}
textarea,
input,
select {
  color: var(--ink-2);
}
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  aspect-ratio: 1;
  flex: 0 0 auto;
}
.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 42px;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 500;
  transition: background 0.15s;
}
.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}
.text-button,
.subtle-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px 0;
  font-size: 13px;
}
.text-button:hover,
.subtle-button:hover {
  text-decoration: underline;
}
.success-label {
  color: var(--success);
  font-size: 13px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
[hidden] {
  display: none !important;
}
::selection {
  background: #1f3a5c26;
}

input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: -1px; box-shadow: none; }

small { font-size: 13px; }

/* Actions must remain recognizable without a hover-capable pointer. */
.text-button {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}
.text-button:disabled { text-decoration: none; cursor: not-allowed; }
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface, #fff);
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.secondary-button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.secondary-button:disabled { cursor: not-allowed; }

@media(pointer:coarse) { .text-button { min-height: 44px; min-width: 44px; } }

/* shell.css */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 84px;
  border-right: 1px solid var(--line);
  background: white;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px 12px;
  z-index: 20;
}
.brand {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  background: transparent;
  color: #fff;
  border-radius: 8px;
}
.brand img {
  width: 40px;
  height: 40px;
  display: block;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rail-item,
.rail-new {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 2px 9px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}
.rail-item:hover {
  background: var(--surface-2);
}
.rail-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.rail-new {
  margin: 2px 0 10px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px #1018280a;
}
.rail-new:hover {
  background: var(--accent-strong);
}
.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding-top: 20px;
}
.app-shell {
  margin-left: 84px;
  min-height: 100dvh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 38px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.topbar > div {
  display: flex;
  align-items: center;
  gap: 13px;
}
.topbar strong {
  font-size: 17px;
  font-weight: 600;
}
.header-divider {
  height: 16px;
  width: 1px;
  background: var(--line-strong);
}
#page-title {
  color: var(--muted);
  font-size: 13px;
}
.header-status {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}
.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7a9f89;
}
.header-status button {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 13px;
}
.feature-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 30px;
  padding: 0 38px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.feature-tabs button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 14px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.feature-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--highlight);
  font-weight: 700;
}
.feature-tabs .icon {
  width: 18px;
  height: 18px;
}
.feature-tabs button:hover {
  color: var(--accent);
}

.topbar-brand-icon { display: none; flex: 0 0 auto; }
@media (max-width:550px) { .topbar-brand-icon { display:block; width:28px; height:28px; border-radius:6px; } }

/* layout.css */
main {
  max-width: 1256px;
  margin: auto;
  padding: 0 clamp(22px, 3vw, 48px) 40px;
  min-height: calc(100dvh - 200px);
}
.page-hero {
  text-align: center;
  padding: 38px 0 26px;
}
.eyebrow {
  display: block;
  color: var(--highlight);
  font-size: 13px;
  margin-bottom: 10px;
}
.page-hero h1 {
  font-size: clamp(25px, 2.4vw, 32px);
  line-height: 1.35;
  font-weight: 700;
}
.page-hero p {
  max-width: 660px;
  margin: 11px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.page-hero.align-left {
  text-align: left;
}
.align-left p {
  margin-left: 0;
}
.content-section {
  margin-top: 30px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}
.section-heading h2 {
  font-size: 18px;
  font-weight: 600;
}
.section-kicker {
  display: block;
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 5px;
}
footer {
  max-width: 1256px;
  margin: auto;
  padding: 0 clamp(22px, 3vw, 48px) 24px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 13px;
  gap: 20px;
}
.page-loading { max-width: 820px; margin: auto; padding: 26px 0 40px; }
.page-skeleton span { display: block; background: linear-gradient(110deg,#e9eef4 25%,#f7f9fc 40%,#e9eef4 55%); background-size: 200% 100%; animation: studio-sweep 1.6s linear infinite; border-radius: 6px; }
.page-skeleton .skeleton-title { width: 38%; height: 29px; margin-bottom: 14px; }
.page-skeleton .skeleton-subtitle { width: 52%; height: 12px; margin-bottom: 28px; }
.skeleton-form { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 24px; }
.skeleton-form span:first-child { width: 24%; height: 15px; margin-bottom: 20px; }
.skeleton-form span:nth-child(2) { width: 100%; height: 130px; margin-bottom: 20px; }
.skeleton-form span:last-child { width: 34%; height: 42px; margin-left: auto; }
.skeleton-cards { display: none; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 18px; }
.skeleton-cards span { height: 210px; }
.page-loading[data-kind="works"],.page-loading[data-kind="assets"] { max-width: none; }
.page-loading:is([data-kind="works"],[data-kind="assets"]) .skeleton-cards { display: grid; }
.page-loading:is([data-kind="works"],[data-kind="assets"]) .skeleton-form { display: none; }
.page-loading[aria-busy="false"] .page-skeleton { display: none; }
#page-load-error { margin: 15px 0; color: var(--muted); font-size: 14px; }
@keyframes studio-sweep { to { background-position: -200% 0; } }
@media(max-width:550px) { .page-loading { padding-top: 25px; } .skeleton-form { padding: 18px; } .skeleton-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; } }
@media(prefers-reduced-motion:reduce) { .page-skeleton span { animation: none; } }
.empty-state {
  padding: 46px 20px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}
.message,
.form-message {
  padding: 12px 16px;
  margin: 15px 0 0;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
}
.message.error,
.form-message.error {
  color: var(--danger);
  background: #fdf6f5;
}
.form-message {
  margin: 0 24px 20px;
}
.workflow-note {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 20px 0 30px;
  color: var(--faint);
  font-size: 13px;
}
.workflow-note b {
  font-weight: 400;
  color: #a0a9b5;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tabs button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 16px;
}
.filter-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.works-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.works-actions button { min-height:44px; }

/* forms.css */
.creation-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px #10182806;
  overflow: hidden;
  padding: 24px 24px 0;
}
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 14px;
}
.card-heading h2 {
  font-size: 16px;
  font-weight: 600;
}
.required-note {
  font-size: 13px;
  color: var(--muted);
  padding: 2px 7px;
  background: var(--surface-2);
  border-radius: 5px;
}
.upload-zone {
  min-height: 185px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #bdcbdc;
  border-radius: 10px;
  background: #f9fbfe;
  transition:
    background 0.15s,
    border-color 0.15s;
  cursor: pointer;
}
.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--highlight);
  background: var(--accent-soft);
}
.upload-zone.has-source {
  border-style: solid;
  cursor: default;
  min-height: 150px;
}
.upload-zone.has-source:hover {
  border-color: #bdcbdc;
  background: #f9fbfe;
}
#upload-empty {
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
}
.upload-icon {
  width: 28px;
  height: 28px;
  color: var(--highlight);
  margin-bottom: 2px;
}
#upload-empty strong {
  font-size: 15px;
  font-weight: 500;
}
#upload-empty span {
  font-size: 13px;
  color: var(--muted);
}
#choose-upload {
  font-size: 13px;
  min-height: 36px;
  padding: 6px 20px;
  margin-top: 2px;
}
.source-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 11px 0 24px;
}
#upload-status {
  color: var(--success);
  font-size: 13px;
}
.attachment {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 14px 20px;
}
.attachment img {
  width: 76px;
  height: 108px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}
.attachment > div {
  min-width: 0;
  flex: 1;
}
.attachment strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.attachment small {
  display: block;
  color: var(--success);
  font-size: 13px;
  margin-top: 7px;
}
.field-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  margin: 20px 0 10px;
}
.field-label span {
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
}
textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 90px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.8;
  background: #fff;
  font-size: 14px;
}
textarea::placeholder,
input::placeholder {
  color: #8a94a3;
  opacity: 1;
}
textarea:focus,
input:focus,
select:focus {
  border-color: #7c90ab;
  box-shadow: 0 0 0 2px #1f3a5c14;
  outline: none;
}
.creation-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}
.template-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
}
.template-chip small {
  color: var(--faint);
  font-size: 13px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
}
.template-chip:hover {
  border-color: var(--accent-border);
}
.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  padding: 19px 0 7px;
}
.advanced-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.advanced-grid input:not([type="checkbox"]),
.advanced-grid select {
  width: 100%;
  height: 39px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 6px 10px;
  background: #fff;
}
.advanced-grid label.check-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.check-field input {
  accent-color: var(--accent);
}
.creation-card > .form-message {
  margin: 0 0 18px;
}
.platform-label {
  font-size: 13px;
  color: var(--faint);
}
.field-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  margin: 10px 0;
}

.attachment > .source-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  white-space: nowrap;
}

textarea:focus::placeholder, input:focus::placeholder { color: transparent; }

/* library.css */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.template-card {
  display: block;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  text-align: left;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.template-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
}
.template-card.selected {
  border: 2px solid var(--highlight);
}
.auto-template {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  text-align: left;
}
.auto-template strong {
  font-size: 14px;
  font-weight: 500;
}
.auto-template span {
  font-size: 13px;
  color: var(--muted);
}
.auto-template.selected {
  border-color: var(--highlight);
  background: var(--accent-soft);
}
.template-art {
  height: 155px;
  position: relative;
  overflow: hidden;
  padding: 18px 22px;
}
.template-art:before {
  content: "";
  position: absolute;
  width: 95px;
  height: 132px;
  right: 31px;
  top: 40px;
  transform: rotate(-8deg);
  border-radius: 5px;
  background: linear-gradient(145deg, #5c615f, #c1b7aa);
  box-shadow: 0 12px 20px #0002;
}
.template-art:after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: -35px;
  top: -45px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.25;
}
.template-art .art-tag {
  position: relative;
  font:
    8px/1.5 Georgia,
    serif;
  letter-spacing: 1.5px;
  opacity: 0.65;
}
.template-art strong {
  display: block;
  position: relative;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 1px;
  margin-top: 13px;
  z-index: 1;
}
.template-art .art-line {
  position: relative;
  width: 34px;
  height: 2px;
  background: currentColor;
  opacity: 0.55;
  margin-top: 13px;
}
.template-art .art-photo {
  position: absolute;
  right: 29px;
  top: 28px;
  width: 97px;
  height: 141px;
  transform: rotate(-6deg);
  object-fit: cover;
  border-radius: 4px;
  filter: saturate(0.75);
  box-shadow: 0 12px 24px #0003;
  z-index: 0;
}
.template-card[data-id="insight"] .template-art {
  background: #ede6d8;
  color: #343d37;
}
.template-card[data-id="launch"] .template-art {
  background: radial-gradient(ellipse at 80% 100%, #6c5199, #272330 75%);
  color: #e8d9ff;
}
.template-card[data-id="launch"] .template-art:before {
  background: linear-gradient(135deg, #b1a2cb, #382c4c);
  width: 74px;
  height: 110px;
  border-radius: 14px;
  top: 57px;
  right: 42px;
}
.template-card[data-id="space"] .template-art {
  background: #e5e5df;
  color: #595b50;
}
.template-card[data-id="space"] .template-art:before {
  background: linear-gradient(
    90deg,
    #bab8ab 40%,
    #d7d1be 40%,
    #d7d1be 45%,
    #aaa896 45%
  );
  transform: rotate(0);
  width: 122px;
  height: 132px;
  right: 12px;
}
.template-card[data-id="explainer"] .template-art {
  background: #dce9e8;
  color: #385e64;
}
.template-card[data-id="explainer"] .template-art:before {
  background: linear-gradient(130deg, #a2c5c3, #e4e9db);
  transform: rotate(8deg);
}
.template-card[data-id="story"] .template-art {
  background: linear-gradient(120deg, #634554, #b9999c);
  color: #f8e9e5;
}
.template-card[data-id="story"] .template-art:before {
  background: linear-gradient(90deg, #a78c91, #655358);
  width: 130px;
  transform: rotate(4deg);
}
.template-card[data-id="pulse"] .template-art {
  background: radial-gradient(ellipse at 90% 70%, #599184, #203b35 78%);
  color: #d3eee0;
}
.template-card[data-id="pulse"] .template-art:before {
  background: transparent;
  box-shadow: none;
  border: 1px solid #a0d5be70;
  border-radius: 50%;
  transform: rotate(30deg);
  width: 120px;
}
.template-card:hover .art-photo {
  animation: cardfloat 2.5s ease-in-out infinite;
}
@keyframes cardfloat {
  50% {
    transform: translateY(-5px) rotate(-3deg);
  }
}
.template-description {
  padding: 14px 15px;
}
.template-description strong {
  font-size: 14px;
  font-weight: 500;
}
.template-description small {
  display: block;
  color: var(--faint);
  font-size: 13px;
  margin-top: 4px;
}
.template-description p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.template-art strong {
  white-space: pre-line;
}
.works-grid,
.assets-grid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.work-card,
.asset-card {
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  min-width: 0;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.work-card:hover,
.asset-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
}
.work-art {
  aspect-ratio: 9 / 16;
  height: auto;
  position: relative;
  background: #e9eef5;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.work-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.work-placeholder {
  color: var(--accent);
  font-size: 16px;
}
.work-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 2px 7px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 5px;
  background: #ffffffeb;
}
.work-info {
  padding: 14px;
}
.work-info strong,
.asset-card strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 500;
}
.work-info small {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.asset-card img {
  width: 100%;
  height: 195px;
  object-fit: cover;
  object-position: center 30%;
}
.asset-card strong {
  padding: 12px 14px 0;
}
.asset-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  padding: 5px 14px 14px;
}

/* tools.css */
.tool-form,
.tool-result {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}
.tool-form {
  padding-bottom: 0;
}
.tool-form textarea {
  min-height: 110px;
}
.local-source {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}
.local-source input {
  display: block;
  width: 100%;
  padding: 15px 0 0;
  font-size: 13px;
}
.tool-attachment {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  background: var(--surface-2);
  padding: 10px 13px;
  border-radius: 5px;
  margin-top: 13px;
}
.tool-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
}
.tool-submit > span {
  color: var(--faint);
  font-size: 13px;
}
.tool-result {
  scroll-margin-top: 76px;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.result-block {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.result-block h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 12px;
}
.result-block p {
  font-size: 14px;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
}
#copy-result .result-block:nth-child(3),
#rewrite-result .result-block:nth-child(2) {
  grid-column: 1/-1;
}
#rewrite-result .result-block:first-child {
  grid-column: 1/-1;
}
.media-result-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.media-result-layout video {
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  background: #171b22;
}
.media-result-content > h3 {
  font-size: 17px;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}
.media-result-layout:has(.source-media-preview:not([open])) { grid-template-columns: minmax(0, 1fr); }
.media-result-content .collapsed-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.title-toggle { margin: -6px 0 10px; padding: 7px 0; min-height: 36px; }
.copy-feedback { flex-basis: 100%; color: var(--muted); font-size: 13px; line-height: 1.6; }
.extracted-text .download-actions > button { min-height: 39px; padding: 8px 10px; }
.subtitle-review { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; }
.subtitle-review summary { cursor: pointer; color: var(--accent); }
.subtitle-review ul { list-style: none; margin: 12px 0 0; padding: 0; }
.subtitle-review li { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; overflow-wrap: anywhere; }
.subtitle-review li > :first-child { flex: 0 0 auto; padding: 4px 0; font-variant-numeric: tabular-nums; }
.transcript-text > p { margin: 0 0 .8em; }
.transcript-text > p:last-child { margin-bottom: 0; }
.transcript-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.media-result-content .result-block {
  padding: 14px 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
}
.media-result-content .result-block h3 {
  margin-bottom: 7px;
}
.media-result-content .result-block p {
  font-size: 13px;
}
.download-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.download-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 9px 15px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-size: 13px;
}
.download-actions a.secondary {
  color: var(--accent);
  background: #fff;
  border-color: var(--line-strong);
}
.download-actions a:hover {
  filter: brightness(0.96);
}
.download-actions .primary-button {
  font-size: 13px;
  min-height: 39px;
  padding: 9px 15px;
}
#rewrite-text {
  min-height: 210px;
}
#rewrite-brief {
  min-height: 80px;
}

.media-result-layout.landscape {
  grid-template-columns: 1fr;
}
.media-result-layout.landscape video {
  max-height: 420px;
  object-fit: contain;
}
.extracted-cover {
  display: block;
  max-width: 100%;
  max-height: 170px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 20px;
}
.audio-preview {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.audio-preview audio {
  width: 100%;
  max-width: 460px;
  height: 38px;
}

/* dialogs.css */
.dialog {
  width: 610px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 64px #1018281f;
}
.dialog::backdrop {
  background: #10182866;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.dialog-heading h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.5;
}
.close-button {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  font-size: 0;
  padding: 0;
  line-height: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.close-button::before {
  z-index: 1;
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='1.65' stroke-linecap='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
.close-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.assets-dialog {
  width: 960px;
}
.assets-dialog .assets-grid {
  margin-top: 22px;
}
.templates-dialog {
  width: 980px;
}
.director-orbit {
  height: 106px;
  width: 106px;
  position: relative;
  margin: 30px auto 25px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.director-orbit span {
  font-size: 34px;
}
.director-orbit i {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: director-turn 4s linear infinite;
}
.director-orbit i:nth-child(2) {
  inset: 13px;
  animation-direction: reverse;
  animation-duration: 6s;
}
#making {
  text-align: center;
}
#making h3 {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
#task-explanation {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  margin: 12px auto 24px;
  max-width: 420px;
}
progress {
  display: block;
  width: 100%;
  height: 7px;
  appearance: none;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar {
  background: var(--surface-2);
}
progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 13px;
  margin: 10px 0 22px;
}
#cancel-task {
  margin-bottom: 5px;
  font-size: 13px;
}
#result-video {
  display: block;
  width: 100%;
  max-height: 62dvh;
  border-radius: 8px;
  background: #171b22;
}
#result-cover {
  display: block;
  width: 100%;
  max-height: 60dvh;
  object-fit: contain;
  border-radius: 8px;
}
#delivery-details {
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}
#delivery-copy {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow: auto;
  padding: 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  line-height: 1.9;
}
#detail-files {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 7px;
}
#detail-files a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.again-button {
  width: 100%;
  margin-top: 24px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--accent);
  font-size: 13px;
}
.again-button:hover {
  background: var(--accent-soft);
}
.task-error {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid #ddbcb7;
  border-radius: 8px;
  background: #fdf6f5;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.9;
}
#text-result {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.9;
}
@keyframes director-turn {
  to {
    transform: rotate(360deg);
  }
}

.close-button::after { content: ""; position: absolute; width: 28px; height: 28px; top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: 6px; background: #f3f5f8; }
.close-button:hover::after { background: #e9edf2; }

.revision-dialog > .text-button {
  min-width: 44px;
  min-height: 44px;
  padding-inline: 8px;
}

/* responsive.css */
@media (max-width: 1100px) {
  .works-grid,
  .assets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .template-art {
    height: 150px;
    padding: 17px;
  }
  .template-art strong {
    font-size: 24px;
  }
  .topbar {
    padding: 0 26px;
  }
  .feature-tabs {
    padding: 0 26px;
  }
}
@media (max-width: 760px) {
  main {
    padding: 0 22px 36px;
  }
  .topbar {
    height: 60px;
    padding: 0 22px;
  }
  .feature-tabs {
    gap: 24px;
    padding: 0 22px;
  }
  .feature-tabs button {
    font-size: 15px;
    gap: 7px;
  }
  .header-status {
    font-size: 13px;
    gap: 6px !important;
  }
  .header-status #service-label {
    display: none;
  }
  .works-grid,
  .assets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .creation-card {
    padding: 20px 20px 0;
  }
  .page-hero {
    padding: 31px 0 24px;
  }
  .page-hero p {
    font-size: 14px;
  }
  .source-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
  .media-result-layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    padding: 17px;
  }
  .section-heading {
    align-items: flex-start;
  }
  .filter-tabs {
    gap: 3px;
  }
  .filter-tabs button {
    padding: 6px 8px;
  }
  .templates-dialog {
    padding: 22px !important;
  }
  .template-description {
    padding: 12px;
  }
  .template-description p {
    display: none;
  }

}

@media (max-width: 550px) {
  .dialog {
    padding: 21px !important;
    max-height: calc(100dvh - 40px);
  }
  .templates-dialog {
    width: calc(100% - 24px);
    padding: 18px !important;
  }
  .dialog-heading h2 {
    font-size: 20px;
  }
  .template-grid {
    gap: 12px;
  }
  .template-art {
    height: 135px;
    padding: 13px;
  }
  .template-art strong {
    font-size: 22px;
  }
  .template-description strong {
    font-size: 13px;
  }
  .template-description small {
    font-size: 13px;
  }
  .auto-template {
    padding: 13px;
  }
  .auto-template strong {
    font-size: 13px;
  }
  .auto-template span {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* compact.css */
@media (max-width: 550px) {
  .sidebar {
    inset: auto 0 0;
    width: auto;
    height: var(--studio-mobile-nav-height);
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 6px 12px 8px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .sidebar .brand,
  .rail-foot {
    display: none;
  }
  .sidebar nav {
    display: contents;
  }
  .rail-item,
  .rail-new {
    width: 72px;
    min-height: 58px;
    padding: 6px 2px;
    font-size: 13px;
    font-weight: 500;
    margin: 0;
  }
  .rail-new {
    box-shadow: none;
  }
  .rail-item.active {
    background: var(--accent-soft);
  }
  .app-shell {
    margin-left: 0;
    padding-bottom: 72px;
  }
  .topbar {
    height: 57px;
    padding: 0 18px;
  }
  .topbar strong {
    font-size: 16px;
  }
  .header-divider,
  #page-title {
    display: none;
  }
  .topbar > div {
    gap: 7px;
  }
  .feature-tabs {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    padding: 0 12px;
    gap: 4px;
  }
  .feature-tabs button {
    justify-content: center;
    font-size: 15px;
    gap: 6px;
    min-height: 54px;
    padding: 13px 3px;
  }
  .feature-tabs .icon {
    width: 18px;
    height: 18px;
  }
  main {
    padding: 0 17px 30px;
  }
  .page-hero {
    padding: 28px 0 24px;
  }
  .page-hero h1 {
    font-size: 25px;
    line-height: 1.5;
  }
  .page-hero p {
    font-size: 13px;
    line-height: 1.8;
  }
  .eyebrow {
    font-size: 13px;
    margin-bottom: 6px;
  }
  .creation-card {
    padding: 18px 16px 0;
    border-radius: 10px;
  }
  .card-heading h2 {
    font-size: 15px;
  }
  .upload-zone {
    min-height: 190px;
  }
  #upload-empty {
    padding: 19px 10px;
    gap: 10px;
  }
  #upload-empty strong {
    font-size: 14px;
  }
  #upload-empty span {
    font-size: 13px;
  }
  .attachment {
    padding: 12px;
    gap: 12px;
  }
  .attachment img {
    width: 61px;
    height: 88px;
  }
  .attachment strong {
    font-size: 13px;
  }
  .attachment span,
  .attachment small {
    font-size: 13px;
  }
  .attachment .text-button {
    font-size: 13px;
  }
  .field-label {
    font-size: 13px;
    flex-wrap: wrap;
    gap: 5px;
  }
  .field-label span {
    font-size: 13px;
  }
  .source-actions {
    margin-bottom: 18px;
  }
  .source-actions .text-button {
    font-size: 13px;
  }
  textarea {
    padding: 12px;
    font-size: 14px;
  }
  .creation-bottom {
    gap: 10px;
    padding: 16px 0 18px;
  }
  .template-chip {
    padding: 9px 8px;
    font-size: 13px;
    gap: 5px;
  }
  .template-chip small {
    font-size: 13px;
    padding-left: 5px;
  }
  .template-chip .icon {
    width: 16px;
    height: 16px;
  }
  .primary-button {
    padding: 10px 14px;
    font-size: 13px;
    gap: 9px;
  }
  .advanced-grid {
    grid-template-columns: 1fr;
  }
  .workflow-note {
    font-size: 13px;
    gap: 6px;
    flex-wrap: wrap;
    margin: 18px 0 27px;
  }
  .section-heading h2 {
    font-size: 16px;
  }
  .works-grid,
  .assets-grid {
    gap: 12px;
  }

  .work-info {
    padding: 12px;
  }
  .work-info strong {
    font-size: 13px;
  }
  .work-info small {
    font-size: 13px;
  }
  .work-badge {
    font-size: 13px;
  }
  .asset-card img {
    height: 170px;
  }
  .asset-card strong {
    padding: 10px 11px 0;
    font-size: 13px;
  }
  .asset-card small {
    font-size: 13px;
    padding: 5px 11px 12px;
  }
  .tool-submit {
    align-items: flex-end;
    gap: 13px;
  }
  .tool-submit > span {
    font-size: 13px;
    max-width: 155px;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .result-block {
    padding: 16px;
  }
  .media-result-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .media-result-layout video {
    max-height: 320px;
    object-fit: contain;
    background: #171b22;
  }
  .media-result-content > h3 {
    font-size: 15px;
  }
  .tool-form .card-heading .text-button {
    font-size: 13px;
  }
  .filter-tabs {
    gap: 3px;
  }
  .filter-tabs button {
    font-size: 13px;
    padding: 6px 7px;
  }
  footer {
    padding: 0 18px 20px;
    font-size: 13px;
  }
  footer span {
    max-width: 170px;
    text-align: right;
  }
  .download-actions {
    gap: 8px;
  }
  .download-actions a,
  .download-actions .primary-button {
    font-size: 13px;
    padding: 8px 12px;
  }
}

@media(max-width:550px) {
  .sidebar .rail-item .icon { width: 22px; height: 22px; }
  .sidebar .rail-item.active { color: var(--accent); font-weight: 600; }
  .sidebar .rail-item.active .icon { color: var(--highlight); }
}

@media (max-width:550px) {
  .page-hero { padding: 17px 0 14px; }
  .page-hero h1 { font-size: 23px; line-height: 1.35; }
  .page-hero p { margin-top: 5px; line-height: 1.6; }
  .creation-hero { padding: 16px 0 12px; }
  .tool-form { padding-top: 15px; }
  .tool-form .card-heading { margin-bottom: 10px; }
  #media-url { min-height: 92px; }
  #rewrite-text { min-height: 156px; }
  #rewrite-brief { min-height: 74px; }
  .local-source { margin-top: 12px; }
  .tool-submit { padding: 14px 0; }
  .filter-tabs button { font-size: 15px; padding: 8px 6px; min-height:44px; }
  .filter-tabs { flex-wrap:nowrap; gap:1px; }
  .works-heading { gap:6px; }
  .works-actions { gap:2px; }
  .works-actions .text-button { padding-inline:5px; }
}

/* mobile.css */
.header-status .inbox-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 13px; }
.header-status .inbox-button .icon { width: 18px; height: 18px; }
.header-status .inbox-button:hover { color: var(--accent); border-color: var(--line-hover); background: var(--surface-2); }
.header-status .inbox-button.has-unread { color: var(--accent); }
.inbox-count { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; background: var(--accent); color: white; border-radius: 5px; font-size: 13px; line-height: 1; }
.inbox-dialog { width: min(520px, calc(100% - 28px)); }
.inbox-dialog > .text-button { float: right; margin-top: -35px; }
.inbox-list { display: grid; gap: 9px; margin: 22px 0; max-height: 48dvh; overflow: auto; }
.inbox-item { display: grid; gap: 6px; text-align: left; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.inbox-item.unread { border-left: 3px solid var(--accent); }
.inbox-item strong { font-size: 14px; }
.inbox-item small { font-size: 13px; color: var(--muted); }
.inbox-dialog > .field-help { margin-top: 16px; }
.activity-banner, .transfer-card {
  position: fixed; z-index: 90; bottom: 22px; right: 22px;
  width: min(430px, calc(100vw - 32px)); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 8px 35px #14274025; padding: 18px;
}
.activity-banner { display: flex; gap: 12px; align-items: center; }
.activity-banner > span { flex: 1; font-size: 14px; }
.activity-banner .text-button { min-height: 44px; }
.transfer-card { z-index: 120; }
.transfer-card strong { display: block; font-size: 15px; margin-bottom: 8px; }
.transfer-card > span { display: block; font-size: 13px; line-height: 1.7; color: var(--muted); }
.transfer-card progress { display: block; width: 100%; height: 8px; margin: 15px 0; accent-color: var(--accent); }
.transfer-card button { min-height: 44px; margin-right: 20px; }
.work-card { content-visibility: auto; contain-intrinsic-size: 250px 250px; }
@media (max-width: 550px) {
  .sidebar { height: calc(var(--studio-mobile-nav-height) + env(safe-area-inset-bottom)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px #10182808; }
  .app-shell { padding-bottom: calc(var(--studio-mobile-nav-height) + 16px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); height: calc(57px + env(safe-area-inset-top)); }
  .feature-tabs { top: calc(57px + env(safe-area-inset-top)); }
  input, textarea, select { font-size: 16px !important; }
  button, .download-actions a { min-height: 44px; touch-action: manipulation; }
  .source-actions { flex-direction: row; align-items: center; flex-wrap: wrap; }
  #source-file { scroll-margin-top: 120px; }
  .dialog { width: calc(100% - 16px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 14px; }
  .task-dialog video { max-height: 53dvh !important; object-fit: contain; }
  .header-status { gap: 5px; }
  #active-task { padding: 7px; font-size: 13px; }
  .connection-dot { display: none; }
  .inbox-button { padding: 7px 9px; white-space: nowrap; }
  .activity-banner, .transfer-card { bottom: calc(var(--studio-mobile-nav-height) + 12px + env(safe-area-inset-bottom)); right: 12px; width: calc(100vw - 24px); }
  .download-actions a { flex-grow: 1; text-align: center; }
  .download-actions a:first-child { flex-basis: 100%; }
  .filter-tabs { max-width: calc(100vw - 90px); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .section-heading { gap: 8px; }
}
.account-card #invite-form { margin-top: 24px; display: grid; gap: 10px; }
.account-card input { width: 100%; min-height: 46px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px; background: var(--surface); }
#page-settings > .creation-card { padding-bottom: 22px; margin-bottom: 18px; }
#page-settings h2 { font-size: 17px; font-weight: 600; }
#invite-form .primary-button { justify-self: start; }
#quota-information { padding: 14px; background: var(--accent-soft); border-radius: 7px; line-height: 1.8; margin: 18px 0 10px; }
.settings-list { display: grid; gap: 10px; margin-top: 16px; }
.settings-list .inbox-item strong { overflow-wrap: anywhere; }
#storage-progress { width: 100%; height: 8px; margin: 15px 0; accent-color: var(--accent); }
#storage-information { line-height: 1.8; }
.template-actions { display: flex; justify-content: space-between; gap: 4px; padding: 0 12px 12px; }
.template-actions button { font-size: 13px; min-height: 44px; padding: 4px; }
.template-demo-dialog { width: min(440px, calc(100% - 20px)); }
.template-demo-dialog video { display: block; margin: 16px auto; max-width: 100%; height: min(60dvh, 580px); background: #182127; }
.template-demo-dialog .field-help { margin: 16px 0; }
.template-demo-dialog > .text-button { float: right; }
.caption-editor { display: grid; gap: 15px; max-height: 38dvh; overflow: auto; padding-right: 5px; }
.caption-editor label { display: grid; gap: 7px; }
.caption-editor label > span { font-size: 13px; color: var(--muted); }
.caption-editor textarea { width: 100%; font-size: 16px; }

@media(max-width:550px) { .header-status .inbox-button { min-height: 44px; } }

/* composer.css */
.creation-hero { max-width: 820px; margin: auto; text-align: left; padding: 18px 0 14px; }
.creation-hero .eyebrow { letter-spacing: .12em; margin-bottom: 6px; }
.creation-hero h1 { font-size: clamp(23px, 2.3vw, 28px); }
.creation-hero p { margin: 9px 0 0; font-size: 14px; }
.composer-layout { max-width: 820px; min-width: 0; margin: auto; }
.composer-layout > * { min-width: 0; }
#video-form { padding: 16px 24px 0; border-radius: 12px; overflow: visible; }
#video-form .card-heading { margin-bottom: 12px; }
#video-form .card-heading h2 { display: flex; align-items: center; gap: 8px; }
#video-form .upload-zone { min-height: 128px; background: #f8fafd; border-color: #b8c9dd; }
#video-form #upload-empty { padding: 12px; gap: 6px; }
#video-form .upload-icon { width: 25px; height: 25px; }
#video-form .source-actions { margin: 5px 0 18px; min-height: 20px; }
#video-form .source-actions:has(#upload-status:empty) { display: none; }
#video-form .upload-zone { margin-bottom: 15px; }
#video-form #upload-status { color: var(--muted); }
#video-form .field-label { margin: 0 0 10px; }
#video-form #brief { min-height: 88px; line-height: 1.7; }
.brief-suggestions { display: flex; gap: 7px; padding: 9px 0 0; flex-wrap: wrap; }
.brief-suggestions button { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); padding: 4px 10px; font-size: 13px; min-height: 32px; }
.brief-suggestions button:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
#video-form .creation-bottom { padding: 8px 0; gap: 12px; }
.auto-defaults { color: var(--faint); font-size: 13px; }
.create-dock { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0; }
#create-hint { font-size: 13px; color: var(--muted); }
#create { min-width: 160px; min-height: 46px; border-radius: 8px; }
.ongoing-work { display: flex; align-items: center; gap: 15px; padding: 15px 18px; margin-bottom: 18px; border: 1px solid var(--accent-border); border-radius: 9px; background: #fff; }
.ongoing-work > div { flex: 1; min-width: 0; }
.ongoing-work strong, .ongoing-work span { display: block; }
.ongoing-work strong { font-size: 14px; }
.ongoing-work span { color: var(--muted); font-size: 13px; }
.ongoing-work progress { width: 100px; }
.source-preview { width: min(480px, calc(100% - 24px)); }
.source-preview video { display: block; width: 100%; max-height: 60dvh; background: #17212a; border-radius: 8px; margin: 16px 0; }
@media (max-width: 550px) {
  .sidebar .rail-new { display: none; }
  .sidebar .rail-item { width: 25%; }
  .creation-hero { padding: 16px 0 12px; }
  .creation-hero .eyebrow { font-size: 13px; margin-bottom: 4px; }
  .creation-hero h1 { font-size: 23px; line-height: 1.35; }
  .creation-hero p { font-size: 13px; line-height: 1.8; max-width: 320px; margin-top: 6px; }
  #video-form { padding: 16px 15px 0; }
  #video-form .upload-zone { min-height: 108px; }
  #video-form #upload-empty { display:grid; grid-template-columns:auto auto; align-items:center; padding:10px 8px; gap:5px 10px; }
  #video-form #upload-empty .upload-icon { margin:0; }
  #video-form #upload-empty > span { grid-column:1 / -1; }
  #video-form #upload-empty strong { font-size: 13px; }
  #video-form #upload-empty span { font-size: 13px; }
  #video-form #choose-upload { min-height: 44px; margin-top: 0; }
  #video-form .source-actions { margin-bottom: 14px; }
  #video-form .field-label { gap: 6px; font-size: 14px; }
  #video-form #brief { min-height: 80px; padding: 9px 12px; }
  .brief-suggestions { gap: 6px; }
  .brief-suggestions button { min-height: 36px; font-size: 13px; padding: 5px 9px; }
  #video-form .creation-bottom { padding: 12px 0; }
  .auto-defaults { display: none; }
  .create-dock { display: none; position: fixed; z-index: 19; bottom: calc(var(--studio-mobile-nav-height) + env(safe-area-inset-bottom)); left: 0; right: 0; padding: 9px 17px 11px; gap: 6px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -5px 18px #14274006; flex-direction: column; }
  #create-hint { font-size: 13px; }
  #create { width: 100%; min-height: 46px; font-size: 15px; }
  #video-form[data-source="true"] .create-dock { display: flex; }
  body:has(#page-video:not([hidden]) #video-form[data-source="true"]) .app-shell { padding-bottom: calc(var(--studio-mobile-nav-height) + 96px + env(safe-area-inset-bottom)); }
  .ongoing-work { gap: 8px; padding: 12px; }
  .ongoing-work progress { display: none; }
  .ongoing-work strong { font-size: 13px; }
  .ongoing-work span { font-size: 13px; }
  .ongoing-work .text-button { font-size: 13px; }
  .attachment .source-controls { gap: 0; }
  .attachment .source-controls button { min-height: 36px; }
  body:has(#page-video:not([hidden])) .activity-banner { bottom: calc(var(--studio-mobile-nav-height) + 96px + env(safe-area-inset-bottom)); }
}

#create-hint:empty { display: none; }
#video-form #choose-upload { min-height: 44px; }
#upload-transfer { width: 100%; }
.inline-transfer { position: static; width: 100%; border: 0; border-radius: 8px; box-shadow: none; background: transparent; padding: 16px; }
.inline-transfer button { min-height: 44px; }
@media (max-width: 550px) {
  .topbar { position: static; }
  .feature-tabs { top: 0; }
  #video-form .upload-zone { margin-bottom: 16px; }
}
.material-attachments{display:flex;gap:12px;flex-wrap:wrap}.material-attachment{display:flex;align-items:center;gap:8px}.material-attachment img{width:64px;height:64px;object-fit:contain;background:#eef0f3;border-radius:6px}.material-attachment button{min-width:44px;min-height:44px}#supplemental-materials .settings-body{display:grid;gap:12px}#supplemental-materials p{margin:0}
.creation-entries{display:flex;gap:4px;padding:4px;background:#e9edf2;border:1px solid #d9e0e8;border-radius:9px;margin:0 0 16px}.creation-entries button{flex:1;min-height:44px;border:0;border-radius:6px;background:transparent;color:#4a596c;font:inherit;font-weight:600;cursor:pointer}.creation-entries [aria-selected=true]{background:#fff;color:#183044;box-shadow:0 1px 4px #192c4317}.material-attachment video{width:100px;height:80px;object-fit:contain}#entry-form .settings-body{display:grid;gap:12px}#entry-form textarea{width:100%;box-sizing:border-box}#entry-assets[open] > :not(summary, [hidden]){margin-top:10px}
#entry-form{padding:16px 24px 0;border-radius:12px}#entry-create{min-width:160px;min-height:46px;border-radius:8px}.creation-entries{max-width:820px;margin-left:auto;margin-right:auto}
@media(max-width:700px){#entry-form{padding:14px 16px 0}#entry-form:not([hidden]) .create-dock{display:flex}body:has(#page-video:not([hidden]) #entry-form:not([hidden])) .app-shell{padding-bottom:calc(var(--studio-mobile-nav-height) + 96px + env(safe-area-inset-bottom))}.creation-entries button{font-size:14px}.creation-entries{margin-bottom:12px}}
#entry-form>.settings-body{padding:0 0 16px}#entry-form label,#supplemental-materials .settings-body>label{display:grid;gap:7px;color:var(--muted);font-size:14px}#entry-form input:not([type="hidden"]):not([type="file"]):not([type="checkbox"]),#supplemental-materials input:not([type="file"]){width:100%;min-width:0;min-height:44px;padding:8px 11px;box-sizing:border-box;border:1px solid var(--line-strong);border-radius:8px;background-color:#fff;color:var(--ink-2);font:inherit}#entry-material-list .material-attachment{max-width:140px;flex-direction:column;align-items:stretch}#entry-material-list .material-attachment img{width:100px;height:100px}#entry-material-list .material-attachment button{align-self:center}

.material-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#material-add { justify-self: start; }
#entry-assets-hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
#entry-form .preference-chip { padding: 2px 8px; border-radius: 4px; background: #edf1f6; color: var(--muted); font-size: 13px; }
#entry-form .preference-chip[data-mode="custom"] { color: var(--accent); background: var(--accent-soft); }
#entry-form label.setting-switch { display: flex; align-items: center; justify-content: space-between; }
#entry-style, #entry-preferences-reset { justify-self: start; }
#entry-status { color: var(--muted); font-size: 13px; line-height: 1.5; }
@media(max-width:550px) {
  #entry-create { width: 100%; }
  .material-actions .secondary-button { flex: 1 1 130px; }
}

/* task-flow.css */
.task-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; padding: 0; margin: 24px 0 20px; counter-reset: task; gap: 8px; }
.task-steps li { counter-increment: task; font-size: 13px; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 7px; }
.task-steps li::before { content: counter(task); display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-2); font-size: 13px; }
.task-steps li.current { color: var(--accent); font-weight: 600; }
.task-steps li.current::before { color: white; border-color: var(--accent); background: var(--accent); }
.task-steps li.done::before { content: "✓"; color: var(--success); border-color: #c5d5ce; background: #edf4f0; }
#background-task { display: flex; margin: 0 auto 12px; min-width: 220px; }
.task-dialog .director-orbit { height: 74px; width: 74px; margin: 20px auto; }
.task-dialog #task-explanation { margin-bottom: 18px; }
.task-dialog #task-error { text-align: left; }
.task-dialog #delivery { padding-bottom: 4px; }
.task-activity { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; text-align: left; font-size: 13px; }
.task-activity ol { padding: 0; list-style: none; max-height: 240px; overflow-y: auto; }
.activity-event { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 12px 0; }
.activity-event time { color: var(--faint); font-size: 13px; }
.activity-event small { grid-column: 2; color: var(--muted); }
.extracted-text { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.transcript-text { white-space: pre-wrap; line-height: 1.9; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; }
.tool-result { scroll-margin-top: 78px; }
.source-choice-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.source-media-preview { min-width: 0; }
.source-media-preview video { display: block; object-fit: contain; }
#initial-preview video { width: 100%; max-height: 42dvh; border-radius: 8px; background: #161c25; }
.brief-suggestions [aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
@media (max-width: 550px) {
  .tool-result { scroll-margin-top: 125px; }
  .transcript-text { max-height: 190px; }
  .media-result-layout:has(.source-media-preview:not([open])) { gap: 4px; }
}
.task-dialog .download-actions a:first-child { font-weight: 600; }
.task-dialog #make-again { background: transparent; border: 0; margin-top: 4px; color: var(--muted); }
.topbar .header-divider, .topbar #page-title { display: none; }
.service-details { margin-top: 18px; color: var(--muted); font-size: 13px; }
#account-information { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
#account-information span { font-size: 13px; color: var(--muted); }
.additional-materials { margin-top: 16px; color: var(--muted); font-size: 13px; }
.additional-materials > a { display: inline-block; color: var(--accent); margin: 12px 16px 0 0; }
.template-art { position: relative; overflow: hidden; }
.template-art::before, .template-art::after { content: none; }
.template-art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.template-art > .art-tag, .template-art > strong, .template-art > .art-line { display: none; }
@media (max-width: 550px) {
  .task-dialog { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .task-steps { gap: 4px; }
  .task-steps li { font-size: 13px; }
  .task-dialog .dialog-heading { margin-bottom: 12px; }
  .task-dialog .dialog-heading h2 { font-size: 19px; }
  .task-dialog #result-video { max-height: 46dvh !important; }
  .task-dialog .download-actions { margin-top: 14px; }
}
.style-discovery{display:grid;gap:10px;margin:18px 0}.style-filters{display:flex;gap:4px;flex-wrap:wrap}.style-filters [aria-pressed=true]{background:var(--accent-soft,#e6efe8);color:var(--ink,#233b32);border-radius:6px}.style-discovery input{width:100%}
.style-filters .text-button {
  min-width: 44px;
  padding: 8px 10px;
  border: 1px solid transparent;
}
.style-filters [aria-pressed=true] { border-color: var(--accent-border); }
.style-discovery input {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}
#delivery-notes { white-space: pre-line; }
.production-mode { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; padding: 4px; margin: 18px 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.production-mode legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.production-mode label { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 7px 12px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; min-width: 0; }
.production-mode label:hover { border-color: var(--line-hover); }
.production-mode label:has(input:checked) { background: white; border-color: var(--accent-border); box-shadow: 0 1px 2px #1018280a; }
.production-mode input { appearance: none; -webkit-appearance: none; position: static; width: 17px; height: 17px; flex: 0 0 17px; margin: 0; border: 1.5px solid var(--line-hover); border-radius: 50%; background: white; cursor: pointer; }
.production-mode input:checked { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E") center / 12px 12px no-repeat; }
.production-mode input:disabled { opacity: .5; cursor: default; }
.production-mode label > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.production-mode strong { color: var(--muted); font-size: 14px; font-weight: 600; line-height: 21px; }
.production-mode small { color: var(--faint); font-size: 13px; line-height: 17px; }
.production-mode input:checked + span strong { color: var(--accent); }
@media(max-width:550px) { .production-mode label { gap: 8px; min-height: 50px; gap: 7px; padding: 5px 8px; } .production-mode strong { font-size: 13px; } .production-mode small { font-size: 13px; } }

/* settings-panel.css */
:root { --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231f3a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E"); }

details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: start;
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: '';
  box-sizing: border-box;
  flex: 0 0 28px;
  height: 28px;
  margin-inline-start: auto;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  background: var(--surface) var(--control-chevron) center / 17px no-repeat;
  transition: transform .15s;
}
details[open] > summary { margin-block-end: 10px; background: var(--accent-soft); border-color: var(--accent-border); }
details[open] > summary::after { transform: rotate(180deg); }
details + details { margin-block-start: 10px; }
.advanced > summary > span { color: var(--muted); font-size: 13px; font-weight: 400; }
#supplemental-materials { margin-top: 10px; }
@media (hover: hover) {
  details > summary:hover { background: var(--accent-soft); border-color: var(--line-focus); }
}
#video-form #preferences-status { margin: 0; padding: 2px 8px; border-radius: 4px; background: #edf1f6; color: var(--muted); font-size: 13px; }
#video-form #preferences-status[data-mode="custom"] { color: var(--accent); background: var(--accent-soft); }
.settings-body { padding: 0 0 14px; }
.settings-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; color: var(--faint); font-size: 13px; }
.settings-toolbar .text-button { padding: 0; min-height: 28px; font-size: 13px; }
.settings-section { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 18px 0; }
.settings-section:last-child { padding-bottom: 0; }
.settings-section h3, .cover-setting > label { color: var(--ink-2); font-size: 13px; font-weight: 600; margin: 0 0 12px; }
.settings-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "style ." "brand aspect" "presentation cover" "subtitles music" "cleanup assets"; gap: 16px 24px; }
.settings-matrix > label:not(.setting-switch), .style-setting { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 13px; min-width: 0; }
.style-setting { grid-area: style; }
.setting-brand { grid-area: brand; }
.setting-aspect { grid-area: aspect; }
.setting-presentation { grid-area: presentation; }
.setting-cover { grid-area: cover; }
.setting-subtitles { grid-area: subtitles; }
.setting-music { grid-area: music; }
.setting-cleanup { grid-area: cleanup; }
.setting-assets { grid-area: assets; }
.style-setting .template-chip { width: 100%; min-height: 44px; background: white; border-radius: 6px; text-align: left; }
.style-setting .template-chip .icon { width: 16px; height: 16px; }
.style-setting .template-chip > span:last-child { margin-left: auto; font-size: 20px; color: var(--faint); line-height: 1; }
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-fields > label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 13px; min-width: 0; }
.settings-fields .wide-field { grid-column: 1 / -1; }
.settings-fields input, .settings-matrix input:not([type="checkbox"]) { width: 100%; min-width: 0; height: 44px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink-2); font-size: 13px; }
.settings-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.setting-switch { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.setting-switch:has(input:disabled) { color: var(--faint); cursor: default; }
.setting-switch > span { flex: 1; min-width: 0; }
.setting-switch small { display: block; color: var(--faint); font-size: 13px; }
.setting-switch input { appearance: none; -webkit-appearance: none; flex: 0 0 34px; width: 34px; height: 20px; margin: 0; border: 1px solid #c9d2de; border-radius: 11px; background: #c9d2de; position: relative; cursor: pointer; transition: background .15s; }
.setting-switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #20334d24; transition: transform .15s; }
.setting-switch input:checked { background: var(--accent); border-color: var(--accent); }
.setting-switch input:checked::after { transform: translateX(14px); }
.setting-switch input:disabled { opacity: .4; cursor: default; }
@media (max-width: 550px) {
  .advanced > summary > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .settings-toolbar { font-size: 13px; gap: 5px; }
  .settings-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-switches { grid-template-columns: minmax(0, 1fr); }
  .setting-switch + .setting-switch { border-top: 1px solid var(--line); }
  .setting-switch { min-height: 54px; }
  .settings-matrix { gap: 14px 14px; }
  .settings-matrix .setting-switch { gap: 7px; min-height: 46px; border-top: 0; font-size: 13px; }
  .settings-matrix .template-chip { gap: 5px; padding: 8px; font-size: 13px; }
  .settings-matrix .template-chip .icon { width: 14px; height: 14px; }
  .settings-matrix .template-chip > span:last-child { font-size: 16px; }
  .settings-matrix input:not([type="checkbox"]) { font-size: 13px; padding: 7px 8px; }
}
@media (prefers-reduced-motion: reduce) { .setting-switch input, .setting-switch input::after, details > summary::after { transition: none; } }
.style-setting #template-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

select {
  width: 100%;
  min-width: 0;
  height: 44px;
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 38px 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface) var(--control-chevron) right 12px center / 17px no-repeat;
  color: var(--ink-2);
  cursor: pointer;
}
select:disabled { cursor: not-allowed; }
@media (forced-colors: active) {
  details > summary::after { display: grid; place-items: center; background: none; content: '⌄'; }
  select { appearance: auto; background-image: none; padding-inline-end: 11px; }
}

.settings-matrix :is(input:not([type="checkbox"]),select):hover, .settings-fields :is(input,select):hover { border-color: var(--line-hover); }

/* style-browser.css */
/* Portrait references, grouped variants, and a separate focused preview. */
.templates-dialog { width: 1040px; padding: 0; max-height: min(900px, calc(100dvh - 40px)); }
.templates-dialog[open] { display: flex; flex-direction: column; }
.templates-dialog > .dialog-heading { margin: 0; padding: 22px 26px 14px; flex: 0 0 auto; }
.templates-dialog .dialog-heading h2 { font-size: 22px; }
.templates-dialog .dialog-heading p { font-size: 13px; color: var(--muted); margin-top: 3px; }

.templates-dialog .style-discovery { display: flex; align-items: center; gap: 18px; justify-content: space-between; margin: 0; padding: 0 26px 17px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.templates-dialog .style-filters { gap: 3px; flex-wrap: wrap; }
.templates-dialog .style-filters button { min-height: 40px; padding: 7px 10px; white-space: nowrap; border-radius: 6px; font-size: 13px; }
.templates-dialog .style-discovery input { width: 190px; min-width: 100px; min-height: 40px; padding: 7px 11px; background: #f8fafc; font-size: 13px; }
.style-browser-body { overflow: auto; overscroll-behavior: contain; padding: 22px 26px 26px; background: #f7f9fc; min-height: 0; }
.templates-dialog .auto-template { position: relative; width: 100%; padding: 14px 18px; display: flex; align-items: center; gap: 12px; background: white; border-radius: 8px; margin: 0 0 20px; }
.templates-dialog .auto-template strong { font-size: 14px; font-weight: 600; }
.templates-dialog .auto-template span { font-size: 13px; }
.templates-dialog .auto-template i { margin-left: auto; font-style: normal; color: var(--highlight); visibility: hidden; }
.templates-dialog .auto-template.selected { border-color: var(--accent-border); background: var(--accent-soft); }
.templates-dialog .auto-template.selected i { visibility: visible; }
.templates-dialog .template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.templates-dialog .template-card { background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 2px 4px #1e344406; min-width: 0; padding: 8px; overflow: hidden; }
.templates-dialog .template-card.selected { border-color: var(--highlight); box-shadow: 0 0 0 1px var(--highlight); }
.templates-dialog .template-art { width: 100%; height: auto; aspect-ratio: 9 / 16; display: block; padding: 0; border: 0; border-radius: 5px; background: #e7edf2; position: relative; overflow: hidden; }
.templates-dialog .template-art::before, .templates-dialog .template-art::after { content: none; }
.templates-dialog .template-art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.style-play { position: absolute; bottom: 9px; right: 8px; border: 1px solid #ffffff30; border-radius: 5px; padding: 3px 7px; color: white; background: #15202ec4; font-size: 13px; backdrop-filter: blur(8px); }
.style-selected { position: absolute; top: 8px; right: 8px; padding: 3px 7px; border-radius: 4px; background: var(--accent); color: white; font-size: 13px; }
.templates-dialog .template-description { padding: 11px 3px 6px; }
.templates-dialog .template-description strong { font-size: 14px; font-weight: 600; display: block; }
.templates-dialog .template-description small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.templates-dialog .template-actions { padding: 0 3px; display: flex; align-items: center; justify-content: space-between; }
.templates-dialog .template-actions button { min-height: 38px; font-size: 13px; padding: 4px 0; }
.templates-dialog .template-actions button[aria-pressed="true"] { color: var(--highlight); font-weight: 600; }
.style-empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--muted); }
.template-demo-dialog { width: 760px; padding: 22px; max-height: calc(100dvh - 36px); }
.template-demo-dialog > .dialog-heading { margin: 0 0 18px; align-items: center; }
.template-demo-dialog h2 { font-size: 21px; }
.style-eyebrow { display: block; color: var(--faint); font-size: 13px; margin-bottom: 3px; }
.style-preview-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.style-preview-stage { min-width: 0; background: #eff3f7; border-radius: 8px; overflow: hidden; }
.template-demo-dialog .style-preview-stage video { display: block; width: 100%; height: auto; max-height: min(65dvh, 620px); aspect-ratio: 9 / 16; object-fit: contain; margin: 0; background: #17222c; }
.style-preview-info { min-width: 0; }
.style-format { color: var(--faint); font-size: 13px; }
.style-description { color: var(--ink-2); font-size: 16px; line-height: 1.8; margin: 12px 0 22px; }
.style-variants { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.style-variant { border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 11px; background: white; font-size: 13px; min-height: 40px; }
.style-variant[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.style-preview-note { font-size: 13px; color: var(--faint); line-height: 1.8; margin: 0 0 22px; }
.style-preview-info > .primary-button { width: 100%; min-height: 44px; }
@media (max-width: 800px) {
  .templates-dialog .style-discovery { align-items: stretch; flex-direction: column; gap: 10px; }
  .templates-dialog .style-discovery input { width: 100%; }
  .templates-dialog .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 550px) {
  .templates-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .templates-dialog > .dialog-heading { padding: 17px 16px 12px; }
  .templates-dialog .dialog-heading h2 { font-size: 20px; }
  .templates-dialog .dialog-heading p { font-size: 13px; }
  .templates-dialog .style-discovery { padding: 0 16px 14px; }
  .templates-dialog .style-filters { flex-wrap: nowrap; overflow-x: auto; gap: 1px; scrollbar-width: none; }
  .templates-dialog .style-filters button { padding: 7px 8px; font-size: 13px; flex-shrink: 0; }
  .style-browser-body { padding: 16px; }
  .templates-dialog .auto-template { padding: 12px; display: grid; gap: 3px; grid-template-columns: 1fr auto; }
  .templates-dialog .auto-template span { grid-row: 2; font-size: 13px; }
  .templates-dialog .auto-template i { grid-column: 2; grid-row: 1 / 3; }
  .templates-dialog .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .templates-dialog .template-card { padding: 6px; }
  .templates-dialog .template-description { padding: 10px 2px 3px; }
  .templates-dialog .template-description strong { font-size: 13px; }
  .templates-dialog .template-description small { font-size: 13px; }
  .template-demo-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); padding: 16px; }
  .template-demo-dialog > .dialog-heading { margin-bottom: 12px; }
  .style-preview-body { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .template-demo-dialog .style-preview-stage video { max-height: 43dvh; width: 100%; }
  .style-description { font-size: 14px; margin: 5px 0 12px; }
  .style-variants { margin-bottom: 10px; }
  .style-preview-note { font-size: 13px; margin-bottom: 12px; }
}
.style-preview-stage { width: fit-content; max-width: 100%; margin: 0 auto; }
.template-demo-dialog .style-preview-stage video { width: auto; max-width: 100%; height: min(65dvh, 620px); }
@media (max-width: 550px) { .template-demo-dialog .style-preview-stage video { width: auto; height: min(43dvh, 390px); } }
.templates-dialog .auto-template { flex-direction: row; min-height: 58px; }
@media (max-width: 550px) {
  /* Legacy dialog rules use !important; keep this reset limited to these two dialogs. */
  .templates-dialog { padding: 0 !important; }
  .template-demo-dialog { padding: 16px !important; }
}

/* story-chooser.css */
.story-chooser summary {
  gap: 9px;
  flex-wrap: wrap;
}
.story-chooser #story-selected {
  font-weight: 600;
  color: var(--accent);
}
.story-chooser #story-recommendation {
  font-size: 13px;
  color: var(--muted);
}
.story-chooser fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.story-option {
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 1px 6px;
}
.story-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--line-focus);
}
.story-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  flex: 1;
  cursor: pointer;
}
.story-option input { accent-color: var(--accent); }
.story-option small { display: block; color: var(--muted); line-height: 1.4; font-size: 13px; }
.story-option button { flex-shrink: 0; min-height: 44px; padding: 4px; text-decoration: underline; }
#story-preview:not(:empty) {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  justify-items: center;
}
#story-preview video {
  display: block;
  max-width: 100%;
  width: 180px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: var(--ink);
}
@media (max-width: 550px) {
  .story-chooser fieldset { grid-template-columns: 1fr; }
}

