:root {
  --primary-color: #ffd600;
  --secondary-color: #111315;
  --card-background: rgba(12, 14, 16, 0.94);
  --text-color: #ffffff;
  --border-color: #ffd600;
  --button-text-color: #111315;
  --danger: #ff6b6b;
  --muted: rgba(255, 255, 255, 0.72);
  --radius: 22px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px var(--border-color), 0 0 36px rgba(255, 214, 0, 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --app-height: 100dvh;
  --chrome-offset: clamp(110px, 18vh, 170px);
  --panel-max-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - var(--chrome-offset));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text-color);
  background: var(--secondary-color);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-height);
}

h1,
h2,
.eyebrow {
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  letter-spacing: -0.02em;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding:
    max(16px, calc(12px + var(--safe-top)))
    max(12px, calc(12px + var(--safe-right)))
    max(20px, calc(16px + var(--safe-bottom)))
    max(12px, calc(12px + var(--safe-left)));
  overflow: hidden;
}

.app-shell.is-landing {
  justify-content: center;
  align-items: center;
  gap: clamp(20px, 3.5vh, 36px);
  padding: clamp(24px, 4vh, 48px) clamp(16px, 4vw, 48px);
  max-width: none;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

/* Logo + step rail + main card: even spacing; scroll stays inside the card */
.app-shell.is-flow {
  justify-content: space-evenly;
  align-items: center;
  gap: 0;
  height: var(--app-height);
  max-height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  width: 100%;
}

.app-shell.is-flow .flow-chrome {
  flex: 0 0 auto;
  width: min(720px, 100%);
  margin: 0;
}

.app-shell.is-flow .panel-card {
  flex: 1 1 auto;
  min-height: 0;
  width: min(920px, 100%);
  max-height: none;
  margin: 0;
}

.flow-chrome {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: min(720px, 100%);
}

.app-shell.is-landing .flow-chrome {
  width: min(720px, 92vw);
  gap: clamp(18px, 2.8vh, 32px);
}

.brand-header {
  display: grid;
  justify-items: center;
  width: 100%;
}

.brand-header .logo-main {
  max-width: min(520px, 90vw);
  max-height: clamp(120px, 16vh, 180px);
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.5));
}

.app-shell.is-landing .brand-header .logo-main {
  max-width: min(720px, 92vw);
  max-height: clamp(160px, 24vh, 280px);
  width: auto;
}

.step-rail {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(12px, 2vw, 22px);
  align-items: center;
  justify-content: center;
}

.step-dot {
  width: clamp(34px, 4.2vw, 48px);
  height: clamp(34px, 4.2vw, 48px);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(0.95rem, 1.6vw, 1.25rem);
  font-weight: 700;
  background: rgba(8, 10, 14, 0.45);
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.step-dot.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #111;
  transform: scale(1.08);
  box-shadow: 0 0 0 5px rgba(255, 214, 0, 0.2);
}

.step-dot.done {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #111;
}

.landing-screen {
  position: relative;
  z-index: 2;
  width: min(640px, 92vw);
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.landing-screen.active {
  display: flex;
}

.hero-card {
  width: 100%;
  padding: clamp(28px, 4vh, 44px) clamp(24px, 4vw, 48px) clamp(28px, 3.5vh, 40px);
  border-radius: 28px;
  background: rgba(28, 32, 38, 0.91);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--primary-color);
  box-shadow:
    0 20px 55px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 214, 0, 0.15),
    0 0 34px rgba(255, 214, 0, 0.18);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: cardIn 500ms ease both;
}

.hero-card h1 {
  margin: 0 0 clamp(10px, 1.5vh, 16px);
  font-size: clamp(2.1rem, 5.2vw, 3.2rem);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-card .spark {
  color: var(--primary-color);
  font-size: 0.85em;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 214, 0, 0.55));
}

.hero-copy {
  margin: 0 auto clamp(22px, 3vh, 32px);
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  line-height: 1.45;
  font-weight: 600;
}

.btn-pill {
  min-width: 168px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 0.95rem 2.2rem;
}

