:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --panel-raised: #ffffff;
  --line: #dfe4ea;
  --line-soft: #edf0f4;
  --text: #171a1f;
  --muted: #66707d;
  --subtle: #929aa5;
  --accent: #6366f1;
  --accent-ink: #ffffff;
  --green: #1f9d55;
  --red: #d14343;
  --shadow: 0 24px 60px rgba(28, 39, 54, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(1760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.topbar,
.rail,
.stage-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9)),
    rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-color: rgba(99, 102, 241, 0.24);
  border-radius: 12px;
  background: linear-gradient(180deg, #7477ff 0%, var(--accent) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 18px 40px rgba(99, 102, 241, 0.24);
}

.topbar h1,
.topbar .eyebrow {
  color: #ffffff;
}

.topbar .eyebrow {
  opacity: 0.82;
}

.topbar .brand-mark {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.94);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.topbar .brand-mark img {
  filter: none;
}

.topbar .run-status,
.topbar .ghost-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.topbar .run-status.error {
  background: rgba(209, 67, 67, 0.34);
}

.brand,
.topbar-actions,
.stage-head,
.inline-actions,
.preview-head {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 13px;
}

.brand-home-link {
  border-radius: 12px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.brand-home-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.92);
  outline-offset: 4px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(99, 102, 241, 0.16), rgba(255, 255, 255, 0.86)),
    #fff;
  color: var(--accent);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 10px 22px rgba(99, 102, 241, 0.12);
}

.brand-mark img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.eyebrow,
.section-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 3px;
  overflow: hidden;
  font-size: 19px;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 10px;
}

.run-status,
.stage-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.run-status {
  min-width: 138px;
  justify-content: center;
  padding: 0 13px;
}

.topbar .run-status[hidden] {
  display: none !important;
}

.stage-chip {
  padding: 0 10px;
}

.ghost-button,
.secondary-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f5f7fa);
  color: var(--text);
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ghost-button {
  padding: 0 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.workspace [hidden] {
  display: none !important;
}

.rail {
  position: sticky;
  top: 14px;
  height: calc(100vh - 122px);
  min-height: 680px;
  border-radius: 12px;
}

.product-mode-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.product-mode-button span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--subtle);
  font-size: 10px;
  font-weight: 900;
}

.product-mode-button strong {
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
}

.product-mode-button::after {
  content: "›";
  color: var(--subtle);
  font-size: 24px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.product-mode-button.active {
  border-color: #4d53c8;
  background: rgba(99, 102, 241, 0.09);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.product-mode-button.active span {
  background: var(--accent);
  color: #ffffff;
}

.product-mode-button.active::after {
  color: var(--accent);
  transform: rotate(90deg);
}

.rail {
  display: grid;
  z-index: 2;
  align-self: start;
  align-content: start;
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 122px);
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.product-subnav {
  display: grid;
  gap: 6px;
  margin: -2px 0 4px 12px;
  padding: 6px 0 8px 8px;
}

.rail-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  min-height: 46px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--muted);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.rail-step span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8fa;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 850;
}

.rail-step strong {
  color: inherit;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-step.active {
  border-color: #4d53c8;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0.72)),
    rgba(99, 102, 241, 0.08);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.rail-step.active span {
  border-color: rgba(99, 102, 241, 0.42);
  color: var(--accent);
}

.main-stage {
  display: grid;
  grid-column: 2 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
  align-items: stretch;
}

.video-step-one-column,
.video-stage-stack {
  display: grid;
  min-width: 0;
  gap: 14px;
  align-content: start;
}

.video-stage-stack {
  align-content: stretch;
}

.stage-card {
  min-height: 520px;
  padding: 18px;
  border-radius: 12px;
}

.video-flow-stage {
  display: block;
}

.video-flow-stage[data-progressive="true"] {
  display: grid;
  align-content: start;
  gap: 18px;
}

.video-flow-stage[data-progressive="true"] .video-flow-panel {
  min-width: 0;
}

.video-flow-stage[data-progressive="true"] .video-flow-panel + .video-flow-panel {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.video-flow-panel[hidden] {
  display: none !important;
}

#promptStage {
  display: flex;
  flex-direction: column;
}

#promptStage.is-collapsed {
  padding: 14px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.045);
}

#promptStage.is-collapsed > :not(.stage-head) {
  display: none !important;
}

#promptStage.is-collapsed .stage-head {
  margin-bottom: 0;
}

.stage-card,
.rail {
  outline: 1px solid rgba(255, 255, 255, 0.72);
  outline-offset: -2px;
}

.image-shell[hidden] {
  display: none;
}

.image-shell {
  display: block;
  grid-column: 2 / -1;
}

.main-stage > .recent-task-notice {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.recent-task-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 11px;
  background: rgba(99, 102, 241, 0.07);
}

.recent-task-notice[hidden] {
  display: none;
}

.recent-task-notice-copy {
  min-width: 0;
}

.recent-task-notice-copy strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
}

.recent-task-notice-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.recent-task-notice-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.recent-task-notice-actions a,
.recent-task-notice-actions button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 8px;
  background: #ffffff;
  color: #4d53c8;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.recent-task-notice-actions a[hidden] {
  display: none;
}

.image-tool-button {
  display: grid;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--muted);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.image-tool-button strong {
  color: inherit;
  font-size: 14px;
}

.image-tool-button.active {
  border-color: #4d53c8;
  background: rgba(99, 102, 241, 0.14);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.image-history-refresh {
  min-height: 36px;
  padding: 0 12px;
}

.image-stage {
  display: grid;
  gap: 14px;
}

.image-compose-card {
  min-height: 620px;
}

.image-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 18px;
}

.image-form-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.image-type-tabs,
.replicate-variant-tabs {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.image-type-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-color: rgba(99, 102, 241, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8f8ff 0%, #f1f2fb 100%);
  box-shadow: inset 0 1px 2px rgba(79, 82, 217, 0.06);
}

.replicate-variant-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-type-tabs button,
.replicate-variant-tabs button {
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.image-type-tabs button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #4d53c8;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: #4d53c8;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 7px rgba(79, 82, 217, 0.06);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.image-type-tabs button:not(.active):hover {
  border-color: #353aa8;
  background: #ffffff;
  color: #353aa8;
  box-shadow: 0 4px 12px rgba(79, 82, 217, 0.12);
}

.image-type-tabs button.active,
.replicate-variant-tabs button.active {
  background: #4f52d9;
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(79, 82, 217, 0.22);
}

.image-type-tabs button.active {
  border-color: transparent;
  background: linear-gradient(135deg, #5d61e8 0%, #4f52d9 100%);
  box-shadow: 0 6px 16px rgba(79, 82, 217, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.image-type-tabs button:focus-visible {
  outline: 2px solid rgba(79, 82, 217, 0.4);
  outline-offset: 2px;
}

.replicate-variant-tabs[hidden] {
  display: none;
}

.replicate-variant-tabs button strong {
  font-size: inherit;
}

.image-ad-fields {
  display: grid;
  gap: 14px;
}

.image-upload-card {
  display: grid;
  min-height: 132px;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 18px;
  border: 1px dashed rgba(99, 102, 241, 0.42);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.04);
  text-align: center;
  cursor: pointer;
}

.image-upload-card.reference {
  margin-top: 0;
  border-color: rgba(99, 102, 241, 0.42);
  background: rgba(99, 102, 241, 0.04);
}

.image-upload-card span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
}

.image-upload-card strong {
  font-size: 15px;
}

.image-upload-card small {
  color: var(--muted);
  font-size: 11px;
}

.image-upload-card input {
  display: none;
}

.image-file-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.image-file-preview:empty {
  display: none;
}

.image-upload-card .image-file-preview {
  width: 100%;
  margin-top: 8px;
  grid-template-columns: repeat(auto-fill, 112px);
  justify-content: start;
  gap: 12px;
}

.image-upload-card .image-upload-add-tile {
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px dashed #d8dbe0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #777d85;
  font-size: 38px;
  font-weight: 350;
  line-height: 1;
}

.image-upload-card .image-upload-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(48, 52, 58, 0.78);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.2);
  font-size: 23px;
  font-weight: 300;
  line-height: 1;
}

.image-upload-card .image-upload-remove:hover {
  background: rgba(30, 33, 38, 0.94);
}

.image-file-preview figure {
  position: relative;
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.image-file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-file-preview figcaption {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  overflow: hidden;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(17, 24, 39, 0.72);
  color: #ffffff;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-control-grid {
  gap: 10px;
}

.image-provider-field {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.image-main-module {
  display: grid;
  gap: 10px;
}

.image-main-module[hidden] {
  display: none;
}

.image-main-module-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-main-module-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.image-main-module-tabs button {
  min-height: 40px;
  border: 1px solid #4d53c8;
  border-radius: 9px;
  background: #ffffff;
  color: #4d53c8;
  font-size: 12px;
  font-weight: 800;
}

.image-main-module-tabs button.active {
  border-color: #4f52d9;
  background: #4f52d9;
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(79, 82, 217, 0.22);
}

.image-main-module-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.image-main-module-custom {
  display: grid;
  gap: 10px;
}

.image-main-module-custom[hidden] {
  display: none;
}

.image-main-module-toolbar {
  display: flex;
  min-height: 26px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.image-main-module-total {
  margin-left: auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.image-main-module-select-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  cursor: pointer;
}

.image-main-module-select-all input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #17191d;
}

.image-main-module-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.image-main-module-option {
  display: grid;
  min-width: 0;
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) 76px;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.04);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.image-main-module-option.selected {
  border-color: rgba(99, 102, 241, 0.48);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.image-main-module-option.limit-disabled:not(.selected) {
  opacity: 0.48;
}

.image-main-module-option label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.image-main-module-option label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.image-main-module-check {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #9ca2aa;
  border-radius: 7px;
  background: #ffffff;
  color: transparent;
  font-size: 13px;
  font-weight: 900;
}

.image-main-module-option.selected .image-main-module-check {
  border-color: #17191d;
  background: #17191d;
  color: #ffffff;
}

.image-main-module-option strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
}

.image-main-module-option select {
  width: 76px;
  height: 36px;
  padding: 0 30px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2366707d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.image-main-module-option select:disabled {
  opacity: 0.5;
}

.image-ai-write-field {
  position: relative;
}

.image-ai-write-field textarea {
  height: 163px;
  min-height: 163px;
  padding-bottom: 70px;
  font-size: 14px;
}

.image-ai-write-button {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: #4d53c8;
  box-shadow: 0 5px 16px rgba(28, 39, 54, 0.1);
  font-size: 13px;
}

.image-ai-write-button:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 7px 20px rgba(99, 102, 241, 0.14);
}

.image-ai-write-button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.16);
}

