/*
 * Three-step character builder. Layout, sizes and behaviour follow the source page
 * (research/notes.md has the measurements); colours are Tyan's; no logo (removed 2026-11-26).
 * The chat screen after step 3 is styled in match.css.
 */

@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  /* Tyan palette (same values as the other Tyan landings) */
  --bg: #050507;
  --surface: #16161c;          /* dialog */
  --surface-2: #1a1a22;        /* tiles, inputs, chat bubbles */
  --surface-3: #26262f;        /* secondary button */
  --muted: rgba(255, 255, 255, .68);
  --line: rgba(255, 255, 255, .1);
  --line-light: rgba(255, 255, 255, .17);
  --pink: #fe3cb3;
  --pink-hover: #e535a0;
  --pink-soft: rgba(254, 60, 179, .12);
  --pink-glow: rgba(254, 60, 179, .32);
  --gradient: linear-gradient(135deg, #fe3cb3 0%, #e535a0 55%, #ba62ec 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-width: 320px;
  margin: 0;
  color: #fafafa;
  background: var(--bg);
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}
button { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img, video { display: block; }
[hidden] { display: none !important; }

/* ---------- frame ---------- */
.page { position: relative; display: flex; flex-direction: column; width: 100%; min-height: 100vh; min-height: 100dvh; }

.progress { position: fixed; inset: 0 0 auto 0; z-index: 20; height: 4px; background: rgba(255, 255, 255, .1); }
.progress-fill { height: 100%; border-radius: 0 9999px 9999px 0; background: linear-gradient(to right, var(--pink), var(--pink-hover)); transition: width .3s ease; }

.top { z-index: 10; display: flex; align-items: center; justify-content: flex-end; width: 100%; padding: 20px 20px 16px; }
.counter { display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .7); font-size: 14px; line-height: 20px; }
.counter-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.counter-number { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .5; } }

.stage { width: 100%; max-width: 512px; margin: 0 auto; padding: 0 16px; }
.panel > * + * { margin-top: 16px; }
.panel { animation: panel-in .3s ease-out both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.head { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; text-align: center; }
.head-row { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; }
.back { position: absolute; left: 0; display: flex; align-items: center; gap: 4px; color: rgba(255, 255, 255, .3); font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: .6px; text-transform: uppercase; transition: color .15s; }
.back:hover { color: rgba(254, 60, 179, .7); }
.back svg { width: 10px; height: 10px; }
.step-label { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, .35); font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: 1.2px; text-transform: uppercase; }
.step-label i { width: 20px; height: 1px; background: rgba(255, 255, 255, .15); }
.title { margin: 0; color: #fff; font-size: 24px; font-weight: 700; line-height: 30px; letter-spacing: -.6px; }
.title span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { max-width: 320px; margin: 0; color: rgba(255, 255, 255, .4); font-size: 14px; line-height: 20px; }

.trust { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 20px; margin-top: auto; padding: 16px; }
.trust-item { display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .3); font-size: 14px; line-height: 20px; }
.trust-item svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .6; }

/* ---------- step 1: art style ---------- */
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.style-card { position: relative; aspect-ratio: 1 / 2; overflow: hidden; border: 2px solid var(--line); border-radius: 16px; transition: transform .3s, border-color .3s; }
.style-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.style-card-label { position: absolute; inset: auto 0 0 0; z-index: 1; padding: 32px 12px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .9), transparent); color: #fff; font-size: 16px; font-weight: 600; line-height: 24px; text-align: left; }

