:root {
  color-scheme: dark;
  --bg: #0b0f15;
  --panel: #151b23;
  --panel-strong: #1b232d;
  --ink: #eef3f8;
  --muted: #8d98a7;
  --soft: #222b36;
  --line: #2a3441;
  --accent: #18b7d6;
  --accent-strong: #5edcf0;
  --danger: #ff6b6b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgb(28 45 58 / 46%), transparent 38%),
    var(--bg);
  color: var(--ink);
}

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

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

.studio-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 18px clamp(18px, 3.5vw, 64px);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.asset-library-button,
.toolbar-chip,
.advanced-panel summary,
.download-button,
.logout-button,
.close-drawer-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.session-user {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.logout-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.logout-button:hover,
.logout-button:focus-visible {
  border-color: rgb(94 220 240 / 46%);
  color: var(--accent-strong);
  outline: none;
}

.asset-library-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  box-shadow: 0 14px 38px rgb(0 0 0 / 28%);
  font-size: 13px;
  font-weight: 800;
}

.asset-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.creation-stage {
  display: grid;
  grid-template-rows: auto auto minmax(48px, 1fr) auto;
  row-gap: 18px;
  justify-items: center;
  align-content: stretch;
  min-height: 0;
  overflow: hidden;
  padding: 20px 0 0;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  margin-bottom: 28px;
  font-size: clamp(23px, 2.5vw, 32px);
  font-weight: 900;
}

h2 {
  font-size: 20px;
}

.composer-card {
  position: relative;
  bottom: auto;
  z-index: 30;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-self: end;
  width: min(1120px, 100%);
  margin-top: 18px;
  height: var(--composer-height, auto);
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow:
    0 26px 70px rgb(0 0 0 / 34%),
    inset 0 0 0 1px rgb(255 255 255 / 4%);
  padding: 14px 20px;
}

.composer-resize-handle {
  position: absolute;
  top: -10px;
  left: 50%;
  width: min(190px, 34%);
  height: 18px;
  border: 0;
  background: transparent;
  cursor: ns-resize;
  padding: 0;
  transform: translateX(-50%);
}

.composer-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 68px;
  height: 4px;
  border-radius: 999px;
  background: rgb(141 152 167 / 28%);
  opacity: 0;
  transform: translateX(-50%);
  transition:
    opacity 140ms ease,
    background 140ms ease;
}

.composer-card:hover .composer-resize-handle::before,
.composer-resize-handle:focus-visible::before,
.composer-card.is-resizing .composer-resize-handle::before {
  opacity: 1;
}

.composer-resize-handle:focus-visible {
  outline: none;
}

.composer-card.is-resizing {
  user-select: none;
}

.composer-main {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  min-height: 68px;
  overflow: visible;
}

.composer-card.is-resized .composer-main {
  align-items: stretch;
  min-height: 0;
}

.upload-stack {
  align-self: start;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  width: 82px;
}

.upload-panel {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 62px;
  border-radius: 7px;
  background: #202833;
  box-shadow:
    0 12px 28px rgb(0 0 0 / 18%),
    inset 0 0 0 1px rgb(255 255 255 / 4%);
  cursor: pointer;
  transform: rotate(-8deg);
}

.reuse-assets-hint {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.25;
  padding: 0;
  text-align: center;
  white-space: nowrap;
}

.reuse-assets-hint:hover,
.reuse-assets-hint:focus-visible {
  color: var(--accent-strong);
  outline: none;
}

.upload-panel input {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  cursor: pointer;
}

.upload-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
}

.upload-preview.has-reference {
  outline: 1px solid rgb(126 151 177 / 42%);
  box-shadow: 0 14px 30px rgb(0 0 0 / 32%);
}

.upload-preview img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.upload-plus {
  color: #8793a1;
  font-size: 28px;
  line-height: 1;
}

.upload-reference-quote {
  position: absolute;
  left: -18px;
  bottom: -13px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #242f3b;
  color: #8c9aab;
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 12px 24px rgb(0 0 0 / 32%);
  pointer-events: none;
}

