:root {
  --bg: #0c0e13;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --text: #f0f1f3;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --primary: #4f7ef8;
  --primary-dark: #3563e9;
  --green: #22c55e;
  --card-w: 440px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(79,126,248,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(139,92,246,0.10) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  overflow-y: auto;
  padding: 0;
}

.container {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
}

/* ── Hero Section (viewport penuh) ──────────────────────── */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Stats Section (scroll reveal) ──────────────────────── */
.stats-scroll {
  padding: 3rem 1rem 5rem;
  display: flex;
  justify-content: center;
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal:nth-child(6) { transition-delay: 0.40s; }
.reveal:nth-child(7) { transition-delay: 0.48s; }
.reveal:nth-child(8) { transition-delay: 0.56s; }

/* ── Page Loader ─────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.page-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}
.loader-pulse {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  animation: pagePulse 1.2s infinite ease-in-out;
}
@keyframes pagePulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0.2; }
  100% { transform: scale(0.8); opacity: 0.8; }
}

/* ── Layout ────────────────────────────────────── */
.layout-wrapper {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  justify-content: center;
}

/* ── Card Shell (fixes size) ───────────────────── */
.card-shell {
  width: var(--card-w);
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
}

/* Slider – holds step-1, step-2, step-3 */
.card-slider {
  display: flex;
  width: 300%;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-slider.show-step2 {
  transform: translateX(-33.333%);
}
.card-slider.show-step3 {
  transform: translateX(-66.666%);
}

/* ── Glass Card ─────────────────────────────────── */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 33.333%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  flex: 1;
}

/* ── Header ─────────────────────────────────────── */
.header { margin-bottom: 1.75rem; }
.header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(120deg, #7eb3ff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}
.header p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ── Form ───────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtle);
  margin-bottom: 0.5rem;
}
.form-group label span { text-transform: none; font-weight: 400; letter-spacing: 0; }

.preset-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.preset-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--subtle);
  padding: 0.5rem 0.25rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover { background: var(--surface-hover); color: var(--text); }
.preset-btn.active {
  background: rgba(79,126,248,0.15);
  border-color: var(--primary);
  color: #93bbff;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus,
input[type="number"]:focus { border-color: var(--primary); }
input::placeholder { color: var(--muted); }

.payment-methods { display: flex; gap: 0.75rem; }
.radio-label { flex: 1; cursor: pointer; }
.radio-label input { display: none; }
.radio-custom {
  display: block;
  text-align: center;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  font-size: 0.875rem;
  color: var(--subtle);
  transition: all 0.15s;
}
.radio-label input:checked + .radio-custom {
  background: rgba(79,126,248,0.15);
  border-color: var(--primary);
  color: #93bbff;
}

/* ── Buttons ────────────────────────────────────── */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  margin-top: 0.75rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { color: var(--text); background: var(--surface-hover); }

.dana-btn { text-decoration: none; margin-bottom: 0; }

/* ── Step 2 Payment ─────────────────────────────── */
.payment-container { text-align: center; padding: 0.5rem 0 1.5rem; }

#qris-image {
  width: 220px;
  height: 220px;
  border-radius: 0.75rem;
  border: 3px solid rgba(255,255,255,0.12);
  margin-bottom: 0.75rem;
}

.qris-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.status-poll {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 500;
}
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* ── Spinner ────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Leaderboard ────────────────────────────────── */
.leaderboard-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lb-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.lb-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtle);
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  transition: background 0.15s;
  animation: lbFadeIn 0.35s ease both;
}
@keyframes lbFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lb-item:hover { background: var(--surface-hover); }

.leaderboard-list.fading {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.leaderboard-list.visible {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.lb-rank {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.lb-info {
  flex: 1;
  min-width: 0;
}
.lb-comment {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}
.lb-amount {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
}

.lb-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1.5rem 0;
  list-style: none;
}

/* ── Pagination ─────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.pg-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0.4rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.pg-btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--primary); color: var(--primary); }
.pg-btn:disabled { opacity: 0.25; cursor: not-allowed; }
#lb-page-info {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 1.5rem;
  text-align: center;
}

/* ── Party / Notification ───────────────────────── */
#party-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.party-text {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.4;
  animation: bounceUp 0.5s ease-out;
}
.party-text span { font-size: 1.15rem; color: #93bbff; font-weight: 500; }
@keyframes bounceUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.notification {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 50;
  white-space: nowrap;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.hidden { display: none !important; }

/* ── Thank You Screen ───────────────────────────── */
.thankyou-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0 1.5rem;
  gap: 0.75rem;
}
.thankyou-icon {
  font-size: 3.5rem;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.thankyou-title {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(120deg, #7eb3ff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: slideUp 0.4s 0.15s ease both;
}
.thankyou-sub {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  animation: slideUp 0.4s 0.25s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Confetti ────────────────────────────────────── */
#confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.thankyou-content, #step-3 .btn-secondary {
  position: relative;
  z-index: 1;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Stats Section ───────────────────────────────────────────── */
.stats-section {
  width: 100%;
  max-width: 940px;
}
.stats-inner {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.stat-card.span-3 { grid-column: span 3; }
.stat-card.span-4 { grid-column: span 4; }
.stat-card.span-12 { grid-column: span 12; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
}
.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}
.stat-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Logs card */
.stat-logs { grid-column: span 1; }
.logs-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.log-row {
  display: grid;
  grid-template-columns: 1fr 120px 80px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.log-row:last-child { border-bottom: none; }
.log-model {
  color: var(--subtle);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-tokens { color: var(--muted); font-size: 0.75rem; text-align: center; }
.log-cost { color: var(--green); font-weight: 700; white-space: nowrap; text-align: right; font-size: 0.75rem; }
.log-time { color: var(--muted); font-size: 0.68rem; white-space: nowrap; }
.log-empty { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 0.5rem 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .layout-wrapper { flex-direction: column; align-items: center; }
  .card-shell { width: 100%; max-width: var(--card-w); align-self: auto; }
  .leaderboard-card { width: 100%; max-width: var(--card-w); min-height: 360px; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
  .stat-card.span-3, .stat-card.span-4, .stat-card.span-12 { grid-column: span 2; }
}
