@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #F3F5F9;
  --panel: #12151D;
  --panel-raised: #161B2C;
  --hairline: #232A3D;
  --gold: #3B82F6;
  --gold-bright: #60A5FA;
  --paper: #F3F5F9;
  --muted: #8B93A7;
  --sage: #22C55E;
  --danger: #F87171;
  --page-bg: #060810;

  --glass-bg: rgba(22, 27, 44, 0.42);
  --glass-bg-soft: rgba(255, 255, 255, 0.035);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-blur: blur(28px) saturate(150%);

  --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 16px 40px rgba(0,0,0,0.4);
  --shadow-raised: 0 0 0 1px rgba(59,130,246,0.4), 0 10px 32px rgba(59,130,246,0.2);
  --glow: 0 0 20px rgba(59,130,246,0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }

body.ledger-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 560px at 12% -8%, rgba(59,130,246,0.22), transparent 55%),
    radial-gradient(900px 500px at 105% 10%, rgba(96,165,250,0.14), transparent 55%),
    radial-gradient(700px 500px at 50% 80%, rgba(37,99,235,0.10), transparent 60%),
    var(--page-bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #fff; }

a { color: var(--gold-bright); }

.ledger-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 96px;
}

.ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 24px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--glass-border);
  animation: rise 0.6s var(--ease) both;
}

.brand-mark { display: flex; flex-direction: column; gap: 2px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-sub { font-size: 13px; color: var(--muted); }

.ledger-folio {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.hero { margin-bottom: 44px; animation: rise 0.7s 0.05s var(--ease) both; }
.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-eyebrow::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 10px 2px rgba(96,165,250,0.6);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  max-width: 17ch;
  color: var(--ink);
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--gold-bright), #93C5FD);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { max-width: 56ch; color: var(--muted); font-size: 16px; }

/* ---------------------------------------------------------------------- */
/* The glass wizard card — one continuous frosted panel for all steps      */
/* ---------------------------------------------------------------------- */

.wizard-card {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 36px 40px 40px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: rise 0.7s 0.1s var(--ease) both;
}
.wizard-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}
.wizard-card::after {
  content: '';
  position: absolute; top: -40%; left: -10%; width: 55%; height: 90%;
  background: radial-gradient(circle, rgba(59,130,246,0.14), transparent 65%);
  pointer-events: none;
}
@media (max-width: 640px) {
  .wizard-card { padding: 24px 20px 28px; border-radius: 18px; }
}

/* ---------------------------------------------------------------------- */
/* Connected progress track                                                */
/* ---------------------------------------------------------------------- */

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.progress-labels span { transition: color 0.3s; }
.progress-labels span.is-current { color: var(--gold-bright); font-weight: 700; }
.progress-labels span.is-done { color: var(--sage); }

.progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  margin-bottom: 36px;
  overflow: visible;
  z-index: 1;
}
.progress-fill {
  position: absolute;
  top: 0; left: 0; height: 100%;
  width: 10%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: var(--glow);
  transition: width 0.5s var(--ease);
}
.progress-dot {
  position: absolute;
  top: 50%; left: 10%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(96,165,250,0.25), var(--glow);
  transform: translate(-50%, -50%);
  transition: left 0.5s var(--ease);
}

/* ---------------------------------------------------------------------- */
/* Steps — single step visible at a time, glass-focus transition           */
/* ---------------------------------------------------------------------- */

.entry {
  display: none;
  padding: 0;
  position: relative;
  z-index: 1;
}
.entry.is-active {
  display: block;
  animation: step-in 0.5s var(--ease) both;
}
.entry.is-leaving {
  animation: step-out 0.22s var(--ease) both;
}

@keyframes step-in {
  from { opacity: 0; transform: translateX(20px); filter: blur(6px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes step-out {
  from { opacity: 1; transform: translateX(0); filter: blur(0); }
  to { opacity: 0; transform: translateX(-20px); filter: blur(6px); }
}

.entry-index { display: none; }
.entry-number { display: none; }

.entry-body { padding-bottom: 0; }
.entry-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.entry-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--ink);
}

/* ---------------------------------------------------------------------- */
/* Tier cards — nested glass                                               */
/* ---------------------------------------------------------------------- */

.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .tier-grid { grid-template-columns: 1fr; } }