.upload-reference-count {
  position: absolute;
  right: -9px;
  top: -9px;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 0 6px;
  pointer-events: none;
}

.upload-reference-remove {
  position: absolute;
  top: -9px;
  right: -9px;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(0 0 0 / 76%);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.upload-panel:hover .upload-reference-remove,
.upload-reference-remove:focus-visible {
  opacity: 1;
  outline: none;
  transform: scale(1);
}

.prompt-field {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.prompt-editor {
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 58px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  outline: none;
  color: var(--ink);
  caret-color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.55;
  padding: 0 8px 34px 0;
  scrollbar-gutter: stable;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: #748190;
  pointer-events: none;
}

.prompt-reference-chip {
  display: inline-flex;
  position: relative;
  top: 5px;
  align-items: center;
  gap: 4px;
  width: 25px;
  height: 25px;
  margin: 0 4px;
  border: 1px solid rgb(126 151 177 / 34%);
  border-radius: 8px;
  background: rgb(255 255 255 / 6%);
  line-height: 1;
  padding: 0;
  vertical-align: baseline;
}

.prompt-reference-chip img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  box-shadow: 0 1px 6px rgb(0 0 0 / 28%);
  object-fit: cover;
}

.prompt-input {
  display: none;
}

.reference-mention {
  position: absolute;
  right: 0;
  bottom: 0;
  border: 1px solid rgb(94 220 240 / 34%);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgb(24 183 214 / 12%);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.current-reference-tray {
  position: absolute;
  left: 4px;
  top: 34px;
  z-index: 3;
  width: 214px;
  height: 74px;
  pointer-events: none;
}

.current-reference-item {
  position: absolute;
  top: 4px;
  overflow: hidden;
  width: 54px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-strong);
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  transform-origin: 50% 90%;
  box-shadow: 0 12px 28px rgb(0 0 0 / 32%);
  transition:
    box-shadow 160ms ease,
    transform 160ms ease;
}

.current-reference-item:nth-of-type(1) {
  left: 32px;
  z-index: 2;
  transform: rotate(-7deg);
}

.current-reference-item:nth-of-type(2) {
  left: 74px;
  z-index: 3;
  transform: rotate(2deg);
}

.current-reference-item:nth-of-type(3) {
  left: 118px;
  z-index: 4;
  transform: rotate(-8deg);
}

.current-reference-item:nth-of-type(4) {
  left: 160px;
  z-index: 5;
  transform: rotate(5deg);
}

.current-reference-item:nth-of-type(5) {
  left: 202px;
  z-index: 6;
  transform: rotate(-4deg);
}

.current-reference-item:hover,
.current-reference-item:focus-visible {
  z-index: 8;
  outline: none;
  box-shadow: 0 18px 34px rgb(0 0 0 / 42%);
  transform: translateY(-5px) rotate(0deg);
}

.current-reference-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.current-reference-quote {
  position: absolute;
  left: 6px;
  bottom: 1px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #202833;
  color: #697685;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 22px rgb(0 0 0 / 30%);
  pointer-events: none;
}

.current-reference-overflow {
  position: absolute;
  left: 244px;
  top: 48px;
  z-index: 9;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgb(238 243 248 / 16%);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  pointer-events: none;
}

.current-reference-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgb(0 0 0 / 78%);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
}

.current-reference-item:hover .current-reference-remove,
.current-reference-item:focus-visible .current-reference-remove {
  opacity: 1;
}

.mention-picker {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: var(--panel);
  box-shadow: 0 22px 48px rgb(0 0 0 / 38%);
}

.mention-option {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  padding: 6px;
  text-align: left;
}

.mention-option:hover,
.mention-option:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mention-option img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 0;
}

.toolbar-chip,
.advanced-panel summary,
.download-button,
.edit-button,
.regenerate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 750;
}

.project-selector {
  display: inline-grid;
  grid-template-columns: auto minmax(96px, 150px);
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 850;
}

.project-selector select {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
}

