:root {
  --bg: #f4efe8;
  --bg-accent: #e8ddff;
  --panel: rgba(255, 252, 248, 0.88);
  --panel-strong: #ffffff;
  --line: rgba(43, 30, 83, 0.12);
  --text: #1f1b2d;
  --muted: #6f6782;
  --brand: #5c50ff;
  --brand-2: #33c36b;
  --danger: #d55353;
  --shadow: 0 22px 60px rgba(56, 39, 128, 0.18);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(92, 80, 255, 0.3), transparent 32%),
    radial-gradient(circle at bottom right, rgba(51, 195, 107, 0.22), transparent 28%),
    linear-gradient(135deg, #f8f1e7 0%, #f3f0ff 100%);
}

.shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px;
}

.single-column {
  display: grid;
  gap: 20px;
}

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

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 1;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 20px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.studio-frame {
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, #dff5ff 0%, #fffaf2 14%, rgba(255, 255, 255, 0.94) 100%);
  border: 1px solid rgba(92, 80, 255, 0.08);
}

.studio-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(92, 80, 255, 0.08);
}

.studio-title {
  font-size: 18px;
  font-weight: 700;
}

.demo-link {
  border: 0;
  background: transparent;
  color: #0aa5df;
  font-weight: 700;
  cursor: pointer;
}

.studio-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px;
}

.reference-wall {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 14px;
  min-height: 260px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header.compact {
  margin-bottom: 10px;
}

.status-dot,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(92, 80, 255, 0.1);
  color: var(--brand);
}

.reference-tile {
  position: relative;
  width: 108px;
  height: 152px;
  border-radius: 20px;
  border: 1px solid rgba(59, 53, 89, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248,248,252,0.94));
  box-shadow: 0 18px 38px rgba(63, 53, 126, 0.12);
  cursor: pointer;
  overflow: hidden;
}

.reference-tile:nth-child(2n) {
  transform: rotate(-7deg);
}

.reference-tile:nth-child(3n) {
  transform: rotate(5deg);
}

.add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  color: #a0a6b9;
  text-align: center;
}

.add-plus {
  font-size: 42px;
  line-height: 1;
}

.add-label {
  max-width: 100%;
  font-size: 16px;
  line-height: 1.3;
  word-break: break-word;
  opacity: 0.85;
}

.filled-tile {
  padding: 8px;
}

.tile-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 20, 30, 0.82);
  color: white;
  font-size: 18px;
}

.tile-media {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 16px;
  overflow: hidden;
  background: #eef3fb;
}

.tile-media img,
.tile-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-media.audio {
  background: linear-gradient(180deg, #93a8cf, #6d83ac);
  color: white;
}

.audio-tile-icon {
  font-size: 46px;
}

.tile-caption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
}

.tile-duration {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 12px;
}

.hidden-file-input {
  display: none;
}

.composer {
  display: grid;
  gap: 14px;
}

.inline-action-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field-hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.field-hint[data-tone="success"] {
  color: #18864a;
}

.field-hint[data-tone="error"] {
  color: var(--danger);
}

.prompt-shell {
  position: relative;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
pre {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(50, 38, 95, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
}

.prompt-editor {
  min-height: 220px;
  line-height: 1.6;
  border-radius: 16px;
  border: 1px solid rgba(50, 38, 95, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: #9aa0b4;
}

.inline-token {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  margin: 0 4px;
  border-radius: 12px;
  background: rgba(92, 80, 255, 0.12);
  border: 1px solid rgba(92, 80, 255, 0.18);
  vertical-align: middle;
}

.inline-token-thumb {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand);
}

.inline-token-thumb img,
.inline-token-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inline-token-thumb.audio {
  background: linear-gradient(180deg, #93a8cf, #6d83ac);
  color: white;
}

.inline-token-label {
  color: #4d42d9;
  font-weight: 700;
}

.inline-token-audio {
  font-size: 12px;
}

.secondary-btn {
  border: 0;
  border-radius: 14px;
  background: rgba(92, 80, 255, 0.1);
  color: var(--brand);
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-token-list {
  min-height: 24px;
}

.token-chip {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(92, 80, 255, 0.12);
  color: var(--brand);
}

.job-billing {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  background: rgba(92, 80, 255, 0.08);
  color: var(--brand);
}

.job-billing.success {
  background: rgba(51, 195, 107, 0.14);
  color: #18864a;
}

.job-billing.error {
  background: rgba(213, 83, 83, 0.12);
  color: #b13c3c;
}

.mention-menu {
  position: absolute;
  top: 54px;
  left: 20px;
  width: min(360px, calc(100% - 40px));
  padding: 14px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 26px 60px rgba(65, 52, 135, 0.18);
  border: 1px solid rgba(92, 80, 255, 0.08);
  z-index: 10;
}

.mention-menu.hidden {
  display: none;
}

.mention-title {
  color: #9aa0b4;
  font-size: 14px;
  margin-bottom: 8px;
}

.mention-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 0;
  background: transparent;
  border-radius: 18px;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
}

.mention-item:hover {
  background: #f3f4f9;
}

.mention-create {
  margin-bottom: 6px;
}

.mention-icon,
.mention-thumb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  background: #e9eef7;
  font-size: 28px;
}

.mention-thumb img,
.mention-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mention-empty {
  padding: 10px 4px 4px;
  color: #8f96ab;
  font-size: 14px;
}

.config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-field {
  width: 122px;
}

.compact-field select,
.compact-field input {
  min-height: 52px;
}

.compact-field-sm {
  width: 96px;
}

.compact-field span {
  font-size: 12px;
  line-height: 1.2;
}

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

.toggles,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.toggles {
  align-items: stretch;
}

.toggle {
  flex: 1 1 220px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.toggle:hover {
  border-color: rgba(92, 80, 255, 0.26);
  box-shadow: 0 14px 28px rgba(63, 53, 126, 0.08);
}

.toggle:has(input:checked) {
  background: rgba(92, 80, 255, 0.08);
  border-color: rgba(92, 80, 255, 0.3);
}

.toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  font-size: 15px;
  line-height: 1.2;
}

.toggle-copy small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.primary-btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #5c50ff, #7f61ff);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.jobs-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jobs-list {
  display: grid;
  gap: 16px;
}

.empty-jobs {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.job-card {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.job-preview {
  height: 220px;
  min-height: 220px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(15, 17, 33, 0.14), rgba(15, 17, 33, 0.08)),
    linear-gradient(135deg, #251f40, #364d6b 70%, #1d2030);
}

.job-video,
.job-placeholder {
  width: 100%;
  height: 100%;
}

.job-video {
  display: block;
  object-fit: cover;
}

.job-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
}

.job-main {
  display: grid;
  gap: 12px;
}

.job-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.job-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip,
.job-status {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(92, 80, 255, 0.1);
  color: var(--brand);
}

.job-status.success {
  background: rgba(51, 195, 107, 0.16);
  color: #18864a;
}

.job-status.failed {
  background: rgba(213, 83, 83, 0.16);
  color: #b13c3c;
}

.job-id {
  font-size: 13px;
  color: var(--muted);
}

.job-prompt {
  line-height: 1.7;
}

.job-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.job-footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.job-error {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(213, 83, 83, 0.08);
  color: #a33a3a;
}

.raw-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

pre {
  min-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .studio-body,
  .job-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 16px;
  }

  h1 {
    font-size: 30px;
  }

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

  .job-preview {
    height: 200px;
    min-height: 200px;
  }

  .reference-wall {
    min-height: auto;
  }
}
