:root {
  color-scheme: dark;
  --bg: #06070b;
  --panel: rgba(18, 19, 25, 0.78);
  --panel-2: rgba(29, 30, 37, 0.74);
  --panel-3: rgba(45, 46, 54, 0.72);
  --text: #f5f7fb;
  --muted: #8a91a3;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #f2f4ff;
  --accent-dark: #101219;
  --blue: #7aa7ff;
  --violet: #b48cff;
  --green: #67d391;
  --danger: #ff6b7a;
  --radius: 8px;
  --shadow: 0 26px 92px rgba(0, 0, 0, 0.62);
  --glass-shadow: 0 22px 78px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 54% -18%, rgba(145, 125, 255, 0.15), transparent 34%),
    radial-gradient(circle at 86% 92%, rgba(255, 255, 255, 0.06), transparent 24%),
    linear-gradient(180deg, #0a0b10 0%, #050609 100%);
  color: var(--text);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 136, 98, 0.24), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(117, 92, 255, 0.28), transparent 32%),
    linear-gradient(145deg, #08080c 0%, #16131d 54%, #09090d 100%);
}

.auth-screen.hidden {
  display: none;
}

html.auth-restoring .auth-screen {
  display: none;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
}

.auth-card {
  position: relative;
  width: min(420px, calc(100vw - 48px));
  max-width: 100%;
  min-width: 0;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(24, 23, 31, 0.72);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px) saturate(1.15);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.auth-copy {
  margin: 28px 0 22px;
}

.auth-copy h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.7;
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.auth-tabs button {
  height: 40px;
  border: 0;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.64);
  background: transparent;
}

.auth-tabs button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

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

.auth-field {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.auth-field input {
  min-width: 0;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  outline: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-field input:focus {
  border-color: rgba(255, 159, 108, 0.58);
  box-shadow: 0 0 0 4px rgba(255, 141, 98, 0.13);
}

.auth-field input:focus-visible {
  outline: 0;
  outline-offset: 0;
}

.auth-submit {
  height: 48px;
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(105deg, #ff9b5f, #e368c8 48%, #765cff);
  box-shadow: 0 16px 34px rgba(227, 104, 200, 0.26);
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  color: #ffdad3;
  background: rgba(255, 82, 82, 0.13);
}

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

button {
  cursor: pointer;
  transform: translateZ(0);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.985);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(226, 232, 255, 0.74);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 14px;
  background: linear-gradient(180deg, rgba(11, 12, 17, 0.94), rgba(5, 6, 9, 0.9));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.25);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #08090d;
  font-weight: 800;
  background: linear-gradient(135deg, #f6f7ff, #9fc1ff 48%, #d9c7ff);
}

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

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

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button,
.icon-button,
.primary-mini {
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
  transition: background 160ms ease, border 160ms ease, transform 160ms ease;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #c8cedd;
  text-align: left;
}

.workspace {
  position: relative;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

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

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
}

.balance {
  min-height: 34px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.workspace {
  min-width: 0;
  padding: 18px 24px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
}

.route {
  display: grid;
  gap: 4px;
}

.route span {
  color: var(--muted);
  font-size: 12px;
}

.route strong {
  font-size: 18px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.primary-mini,
.ghost-button {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
}

.primary-mini {
  color: #0c0e14;
  background: linear-gradient(135deg, #fff, #d9e3ff 58%, #f3e9ff);
  box-shadow: 0 12px 30px rgba(178, 192, 255, 0.16);
}

.ghost-button {
  width: 100%;
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
  height: calc(100vh - 172px);
  min-height: 640px;
}

.preview-panel,
.settings-panel,
.job-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 18, 24, 0.76), rgba(8, 9, 13, 0.82));
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(1.2);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: #090b10;
  border: 1px solid var(--line);
}

.mode-tab {
  height: 38px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.mode-tab.active {
  color: #fff;
  background: #222632;
}

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

.field > span {
  color: #c5cad7;
  font-size: 13px;
  font-weight: 600;
}

.prompt-field {
  position: relative;
  margin-top: 0;
  min-width: 0;
}

.prompt-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 78px;
}

.prompt-asset-button {
  display: grid;
  place-items: center;
  align-content: center;
  width: 72px;
  height: 72px;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055)),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.prompt-asset-button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)),
    rgba(255, 255, 255, 0.055);
}

.prompt-asset-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-asset-button span {
  font-size: 12px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d13;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(160, 185, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(99, 127, 255, 0.14);
}

.prompt-field em {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.model-row,
.advanced-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.compact select,
.advanced input,
.advanced select {
  height: 42px;
  padding: 0 11px;
}

.upload-panel {
  margin-bottom: 12px;
}

.upload-panel.media-only #dropZone {
  display: none;
}

.upload-panel.media-only .upload-action-grid {
  grid-template-columns: minmax(0, 1fr);
}

.upload-panel.media-only .media-upload-tile {
  min-height: 76px;
}

.upload-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr);
  gap: 10px;
  min-width: 0;
}

.reference-panel,
.template-panel,
.asset-mode-panel {
  display: grid;
  gap: 10px;
  padding: 6px 0 4px;
}

.reference-panel,
.asset-mode-panel {
  grid-template-columns: 88px 88px minmax(0, 1fr);
}

.reference-tile,
.asset-tile,
.asset-list button,
.template-panel button,
.template-search {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  color: #eef1f8;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.reference-tile,
.asset-tile {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 88px;
  height: 72px;
  padding: 8px;
  text-align: center;
}

.reference-tile strong,
.reference-tile span,
.asset-tile strong,
.asset-tile span {
  display: block;
}

.reference-tile strong,
.asset-tile strong {
  font-size: 12px;
}

.reference-tile span,
.asset-tile span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.asset-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 8px;
  border-radius: 8px;
  color: #aeb5c6;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.asset-list button {
  flex: 0 0 auto;
  display: grid;
  gap: 2px;
  height: 48px;
  padding: 6px 10px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055)),
    rgba(255, 255, 255, 0.04);
}

.asset-list b,
.asset-list em {
  display: block;
  font-style: normal;
}

.asset-list b {
  color: #fff;
  font-size: 12px;
}

.asset-list em {
  color: #98a0b2;
  font-size: 10px;
}

.template-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 10px;
  color: #9da3b3;
  font-size: 12px;
}