.tier-card {
  position: relative;
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 20px 18px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  text-align: left;
}
.tier-card:hover { transform: translateY(-2px); border-color: rgba(96,165,250,0.4); background: rgba(255,255,255,0.055); }
.tier-card.is-selected {
  border-color: var(--gold);
  background: rgba(59,130,246,0.1);
  box-shadow: var(--shadow-raised);
}
.tier-card.is-selected::after {
  content: '\2713';
  position: absolute; top: 14px; right: 14px;
  color: #fff; font-size: 11px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(59,130,246,0.6);
}
.tier-name { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--ink); }
.tier-tagline { font-size: 13px; color: var(--muted); margin: 0 0 18px; min-height: 34px; }
.tier-meta { display: flex; justify-content: space-between; align-items: baseline; }
.tier-price { color: var(--gold-bright); font-size: 19px; font-weight: 700; font-family: var(--font-display); }
.tier-duration { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }

/* ---------------------------------------------------------------------- */
/* Fields                                                                   */
/* ---------------------------------------------------------------------- */

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

input[type=text], input[type=email], input[type=tel], input[type=date], textarea, select {
  width: 100%;
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--ink);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(59,130,246,0.06);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
textarea { resize: vertical; min-height: 80px; }

/* Belt-and-braces for the native <select> popup: color-scheme above handles
   this in most modern browsers, but some only partially honor it for the
   dropdown *list* (as opposed to the closed control) — explicit option
   colors guarantee readable text either way instead of white-on-white. */
select option {
  color: #0F172A;
  background: #fff;
}

/* The native date-picker calendar icon renders black by default, which is
   invisible on a dark field. IMPORTANT: <html> above sets color-scheme:dark
   globally, which makes some Chromium versions draw the icon light already —
   if that happens, invert(1) below flips it right back to black. Forcing
   color-scheme:light on just this input guarantees the browser always draws
   its default *dark* glyph first, so the invert() that follows reliably
   turns it white regardless of browser/version. */
input[type=date] {
  color-scheme: light;
}
input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.3);
  cursor: pointer;
  border-radius: 4px;
}
input[type=date]::-webkit-calendar-picker-indicator:hover {
  background: rgba(255,255,255,0.08);
}

.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
@media (max-width: 640px) { .slot-grid { grid-template-columns: repeat(2, 1fr); } }

.slot-btn {
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.slot-btn:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.slot-btn.is-selected { border-color: var(--gold); background: var(--gold); color: #fff; box-shadow: 0 0 14px rgba(59,130,246,0.45); }
.slot-btn:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

/* ---------------------------------------------------------------------- */
/* Payment                                                                  */
/* ---------------------------------------------------------------------- */

.payment-banner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(59,130,246,0.09);
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  color: var(--gold-bright);
  font-weight: 500;
}
.payment-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-bright); flex-shrink: 0; box-shadow: 0 0 8px rgba(96,165,250,0.6); }
.payment-banner select {
  width: auto;
  margin-left: auto;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 400;
  background: rgba(255,255,255,0.06);
}

.wallet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 720px) { .wallet-grid { grid-template-columns: 1fr; } }

.wallet-card {
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.2s, background 0.2s;
}
.wallet-card:hover { border-color: rgba(96,165,250,0.35); background: rgba(255,255,255,0.05); }
.wallet-card img { width: 60px; height: 60px; border-radius: 8px; flex-shrink: 0; border: 1px solid var(--glass-border); }
.wallet-coin { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin: 0 0 2px; color: var(--ink); }
.wallet-network { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.wallet-address {
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
  color: var(--ink);
}
.wallet-note { font-size: 11px; color: var(--muted); line-height: 1.4; }
.copy-btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(96,165,250,0.3);
  color: var(--gold-bright);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.copy-btn:hover { border-color: var(--gold); }
.copy-btn.is-copied { color: var(--sage); border-color: var(--sage); background: rgba(34,197,94,0.12); }

.bank-card {
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 22px;
}
.bank-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--glass-border); font-size: 13px; }
.bank-row:last-child { border-bottom: none; }
.bank-row span:first-child { color: var(--muted); }
.bank-row span:last-child { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                  */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  padding: 13px 24px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--gold), #2563EB); color: #fff; box-shadow: 0 4px 18px rgba(59,130,246,0.4); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(59,130,246,0.55); }
.btn-primary:disabled { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--glass-border); box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--glass-bg-soft); color: var(--ink); border-color: var(--glass-border); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(59,130,246,0.08); }

