@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Unbounded:wght@500;700&display=swap');

:root {
  --bg: #1f2127;
  --panel: #2b2d31;
  --panel-2: #313338;
  --text: #ffffff;
  --muted: #e6e9f2;
  --accent: #5865f2;
  --accent-2: #3ba55c;
  --accent-3: #f6c343;
  --glow: rgba(88, 101, 242, 0.35);
  --radius: 22px;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  --font-main: "Space Grotesk", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Unbounded", "Space Grotesk", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 15% 15%, rgba(88,101,242,0.35), transparent 60%),
    radial-gradient(800px 500px at 85% 25%, rgba(91,188,255,0.18), transparent 60%),
    linear-gradient(145deg, #3d4188 0%, #2a2d55 35%, #171823 100%);
  color: var(--text);
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.wrap {
  width: min(860px, 100%);
}

.card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: -30% 0 auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(88,101,242,0.35), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(88,101,242,0.2);
  border: 1px solid rgba(88,101,242,0.5);
  box-shadow: 0 10px 30px rgba(88,101,242,0.25);
}

.badge svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
}

h1 {
  font-family: var(--font-display);
  letter-spacing: 0.4px;
  margin: 0 0 4px;
  font-size: clamp(22px, 3vw, 30px);
}

.subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.98rem;
}

.option-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.option-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.option-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(109,168,255,0.7);
  box-shadow: 0 16px 26px rgba(79,124,255,0.28);
}

.option-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

.option-btn.active {
  border-color: #6da8ff;
  background: linear-gradient(135deg, rgba(109,168,255,0.4), rgba(47,91,255,0.2));
  box-shadow: 0 0 0 1px rgba(109,168,255,0.6), 0 18px 40px rgba(79,124,255,0.35);
}

.opt-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: transparent;
  border: none;
  padding: 0;
}

.opt-text {
  display: grid;
  gap: 2px;
  text-align: left;
}

.opt-title {
  font-size: 0.98rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.title-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.opt-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.choices {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.choices.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choices.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(160deg, rgba(44,48,66,0.9), rgba(26,28,44,0.9));
  padding: 22px;
  text-align: center;
  border-radius: 18px;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  display: grid;
  gap: 12px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  animation: none;
}

.choice-card.animate {
  animation: card-in 0.55s ease both;
  animation-delay: var(--delay);
}

.choice-card.active.animate {
  animation: card-in 0.55s ease both, active-float 2.4s ease-in-out infinite;
  animation-delay: var(--delay), 0s;
}

.choice-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px 140px at 50% 0%, rgba(109,168,255,0.2), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.choice-card > * {
  position: relative;
  z-index: 1;
}

.choice-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(88,101,242,0.18);
  border: 1px solid rgba(88,101,242,0.5);
  color: #e8edff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.choice-card:hover {
  transform: translateY(-4px);
  border-color: rgba(109,168,255,0.6);
  box-shadow: 0 20px 36px rgba(79,124,255,0.32);
}

.choice-card.active {
  border-color: #6da8ff;
  background: linear-gradient(160deg, rgba(65,115,255,0.25), rgba(26,28,44,0.9));
  box-shadow: 0 0 0 1px rgba(109,168,255,0.6), 0 18px 36px rgba(79,124,255,0.35);
}

.choice-card:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 3px;
}

.choice-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border-radius: 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 10px 20px rgba(10,12,24,0.35);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.choice-card:hover .choice-icon {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(109,168,255,0.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 14px 26px rgba(10,12,24,0.45);
}

.choice-card.active .choice-icon {
  border-color: rgba(109,168,255,0.65);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 16px 30px rgba(79,124,255,0.35);
}

.choice-icon img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.choice-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.2;
}

.choice-title {
  color: #f4f7ff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
  font-family: var(--font-display);
}

.choice-price {
  color: var(--accent-3);
  font-size: 0.96rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(246,195,67,0.12);
  border: 1px solid rgba(246,195,67,0.45);
  box-shadow: inset 0 0 0 1px rgba(246,195,67,0.15);
  width: fit-content;
  margin: 0 auto;
}

.choice-sub {
  color: #d7defc;
  font-size: 0.93rem;
  line-height: 1.5;
  max-width: 220px;
  margin: 0 auto;
}

.actions {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.actions-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.generate-btn {
  border: none;
  background: linear-gradient(135deg, #74a6ff 0%, #4f7cff 45%, #2f5bff 100%);
  color: #fff;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 18px 35px rgba(79,124,255,0.45), 0 0 24px rgba(116,166,255,0.45);
  transition: transform .18s ease, box-shadow .18s ease, opacity .2s;
  animation: blue-pulse 2.4s ease-in-out infinite;
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(79,124,255,0.55), 0 0 30px rgba(116,166,255,0.55);
}

.generate-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.ghost-btn {
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.hidden { display: none; }

.progress {
  margin-top: 24px;
  display: grid;
  gap: 14px;
  place-items: center;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 18px var(--glow);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes blue-pulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 18px 35px rgba(79,124,255,0.45), 0 0 24px rgba(116,166,255,0.45);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px rgba(79,124,255,0.6), 0 0 32px rgba(116,166,255,0.6);
  }
}

.status {
  color: var(--muted);
  font-size: 0.98rem;
}

.status-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.bar {
  width: min(420px, 100%);
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #7b86ff);
  transition: width 0.4s ease;
  box-shadow: 0 0 18px rgba(88,101,242,0.4);
}

.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 18, 0.7);
  backdrop-filter: blur(8px);
  padding: 24px;
  z-index: 20;
}