.template-search input {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.template-tags,
.template-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.template-panel button {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.template-panel button.active {
  background: rgba(255, 255, 255, 0.16);
}

#imageInput,
#mediaInput,
#referenceImagesInput,
#firstFrameInput,
#lastFrameInput,
#mimicImageInput,
#mimicVideoInput {
  display: none;
}

.switch-pill[aria-disabled="true"],
.switch-pill.is-disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.drop-zone,
.media-upload-tile {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 106px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(122, 167, 255, 0.09), rgba(180, 140, 255, 0.08)),
    #0b0d13;
  color: #dce2ef;
}

.media-upload-tile {
  border-style: solid;
  text-align: center;
}

.drop-zone span,
.media-upload-tile span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.drop-zone.has-file,
.media-upload-tile.has-file {
  border-color: rgba(103, 211, 145, 0.55);
}

.advanced {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 19, 0.75);
}

.advanced summary {
  padding: 13px 14px;
  color: #dfe4f2;
  font-weight: 650;
}

.advanced-grid {
  padding: 0 14px 14px;
  grid-template-columns: 1fr;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 0 14px 14px;
  color: #c5cad7;
  font-size: 13px;
}

.toggle-row input {
  width: auto;
  margin-right: 6px;
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 164px;
  flex: 0 0 164px;
  height: 52px;
  margin-top: 22px;
  color: #08090d;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #c9d8ff 48%, #efe0ff);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 18px 48px rgba(187, 203, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.generate-button:hover {
  box-shadow: 0 22px 58px rgba(187, 203, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.generate-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.generation-progress {
  position: relative;
  overflow: hidden;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.04)),
    rgba(7, 8, 12, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.generation-progress span {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 12px;
  color: #eef2ff;
  font-size: 12px;
  font-weight: 800;
}

.generation-progress em {
  color: #d7ddf0;
  font-style: normal;
}

.generation-progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42), rgba(161, 190, 255, 0.72), rgba(219, 185, 255, 0.68));
  box-shadow: 0 0 30px rgba(185, 201, 255, 0.22);
  transition: width 420ms ease;
}

.generation-progress.done i {
  background: linear-gradient(90deg, rgba(150, 255, 190, 0.7), rgba(255, 255, 255, 0.78));
}

.generation-progress.error i {
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 107, 122, 0.78), rgba(255, 182, 193, 0.45));
}

.preview-panel {
  display: grid;
  grid-template-rows: 72px 230px minmax(220px, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 15, 0.64);
  backdrop-filter: blur(18px);
}

.library-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.library-tab,
.ghost-chip,
.tool-tab,
.config-button {
  border: 0;
  color: #c5cad7;
  background: transparent;
}

.library-tab {
  height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 750;
}

.library-tab.active,
.ghost-chip,
.config-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.105);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-chip {
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
}

.history-shelf {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    #050608;
}

.history-shelf:empty {
  background: #050608;
}

.history-shelf[data-view-mode="grid"] {
  flex-wrap: wrap;
}

.history-shelf[data-view-mode="wide"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  align-items: stretch;
  overflow-y: auto;
}

.history-shelf[data-view-mode="compact"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: stretch;
  overflow-y: auto;
}

.creation-card {
  position: relative;
  width: 292px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(17, 18, 22, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.36);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.history-shelf[data-view-mode="wide"] .creation-card,
.history-shelf[data-view-mode="compact"] .creation-card {
  width: 100%;
}

.history-shelf[data-view-mode="wide"] .creation-card .card-video,
.history-shelf[data-view-mode="wide"] .creation-card .card-placeholder {
  height: 190px;
}

.history-shelf[data-view-mode="compact"] .creation-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-shelf[data-view-mode="compact"] .creation-card .card-video,
.history-shelf[data-view-mode="compact"] .creation-card .card-placeholder {
  height: 102px;
}

.history-shelf[data-view-mode="compact"] .creation-card em {
  height: 22px;
  margin: 6px;
  padding: 0 8px;
  font-size: 11px;
}

.creation-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 62px rgba(0, 0, 0, 0.52);
  transform: translateY(-2px);
}

.creation-card span {
  display: block;
  padding: 8px 0 8px;
  color: #a5a9b6;
  background: #050608;
  font-size: 12px;
}

.creation-card img,
.creation-card .card-video,
.card-placeholder,
.card-preview-art {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  transition: filter 160ms ease, transform 240ms ease;
}

.creation-card:hover img {
  filter: brightness(1.08);
  transform: scale(1.015);
}

.card-play {
  position: absolute;
  left: 50%;
  top: 92px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(18, 19, 25, 0.58);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  backdrop-filter: blur(16px);
}

.creation-card:hover .card-play,
.creation-card:focus-within .card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-placeholder {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), transparent 40%),
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.14), transparent 27%),
    linear-gradient(90deg, #1c1e25, #111319);
}

.card-placeholder.soft {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.055), transparent 42%),
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.09), transparent 27%),
    linear-gradient(90deg, #161920, #0d0f14);
}

.card-preview-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,0.22), transparent 14%),
    linear-gradient(135deg, #1c2030, #0a0c12);
}

.card-preview-art::before,
.card-preview-art::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
}

.preview-noir::before {
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(74, 142, 255, 0.26) 35% 38%, transparent 39%),
    radial-gradient(circle at 75% 18%, rgba(255, 221, 130, 0.74), transparent 10%),
    linear-gradient(180deg, #101522, #08090d 58%, #241019);
}

.preview-noir::after {
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 34px);
  opacity: 0.42;
}

.preview-sci-fi::before {
  background:
    radial-gradient(ellipse at 62% 36%, rgba(255, 167, 70, 0.72), transparent 18%),
    radial-gradient(ellipse at 45% 55%, rgba(101, 174, 255, 0.46), transparent 22%),
    linear-gradient(145deg, #090b18, #241331 52%, #0b0c13);
}

.preview-sci-fi::after {
  inset: 42% 20% 38%;
  border: 1px solid rgba(255,255,255,0.38);
  border-radius: 999px;
  transform: skewX(-24deg);
}

.preview-wuxia::before {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 194, 92, 0.82), transparent 10%),
    radial-gradient(circle at 70% 24%, rgba(255, 104, 84, 0.48), transparent 13%),
    linear-gradient(180deg, #2c1411, #100b08 55%, #26150a);
}

.preview-wuxia::after {
  background: repeating-linear-gradient(90deg, transparent 0 28px, rgba(255, 184, 92, 0.26) 29px 31px);
  filter: blur(0.2px);
}