.image-ai-write-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.image-ai-write-button strong {
  white-space: nowrap;
}

.image-ai-write-help {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: #4d53c8;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.image-ai-plan-dialog {
  width: min(960px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(18, 24, 35, 0.28);
}

.image-ai-plan-dialog::backdrop {
  background: rgba(22, 27, 35, 0.48);
  backdrop-filter: blur(5px);
}

.image-ai-plan-panel {
  display: flex;
  min-height: min(780px, calc(100vh - 34px));
  max-height: calc(100vh - 34px);
  flex-direction: column;
}

.image-ai-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.image-ai-plan-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.image-ai-plan-heading h2 {
  margin: 0 0 3px;
  font-size: 20px;
}

.image-ai-plan-heading p {
  color: var(--muted);
  font-size: 12px;
}

.image-ai-plan-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: #f2f0eb;
  color: #4d4d49;
  font-size: 23px;
}

.image-ai-plan-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  color: #555b63;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.image-ai-plan-close:hover {
  background: var(--panel-soft);
}

.image-ai-plan-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 18px;
  padding: 22px 28px 24px;
}

.image-ai-plan-tabs-row {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.image-ai-plan-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-ai-plan-tab {
  min-width: 78px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 750;
}

.image-ai-plan-tab.active {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.image-ai-plan-editor {
  width: 100%;
  min-height: 360px;
  flex: 1;
  padding: 22px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fbfbfa;
  color: #202326;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.75;
}

.image-ai-plan-editor:focus {
  border-color: rgba(99, 102, 241, 0.48);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.image-ai-plan-confirm {
  min-height: 56px;
  border-radius: 13px;
  background: #111111;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
}

.image-ai-plan-regenerate {
  display: inline-flex;
  min-height: 34px;
  align-self: center;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.image-planning-inline {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f9fb;
  color: var(--text);
}

.image-planning-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  list-style: none;
}

.image-planning-header::-webkit-details-marker { display: none; }
.image-planning-toggle { flex-shrink: 0; color: var(--accent); font-size: 13px; }
.image-planning-toggle::after { content: "展开"; }
.image-planning-inline[open] > summary .image-planning-toggle::after { content: "收起"; }
.image-planning-confirmed > summary { padding: 12px 16px; }
.image-planning-confirmed .image-planning-heading,
.image-planning-confirmed .image-planning-heading > div { min-width: 0; }
.image-planning-confirmed .image-planning-heading h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-planning-confirmed .image-planning-icon { display: none; }

.image-planning-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.image-planning-heading h3,
.image-planning-section-head h3 {
  margin: 0;
}

.image-planning-heading h3 {
  font-size: 15px;
}

.image-planning-heading p,
.image-planning-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.image-planning-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  font-size: 22px;
}

.image-planning-body {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.image-planning-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.image-planning-section-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: #f5f3ef;
}

.image-planning-section-head h3 {
  font-size: 15px;
}

.image-planning-overall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.image-planning-facts {
  grid-column: 1 / -1;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.07);
}

.image-planning-facts strong {
  font-size: 13px;
}

.image-planning-facts p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.image-planning-field {
  display: grid;
  gap: 6px;
}

.image-planning-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.image-planning-field input,
.image-planning-field textarea {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #fbfcfe;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
}

.image-planning-field textarea {
  min-height: 70px;
}

.image-planning-field input:focus,
.image-planning-field textarea:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.09);
}

.image-planning-items {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.image-planning-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #ffffff;
}

.image-planning-item[open] {
  border-color: rgba(99, 102, 241, 0.38);
  box-shadow: 0 8px 24px rgba(37, 46, 65, 0.07);
}

.image-planning-item summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
}

.image-planning-item summary::-webkit-details-marker {
  display: none;
}

.image-planning-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #f2f0eb;
  font-size: 13px;
  font-weight: 850;
}

.image-planning-summary-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.image-planning-summary-copy strong {
  font-size: 13px;
}