.step-actions { display: flex; gap: 12px; margin-top: 28px; }

/* ---------------------------------------------------------------------- */
/* Confirmation + stamp (nested inside the glass wizard-card)              */
/* ---------------------------------------------------------------------- */

.confirmation {
  padding: 8px 0 0;
  position: relative;
  overflow: visible;
}
.confirmation-ref { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.confirmation h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin: 0 0 20px; color: var(--ink); }

.stamp {
  position: absolute;
  top: 0; right: 0;
  width: 108px; height: 108px;
  border: 3px solid var(--sage);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--sage);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-10deg) scale(2.2);
  opacity: 0;
  background: rgba(34,197,94,0.1);
  backdrop-filter: blur(8px);
}
.stamp.stamp-play {
  animation: stamp-hit 0.5s cubic-bezier(.2,1.6,.4,1) 0.15s forwards;
}
.stamp-ink {
  position: absolute;
  inset: -5px;
  border: 3px solid var(--sage);
  border-radius: 50%;
  opacity: 0;
}
.stamp.stamp-play .stamp-ink { animation: ink-bleed 0.5s ease-out 0.5s forwards; }

@keyframes stamp-hit {
  0% { opacity: 0; transform: rotate(-10deg) scale(2.2); }
  60% { opacity: 1; transform: rotate(-10deg) scale(0.94); }
  100% { opacity: 1; transform: rotate(-10deg) scale(1); }
}
@keyframes ink-bleed {
  0% { opacity: 0.4; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3); }
}

/* ---------------------------------------------------------------------- */
/* Lookup                                                                   */
/* ---------------------------------------------------------------------- */

.lookup-panel {
  margin-top: 56px;
  padding: 32px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.04);
}
.status-pill.pending { color: #FBBF24; border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.08); }
.status-pill.confirmed { color: var(--sage); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
.status-pill.cancelled { color: var(--danger); border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.08); }

/* ---------------------------------------------------------------------- */
/* Message banners                                                         */
/* ---------------------------------------------------------------------- */

.msg { border-radius: 8px; padding: 12px 16px; font-size: 13px; margin-top: 14px; display: none; }
.msg.is-visible { display: block; animation: rise 0.3s var(--ease) both; }
.msg.error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.35); color: #FCA5A5; }
.msg.info { background: rgba(59,130,246,0.08); border: 1px solid rgba(96,165,250,0.3); color: var(--gold-bright); }

/* ---------------------------------------------------------------------- */
/* Error page                                                              */
/* ---------------------------------------------------------------------- */

.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.error-card {
  text-align: center; max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 36px;
}
.error-card .eyebrow { color: var(--gold-bright); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.error-card h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
.error-card p { color: var(--muted); margin-bottom: 24px; }

/* ---------------------------------------------------------------------- */
/* Motion + accessibility                                                  */
/* ---------------------------------------------------------------------- */

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

:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                               */
/* ---------------------------------------------------------------------- */

@media (max-width: 640px) {
  .ledger-shell { padding: 0 16px 64px; }
  .ledger-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 24px 0 20px;
  }
  .ledger-folio { text-align: left; }
  .hero { margin-bottom: 32px; }
  .hero h1 { max-width: none; }
  .progress-labels { font-size: 11px; }
  .step-actions { flex-direction: column-reverse; }
  .step-actions .btn { width: 100%; justify-content: center; }
  .wallet-card { flex-direction: column; }
  .wallet-card img { width: 48px; height: 48px; }
  .payment-banner { flex-wrap: wrap; }
  .payment-banner select { margin-left: 0; width: 100%; }
  .lookup-panel { padding: 22px 20px; margin-top: 40px; }
}

@media (max-width: 400px) {
  .tier-meta { flex-direction: column; align-items: flex-start; gap: 4px; }
  .progress-labels span { font-size: 10px; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .wizard-card, .lookup-panel, .error-card { background: #12151D; }
}
