:root {
  color-scheme: light;
  --canvas: #f7f8fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #f3f5fa;
  --line: #e3e7ef;
  --line-strong: #d3d9e5;
  --ink: #182033;
  --muted: #687187;
  --muted-light: #929aad;
  --accent: #5f62d9;
  --accent-dark: #4b4fbe;
  --accent-soft: #ededff;
  --mint: #44a58b;
  --mint-soft: #e8f7f2;
  --amber: #b9792c;
  --amber-soft: #fff5e8;
  --danger: #bd4a5a;
  --danger-soft: #fff0f2;
  --shadow-sm: 0 8px 24px rgba(35, 45, 75, 0.06);
  --shadow-lg: 0 28px 80px rgba(42, 49, 85, 0.13);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --content-width: 1240px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbfbfd 0%, var(--canvas) 44%, #f6f7fa 100%);
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
label[for],
input[type="radio"],
input[type="checkbox"] {
  cursor: pointer;
}

button {
  border: 0;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

:focus-visible {
  outline: 3px solid rgba(95, 98, 217, 0.28);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent-dark);
  border-radius: 10px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  width: 440px;
  height: 440px;
  top: -210px;
  right: -120px;
  background: radial-gradient(circle, rgba(127, 130, 232, 0.16), rgba(127, 130, 232, 0));
}

.ambient-two {
  width: 520px;
  height: 520px;
  bottom: -320px;
  left: -230px;
  background: radial-gradient(circle, rgba(97, 190, 164, 0.12), rgba(97, 190, 164, 0));
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 12px max(24px, calc((100vw - var(--content-width)) / 2));
  border-bottom: 1px solid rgba(220, 224, 234, 0.78);
  background: rgba(250, 251, 253, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: inherit;
  text-decoration: none;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(95, 98, 217, 0.16);
  border-radius: 14px;
  background: linear-gradient(145deg, #f0efff, #fff);
  box-shadow: 0 8px 18px rgba(74, 77, 177, 0.12);
}

.brand-mark svg {
  width: 31px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
}

.brand-mark .brand-play {
  fill: var(--accent);
  stroke: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-self: center;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  color: var(--muted);
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  gap: 8px;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nav-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.nav-button.is-active {
  color: var(--accent-dark);
  background: #fff;
  box-shadow: 0 4px 12px rgba(45, 51, 90, 0.09);
}

.nav-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  color: var(--accent-dark);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 10px;
}

.session-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  max-width: 190px;
  min-height: 36px;
  padding: 0 12px;
  overflow: hidden;
  color: #49536a;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 650;
  gap: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 2px solid #d8f1e9;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(68, 165, 139, 0.1);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button:hover {
  color: var(--accent-dark);
  border-color: #cdd0ef;
  background: var(--accent-soft);
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

main {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 0 auto;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  min-height: calc(100vh - 76px);
  align-items: center;
  padding: 64px 0 86px;
  gap: clamp(48px, 8vw, 112px);
}

.auth-copy {
  max-width: 680px;
  padding-left: clamp(0px, 3vw, 28px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(40px, 5.1vw, 72px);
  font-weight: 720;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.auth-lead {
  max-width: 570px;
  margin: 27px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  margin-top: 40px;
  gap: 12px 20px;
}

.feature-row span {
  display: inline-flex;
  align-items: center;
  color: #5e687e;
  font-size: 12px;
  font-weight: 650;
  gap: 8px;
}

.feature-row i {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: var(--accent);
  border: 1px solid #dfe0f7;
  border-radius: 8px;
  background: #f3f2ff;
  font-size: 9px;
  font-style: normal;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  justify-self: end;
  padding: clamp(26px, 4vw, 38px);
  border: 1px solid rgba(221, 225, 235, 0.92);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.auth-card-heading {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  gap: 13px;
}

.auth-card-heading h2,
.auth-card-heading p {
  margin: 0;
}

.auth-card-heading h2 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.auth-card-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.soft-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent);
  border-radius: 15px;
  background: var(--accent-soft);
}

.soft-icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.field-label,
.field-group > span,
.field-group legend {
  display: block;
  margin-bottom: 9px;
  color: #414a60;
  font-size: 12px;
  font-weight: 750;
}

.secret-field {
  position: relative;
}

.secret-field input,
.field-group select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(24, 32, 51, 0.02);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.secret-field input {
  padding-right: 68px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.secret-field input:focus,
.field-group select:focus,
textarea:focus {
  border-color: rgba(95, 98, 217, 0.7);
  box-shadow: 0 0 0 4px rgba(95, 98, 217, 0.1);
  outline: none;
}

.reveal-button {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 34px;
  padding: 0 10px;
  color: var(--accent-dark);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 750;
}

.field-hint {
  margin: 9px 0 0;
  color: var(--muted-light);
  font-size: 11px;
  line-height: 1.65;
}

.check-row {
  display: flex;
  align-items: flex-start;
  margin: 22px 0;
  gap: 10px;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  color: #3d465b;
  font-size: 12px;
}

.check-row small {
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 760;
  gap: 9px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7376e5);
  box-shadow: 0 12px 24px rgba(95, 98, 217, 0.22);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-dark), #6568d7);
  box-shadow: 0 14px 28px rgba(77, 80, 190, 0.27);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button svg,
.secondary-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.secondary-button {
  color: #4a5368;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.secondary-button:hover:not(:disabled) {
  color: var(--accent-dark);
  border-color: #c8cae9;
  background: #fafaff;
}

.full-width {
  width: 100%;
}

.privacy-note {
  margin: 17px 0 0;
  color: var(--muted-light);
  font-size: 10px;
  line-height: 1.65;
  text-align: center;
}

.inline-alert {
  margin-top: 14px;
  padding: 11px 12px;
  color: #96404d;
  border: 1px solid #f2cfd5;
  border-radius: 11px;
  background: var(--danger-soft);
  font-size: 11px;
  line-height: 1.6;
}

.workspace-view {
  padding: 48px 0 80px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
}

.page-heading h1,
.page-heading p {
  margin: 0;
}

.page-heading h1 {
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.045em;
}

.page-heading > div:first-child > p:last-child {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.usage-card {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  min-width: 172px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  column-gap: 16px;
}

.usage-card span,
.usage-card small {
  color: var(--muted);
  font-size: 10px;
}

.usage-card strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--accent-dark);
  font-size: 26px;
  text-align: right;
}

.usage-card small {
  margin-top: 3px;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 18px;
}

.panel {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.prompt-panel,
.settings-panel {
  grid-column: 1;
}

.assets-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 14px;
}

.panel-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.step-index {
  display: inline-grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--accent);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 9px;
  font-weight: 850;
}

.mode-badge,
.subtle-count {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 0 10px;
  color: #5d667b;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.mode-badge[data-mode="image_to_video"] {
  color: #277b68;
  border-color: #ccebe2;
  background: var(--mint-soft);
}

textarea {
  width: 100%;
  min-height: 194px;
  padding: 18px;
  resize: vertical;
  color: #30394f;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #fbfcfe;
  font-size: 14px;
  line-height: 1.85;
}

textarea::placeholder,
input::placeholder {
  color: #a3aabb;
}

.textarea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  color: var(--muted-light);
  font-size: 10px;
}

.text-button {
  padding: 4px 0;
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.drop-zone {
  display: flex;
  min-height: 178px;
  align-items: center;
  justify-content: center;
  padding: 22px;
  color: var(--muted);
  border: 1.5px dashed #cfd5e1;
  border-radius: 16px;
  background: linear-gradient(145deg, #fafbfe, #f6f7fb);
  flex-direction: column;
  text-align: center;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  color: var(--accent-dark);
  border-color: #aeb1e6;
  background: #f5f4ff;
}

.drop-zone.is-disabled,
.drop-zone.is-disabled:hover {
  cursor: not-allowed;
  color: var(--muted);
  border-color: #cfd5e1;
  background: #f6f7fb;
  opacity: 0.62;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-zone strong {
  margin-top: 12px;
  color: #454e64;
  font-size: 13px;
}

.drop-zone small {
  margin-top: 6px;
  color: var(--muted-light);
  font-size: 10px;
}

.upload-orb {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--accent);
  border: 1px solid #dedffa;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(67, 70, 145, 0.08);
}

.upload-orb svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
  gap: 10px;
}

.asset-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.asset-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eef0f5;
}

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

.asset-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #6d7390;
  background: linear-gradient(135deg, #eef0f7, #e5e8f2);
  font-size: 12px;
  font-weight: 800;
}

.asset-state {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 4px 7px;
  color: #fff;
  border-radius: 999px;
  background: rgba(38, 46, 66, 0.75);
  backdrop-filter: blur(8px);
  font-size: 9px;
  font-weight: 750;
}

.asset-state.is-valid {
  background: rgba(38, 139, 111, 0.9);
}

.asset-state.is-error {
  background: rgba(181, 64, 80, 0.9);
}

.asset-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  padding: 9px 9px 9px 10px;
  gap: 6px;
}