.image-planning-summary-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-planning-item summary em {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.image-planning-remove {
  padding: 7px 10px;
  border: 1px solid rgba(205, 52, 52, 0.18);
  border-radius: 8px;
  background: rgba(205, 52, 52, 0.05);
  color: #b42318;
  font-size: 11px;
}

.image-planning-item-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 15px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.image-planning-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.image-planning-regenerate,
.image-planning-confirm {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.image-planning-regenerate {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
}

.image-planning-confirm {
  min-width: 240px;
  background: #111111;
  color: #ffffff;
}

.image-ai-plan-regenerate span {
  font-size: 22px;
  line-height: 1;
}

.image-results-card {
  min-height: 360px;
}

.image-results-column {
  display: flex;
}

.image-results-panel {
  flex: 1;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.025);
}

.image-progress {
  height: 6px;
  margin: -4px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.image-progress span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.image-generation-notice {
  position: fixed;
  top: 108px;
  right: 24px;
  z-index: 80;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  width: min(360px, calc(100vw - 32px));
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(91, 75, 211, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 48px rgba(31, 28, 65, 0.18);
  backdrop-filter: blur(16px);
  animation: image-generation-notice-in 180ms ease-out;
}

.image-new-round-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(91, 75, 211, 0.24);
  border-radius: 10px;
  background: rgba(91, 75, 211, 0.08);
  color: var(--text);
  font-size: 13px;
}

.image-new-round-notice[hidden] { display: none; }
.image-new-round-notice button {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.image-generation-notice[hidden] {
  display: none;
}

.image-generation-notice-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #565ce8, #7954da);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
}

.image-generation-notice strong {
  display: block;
  margin: 1px 0 5px;
  color: var(--text);
  font-size: 15px;
}

.image-generation-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@keyframes image-generation-notice-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.image-result-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.image-result-empty strong {
  color: var(--text);
}

.image-result-empty span {
  max-width: 520px;
  font-size: 12px;
  line-height: 1.6;
}

.image-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.image-result-grid:empty {
  display: none;
}

.image-result-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.image-result-item-unavailable,
.image-history-unavailable {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.image-generation-form.replicate-active .image-result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-result-hover-actions {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(16, 22, 33, 0.54);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.image-result-item:hover .image-result-hover-actions,
.image-result-item:focus-within .image-result-hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.image-result-hover-actions button,
.image-result-hover-actions a {
  display: grid;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #6366f1;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.image-result-hover-actions button:hover,
.image-result-hover-actions a:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.image-result-action-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-result-download-icon {
  width: 21px;
  height: 21px;
}

.image-result-hover-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.image-regenerate-all {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.image-regenerate-all:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.48);
  color: var(--accent);
}

.image-result-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #eef1f5;
}

.image-result-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #eef1f5;
  cursor: zoom-in;
}

.image-result-preview-button img {
  transition: transform 160ms ease, filter 160ms ease;
}

.image-result-preview-button:hover img {
  transform: scale(1.015);
  filter: brightness(0.97);
}

.image-result-preview-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.image-result-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: 28px;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.image-result-lightbox::backdrop {
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(6px);
}

.image-result-lightbox-panel {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
  pointer-events: none;
}

.image-result-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-inline-size: calc(100vw - 56px);
  max-block-size: calc(100dvh - 56px);
  object-fit: contain;
  border-radius: 10px;
  background: #111722;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.image-result-lightbox-close {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(17, 23, 34, 0.86);
  color: #ffffff;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  pointer-events: auto;
}

.image-result-lightbox-close:hover {
  background: #111722;
}

.image-result-item a {
  display: block;
  padding: 11px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.image-result-item-label {
  display: block;
  padding: 10px 11px 0;
  color: var(--text);
  font-size: 11px;
  text-align: center;
}

.image-result-provider {
  display: block;
  padding: 0 10px 7px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.image-history-page {
  min-height: 720px;
  padding: clamp(22px, 3vw, 42px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.video-history-page {
  grid-column: 2 / -1;
}

.video-history-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.video-history-list > p {
  padding: 40px 12px;
  color: var(--muted);
  text-align: center;
}

.video-history-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(21, 29, 51, 0.06);
}

.video-history-card.selected {
  border-color: rgba(99, 102, 241, 0.48);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.12);
}

.video-history-thumbnail {
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), #f8f9ff);
  color: var(--accent);
  font-weight: 900;
}

.video-history-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-history-card-body {
  min-width: 0;
}

.video-history-card-body h3 {
  margin: 0 0 8px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-history-card-body > p {
  margin: 10px 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--subtle);
}

.video-history-open {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  font-weight: 800;
}

.video-history-open:hover {
  border-color: rgba(99, 102, 241, 0.52);
  background: rgba(99, 102, 241, 0.14);
}

.video-history-list.date-view {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.video-history-list.date-view .image-history-date-heading {
  grid-column: 1 / -1;
}

.video-history-more {
  width: auto;
  min-width: 140px;
  margin: 18px auto 0;
}

@media (max-width: 900px) {
  .video-history-card {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .video-history-open {
    grid-column: 1 / -1;
  }
}

.image-history-page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.image-history-page-head h2 {
  margin: 3px 0 4px;
  font-size: clamp(24px, 3vw, 38px);
}

.image-history-page-head > div > p:last-child {
  margin: 0;
  color: var(--muted);
}

.image-history-toolbar {
  display: grid;
  grid-template-columns: max-content 220px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 30px 0 20px;
}

.image-history-sort,
.image-history-sort-tabs,
.image-history-date-filter {
  display: flex;
  align-items: center;
}

.image-history-sort {
  gap: 10px;
  white-space: nowrap;
}

.image-history-sort-tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
}

.image-history-sort-tabs button {
  min-height: 36px;
  padding: 0 17px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.image-history-sort-tabs button.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(79, 70, 229, 0.2);
}

.image-history-search {
  display: flex;
  width: 220px;
  justify-self: start;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.image-history-search:focus-within {
  border-color: #aaa3ff;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.image-history-search-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: #777973;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.image-history-search input#imageHistorySearch,
.image-history-search input#videoHistorySearch {
  width: 100%;
  height: auto;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: none;
}

.image-history-search input::placeholder {
  color: #8d8d87;
  opacity: 1;
}

.image-history-date-filter {
  gap: 12px;
  justify-self: end;
  color: var(--muted);
  white-space: nowrap;
}

.image-history-date-picker {
  position: relative;
}

.image-history-date-trigger {
  display: flex;
  width: 210px;
  min-width: 210px;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  color: #777973;
  font: inherit;
  font-size: 14px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.image-history-date-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-history-date-trigger:hover,
.image-history-date-trigger[aria-expanded="true"] {
  border-color: #aaa3ff;
  background: var(--panel-soft);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.image-history-date-trigger svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.image-history-calendar {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: 324px;
  padding: 16px;
  border: 1px solid #ddd9d0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(39, 39, 54, 0.16);
}

.image-history-calendar[hidden] {
  display: none;
}

.image-history-calendar-head {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  margin-bottom: 12px;
}

.image-history-calendar-head strong {
  color: var(--text);
  text-align: center;
}

.image-history-calendar-head button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.image-history-calendar-head button:hover {
  background: var(--panel-soft);
  color: var(--accent);
}

.image-history-calendar-weekdays,
.image-history-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.image-history-calendar-weekdays {
  margin-bottom: 4px;
  color: #9a9b96;
  font-size: 12px;
  text-align: center;
}

.image-history-calendar-weekdays span {
  padding: 7px 0;
}

.image-history-calendar-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.image-history-calendar-day:hover {
  background: #efedff;
  color: var(--accent);
}

.image-history-calendar-day.outside-month {
  color: #c5c5c1;
}

.image-history-calendar-day.today {
  box-shadow: inset 0 0 0 1px #aaa3ff;
}

.image-history-calendar-day.in-range {
  border-radius: 0;
  background: #efedff;
  color: var(--accent);
}

.image-history-calendar-day.selected {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.24);
}

.image-history-calendar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.image-history-calendar-actions button {
  min-width: 68px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-weight: 750;
}

.image-history-calendar-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.image-history-list {
  display: grid;
  gap: 18px;
}

.image-history-list > p,
.image-history-project-empty {
  margin: 0;
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.image-history-date-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  gap: 12px;
  margin: 8px 0 -2px;
  color: var(--text);
}

.image-history-date-heading strong {
  font-size: 20px;
}

.image-history-date-heading span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.image-history-list.date-view {
  grid-template-columns: repeat(auto-fill, minmax(170px, 220px));
  align-items: start;
  gap: 18px;
}

.image-history-list.date-view .image-history-project,
.image-history-list.date-view .image-history-images {
  display: contents;
}

.image-history-list.date-view .image-history-project-head,
.image-history-list.date-view .image-history-project-actions,
.image-history-list.date-view .image-history-project-empty {
  display: none;
}

.image-history-project {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.055);
}

.image-history-project-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.image-history-project-head h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.image-history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.image-history-tag {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.image-history-tag.primary {
  border-color: rgba(99, 102, 241, 0.18);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

.image-history-tag.failed {
  color: var(--red);
}

.image-history-tag.running,
.image-history-tag.queued {
  color: #b45309;
}

.image-history-prompt-button {
  padding: 5px 10px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
}

.image-history-prompt-button:hover {
  background: rgba(99, 102, 241, 0.08);
}

.image-history-prompt-dialog {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  max-height: min(780px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
}

.image-history-prompt-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.image-history-prompt-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(780px, calc(100dvh - 32px));
}

.image-history-prompt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.image-history-prompt-head h2 {
  margin: 3px 0 6px;
  font-size: 22px;
}

.image-history-prompt-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.image-history-prompt-head > button {
  width: 36px;
  height: 36px;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-history-prompt-content {
  display: grid;
  gap: 18px;
  padding: 22px 26px;
  overflow: auto;
  background: #fafbff;
}

.image-history-prompt-group {
  display: grid;
  gap: 12px;
}

.image-history-prompt-group h3 {
  margin: 0;
  font-size: 15px;
}

.image-history-prompt-group article {
  display: grid;
  gap: 8px;
}

.image-history-prompt-group article > strong {
  color: var(--muted);
  font-size: 12px;
}

.image-history-prompt-group pre {
  margin: 0;
  padding: 16px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.image-history-prompt-empty {
  margin: 0;
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

.image-history-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
}

.image-history-project-meta {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.image-history-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 190px));
  gap: 14px;
  margin-top: 22px;
}

.image-history-image {
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 13px;
  background: var(--panel-soft);
}

.image-history-image.selected {
  border-color: var(--accent);
}

.image-history-image-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-history-image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.image-history-thumbnail-status {
  display: grid;
  width: 100%;
  aspect-ratio: 1 / 1;
  place-items: center;
  color: var(--muted);
}

.image-history-thumbnail-status[hidden],
.image-history-image-preview img[hidden] {
  display: none;
}

.image-history-image-check {
  position: absolute;
  top: 9px;
  left: 9px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 9px;
  background: rgba(17, 24, 39, 0.82);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(17, 24, 39, 0.2);
}

.image-history-image-actions {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 1;
  display: flex;
  gap: 7px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.image-history-image:hover .image-history-image-actions,
.image-history-image:focus-within .image-history-image-actions {
  opacity: 1;
  transform: translateY(0);
}

.image-history-image-action {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 31, 47, 0.78);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.22);
  transition: background 150ms ease, transform 150ms ease;
}

.image-history-image-action:hover:not(:disabled) {
  background: rgba(22, 31, 47, 0.96);
  transform: scale(1.06);
}

.image-history-image-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.image-history-image-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.image-history-image figcaption {
  overflow: hidden;
  padding: 9px 10px;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-history-project-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 18px;
}

.image-history-project-actions button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  color: var(--text);
  font-weight: 780;
}

.image-history-project-actions button:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.38);
  color: var(--accent);
}

.image-history-project-actions .image-history-download.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.image-history-project-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.image-history-project-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 980px) {
  .image-history-toolbar {
    grid-template-columns: 1fr;
  }

  .image-history-date-filter {
    justify-self: start;
    flex-wrap: wrap;
  }

  .image-history-date-trigger {
    width: min(210px, calc(100vw - 72px));
    min-width: min(210px, calc(100vw - 72px));
  }

  .image-history-calendar {
    right: auto;
    left: 0;
    width: min(324px, calc(100vw - 56px));
  }
}

@media (max-width: 640px) {
  .image-history-page {
    padding: 18px;
  }

  .image-history-project-head {
    display: grid;
  }

  .image-history-project-meta {
    text-align: left;
  }

  .image-history-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body :where(
  .topbar,
  .unified-rail,
  .image-shell,
  .image-ai-plan-dialog,
  #videoMainStage,
  #videoHistoryView
) :where(
  h1,
  h2,
  h3,
  p,
  span,
  strong,
  small,
  button,
  input,
  textarea,
  select,
  option,
  label,
  a
) {
  font-size: 12px;
}

body.image-page-active .product-mode-button::after {
  font-size: 20px;
}

body.image-page-active .image-upload-card .image-upload-add-tile {
  font-size: 30px;
}

body.image-page-active .image-upload-card .image-upload-remove,
body.image-page-active .image-ai-plan-close {
  font-size: 20px;
}

body.image-page-active .image-ai-plan-icon,
body.image-page-active .image-ai-plan-regenerate > span {
  font-size: 18px;
}

.stage-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.video-stage-actions,
.video-download-action {
  display: flex;
  align-items: center;
}

.video-stage-actions {
  gap: 12px;
}

.video-generation-notice {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(79, 70, 229, 0.24);
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  color: #3730a3;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.video-generation-notice[hidden] {
  display: none;
}

.video-wait-estimate {
  margin: 10px 0 0;
  color: #575a70;
  font-size: 13px;
  line-height: 1.5;
}

.video-wait-estimate[hidden] {
  display: none;
}

.video-download-action {
  gap: 7px;
  min-height: 34px;
  padding: 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.video-download-action[hidden] {
  display: none;
}

.video-download-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.video-download-action:hover {
  color: #4f46e5;
}

.asset-grid,
.prompt-layout {
  display: grid;
  gap: 14px;
}

.asset-grid {
  grid-template-columns: minmax(0, 1fr);
}

.asset-upload-column {
  display: grid;
  min-width: 0;
  grid-template-rows: auto;
  gap: 12px;
}

.upload-zone,
.mini-panel,
.video-board,
.platform-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(247, 249, 251, 0.96)),
    var(--panel-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border: 1px dashed rgba(99, 102, 241, 0.42);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.04);
  color: var(--muted);
  box-shadow: none;
}

.upload-zone:focus-within {
  border-color: rgba(99, 102, 241, 0.44);
  background: rgba(99, 102, 241, 0.05);
}

.upload-zone input {
  display: none;
}

.upload-preview-grid {
  display: none;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 132px;
  gap: 8px;
}

.upload-zone.has-images .upload-preview-grid {
  display: grid;
}

.upload-zone.has-images {
  justify-content: flex-start;
}

.upload-preview-grid[data-count="1"] {
  grid-template-columns: 1fr;
  grid-auto-rows: 260px;
}

.upload-preview-grid[data-count="2"] {
  grid-auto-rows: 220px;
}

.upload-preview-grid[data-count="3"],
.upload-preview-grid[data-count="4"] {
  grid-auto-rows: 154px;
}

.upload-preview-card {
  position: relative;
  min-width: 0;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8fa;
}

.upload-preview-card:only-child {
  grid-column: 1 / -1;
}

.upload-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upload-role,
.upload-name,
.upload-remove {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(214, 220, 229, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(28, 39, 54, 0.1);
}

.upload-role {
  top: 7px;
  left: 7px;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.upload-remove {
  top: 6px;
  right: 6px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.upload-name {
  right: 7px;
  bottom: 7px;
  left: 7px;
  overflow: hidden;
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-add {
  display: flex;
  width: 100%;
  min-height: 98px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.upload-zone.has-images .upload-add {
  min-height: 56px;
  justify-content: flex-start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.upload-add:disabled {
  cursor: default;
  opacity: 0.58;
}

.upload-add-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.upload-add-copy strong {
  color: var(--text);
  font-size: 16px;
}

.upload-add-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(99, 102, 241, 0.38);
  border-radius: 12px;
  color: var(--accent);
  font-size: 30px;
}

.platform-card small,
.video-placeholder small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 9px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

textarea,
select,
input:not([type="checkbox"]):not([type="file"]) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(28, 39, 54, 0.04);
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding: 14px;
  line-height: 1.65;
}

#goalInput {
  min-height: 230px;
}

select,
input:not([type="checkbox"]):not([type="file"]) {
  height: 46px;
  padding: 0 12px;
}

textarea:focus,
select:focus,
input:not([type="checkbox"]):not([type="file"]):focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  outline: none;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-action {
  display: inline-flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #7477ff 0%, var(--accent) 100%);
  color: #ffffff;
  font-weight: 880;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 14px 28px rgba(99, 102, 241, 0.24);
}

.primary-action.compact,
.secondary-action {
  width: auto;
  padding: 0 16px;
}

.primary-action:hover {
  filter: brightness(1.04);
}

.primary-action:disabled {
  cursor: wait;
  filter: none;
  opacity: 0.72;
}

.director-action-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
  align-items: end;
}

.director-source-field select {
  font-weight: 760;
}

#generatePublishCopyButton {
  border: 0;
  background: linear-gradient(180deg, #7477ff 0%, var(--accent) 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 14px 28px rgba(99, 102, 241, 0.24);
}

#polishPromptButton,
#copyPromptButton {
  border: 1px solid rgba(99, 102, 241, 0.32);
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0.72)),
    rgba(99, 102, 241, 0.08);
  color: #111318;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#videoStatusChip {
  border: 1px solid rgba(99, 102, 241, 0.32);
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0.72)),
    rgba(99, 102, 241, 0.08);
  color: #111318;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.director-plan {
  margin-bottom: 16px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.035), transparent 42%);
}