.preview-fantasy::before {
  background:
    radial-gradient(circle at 30% 26%, rgba(212, 255, 166, 0.78), transparent 9%),
    radial-gradient(circle at 68% 42%, rgba(138, 255, 218, 0.52), transparent 13%),
    linear-gradient(160deg, #0c2119, #06100d 52%, #182313);
}

.preview-fantasy::after {
  background: radial-gradient(circle at 50% 92%, rgba(255,255,255,0.16), transparent 34%);
}

.placeholder-card {
  cursor: default;
}

.creation-card em {
  display: inline-grid;
  place-items: center;
  height: 28px;
  margin: 8px;
  padding: 0 10px;
  border-radius: 6px;
  color: #d5dae8;
  background: #1d2028;
  font-size: 12px;
  font-style: normal;
}

.muted-card {
  opacity: 0.72;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.045), transparent 34%),
    #050608;
}

.composer-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(980px, calc(100% - 96px));
  margin: 0 auto 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(28, 29, 35, 0.74), rgba(13, 14, 19, 0.72));
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(26px) saturate(1.3);
}

.tool-tabs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--line);
}

.tool-tab {
  position: relative;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.8;
}

.tool-tab.active {
  color: #fff;
  opacity: 1;
}

.tool-tab:hover {
  color: #fff;
  opacity: 1;
}

.tool-tab.active::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  border-radius: 99px;
  background: #fff;
  content: "";
}

.composer-bar .field > span {
  display: none;
}

.composer-bar textarea {
  min-height: 72px;
  max-height: 150px;
  border-color: transparent;
  background: transparent;
  padding: 8px 6px 20px;
}

.composer-bar textarea::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.composer-bar textarea:focus {
  box-shadow: none;
}

.settings-panel {
  position: absolute;
  z-index: 30;
  top: 72px;
  right: 24px;
  display: none;
  flex-direction: column;
  width: 348px;
  height: calc(100vh - 132px);
  overflow: auto;
  padding: 16px;
  backdrop-filter: blur(20px);
}

body.settings-open .settings-panel {
  display: flex;
}

.settings-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-title strong,
.settings-title span {
  display: block;
}

.settings-title strong {
  font-size: 16px;
}

.settings-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.empty-preview {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  color: #d9deed;
}

.empty-preview span {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.orb {
  width: 120px;
  height: 160px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(180deg, #2a3042, #0f121b);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 70px rgba(122, 167, 255, 0.24);
}

#resultVideo {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.72);
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 24, 0.96);
}

.status-card strong,
.status-card span {
  display: block;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-width: 82px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #0a0c10;
  background: #e8ebf5;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.idle {
  color: #a4abbc;
  background: #272b37;
}

.status-pill.running {
  color: #101219;
  background: #ffd166;
}

.status-pill.done {
  color: #07110b;
  background: var(--green);
}

.status-pill.error {
  color: #170307;
  background: var(--danger);
}

.raw-output {
  flex: 1;
  margin: 0;
  margin-top: 12px;
  padding: 14px 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #b8c0d4;
  background: #090a0f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.composer-footer,
.quick-settings,
.generate-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-footer {
  justify-content: space-between;
  flex-wrap: wrap;
}

.quick-settings,
.generate-cluster {
  flex-wrap: wrap;
}

.quick-select select,
.quick-select input,
.quick-button,
.count-pill input {
  width: auto;
  min-width: 68px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.095);
  border-color: transparent;
  border: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.075);
}

.quick-button:hover,
.config-button:hover,
.switch-pill:hover,
.seed-row button:hover,
.option-row button:hover,
.duration-grid button:hover,
.ratio-grid button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.quick-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.model-control {
  min-width: 132px;
}

.model-control b {
  display: inline-grid;
  place-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(135deg, #f65aff, #6c4cff);
  font-size: 10px;
}

.count-pill input {
  width: 38px;
  padding: 0;
  text-align: center;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.095);
}

.count-pill span {
  display: grid;
  width: 22px;
  padding-right: 4px;
}

.count-pill button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 13px;
  border: 0;
  color: #bfc4d2;
  background: transparent;
  font-size: 10px;
  line-height: 1;
}

.switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: #d4d9e6;
  background: rgba(255, 255, 255, 0.095);
  font-size: 13px;
  font-weight: 700;
}

.switch-pill i,
.mini-switch i,
.switch-dot {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.26);
}

.switch-pill i::after,
.mini-switch i::after,
.switch-dot::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #e6e8ef);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.36);
  transition: transform 160ms ease;
  content: "";
}

.switch-pill.on i,
.mini-switch.on i,
.config-row.on .switch-dot {
  background: linear-gradient(90deg, #ff8b58, #d85fff 48%, #6e5cff);
  box-shadow: 0 0 18px rgba(188, 99, 255, 0.28);
}

.switch-pill.on i::after,
.mini-switch.on i::after,
.config-row.on .switch-dot::after {
  transform: translateX(16px);
}

.config-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.slider-glyph {
  color: #dce0ec;
  font-size: 12px;
}

.config-button b {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, #ff7de8, #755cff);
  transform: rotate(45deg);
}

.floating-popover {
  position: absolute;
  z-index: 40;
  bottom: 72px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(48, 47, 45, 0.94), rgba(25, 25, 28, 0.96));
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px) saturate(1.25);
}

.sheet-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  color: #d6d8df;
  background: rgba(255, 255, 255, 0.095);
  font-size: 22px;
  line-height: 1;
}

.size-popover {
  left: 10px;
  width: 384px;
  padding: 52px 10px 10px;
}

.floating-popover section {
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.072);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.floating-popover section + section {
  margin-top: 10px;
}

.popover-heading,
.mini-switch,
.config-row,
.seed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-switch {
  color: #c7c9d1;
  font-size: 12px;
}

.option-row,
.duration-grid,
.ratio-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.option-row {
  grid-template-columns: repeat(4, 1fr);
}

.duration-grid {
  grid-template-columns: repeat(5, 1fr);
}

.option-row button,
.duration-grid button,
.ratio-grid button {
  border: 0;
  border-radius: 8px;
  color: #d6d8df;
  background: transparent;
  box-shadow: none;
}

.option-row button,
.duration-grid button {
  height: 38px;
}

.option-row button.active,
.duration-grid button.active,
.ratio-grid button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.145);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.085);
}

