@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --paper: #f6f3ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #e7e1d5;
  --line-strong: #d8d0c1;
  --ink: #1b1a22;
  --ink-soft: #5f5b6b;
  --ink-faint: #9a95a3;
  --tangerine: #ff5c28;
  --tangerine-deep: #e8481a;
  --tangerine-soft: #ffe8de;
  --grape: #5b45e0;
  --grape-soft: #ece8ff;
  --mint: #148a62;
  --mint-soft: #dcf3e9;
  --danger: #d23f37;
  --danger-soft: #fde6e4;
  --amber: #a86a12;
  --amber-soft: #fff0d4;
  --radius-card: 18px;
  --radius-control: 12px;
  --shadow-soft: 0 1px 2px rgba(27, 26, 34, 0.06), 0 6px 20px rgba(27, 26, 34, 0.05);
  --shadow-lift: 0 2px 6px rgba(27, 26, 34, 0.08), 0 18px 40px rgba(27, 26, 34, 0.12);
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-width: 256px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
}
a {
  color: var(--grape);
}
h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}
h1 {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
}
h2 {
  font-size: 21px;
  font-weight: 700;
}
h3 {
  font-size: 16px;
  font-weight: 700;
}
p {
  margin: 0;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--grape) 45%, transparent);
  outline-offset: 2px;
}

/* ---------- Buttons and controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover {
  border-color: var(--ink-faint);
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn-primary {
  background: var(--tangerine);
  border-color: var(--tangerine);
  color: #fff;
}
.btn-primary:hover {
  background: var(--tangerine-deep);
  border-color: var(--tangerine-deep);
}
.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-dark:hover {
  background: #33313d;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgba(27, 26, 34, 0.05);
  border-color: transparent;
}
.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--surface-strong);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.btn-small {
  min-height: 34px;
  padding: 0 13px;
  font-size: 14px;
}
.btn-icon {
  width: 40px;
  padding: 0;
}
.btn-block {
  width: 100%;
}

.field {
  display: grid;
  gap: 6px;
}
.field-label {
  font-weight: 650;
  font-size: 14px;
}
.field-hint {
  color: var(--ink-soft);
  font-size: 13px;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--grape);
  box-shadow: 0 0 0 3px var(--grape-soft);
}
.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235f5b6b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.colour-input {
  width: 44px;
  height: 44px;
  padding: 3px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  cursor: pointer;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover {
  border-color: var(--ink-faint);
}
.chip.is-selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(27, 26, 34, 0.06);
  gap: 2px;
}
.segmented button {
  white-space: nowrap;
  border: none;
  background: transparent;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-soft);
}
.segmented button.is-selected {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(27, 26, 34, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  white-space: nowrap;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: rgba(27, 26, 34, 0.06);
  color: var(--ink-soft);
}
.badge svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.badge-tangerine {
  background: var(--tangerine-soft);
  color: var(--tangerine-deep);
}
.badge-grape {
  background: var(--grape-soft);
  color: var(--grape);
}
.badge-mint {
  background: var(--mint-soft);
  color: var(--mint);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.cost-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.cost-line strong {
  color: var(--ink);
  font-weight: 700;
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
}
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
}
.sidebar-section-label {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.mascot-list {
  display: grid;
  gap: 2px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.mascot-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.mascot-link:hover {
  background: rgba(27, 26, 34, 0.05);
}
.mascot-link.is-current {
  background: var(--tangerine-soft);
}
.mascot-link-thumb {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  object-fit: contain;
  background: var(--paper);
}
.mascot-link-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.spend {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 8px 10px;
  font-size: 13px;
  color: var(--ink-soft);
}
.spend strong {
  font-family: var(--display);
  font-size: 17px;
  color: var(--ink);
}
.sidebar-footer .btn {
  justify-content: flex-start;
}

.main {
  min-width: 0;
  padding: 28px clamp(16px, 3.2vw, 44px) 64px;
}
.mobile-bar,
.menu-scrim {
  display: none;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head p {
  color: var(--ink-soft);
  margin-top: 6px;
  max-width: 62ch;
}

.card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}
.card-pad {
  padding: 22px;
}
.stack {
  display: grid;
  gap: 16px;
}
.stack-tight {
  display: grid;
  gap: 10px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.two-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.muted {
  color: var(--ink-soft);
}
.small {
  font-size: 13px;
}

/* ---------- Tabs ---------- */