.asset-name {
  min-width: 0;
  overflow: hidden;
  color: #4b5469;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.asset-retry {
  min-height: 25px;
  padding: 0 7px;
  color: var(--danger);
  border-radius: 8px;
  background: var(--danger-soft);
  font-size: 9px;
  font-weight: 750;
}

.asset-retry:hover {
  color: #983746;
  background: #ffe4e8;
}

.asset-remove {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 14px;
}

.asset-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.setting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
  gap: 16px;
}

.field-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

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

.choice-pill {
  position: relative;
}

.choice-pill input {
  position: absolute;
  opacity: 0;
}

.choice-pill span {
  display: grid;
  min-height: 50px;
  place-items: center;
  color: #596277;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice-pill input:checked + span {
  color: var(--accent-dark);
  border-color: #bfc1eb;
  background: var(--accent-soft);
}

.choice-pill input:focus-visible + span,
.ratio-card input:focus-visible ~ * {
  outline: 3px solid rgba(95, 98, 217, 0.25);
  outline-offset: 2px;
}

.ratio-group {
  margin-top: 20px;
}

.ratio-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(74px, 1fr));
  gap: 8px;
}

.ratio-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 106px;
  align-items: center;
  justify-content: center;
  padding: 11px 7px;
  color: #5d667b;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfe;
  flex-direction: column;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ratio-card:hover,
