*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --purple-light: #c084fc;
  --purple-mid: #7c3aed;
  --purple-dark: #4f46e5;
  --text: #e8d5ff;
  --text-muted: #9d7abf;
  --bg: #0a0015;
  --card-bg: #110020;
}

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1e0540 0%, #0a0015 55%, #000 100%);
  color: var(--text);
  font-family: 'Cinzel', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem 4rem;
}

/* ─── Header ─────────────────────────────── */

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  background: linear-gradient(135deg, #a78bfa, #c084fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ─── Sphere ──────────────────────────────── */

.sphere-wrapper {
  position: relative;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sphere {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #252525 0%, #0e0e0e 35%, #000 70%);
  box-shadow:
    inset -18px -18px 35px rgba(0, 0, 0, 0.95),
    inset 4px 4px 12px rgba(255, 255, 255, 0.04),
    0 0 70px rgba(124, 58, 237, 0.35),
    0 0 140px rgba(124, 58, 237, 0.12),
    0 30px 60px rgba(0, 0, 0, 0.8);
  position: relative;
  cursor: default;
  user-select: none;
}

/* Specular highlight */
.highlight {
  position: absolute;
  top: 11%;
  left: 17%;
  width: 34%;
  height: 21%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 60%, transparent 100%);
  border-radius: 50%;
  transform: rotate(-28deg);
  pointer-events: none;
}

/* Blue answer window */
.answer-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #1e3a8a 0%, #0c1a5c 55%, #060d2e 100%);
  border: 1px solid rgba(99, 149, 237, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 0 24px rgba(0, 40, 180, 0.6),
    0 0 12px rgba(30, 58, 138, 0.25);
}

.answer-text {
  color: #c8d9ff;
  font-size: 3.2rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  text-shadow: 0 0 24px rgba(100, 150, 255, 0.9);
  padding: 8px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.answer-text.small {
  font-size: clamp(0.6rem, 2.5vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
}

.sphere-shadow {
  width: 200px;
  height: 20px;
  background: radial-gradient(ellipse, rgba(80, 0, 160, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  margin-top: 12px;
}

/* ─── Form ────────────────────────────────── */

.question-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 1rem;
}

.question-form input {
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: 50px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.question-form input:focus {
  border-color: rgba(192, 132, 252, 0.6);
  box-shadow: 0 0 22px rgba(192, 132, 252, 0.18);
}

.question-form input::placeholder {
  color: rgba(192, 132, 252, 0.35);
}

.ask-btn {
  padding: 0.85rem 2.5rem;
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-dark));
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 22px rgba(124, 58, 237, 0.45);
}

.ask-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.65);
}

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

.hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  min-height: 1.2em;
  text-align: center;
}

/* ─── Payment overlay ─────────────────────── */

.payment-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.payment-overlay.show {
  display: flex;
}

.payment-card {
  position: relative;
  background: linear-gradient(160deg, #160030, #0a0018);
  border: 1px solid rgba(192, 132, 252, 0.28);
  border-radius: 1.5rem;
  padding: 2rem 1.75rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 80px rgba(124, 58, 237, 0.3);
  animation: slideUp 0.3s ease;
}

.payment-card h2 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.payment-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.payment-desc strong {
  color: var(--purple-light);
}

.qr-wrapper {
  background: #fff;
  border-radius: 1rem;
  padding: 0.85rem;
  display: inline-block;
  margin-bottom: 1.25rem;
}

.invoice-raw {
  font-family: monospace;
  font-size: 0.6rem;
  color: #6b4f8a;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(192, 132, 252, 0.12);
  border-radius: 0.5rem;
  padding: 0.65rem;
  margin-bottom: 1rem;
  max-height: 52px;
  overflow: hidden;
  cursor: pointer;
  transition: color 0.2s;
}

.invoice-raw:hover {
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.copy-btn,
.wallet-btn {
  padding: 0.55rem 1.3rem;
  border-radius: 50px;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.copy-btn {
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.35);
  color: var(--purple-light);
}

.copy-btn:hover {
  background: rgba(192, 132, 252, 0.22);
}

.wallet-btn {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.wallet-btn:hover {
  background: rgba(99, 102, 241, 0.25);
}

.waiting {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.spinner {
  display: inline-block;
  animation: spin 1.2s linear infinite;
  font-size: 1.1rem;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text);
}

/* ─── Animations ──────────────────────────── */

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10%       { transform: rotate(-7deg) scale(1.02); }
  25%       { transform: rotate(7deg) scale(1.04); }
  40%       { transform: rotate(-5deg) scale(1.03); }
  55%       { transform: rotate(5deg) scale(1.02); }
  70%       { transform: rotate(-3deg) scale(1.01); }
  85%       { transform: rotate(3deg) scale(1.01); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 70px rgba(124, 58, 237, 0.35), 0 0 140px rgba(124, 58, 237, 0.12), 0 30px 60px rgba(0, 0, 0, 0.8); }
  50%       { box-shadow: 0 0 90px rgba(192, 132, 252, 0.55), 0 0 180px rgba(192, 132, 252, 0.2),  0 30px 60px rgba(0, 0, 0, 0.8); }
}

@keyframes revealText {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.sphere.thinking {
  animation: pulseGlow 1.8s ease-in-out infinite;
}

.sphere.shaking {
  animation: shake 0.75s ease-in-out;
}

.answer-text.revealed {
  animation: revealText 0.5s ease-out forwards;
}

/* ─── Responsive ──────────────────────────── */

@media (max-width: 360px) {
  .sphere {
    width: 240px;
    height: 240px;
  }
  .answer-window {
    width: 112px;
    height: 112px;
  }
}
