:root {
  color-scheme: dark;
  --bg: #070815;
  --panel: rgba(19, 23, 48, 0.82);
  --panel-strong: rgba(28, 34, 70, 0.96);
  --text: #f5f7ff;
  --muted: #aeb7d9;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #8f7cff;
  --accent-2: #36e7c4;
  --warning: #ffd166;
  --success: #58f29b;
  --danger: #ff6b81;
  --glow: 0 0 0 4px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(143, 124, 255, 0.34), transparent 34rem),
    radial-gradient(circle at 90% 15%, rgba(54, 231, 196, 0.18), transparent 28rem),
    linear-gradient(135deg, #070815 0%, #0b1022 48%, #111735 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

/* Animated aurora blobs behind everything, subtly parallaxed by mouse in app.js */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.blob-1 { width: 30rem; height: 30rem; left: -8rem; top: -6rem; background: radial-gradient(circle, rgba(143,124,255,0.55), transparent 70%); animation: drift-1 22s ease-in-out infinite; }
.blob-2 { width: 26rem; height: 26rem; right: -6rem; top: 10rem; background: radial-gradient(circle, rgba(54,231,196,0.4), transparent 70%); animation: drift-2 26s ease-in-out infinite; }
.blob-3 { width: 22rem; height: 22rem; left: 30%; bottom: -10rem; background: radial-gradient(circle, rgba(255,209,102,0.22), transparent 70%); animation: drift-3 30s ease-in-out infinite; }

@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3rem, 2rem) scale(1.08); }
}
@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-2.5rem, 3rem) scale(1.05); }
}
@keyframes drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(2rem, -1.5rem) scale(1.1); }
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
  position: relative;
  z-index: 1;
}

.narrow { width: min(860px, calc(100% - 32px)); }

.hero-card, .status-card, .result-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 100px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(20px);
  border-radius: 28px;
}

.hero-card { padding: 34px; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 32px;
  align-items: stretch;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 800;
  margin: 0 0 12px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.3rem, 7vw, 5rem); line-height: 0.92; letter-spacing: -0.06em; margin-bottom: 20px; }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.04em; }
h3 { font-size: 1.22rem; line-height: 1.3; }

.lede {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 62ch;
}

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.badges span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #dfe5ff;
  background: rgba(255,255,255,0.055);
}

.input-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label { font-weight: 800; color: #f7f8ff; }

.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.char-count { font-size: 0.78rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.char-count.near-limit { color: var(--warning); }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0,0,0,0.24);
  color: var(--text);
  padding: 16px;
  font: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(54, 231, 196, 0.12); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--accent-2); color: var(--text); background: rgba(54,231,196,0.1); transform: translateY(-1px); }
.chip:active { transform: translateY(0) scale(0.97); }

button, .button-link, .big-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 900;
  font-size: 1rem;
  text-decoration: none;
  color: #061018;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-2), #b8ff6a);
  box-shadow: 0 12px 34px rgba(54, 231, 196, 0.22);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
button:hover:not(:disabled), .button-link:not(.disabled):hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(54, 231, 196, 0.32); }
button:active:not(:disabled), .button-link:not(.disabled):active { transform: translateY(0) scale(0.98); }
button:disabled { cursor: wait; opacity: 0.72; }
.button-link.disabled { pointer-events: none; opacity: 0.5; filter: grayscale(1); }

/* Connect the user's own Preferences AI account */
.connect-account.hidden { display: none !important; }
.connect-account { margin-top: 14px; }
.connect-account label { display: block; margin: 8px 0 6px; }
.connect-account #pai-key {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  background: rgba(8, 17, 31, 0.55);
  color: var(--text, #edf4ff);
  font: inherit;
  letter-spacing: 0.04em;
}
.connect-account #pai-key:focus {
  outline: none;
  border-color: var(--accent-strong, #38bdf8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

/* OKX Wallet crypto payment */
.crypto-pay.hidden { display: none !important; }
.pay-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}
.pay-divider::before, .pay-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.okx-btn {
  width: 100%;
  color: #f7f8ff;
  background: linear-gradient(135deg, #1a1c2e, #050608);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
}
.okx-btn:hover:not(:disabled) { box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55); }
.okx-glyph {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--accent-2);
  transform: rotate(0deg);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(6, 16, 24, 0.35);
  animation: ripple-anim 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(3.2); opacity: 0; }
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(6,16,24,0.28);
  border-top-color: #061018;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