.director-empty {
  display: grid;
  flex: 1;
  min-height: 300px;
  place-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.director-empty[hidden] {
  display: none;
}

.director-empty strong {
  color: var(--text);
  font-size: 16px;
}

.moonclaw-workflow {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.moonclaw-workflow[hidden],
.moonclaw-step[hidden],
.moonclaw-step-body[hidden],
.moonclaw-step-summary[hidden],
.moonclaw-step-loading[hidden],
.moonclaw-step-error[hidden],
.moonclaw-concept-list[hidden],
.moonclaw-product-grid[hidden],
.moonclaw-step-actions[hidden],
#promptActions[hidden] {
  display: none;
}

.moonclaw-step {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.055), transparent 44%),
    rgba(255, 255, 255, 0.82);
}

.moonclaw-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.moonclaw-step-head h3 {
  margin-top: 2px;
  font-size: 17px;
}

.moonclaw-step-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.moonclaw-disclosure-toggle {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.moonclaw-disclosure-toggle:hover {
  border-color: rgba(99, 102, 241, 0.44);
  background: rgba(99, 102, 241, 0.07);
}

.moonclaw-step-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.moonclaw-step-copy {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.moonclaw-step-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.moonclaw-step-loading {
  margin: 0;
  padding: 18px;
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.045);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.moonclaw-step-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.07);
  color: var(--red);
  font-size: 13px;
  line-height: 1.55;
}

.moonclaw-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.moonclaw-product-grid textarea {
  min-height: 104px;
}

.moonclaw-wide-field {
  grid-column: 1 / -1;
}

.moonclaw-step-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.moonclaw-concept-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.moonclaw-concept-list.single-selected {
  grid-template-columns: minmax(0, 1fr);
}

.moonclaw-concept-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.moonclaw-concept-card.is-selected {
  border-color: rgba(99, 102, 241, 0.52);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.moonclaw-concept-card h4 {
  font-size: 15px;
  line-height: 1.4;
}

.moonclaw-concept-card p,
.moonclaw-concept-card li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.moonclaw-concept-card p strong {
  color: var(--text);
}

.moonclaw-concept-card ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
}

.moonclaw-concept-card button {
  min-height: 40px;
  margin-top: auto;
}