.modal-card {
  width: min(420px, 100%);
  background: linear-gradient(160deg, rgba(40,42,60,0.95), rgba(24,26,38,0.95));
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 24px 50px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  display: grid;
  gap: 12px;
}

.modal-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.modal-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.input-label {
  font-size: 0.85rem;
  color: var(--muted);
}

#username-input {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(10,12,18,0.6);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: var(--font-main);
}

#username-input:focus {
  outline: 2px solid rgba(122,134,255,0.6);
  border-color: rgba(122,134,255,0.6);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  body {
    align-items: flex-start;
    padding: 20px;
  }
  .card {
    padding: 20px;
    border-radius: 18px;
  }
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .option-row {
    grid-template-columns: 1fr;
  }
  .option-btn {
    justify-content: flex-start;
    padding: 14px 16px;
  }
  .title-icon {
    width: 30px;
    height: 30px;
  }
  .choices.two,
  .choices.three {
    grid-template-columns: 1fr;
  }
  .choice-card {
    min-height: 0;
  }
  .choice-icon {
    width: 72px;
    height: 72px;
  }
  .choice-icon img {
    width: 46px;
    height: 46px;
  }
  .progress-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .bar {
    width: 100%;
  }
  .actions {
    width: 100%;
  }
  .generate-btn {
    width: 100%;
  }
  .modal-card {
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }
  .card {
    padding: 16px;
    border-radius: 16px;
  }
  h1 {
    font-size: 1.25rem;
  }
  .subtitle {
    font-size: 0.9rem;
  }
  .option-btn {
    padding: 12px 14px;
  }
  .choice-card {
    padding: 18px;
  }
  .choice-title {
    font-size: 1rem;
  }
  .choice-sub {
    font-size: 0.9rem;
  }
  .status,
  .status-sub {
    font-size: 0.9rem;
  }
}

.modal.hidden {
  display: none;
}

.modal-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.2em;
}

#username-input.validated {
  border-color: rgba(59, 165, 92, 0.9);
  outline: 2px solid rgba(59, 165, 92, 0.6);
  box-shadow: 0 0 0 2px rgba(59, 165, 92, 0.2), 0 0 18px rgba(59, 165, 92, 0.35);
  animation: input-validated 0.55s ease-out;
}

.generate-btn.is-valid {
  background: linear-gradient(135deg, #41c66f 0%, #3ba55c 45%, #248a45 100%);
  box-shadow: 0 18px 35px rgba(59, 165, 92, 0.45), 0 0 24px rgba(65, 198, 111, 0.45);
  animation: confirm-pop 0.5s ease-out;
}

@keyframes input-validated {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes confirm-pop {
  0% {
    transform: translateY(0) scale(1);
  }
  60% {
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes card-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


body.page-ready .card {
  animation: page-card 0.7s ease both;
}

body.page-ready .header {
  animation: fade-up 0.6s ease both;
}

body.page-ready .option-row {
  animation: fade-up 0.6s 0.1s ease both;
}

body.page-ready #screen-2 {
  animation: fade-up 0.6s 0.18s ease both;
}

body.page-ready .actions {
  animation: fade-up 0.6s 0.26s ease both;
}

body.page-ready .progress {
  animation: fade-up 0.6s 0.26s ease both;
}

body.page-ready footer {
  animation: fade-up 0.6s 0.4s ease both;
}

.option-btn {
  position: relative;
  overflow: hidden;
}

.option-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  opacity: 0;
}

.option-btn:hover::after {
  animation: sheen 0.8s ease;
}

.choice-card.active {
  animation: active-float 2.4s ease-in-out infinite;
}

.actions-note {
  animation: fade-up 0.5s ease both;
}

#username-input {
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#username-input:focus {
  transform: translateY(-1px);
}

.modal {
  animation: modal-fade 0.25s ease both;
}

.modal-card {
  animation: modal-pop 0.35s ease both;
}

.progress-row {
  animation: fade-up 0.4s ease both;
}

.bar {
  animation: grow-in 0.4s ease both;
}

@keyframes page-card {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-up {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sheen {
  0% {
    opacity: 0;
    transform: translateX(-120%);
  }
  15% {
    opacity: 0.5;
  }
  60% {
    opacity: 0.2;
  }
  100% {
    opacity: 0;
    transform: translateX(120%);
  }
}

@keyframes active-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes modal-fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes modal-pop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes grow-in {
  0% {
    opacity: 0;
    transform: scaleX(0.85);
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}