.cta-pulse { animation: cta-glow 2.4s ease-in-out infinite; }
@keyframes cta-glow {
  0%, 100% { box-shadow: 0 12px 34px rgba(54, 231, 196, 0.22); }
  50% { box-shadow: 0 16px 52px rgba(54, 231, 196, 0.5); }
}

.fine-print, .muted { color: var(--muted); line-height: 1.55; }
.fine-print { font-size: 0.9rem; margin-bottom: 0; }

.status-card {
  margin-top: 20px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.status-head { display: flex; align-items: center; gap: 16px; }
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; font-weight: 700; }

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.progress-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  opacity: 0.55;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.progress-steps li .step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}
.progress-steps li.active { opacity: 1; color: var(--text); }
.progress-steps li.active .step-dot {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(54, 231, 196, 0.14);
}
.progress-steps li.active .step-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { transform: scale(0.8); opacity: 0.7; } 50% { transform: scale(1.15); opacity: 1; } }
.progress-steps li.done { opacity: 1; color: #d9ffe9; }
.progress-steps li.done .step-dot {
  border-color: var(--success);
  background: var(--success);
  color: #06331c;
  transform: scale(1);
}
.progress-steps li.done .step-dot::before { content: "✓"; font-weight: 900; }

.hidden { display: none !important; }

/* Reveal-on-render animation for result cards */
.reveal {
  animation: fade-in-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}
.result-card {
  padding: 24px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.result-card.tilt:hover {
  border-color: rgba(54, 231, 196, 0.35);
  box-shadow: 0 28px 90px rgba(0,0,0,0.4);
}
.full { grid-column: 1 / -1; }
.summary-list { display: grid; gap: 12px; padding-left: 20px; color: #e7ebff; line-height: 1.55; }
.summary-list li { animation: fade-in-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }

.metric span { display: block; font-size: 2.7rem; font-weight: 950; color: var(--accent-2); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; }
.affinity-track {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.affinity-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.asset-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 24px;
  align-items: start;
}
.asset-list { display: grid; gap: 12px; margin: 18px 0 0; }
.asset-list div { border-top: 1px solid var(--line); padding-top: 12px; }
dt { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; }
dd { margin: 4px 0 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #f6f8ff; display: flex; align-items: center; gap: 8px; }

.copy-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--accent-2); border-color: var(--accent-2); transform: none; box-shadow: none; }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

.unlock-panel { border: 1px solid var(--line); border-radius: 22px; padding: 20px; background: rgba(255,255,255,0.06); }
.unlock-panel p { color: var(--muted); line-height: 1.55; }

.unlock-card { border-radius: 22px; padding: 22px; margin-bottom: 18px; }
.unlock-card.success { border: 1px solid rgba(88,242,155,0.4); background: rgba(88,242,155,0.09); }
.unlock-card.warning { border: 1px solid rgba(255,209,102,0.45); background: rgba(255,209,102,0.08); }
.big-link { margin: 8px 10px 0 0; }
.back-link { color: var(--accent-2); display: inline-block; margin-bottom: 16px; text-decoration: none; font-weight: 800; }
code { color: var(--accent-2); }

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100% - 40px));
}
.toast {
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 18px 60px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.leaving { animation: toast-out 0.3s ease forwards; }
.toast strong { display: block; margin-bottom: 2px; }
.toast p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.toast.error { border-color: rgba(255,107,129,0.45); }
.toast.error strong { color: var(--danger); }
.toast.success { border-color: rgba(88,242,155,0.4); }
.toast.success strong { color: var(--success); }
.toast-close { margin-left: auto; background: none; border: none; box-shadow: none; color: var(--muted); padding: 0; font-size: 1rem; cursor: pointer; }
.toast-close:hover { color: var(--text); transform: none; box-shadow: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* Confetti */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -20px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.3; }
}

@media (max-width: 820px) {
  .split, .result-grid, .asset-card { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .hero-card { padding: 22px; }
  h1 { font-size: 3rem; }
  .toast-stack { right: 12px; bottom: 12px; left: 12px; width: auto; }
}
