/* Shared components. Every value comes from tokens.css. */

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--motion-fast),
    border-color var(--motion-fast);
}

.button svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.is-primary {
  background: var(--action);
  border-color: var(--action);
  color: var(--on-action);
}

.button.is-primary:hover:not(:disabled) {
  background: var(--action-hover);
  border-color: var(--action-hover);
}

.button.is-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface-raised);
}

.button.is-danger:hover:not(:disabled) {
  filter: brightness(0.92);
}

.trash-rule {
  margin-bottom: var(--space-4);
}

.button.is-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  padding: 0 var(--space-2);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* Fields */
.field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.field-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.input,
.select {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
}

.input:disabled,
.select:disabled {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.check input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  flex: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  /* A field with a hint must not stretch the input of its neighbour. */
  align-items: start;
  gap: var(--space-4);
}

.form {
  display: grid;
  gap: var(--space-4);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.1rem var(--space-2);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 650;
  white-space: nowrap;
  vertical-align: middle;
}

.badge.is-positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.badge.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Cards and rows */
.card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card-text {
  color: var(--text-muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.row:first-child {
  border-top: 0;
  padding-top: 0;
}

.row-copy {
  display: grid;
  gap: var(--space-1);
  flex: 1 1 16rem;
  min-width: 0;
}

.row-copy p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Messages */
.note {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: var(--text-sm);
  /* Errors can quote a long file name or address; it wraps rather than widening the page. */
  overflow-wrap: anywhere;
}

.notice.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.notice.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.is-positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  display: grid;
  gap: var(--space-2);
  max-width: min(26rem, calc(100vw - 2 * var(--space-4)));
  z-index: 10;
}

.toast {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
  font-size: var(--text-sm);
}

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

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
}

/* Checklists: a label and its state, one per line */
.checklist {
  display: grid;
  gap: var(--space-2);
}

.checklist > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.checklist dt {
  color: var(--text);
}

.checklist dd {
  color: var(--text-muted);
  text-align: right;
}

.checklist dd.is-ready {
  color: var(--positive);
  font-weight: 600;
}

