:root {
  --ink: #431020;
  --ink-soft: #795261;
  --berry: #b3134a;
  --berry-dark: #890c37;
  --pink: #ffbde2;
  --pink-soft: #ffe5f3;
  --paper: #fffafd;
  --line: rgba(117, 28, 61, 0.14);
  --aqua: #62e4e7;
  --success: #1d886f;
  --danger: #b72e45;
  --shadow: 0 28px 70px rgba(96, 22, 52, 0.13);
  --radius: 22px;
}

* { box-sizing: border-box; }

html {
  color: var(--ink);
  background: #f9c9e4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.72), transparent 27rem),
    linear-gradient(135deg, #ffd9ed 0%, #f9bddc 52%, #f6b5d7 100%);
}

body.auth-locked {
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.75), transparent 25rem),
    radial-gradient(circle at 86% 82%, rgba(98,228,231,.28), transparent 24rem),
    linear-gradient(135deg, #ffd9ed, #f7b8da);
}

.login-card {
  width: min(460px, 100%);
  padding: 44px;
  background: rgba(255,250,253,.92);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 28px;
  box-shadow: 0 35px 90px rgba(96,22,52,.2);
  backdrop-filter: blur(20px);
}

.login-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 26px;
  place-items: center;
  color: white;
  background: var(--berry);
  border-radius: 15px;
  box-shadow: 0 10px 24px rgba(179,19,74,.24);
  font-size: 22px;
}

.login-card h1 {
  margin: 7px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 9vw, 52px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}

.login-card h1 em {
  color: var(--berry);
  font-weight: 500;
}

.login-copy {
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}

.login-form input {
  width: 100%;
  padding: 15px 16px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.login-form input:focus {
  border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(179,19,74,.1);
}

.login-button {
  width: 100%;
  margin-top: 5px;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.4;
}

.login-note {
  margin: 17px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

button, input, textarea, select { font: inherit; }
button, label, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: 0;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: .32;
}
.ambient-one {
  top: 18%;
  right: -190px;
  background: radial-gradient(circle, var(--aqua), transparent 68%);
}
.ambient-two {
  bottom: -240px;
  left: -130px;
  background: radial-gradient(circle, #fff, transparent 68%);
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 34px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.logout-button {
  padding: 8px 12px;
  color: var(--ink-soft);
  background: rgba(255,250,253,.62);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.logout-button:hover {
  color: var(--berry);
  background: rgba(255,250,253,.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--berry);
  border-radius: 13px;
  box-shadow: 0 9px 22px rgba(179, 19, 74, .23);
  font-size: 20px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: rgba(255, 250, 253, .62);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  backdrop-filter: blur(12px);
}
.service-dot {
  width: 8px;
  height: 8px;
  background: #d09eae;
  border-radius: 50%;
}
.service-pill.online .service-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(29,136,111,.12);
}
.service-pill.offline .service-dot { background: var(--danger); }

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  margin: 0 auto;
  padding: 32px 34px 70px;
}

.intro {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 430px);
  align-items: end;
  gap: 40px;
  margin: 18px 0 34px;
}
.eyebrow, .section-kicker {
  margin: 0 0 8px;
  color: var(--berry);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}
.intro h1 {
  max-width: 780px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5.6vw, 76px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .96;
}
.intro h1 em {
  color: var(--berry);
  font-weight: 500;
}
.intro-copy {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 24px;
}

.studio-card, .status-card, .history-card {
  background: rgba(255, 250, 253, .92);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.studio-card {
  padding: clamp(24px, 4vw, 46px);
  border-radius: 30px;
}
.status-card, .history-card { border-radius: var(--radius); }

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.step-number {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 13px;
}
.section-heading h2, .status-card h2, .history-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.025em;
}
.section-heading h2 { font-size: 26px; }
.section-heading .section-kicker { margin-bottom: 4px; }

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.field-stack > label, .mode-fieldset > legend {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}
input:not([type="radio"], [type="checkbox"], [type="range"], [type="color"]),
textarea, select {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:not([type="radio"], [type="checkbox"], [type="range"], [type="color"]),
select {
  height: 45px;
  padding: 0 13px;
}
textarea {
  min-height: 190px;
  padding: 13px;
  resize: vertical;
  line-height: 1.55;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(179,19,74,.10);
}
::placeholder { color: #b28e9a; }

.mode-fieldset {
  padding: 0;
  margin: 24px 0;
  border: 0;
}
.mode-fieldset > legend { margin-bottom: 9px; }
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mode-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option.active {
  border-color: var(--berry);
  box-shadow: inset 0 0 0 1px var(--berry), 0 8px 22px rgba(179,19,74,.08);
}
.mode-option:not(.disabled):hover { transform: translateY(-1px); }
.mode-option.disabled { cursor: not-allowed; opacity: .46; }
.mode-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--berry);
  background: var(--pink-soft);
  border-radius: 10px;
  font-weight: 800;
}
.mode-option strong, .mode-option small { display: block; }
.mode-option strong { font-size: 13px; }
.mode-option small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }

.preset-row { display: flex; gap: 10px; }
.preset {
  display: grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 1px 9px;
  min-width: 142px;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.preset.active {
  border-color: var(--berry);
  box-shadow: inset 0 0 0 1px var(--berry);
}
.preset small {
  grid-column: 2;
  color: var(--ink-soft);
  font-size: 9px;
}
.ratio {
  grid-row: 1 / span 2;
  justify-self: center;
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.ratio.landscape { width: 24px; height: 14px; }
.ratio.portrait { width: 13px; height: 22px; }
.ratio.square { width: 19px; height: 19px; }

.settings-panel {
  margin-top: 18px;
  background: rgba(255,255,255,.56);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.settings-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 750;
}
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary::after { content: "+"; font-size: 18px; font-weight: 400; }
.settings-panel[open] summary::after { content: "−"; }
.settings-panel summary small { color: var(--ink-soft); font-weight: 500; }
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 16px 18px;
}
.settings-grid { display: grid; gap: 13px; }
.settings-grid.three { grid-template-columns: repeat(3, 1fr); }
.toggle-control {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 11px 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.toggle-control input { width: 18px; height: 18px; accent-color: var(--berry); }
.toggle-control strong, .toggle-control small { display: block; }
.toggle-control strong { font-size: 12px; }
.toggle-control small { margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.color-control, .range-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 7px 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.color-control input {
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.color-control span, .range-control output {
  color: var(--ink-soft);
  font-size: 11px;
}
.range-control input { min-width: 0; flex: 1; accent-color: var(--berry); }
.choice-chip input { position: absolute; opacity: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip span {
  display: block;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.choice-chip input:checked + span {
  color: white;
  background: var(--berry);
  border-color: var(--berry);
}

.section-rule {
  height: 1px;
  margin: 36px 0;
  background: var(--line);
}
.asset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.asset-panel {
  min-width: 0;
  padding: 17px;
  background: rgba(255,255,255,.54);
  border: 1px solid var(--line);
  border-radius: 17px;
}
.optional-assets { margin-top: 16px; }
.compact-panel .dropzone.optional { min-height: 118px; }
.clear-optional {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 10px;
}
.clear-optional:hover { color: var(--danger); }
.asset-panel-heading, .status-card-top, .history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.asset-panel-heading { margin-bottom: 13px; }
.asset-panel h3 { margin: 0; font-family: Georgia, serif; font-size: 17px; font-weight: 500; }
.asset-panel-heading p { margin: 4px 0 0; color: var(--ink-soft); font-size: 10px; }
.count-badge {
  padding: 5px 8px;
  color: var(--berry);
  background: var(--pink-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.dropzone {
  display: flex;
  min-height: 166px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  background: white;
  border: 1.5px dashed #dca2b6;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.dragging {
  background: #fff5fa;
  border-color: var(--berry);
  transform: translateY(-1px);
}
.dropzone.compact { min-height: 190px; }
.upload-mark {
  display: grid;
  min-width: 37px;
  height: 37px;
  margin-bottom: 9px;
  padding: 0 6px;
  place-items: center;
  color: var(--berry);
  background: var(--pink-soft);
  border-radius: 11px;
  font-weight: 800;
}
.dropzone strong { font-size: 12px; }
.dropzone > span:not(.upload-mark) { margin-top: 2px; color: var(--berry); font-size: 10px; }
.dropzone small { margin-top: 9px; color: #a17b88; font-size: 8px; letter-spacing: .05em; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.file-list { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 9px 0 0; list-style: none; }
.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  background: white;
  border-radius: 10px;
  font-size: 10px;
}
.file-item > span:first-child { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--ink-soft); font-size: 9px; white-space: nowrap; }
.remove-file {
  display: grid;
  width: 23px;
  height: 23px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.remove-file:hover { color: var(--danger); background: #fff0f3; }

.caption-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 9px;
  padding: 4px;
  background: #f7e5ed;
  border-radius: 10px;
}
.caption-tabs.three { grid-template-columns: repeat(3, 1fr); }
.caption-tab {
  padding: 7px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}
.caption-tab.active { background: white; box-shadow: 0 2px 8px rgba(73,15,35,.08); }
.library-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.library-toolbar input, .library-toolbar select { height: 38px; font-size: 10px; }
.script-library {
  display: flex;
  min-height: 128px;
  max-height: 190px;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  padding-right: 3px;
  overflow-y: auto;
}
.script-library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  padding: 9px 10px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}
.script-library-item:hover { border-color: var(--line); }
.script-library-item strong { overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.script-library-item small { grid-column: 1; color: var(--ink-soft); font-size: 8px; }
.script-library-item span { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--berry); font-size: 8px; }
.library-empty { margin: auto; color: var(--ink-soft); font-size: 10px; }
.library-create { width: 100%; margin-top: 8px; }

.content-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 20px;
  color: var(--ink);
  background: var(--blush, #fff6fa);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(73,15,35,.28);
}
.content-dialog::backdrop { background: rgba(35,8,18,.58); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-heading h2 { margin: 3px 0 0; font-family: Georgia, serif; font-weight: 500; }
.dialog-close { width: 34px; height: 34px; padding: 0; color: var(--ink-soft); background: white; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 20px; }
.dialog-meta, .field-help { color: var(--ink-soft); font-size: 10px; }
.script-preview-list { max-height: 520px; padding: 0 0 0 32px; overflow-y: auto; }
.script-preview-list li { padding: 5px 8px; line-height: 1.4; font-size: 12px; }
.script-preview-list li:nth-child(odd) { background: rgba(255,255,255,.55); border-radius: 7px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.dialog-actions .danger-button { margin-right: auto; }
.editor-dialog { overflow-y: auto; }
.editor-dialog > .field-stack { margin-top: 16px; }
.ai-script-panel { margin: 15px 0; background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 13px; }
.ai-script-panel summary { padding: 12px 14px; cursor: pointer; font-size: 12px; font-weight: 750; }
.ai-script-content { display: flex; flex-direction: column; gap: 9px; padding: 0 13px 13px; }
.ai-script-content textarea { min-height: 78px; }
.ai-generate-row { display: flex; gap: 8px; }
.ai-generate-row select { flex: 1; }
.generation-status { margin: 0; color: var(--ink-soft); font-size: 10px; }
.generation-status.error { color: var(--danger); }
.editor-caption-heading { display: flex; justify-content: space-between; margin: 8px 0; font-size: 11px; font-weight: 750; }
.editor-caption-heading span { color: var(--ink-soft); font-weight: 500; }
.script-editor-text { min-height: 280px; }

.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
  padding: 16px 0 0;
}
.submit-bar p { margin: 0; font-family: Georgia, serif; font-size: 16px; }
.submit-bar small { color: var(--ink-soft); font-size: 10px; }
.primary-button, .download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 49px;
  padding: 0 20px;
  color: white;
  background: var(--berry);
  border: 0;
  border-radius: 13px;
  box-shadow: 0 10px 25px rgba(179,19,74,.22);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  transition: background .2s, transform .2s, box-shadow .2s;
}
.primary-button:hover, .download-button:hover {
  background: var(--berry-dark);
  box-shadow: 0 13px 30px rgba(137,12,55,.25);
  transform: translateY(-1px);
}
.primary-button:disabled { cursor: wait; opacity: .58; transform: none; }

.side-column { display: flex; flex-direction: column; gap: 16px; }
.status-card { padding: 24px; }
.status-card h2, .history-card h2 { font-size: 21px; }
.status-badge {
  padding: 6px 9px;
  color: var(--ink-soft);
  background: #f5e7ed;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status-badge.queued { color: #8a5b05; background: #fff2d5; }
.status-badge.running { color: #126d70; background: #dff8f7; }
.status-badge.completed { color: #176e58; background: #def5ec; }
.status-badge.failed { color: var(--danger); background: #ffe4e9; }
.status-badge.cancelled { color: #6f5a63; background: #eee7ea; }
.active-message {
  min-height: 42px;
  margin: 18px 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}
.progress-track {
  height: 7px;
  overflow: hidden;
  background: #f1dfe7;
  border-radius: 999px;
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--berry), #df5688);
  border-radius: inherit;
  transition: width .45s ease;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 9px;
}
.progress-meta strong { color: var(--ink); font-size: 10px; }
.download-button { width: 100%; margin-top: 19px; }
.job-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.secondary-button, .danger-button {
  min-height: 40px;
  padding: 0 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}
.secondary-button:hover { color: var(--berry); border-color: #dca2b6; }
.danger-button { color: var(--danger); }
.danger-button:hover { background: #fff0f3; border-color: #e4a4b0; }
.secondary-button:disabled, .danger-button:disabled {
  cursor: wait;
  opacity: .55;
}

.history-card { padding: 22px 20px; }
.history-heading { align-items: center; margin-bottom: 14px; }
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.icon-button:hover { color: var(--berry); border-color: #dca2b6; }
.history-list { display: flex; flex-direction: column; gap: 7px; }
.history-empty { padding: 24px 8px; text-align: center; color: #a17b88; font-size: 10px; }
.usage-note {
  margin: 13px 2px 0;
  color: var(--ink-soft);
  font-size: 8px;
  text-align: center;
}
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  width: 100%;
  padding: 11px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}
.history-item:hover { border-color: var(--line); }
.history-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 500;
}
.history-item small { color: var(--ink-soft); font-size: 8px; }
.mini-status {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  width: 7px;
  height: 7px;
  background: #c6a8b3;
  border-radius: 50%;
}
.mini-status.running { background: #1f9da0; box-shadow: 0 0 0 3px #dcf5f4; }
.mini-status.completed { background: var(--success); }
.mini-status.failed { background: var(--danger); }
.mini-status.cancelled { background: #8d7881; }
.mini-status.queued { background: #c58b18; }

.worker-note {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  color: var(--ink-soft);
  background: rgba(255,250,253,.48);
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 15px;
  font-size: 9px;
  line-height: 1.5;
}
.worker-note > span {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--berry);
  background: var(--pink-soft);
  border-radius: 50%;
  font-family: Georgia, serif;
}
.worker-note p { margin: 0; }

.toast-region {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(360px, calc(100vw - 40px));
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 13px 15px;
  color: white;
  background: var(--ink);
  border-radius: 12px;
  box-shadow: 0 15px 35px rgba(67,16,32,.25);
  font-size: 11px;
  line-height: 1.45;
  animation: toast-in .25s ease both;
}
.toast.error { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .side-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .worker-note { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .login-card { padding: 32px 24px; }
  .topbar { padding: 18px; }
  .page-shell { padding: 20px 16px 45px; }
  .intro { grid-template-columns: 1fr; gap: 18px; margin-top: 5px; }
  .intro h1 { font-size: clamp(39px, 13vw, 58px); }
  .studio-card { padding: 24px 18px; border-radius: 22px; }
  .mode-grid { grid-template-columns: 1fr; }
  .preset-row { display: grid; grid-template-columns: repeat(3, 1fr); }
  .preset { min-width: 0; grid-template-columns: 1fr; text-align: center; }
  .preset .ratio { display: none; }
  .preset small { grid-column: 1; }
  .settings-grid.three, .asset-grid, .side-column { grid-template-columns: 1fr; }
  .settings-panel summary small { display: none; }
  .submit-bar { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .worker-note { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