.ratio-card.is-selected {
  color: var(--accent-dark);
  border-color: #c6c8ec;
  background: var(--accent-soft);
}

.ratio-card.is-disabled,
.ratio-card.is-disabled:hover {
  cursor: not-allowed;
  color: var(--muted-light);
  border-color: var(--line);
  background: #f7f8fb;
  opacity: 0.62;
}

.ratio-card input {
  position: absolute;
  opacity: 0;
}

.ratio-card strong {
  margin-top: 8px;
  font-size: 10px;
}

.ratio-card small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 8px;
}

.ratio-shape {
  display: block;
  width: 25px;
  height: 31px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  opacity: 0.75;
}

.ratio-shape[data-ratio="4:3"] {
  width: 31px;
  height: 23px;
}

.ratio-shape[data-ratio="9:16"] {
  width: 18px;
  height: 32px;
}

.ratio-shape[data-ratio="16:9"] {
  width: 34px;
  height: 19px;
}

.ratio-shape[data-ratio="1:1"] {
  width: 27px;
  height: 27px;
}

.ratio-shape[data-ratio="21:9"] {
  width: 36px;
  height: 16px;
}

.auto-shape {
  position: relative;
  width: 29px;
  height: 25px;
  border-style: dashed;
}

.auto-shape::after {
  position: absolute;
  content: "A";
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
}

.submit-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  padding: 18px 20px 18px 24px;
  border: 1px solid #dcdef3;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, #f7f6ff, #fff 50%, #f3faf8);
  gap: 22px;
}