/* Landing START — larger + slight 3D depth */
.btn-start {
  min-width: min(320px, 82%);
  min-height: clamp(60px, 8vh, 76px);
  padding: 1.2rem 3.4rem;
  border-radius: 999px;
  border: none;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #111;
  background: linear-gradient(180deg, #ffe566 0%, var(--primary-color) 55%, #e6c200 100%);
  box-shadow:
    0 2px 0 #c9a800,
    0 8px 0 #a88900,
    0 12px 22px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(255, 214, 0, 0.35);
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.btn-start:hover {
  filter: brightness(1.03);
  transform: translateY(-2px);
  box-shadow:
    0 2px 0 #c9a800,
    0 10px 0 #a88900,
    0 16px 26px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(255, 214, 0, 0.42);
}

.btn-start:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #c9a800,
    0 3px 0 #a88900,
    0 6px 14px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(255, 214, 0, 0.28);
}

.panel-card[hidden] {
  display: none !important;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background-color: #070a12;
  background-image: var(--bg-desktop);
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  transform: scale(1.02);
  z-index: 0;
}

/* Portrait phones/tablets: use dedicated portrait rocket background */
@media (orientation: portrait) {
  .bg-layer {
    background-image: var(--bg-portrait, var(--bg-mobile));
    background-position: center center;
  }
}

.bg-layer::after {
  content: none;
  display: none;
}

.card,
.panel-card {
  position: relative;
  z-index: 2;
  width: min(720px, 100%);
  max-height: var(--panel-max-height);
  overflow: hidden;
  background: rgba(12, 14, 16, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow);
  padding: 28px 24px 24px;
  animation: cardIn 500ms ease both;
  scrollbar-width: none;
}

.card::-webkit-scrollbar,
.panel-card::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeStep 320ms ease both;
}

@keyframes fadeStep {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.logo {
  max-width: min(280px, 70vw);
  max-height: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--primary-color);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-align: center;
}

h1,
h2 {
  margin: 8px 0 10px;
  text-align: center;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.tagline,
.footer-text,
.hint {
  text-align: center;
  color: var(--muted);
}

.footer-text {
  margin-top: 28px;
  font-size: 0.85rem;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

.actions-split {
  justify-content: space-between;
}

.actions-wrap {
  flex-wrap: wrap;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(12, 14, 16, 0.96) 30%);
}

.btn {
  min-height: 48px;
  min-width: 44px;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--button-text-color);
}

.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

label,
fieldset {
  display: block;
  margin-bottom: 14px;
}

input[type="text"],
input[type="email"],
select {
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-color);
  padding: 0.75rem 0.9rem;
  font: inherit;
}

/* Enter Details screen */
.panel-card.is-details {
  width: min(560px, 100%);
  background: rgba(16, 20, 26, 0.72);
  border: 1.5px solid var(--primary-color);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 214, 0, 0.12);
  padding: 28px 28px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-shell.is-flow .panel-card.is-details {
  width: min(560px, 100%);
}

.details-title {
  margin: 0 0 18px;
  text-align: left;
  font-size: clamp(1.45rem, 3vw, 1.75rem);
  font-weight: 700;
}

.details-form .field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
}

.details-form .field-input {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  min-height: 48px;
  border-radius: 12px;
  border: none;
  background: #ffffff;
  color: #111;
  padding: 0.8rem 1rem;
  font: inherit;
  box-shadow: none;
}

.details-form .field-input::placeholder {
  color: #8a8a8a;
}

.details-form .field-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #333 50%),
    linear-gradient(135deg, #333 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
  cursor: pointer;
}

.details-form .field-hint {
  margin: -6px 0 16px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.88rem;
}

.gender-fieldset {
  border: 0;
  margin: 0 0 8px;
  padding: 0;
}

.gender-fieldset .field-label {
  margin-bottom: 10px;
}

.gender-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.gender-pill {
  margin: 0;
  cursor: pointer;
  flex: 1 1 140px;
}

.gender-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-pill-face {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: #ffffff;
  color: #111;
  border: 2px solid transparent;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.gender-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #555;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}

.gender-pill input:checked + .gender-pill-face {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.2);
}

.gender-pill input:checked + .gender-pill-face .gender-radio {
  border-color: var(--primary-color);
}

