/* ForbiddenFruitAI — criador de rosto 3D (substitui o picker de catálogo) */

.model-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(0.65rem + env(safe-area-inset-top, 0px))
    0.85rem
    calc(0.65rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.model-picker-modal.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.model-picker-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 8, 0.88);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

body.model-picker-open {
  overflow: hidden;
}

.face-creator__sheet {
  --fc-accent: #e8253a;
  --fc-accent-soft: rgba(232, 37, 58, 0.18);
  --fc-line: rgba(255, 255, 255, 0.09);
  --fc-text: #f3eeee;
  --fc-muted: rgba(243, 238, 238, 0.58);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 86rem);
  height: min(96dvh, 54rem);
  overflow: hidden;
  border: 1.5px solid rgba(232, 37, 58, 0.3);
  border-radius: 1.6rem;
  color: var(--fc-text);
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(232, 37, 58, 0.12), transparent 60%),
    linear-gradient(165deg, #121315 0%, #0c0d0f 60%, #130b0e 100%);
  box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, 0.6), inset 0 1px rgba(255, 255, 255, 0.07);
  transform: translateY(0.6rem) scale(0.97);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s ease;
}

.face-creator__sheet .material-symbols-outlined {
  max-width: 1.5em;
  overflow: hidden;
}

.model-picker-modal.is-open .face-creator__sheet {
  transform: none;
  opacity: 1;
}

/* Cabeçalho */

.face-creator__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--fc-line);
}

.face-creator__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.face-creator__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--fc-muted);
}

.face-creator__close {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--fc-line);
  border-radius: 999px;
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.face-creator__close:hover {
  border-color: var(--fc-accent);
}

/* Corpo: categorias | palco 3D | painel */

.face-creator__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr) 22rem;
}

.face-creator__cats {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem 0.6rem;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--fc-line);
}

.face-creator__cat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 0;
  border-radius: 0.7rem;
  color: var(--fc-muted);
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.face-creator__cat .material-symbols-outlined {
  flex: none;
  width: 1.25rem;
  overflow: hidden;
  font-size: 1.25rem;
}

.face-creator__cat:hover {
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.04);
}

.face-creator__cat.is-active {
  color: #fff;
  background: linear-gradient(90deg, var(--fc-accent-soft), rgba(232, 37, 58, 0.04));
}

.face-creator__cat.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 3px;
  background: var(--fc-accent);
}

.face-creator__stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(ellipse 55% 60% at 50% 42%, rgba(255, 236, 228, 0.09), transparent 70%),
    radial-gradient(ellipse 90% 30% at 50% 100%, rgba(232, 37, 58, 0.1), transparent 70%);
}

.face-creator__viewport {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 97%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 97%);
}

.face-creator__viewport:active {
  cursor: grabbing;
}

.face-creator__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.face-creator__loading,
.face-creator__busy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: var(--fc-muted);
  font-size: 0.9rem;
  text-align: center;
}

.face-creator__busy {
  background: rgba(8, 8, 10, 0.55);
  color: var(--fc-text);
}

.face-creator__loading[hidden],
.face-creator__busy[hidden] {
  display: none;
}

.face-creator__spinner {
  width: 2.4rem;
  height: 2.4rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--fc-accent);
  border-radius: 50%;
  animation: face-creator-spin 0.9s linear infinite;
}

@keyframes face-creator-spin {
  to {
    transform: rotate(360deg);
  }
}

.face-creator__view-tools {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 3;
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--fc-line);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.face-creator__view-tools button {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 0;
  border-radius: 999px;
  color: var(--fc-text);
  background: transparent;
  cursor: pointer;
}

.face-creator__view-tools button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Painel de controles */

.face-creator__panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--fc-line);
  background: rgba(0, 0, 0, 0.18);
}

.face-creator__panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--fc-line);
}

.face-creator__eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fc-accent);
}