.project-selector .custom-select-button {
  min-height: 36px;
  border-radius: 12px;
  background: #101821;
  padding: 0 12px;
}

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-select {
  position: relative;
  min-width: 0;
}

.custom-select-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #10161d;
  color: var(--ink);
  cursor: pointer;
  padding: 0 12px;
  text-align: left;
  font-weight: 850;
}

.project-selector .custom-select-menu {
  min-width: 150px;
}

.custom-select-button:hover,
.custom-select-button:focus-visible,
.custom-select-button[aria-expanded="true"] {
  border-color: rgb(94 220 240 / 44%);
  outline: none;
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  overflow: auto;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f151c;
  box-shadow: 0 20px 44px rgb(0 0 0 / 42%);
  padding: 6px;
}

.custom-select-menu.opens-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.custom-select-option {
  display: block;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  font-weight: 750;
}

.custom-select-option:hover,
.custom-select-option:focus-visible,
.custom-select-option.is-selected {
  background: #223241;
  color: var(--accent-strong);
  outline: none;
}

.toolbar-chip:disabled {
  cursor: default;
  opacity: 1;
}

.advanced-panel {
  position: relative;
}

.advanced-panel summary {
  list-style: none;
  color: var(--accent);
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-grid {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 12px;
  min-width: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 24px 54px rgb(0 0 0 / 40%);
}

.advanced-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.advanced-grid input,
.advanced-grid select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10161d;
  color: var(--ink);
  padding: 0 10px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-content: end;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.status-pill {
  margin-left: auto;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-busy {
  color: #f6c86b;
}

.status-pill.is-error {
  color: var(--danger);
}

.status-pill.is-done {
  color: var(--accent-strong);
}

.submit-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgb(94 220 240 / 20%);
  border-radius: 12px;
  background: #1d2631;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 3%);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.submit-button:not(:disabled) {
  background: #1e3340;
  border-color: rgb(94 220 240 / 34%);
}

.submit-button:not(:disabled):hover,
.submit-button:not(:disabled):focus-visible {
  background: #244657;
  border-color: rgb(94 220 240 / 58%);
  outline: none;
  transform: translateY(-1px);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.result-panel {
  width: min(1120px, 100%);
  margin: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  overflow: visible;
  transition:
    max-height 220ms ease,
    padding 180ms ease;
}

.result-feed {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: min(1120px, 100%);
  min-height: 0;
  max-height: 100%;
  gap: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 0 96px;
  scroll-padding-bottom: 96px;
  scrollbar-width: thin;
}

.result-feed::before {
  content: "";
  order: 0;
  margin-top: auto;
}

.result-feed > .result-panel {
  flex: 0 0 auto;
  order: 2;
}

.result-feed::-webkit-scrollbar {
  width: 8px;
}

.result-feed::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgb(141 152 167 / 28%);
}

.result-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.result-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 26px;
  border-radius: 8px;
  background: rgb(238 243 248 / 10%);
  color: #b7c0cb;
  padding: 0 9px 0 5px;
  font-weight: 800;
  white-space: nowrap;
}

.result-thumbnail {
  display: block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 8px;
  background: #111;
  object-fit: cover;
}

.result-thumbnail-placeholder {
  background:
    linear-gradient(90deg, transparent, rgb(255 255 255 / 16%), transparent),
    #111;
  background-size: 180% 100%;
  animation: result-loading 1.4s ease-in-out infinite;
}

@keyframes result-loading {
  from {
    background-position: 180% 0;
  }

  to {
    background-position: -180% 0;
  }
}

.result-summary-text {
  flex: 1 1 260px;
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.result-reference-strip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  min-height: 28px;
}

.result-reference-strip img {
  width: 28px;
  height: 28px;
  border: 1px solid rgb(238 243 248 / 18%);
  border-radius: 7px;
  object-fit: cover;
  background: rgb(238 243 248 / 8%);
  box-shadow: 0 6px 16px rgb(0 0 0 / 20%);
}