.floating-popover em {
  display: block;
  margin-top: 8px;
  color: #d06aff;
  text-align: center;
  font-size: 12px;
  font-style: normal;
}

.ratio-grid {
  grid-template-columns: repeat(5, 1fr);
}

.ratio-grid button {
  display: grid;
  place-items: center;
  gap: 7px;
  height: 62px;
  font-size: 12px;
}

.ratio {
  display: block;
  border: 2px solid #b9bbc4;
  border-radius: 4px;
}

.r-16-9 { width: 28px; height: 16px; }
.r-4-3 { width: 24px; height: 18px; }
.r-1-1 { width: 22px; height: 22px; }
.r-3-4 { width: 18px; height: 24px; }
.r-9-16 { width: 16px; height: 28px; }
.r-21-9 { width: 34px; height: 14px; }
.r-3-2 { width: 28px; height: 18px; }
.r-2-3 { width: 18px; height: 28px; }

.config-popover {
  left: 230px;
  width: 380px;
  padding: 54px 12px 12px;
}

.config-row,
.seed-row {
  width: 100%;
  min-height: 56px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: #e7e9f2;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.seed-row {
  margin-top: 10px;
}

.seed-row input {
  width: 150px;
  height: 36px;
  border: 0;
  background: rgba(255, 255, 255, 0.085);
  text-align: center;
}

.seed-row button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 850;
}

#seedSlider {
  width: 100%;
  margin-top: 16px;
  accent-color: #f0f0f5;
}

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

.config-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.config-field.compact {
  grid-column: span 1;
}

.config-field input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.085);
}

.config-field input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.model-popover {
  right: 24px;
  width: 506px;
  padding: 54px 14px 14px;
}

.model-popover > strong {
  display: block;
  margin: 0 0 12px;
}

.model-option {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  text-align: left;
  box-shadow: none;
}

.model-option + .model-option {
  margin-top: 6px;
}

.model-option.active,
.model-option:hover {
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.model-option i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff935e, #765eff);
  box-shadow: 0 10px 28px rgba(137, 96, 255, 0.22);
  font-style: normal;
  font-weight: 900;
}

.model-option b,
.model-option small {
  display: block;
}

.model-option small {
  margin-top: 4px;
  color: #b5b7c1;
  font-size: 12px;
}

.model-option em {
  margin: 0;
  padding: 0 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ff65f7, #634cff);
  color: #fff;
  font-size: 10px;
}

.diagnostics {
  display: none;
}

.job-section {
  margin-top: 18px;
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
}

.section-title .ghost-button {
  width: auto;
}

.job-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.job-row {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.job-row strong {
  font-size: 13px;
}

.job-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px;
    overflow-x: auto;
  }

  .brand {
    border-bottom: 0;
    padding: 0;
  }

  .nav-list {
    display: flex;
  }

  .sidebar-footer {
    display: none;
  }

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

  .preview-panel {
    min-height: 560px;
  }

  .settings-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
    background: #000;
  }

  .app-shell,
  .workspace,
  .studio-grid,
  .preview-panel,
  .settings-panel,
  .job-section {
    width: 100%;
    max-width: 100%;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    background: #000;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 16px 16px 260px;
    overflow-x: hidden;
    max-width: none;
    margin: 0;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 70;
    justify-content: flex-end;
    min-height: 54px;
    height: 54px;
    padding: 0 16px;
    background: #000;
  }

  .route,
  .top-actions .icon-button,
  .top-actions .claim,
  .top-actions .plan-pill {
    display: none;
  }

  .top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
  }

  .credit-pill {
    height: 34px;
    min-width: 58px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
  }

  .top-actions .account-menu-shell {
    display: block;
  }

  .top-actions .avatar-dot {
    display: inline-flex;
    width: 34px;
    height: 34px;
  }

  .account-menu {
    right: -4px;
    width: min(304px, calc(100vw - 24px));
  }

  .studio-grid {
    height: auto;
    min-height: 0;
    margin-top: 0;
    padding-top: 56px;
  }

  .preview-panel {
    min-height: calc(100vh - 56px);
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .settings-panel,
  .job-section,
  .preview-stage,
  .diagnostics {
    display: none;
  }

  .canvas-toolbar {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 106px;
    padding: 0;
    overflow: visible;
    border-bottom: 0;
    background: #000;
  }

  .product-tabs {
    display: flex;
    gap: 28px;
    width: 100%;
    height: 38px;
    overflow-x: auto;
    padding: 0;
    border: 0;
  }

  .product-tabs button {
    flex: 0 0 auto;
    height: 36px;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.54);
    background: transparent;
    font-size: 17px;
    font-weight: 850;
  }

  .product-tabs button.active {
    color: #fff;
  }

  .library-tabs {
    display: flex;
    gap: 8px;
    height: 40px;
    overflow-x: auto;
  }

  .library-tab {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.58);
    font-size: 14px;
    font-weight: 800;
  }

  .library-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
  }

  .canvas-actions {
    display: none;
  }

  .history-shelf {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 34px 0 0;
    overflow: visible;
    background: transparent;
  }

  .creation-card {
    width: 100%;
    height: 185px;
    min-width: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
  }

  .creation-card span {
    height: 28px;
    padding: 0 4px 6px;
    color: rgba(255, 255, 255, 0.68);
    background: transparent;
    font-size: 13px;
  }

  .creation-card img,
  .creation-card .card-video {
    width: 100%;
    height: 157px;
    border-radius: 4px;
    object-fit: cover;
  }

  .creation-card em {
    right: 6px;
    bottom: 6px;
    height: 22px;
    border-radius: 7px;
    font-size: 10px;
  }

  .composer-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 54px;
    z-index: 80;
    width: 100%;
    min-height: 160px;
    margin: 0;
    padding: 8px;
    gap: 6px;
    border-right: 0;
    border-left: 0;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background: rgba(8, 9, 12, 0.82);
    box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(1.25);
  }

  .tool-tabs {
    gap: 18px;
    padding: 0 64px 6px 4px;
    border-bottom: 0;
  }

  .prompt-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    min-height: 50px;
  }

  .prompt-asset-button {
    width: 48px;
    height: 48px;
  }

  .prompt-asset-button span {
    font-size: 11px;
  }

  .reference-panel,
  .asset-mode-panel {
    display: flex;
    overflow-x: auto;
  }

  .reference-panel.hidden,
  .template-panel.hidden,
  .asset-mode-panel.hidden {
    display: none !important;
  }

  .asset-list {
    min-width: 220px;
  }

  .upload-action-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .media-upload-tile {
    min-height: 76px;
  }

  .composer-footer {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 126px 2px 0;
  }

  .quick-settings {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    min-width: max-content;
    overflow: visible;
  }

  .generate-cluster {
    flex-wrap: nowrap;
    flex: 0 0 auto;
    min-width: max-content;
  }

  .quick-button,
  .switch-pill,
  .config-button,
  .count-pill {
    flex: 0 0 auto;
    height: 34px;
  }

  .floating-popover {
    position: fixed;
    z-index: 80;
    top: auto;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    bottom: 48px;
    max-height: min(68vh, 620px);
    overflow-y: auto;
    border-radius: 16px;
  }

  .model-popover {
    right: 8px;
  }

  .size-popover,
  .config-popover,
  .model-popover {
    padding: 58px 14px 14px;
  }

  .sheet-close {
    right: 14px;
    top: 14px;
  }

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

  .duration-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .generate-button {
    position: fixed;
    right: 8px;
    bottom: 66px;
    z-index: 4;
    width: 112px;
    flex: 0 0 112px;
    height: 42px;
    margin-top: 0;
    border-radius: 8px;
  }

  .model-row,
  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .composer-bar textarea {
    min-height: 48px;
    max-height: 50px;
    padding: 8px 6px 14px;
    font-size: 14px;
    line-height: 1.35;
  }

  .prompt-field em {
    right: 8px;
    bottom: 4px;
    font-size: 11px;
  }

  .job-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-width: 100vw;
    width: 100%;
  }

  .brand {
    min-width: 156px;
  }

  .nav-item {
    min-width: 86px;
  }
}