.moonclaw-prompt-panel textarea {
  min-height: 520px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.skit-prompt-help {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.skit-duration-dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(18, 24, 35, 0.25);
}

.skit-duration-dialog::backdrop {
  background: rgba(22, 27, 35, 0.48);
  backdrop-filter: blur(4px);
}

.skit-duration-dialog-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.skit-duration-dialog-panel h2 {
  margin: 0;
  font-size: 20px;
}

.skit-duration-dialog-panel > p:not(.section-label) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.skit-duration-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.skit-workflow .moonclaw-concept-list {
  grid-template-columns: 1fr;
}

.skit-beat-card,
.skit-coverage-card {
  gap: 7px;
}

.skit-beat-card {
  padding: 12px 14px;
}

.skit-story-point-editor {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 0;
}

.skit-story-point-editor > span {
  padding-top: 2px;
  line-height: 1.5;
}

.skit-story-point-editor textarea {
  min-height: 64px;
  padding: 1px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  field-sizing: content;
  resize: none;
  font-size: 12px;
}

.skit-story-point-editor textarea:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.skit-story-point-editor textarea:read-only {
  color: var(--text);
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}

.skit-coverage-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.skit-coverage-card li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.director-plan-head,
.shot-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.director-plan-head {
  margin-bottom: 14px;
}

.director-plan-head h3 {
  margin-top: 2px;
  font-size: 16px;
}

.director-plan-head > strong {
  max-width: min(520px, 60%);
  padding: 5px 8px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.creative-brief {
  margin-bottom: 18px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.director-plan.concept-only .director-plan-head,
.director-plan.concept-only .director-overview,
.director-plan.concept-only .shot-plan-head,
.director-plan.concept-only .shot-list {
  display: none;
}

.director-plan.concept-only .creative-brief {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.creative-brief-head,
.creative-concept-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.creative-brief-head {
  margin-bottom: 8px;
}

.creative-brief-head h3 {
  margin-top: 2px;
  font-size: 16px;
}

.creative-brief-head > p,
.product-facts-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.creative-brief-head > p {
  max-width: 58%;
  text-align: right;
}

.product-facts-summary {
  margin-bottom: 12px;
}

.creative-concept-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.creative-concept-list.single-concept {
  grid-template-columns: minmax(0, 1fr);
}

.creative-concept {
  appearance: none;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.creative-concept:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.38);
}

.creative-concept.skit-beat {
  cursor: default;
}

.creative-concept:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.32);
  outline-offset: 2px;
}

.creative-concept:disabled {
  cursor: wait;
}

.creative-concept.selected {
  border-color: rgba(99, 102, 241, 0.46);
  background: rgba(99, 102, 241, 0.065);
  box-shadow: inset 3px 0 0 var(--accent);
}

.creative-concept-meta {
  margin-bottom: 8px;
}

.creative-concept-meta span,
.creative-concept-meta strong,
.creative-concept small {
  font-size: 11px;
}

.creative-concept-meta span,
.creative-concept small {
  color: var(--muted);
}

.creative-concept-meta strong {
  color: var(--accent);
}

.creative-concept h4 {
  margin-bottom: 6px;
  font-size: 14px;
}

.creative-concept p {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.creative-concept small {
  display: block;
  line-height: 1.5;
}

.director-overview {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.director-strategy textarea {
  min-height: 216px;
}

.director-audio {
  display: grid;
  gap: 10px;
}

.director-audio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.director-voice-style {
  grid-column: 1 / -1;
}

.director-audio textarea {
  min-height: 70px;
}

.shot-plan-head {
  margin-top: 18px;
  padding-bottom: 9px;
}

.shot-plan-head strong {
  font-size: 14px;
}

.shot-plan-head span {
  color: var(--subtle);
  font-size: 11px;
}

.shot-list {
  border-top: 1px solid var(--line);
}

.shot-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.shot-item.modified {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.07), transparent 70%);
}

.shot-item:last-child {
  border-bottom: 0;
}

.shot-index {
  display: grid;
  align-content: start;
  gap: 9px;
}

.shot-index > strong {
  color: var(--accent);
  font-size: 20px;
}

.shot-index label {
  display: grid;
  gap: 5px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 760;
}

.shot-index input {
  height: 36px !important;
  padding: 0 8px !important;
}

.shot-risk {
  justify-self: start;
  padding: 3px 6px;
  border: 1px solid #cfd7e3;
  border-radius: 5px;
  background: #f4f6f8;
  color: #596474;
  font-size: 10px;
  font-weight: 780;
}

.shot-risk.medium {
  border-color: #e9bd69;
  background: #fff7e8;
  color: #855d13;
}

.shot-risk.high {
  border-color: #e7a7a7;
  background: #fff0f0;
  color: #9b2f2f;
}

.shot-modified {
  justify-self: start;
  padding: 3px 6px;
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: 5px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  font-size: 10px;
  font-weight: 780;
}

.shot-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shot-fields textarea {
  min-height: 82px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.shot-fields input {
  height: 40px !important;
}

.prompt-layout {
  grid-template-columns: 285px minmax(0, 1fr);
}

.prompt-layout[hidden],
#polishPromptButton[hidden],
#copyPromptButton[hidden] {
  display: none;
}

.prompt-sections {
  display: grid;
  gap: 10px;
  align-content: start;
}

.mini-panel {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 14px;
  border-radius: 8px;
}

.mini-panel span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.mini-panel textarea {
  min-height: 82px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.58;
  resize: vertical;
}

.mini-panel textarea:focus {
  box-shadow: none;
  outline: none;
}

.mini-panel:focus-within {
  border-color: rgba(99, 102, 241, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 0 0 4px rgba(99, 102, 241, 0.08);
}

.prompt-field textarea {
  min-height: 348px;
}

.inline-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

#promptActions {
  margin-top: auto;
  padding-top: 14px;
}

.video-board {
  display: grid;
  min-height: 440px;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
}

.video-board.generated {
  background:
    linear-gradient(115deg, rgba(99, 102, 241, 0.1), transparent 42%),
    linear-gradient(180deg, #ffffff, #f1f4f7);
}

.video-board video {
  width: 100%;
  height: 100%;
  min-height: 440px;
  max-height: 680px;
  background: #111318;
  object-fit: contain;
}

.video-placeholder {
  display: grid;
  width: min(360px, 88%);
  gap: 10px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.video-placeholder span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 850;
}

.video-placeholder strong {
  color: var(--text);
  font-size: 24px;
}

.video-guidance {
  width: 100%;
  margin-top: 4px;
  color: var(--text);
  text-align: left;
}

.video-guidance b {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.video-guidance ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.video-help-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 0 14px;
  border: 1px solid rgba(99, 102, 241, 0.38);
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.video-help-link:hover {
  background: rgba(99, 102, 241, 0.14);
}

.video-board.generated .video-placeholder::before {
  content: "";
  display: block;
  width: 180px;
  height: 245px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent),
    linear-gradient(180deg, rgba(99, 102, 241, 0.14), rgba(255, 255, 255, 0.7));
  background-size: 220% 100%, 100% 100%;
  animation: scan 2.8s linear infinite;
}

@keyframes scan {
  from {
    background-position: 160% 0, 0 0;
  }
  to {
    background-position: -160% 0, 0 0;
  }
}

.platform-grid {
  display: grid;
  gap: 10px;
}

.platform-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.platform-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 9px;
  align-items: start;
  min-height: 86px;
  padding: 13px;
  border-radius: 8px;
}

.platform-card input {
  grid-row: span 2;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.platform-card strong,
.platform-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-mode {
  grid-column: 2;
  width: max-content;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.09);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.platform-card.selected {
  border-color: rgba(99, 102, 241, 0.42);
  background: rgba(99, 102, 241, 0.06);
}

.publish-empty {
  display: grid;
  min-height: 190px;
  margin-top: 14px;
  place-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.publish-empty strong {
  color: var(--text);
  font-size: 16px;
}

.publish-editors {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.publish-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
}

.publish-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.publish-editor-head h3 {
  margin: 0;
  font-size: 15px;
}

.publish-editor-head span {
  border: 0;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.publish-field {
  gap: 6px;
}

.publish-field textarea {
  min-height: 104px;
}

.publish-action-bar {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.publish-action-bar > small {
  color: var(--muted);
  font-size: 11px;
}

.publish-action-status {
  min-height: 18px;
  margin: 0;
  color: var(--green);
  font-size: 12px;
}

.publish-action-status:empty {
  min-height: 0;
}

.publish-action-status.error {
  color: var(--danger);
}

.stage-timing-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
  min-height: 0;
  margin-top: 14px;
  overflow: hidden;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.stage-timing-head,
.stage-timing-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stage-timing-head {
  align-items: center;
}

.stage-timing-head strong {
  font-size: 13px;
}

.stage-timing-head span,
.stage-timing-list p {
  color: var(--subtle);
  font-size: 11px;
}

.stage-timing-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
}

.stage-timing-list p {
  margin: 0;
  line-height: 1.55;
}

.stage-timing-row {
  align-items: baseline;
  padding-top: 7px;
  border-top: 1px solid rgba(145, 158, 171, 0.18);
}

.stage-timing-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.stage-timing-row strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.stage-cost-row {
  border-top-color: rgba(99, 102, 241, 0.28);
}

.stage-cost-row strong {
  color: var(--accent);
}

.account-menu-shell {
  position: relative;
  flex: 0 0 auto;
}

.account-entry-button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 0 17px;
  background: #fff;
  color: #161616;
  font-weight: 800;
}

.account-entry-button.authenticated {
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #5659d9;
  box-shadow: 0 6px 18px rgba(34, 39, 110, 0.2);
}

.account-entry-button.authenticated:hover,
.account-entry-button.authenticated[aria-expanded="true"] {
  background: #fff;
  color: #3f43c8;
  transform: translateY(-1px);
}

.account-entry-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.account-menu[hidden] {
  display: none;
}

.account-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: 224px;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  padding: 7px;
  background: #fff;
  color: #24272d;
  box-shadow: 0 18px 50px rgba(26, 31, 44, 0.18);
}

.account-menu::before {
  position: absolute;
  top: -5px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-top: 1px solid #e6e8ee;
  border-left: 1px solid #e6e8ee;
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.account-menu-identity {
  display: grid;
  gap: 4px;
  padding: 9px 10px 8px;
}

.account-menu-identity span,
.account-menu-balance span {
  color: #8a9099;
  font-size: 11px;
  font-weight: 650;
}

.account-menu-identity strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu a,
.account-menu button {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: #333740;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

.account-menu a:hover,
.account-menu a:focus-visible,
.account-menu button:hover,
.account-menu button:focus-visible {
  outline: 0;
  background: #f4f5f8;
}

.account-menu svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.account-menu .account-menu-balance {
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 2px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--accent);
}

.account-menu-balance strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.account-menu-divider {
  height: 1px;
  margin: 5px 4px;
  background: #eceef2;
}

.account-menu .account-menu-logout {
  width: 100%;
  color: #d14343;
}

.portal-shell[hidden] {
  display: none;
}

body.portal-active .workspace,
body.portal-active .run-status {
  display: none !important;
}

.portal-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: calc(100vh - 122px);
  gap: 14px;
  margin-top: 14px;
}

.portal-sidebar,
.portal-content {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(28, 39, 54, 0.08);
}

.portal-sidebar {
  position: sticky;
  top: 14px;
  display: flex;
  height: max-content;
  min-height: 480px;
  flex-direction: column;
  padding: 12px;
}

.portal-back {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.portal-back:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.portal-back span {
  font-size: 18px;
}

.portal-nav {
  display: grid;
  gap: 5px;
  margin-top: 14px;
}

.portal-nav a {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  min-height: 44px;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.portal-nav a span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #f2f3f6;
  color: #737b87;
  font-size: 11px;
  font-weight: 900;
}

.portal-nav a:hover {
  background: #f7f7fa;
  color: var(--text);
}

.portal-nav a.active {
  background: rgba(99, 102, 241, 0.1);
  color: #3f43c8;
}

.portal-nav a.active span {
  background: var(--accent);
  color: #fff;
}

.portal-sidebar-note {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding: 16px 7px 3px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.6;
}

.portal-content {
  min-width: 0;
  padding: 28px;
}

.portal-content [hidden] {
  display: none !important;
}

.portal-view {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.portal-page-head {
  display: flex;
  min-height: 82px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 22px;
}

.portal-page-head h2 {
  margin-top: 5px;
  font-size: 26px;
  letter-spacing: -0.025em;
}

.portal-page-head p:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.portal-card,
.portal-wallet-card,
.portal-package-card,
.tutorial-section {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 39, 54, 0.045);
}

.portal-account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 14px;
  margin-top: 22px;
}

.portal-profile-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.portal-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.portal-avatar svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.portal-profile-card > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.portal-profile-card span,
.portal-balance-card > span,
.portal-wallet-card span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.portal-profile-card strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-profile-card small {
  color: var(--muted);
  font-size: 11px;
}

.portal-profile-card i {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: rgba(31, 157, 85, 0.12);
  color: var(--green);
  font-style: normal;
}

.portal-balance-card {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.11), rgba(255, 255, 255, 0.96));
}

.portal-balance-card > strong {
  color: #3f43c8;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.portal-balance-card p {
  color: var(--muted);
  font-size: 11px;
}

.portal-primary-link {
  display: inline-flex;
  min-height: 36px;
  width: max-content;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  margin-top: 7px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.portal-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 14px;
}