.result-reference-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgb(24 183 214 / 18%);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
}

.result-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.result-list {
  display: grid;
  grid-template-columns: minmax(118px, 158px) minmax(0, 1fr);
  gap: 8px 18px;
  align-items: start;
  margin: 0;
}

.result-list div {
  min-width: 0;
}

.result-list dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.result-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.result-list div:nth-child(3) {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.result-list div:nth-child(3) dt {
  margin-bottom: 6px;
}

.result-list div:nth-child(3) dd {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.download-button {
  min-width: 96px;
  border: 1px solid rgb(94 220 240 / 38%);
  border-radius: 12px;
  background: rgb(24 183 214 / 16%);
  color: var(--accent-strong);
  cursor: pointer;
  margin-right: 0;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 3%);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.download-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.edit-button,
.regenerate-button {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(238 243 248 / 8%);
  color: #c7d0dc;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 2%);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.edit-button:disabled,
.regenerate-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.download-button:not(:disabled):hover,
.download-button:not(:disabled):focus-visible {
  border-color: rgb(94 220 240 / 64%);
  background: rgb(24 183 214 / 26%);
  outline: none;
  transform: translateY(-1px);
}

.edit-button:not(:disabled):hover,
.edit-button:not(:disabled):focus-visible,
.regenerate-button:not(:disabled):hover,
.regenerate-button:not(:disabled):focus-visible {
  border-color: rgb(141 152 167 / 46%);
  background: rgb(238 243 248 / 12%);
  color: var(--ink);
  outline: none;
  transform: translateY(-1px);
}

.video-preview-card {
  position: relative;
  overflow: hidden;
  width: 292px;
  max-width: 100%;
  max-height: min(42vh, 360px);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #111;
  box-shadow: none;
}

.video-preview-card.is-portrait {
  width: 292px;
  max-width: 100%;
  max-height: min(42vh, 360px);
}

.video-preview-card.is-landscape {
  width: 380px;
  max-width: 100%;
}

.video-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-bottom: 2px;
}

.result-panel.has-video {
  max-height: none;
  overflow: visible;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.result-panel.has-video .result-summary {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

.result-panel.has-video .result-thumbnail {
  display: block;
}

.result-panel.has-video .result-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  justify-items: start;
  width: 100%;
}

.result-panel.has-video.is-expanded,
.result-panel.has-video:focus-within {
  max-height: none;
  overflow: visible;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.result-panel.has-video.is-expanded .result-summary,
.result-panel.has-video:focus-within .result-summary {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.result-panel.has-video.is-expanded .result-thumbnail,
.result-panel.has-video:focus-within .result-thumbnail {
  display: block;
}

.result-panel.has-video.is-expanded .result-summary-text,
.result-panel.has-video .result-summary-text,
.result-panel.has-video:focus-within .result-summary-text {
  white-space: normal;
}

.result-panel.has-video.is-expanded .result-list > div:nth-child(-n + 2),
.result-panel.has-video .result-list > div:nth-child(-n + 2),
.result-panel.has-video:focus-within .result-list > div:nth-child(-n + 2) {
  display: none;
}

.result-panel.has-video.is-expanded .result-list > div:nth-child(3),
.result-panel.has-video .result-list > div:nth-child(3),
.result-panel.has-video:focus-within .result-list > div:nth-child(3) {
  grid-column: 1;
  grid-row: auto;
  width: 100%;
}

.result-panel.has-video.is-expanded .result-list > div:nth-child(3) dt,
.result-panel.has-video .result-list > div:nth-child(3) dt,
.result-panel.has-video:focus-within .result-list > div:nth-child(3) dt {
  display: none;
}

.result-panel.has-video #downloadResult {
  width: 100%;
}

.result-panel.is-running #downloadResult {
  min-height: 26px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.progress-card {
  display: grid;
  gap: 8px;
  width: min(380px, 100%);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-header strong {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 900;
}

.progress-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgb(238 243 248 / 10%);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 260ms ease;
}

.progress-hint {
  margin: 0;
  color: #778393;
  font-size: 12px;
  font-weight: 750;
}

.error-card {
  display: grid;
  gap: 8px;
  width: min(560px, 100%);
  border: 1px solid rgb(255 111 111 / 34%);
  border-radius: 14px;
  background: rgb(255 111 111 / 8%);
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 3%);
}

.error-card strong {
  color: var(--danger);
  font-size: 14px;
  font-weight: 900;
}

.error-message {
  max-height: 128px;
  overflow: auto;
  margin: 0;
  color: #ffb8b8;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  scrollbar-width: thin;
}

.error-hint {
  color: #8793a1;
  font-size: 12px;
  font-weight: 750;
}

.result-history {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  order: 1;
  align-items: flex-start;
  width: min(1120px, 100%);
  gap: 28px;
  margin: 0;
  overflow: visible;
}

.history-result {
  flex: 0 0 auto;
  margin: 0;
  opacity: 0.9;
}

.history-result .result-list > div {
  display: block !important;
  grid-column: 1 !important;
  grid-row: auto !important;
  width: 100%;
}

.history-result .result-list > div dt {
  display: none;
}

.saved-file-path {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.asset-drawer {
  position: fixed;
  top: 88px;
  right: clamp(18px, 4vw, 84px);
  z-index: 10;
  width: min(440px, calc(100vw - 36px));
  max-height: calc(100vh - 116px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 28px 76px rgb(0 0 0 / 46%);
  padding: 18px;
  transform-origin: top right;
  animation: assetDrawerReveal 150ms ease-out;
}

@keyframes assetDrawerReveal {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.asset-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.close-drawer-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 24px;
  line-height: 1;
}

.asset-project-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.asset-project-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.asset-project-bar input,
.asset-project-bar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10161d;
  color: var(--ink);
  padding: 0 10px;
}

.asset-project-bar .custom-select-button {
  min-height: 38px;
}

.asset-project-bar .custom-select {
  min-width: 0;
}

.asset-project-bar .custom-select-menu {
  max-height: min(240px, calc(100vh - 300px));
  overscroll-behavior: contain;
}

.asset-project-bar button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  padding: 0 12px;
}

.asset-project-create-field {
  grid-column: 1 / -1;
}

.asset-project-bar #addProjectAssetsButton {
  grid-column: 1 / -1;
  background: var(--soft);
  color: var(--ink);
}

.asset-project-bar #addProjectAssetsButton:hover,
.asset-project-bar #addProjectAssetsButton:focus-visible {
  background: #2a3542;
  outline: none;
}

.reference-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.reference-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  min-height: 134px;
}