.submit-panel strong,
.submit-panel span {
  display: block;
}

.submit-panel strong {
  font-size: 13px;
}

.submit-panel > div > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.create-button {
  min-width: 190px;
}

.tasks-heading {
  align-items: center;
}

.task-filter-bar {
  display: flex;
  margin-bottom: 18px;
  gap: 8px;
}

.filter-chip {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.filter-chip:hover,
.filter-chip.is-active {
  color: var(--accent-dark);
  border-color: #c9cbee;
  background: var(--accent-soft);
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr) auto;
  align-items: center;
  padding: 18px 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(35, 45, 75, 0.04);
  gap: 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.task-card:hover {
  border-color: #cfd2e8;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.task-main {
  min-width: 0;
}

.task-topline {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 9px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  color: #536079;
  border-radius: 999px;
  background: #eef1f6;
  font-size: 9px;
  font-weight: 800;
}

.status-badge[data-status="completed"] {
  color: #277b68;
  background: var(--mint-soft);
}

.status-badge[data-status="failed"] {
  color: #a64250;
  background: var(--danger-soft);
}

.status-badge[data-status="queued"] {
  color: #98621e;
  background: var(--amber-soft);
}

.status-badge[data-status="submit_unknown"] {
  color: #9b5e18;
  background: var(--amber-soft);
}

.status-badge[data-status="preparing"],
.status-badge[data-status="submit_prepared"],
.status-badge[data-status="submitting"],
.status-badge[data-status="generating"],
.status-badge[data-status="resolving_url"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.task-id {
  color: var(--muted-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.task-prompt {
  margin: 0;
  overflow: hidden;
  color: #313a4f;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-time {
  margin-top: 6px;
  color: var(--muted-light);
  font-size: 9px;
}

.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
}

.task-meta-grid span {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  gap: 6px;
}

.task-meta-grid b {
  color: #3e485e;
  font-weight: 700;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.compact-button {
  min-height: 34px;
  padding: 0 11px;
  color: #515b70;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.compact-button:hover {
  color: var(--accent-dark);
  border-color: #c9cbee;
  background: var(--accent-soft);
}

.compact-button.download-button {
  color: #277b68;
  border-color: #ccebe2;
  background: var(--mint-soft);
}

.compact-button.retry-button,
.secondary-button.retry-button {
  color: var(--accent-dark);
  border-color: #c9cbee;
  background: var(--accent-soft);
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 42px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.54);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: #485267;
  font-size: 14px;
}

.empty-state span {
  font-size: 11px;
}

.load-more {
  margin: 18px auto 0;
}

.task-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  overflow: auto;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 36px 110px rgba(25, 31, 55, 0.25);
}

.task-dialog::backdrop {
  background: rgba(33, 39, 58, 0.24);
  backdrop-filter: blur(6px);
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

#dialog-content {
  padding: 22px 24px 26px;
}

.dialog-skeleton {
  min-height: 360px;
}

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

.detail-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.detail-item span,
.detail-item strong {
  display: block;
}

.detail-item span {
  color: var(--muted-light);
  font-size: 9px;
}

.detail-item strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #434d63;
  font-size: 11px;
}

.detail-prompt,
.detail-assets {
  margin-top: 18px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.detail-prompt h3,
.detail-assets h3,
.timeline-heading h3 {
  margin: 0;
  color: #3e485e;
  font-size: 12px;
}

.detail-prompt p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-assets ol {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.detail-assets li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 10px;
}

.detail-assets strong,
.detail-assets span {
  overflow-wrap: anywhere;
}

.detail-assets span {
  color: var(--muted);
  text-align: right;
}

.task-error {
  margin-top: 13px;
  padding: 12px 14px;
  color: #9f3c4a;
  border: 1px solid #f3ced4;
  border-radius: 12px;
  background: var(--danger-soft);
  font-size: 10px;
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.timeline-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 22px;
  gap: 14px;
}

.stream-status {
  color: var(--muted-light);
  font-size: 9px;
  text-align: right;
}

.event-empty {
  margin: 14px 0 0;
  padding: 17px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-size: 10px;
  text-align: center;
}

.load-events {
  display: block;
  margin: 4px auto 0;
}

.event-timeline {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.event-item {
  position: relative;
  padding: 0 0 18px 23px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.event-item::before {
  position: absolute;
  content: "";
  top: 4px;
  left: 2px;
  width: 8px;
  height: 8px;
  border: 3px solid #e4e3fb;
  border-radius: 999px;
  background: var(--accent);
}

.event-item::after {
  position: absolute;
  content: "";
  top: 18px;
  bottom: 0;
  left: 8px;
  width: 1px;
  background: var(--line);
}

.event-item:last-child::after {
  display: none;
}

.event-item strong {
  display: block;
  margin-bottom: 3px;
  color: #434d63;
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  padding: 13px 15px;
  color: #3f485d;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(35, 42, 68, 0.16);
  font-size: 11px;
  line-height: 1.55;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-success {
  border-left-color: var(--mint);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 88px;
  border-radius: 16px;
  background: #eceff4;
}

.skeleton::after {
  position: absolute;
  content: "";
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.25s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1040px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .primary-nav {
    position: fixed;
    z-index: 60;
    right: 18px;
    bottom: 18px;
    left: 18px;
    justify-content: center;
    box-shadow: 0 18px 48px rgba(38, 45, 72, 0.17);
  }

  .nav-button {
    flex: 1;
    justify-content: center;
  }

  .auth-view {
    grid-template-columns: 1fr 420px;
    gap: 42px;
  }

  .auth-copy h1 {
    font-size: 50px;
  }

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .prompt-panel,
  .settings-panel,
  .assets-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .assets-panel {
    order: 2;
  }

  .settings-panel {
    order: 3;
  }

  .submit-panel {
    order: 4;
  }

  .ratio-options {
    grid-template-columns: repeat(4, minmax(86px, 1fr));
  }

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

  .task-meta-grid {
    grid-column: 1;
    grid-row: 2;
  }

  .task-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    flex-direction: column;
  }

  .workspace-view {
    padding-bottom: 112px;
  }
}

@media (max-width: 780px) {
  .topbar {
    min-height: 68px;
    padding: 10px 18px;
  }

  .brand small {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .session-chip {
    max-width: 140px;
  }

  main {
    width: min(calc(100% - 32px), var(--content-width));
  }

  .auth-view {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 44px 0 70px;
    gap: 36px;
  }

  .auth-copy {
    padding: 0;
  }

  .auth-copy h1 {
    font-size: clamp(38px, 12vw, 56px);
  }

  .auth-lead {
    font-size: 15px;
  }

  .auth-card {
    max-width: none;
    justify-self: stretch;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-card {
    width: 100%;
  }

  .setting-grid {
    grid-template-columns: 1fr;
  }

  .ratio-options {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
  }

  .ratio-card {
    min-height: 96px;
  }

  .submit-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .create-button {
    width: 100%;
  }

  .task-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .task-meta-grid,
  .task-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .task-actions {
    align-items: stretch;
    flex-direction: row;
  }

  .compact-button {
    flex: 1;
  }

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

@media (max-width: 480px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .brand strong {
    font-size: 15px;
  }

  .session-chip {
    display: none;
  }

  .auth-copy h1 {
    font-size: 39px;
  }

  .feature-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card,
  .panel {
    padding: 21px;
    border-radius: 18px;
  }

  .workspace-view {
    padding-top: 34px;
  }

  .page-heading h1 {
    font-size: 34px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .mode-badge {
    max-width: 140px;
    text-align: center;
  }

  .asset-grid {
    grid-template-columns: 1fr;
  }

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

  .ratio-card {
    min-height: 90px;
  }

  .task-filter-bar {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .dialog-header,
  #dialog-content {
    padding-right: 18px;
    padding-left: 18px;
  }
}

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