:root {
  color-scheme: dark;
  --bg: #060816;
  --bg-deep: #0d1230;
  --panel: rgba(13, 19, 48, 0.76);
  --panel-strong: rgba(22, 28, 66, 0.92);
  --panel-border: rgba(151, 121, 255, 0.22);
  --text: #f6edff;
  --muted: #a6afd3;
  --muted-strong: #d5cfff;
  --gold: #f1c768;
  --gold-strong: #ffd98c;
  --violet: #8753ff;
  --blue: #2a63ff;
  --danger: #ff9fa6;
  --shadow: 0 28px 80px rgba(1, 4, 18, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -5%, rgba(255, 215, 135, 0.22), transparent 20rem),
    radial-gradient(circle at 16% 18%, rgba(90, 88, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 86% 12%, rgba(149, 64, 255, 0.24), transparent 20rem),
    linear-gradient(180deg, #060712 0%, #0a1025 42%, #090614 100%);
  color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

body.is-locked {
  overflow: hidden;
}

button {
  font: inherit;
  cursor: pointer;
}

.shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 16px 36px;
  position: relative;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 {
  font-size: 40px;
  line-height: 1.08;
}

h2 {
  font-size: 28px;
  line-height: 1.05;
}

.panel {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel--hero {
  padding: 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 16px;
  align-items: center;
}

.hero__copy {
  display: grid;
  gap: 10px;
}

.hero__lead,
.status,
.attempts__label,
.attempts__total,
.attempts__hint,
.deck-button__hint,
.history-date {
  color: var(--muted);
}

.hero__lead {
  font-size: 14px;
  line-height: 1.55;
}

.eyebrow,
.panel__eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 217, 140, 0.3);
  border-radius: 999px;
  background: rgba(241, 199, 104, 0.12);
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--soft {
  border-color: rgba(135, 83, 255, 0.2);
  background: rgba(135, 83, 255, 0.12);
  color: var(--muted-strong);
}

.orb {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto;
}

.orb__halo,
.orb__core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.orb__halo {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 216, 146, 0.38), transparent 34%),
    radial-gradient(circle at 35% 30%, rgba(123, 99, 255, 0.42), transparent 42%),
    radial-gradient(circle at 70% 70%, rgba(164, 69, 255, 0.42), transparent 48%);
  filter: blur(8px);
}

.orb__core {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.26), transparent 18%),
    radial-gradient(circle at 50% 62%, rgba(255, 213, 132, 0.28), transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(97, 61, 219, 0.9), rgba(23, 13, 66, 0.95));
  box-shadow:
    inset 0 0 32px rgba(255, 255, 255, 0.12),
    0 0 42px rgba(122, 81, 255, 0.35);
}

.orb__glyph {
  color: var(--gold-strong);
  font-size: 44px;
  text-shadow: 0 0 20px rgba(255, 217, 140, 0.42);
}

.orb__cards {
  position: absolute;
  inset: auto 0 -10px;
  display: flex;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 223, 159, 0.86);
  font-size: 17px;
}

.attempts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.attempts__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.attempts__value {
  display: block;
  color: var(--gold-strong);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 74px;
  line-height: 0.92;
}

.attempts__total {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
}

.attempts__used {
  min-width: 112px;
  padding: 18px 14px;
  border: 1px solid rgba(135, 83, 255, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(121, 72, 255, 0.16), rgba(18, 25, 62, 0.5));
  text-align: center;
}

.attempts__used-value {
  display: block;
  color: var(--muted-strong);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 42px;
  line-height: 1;
}

.attempts__used-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.progress__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(49, 101, 255, 0.95), rgba(139, 74, 255, 0.95), rgba(255, 210, 123, 0.95));
  box-shadow: 0 0 24px rgba(140, 96, 255, 0.44);
  transition: width 220ms ease;
}