.mascot-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.mascot-head-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  flex: none;
}
.mascot-head h1 {
  overflow-wrap: anywhere;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  scrollbar-width: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border: none;
  background: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  font-weight: 650;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.tab svg {
  width: 17px;
  height: 17px;
}
.tab:hover {
  color: var(--ink);
}
.tab.is-current {
  color: var(--ink);
  border-bottom-color: var(--tangerine);
}
.tab-count {
  font-size: 12px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(27, 26, 34, 0.07);
}

/* ---------- Media tiles ---------- */

.checker {
  background-color: #fff;
  background-image: conic-gradient(#efebe3 25%, transparent 0 50%, #efebe3 0 75%, transparent 0);
  background-size: 18px 18px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.tile:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.tile.is-selected {
  border-color: var(--grape);
  box-shadow: 0 0 0 3px var(--grape-soft);
}
.tile-media {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.tile-media img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}
.tile-body {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}
.tile-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(27, 26, 34, 0.25);
  display: grid;
  place-items: center;
  color: #fff;
}
.tile.is-selected .tile-check {
  background: var(--grape);
}
.tile-check svg {
  width: 14px;
  height: 14px;
}
.tile-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  text-align: center;
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(2px);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.tile-status.is-failed {
  color: var(--danger);
}
.tile-add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 220px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-card);
  background: transparent;
  color: var(--ink-soft);
  font-weight: 650;
  cursor: pointer;
}
.tile-add:hover {
  border-color: var(--tangerine);
  color: var(--tangerine-deep);
  background: var(--tangerine-soft);
}
.tile-add svg {
  width: 28px;
  height: 28px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--tangerine);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.progress {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--tangerine);
  transition: width 0.3s;
}

/* ---------- Composer (generation forms) ---------- */

.composer {
  display: grid;
  gap: 16px;
  padding: 20px;
  margin-bottom: 24px;
}
.composer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.pose-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.pose-option {
  flex: none;
  width: 84px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface-strong);
  padding: 4px 4px 6px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.pose-option img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
}
.pose-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pose-option.is-selected {
  border-color: var(--tangerine);
  box-shadow: 0 0 0 3px var(--tangerine-soft);
}
.arrow-between {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.arrow-between > svg {
  margin-top: 40px;
  width: 22px;
  height: 22px;
  color: var(--ink-faint);
}

/* ---------- Empty, loading and error states ---------- */

.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 20px;
}
.empty svg {
  width: 120px;
  height: 120px;
}
.empty p {
  color: var(--ink-soft);
  max-width: 44ch;
}
.state-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 64px 20px;
  text-align: center;
  color: var(--ink-soft);
}
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  background: var(--amber-soft);
  color: #6d4708;
  font-size: 14px;
}
.notice svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.notice-error {
  background: var(--danger-soft);
  color: #8c241e;
}
.notice-info {
  background: var(--grape-soft);
  color: #352a8a;
}

/* ---------- Sign in / setup ---------- */

.centre-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 80% -10%, var(--tangerine-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--grape-soft), transparent 60%), var(--paper);
}
.sign-in-card {
  width: min(420px, 100%);
  display: grid;
  gap: 20px;
  padding: 32px;
}
.sign-in-card .brand {
  padding: 0;
}
.setup-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  margin: 0;
}
code,
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}
code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(27, 26, 34, 0.06);
}
pre.code {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-control);
  background: #1f1d27;
  color: #f2eee6;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.55;
}

/* ---------- Home ---------- */

.mascot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.mascot-card {
  display: grid;
  text-decoration: none;
  color: var(--ink);
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}
.mascot-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.mascot-card-media {
  aspect-ratio: 1.15;
  display: grid;
  place-items: center;
}
.mascot-card-media img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.mascot-card-body {
  padding: 12px 16px 16px;
  display: grid;
  gap: 2px;
}
.mascot-card-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: clamp(22px, 4vw, 40px);
  margin-bottom: 28px;
  border-radius: 28px;
  background: var(--ink);
  color: #fff;
  overflow: hidden;
}
.hero h1 {
  font-size: clamp(30px, 4vw, 46px);
}
.hero p {
  color: #d9d4e8;
  margin: 12px 0 22px;
  max-width: 46ch;
}
.hero-art {
  justify-self: center;
  width: min(280px, 100%);
}
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.step {
  padding: 16px;
}
.step-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tangerine-soft);
  color: var(--tangerine-deep);
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 10px;
}

/* ---------- Wizard ---------- */

.wizard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
.wizard-aside {
  position: sticky;
  top: 20px;
}
.upload-drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-control);
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
}
.upload-drop:hover,
.upload-drop.is-dragging {
  border-color: var(--grape);
  background: var(--grape-soft);
}
.upload-drop svg {
  width: 22px;
  height: 22px;
}
.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(27, 26, 34, 0.7);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.thumb-remove svg {
  width: 12px;
  height: 12px;
}
.thumb-file {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}
.swatch i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.candidates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.candidate {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
  background: none;
}
.candidate img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.candidate.is-selected {
  border-color: var(--tangerine);
  box-shadow: 0 0 0 4px var(--tangerine-soft);
}
.candidate .tile-check {
  top: 12px;
  right: 12px;
}
.candidate.is-selected .tile-check {
  background: var(--tangerine);
}