.gender-pill input:checked + .gender-pill-face .gender-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--primary-color);
}

.gender-text {
  font-weight: 600;
}

.details-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  margin-bottom: max(8px, var(--safe-bottom));
  position: relative;
}

.details-actions .btn-pill {
  min-width: 160px;
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
}

.checkbox-row input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.radio-grid {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.radio-grid label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

.app-shell.is-disclaimer {
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(20px, 4vh, 40px) 16px;
}

.app-shell.is-disclaimer .flow-chrome {
  display: none !important;
}

.panel-card.is-disclaimer {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  width: min(560px, 100%);
  max-width: min(560px, 100%);
  max-height: none;
  overflow: visible;
}

.disclaimer-screen.active {
  display: block;
  width: 100%;
}

.disclaimer-modal {
  background: #ffffff;
  color: #222;
  border-radius: 28px;
  padding: 32px 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: cardIn 420ms ease both;
  width: 100%;
}

.disclaimer-title {
  margin: 0 0 18px;
  text-align: center;
  color: #111;
  font-size: clamp(1.55rem, 4vw, 1.9rem);
  font-weight: 800;
}

.disclaimer-body {
  color: #333;
  line-height: 1.5;
  max-height: none;
  overflow: visible;
  text-align: left;
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
}

.disclaimer-intro,
.disclaimer-closing {
  margin: 0 0 14px;
  color: #333;
}

.disclaimer-closing {
  margin-top: 4px;
  margin-bottom: 0;
}

.disclaimer-bullets {
  margin: 0 0 14px;
  padding-left: 1.2rem;
}

.disclaimer-bullets li {
  margin-bottom: 12px;
  padding-left: 2px;
}

.disclaimer-bullets li:last-child {
  margin-bottom: 0;
}

.disclaimer-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  justify-content: center;
  margin-top: 22px;
}

.disclaimer-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 50px;
  font-weight: 800;
}

.btn-pill-outline {
  min-width: 0;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: 1.5px solid #c8c8c8;
  font-weight: 800;
}

.btn-pill-outline:hover {
  border-color: #111;
}

.form-error {
  color: var(--danger);
  font-weight: 600;
  text-align: center;
}

/* Click Picture card */
.panel-card.is-camera {
  width: min(640px, 100%);
  background: rgba(16, 20, 26, 0.72);
  border: 1.5px solid var(--primary-color);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 214, 0, 0.12);
  padding: 28px 28px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.app-shell.is-flow .panel-card.is-camera {
  width: min(640px, 100%);
}

.photo-choice-row {
  display: flex;
  gap: 14px;
  margin: 8px 0 8px;
}

.btn-white-pill {
  flex: 1;
  min-height: 52px;
  border-radius: 999px;
  background: #ffffff;
  color: #111;
  border: none;
  font-weight: 700;
}

.btn-white-pill:hover {
  filter: brightness(0.96);
}

.photo-preview-wrap {
  width: min(280px, 70%);
  margin: 0 auto 18px;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.photo-preview-wrap[hidden] {
  display: none !important;
}

.photo-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Full-screen live capture */
body.live-capture-open .bg-layer,
body.live-capture-open .flow-chrome,
body.live-capture-open .panel-card,
body.live-capture-open .landing-screen {
  visibility: hidden;
}

.live-capture {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, var(--safe-top))
    max(12px, var(--safe-right))
    max(12px, var(--safe-bottom))
    max(12px, var(--safe-left));
  background: #000;
  height: var(--app-height);
  max-height: var(--app-height);
}

.live-capture[hidden] {
  display: none !important;
}

.live-capture-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
}

.live-capture-frame {
  position: relative;
  width: min(100vw, 56.25vh);
  height: min(100vh, 177.778vw);
  max-width: 480px;
  max-height: 853px;
  margin: 10px auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.live-capture-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.live-capture-frame video.mirror {
  transform: scaleX(-1);
}

.fit-frame-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 2;
}

.live-capture-actions {
  display: flex;
  gap: 12px;
  width: min(100%, 480px);
  justify-content: center;
  padding: 8px 4px 4px;
  box-sizing: border-box;
}