.attempts__hint {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.gold-button,
.ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.gold-button {
  flex: 1 1 auto;
  background: linear-gradient(135deg, #f1c768, #ffdf98);
  color: #2b1833;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(241, 199, 104, 0.26);
}

.ghost-button {
  flex: 0 0 auto;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.gold-button:active,
.ghost-button:active {
  transform: translateY(1px) scale(0.99);
}

.is-hidden {
  display: none;
}

.is-busy {
  opacity: 0.72;
  cursor: wait;
}

.status {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.deck-list {
  display: grid;
  gap: 12px;
}

.deck-button {
  display: flex;
  min-height: 74px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 38%),
    var(--panel-strong);
  color: var(--text);
  text-align: left;
}

.deck-button.is-active {
  border-color: rgba(255, 214, 132, 0.38);
  background:
    linear-gradient(145deg, rgba(255, 230, 164, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(80, 55, 167, 0.56), rgba(19, 24, 54, 0.92));
}

.deck-button__mark {
  color: var(--gold-strong);
  font-size: 20px;
}

.deck-button__name {
  display: block;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 24px;
  line-height: 1.08;
  margin-bottom: 6px;
}

.deck-button__hint {
  display: block;
  font-size: 13px;
  line-height: 1.5;
}

.is-error {
  color: var(--danger);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 214, 133, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(21, 27, 63, 0.95), rgba(10, 14, 33, 0.95));
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.history-date {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.history-question,
.history-cards {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  line-height: 1.55;
}

.history-question span,
.history-cards span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-answer {
  color: var(--muted-strong);
  line-height: 1.65;
  white-space: pre-line;
}

.history-empty,
.history-error {
  color: var(--muted);
  text-align: center;
  padding: 20px;
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: 18px 12px max(18px, env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 18, 0.74);
  backdrop-filter: blur(10px);
}

.purchase-sheet {
  position: relative;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(54, 43, 78, 0.96), rgba(26, 21, 42, 0.98)),
    var(--panel-strong);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
}

.purchase-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-size: 24px;
  line-height: 1;
}

.purchase-group {
  margin-top: 18px;
}

.purchase-group__label {
  margin-bottom: 10px;
  color: rgba(214, 205, 238, 0.86);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.payment-method,
.purchase-option {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(18, 14, 29, 0.62);
  color: var(--text);
}

.payment-method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 16px;
  cursor: default;
}

.payment-method__check {
  color: #c7a5ff;
  font-size: 20px;
}

.purchase-options {
  display: grid;
  gap: 10px;
}

.purchase-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 16px;
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.purchase-option.is-active {
  border-color: rgba(209, 171, 255, 0.46);
  background:
    linear-gradient(180deg, rgba(132, 91, 255, 0.2), rgba(44, 26, 74, 0.78)),
    rgba(18, 14, 29, 0.86);
}

.purchase-option:active {
  transform: translateY(1px) scale(0.995);
}

.purchase-option__meta {
  display: grid;
  gap: 4px;
}

.purchase-option__title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.purchase-option__radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
}

.purchase-option.is-active .purchase-option__radio {
  border-color: rgba(234, 199, 255, 0.8);
  color: #e0b9ff;
}

.purchase-option__hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.purchase-option__price {
  color: #d6bbff;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 22px;
  white-space: nowrap;
}

.purchase-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.purchase-status {
  min-height: 40px;
  margin-top: 14px;
}

.purchase-submit {
  width: 100%;
  margin-top: 6px;
}

.purchase-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .shell {
    padding-inline: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .orb {
    width: 132px;
    height: 132px;
  }

  .attempts {
    flex-direction: column;
    align-items: stretch;
  }

  .attempts__used {
    min-width: auto;
  }

  .actions {
    flex-direction: column;
  }

  .gold-button,
  .ghost-button {
    width: 100%;
  }

  .purchase-sheet {
    padding: 18px 16px;
    border-radius: 24px;
  }

  .purchase-option {
    min-height: 68px;
    padding: 14px;
  }

  .purchase-option__title {
    font-size: 18px;
  }

  .purchase-option__price {
    font-size: 20px;
  }
}