/* ---------- Drawer / modal / toast ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 26, 34, 0.38);
  z-index: 40;
  animation: fade-in 0.15s ease-out;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100%);
  background: var(--surface);
  z-index: 41;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lift);
  animation: slide-in 0.2s ease-out;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-body {
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.drawer-body > * {
  flex: none;
}
.drawer-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.drawer-preview > img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}
.drawer-preview .player-box {
  position: absolute;
  inset: 6%;
}
.preview-background-switch {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
}
.preview-background-switch button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.preview-background-switch button.is-selected {
  border-color: var(--grape);
}
.download-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.download-option {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  cursor: pointer;
  text-align: left;
}
.download-option:hover {
  border-color: var(--grape);
  background: var(--grape-soft);
}
.download-option strong {
  font-size: 14px;
}
.download-option span {
  font-size: 12px;
  color: var(--ink-soft);
}
.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 14px;
  margin: 0;
}
.detail-list dt {
  color: var(--ink-soft);
}
.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.link-row {
  display: flex;
  gap: 8px;
}
.link-row .input {
  font-size: 13px;
  min-height: 38px;
}
.modal {
  position: fixed;
  z-index: 41;
  inset: 0;
  margin: auto;
  width: min(560px, calc(100% - 24px));
  height: fit-content;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-lift);
  animation: pop-in 0.18s ease-out;
}
.modal-body {
  display: grid;
  gap: 16px;
  padding: 22px;
}
.toast-stack {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(440px, calc(100% - 24px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-lift);
  font-size: 14px;
  animation: pop-in 0.18s ease-out;
}
.toast.is-error {
  background: #8c241e;
}
.toast .progress {
  flex: none;
  background: rgba(255, 255, 255, 0.2);
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes slide-in {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}

/* ---------- Talk ---------- */

.script-box {
  font-size: 16px;
  min-height: 120px;
}
.talk-list {
  display: grid;
  gap: 12px;
}
.talk-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
}
.talk-thumb {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.talk-thumb img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}
.talk-script {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.direction {
  display: inline-block;
  padding: 0 6px;
  margin: 0 2px;
  border-radius: 6px;
  background: var(--grape-soft);
  color: var(--grape);
  font-weight: 650;
  font-size: 0.92em;
}
.transcript {
  line-height: 1.9;
}
.transcript .word.is-spoken {
  background: var(--tangerine-soft);
  border-radius: 4px;
}

/* ---------- State machine ---------- */

.machine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.machine-canvas {
  position: relative;
  min-height: 520px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background-color: var(--surface-strong);
  background-image: radial-gradient(circle, #e3ddd0 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  overflow: hidden;
  touch-action: none;
}
.machine-canvas svg.machine-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.machine-node {
  position: absolute;
  width: 116px;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 8px 9px;
  border-radius: 18px;
  border: 2px solid var(--line-strong);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  cursor: grab;
  user-select: none;
  font-weight: 700;
  font-size: 13px;
}
.machine-node img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  pointer-events: none;
}
.machine-node.is-initial {
  border-color: var(--ink);
}
.machine-node.is-selected {
  border-color: var(--grape);
  box-shadow: 0 0 0 4px var(--grape-soft);
}
.machine-node.is-live {
  border-color: var(--tangerine);
}
.machine-node-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.machine-node-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edge-path {
  fill: none;
  stroke: #b9b0a0;
  stroke-width: 2.5;
  cursor: pointer;
}
.edge-path.has-conditions {
  stroke: var(--grape);
}
.edge-path.is-selected {
  stroke: var(--tangerine);
  stroke-width: 4;
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
}
.edge-label {
  font: 600 11.5px var(--body);
  fill: var(--ink-soft);
  pointer-events: none;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5px;
  stroke-linejoin: round;
}
.machine-side {
  display: grid;
  gap: 16px;
}
.machine-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-card);
  overflow: hidden;
}
.machine-preview .player-box {
  position: absolute;
  inset: 4%;
}
.machine-preview-pose {
  position: absolute;
  top: 10px;
  left: 10px;
}
.condition-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 74px minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
}
.condition-row .input,
.condition-row .select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 14px;
}
.condition-row .select {
  padding-right: 26px;
  background-position: right 9px center;
}
.input-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-weight: 600;
  font-size: 14px;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s;
  pointer-events: none;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch input:checked + span {
  background: var(--grape);
}
.switch input:checked + span::after {
  transform: translateX(18px);
}

/* ---------- Identity ---------- */

.style-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

/* ---------- Small screens ---------- */

@media (max-width: 1080px) {
  .wizard,
  .machine {
    grid-template-columns: minmax(0, 1fr);
  }
  .wizard-aside {
    position: static;
  }
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    z-index: 45;
    left: 0;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease-out;
    box-shadow: var(--shadow-lift);
  }
  .app.is-menu-open .sidebar {
    transform: none;
  }
  .app.is-menu-open .menu-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    border: none;
    background: rgba(27, 26, 34, 0.38);
    animation: fade-in 0.15s ease-out;
  }
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .main {
    padding-top: 18px;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-art {
    width: 180px;
    order: -1;
  }
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
    gap: 10px;
  }
  .drawer {
    top: auto;
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    animation-name: slide-up;
  }
  .talk-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .talk-thumb {
    width: 72px;
    height: 72px;
  }
  .talk-row > .row {
    grid-column: 1 / -1;
  }
  .arrow-between {
    grid-template-columns: minmax(0, 1fr);
  }
  .arrow-between > svg {
    display: none;
  }
  .composer-foot .btn {
    flex: 1;
  }
  .mascot-head-avatar {
    width: 52px;
    height: 52px;
  }
}
@keyframes slide-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