.portal-section-head h3,
.tutorial-section h3 {
  margin: 0;
  font-size: 16px;
}

.portal-section-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.portal-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.portal-quick-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 17px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.portal-quick-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.11);
  transform: translateY(-2px);
}

.portal-quick-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
}

.portal-quick-card div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.portal-quick-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-quick-card b {
  color: var(--subtle);
}

.portal-secondary-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.portal-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.portal-segmented {
  display: inline-flex;
  gap: 3px;
  border-radius: 9px;
  padding: 3px;
  background: #f1f2f5;
}

.portal-segmented a {
  min-width: 64px;
  border-radius: 7px;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.portal-segmented a.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 5px rgba(28, 39, 54, 0.09);
}

.portal-search {
  display: flex;
  width: min(100%, 340px);
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  background: #fff;
}

.portal-search:focus-within {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.portal-search svg {
  width: 17px;
  fill: none;
  stroke: var(--subtle);
  stroke-linecap: round;
  stroke-width: 1.7;
}

.portal-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.portal-inline-message {
  min-height: 20px;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.portal-inline-message[data-kind="error"] {
  color: var(--red);
}

.portal-inline-message[data-kind="warning"] {
  color: #a15c00;
}

.portal-inline-message[data-kind="success"] {
  color: var(--green);
}

.portal-history-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.portal-history-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 10px;
  background: #fff;
}

.portal-history-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 24px rgba(28, 39, 54, 0.07);
}

.portal-history-preview {
  display: grid;
  width: 112px;
  height: 78px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #eef0ff, #f6f7fb);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.portal-history-preview.video {
  background: linear-gradient(145deg, #e9ebf0, #f8f8fa);
  color: #555b66;
}

.portal-history-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-history-body {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.portal-history-meta {
  display: flex;
  align-items: center;
  gap: 7px;
}

.portal-history-meta span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #f1f2f5;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.portal-history-meta .portal-history-kind.image {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.portal-history-meta .portal-history-kind.video,
.portal-history-meta .portal-history-status.succeeded {
  background: rgba(31, 157, 85, 0.1);
  color: var(--green);
}

.portal-history-meta .portal-history-status.failed {
  background: rgba(209, 67, 67, 0.1);
  color: var(--red);
}

.portal-history-meta time {
  margin-left: auto;
  color: var(--subtle);
  font-size: 10px;
}

.portal-history-body h3,
.portal-history-body p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-history-body h3 {
  margin: 0;
  font-size: 14px;
}

.portal-history-body p {
  color: var(--muted);
  font-size: 11px;
}

.portal-history-body small {
  color: var(--subtle);
  font-size: 10px;
}

.portal-history-open {
  min-width: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.portal-history-open:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--accent);
}

.portal-media-notice {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(209, 67, 67, 0.2);
  border-radius: 10px;
  margin-top: 20px;
  padding: 13px 15px;
  background: rgba(209, 67, 67, 0.045);
}

.portal-media-notice strong {
  color: var(--red);
  font-size: 12px;
}

.portal-media-notice p,
.portal-media-card .portal-history-body small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.portal-media-card .portal-history-body small {
  overflow-wrap: anywhere;
}

.portal-media-card .portal-history-preview.audio,
.portal-media-card .portal-history-preview.subtitle {
  background: linear-gradient(145deg, #f4efff, #faf8ff);
  color: #7651ad;
}

.portal-media-delete {
  border-color: rgba(209, 67, 67, 0.28);
  background: #fff;
  color: var(--red);
}

.portal-media-delete:hover:not(:disabled) {
  border-color: rgba(209, 67, 67, 0.55);
  color: var(--red);
}

.portal-media-delete:disabled {
  cursor: wait;
  opacity: 0.55;
}

.portal-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.portal-empty p {
  font-size: 12px;
}

.portal-empty.compact {
  padding: 22px;
  font-size: 12px;
}

.portal-wallet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.portal-wallet-card {
  display: grid;
  gap: 6px;
  padding: 20px;
}

.portal-wallet-card.primary {
  border-color: rgba(99, 102, 241, 0.25);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), #fff);
}

.portal-wallet-card strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.portal-wallet-card.primary strong {
  color: #3f43c8;
}

.portal-wallet-card small {
  color: var(--muted);
  font-size: 11px;
}

.portal-payment-notice {
  min-height: 40px;
  border-radius: 8px;
  padding: 11px 13px;
  background: #fff7e7;
  color: #8a5600;
  font-size: 11px;
  line-height: 1.55;
}

.portal-payment-notice[data-available="true"] {
  background: rgba(31, 157, 85, 0.09);
  color: #087443;
}

.portal-package-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.portal-package-card {
  position: relative;
  display: grid;
  align-content: start;
  padding: 18px;
}

.portal-package-card.recommended {
  border-color: rgba(99, 102, 241, 0.42);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.1);
}

.portal-package-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.portal-package-card > strong {
  margin-top: 13px;
  color: #3f43c8;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.portal-package-card > small {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 10px;
}

.portal-package-card > b {
  margin-top: 14px;
  font-size: 18px;
}

.portal-package-card > p {
  min-height: 34px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.portal-package-card button {
  min-height: 38px;
  border-radius: 8px;
  margin-top: 15px;
  background: #171a1f;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.portal-package-card button:disabled {
  cursor: not-allowed;
  background: #ebedf1;
  color: #929aa5;
  opacity: 1;
}

.portal-recharge-orders-head,
.portal-ledger-head {
  margin-top: 32px;
}

.portal-ledger {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
}

.portal-ledger-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 15px;
  background: #fff;
}

.portal-ledger-row + .portal-ledger-row {
  border-top: 1px solid var(--line-soft);
}

.portal-ledger-row > div {
  display: grid;
  gap: 4px;
}

.portal-ledger-row strong {
  font-size: 12px;
}

.portal-ledger-row time {
  color: var(--subtle);
  font-size: 10px;
}

.portal-ledger-row b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.portal-ledger-row b.positive {
  color: var(--green);
}

.portal-recharge-status.pending {
  color: #a15c00;
}

.portal-recharge-status.paid {
  color: var(--green);
}

.portal-recharge-status.failed,
.portal-recharge-status.cancelled,
.portal-recharge-status.expired,
.portal-recharge-status.closed {
  color: var(--red);
}

.tutorial-hero {
  align-items: center;
}

.tutorial-index {
  position: sticky;
  z-index: 3;
  top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 20px 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(28, 39, 54, 0.06);
  backdrop-filter: blur(12px);
}

.tutorial-index a {
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.tutorial-index a:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
}

.tutorial-section {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 18px;
  margin-top: 12px;
  padding: 22px;
  scroll-margin-top: 80px;
}

.tutorial-step {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.tutorial-section > div > p,
.tutorial-section li,
.tutorial-faq details p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.tutorial-section > div > p {
  margin-top: 9px;
}

.tutorial-section ol {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.tutorial-section .tutorial-tip {
  border-left: 3px solid rgba(99, 102, 241, 0.4);
  padding: 9px 12px;
  background: rgba(99, 102, 241, 0.055);
}

.tutorial-faq details {
  border-top: 1px solid var(--line-soft);
  margin-top: 12px;
  padding-top: 12px;
}

.tutorial-faq summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.tutorial-faq details p {
  margin-top: 8px;
}

.account-dialog {
  width: min(calc(100vw - 32px), 448px);
  max-width: none;
  overflow: visible;
  border: 0;
  padding: 0;
  background: transparent;
}

.account-dialog::backdrop {
  background: rgba(22, 22, 22, 0.48);
  backdrop-filter: blur(6px);
}

.account-panel {
  position: relative;
  max-height: min(780px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid #e6e4df;
  border-radius: 18px;
  padding: 34px 32px 30px;
  background: #fff;
  color: #161616;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.24);
}

.account-panel [hidden] {
  display: none !important;
}

.account-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #77736d;
  font-size: 24px;
}

.account-close:hover {
  background: #f4f3ef;
  color: #161616;
}

.account-heading {
  display: grid;
  justify-items: center;
  text-align: center;
}

.account-brand-mark,
.account-profile-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.account-brand-mark {
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.account-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.account-heading h2 {
  margin: 17px 0 7px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.account-heading p {
  margin: 0;
  color: #85817a;
  font-size: 14px;
}

.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 26px;
  border-radius: 9px;
  padding: 3px;
  background: #f3f1ec;
}

.account-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #77736d;
  font-weight: 750;
}

.account-tabs button.active {
  background: #fff;
  color: #161616;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
}

.account-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.account-form label {
  display: grid;
  gap: 8px;
}

.account-form label > span:first-child,
.account-form-intro h3 {
  color: #24211e;
  font-size: 14px;
  font-weight: 800;
}

.account-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dedbd5;
  border-radius: 9px;
  padding: 0 13px;
  background: #faf9f7;
  color: #161616;
  font: inherit;
}

.account-form input:not([type="checkbox"]):focus {
  border-color: #9a958c;
  outline: 3px solid rgba(22, 22, 22, 0.08);
  background: #fff;
}

.account-password-field {
  position: relative;
  display: block;
}

.account-password-field input {
  padding-right: 58px !important;
}

.account-password-field button {
  position: absolute;
  top: 0;
  right: 6px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #77736d;
  font-size: 12px;
}

.account-primary {
  min-height: 44px;
  border: 1px solid #080808;
  border-radius: 10px;
  padding: 0 18px;
  background: #080808;
  color: #fff;
  font-weight: 800;
}

.account-primary:hover:not(:disabled) {
  background: #272727;
}

.account-primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.account-text-button {
  justify-self: center;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: #5f5b55;
  font-size: 13px;
}

.account-forgot {
  justify-self: end;
  margin-top: -8px;
}

.account-hint,
.account-form-intro p {
  margin: 0;
  color: #85817a;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.account-form .account-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #77736d;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.55;
}

.account-consent input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: #161616;
}