/* ---------- step 2: look ---------- */
.group-label { width: 100%; color: rgba(255, 255, 255, .7); font-size: 12px; font-weight: 700; line-height: 16px; letter-spacing: .6px; text-align: left; text-transform: uppercase; }
.group-label span { color: rgba(255, 255, 255, .3); font-weight: 500; letter-spacing: 0; text-transform: none; }
/* Three tiles in a row on a 6-column grid, so that a last row of two can sit in the middle (5 ethnicities). */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 100%; }
.tile:nth-child(3n + 1):nth-last-child(2) { grid-column: 2 / span 2; }
.tile { grid-column: span 2; position: relative; aspect-ratio: 1; overflow: hidden; border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); transition: transform .2s, border-color .2s, box-shadow .2s; }
.tile img, .persona img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform .3s; }
.tile-label { position: absolute; inset: auto 0 0 0; z-index: 1; padding: 16px 4px 6px; background: linear-gradient(to top, rgba(0, 0, 0, .95), transparent); color: #fff; font-size: 12px; font-weight: 600; line-height: 16px; text-align: center; }
.tile[aria-pressed="true"] { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink); }
.tile-check { position: absolute; top: 6px; right: 6px; z-index: 1; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--pink); color: #fff; }
.tile-check svg { width: 10px; height: 10px; }

/* ---------- step 3: personality ---------- */
.personas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 100%; }
.persona { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); text-align: left; transition: transform .2s, border-color .2s; }
.persona-text { position: absolute; inset: auto 0 0 0; z-index: 1; padding: 24px 10px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .95), rgba(0, 0, 0, .6), transparent); }
.persona-title { display: block; color: #fff; font-size: 16px; font-weight: 600; line-height: 20px; }
.persona-desc { display: block; margin-top: 2px; color: rgba(255, 255, 255, .5); font-size: 12px; line-height: 16px; }

/* ---------- summary: the picks and the matched model (our addition, after step 3) ---------- */
.summary { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; width: 100%; }
.reveal { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border: 2px solid var(--line); border-radius: 16px; background: var(--surface-2); transition: border-color .4s, box-shadow .4s; }
.reveal.is-ready { border-color: var(--pink); box-shadow: 0 0 28px var(--pink-glow); }
.reveal-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px; text-align: center; background: linear-gradient(110deg, var(--surface-2) 30%, rgba(254, 60, 179, .1) 50%, var(--surface-2) 70%) 0 0 / 220% 100%; animation: reveal-shimmer 1.6s linear infinite; }
.reveal-loading p { min-height: 20px; margin: 0; color: rgba(255, 255, 255, .6); font-size: 13px; line-height: 20px; }
@keyframes reveal-shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.reveal-ring { position: relative; width: 88px; height: 88px; }
.reveal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.reveal-ring circle { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 8; }
.reveal-ring circle[data-ring] { stroke: var(--pink); stroke-linecap: round; }
.reveal-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reveal-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: reveal-in .7s ease-out both; }
@keyframes reveal-in { from { opacity: 0; transform: scale(1.06); filter: blur(12px); } to { opacity: 1; transform: none; filter: none; } }
.reveal-who { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; gap: 2px; padding: 36px 12px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .92), transparent); animation: fade-in .5s .3s ease-out both; }
.reveal-who b { color: #fff; font-size: 18px; font-weight: 700; line-height: 24px; }
.reveal-who span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; line-height: 16px; }
.reveal-who i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; }