.top-pill,
.credit-pill,
.plan-pill,
.avatar-dot,
.view-toggle button,
.social-row button,
.viewer-actions button,
.viewer-info button {
  border: 0;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
}

.view-toggle button.active {
  color: #0b0c10;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(255, 255, 255, 0.12);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 226px;
  z-index: 150;
  transform: translateX(-50%);
  min-width: 120px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #fff;
  background: rgba(28, 28, 30, 0.9);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.48);
  text-align: center;
  font-size: 13px;
  font-weight: 750;
  backdrop-filter: blur(18px);
}

.history-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(520px, 100%);
  height: 260px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.72);
}

.history-empty span {
  color: rgba(255, 255, 255, 0.42);
  font-size: 13px;
}

.pending-delete {
  opacity: 0.36;
  filter: grayscale(0.8);
}

.viewer-actions button.active,
.viewer-edit button.active,
.viewer-create button.active,
.ghost-chip.active,
.reference-tile.active,
.template-tags button.active,
.template-list button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

body.select-mode .creation-card::after {
  position: absolute;
  right: 10px;
  top: 38px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  content: "";
}

.composer-attention {
  border-color: rgba(201, 115, 255, 0.72) !important;
  box-shadow:
    0 0 0 1px rgba(201, 115, 255, 0.24),
    0 24px 90px rgba(170, 87, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.top-pill,
.credit-pill,
.plan-pill,
.avatar-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.top-pill {
  padding: 0 16px;
}

.claim {
  color: #ff85c7;
}

.credit-pill {
  gap: 6px;
  padding: 0 12px;
}

.plan-pill {
  padding: 0 10px;
  color: #161719;
  background: #f2f2f4;
  font-size: 11px;
}

.avatar-dot {
  width: 32px;
  padding: 0;
  background:
    radial-gradient(circle at 62% 32%, #ff88be 0 12%, transparent 13%),
    radial-gradient(circle at 40% 42%, #ffc170 0 22%, transparent 23%),
    linear-gradient(135deg, #8b5cff, #fb7e8b);
}

.avatar-dot span {
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.account-menu-shell {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 80;
  width: min(320px, calc(100vw - 28px));
  padding: 42px 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(20, 20, 24, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44), inset 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px) saturate(140%);
}

.account-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 17px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 24, 0.86);
}

.account-menu-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.09);
  font-size: 18px;
  line-height: 1;
}

.account-menu-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.account-menu-head {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 4px 14px;
}

.account-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #111;
  font-weight: 850;
  background: linear-gradient(135deg, #fff7d6, #ffb84d 48%, #ff6f3d);
  box-shadow: 0 12px 28px rgba(255, 133, 55, 0.22);
}

.account-menu-head strong,
.account-menu-head em {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head strong {
  color: rgba(255, 255, 255, 0.95);
  font-size: 15px;
}

.account-menu-head em {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-style: normal;
}

.account-menu dl {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 9px 12px;
  margin: 0;
  padding: 13px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.account-menu dt,
.account-menu dd {
  margin: 0;
  font-size: 12px;
}

.account-menu dt {
  color: rgba(255, 255, 255, 0.42);
}

.account-menu dd {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
}

.account-menu-actions button {
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
}

.account-menu-actions button:last-child {
  color: #ffcfbd;
  border-color: rgba(255, 120, 84, 0.25);
  background: rgba(255, 112, 72, 0.12);
}

.social-row {
  display: flex;
  gap: 16px;
}

.social-row button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 11px;
}

.viewer-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 450px 120px;
  background:
    radial-gradient(circle at 42% 84%, rgba(128, 100, 54, 0.14), transparent 34%),
    rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(18px);
}

.viewer-back {
  position: fixed;
  left: 26px;
  top: 26px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.1);
}

.viewer-main {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  min-width: 0;
  padding: 76px 56px 64px;
}

.viewer-video {
  width: min(1012px, 100%);
  aspect-ratio: 16 / 9;
  max-height: min(72vh, 620px);
  justify-self: center;
  border-radius: 4px;
  background: #050505;
  object-fit: contain;
}

.viewer-fallback {
  width: min(1012px, 100%);
  aspect-ratio: 16 / 9;
  max-height: min(72vh, 620px);
  justify-self: center;
  object-fit: contain;
  border-radius: 4px;
  background: #050505;
}

.viewer-video.video-stalled {
  display: none;
}

.viewer-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 48px;
}

.viewer-actions button {
  height: 40px;
  min-width: 88px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 750;
}

.viewer-info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 76px 48px 36px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.viewer-info h2 {
  margin: 0;
  font-size: 18px;
}