.face-creator__cat-title {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.face-creator__reset {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--fc-line);
  border-radius: 999px;
  color: var(--fc-muted);
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.face-creator__reset .material-symbols-outlined {
  font-size: 1rem;
}

.face-creator__reset:hover {
  color: var(--fc-text);
  border-color: rgba(255, 255, 255, 0.25);
}

.face-creator__reset[hidden] {
  display: none;
}

.face-creator__controls {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.9rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.face-creator__slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  user-select: none;
}

.face-creator__slider-label {
  color: var(--fc-text);
  font-weight: 600;
}

.face-creator__slider-value {
  color: var(--fc-muted);
  font-variant-numeric: tabular-nums;
}

.face-creator__slider-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.face-creator__nudge {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--fc-line);
  border-radius: 0.45rem;
  color: var(--fc-muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.face-creator__nudge .material-symbols-outlined {
  font-size: 1.1rem;
}

.face-creator__nudge:hover {
  color: var(--fc-text);
  border-color: var(--fc-accent);
}

.face-creator__range {
  --fill: 50%;
  flex: 1;
  min-width: 0;
  height: 1.5rem;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.face-creator__range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--fc-accent) var(--fill), rgba(255, 255, 255, 0.14) var(--fill));
}

.face-creator__slider.is-centered .face-creator__range::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, transparent var(--from), var(--fc-accent) var(--from), var(--fc-accent) var(--to), transparent var(--to)),
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255, 255, 255, 0.45) calc(50% - 1px), rgba(255, 255, 255, 0.45) calc(50% + 1px), transparent calc(50% + 1px)),
    rgba(255, 255, 255, 0.14);
}

.face-creator__range::-webkit-slider-thumb {
  width: 1rem;
  height: 1rem;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--fc-accent);
  box-shadow: 0 0 0 4px rgba(232, 37, 58, 0.2);
  -webkit-appearance: none;
  appearance: none;
}

.face-creator__range::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.face-creator__range::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--fc-accent);
}

.face-creator__range::-moz-range-thumb {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--fc-accent);
}

.face-creator__group-label {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.face-creator__swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(1.9rem, 1fr));
  gap: 0.35rem;
}

.face-creator__swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.45rem;
  background: var(--swatch, #333);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.face-creator__swatch:hover {
  transform: scale(1.08);
}

.face-creator__swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--fc-accent);
}

.face-creator__swatch--auto {
  grid-column: span 2;
  aspect-ratio: auto;
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.face-creator__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.face-creator__chip {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--fc-line);
  border-radius: 999px;
  color: var(--fc-muted);
  background: rgba(255, 255, 255, 0.03);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.face-creator__chip:hover {
  color: var(--fc-text);
}

.face-creator__chip.is-active,
.face-creator__tile.is-active,
.face-creator__preset:hover {
  color: #fff;
  border-color: var(--fc-accent);
  background: var(--fc-accent-soft);
}

.face-creator__tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.face-creator__tile {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.3rem;
  border: 1px solid var(--fc-line);
  border-radius: 0.7rem;
  color: var(--fc-muted);
  background: rgba(255, 255, 255, 0.03);
  font: inherit;
  cursor: pointer;
}

.face-creator__tile .material-symbols-outlined {
  font-size: 1.2rem;
}

.face-creator__tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

.face-creator__presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.face-creator__preset {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--fc-line);
  border-radius: 0.85rem;
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.03);
  font: inherit;
  cursor: pointer;
}

.face-creator__preset-dots {
  display: flex;
}

.face-creator__preset-dot {
  width: 1.3rem;
  height: 1.3rem;
  margin-right: -0.3rem;
  border: 2px solid #121315;
  border-radius: 50%;
  background: var(--swatch);
}

.face-creator__preset-name {
  font-size: 0.86rem;
  font-weight: 700;
}

.face-creator__note {
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.7rem;
  line-height: 1.4;
}

.face-creator__section {
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--fc-line);
  color: var(--fc-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.face-creator__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--fc-line);
  border-radius: 0.75rem;
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.03);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.face-creator__toggle.is-on {
  border-color: var(--fc-accent);
  background: var(--fc-accent-soft);
}

.face-creator__toggle-track {
  position: relative;
  flex: none;
  width: 2.3rem;
  height: 1.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease;
}

.face-creator__toggle-track::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.face-creator__toggle.is-on .face-creator__toggle-track {
  background: var(--fc-accent);
}

.face-creator__toggle.is-on .face-creator__toggle-track::after {
  transform: translateX(1rem);
}