.account-consent input:focus-visible {
  outline: 3px solid rgba(22, 22, 22, 0.12);
  outline-offset: 2px;
}

.account-consent a {
  color: #24211e;
  font-weight: 750;
  text-decoration: none;
}

.account-consent a:hover,
.account-consent a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-form-intro {
  display: grid;
  gap: 7px;
  text-align: center;
}

.account-form-intro h3 {
  margin: 0;
  font-size: 18px;
}

.account-human-check {
  min-height: 48px;
}

.account-message {
  min-height: 20px;
  margin-top: 15px;
  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.account-message[data-kind="success"] {
  color: #067647;
}

.account-message[data-kind="info"],
.account-message[data-kind="progress"] {
  color: #5f5b55;
}

.account-profile {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 25px;
  text-align: center;
}

.account-profile p {
  margin: 8px 0 0;
  color: #85817a;
  font-size: 13px;
}

.account-profile strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-profile .account-primary {
  width: 100%;
  margin-top: 14px;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(99, 102, 241, 0.035), rgba(99, 102, 241, 0)),
    #fff;
}

.login-shell {
  width: min(100% - 32px, 460px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 40px 0;
}

.login-brand,
.login-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(21, 29, 51, 0.1);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: 8px;
}

.login-brand h1 {
  margin: 3px 0 0;
  font-size: 20px;
}

.login-panel {
  padding: 30px;
  border-radius: 8px;
}

.login-panel h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.login-panel > p:not(.section-label) {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

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

.login-panel input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.login-panel input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(99, 102, 241, 0.12);
}

.login-message {
  min-height: 24px;
  margin-top: 14px;
  color: #b42318;
  font-size: 14px;
}

.rail-history-panel {
  display: grid;
  min-height: 0;
  max-height: 340px;
  gap: 8px;
  overflow: auto;
  padding: 9px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.04);
}

.rail-history-panel[hidden] {
  display: none;
}

.rail-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--subtle);
  font-size: 11px;
}