.viewer-info p {
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.viewer-info section,
.viewer-info dl {
  margin: 0;
  padding: 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.viewer-info section {
  display: grid;
  gap: 12px;
}

.viewer-info section button {
  justify-self: start;
  padding: 0;
  color: rgba(255, 255, 255, 0.52);
  background: transparent;
  text-decoration: underline;
}

.viewer-info dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
}

.viewer-info dt,
.viewer-info dd {
  margin: 0;
}

.viewer-info dd {
  color: rgba(255, 255, 255, 0.72);
}

.viewer-edit,
.viewer-create {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.viewer-edit button,
.viewer-create button {
  height: 48px;
  border-radius: 8px;
  font-weight: 800;
}

.same-button {
  color: #fff !important;
  background: linear-gradient(105deg, #ff955f, #ec67c7 48%, #7b4cff) !important;
}

.viewer-thumbs {
  position: fixed;
  right: 32px;
  top: 72px;
  display: grid;
  gap: 10px;
}

.viewer-thumbs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.78);
}

.viewer-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(135deg, #292d38, #111319);
}

.viewer-thumb-placeholder.soft {
  opacity: 0.62;
}

@media (min-width: 761px) {
  body {
    overflow: hidden;
    background: #000;
  }

  button:hover {
    transform: none;
  }

  .app-shell {
    grid-template-columns: 216px minmax(0, 1fr);
    background: #000;
  }

  .brand {
    position: fixed;
    left: 16px;
    top: 14px;
    z-index: 80;
    display: flex !important;
    gap: 8px;
    width: 112px;
    padding: 0;
    border-bottom: 0;
    color: #fff;
  }

  .brand-mark {
    width: 24px;
    height: 28px;
    border-radius: 6px;
    color: #fff;
    background: linear-gradient(150deg, #ff9b62 0%, #cb62ff 48%, #6e5cff 100%);
    font-size: 0;
    transform: skewY(-10deg);
  }

  .brand strong {
    font-size: 18px;
    letter-spacing: 0;
  }

  .brand span {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    gap: 0;
    width: 216px;
    padding: 72px 16px 16px;
    background: #000;
    border-right: 1px solid rgba(255, 255, 255, 0.13);
    backdrop-filter: none;
  }

  .nav-list {
    gap: 8px;
  }

  .nav-item {
    position: relative;
    width: 184px;
    height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    font-weight: 700;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .nav-item.active,
  .nav-item:hover {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: none;
    color: #fff;
  }

  .nav-item b {
    margin-left: auto;
    padding: 1px 5px;
    border-radius: 4px;
    background: linear-gradient(105deg, #ff69d7, #765cff);
    color: #fff;
    font-size: 9px;
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 0 0 4px;
    border-top: 0;
  }

  .balance {
    min-height: 0;
    color: rgba(255, 255, 255, 0.38);
    font-size: 11px;
  }

  .workspace {
    min-width: 0;
    padding: 56px 24px 0;
  }

  .topbar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 60;
    height: 56px;
    min-height: 56px;
    padding: 0 16px 0 216px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13);
    background: #000;
  }

  .route {
    display: none;
  }

  .top-actions {
    margin-left: auto;
    gap: 12px;
  }

  .icon-button,
  .primary-mini {
    height: 32px;
    border: 0;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  .icon-button {
    width: 32px;
  }

  .primary-mini {
    padding: 0 14px;
    font-weight: 750;
  }

  .studio-grid {
    display: block;
    height: calc(100vh - 56px);
    min-height: 0;
    margin-top: 0;
  }

  .preview-panel {
    display: block;
    height: 100%;
    min-height: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .canvas-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 40px 40px;
    gap: 8px 16px;
    min-height: 104px;
    padding: 16px 0 0;
    border-bottom: 0;
    background: #000;
    backdrop-filter: none;
  }

  .product-tabs {
    display: flex;
    gap: 32px;
    grid-column: 1 / -1;
    height: 40px;
  }

  .product-tabs button {
    position: relative;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.52);
    background: transparent;
    font-size: 16px;
    font-weight: 800;
  }

  .product-tabs button.active {
    color: #fff;
  }

  .product-tabs button.active::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    content: "";
  }

  .library-tabs,
  .canvas-actions {
    height: 40px;
  }

  .library-tabs {
    gap: 12px;
  }

  .library-tab,
  .ghost-chip,
  .view-toggle {
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: none;
    font-size: 15px;
  }

  .library-tab {
    padding: 0 18px;
  }

  .library-tab:not(.active) {
    color: rgba(255, 255, 255, 0.58);
    background: transparent;
  }

  .ghost-chip {
    padding: 0 16px;
  }

  .status-pill {
    display: none;
  }

  .view-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
  }

  .view-toggle button {
    width: 24px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.62);
  }

  .history-shelf {
    display: flex;
    gap: 4px;
    width: 100%;
    min-height: 0;
    padding: 24px 0 0;
    overflow: visible;
    background: transparent;
  }

  .creation-card,
  .creation-card:hover {
    width: 283px;
    height: 283px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .creation-card span {
    height: 28px;
    padding: 0 4px 6px;
    color: rgba(255, 255, 255, 0.58);
    background: transparent;
    font-size: 16px;
  }

  .creation-card img,
  .creation-card .card-video,
  .card-placeholder {
    width: 283px;
    height: 255px;
    border-radius: 4px;
    background: rgb(13, 15, 16);
    object-fit: cover;
  }

  .creation-card:hover img {
    filter: brightness(1.06);
    transform: none;
  }

  .card-play {
    top: 156px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
  }

  .creation-card em {
    position: absolute;
    right: 8px;
    bottom: 8px;
    height: 24px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.34);
    color: rgba(255, 255, 255, 0.74);
    font-size: 11px;
  }

  .preview-stage,
  .job-section,
  .diagnostics {
    display: none;
  }

  .composer-bar {
    position: fixed;
    left: calc(216px + 248px);
    bottom: 18px;
    z-index: 42;
    width: min(980px, calc(100vw - 520px));
    min-height: 184px;
    margin: 0;
    padding: 14px;
    gap: 10px;
    border-color: rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(4, 4, 5, 0.78);
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(26px) saturate(1.2);
  }

  .prompt-row {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    min-height: 76px;
    padding: 0 2px;
  }

  .prompt-asset-button {
    width: 72px;
    height: 72px;
  }

  .tool-tabs {
    gap: 16px;
    padding: 0 4px 8px;
    border-bottom: 0;
  }

  .tool-tab {
    height: 26px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 13px;
    font-weight: 800;
  }

  .tool-tab.active {
    color: #fff;
  }

  .tool-tab.active::after {
    bottom: -8px;
    height: 2px;
  }

  .composer-bar textarea {
    min-height: 64px;
    max-height: 76px;
    padding: 14px 8px 18px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    line-height: 1.35;
  }

  .prompt-field em {
    right: 10px;
    bottom: 6px;
  }

  .composer-footer {
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }

  .quick-settings,
  .generate-cluster {
    flex-wrap: nowrap;
  }

  .quick-button,
  .switch-pill,
  .config-button,
  .count-pill,
  .count-pill input {
    height: 32px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }

  .quick-button,
  .switch-pill,
  .config-button {
    padding: 0 12px;
    font-size: 13px;
  }

  .switch-pill i {
    width: 36px;
    height: 20px;
  }

  .model-control {
    min-width: 124px;
  }

  .generate-button {
    width: 95px;
    flex: 0 0 95px;
    height: 32px;
    margin-top: 0;
    gap: 6px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(105deg, #ff9b5f, #e368c8 48%, #765cff);
    box-shadow: none;
    font-size: 14px;
  }

  .generate-button svg {
    display: none;
  }

  .floating-popover {
    bottom: 58px;
    border-radius: 16px;
    background: rgba(34, 34, 34, 0.94);
  }

  .sheet-close {
    display: none;
  }

  .size-popover {
    left: 0;
    width: 360px;
    padding: 12px;
  }

  .config-popover {
    left: 246px;
    width: 360px;
    padding: 12px;
  }

  .model-popover {
    right: 170px;
    width: 430px;
    padding: 14px;
  }
}