.face-creator__error {
  margin: 0 1.1rem 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(232, 37, 58, 0.45);
  border-radius: 0.6rem;
  color: #ffd5d9;
  background: rgba(232, 37, 58, 0.12);
  font-size: 0.8rem;
}

.face-creator__error[hidden] {
  display: none;
}

.face-creator__footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--fc-line);
}

.face-creator__random,
.face-creator__continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.9rem;
  border-radius: 0.85rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.face-creator__random {
  flex: none;
  padding: 0 0.8rem;
  white-space: nowrap;
  border: 1px solid var(--fc-line);
  color: var(--fc-text);
  background: rgba(255, 255, 255, 0.04);
}

.face-creator__continue {
  flex: 1;
  min-width: 0;
  padding: 0 0.8rem;
  white-space: nowrap;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #f0364b, #b3121f);
  box-shadow: 0 0.6rem 1.4rem rgba(232, 37, 58, 0.28);
}

.face-creator__random:disabled,
.face-creator__continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.model-picker-modal.is-busy .face-creator__panel,
.model-picker-modal.is-busy .face-creator__cats {
  pointer-events: none;
}

/* Revisão da foto */

.face-creator__review {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 8, 10, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.face-creator__review[hidden] {
  display: none;
}

.face-creator__review-card {
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
  max-width: 100%;
  max-height: 100%;
  padding: 1.1rem;
  border: 1px solid var(--fc-line);
  border-radius: 1.2rem;
  background: #121315;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.55);
}

.face-creator__review-img {
  display: block;
  height: min(70dvh, 40rem);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 0.85rem;
  background: #1c1d20;
}

.face-creator__review-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  width: 17rem;
}

.face-creator__review-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
}

.face-creator__review-hint {
  margin: 0 0 0.6rem;
  color: var(--fc-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.face-creator__review-side .face-creator__error {
  margin: 0;
}

.face-creator__review-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.face-creator__review-actions .face-creator__random,
.face-creator__review-actions .face-creator__continue {
  width: 100%;
  flex: none;
}

@media (max-width: 720px) {
  .face-creator__review {
    padding: 0.75rem;
  }

  .face-creator__review-card {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    overflow-y: auto;
  }

  .face-creator__review-img {
    height: min(52dvh, 30rem);
  }

  .face-creator__review-side {
    width: 100%;
  }

  .face-creator__review-hint {
    margin-bottom: 0.2rem;
  }
}

/* Tablet: categorias em faixa horizontal */

@media (max-width: 1100px) {
  .face-creator__body {
    grid-template-columns: minmax(0, 1fr) 20rem;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .face-creator__cats {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--fc-line);
    scrollbar-width: none;
  }

  .face-creator__cat {
    flex: none;
    width: auto;
    padding: 0.5rem 0.8rem;
    white-space: nowrap;
  }

  .face-creator__cat.is-active::before {
    top: auto;
    bottom: 0;
    left: 22%;
    right: 22%;
    width: auto;
    height: 3px;
  }
}

/* Celular: palco em cima, painel embaixo */

@media (max-width: 720px) {
  .model-picker-modal {
    padding: 0;
  }

  .face-creator__sheet {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .face-creator__header {
    padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 0.9rem 0.55rem;
  }

  .face-creator__subtitle {
    display: none;
  }

  .face-creator__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(13rem, 44%) minmax(0, 1fr);
  }

  .face-creator__cat-label {
    font-size: 0.8rem;
  }

  .face-creator__panel {
    border-left: 0;
    border-top: 1px solid var(--fc-line);
  }

  .face-creator__panel-head {
    padding: 0.6rem 0.9rem 0.5rem;
  }

  .face-creator__eyebrow {
    display: none;
  }

  .face-creator__controls {
    padding: 0.75rem 0.9rem;
    gap: 0.85rem;
  }

  .face-creator__view-tools {
    bottom: 0.5rem;
  }

  .face-creator__view-tools button {
    width: 2rem;
    height: 2rem;
  }

  .face-creator__tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .face-creator__presets {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .face-creator__preset {
    padding: 0.55rem;
  }

  .face-creator__footer {
    padding: 0.6rem 0.9rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .face-creator__footer .face-creator__random [data-fc-text] {
    display: none;
  }
}