.live-capture-actions .btn {
  flex: 1;
  min-width: 0;
}

.live-capture-actions #btn-capture-shutter {
  flex: 1.15;
}

.live-capture-error {
  max-width: 480px;
  width: 100%;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 5rem;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2;
}

/* Select Category / Select Avatar */
.panel-card.is-select {
  width: min(920px, 100%);
  background: rgba(16, 20, 26, 0.78);
  border: 1.5px solid var(--primary-color);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 214, 0, 0.12);
  padding: 22px 22px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.panel-card.is-select::-webkit-scrollbar {
  display: block;
  width: 4px;
}

.panel-card.is-select::-webkit-scrollbar-thumb {
  background: rgba(255, 214, 0, 0.45);
  border-radius: 999px;
}

.panel-card.is-select > .select-screen.active {
  display: block;
  width: 100%;
}

.panel-card.is-select .avatar-panel,
.panel-card.is-select .select-panel {
  display: block;
  width: 100%;
}

.select-title {
  margin: 0 0 6px;
  text-align: left;
  font-size: clamp(1.5rem, 3.2vw, 1.9rem);
}

.select-subtitle {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.category-btn {
  min-height: 64px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: #111;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 1rem 1.1rem;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.category-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.category-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.avatar-category-label {
  margin: 0 0 4px;
  font-weight: 700;
  color: #fff;
  text-align: left;
}

.avatar-gender-hint {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.88rem;
  text-align: left;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.avatar-card {
  border: 4px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #111;
  padding: 0;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.avatar-card:hover {
  transform: translateY(-2px);
}

.avatar-card.selected {
  border-color: var(--primary-color);
  box-shadow:
    0 0 0 1px var(--primary-color),
    0 0 22px rgba(255, 214, 0, 0.72);
}

.avatar-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 180px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  display: block;
  background: #0b0d10;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-sizing: border-box;
}

.avatar-card.selected img {
  border-color: rgba(255, 255, 255, 0.98);
}

.avatar-card-title {
  display: none;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: max(10px, var(--safe-bottom));
  padding-top: 4px;
  position: relative;
}

.avatar-actions .btn-white-pill {
  width: 100%;
}

.avatar-actions .btn-pill {
  min-width: 180px;
  width: 100%;
}

/* Desktop avatar grid sizing */
@media (min-width: 901px) {
  .panel-card.is-select {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .panel-card.is-select .select-title {
    margin-bottom: 4px;
  }

  .panel-card.is-select .select-subtitle {
    margin-bottom: 10px;
  }

  .panel-card.is-select .avatar-category-label,
  .panel-card.is-select .avatar-gender-hint {
    margin-bottom: 6px;
  }

  .avatar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 12px;
  }

  .avatar-card img {
    aspect-ratio: 3 / 4;
    min-height: 200px;
    width: 100%;
    object-fit: contain;
  }
}

@media (max-width: 900px) {
  .app-shell.is-flow {
    overflow: hidden;
    justify-content: space-evenly;
    height: var(--app-height);
    max-height: var(--app-height);
  }

  .app-shell.is-flow .flow-chrome {
    flex: 0 0 auto;
  }

  .app-shell.is-flow .panel-card {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .app-shell:not(.is-landing):not(.is-flow):not(.is-disclaimer) {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    align-items: center;
  }

  :root {
    --chrome-offset: clamp(96px, 16vh, 150px);
  }

  .panel-card.is-disclaimer {
    max-height: none;
    overflow: visible;
  }

  .panel-card.is-details::-webkit-scrollbar,
  .panel-card.is-select::-webkit-scrollbar,
  .panel-card.is-camera::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  .panel-card.is-details::-webkit-scrollbar-thumb,
  .panel-card.is-select::-webkit-scrollbar-thumb,
  .panel-card.is-camera::-webkit-scrollbar-thumb {
    background: rgba(255, 214, 0, 0.45);
    border-radius: 999px;
  }

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

  .avatar-card img {
    min-height: 0;
  }

  .avatar-actions,
  .details-actions,
  .panel-card.is-camera .details-actions {
    position: relative;
    bottom: auto;
    z-index: auto;
    background: transparent;
  }
}

@media (max-width: 640px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .avatar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-shell.is-flow {
    padding-top: max(10px, var(--safe-top));
    padding-bottom: max(10px, var(--safe-bottom));
  }

  .app-shell.is-flow .brand-header .logo-main {
    max-height: 72px;
  }

  .app-shell.is-flow .step-dot {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .app-shell.is-flow .flow-chrome {
    gap: 12px;
  }

  .panel-card.is-select,
  .panel-card.is-details,
  .panel-card.is-camera {
    padding: 18px 14px 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .details-form .field-input {
    margin-bottom: 10px;
    min-height: 46px;
  }

  .details-title {
    margin-bottom: 12px;
  }

  .avatar-actions .btn-pill,
  .avatar-actions .btn-white-pill {
    width: 100%;
  }
}

.loader {
  text-align: center;
  padding: 24px 0;
}

.spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary-color);
  animation: spin 0.9s linear infinite;
}

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

.progress-track {
  width: min(320px, 90%);
  height: 8px;
  margin: 16px auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: var(--primary-color);
  transition: width 400ms ease;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Generating screen */
.panel-card.is-generating {
  width: min(640px, 100%);
  max-height: none;
  overflow: visible;
  background: rgba(10, 12, 16, 0.82);
  border: 1.5px solid var(--primary-color);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 214, 0, 0.18);
  padding: clamp(36px, 6vh, 56px) clamp(28px, 5vw, 48px);
}

.gen-panel {
  text-align: center;
}

.gen-title {
  margin: 0 0 28px;
  font-size: clamp(1.7rem, 3.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.gen-loader {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.gen-spinner {
  width: 72px;
  height: 72px;
  margin: 0;
  border-width: 5px;
  border-color: rgba(255, 255, 255, 0.22);
  border-top-color: var(--primary-color);
}

.gen-dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gen-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-color);
  opacity: 0.35;
  animation: genDotPulse 1.2s ease-in-out infinite;
}

.gen-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.gen-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes genDotPulse {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.gen-copy {
  margin: 0 auto;
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.98rem;
  line-height: 1.45;
}

.gen-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

/* Result / Your Avatar screen */
.panel-card.is-result {
  width: min(520px, 100%);
  max-height: var(--panel-max-height);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(10, 12, 16, 0.88);
  border: 1.5px solid var(--primary-color);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 214, 0, 0.16);
  padding: 16px 16px 14px;
}

.result-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.result-heading {
  margin: 0 0 10px;
  text-align: left;
  font-size: clamp(1.45rem, 3vw, 1.75rem);
  font-weight: 800;
}

.result-frame {
  margin: 0 auto 14px;
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #111;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 560px);
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: #0b0d10;
}

.result-frame.compact {
  width: 100%;
  max-width: 420px;
}

.result-caption {
  align-self: center;
  margin: 0 0 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: #111;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  max-width: 90%;
}

.result-caption:empty {
  display: none;
}

.result-choose-link {
  align-self: center;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  cursor: pointer;
}

.result-panel.is-submitted .result-choose-link {
  display: none;
}

.result-choose-link:hover {
  color: #fff;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.btn-result-submit,
.btn-result-retake {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.btn-result-retake {
  background: rgba(40, 44, 52, 0.95);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-result-retake:hover {
  filter: brightness(1.08);
}

.btn-result-submit.is-submitted {
  background: rgba(40, 44, 52, 0.95);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: default;
}

.result-reset-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

/* Submit thank-you popup */
.submit-modal[hidden] {
  display: none !important;
}

.submit-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.submit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.submit-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: #ffffff;
  color: #222;
  border-radius: 22px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: cardIn 280ms ease both;
}

.submit-modal-card h2 {
  margin: 0 0 10px;
  color: #222;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.3;
}

.submit-modal-card p {
  margin: 0 0 22px;
  color: #444;
  font-size: 0.98rem;
  line-height: 1.4;
}

.submit-modal-actions {
  display: flex;
  gap: 12px;
}

.btn-modal-download,
.btn-modal-home {
  flex: 1;
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-download {
  background: #ffffff;
  color: #111;
  border: 1.5px solid #222;
}

.btn-modal-download:hover {
  background: #f4f4f4;
}

body.submit-modal-open {
  overflow: hidden;
}

.success-icon {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}

@media (max-width: 900px) and (orientation: landscape) {
  .bg-layer {
    background-image: var(--bg-desktop);
    background-position: center right;
  }
}

@media (max-width: 640px) {
  .app-shell {
    justify-content: flex-start;
    padding-top: 40px;
    gap: 18px;
  }

  .app-shell.is-landing {
    padding: 28px 14px 28px;
    gap: 18px;
    justify-content: center;
  }

  .brand-header .logo-main {
    max-height: 88px;
  }

  .app-shell.is-landing .brand-header .logo-main {
    max-width: 94vw;
    max-height: clamp(140px, 20vh, 190px);
  }

  .step-dot {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .hero-card {
    padding: 28px 18px 26px;
  }

  .hero-card h1 {
    font-size: clamp(1.9rem, 8vw, 2.4rem);
  }

  .hero-copy {
    font-size: clamp(1.1rem, 4.2vw, 1.25rem);
  }

  .btn-start {
    min-width: 88%;
    min-height: 60px;
    font-size: 1.3rem;
    padding: 1.05rem 2.4rem;
  }

  .card,
  .panel-card {
    padding: 22px 16px 18px;
    border-radius: 18px;
  }

  .app-shell.is-flow .panel-card {
    max-height: none;
  }

  .panel-card.is-details,
  .panel-card.is-camera,
  .panel-card.is-select,
  .panel-card.is-result {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .panel-card.is-generating {
    padding: 40px 20px 32px;
    max-height: none;
    overflow: visible;
  }

  .panel-card.is-result {
    padding: 14px 12px 12px;
    width: min(100%, 420px);
  }

  .result-frame {
    width: 100%;
    max-width: none;
  }

  .result-frame img {
    max-height: min(58vh, 480px);
  }

  .submit-modal-actions {
    flex-direction: column;
  }

  .actions-split {
    flex-direction: column-reverse;
  }

  .actions-split .btn,
  .actions-wrap .btn {
    width: 100%;
  }

  .disclaimer-modal {
    padding: 26px 18px 20px;
    border-radius: 24px;
  }

  .disclaimer-body {
    font-size: 0.95rem;
    line-height: 1.48;
  }

  .disclaimer-actions {
    flex-direction: row;
    gap: 12px;
    margin-top: 20px;
  }

  .disclaimer-actions .btn {
    width: auto;
    flex: 1 1 0;
    min-height: 48px;
    font-size: 1rem;
  }

  .app-shell.is-disclaimer {
    padding: 18px 12px;
  }

  .panel-card.is-disclaimer {
    width: min(520px, 100%);
    max-height: none;
    overflow: visible;
  }

  .panel-card.is-details {
    padding: 18px 16px 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .gender-pill {
    flex: 1 1 calc(50% - 6px);
  }

  .details-actions .btn-pill {
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .app-shell.is-landing {
    padding: clamp(32px, 5vh, 64px) 48px;
  }

  .app-shell.is-landing .brand-header .logo-main {
    max-width: min(760px, 62vw);
    max-height: clamp(190px, 26vh, 300px);
  }

  .landing-screen {
    width: min(680px, 100%);
  }

  .hero-card h1 {
    font-size: clamp(2.6rem, 3.6vw, 3.4rem);
  }

  .hero-copy {
    font-size: clamp(1.35rem, 1.8vw, 1.65rem);
  }

  .btn-start {
    min-width: 340px;
    min-height: 74px;
    font-size: 1.65rem;
  }
}

@media (min-width: 1400px) {
  .card,
  .panel-card {
    width: min(820px, 100%);
  }

  .app-shell.is-landing .brand-header .logo-main {
    max-width: min(860px, 58vw);
    max-height: clamp(220px, 28vh, 340px);
  }

  .landing-screen {
    width: min(720px, 100%);
  }

  .hero-card h1 {
    font-size: 3.5rem;
  }

  .hero-copy {
    font-size: 1.7rem;
  }

  .btn-start {
    min-width: 380px;
    min-height: 80px;
    font-size: 1.8rem;
  }
}
