.welcome-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.welcome-page .brand { margin-bottom: 1.25rem; }
.welcome-card {
  width: min(100%, 850px);
  min-height: min(650px, calc(100dvh - 100px));
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 5vw, 2.25rem);
  border: 1px solid rgba(202, 195, 255, .13);
  border-radius: 22px;
  background: rgba(19, 20, 32, .94);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
}
.welcome-card form { display: flex; flex: 1; flex-direction: column; }
.welcome-card h1 { margin-bottom: .35rem; }
.welcome-card .auth-subtitle { margin-bottom: 1.4rem; }
.welcome-card h2 { margin: 0 0 .4rem; font-size: clamp(1.2rem, 4vw, 1.55rem); letter-spacing: -.035em; }
.step-hint { margin: 0 0 1.25rem; color: #a5a4b8; font-size: .82rem; line-height: 1.6; }
.wizard-progress { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.7rem; }
.wizard-progress-track { height: 5px; flex: 1; overflow: hidden; border-radius: 99px; background: rgba(202, 195, 255, .12); }
.wizard-progress-track span { display: block; width: 12.5%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8977f8, #54c9d2); transition: width .25s ease; }
#wizard-progress-label { color: #a5a4b8; font-size: .72rem; white-space: nowrap; }
.wizard-step { flex: 1; min-height: 330px; animation: step-enter .2s ease both; }
.wizard-step[hidden] { display: none !important; }
.wizard-step[aria-hidden="true"] { display: none !important; }
@keyframes step-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.welcome-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.welcome-grid .full { grid-column: 1 / -1; }
.welcome-grid textarea { min-height: 72px; resize: vertical; }
.optional { color: #858397; font-weight: 400; }
.template-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.template-option {
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: center;
  gap: .1rem .7rem;
  min-height: 78px;
  padding: .8rem;
  border: 1px solid rgba(202, 195, 255, .14);
  border-radius: 13px;
  background: #10111b;
  color: #f2f1ff;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.template-option:hover { transform: translateY(-1px); border-color: rgba(169, 155, 255, .55); }
.template-option.selected { border-color: #9a88ff; background: rgba(137, 119, 248, .12); box-shadow: 0 0 0 2px rgba(154, 136, 255, .1); }
.field-label { display: block; margin-bottom: .45rem; color: #e8e7f2; font-size: .78rem; font-weight: 600; }
.appearance-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 110px;
  margin: 0 0 1rem;
  padding: .65rem 1rem;
  overflow: hidden;
  border: 1px solid rgba(202, 195, 255, .15);
  border-radius: 14px;
  background: radial-gradient(ellipse at 18% 55%, rgba(84, 201, 210, .16), transparent 55%), #10111b;
  color: #c4c2d3;
  font-size: .78rem;
}
.appearance-preview img {
  width: 72px;
  height: 92px;
  object-fit: cover;
  border: 1px solid rgba(143, 229, 226, .35);
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
  animation: preview-idle 3s ease-in-out infinite;
}
.appearance-preview[data-visual-style="manga3d"] img { filter: saturate(.72) contrast(1.12); }
.appearance-preview[data-visual-style="stylized3d"] img { filter: saturate(1.18) brightness(1.04); }
.appearance-options { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: .8rem; }
.appearance-options .template-option { min-height: 72px; padding: .55rem; }
.appearance-options .option-icon { grid-row: span 2; font-size: 1rem; }
.appearance-options .template-option strong { font-size: .72rem; }
.appearance-options .template-option small { font-size: .62rem; }
.visual-style-options { margin-top: 0; }
.visual-style-options button { min-height: 36px; }
@keyframes preview-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.option-icon { grid-row: span 2; font-size: 1.35rem; }
.template-option strong { font-size: .8rem; line-height: 1.35; }
.template-option small { color: #a5a4b8; font-size: .68rem; line-height: 1.4; }
.choice-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: -.25rem 0 .7rem; }
.choice-chips button {
  padding: .42rem .65rem;
  border: 1px solid rgba(202, 195, 255, .15);
  border-radius: 999px;
  background: #10111b;
  color: #c4c2d3;
  font: inherit;
  font-size: .7rem;
  line-height: 1.4;
  cursor: pointer;
}
.choice-chips button:hover, .choice-chips button.selected { border-color: #9a88ff; color: #f2f1ff; background: rgba(137, 119, 248, .13); }
.character-summary { display: grid; gap: .5rem; margin: .8rem 0 1rem; }
.avatar-setup {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: .75rem 0;
  padding: .7rem;
  border: 1px solid rgba(202, 195, 255, .12);
  border-radius: 12px;
  background: rgba(16, 17, 27, .7);
}
.avatar-setup > img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: cover;
  border: 1px solid rgba(143, 229, 226, .35);
  border-radius: 50%;
}
.avatar-setup strong { font-size: .78rem; }
.avatar-setup p { margin: .2rem 0 .45rem; color: #a5a4b8; font-size: .7rem; line-height: 1.4; }
.avatar-template-group { margin: .65rem 0; }
.avatar-template-grid { display: grid; grid-template-columns: repeat(5, 48px); gap: .5rem; }
.avatar-template-option {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid rgba(202, 195, 255, .16);
  border-radius: 50%;
  background: #10111b;
  cursor: pointer;
}
.avatar-template-option.selected { border-color: #8fe5e2; box-shadow: 0 0 0 2px rgba(84, 201, 210, .2); }
.avatar-template-option img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.avatar-template-option span { position: absolute; right: 0; bottom: 0; min-width: 15px; border-radius: 99px; background: #10111b; color: #fff; font-size: .58rem; line-height: 15px; text-align: center; }
.generated-avatar-option {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .65rem 0;
  padding: .4rem .65rem;
  border: 1px solid rgba(202, 195, 255, .16);
  border-radius: 10px;
  background: #10111b;
  color: #f2f1ff;
  font: inherit;
  font-size: .7rem;
  cursor: pointer;
}
.generated-avatar-option.selected { border-color: #8fe5e2; }
.generated-avatar-option img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.generated-avatar-option[hidden] { display: none; }
.avatar-generate-button {
  padding: .4rem .65rem;
  border: 1px solid rgba(154, 136, 255, .45);
  border-radius: 8px;
  background: rgba(137, 119, 248, .12);
  color: #f2f1ff;
  font: inherit;
  font-size: .7rem;
  cursor: pointer;
}
.avatar-generate-button:disabled { opacity: .55; cursor: wait; }
.summary-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: .7rem; padding: .6rem .7rem; border: 1px solid rgba(202, 195, 255, .1); border-radius: 9px; background: rgba(16, 17, 27, .7); }
.summary-row span { color: #a5a4b8; font-size: .73rem; }
.summary-row strong { overflow-wrap: anywhere; font-size: .76rem; font-weight: 600; }
.safety-note { margin: .25rem 0 1rem; color: #a5a4b8; font-size: .75rem; line-height: 1.6; }
.consent-row { display: flex; align-items: flex-start; gap: .6rem; color: #c4c2d3; font-size: .76rem; line-height: 1.55; }
.consent-row input { margin-top: .2rem; accent-color: #8977f8; }
.consent-row a { color: #b6aaff; text-decoration: none; }
.consent-row a:hover { text-decoration: underline; }
.welcome-card .auth-error { margin-top: .75rem; }
.wizard-actions { display: flex; align-items: center; gap: .7rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(202, 195, 255, .1); }
.wizard-action-spacer { flex: 1; }
.wizard-actions .submit-button { width: auto; min-width: 155px; padding: 0 1.15rem; }
.wizard-back { min-height: 46px; padding: 0 1rem; border: 1px solid rgba(202, 195, 255, .18); border-radius: 10px; background: transparent; color: #c4c2d3; font: inherit; font-size: .82rem; cursor: pointer; }
.wizard-back:hover { border-color: #9a88ff; color: white; }
.wizard-back[hidden], .wizard-actions .submit-button[hidden] { display: none; }

@media (max-width: 600px) {
  .welcome-page { justify-content: flex-start; padding: 1.25rem .75rem; }
  .welcome-card { min-height: calc(100dvh - 86px); }
  .welcome-grid { grid-template-columns: 1fr; }
  .welcome-grid .full { grid-column: auto; }
  .template-options { grid-template-columns: 1fr; }
  .avatar-template-grid { grid-template-columns: repeat(5, minmax(0, 44px)); gap: .4rem; }
  .avatar-template-option { width: 44px; height: 44px; }
  .appearance-options { grid-template-columns: 1fr; }
  .appearance-options .template-option { min-height: 62px; }
  .wizard-step { min-height: min(420px, 52dvh); }
  .summary-row { grid-template-columns: 90px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-step, .appearance-preview img { animation: none !important; }
}