.picks { display: grid; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.pick { display: flex; align-items: stretch; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); animation: panel-in .35s ease-out both; }
.pick-thumb { flex: 0 0 46px; background: var(--surface-3) center / cover no-repeat; }
.pick-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 8px 0 10px; }
.pick-text small { color: rgba(255, 255, 255, .4); font-size: 10px; font-weight: 600; line-height: 14px; letter-spacing: .5px; text-transform: uppercase; }
.pick-text b { overflow: hidden; color: #fff; font-size: 14px; font-weight: 600; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; }

.summary-cta { min-height: 52px; }   /* the place is kept, so nothing jumps when the button comes */
.cta { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border-radius: 9999px; background: var(--gradient); box-shadow: 0 6px 24px var(--pink-glow); color: #fff; font-size: 16px; font-weight: 700; line-height: 24px; transition: filter .15s; animation: panel-in .35s ease-out both; }
.cta:hover { filter: brightness(1.08); }

@media (hover: hover) {
  .style-card:hover, .tile:not([aria-pressed="true"]):hover, .persona:hover { transform: translateY(-2px); border-color: rgba(254, 60, 179, .4); }
  .tile:hover img, .persona:hover img { transform: scale(1.05); }
}

/* ---------- sign-up dialog ---------- */
.signup-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, .8); animation: fade-in .2s ease-out both; }
.signup {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  width: calc(100vw - 16px);
  max-width: 448px;
  max-height: 85vh;
  padding: 24px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 2px 2px 8px 3px rgba(0, 0, 0, .25);
  transform: translate(-50%, -50%);
  animation: dialog-in .2s ease-out both;
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.95); } }
.signup-close { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; transition: background .15s; }
.signup-close:hover { background: rgba(255, 255, 255, .1); }
.signup-close svg { width: 16px; height: 16px; }
.signup-body { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.signup-title { margin: 0; color: #fff; font-size: 24px; font-weight: 700; line-height: 28px; letter-spacing: -.4px; text-align: center; text-transform: uppercase; }
.signup-sub { margin: 4px 0 0; color: #aaa; font-size: 14px; line-height: 20px; text-align: center; }
.signup-actions, .signup-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.signup-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 40px; padding: 10px 16px; border-radius: 9999px; font-size: 14px; font-weight: 500; line-height: 20px; transition: filter .15s, background .15s; }
.signup-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.signup-btn.is-light { background: #fff; color: #0d0d0d; }
.signup-btn.is-light:hover { filter: brightness(.92); }
.signup-btn.is-subtle { background: var(--surface-3); color: #fff; }
.signup-btn.is-subtle:hover { filter: brightness(1.2); }
.signup-btn.is-accent { background: var(--gradient); color: #fff; font-weight: 700; }
.signup-btn.is-accent:hover { filter: brightness(1.08); }
.signup-btn:disabled { background: var(--surface-3); color: rgba(255, 255, 255, .35); cursor: not-allowed; filter: none; }
.signup-field { position: relative; display: block; width: 100%; }
.signup-field svg { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; color: rgba(255, 255, 255, .5); transform: translateY(-50%); pointer-events: none; }
.signup-field input { width: 100%; height: 48px; padding: 12px 12px 12px 40px; border: 1px solid var(--line); border-radius: 16px; outline: none; background: var(--surface); color: #fff; font: inherit; font-size: 16px; font-weight: 500; line-height: 18px; transition: border-color .15s; }
.signup-field input::placeholder { color: rgba(255, 255, 255, .45); }
.signup-field input:focus { border-color: var(--pink); }
.signup-field input.is-error { border-color: #e53935; }
.signup-note { min-height: 16px; margin: 0; color: rgba(255, 255, 255, .75); font-size: 12px; line-height: 16px; text-align: center; }
.signup-note.is-error { color: #ff7d7a; }
.signup-login { margin: 0; color: rgba(255, 255, 255, .55); font-size: 13px; line-height: 18px; text-align: center; }
.signup-login a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.signup-btn:disabled { opacity: .6; cursor: default; }

@media (min-width: 640px) {
  .signup { border-radius: 8px; }
}
@media (min-width: 768px) {
  .title { font-size: 30px; line-height: 36px; letter-spacing: -.75px; }
  .style-grid { gap: 16px; }
  .style-card { aspect-ratio: 2 / 3; }
  .tiles { gap: 8px; }
  .personas { gap: 10px; }
  .summary { gap: 12px; }
  .picks { gap: 8px; }
  .pick-thumb { flex-basis: 64px; }
  .pick-text { padding: 0 10px 0 12px; }
  .pick-text small { font-size: 11px; line-height: 16px; }
  .pick-text b { font-size: 16px; line-height: 22px; }
  .trust { gap: 28px; }
  .trust-item svg { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .signup, .signup-overlay, .counter-dot, .reveal-loading, .reveal-photo, .reveal-who, .pick, .cta { animation: none; }
}