@media (min-width: 761px) and (max-width: 1220px) {
  .composer-bar {
    left: 240px;
    width: calc(100vw - 264px);
  }
}

@media (max-width: 760px) {
  .viewer-drawer {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .viewer-main {
    padding: 70px 14px 24px;
  }

  .viewer-video {
    width: 100%;
    max-height: 52vh;
  }

  .viewer-actions,
  .viewer-edit,
  .viewer-create {
    overflow-x: auto;
  }

  .viewer-info {
    padding: 14px;
    border-left: 0;
  }

  .viewer-thumbs {
    display: none;
  }
}

/* UI hardening: prevent low-level overflow, fake controls, and unclosable overlays. */
html,
body,
.app-shell,
.workspace {
  max-width: 100%;
}

body,
.workspace,
.preview-panel,
.composer-bar,
.floating-popover,
.account-menu,
.job-row,
.creation-card {
  overflow-wrap: anywhere;
}

.canvas-toolbar,
.top-actions,
.product-tabs,
.library-tabs,
.canvas-actions,
.tool-tabs,
.composer-footer,
.quick-settings,
.generate-cluster,
.viewer-actions,
.viewer-edit,
.viewer-create {
  min-width: 0;
}

.tool-tabs,
.composer-footer,
.quick-settings,
.generate-cluster,
.canvas-toolbar,
.canvas-actions {
  flex-wrap: wrap;
}

.floating-popover {
  max-width: calc(100vw - 32px);
  overflow-wrap: anywhere;
}

.floating-popover .sheet-close {
  display: grid;
}

@media (min-width: 761px) {
  .history-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .creation-card,
  .creation-card:hover {
    width: 100%;
    max-width: 100%;
  }

  .creation-card .card-video,
  .creation-card .card-placeholder,
  .creation-card .card-preview-art {
    width: 100%;
  }

  .composer-bar {
    left: clamp(232px, 36vw, 464px);
    right: 18px;
    width: auto;
    max-width: 980px;
  }

  .composer-footer,
  .quick-settings,
  .generate-cluster {
    row-gap: 8px;
  }

  .size-popover,
  .config-popover,
  .model-popover {
    max-height: min(72vh, 620px);
    overflow-y: auto;
    padding-top: 52px;
  }

  .config-popover {
    left: auto;
    right: clamp(96px, 18vw, 210px);
    width: min(430px, calc(100vw - 280px));
  }
}

@media (min-width: 761px) and (max-width: 1220px) {
  .composer-bar {
    left: 240px;
    right: 18px;
    width: auto;
  }

  .config-popover,
  .model-popover,
  .size-popover {
    left: 240px;
    right: 18px;
    width: auto;
  }
}

@media (max-width: 760px) {
  .auth-screen {
    justify-items: center;
    padding: 16px;
    overflow-x: hidden;
  }

  .auth-card {
    width: min(420px, calc(100vw - 64px));
    padding: 24px;
  }

  .auth-copy h1 {
    font-size: clamp(24px, 8vw, 30px);
  }

  .auth-copy p,
  .auth-tabs button,
  .auth-submit {
    overflow-wrap: anywhere;
  }

  .tool-tabs {
    gap: 10px 14px;
    max-height: 72px;
    overflow-y: auto;
    padding-right: 4px;
  }

  .composer-footer {
    flex-wrap: wrap;
    overflow-x: hidden;
    padding-right: 118px;
  }

  .quick-settings,
  .generate-cluster {
    min-width: 0;
    flex-wrap: wrap;
    flex: 1 1 0;
    max-width: calc(100vw - 150px);
  }

  .quick-settings > *,
  .generate-cluster > * {
    max-width: 100%;
  }

  .config-button {
    white-space: normal;
  }

  .floating-popover {
    bottom: 148px;
    max-height: min(58vh, 520px);
  }

  .config-field-grid {
    grid-template-columns: 1fr;
  }

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

  .creation-card,
  .creation-card:hover {
    width: 100%;
  }

  .creation-card img,
  .creation-card .card-video,
  .creation-card .card-placeholder,
  .creation-card .card-preview-art {
    width: 100%;
  }
}

.subscription-panel {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
}

.subscription-panel.hidden {
  display: none;
}

.subscription-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
}

.subscription-card {
  position: relative;
  width: min(1040px, calc(100vw - 48px));
  max-height: min(86vh, 800px);
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(20, 20, 28, 0.96), rgba(8, 9, 14, 0.98));
  box-shadow: var(--shadow);
}

.subscription-card header,
.subscription-hero {
  display: grid;
  gap: 8px;
  padding-right: 42px;
}

.subscription-card header span {
  color: var(--blue);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subscription-card h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
}

.subscription-card p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.subscription-lifecycle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.subscription-lifecycle div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.subscription-lifecycle b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #061018;
  background: var(--green);
}