.reference-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.reference-card-label {
  display: block;
  overflow: hidden;
  padding: 8px 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-reference-button {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 999px;
  background: rgb(23 23 23 / 82%);
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.reference-card:hover .remove-reference-button,
.remove-reference-button:focus-visible {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 860px) {
  .studio-shell {
    padding: 12px 10px;
  }

  .creation-stage {
    grid-template-rows: auto auto minmax(40px, 1fr) auto;
    align-content: stretch;
    min-height: 0;
    padding-top: 26px;
  }

  h1 {
    margin-bottom: 18px;
    text-align: center;
  }

  .composer-card {
    bottom: auto;
    border-radius: 20px;
    padding: 12px;
  }

  .composer-main {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
  }

  .upload-panel {
    width: 46px;
    height: 56px;
  }

  .composer-toolbar {
    flex-wrap: wrap;
  }

  .project-selector {
    grid-template-columns: auto minmax(90px, 1fr);
  }

  .status-pill {
    order: 8;
    width: 100%;
  }

  .submit-button {
    margin-left: auto;
  }

  .result-list {
    grid-template-columns: 1fr;
  }

  .result-list div:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }

  .video-preview-card.is-landscape {
    width: 100%;
  }

  .advanced-grid {
    left: auto;
    right: 0;
    min-width: min(420px, calc(100vw - 48px));
    grid-template-columns: 1fr;
  }

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