/* MagicMe approved high-fidelity visual direction.
   Loaded last by every high-fidelity prototype to prevent visual drift. */

:root {
  color-scheme: dark;
  --canvas: var(--mm-color-canvas);
  --surface: var(--mm-color-surface);
  --surface-raised: var(--mm-color-surface-raised);
  --surface-soft: var(--mm-color-surface-soft);
  --text: var(--mm-color-text);
  --muted: var(--mm-color-text-muted);
  --disabled: var(--mm-color-disabled);
  --border: var(--mm-color-border);
  --primary: var(--mm-color-brand);
  --primary-strong: var(--mm-color-action);
  --primary-hover: var(--mm-color-action-hover);
  --positive: var(--mm-color-success);
  --info: var(--mm-color-info);
  --warning: var(--mm-color-warning);
  --danger: var(--mm-color-danger);
  --focus: var(--mm-color-focus);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
}

html,
body {
  color: var(--text);
  background-color: var(--canvas);
  font-family: var(--mm-font-family);
}

.screen-heading,
.screen-body > h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -.035em;
}

.eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--primary-strong);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.supporting,
.lead {
  margin: var(--space-2) 0 var(--space-4);
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.55;
}

.section-title,
.section-heading h2 {
  margin: var(--space-4) 0 var(--space-2);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
}

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

.card,
.creation-card,
.profile-summary,
.provider-card,
.site-row,
.choice,
.metric,
.notice {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.card,
.creation-card,
.profile-summary,
.provider-card {
  padding: 16px;
  border-radius: var(--radius-md);
}

.card h3,
.card p { margin: 0; }
.card h3 { font-size: .96rem; }
.card p { margin-top: 5px; color: var(--muted); font-size: .8rem; line-height: 1.45; }

.card.selected,
.creation-card.selected {
  background: rgb(167 139 250 / 12%);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.site-row {
  min-height: 62px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.site-row small,
.creation-card span,
.profile-summary span,
.provider-card p { color: var(--muted); }

.field { display: grid; gap: var(--space-1); min-width: 0; }
.field > span,
.field > label { color: var(--text); font-size: .78rem; font-weight: 650; }

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.field textarea { min-height: 126px; resize: vertical; }

.field select {
  appearance: none;
  padding-right: 48px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 13px;
  border-radius: var(--radius-sm);
}

.choice span { font-size: .78rem; line-height: 1.45; }

.choice input {
  appearance: none;
  flex: 0 0 20px;
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.choice input[type="radio"] { border-radius: 50%; }
.choice input::before { content: ""; width: 11px; height: 8px; background: var(--text); clip-path: polygon(0 45%, 15% 28%, 40% 58%, 85% 0, 100% 16%, 42% 100%); transform: scale(0); }
.choice input[type="radio"]::before { width: 9px; height: 9px; clip-path: none; border-radius: 50%; }
.choice input:checked { background: var(--primary-strong); border-color: var(--primary-strong); }
.choice input:checked::before { transform: scale(1); }

.button {
  min-height: 48px;
  padding: 11px 16px;
  color: var(--primary);
  background: rgb(167 139 250 / 8%);
  border: 1px solid var(--primary);
  border-radius: 14px;
  font-weight: 700;
}

.button.primary { color: var(--text); background: var(--primary-strong); border-color: var(--primary-strong); box-shadow: 0 8px 22px var(--mm-color-action-shadow); }
.button.primary:hover { background: var(--primary-strong); box-shadow: 0 10px 28px rgb(109 74 255 / 34%); }
.button.secondary { color: var(--primary); background: rgb(167 139 250 / 8%); border-color: var(--primary); }
.button.secondary:hover { background: rgb(167 139 250 / 14%); }
.button.tertiary,
.button.textual { color: var(--primary); background: transparent; border-color: transparent; box-shadow: none; }

.icon-button,
.menu-button {
  display: grid;
  place-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 650;
}

.status::before { content: ""; flex: 0 0 7px; width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.status.success,
.status.positive { color: var(--positive); }
.status.warning { color: var(--warning); }

.thumb,
.pose,
.likeness,
.camera,
.video,
.placeholder,
.video-placeholder {
  color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--surface-raised), var(--surface-raised) 10px, var(--surface-soft) 10px, var(--surface-soft) 20px);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.notice { padding: 14px; background: var(--surface-soft); border-radius: var(--radius-sm); }
.metric { padding: 12px 8px; text-align: center; border-radius: var(--radius-sm); }
.metric strong { display: block; font-size: 1.15rem; }
.metric span { color: var(--muted); font-size: .67rem; }

.workspace-tabs,
.filter-chips,
.stage-tabs { display: flex; gap: var(--space-1); overflow-x: auto; }

.workspace-tabs button,
.filter-chips button,
.stage-tabs button {
  min-height: 40px;
  padding: 7px 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 700;
}

.workspace-tabs button.active,
.filter-chips button.active,
.stage-tabs button.active { color: var(--text); background: rgb(167 139 250 / 12%); border-color: var(--primary); }

.mobile-topbar,
.app-header {
  background: var(--mm-color-header-backdrop);
  border-bottom: 1px solid rgb(53 64 85 / 60%);
  backdrop-filter: blur(14px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}

.dialog-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

.dialog-head > .icon-button {
  flex: 0 0 44px;
  margin-left: auto;
}

.sticky-actions,
.sticky-footer,
.bottom-nav {
  background: var(--mm-color-footer-backdrop);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 30px rgb(0 0 0 / 22%);
  backdrop-filter: blur(14px);
}

.bottom-nav { margin: 0; }
.bottom-nav button,
.nav-item { min-width: 44px; min-height: 48px; color: var(--muted); background: transparent; border: 0; border-radius: 10px; }
.bottom-nav button.active,
.bottom-nav button[aria-current="page"],
.nav-item.active { color: var(--primary); background: rgb(167 139 250 / 12%); }

button:focus-visible,
summary:focus-visible {
  outline: var(--mm-focus-ring-width) solid var(--focus);
  outline-offset: var(--mm-focus-ring-offset);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--mm-color-interaction-border);
  outline: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(:disabled):hover,
textarea:not(:disabled):hover,
select:not(:disabled):hover {
  border-color: var(--mm-color-interaction-border);
}

.field.error input,
.field.error textarea,
.field.error select,
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--mm-color-danger);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