.subscription-lifecycle strong,
.subscription-lifecycle small {
  overflow-wrap: anywhere;
}

.subscription-lifecycle small {
  color: rgba(255, 255, 255, 0.56);
}

.subscription-notice {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(77, 212, 172, 0.24);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(77, 212, 172, 0.08);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.subscription-notice.warning {
  border-color: rgba(255, 207, 111, 0.34);
  background: rgba(255, 207, 111, 0.1);
}

.subscription-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
}

.subscription-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin: 18px 0 22px;
}

.subscription-summary > div,
.subscription-summary > strong {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.subscription-summary small {
  color: rgba(255, 255, 255, 0.52);
}

.subscription-summary strong {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.subscription-summary b {
  font-size: 24px;
  color: var(--green);
}

.subscription-summary .auth-submit {
  min-height: 62px;
  align-self: stretch;
}

.subscription-section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.subscription-section-title span {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.package-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  overflow-wrap: anywhere;
}

.package-card.trial {
  border-color: rgba(77, 212, 172, 0.28);
  background: linear-gradient(150deg, rgba(77, 212, 172, 0.13), rgba(255, 255, 255, 0.045));
}

.package-card.paid {
  background: linear-gradient(150deg, rgba(83, 132, 255, 0.11), rgba(255, 255, 255, 0.045));
}

.package-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.package-card-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.09);
  font-size: 11px;
}

.package-card strong {
  font-size: 16px;
}

.package-card em,
.package-card small,
.package-card li {
  color: rgba(255, 255, 255, 0.62);
  font-style: normal;
  line-height: 1.55;
}

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

.package-card button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.package-card.paid button {
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
}

@media (max-width: 760px) {
  .subscription-panel {
    padding: 12px;
  }

  .subscription-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 20px;
    border-radius: 18px;
  }

  .subscription-lifecycle,
  .subscription-summary {
    grid-template-columns: 1fr;
  }

  .subscription-section-title {
    align-items: start;
  }
}

/* 2026-06 low-level creation page hardening: scroll, previews, popovers, subscription UX. */
@keyframes soft-dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes soft-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 761px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

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

  .sidebar {
    height: 100vh;
    max-height: 100vh;
  }

  .workspace {
    padding-bottom: 0;
  }

  .studio-grid {
    height: auto;
    min-height: calc(100vh - 92px);
  }

  .preview-panel {
    grid-template-rows: auto auto minmax(260px, 42vh) auto;
    height: auto;
    min-height: calc(100vh - 92px);
    overflow: visible;
  }

  .canvas-toolbar {
    flex-wrap: wrap;
    min-height: 72px;
  }

  .history-shelf {
    max-height: max(240px, calc(100vh - 386px));
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 0;
    padding-right: 8px;
  }

  .creation-card,
  .creation-card:hover {
    width: 100%;
    height: auto;
  }

  .creation-card img,
  .creation-card .card-video,
  .creation-card .card-placeholder,
  .creation-card .card-preview-art {
    width: 100%;
    height: clamp(156px, 24vh, 208px);
  }

  .preview-stage {
    min-height: clamp(260px, 42vh, 520px);
  }

  .composer-bar {
    position: fixed;
    left: clamp(240px, 32vw, 464px);
    right: 24px;
    bottom: 18px;
    z-index: 42;
    width: auto;
    max-width: 980px;
    min-height: 184px;
    margin: 0;
  }

  .floating-popover {
    position: absolute;
    bottom: 72px;
  }

  .size-popover {
    left: 10px;
  }

  .config-popover {
    left: auto;
    right: clamp(96px, 18vw, 210px);
  }

  .model-popover {
    left: auto;
    right: 12px;
  }
}

.showcase-intro {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 0 2px 4px;
  color: rgba(255, 255, 255, 0.72);
}

.showcase-intro strong {
  color: #fff;
  font-size: 14px;
}

.showcase-intro span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.showcase-card {
  min-width: 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.showcase-card:hover {
  height: auto;
  min-height: 0;
}

.showcase-card span {
  color: rgba(255, 255, 255, 0.78);
}

.showcase-card small {
  display: -webkit-box;
  min-height: 42px;
  padding: 8px 10px 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.showcase-card em {
  position: static;
  right: auto;
  bottom: auto;
  display: inline-grid;
  width: fit-content;
  margin: 8px 10px 10px;
  background: rgba(122, 167, 255, 0.14);
  color: rgba(232, 238, 255, 0.9);
}

.creation-card img,
.creation-card .card-video,
.card-placeholder,
.card-preview-art {
  width: 100%;
  height: clamp(150px, 20vw, 220px);
}

.subscription-panel.is-open .subscription-backdrop {
  animation: soft-backdrop-in 160ms ease-out both;
}

.subscription-panel.is-open .subscription-card {
  animation: soft-dialog-in 180ms cubic-bezier(.2, .8, .2, 1) both;
}

.subscription-card {
  overscroll-behavior: contain;
}

.package-card {
  align-content: start;
}

.package-card button,
.package-card.paid button {
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
}

.package-card.paid button:hover {
  border-color: rgba(122, 167, 255, 0.36);
  background: rgba(122, 167, 255, 0.16);
}

/* Creation toolbar semantics: usable view icons, real selection state, unclipped card labels. */
.view-toggle button {
  display: grid;
  place-items: center;
}

.view-toggle button svg {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.history-shelf:not([data-view-mode="compact"]) .creation-card span {
  height: auto;
  min-height: 28px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
}

.ghost-chip.active,
.select-mode [data-select-toggle] {
  border-color: rgba(135, 170, 255, 0.34);
  color: #fff;
  background: rgba(110, 132, 255, 0.18);
}

.select-mode .creation-card {
  cursor: pointer;
}

.creation-card.is-selected {
  outline: 2px solid rgba(134, 173, 255, 0.9);
  outline-offset: -2px;
  box-shadow: 0 0 0 4px rgba(87, 120, 255, 0.22), 0 18px 52px rgba(0, 0, 0, 0.54);
}

.creation-card.is-selected::after {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #07101f;
  background: linear-gradient(135deg, #fff, #9fc1ff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
  content: "✓";
  font-size: 15px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .showcase-intro {
    display: grid;
    gap: 4px;
  }

  .showcase-card small {
    min-height: 38px;
  }

  .subscription-card {
    max-width: calc(100vw - 24px);
  }
}