/* Tabs beside a panel; they stack above it on narrow screens */
.tabbed {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.tablist {
  display: grid;
  gap: var(--space-1);
  position: sticky;
  top: var(--space-5);
}

.tab {
  display: flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.tab[aria-selected='true'] {
  background: var(--accent-soft);
  color: var(--text);
}

.tabpanel {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.tabpanel-head {
  display: grid;
  gap: var(--space-1);
}

.tabpanel-head p {
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .tabbed {
    grid-template-columns: minmax(0, 1fr);
  }

  .tablist {
    position: static;
    display: flex;
    flex-wrap: wrap;
  }

  .tab {
    white-space: nowrap;
  }
}

/* Theme choice */
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-3);
  border: 0;
  padding: 0;
}

.choices legend {
  padding: 0;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.choice {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.choice small {
  display: block;
  color: var(--text-muted);
}

.swatch {
  display: flex;
  gap: 3px;
  height: 2.25rem;
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.swatch i {
  flex: 1;
  border-radius: 3px;
}

.swatch.is-light {
  background: var(--swatch-light-page);
}

.swatch.is-light i {
  background: var(--swatch-light-line);
}

.swatch.is-light i:first-child {
  background: var(--swatch-light-accent);
}

.swatch.is-dark {
  background: var(--swatch-dark-page);
}

.swatch.is-dark i {
  background: var(--swatch-dark-line);
}

.swatch.is-dark i:first-child {
  background: var(--swatch-dark-accent);
}

.swatch.is-system {
  background: linear-gradient(90deg, var(--swatch-light-page) 50%, var(--swatch-dark-page) 50%);
}

.swatch.is-system i {
  background: var(--swatch-system-line);
}

.swatch.is-system i:first-child {
  background: var(--swatch-system-accent);
}

/* A request awaiting a confirmed cost, and similar small bordered groups */
.subform {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

details > summary {
  cursor: pointer;
  font-weight: 600;
}

details[open] > summary {
  margin-bottom: var(--space-3);
}

/* Tables: each row becomes a small card on narrow screens */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table .is-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-person {
  display: grid;
  gap: 2px;
}

.table-person small {
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .table thead {
    display: none;
  }

  .table tr {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0;
    border: 0;
    text-align: right;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
  }

  .table td:first-child::before {
    content: none;
  }

  .table td:first-child {
    text-align: left;
  }
}

/* A value against its limit */
.meter {
  display: grid;
  gap: var(--space-1);
  min-width: 7rem;
}

.meter-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  overflow: hidden;
}

.meter-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.meter.is-high .meter-bar i {
  background: var(--warning);
}

.meter.is-full .meter-bar i {
  background: var(--danger);
}

.meter-text {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Headline figures */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: var(--space-3);
}

.stat {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.stat dt {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.stat dd {
  font-size: var(--text-xl);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* A long row of figures stays on one line with slightly smaller numbers. */
.stats:has(> :nth-child(6)) .stat dd {
  font-size: var(--text-lg);
}

/* A page for people who are not signed in yet */
.entry {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-5) var(--space-4);
  background:
    radial-gradient(70rem 24rem at 50% -8rem, var(--surface-hover), transparent 70%),
    var(--surface-page);
}

.entry-card {
  width: min(26rem, 100%);
  display: grid;
  gap: var(--space-5);
}

.entry-card .brand {
  justify-self: center;
  font-size: var(--text-xl);
}

.entry-card.is-wide {
  width: min(44rem, 100%);
}

.entry-tagline {
  margin-top: calc(-1 * var(--space-3));
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.entry-links {
  text-align: center;
}

/* Terms and privacy: plain reading text */
.legal {
  display: grid;
  gap: var(--space-3);
  line-height: var(--leading-body);
}

.legal h2 {
  margin-top: var(--space-3);
  font-size: var(--text-md);
}

.legal ul,
.help-steps,
.help-list {
  display: grid;
  gap: var(--space-2);
  padding-left: var(--space-5);
  line-height: var(--leading-body);
}

/* The admin's first-run checklist */
.setup-list {
  display: grid;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.setup-list li {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
}

.setup-mark {
  width: 1.25em;
  color: var(--text-muted);
}

.setup-list li.is-done {
  color: var(--text-muted);
}

.setup-list li.is-done .setup-mark {
  color: var(--positive);
}

/* A value to copy, such as a link or a token */
.copyable {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.copyable code {
  flex: 1;
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  min-width: 0;
}

.frame-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2) 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 700;
}

.frame-user-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  line-height: var(--leading-tight);
}

.frame-user-text > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frame-user-text > span {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.frame-user .button {
  flex: none;
  min-height: 2rem;
  padding: 0 var(--space-2);
}

.frame-user .button span {
  display: none;
}

.card-title {
  font-size: var(--text-xl);
}

/* Tabs in a row above their panel */
.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* Studio home: a headline, the prompt box, the ways to start, then the projects. */
.home {
  gap: var(--space-6);
}

.studio-hero {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding-top: var(--space-5);
  text-align: center;
}

.studio-hero h1 {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  font-weight: 650;
}

.studio-hero p {
  max-width: 36rem;
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.micro-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 550;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.micro-label .badge {
  letter-spacing: 0;
  text-transform: none;
}

/* The prompt box: a large field with its choices as chips along the bottom. */
.composer {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised), var(--glow-action);
  transition: border-color var(--motion-fast);
}

.composer:focus-within {
  border-color: var(--text-muted);
}

.composer-input {
  width: 100%;
  min-height: 5.5rem;
  padding: var(--space-2) var(--space-3);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  resize: vertical;
}

.composer-input:focus {
  outline: none;
}

.composer-input::placeholder {
  color: var(--text-muted);
}

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-select select {
  appearance: none;
  min-height: 2.25rem;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.chip-select select:hover {
  border-color: var(--border-strong);
}

.composer-go {
  min-height: 2.75rem;
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
}

.home-section {
  display: grid;
  gap: var(--space-3);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 650;
}

/* Ways to start: picture cards with their words over the picture. */
.doors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.door {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 4 / 5;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-sunken);
  color: var(--text-on-media);
  text-decoration: none;
  isolation: isolate;
}

.door img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  transition: transform 400ms ease;
}

.door::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--media-fade);
}

.door:hover img {
  transform: scale(1.04);
}

.door:hover {
  border-color: var(--border-strong);
}

.door-copy {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.door-kicker {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-on-media-muted);
}

.door-kicker svg {
  width: 0.9rem;
  height: 0.9rem;
}

.door-kicker .badge {
  letter-spacing: 0;
  text-transform: none;
}

.door strong {
  font-size: var(--text-lg);
}

.door-copy > span:last-child {
  color: var(--text-on-media-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .doors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .door {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 760px) {
  .home {
    gap: var(--space-5);
  }

  .studio-hero {
    padding-top: 0;
  }

  .doors {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    padding-bottom: var(--space-2);
  }

  .door {
    flex: 0 0 72vw;
    aspect-ratio: 4 / 5;
    scroll-snap-align: start;
  }

  .composer-go {
    flex: 1 1 100%;
  }
}

/* A list of projects */
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.project-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.project-list li:first-child {
  border-top: 0;
}

.project-list a {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.project-list a:hover .project-title {
  color: var(--accent-strong);
  text-decoration: underline;
}

.project-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.project-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Create */
.textarea {
  min-height: 5rem;
  padding: var(--space-3);
  resize: vertical;
  line-height: var(--leading-body);
}

.field-set {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-set legend {
  padding: 0;
  margin-bottom: var(--space-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  cursor: pointer;
}

.chip input[type='radio'] {
  position: absolute;
  opacity: 0;
}

.chip span {
  display: grid;
}

.chip small {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chip.is-input .input {
  width: 4.5rem;
  min-height: 1.75rem;
  padding: 0 var(--space-2);
}

.voice-card:has(input:focus-visible),
.style-card:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: var(--space-3);
}

.style-card {
  position: relative;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  cursor: pointer;
}

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

.style-picture {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--accent);
}

.style-picture svg {
  width: 2rem;
  height: 2rem;
}

.style-card:has(input:checked) .style-picture {
  border-color: var(--accent);
}

.style-card label {
  display: grid;
  gap: var(--space-1);
  cursor: pointer;
}

.style-play {
  position: absolute;
  left: var(--space-2);
  bottom: calc(var(--space-6) + var(--space-2));
  z-index: 1;
  min-height: 2rem;
  padding: 0 var(--space-3);
}

.example-stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--scrim);
}

.example-sheet {
  display: grid;
  gap: var(--space-3);
  justify-items: center;
}

.example-frame {
  width: min(100%, 22rem);
  aspect-ratio: 9 / 16;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.style-search {
  max-width: 18rem;
}

.dropzone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.dropzone svg {
  width: 1.5rem;
  height: 1.5rem;
}

.dropzone small {
  flex-basis: 100%;
}

.media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.media-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.media-list img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex: none;
}

.media-name {
  flex: 0 1 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.media-list .input {
  flex: 1;
}

/* A clip: its name on a line of its own, then its sound, order, note and actions. */
.media-list li.clip-row {
  flex-wrap: wrap;
}

.clip-row .media-name {
  flex: 1 1 100%;
}

.clip-row .select {
  flex: 0 1 13rem;
  width: auto;
}

.clip-row .input {
  flex: 1 1 10rem;
}

.analysis-sheet {
  display: block;
  max-width: 100%;
  /* A clip with one shot is a single frame; it should not fill the whole panel. */
  max-height: 18rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.transcript {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.transcript span {
  display: inline-block;
  width: 3.5rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.transcript li:has(input) {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2);
}

.transcript-box {
  display: grid;
  gap: var(--space-2);
}

.transcript-box > summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.mode-switch a,
.mode-switch button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.mode-switch a[aria-current='page'],
.mode-switch button[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--text);
}

.mode-switch svg {
  width: 1rem;
  height: 1rem;
}

details.more > summary {
  font-size: var(--text-lg);
}

/* The approval is the last card, outlined so it reads as the place to decide. */
.approve {
  border-color: var(--border-strong);
}

/* Production */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.steps li {
  display: grid;
  gap: var(--space-1);
  color: var(--text-muted);
}

.step-dot {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
}

.steps .is-done .step-dot {
  background: var(--accent);
}

.steps .is-now {
  color: var(--text);
  font-weight: 650;
}

.steps .is-now .step-dot {
  background: linear-gradient(90deg, var(--accent) 50%, var(--border) 50%);
}

.production-now {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
}

.result {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.result-video {
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-md);
  background: var(--video-backdrop);
}

.result-side {
  display: grid;
  gap: var(--space-4);
}

.kit-hook {
  font-size: var(--text-lg);
}

.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--space-3);
}

.kit-platform {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.kit-field {
  display: grid;
  gap: var(--space-1);
}

.kit-field p {
  white-space: pre-wrap;
  font-size: var(--text-sm);
}

.kit-field .button {
  justify-self: start;
}

.kit-tags {
  color: var(--accent-strong);
  font-size: var(--text-sm);
}

.back {
  font-size: var(--text-sm);
  text-decoration: none;
}

.versions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.versions li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-height: var(--control-height);
}

.versions li > span {
  flex: 1 1 12rem;
}

.version-view {
  display: grid;
  gap: var(--space-3);
  max-width: 22rem;
}

a.button {
  text-decoration: none;
}

@media (max-width: 760px) {
  .result {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .media-list li {
    flex-wrap: wrap;
  }
}

/* The project library: a heading with its lists as a segmented control, then a grid of covers. */
.library {
  display: grid;
  gap: var(--space-4);
}

.library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.library-new {
  margin-right: auto;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
}

.segmented .button {
  min-height: 2rem;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.segmented [aria-pressed='true'] {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: var(--space-5) var(--space-4);
}

.project-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-width: 0;
}

.project-poster {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 80% at 20% 0%, var(--accent-soft), transparent 60%), var(--surface-sunken);
}

.project-poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  transition: transform 400ms ease;
}

a.project-poster:hover img {
  transform: scale(1.04);
}

a.project-poster:hover {
  border-color: var(--border-strong);
}

.project-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
}

.project-placeholder svg {
  width: 2rem;
  height: 2rem;
}

.project-poster .badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  background: var(--media-chip);
  backdrop-filter: blur(6px);
}

.project-poster .badge:not(.is-positive, .is-warning, .is-danger) {
  color: var(--text-on-media-muted);
}

/* Labels on a picture keep the dark theme's colours, which read on the dark chip in both. */
.project-poster .badge.is-positive {
  color: var(--on-media-positive);
}

.project-poster .badge.is-warning {
  color: var(--on-media-warning);
}

.project-poster .badge.is-danger {
  color: var(--on-media-danger);
}

.project-poster,
.project-poster:hover {
  text-decoration: none;
}

.project-card-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
}

.project-card-text {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.project-card-text a {
  color: var(--text);
  text-decoration: none;
}

.project-card-text a:hover {
  text-decoration: underline;
}

.icon-button {
  flex: none;
  width: 2rem;
  min-height: 2rem;
  padding: 0;
  border-radius: var(--radius-full);
}

.project-card .library-actions {
  gap: var(--space-1);
}

.project-card .library-actions .button {
  min-height: 2rem;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

@media (max-width: 760px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) var(--space-3);
  }
}
.project-list .library-item {
  display: grid;
  justify-content: stretch;
  gap: var(--space-2);
}
.library-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.library-text {
  flex: 1;
  min-width: 0;
  display: grid;
  overflow-wrap: anywhere;
}
.project-list .library-actions a {
  display: inline-flex;
}
.library-rename {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.library-pagination {
  margin-top: var(--space-3);
  align-items: center;
}
@media (max-width: 36rem) {
  .library-summary {
    flex-wrap: wrap;
  }
  .library-text {
    flex-basis: 100%;
  }
}

/* Create: collections of looks, voice samples, templates, tightening a clip */
.chip.is-button {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.chip.is-button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.style-tools {
  display: grid;
  gap: var(--space-2);
}

.voice-sample {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.voice-sample audio {
  flex: 1 1 16rem;
  max-width: 100%;
  height: var(--control-height);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-3);
}

.template-card {
  display: grid;
  gap: var(--space-2);
  grid-template-rows: 1fr auto;
}
.template-card .voice-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: stretch; gap: 0; overflow: hidden; padding: 0; }
.template-still { width: 100%; height: auto; display: block; aspect-ratio: 16/9; }
.template-caption { display: grid; align-content: start; gap: var(--space-1); padding: var(--space-3); }
.template-caption small { color: var(--muted); }
.template-caption small:last-child { margin-top: var(--space-1); }

.tighten {
  display: grid;
  gap: var(--space-2);
  flex-basis: 100%;
  justify-items: start;
}

.tighten-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tighten-options .select {
  width: auto;
  max-width: 100%;
  flex: 1 1 14rem;
}

.logo-choice,
.draft-logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.logo-choice img,
.draft-logo img {
  width: 4.5rem;
  height: 3rem;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  flex: none;
}

.draft-logo img {
  width: 3rem;
  height: 2rem;
}

.summary-note {
  margin-left: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
}

/* Until the approval card is on screen, a small floating bar says the cost and leads to it. */
.jump-bar {
  display: flex;
  justify-content: center;
  position: sticky;
  bottom: var(--space-4);
  z-index: 2;
  pointer-events: none;
}

.dock {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
}

.dock-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.dock .button {
  border-radius: var(--radius-full);
}

@media (max-width: 760px) {
  .jump-bar {
    bottom: calc(4.5rem + env(safe-area-inset-bottom));
  }

  .dock-text {
    display: none;
  }

  .dock {
    padding: var(--space-1);
  }
}

/* Leaving unsaved work */
.leave-dialog {
  width: min(26rem, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.leave-dialog[open] {
  display: grid;
  gap: var(--space-3);
}

.leave-dialog::backdrop {
  background: var(--scrim);
}

.leave-dialog h2 {
  font-size: var(--text-lg);
}

/* A video's notebook, findings and technical details */
.note-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.note-text,
.technical pre {
  margin: 0;
  padding: var(--space-4);
  max-height: 28rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.technical {
  font-size: var(--text-sm);
}

.findings {
  margin: 0;
  padding-left: var(--space-5);
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.result-sheet {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.result-empty {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-align: center;
}

/* On a phone the account sits in the slim header: initials and sign-out only. */
@media (max-width: 760px) {
  .frame-user {
    order: 3;
    padding: 0;
    border-top: 0;
  }

  .frame-user-text {
    display: none;
  }
}

/* On a tablet rail the account is the initials above the sign-out icon. */
@media (max-width: 1100px) and (min-width: 761px) {
  .frame-user {
    flex-direction: column;
    padding-inline: 0;
  }

  .frame-user-text {
    display: none;
  }
}

/* The phone's Create tab is the raised action in the middle of the bar. */
@media (max-width: 760px) {
  .frame-start {
    display: none;
  }

  .frame-tabbar a.is-create svg {
    box-sizing: content-box;
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-full);
    background: var(--action);
    color: var(--on-action);
  }

  .frame-tabbar a.is-create[aria-current='page'] svg {
    color: var(--on-action);
  }
}

/* Create, step by step: numbered cards, shapes you can see, voices as tiles. */
.create .card.step {
  gap: var(--space-5);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.step-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 1px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: var(--text-sm);
  font-weight: 700;
}

.step-title {
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
}

.step-hint {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.create .field-set legend.field-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Choices: softer pills; the chosen one is filled. */
.create .chip {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast);
}

.create .chip:hover {
  border-color: var(--border-strong);
}

.create .chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Length and language: one joined control. */
.chips.is-segmented {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  justify-self: start;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.create .chips.is-segmented .chip {
  min-height: 2.25rem;
  border-color: transparent;
  border-radius: var(--radius-md);
  background: transparent;
}

.create .chips.is-segmented .chip:has(input:checked) {
  border-color: transparent;
  background: var(--selected);
  color: var(--on-selected);
  box-shadow: none;
}

.create .chips.is-segmented .chip:has(input:checked) small {
  color: var(--on-selected);
}

/* The step's title already names these. */
.create .voice-picker > legend,
.create .style-picker > legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Every card on the page shares the step cards' shape. */
.create > .card,
.create > details.card,
.create .card.approve {
  border-radius: var(--radius-xl);
}

.create .chips.is-segmented .chip.is-input .input {
  background: var(--surface-raised);
}

.basics {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5) var(--space-6);
}

.basics-shape {
  grid-column: 1 / -1;
}

.chips.is-shapes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chips.is-shapes .chip {
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3) var(--space-3);
  text-align: center;
}

.chips.is-shapes .chip span {
  justify-items: center;
}

/* A small frame drawn at each shape's own proportions. */
.shape-glyph {
  display: block;
  height: 2.25rem;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
}

.shape-glyph[data-shape='9x16'] {
  aspect-ratio: 9 / 16;
}

.shape-glyph[data-shape='4x5'] {
  aspect-ratio: 4 / 5;
}

.shape-glyph[data-shape='1x1'] {
  aspect-ratio: 1;
}

.shape-glyph[data-shape='16x9'] {
  height: 1.5rem;
  margin-block: 0.375rem;
  aspect-ratio: 16 / 9;
}

.chip:has(input:checked) .shape-glyph {
  border-color: var(--text);
  background: var(--surface-hover);
}

/* Voices */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: var(--space-3);
}

.voice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  min-height: 4.5rem;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast);
}

.voice-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

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

.voice-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.voice-card:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.voice-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.voice-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.voice-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-text small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.voice-avatar {
  display: grid;
  grid-auto-flow: column;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  background: var(--tone-2);
  color: var(--text-on-media);
  font-size: var(--text-lg);
  font-weight: 700;
}

.voice-avatar svg {
  width: 1rem;
  height: 1rem;
  margin-inline: -2px;
}

.voice-avatar[data-tone='1'] {
  background: var(--tone-1);
}

.voice-avatar[data-tone='3'] {
  background: var(--tone-3);
}

.voice-avatar[data-tone='4'] {
  background: var(--tone-4);
}

.voice-avatar[data-tone='5'] {
  background: var(--tone-5);
}

.voice-avatar[data-tone='6'] {
  background: var(--tone-6);
}

.voice-avatar.is-text {
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-size: var(--text-md);
}

.voice-tag {
  flex: none;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.voice-tag.is-free {
  background: var(--positive-soft);
  color: var(--positive);
}

.voice-tag.is-paid {
  background: var(--warning-soft);
  color: var(--warning);
}

/* A tick in the corner of the chosen voice or look. */
.voice-check,
.style-card::after {
  position: absolute;
  top: calc(var(--space-2) * -1);
  right: calc(var(--space-2) * -1);
  display: none;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: var(--radius-full);
  background: var(--selected) var(--tick) center / 0.85rem no-repeat;
  box-shadow: 0 0 0 3px var(--surface-raised);
}

.voice-card:has(input:checked) .voice-check {
  display: block;
}

/* The chosen voice, with its samples beside it. */
.voice-now {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-top: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.voice-now > .voice-avatar {
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
}

.voice-now-body {
  display: grid;
  flex: 1;
  gap: var(--space-3);
  min-width: 0;
}

.voice-now-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
}

.voice-now-name span {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.voice-samples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-5);
}

.voice-samples > .voice-sample {
  flex: 1 1 16rem;
  align-content: start;
  align-items: flex-start;
  flex-direction: column;
}

.voice-now .voice-sample .button {
  border-radius: var(--radius-full);
}

.voice-now .voice-sample .button::before {
  content: '';
  width: 0;
  height: 0;
  margin-right: var(--space-1);
  border-block: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.voice-now .voice-sample .button[aria-busy='true']::before {
  display: none;
}

/* Looks: filters as pills, search beside them, a tick on the chosen look. */
.create .style-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.create .chip.is-button {
  min-height: 2rem;
  padding: 0 var(--space-3);
  border-color: transparent;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.create .chip.is-button:hover {
  color: var(--text);
}

.create .chip.is-button[aria-pressed='true'] {
  border-color: transparent;
  background: var(--selected);
  color: var(--on-selected);
  box-shadow: none;
}

.create .style-search {
  flex: 0 1 16rem;
  border-radius: var(--radius-full);
}

.create .style-grid {
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: var(--space-4) var(--space-3);
}

.create .style-picture {
  border-radius: var(--radius-lg);
  transition: border-color var(--motion-fast);
}

.create .style-card:hover .style-picture {
  border-color: var(--border-strong);
}

.create .style-card:has(input:checked)::after {
  display: block;
  z-index: 1;
}

.create .style-card:has(input:checked) .style-picture {
  border-color: var(--selected);
  box-shadow: 0 0 0 2px var(--selected);
}

.create .style-card.is-auto .style-picture {
  border: 1px dashed var(--border-strong);
  background: var(--accent-soft);
}

.create .style-play {
  border-radius: var(--radius-full);
  background: var(--media-chip);
  color: var(--text-on-media);
  border-color: transparent;
}

@media (max-width: 760px) {
  .create .card.step {
    padding: var(--space-4);
  }

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

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

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

  .voice-now {
    padding: var(--space-3);
  }

  .voice-now > .voice-avatar {
    display: none;
  }

  .create .style-grid {
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  }

  .create .style-search {
    flex-basis: 100%;
  }
}

/* Account: a profile heading, and figures that keep their limit beside them. */
.profile-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.profile-head p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.avatar.is-large {
  width: 3.5rem;
  height: 3.5rem;
  background: var(--tone-2);
  color: var(--text-on-media);
  font-size: var(--text-lg);
}

.stat .meter-text {
  white-space: normal;
}

.stat .meter-limit {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.stat .meter {
  gap: var(--space-2);
  min-width: 0;
}

/* A project with no picture yet: a soft colour of its own, the icon and a word. */
.project-placeholder {
  position: relative;
  gap: var(--space-2);
  align-content: center;
  background: var(--tone-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.project-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-sunken);
  opacity: 0.82;
}

.project-placeholder > * {
  position: relative;
}

.project-placeholder[data-tone='1'] {
  background: var(--tone-1);
}

.project-placeholder[data-tone='3'] {
  background: var(--tone-3);
}

.project-placeholder[data-tone='4'] {
  background: var(--tone-4);
}

.project-placeholder[data-tone='5'] {
  background: var(--tone-5);
}

.project-placeholder[data-tone='6'] {
  background: var(--tone-6);
}

/* Create's optional steps: a numbered heading that folds, with what is chosen beside it. */
.create details.fold {
  gap: 0;
}

.create details.fold > summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  cursor: pointer;
}

.create details.fold > summary::-webkit-details-marker {
  display: none;
}

.fold-title {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.fold-title .summary-note {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fold-chevron {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: var(--space-1);
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--motion-fast);
}

.create details.fold[open] > summary .fold-chevron {
  transform: rotate(-135deg);
}

.create details.fold[open] > .fold-hint {
  margin: var(--space-2) 0 var(--space-5) calc(1.75rem + var(--space-3));
}

.create details.fold > .form {
  gap: var(--space-5);
}

/* Picture tiles: one choice from a few. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-3);
}

.tile {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast);
}

.tile:hover {
  border-color: var(--border-strong);
}

.tile input {
  position: absolute;
  opacity: 0;
}

.tile:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.tile:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.tile:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-muted);
}

.tile-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.tile:has(input:checked) .tile-icon {
  background: var(--selected);
  color: var(--on-selected);
}

.tile-text {
  display: grid;
  gap: 2px;
}

.tile-text small {
  color: var(--text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* An on/off switch with its explanation. */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.switch-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.switch-text label {
  font-weight: 600;
  cursor: pointer;
}

.switch-text small {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.switch {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  appearance: none;
  cursor: pointer;
  transition: background var(--motion-fast);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.5rem - 6px);
  height: calc(1.5rem - 6px);
  border-radius: var(--radius-full);
  background: var(--text-muted);
  transition:
    transform var(--motion-fast),
    background var(--motion-fast);
}

.switch:checked {
  border-color: var(--selected);
  background: var(--selected);
}

.switch:checked::after {
  background: var(--on-selected);
  transform: translateX(1.25rem);
}

.switch:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Quick picks under a text field. */
.quick-pick {
  display: grid;
  gap: var(--space-2);
}

.pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.pick {
  min-height: 1.75rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.pick:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.pick[aria-pressed='true'] {
  border-color: var(--selected);
  background: var(--selected);
  color: var(--on-selected);
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.word-meter {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.word-meter.is-over {
  color: var(--warning);
  font-weight: 600;
}

.help-note > summary {
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.help-note p {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Audio styles as cards. */
.style-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-3);
}

.preset-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.preset-card p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.preset-card.is-chosen {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.preset-card .button {
  justify-self: start;
  border-radius: var(--radius-full);
}

.preset-mood {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.mood-chip {
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 760px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create details.fold[open] > .fold-hint {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  /* Audio styles scroll sideways on a phone instead of a long column. */
  .style-presets {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    padding-bottom: var(--space-2);
    scroll-snap-type: x mandatory;
  }

  .preset-card {
    scroll-snap-align: start;
  }
}

/* Branding: kits with their logos, a small editor and a 9:16 preview. */
.branding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-5);
}

.branding-choices {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.tile-logo {
  display: block;
  max-width: 2rem;
  max-height: 1.5rem;
  object-fit: contain;
}

.tile-icon:has(.tile-logo) {
  background: var(--video-backdrop);
}

.tile:has(input:checked) .tile-icon:has(.tile-logo) {
  background: var(--video-backdrop);
}

.kit-editor {
  display: grid;
  gap: var(--space-4);
}

.colour-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.colour-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.colour-field input {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
}

.brand-preview {
  display: flex;
  gap: var(--space-3);
}

.brand-frame {
  position: relative;
  display: grid;
  width: 6.5rem;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--surface-hover), var(--video-backdrop));
}

.brand-frame-logo {
  position: absolute;
  top: 8%;
  left: 8%;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 84%;
  color: var(--text-on-media);
  font-size: 0.45rem;
  font-weight: 600;
}

.brand-frame-logo img {
  width: 1rem;
  height: 0.8rem;
  object-fit: contain;
}

.brand-frame img.is-wide {
  width: 2.4rem;
}

.brand-frame-lines {
  position: absolute;
  inset: auto 10% 18% 10%;
  display: grid;
  gap: 4px;
}

.brand-frame-lines i {
  display: block;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--text-on-media-muted);
  opacity: 0.35;
}

.brand-frame-lines i:last-child {
  width: 60%;
}

.brand-frame.is-card {
  place-content: center;
  justify-items: center;
  gap: 4px;
  padding: var(--space-2);
  color: var(--text-on-media-muted);
  font-size: 0.45rem;
  text-align: center;
}

.brand-frame.is-card img {
  width: 1.8rem;
  height: 1.5rem;
  object-fit: contain;
}

.brand-frame.is-card img.is-wide {
  width: 3.6rem;
}

.brand-frame.is-card strong {
  font-size: 0.6rem;
}

@media (max-width: 760px) {
  .branding-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.voice-option {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--space-2);
  min-width: 0;
}
.voice-option .button { justify-self: start; }
.voice-sample { grid-column: 1 / -1; display: grid; gap: var(--space-2); }
.voice-sample audio { width: min(100%, 30rem); }
.opening-comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--space-3); }
.opening-comparison video { display: block; width: 100%; max-height: 18rem; object-fit: contain; margin-block: var(--space-2); }