.rail-history-head button,
.history-more {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.history-list {
  display: grid;
  gap: 6px;
}

.history-list > p {
  padding: 8px 4px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.history-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 4px 6px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.history-item:hover,
.history-item.selected {
  border-color: rgba(99, 102, 241, 0.42);
  background: rgba(99, 102, 241, 0.08);
}

.history-item strong {
  grid-column: 1 / -1;
  font-size: 11px;
  white-space: nowrap;
}

.history-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-status {
  align-self: center;
  width: 32px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.history-status.succeeded {
  color: var(--green);
}

.history-status.failed,
.history-load-failed {
  color: var(--red);
}

.history-more {
  width: 100%;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .image-shell {
    grid-column: 2 / -1;
  }

  .image-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 980px) {
  .workspace,
  .main-stage,
  .image-shell,
  .image-form-grid,
  .asset-grid,
  .prompt-layout,
  .creative-concept-list,
  .moonclaw-concept-list,
  .skit-workflow .moonclaw-concept-list,
  .moonclaw-product-grid,
  .director-overview {
    grid-template-columns: 1fr;
  }

  .skit-story-point-editor {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .skit-story-point-editor > span {
    padding-top: 0;
  }

  .moonclaw-wide-field {
    grid-column: auto;
  }

  .rail {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .product-mode-button {
    min-height: 58px;
  }

  .image-shell,
  .main-stage {
    grid-column: auto;
  }

  .rail-history-panel {
    grid-column: 1 / -1;
  }

  .director-strategy textarea {
    min-height: 120px;
  }
}

@media (max-width: 700px) {
  .image-main-module-options {
    grid-template-columns: 1fr;
  }

  .image-ai-plan-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .image-ai-plan-panel {
    min-height: calc(100vh - 18px);
    max-height: calc(100vh - 18px);
  }

  .image-ai-plan-header,
  .image-ai-plan-body {
    padding: 18px;
  }

  .image-ai-plan-tabs-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-ai-plan-editor {
    min-height: 280px;
  }

  .image-planning-header,
  .image-planning-footer {
    padding: 14px;
  }

  .image-planning-body {
    padding: 12px;
  }

  .image-planning-overall,
  .image-planning-item-fields {
    grid-template-columns: 1fr;
  }

  .image-planning-item summary {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .image-planning-item summary em {
    display: none;
  }

  .image-planning-footer {
    flex-direction: column-reverse;
  }

  .image-planning-confirm {
    min-width: 0;
  }

  .app-shell {
    width: min(100vw - 20px, 700px);
    padding-top: 10px;
  }

  .topbar,
  .stage-head,
  .inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    white-space: normal;
  }

  .topbar-actions,
  .inline-actions {
    width: 100%;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-entry-button {
    width: 100%;
    max-width: none;
  }

  .account-panel {
    padding: 30px 20px 24px;
  }

  .run-status {
    width: 100%;
  }

  .ghost-button,
  .secondary-action,
  .primary-action.compact {
    width: 100%;
  }

  .rail,
  .control-grid,
  .director-action-bar,
  .director-audio-grid,
  .shot-fields,
  .platform-grid,

  .director-plan-head,
  .creative-brief-head,
  .shot-plan-head {
    align-items: flex-start;
  }

  .director-plan-head > strong {
    max-width: 100%;
    text-align: left;
  }

  .creative-brief-head > p {
    max-width: 100%;
    text-align: left;
  }

  .shot-item {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }

  .stage-card {
    padding: 14px;
  }

  .image-result-grid,
  .image-file-preview {
    grid-template-columns: 1fr;
  }

  .image-history-entry {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .image-history-entry img,
  .image-history-placeholder {
    width: 56px;
    height: 56px;
  }

  .image-history-entry-status {
    grid-column: 2;
  }
}

/* Home page — light product showcase, adapted to the Zhenzao brand. */
.home-page[hidden],
.app-shell[hidden] {
  display: none !important;
}

body.home-page-active {
  min-width: 320px;
  background: #f7f8fb;
  color: #16181d;
}

.home-page {
  --home-ink: #16181d;
  --home-muted: #646a78;
  --home-line: #e3e6ed;
  --home-surface: #ffffff;
  --home-soft: #f1f3f8;
  --home-accent: #5b5ff2;
  --home-accent-dark: #484bd9;
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #f4f5f8;
  color: var(--home-ink);
  font-family: Inter, "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.home-nav {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: min(1440px, calc(100% - 64px));
  min-height: 80px;
  margin: 0 auto;
}

.home-nav::before {
  position: absolute;
  z-index: -1;
  inset: 0 50%;
  width: 100vw;
  background:
    radial-gradient(ellipse at 78% 115%, rgba(111, 103, 255, 0.46), transparent 48%),
    linear-gradient(110deg, #0f1118 0%, #171923 48%, #29284f 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 16px 42px rgba(17, 19, 33, 0.1);
  content: "";
  transform: translateX(-50%);
}

.home-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  width: max-content;
  color: #f7f8fc;
  text-decoration: none;
}

.home-brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #eef0ff;
}

.home-nav .home-brand-mark {
  width: 46px;
  height: 46px;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.home-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.home-brand strong {
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.home-brand small {
  color: rgba(228, 231, 242, 0.58);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.home-nav-action {
  justify-self: end;
  min-height: 40px;
  padding: 0 19px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.home-nav-action:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
}

.home-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(470px, 0.9fr) minmax(620px, 1.1fr);
  align-items: center;
  gap: clamp(44px, 4vw, 72px);
  width: min(1440px, calc(100% - 64px));
  min-height: 740px;
  margin: 0 auto;
  padding: 72px 0 92px;
}

.home-hero::before {
  position: absolute;
  z-index: 0;
  top: -80px;
  bottom: 0;
  left: 50%;
  width: 100vw;
  background:
    radial-gradient(circle at 84% 13%, rgba(99, 102, 241, 0.12), transparent 24%),
    #fbfbfd;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.home-hero-copy {
  position: relative;
  z-index: 1;
}

.home-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  color: var(--home-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.home-kicker span {
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.home-hero-title {
  max-width: 660px;
  margin: 0;
  overflow: visible;
  color: var(--home-ink);
  font-size: clamp(48px, 3.9vw, 64px);
  font-weight: 720;
  line-height: 1.04;
  letter-spacing: -0.055em;
  text-overflow: clip;
  white-space: normal;
}

.home-title-accent {
  color: #6d5df4;
}

.home-hero-lead {
  max-width: 560px;
  margin: 30px 0 0;
  color: var(--home-muted);
  font-size: clamp(17px, 1.35vw, 20px);
  line-height: 1.8;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 38px;
}

.home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 25px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.home-button:hover {
  transform: translateY(-2px);
}

.home-button.primary {
  background: var(--home-accent);
  color: #fff;
}

.home-button.primary:hover {
  background: var(--home-accent-dark);
}

.home-button.secondary {
  border-color: #d9dce5;
  background: rgba(255, 255, 255, 0.76);
  color: var(--home-ink);
}

.home-capability-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 42px;
  color: #7a808d;
  font-size: 12px;
  font-weight: 650;
}

.home-capability-line i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b4b9c4;
}

.home-product-stage {
  position: relative;
  z-index: 1;
  min-height: 570px;
  overflow: hidden;
  border: 1px solid rgba(220, 224, 234, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 28px 80px rgba(35, 40, 65, 0.11);
  transform: rotate(0.3deg);
  animation: home-stage-enter 600ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.home-product-stage::after {
  position: absolute;
  right: -70px;
  bottom: -100px;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  content: "";
  filter: blur(2px);
  pointer-events: none;
}

.home-product-stage > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 22px;
  border-bottom: 1px solid var(--home-line);
}

.home-stage-brand,
.home-stage-status {
  display: flex;
  align-items: center;
  gap: 9px;
}

.home-stage-brand img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.home-stage-brand strong {
  font-size: 12px;
}

.home-stage-status {
  color: #737987;
  font-size: 10px;
  font-weight: 650;
}

.home-stage-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #37b879;
  box-shadow: 0 0 0 4px rgba(55, 184, 121, 0.1);
}

.home-stage-body {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  min-height: 508px;
}

.home-stage-body > aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 25px;
  border-right: 1px solid var(--home-line);
  background: #fafbfc;
}

.home-stage-body > aside span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #e2e5ed;
  border-radius: 11px;
  color: #9499a5;
  font-size: 8px;
  font-weight: 800;
}

.home-stage-body > aside span.active {
  border-color: #cfd2ff;
  background: #eeefff;
  color: var(--home-accent);
}

.home-stage-canvas {
  padding: 30px;
}

.home-stage-heading {
  display: grid;
  gap: 6px;
}

.home-stage-heading span {
  color: var(--home-accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.home-stage-heading strong {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.home-showcase-artwork {
  aspect-ratio: 4 / 3;
  margin: 23px 0 0;
  overflow: hidden;
  border: 1px solid #e2e5ec;
  border-radius: 16px;
  background: #f6f7f9;
}

.home-showcase-artwork img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-stage-prompt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 14px;
  padding: 0 8px 0 15px;
  border: 1px solid #e0e3ea;
  border-radius: 13px;
  background: #fff;
}

.home-stage-prompt span {
  color: var(--home-accent);
}

.home-stage-prompt p {
  overflow: hidden;
  margin: 0;
  color: #7b818e;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-stage-prompt b {
  padding: 9px 13px;
  border-radius: 9px;
  background: var(--home-accent);
  color: #fff;
  font-size: 9px;
}

.home-section,
.home-workflow,
.home-final-cta,
.home-footer {
  width: min(1320px, calc(100% - 64px));
  margin-right: auto;
  margin-left: auto;
}

.home-section {
  padding: 128px 0 112px;
}

.home-section-heading {
  max-width: 800px;
}

.home-section-heading p,
.home-final-cta > p {
  margin: 0 0 14px;
  color: var(--home-accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.home-section-heading h2,
.home-final-cta h2 {
  margin: 0;
  color: var(--home-ink);
  font-size: clamp(38px, 4.4vw, 66px);
  font-weight: 710;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.home-section-heading > span {
  display: block;
  margin-top: 22px;
  color: var(--home-muted);
  font-size: 17px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 64px;
}

.home-feature-card {
  display: flex;
  min-height: 390px;
  flex-direction: column;
  padding: 30px;
  border: 1px solid var(--home-line);
  border-radius: 22px;
  background: var(--home-surface);
}

.home-feature-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: #eff0ff;
  color: var(--home-accent);
  font-size: 11px;
  font-weight: 850;
}

.home-feature-card > p {
  margin: 58px 0 12px;
  color: #9297a3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.home-feature-card h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.home-feature-card > span {
  margin-top: 16px;
  color: var(--home-muted);
  font-size: 14px;
  line-height: 1.75;
}

.home-feature-card > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
  padding: 17px 0 0;
  border: 0;
  border-top: 1px solid var(--home-line);
  background: transparent;
  color: var(--home-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.home-feature-card > button b {
  color: var(--home-accent);
  font-size: 18px;
}

.home-feature-card.video-feature {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 84% -8%, rgba(111, 103, 255, 0.34), transparent 48%),
    linear-gradient(145deg, #11131a 0%, #171923 62%, #1b1c2d 100%);
  color: #fff;
}

.home-feature-card.video-feature .home-feature-icon {
  background: #666af6;
  color: #fff;
}

.home-feature-card.video-feature > span,
.home-feature-card.video-feature > p {
  color: #aeb2bf;
}

.home-feature-card.video-feature > button {
  border-color: #383b46;
  color: #fff;
}

.home-workflow {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(520px, 1.2fr);
  gap: 10vw;
  padding: 120px 0;
  border-top: 1px solid #dfe2e8;
}

.home-section-heading.compact h2 {
  max-width: 520px;
  font-size: clamp(36px, 3.7vw, 56px);
}

.home-workflow ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-workflow li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid #dfe2e8;
}

.home-workflow li:first-child {
  padding-top: 4px;
}

.home-workflow li > span {
  color: var(--home-accent);
  font-size: 12px;
  font-weight: 850;
}

.home-workflow li strong {
  font-size: 19px;
}

.home-workflow li p {
  max-width: 580px;
  margin: 9px 0 0;
  color: var(--home-muted);
  font-size: 14px;
  line-height: 1.7;
}

.home-final-cta {
  display: flex;
  min-height: 470px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 78px 28px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% -20%, rgba(132, 135, 255, 0.6), transparent 52%),
    #1b1d27;
  color: #fff;
  text-align: center;
}

.home-final-cta img {
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  border-radius: 17px;
}

.home-final-cta h2 {
  max-width: 860px;
  color: #fff;
}

.home-final-cta .home-button {
  margin-top: 36px;
  background: #fff;
  color: var(--home-ink);
}

.home-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 150px;
  margin-top: 56px;
  border-top: 1px solid var(--home-line);
}

.home-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.home-footer-links a {
  color: #656b77;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: color 160ms ease;
}

.home-footer-links a:hover {
  color: var(--home-accent);
}

.home-footer-meta {
  justify-self: end;
  color: #7b818d;
  font-size: 12px;
  text-align: right;
}

@keyframes home-stage-enter {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(0.3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0.3deg);
  }
}

@media (min-width: 1101px) {
  .home-hero {
    min-height: 0;
    padding: 72px 0;
  }

  .home-product-stage {
    align-self: center;
  }
}

@media (max-width: 1100px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-hero-copy {
    max-width: 780px;
  }

  .home-product-stage {
    width: min(760px, 100%);
    justify-self: center;
  }

  .home-feature-grid {
    grid-template-columns: 1fr;
  }

  .home-feature-card {
    min-height: 310px;
  }

  .home-feature-card > p {
    margin-top: 38px;
  }
}

@media (max-width: 760px) {
  .home-nav,
  .home-hero,
  .home-section,
  .home-workflow,
  .home-final-cta,
  .home-footer {
    width: min(100% - 32px, 680px);
  }

  .home-nav {
    grid-template-columns: 1fr auto;
  }

  .home-nav-action {
    padding: 0 15px;
  }

  .home-hero {
    min-height: 0;
    gap: 48px;
    padding: 60px 0 72px;
  }

  .home-hero-title {
    font-size: clamp(44px, 13vw, 64px);
  }

  .home-product-stage {
    min-height: 500px;
    border-radius: 20px;
  }

  .home-stage-body {
    grid-template-columns: 50px minmax(0, 1fr);
    min-height: 438px;
  }

  .home-stage-canvas {
    padding: 22px 16px;
  }

  .home-section {
    padding: 90px 0 84px;
  }

  .home-feature-grid {
    margin-top: 42px;
  }

  .home-workflow {
    grid-template-columns: 1fr;
    gap: 52px;
    padding: 84px 0;
  }

  .home-final-cta {
    min-height: 420px;
    border-radius: 24px;
  }

  .home-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 0;
    padding: 34px 0;
    gap: 24px;
    text-align: center;
  }

  .home-footer-meta {
    justify-self: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .home-brand small,
  .home-nav-action {
    display: none;
  }

  .home-hero-actions {
    display: grid;
  }

  .home-button {
    width: 100%;
  }

  .home-capability-line {
    gap: 8px;
  }

  .home-product-stage {
    min-height: 472px;
  }

  .home-product-stage > header {
    padding: 0 14px;
  }

  .home-stage-status {
    display: none;
  }

  .home-stage-body {
    grid-template-columns: 1fr;
  }

  .home-stage-body > aside {
    display: none;
  }

  .home-feature-card {
    min-height: 330px;
    padding: 24px;
  }

  .home-footer {
    gap: 20px;
  }

  .home-footer-links {
    flex-wrap: wrap;
    gap: 12px 22px;
  }
}

@media (max-width: 980px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: static;
    min-height: 0;
  }

  .portal-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .portal-sidebar-note {
    display: none;
  }

  .portal-account-grid,
  .portal-package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-quick-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .account-menu-shell {
    width: 100%;
  }

  .account-entry-button.authenticated {
    width: 36px;
    margin-left: auto;
  }

  .portal-shell {
    min-height: 0;
  }

  .portal-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-content {
    padding: 18px 14px;
  }

  .portal-page-head,
  .portal-history-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-page-head h2 {
    font-size: 23px;
  }

  .portal-secondary-button,
  .portal-search {
    width: 100%;
  }

  .portal-account-grid,
  .portal-wallet-grid,
  .portal-package-grid {
    grid-template-columns: 1fr;
  }

  .portal-segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .portal-history-card {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 11px;
  }

  .portal-history-preview {
    width: 82px;
    height: 68px;
  }

  .portal-history-meta time {
    display: none;
  }

  .portal-history-open {
    grid-column: 1 / -1;
  }

  .tutorial-hero .portal-primary-link {
    width: 100%;
  }

  .tutorial-index {
    position: static;
  }

  .tutorial-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .recent-task-notice {
    align-items: stretch;
    flex-direction: column;
    gap: 11px;
  }

  .recent-task-notice-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-product-stage,
  .home-button,
  .image-generation-notice {
    animation: none;
    transition: none;
  }

  .portal-quick-card,
  .account-entry-button.authenticated {
    transition: none;
  }
}
