:root {
  --bg: #130d1f;
  --panel: rgba(255, 248, 255, 0.95);
  --text: #24152f;
  --muted: #75657f;
  --line: #eadcf0;
  --accent: #8b4fd6;
  --accent-dark: #5c2f98;
  --danger: #9d2b2b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 16%, rgba(154, 91, 255, 0.48), transparent 28rem),
    radial-gradient(circle at 80% 80%, rgba(73, 214, 255, 0.22), transparent 28rem),
    linear-gradient(135deg, #120b1f, #23103d 54%, #080611);
}

button, textarea { font: inherit; }

.shell {
  min-height: 100vh;
  width: min(700px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 34px;
  padding: clamp(24px, 6vw, 46px);
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: -120px auto auto -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(139, 79, 214, 0.12);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 850;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(40px, 8vw, 78px);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.ritual-text {
  max-width: 520px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: clamp(13px, 2vw, 15px);
  line-height: 1.36;
}

.ritual-list {
  margin: 0;
  padding-left: 1.12rem;
  text-align: left;
}

.ritual-list li {
  margin: 0 0 5px;
}

.ritual-list li:last-child {
  margin-bottom: 0;
}

.ritual-list strong {
  color: var(--text);
  font-weight: 760;
}

.ritual-list li::marker {
  color: rgba(139, 79, 214, 0.82);
  font-weight: 760;
}

textarea {
  width: 100%;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.74);
  outline: none;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 79, 214, 0.16);
  background: #fff;
}


.active-instruction {
  width: 100%;
  margin: 18px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(139, 79, 214, 0.34);
  border-radius: 24px;
  color: #fff8ff;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.24), transparent 12rem),
    linear-gradient(135deg, rgba(139, 79, 214, 0.95), rgba(46, 20, 86, 0.96));
  box-shadow:
    0 16px 40px rgba(72, 29, 123, 0.26),
    0 0 0 4px rgba(139, 79, 214, 0.08);
  text-align: left;
  animation:
    instructionEntrance 480ms ease both,
    instructionGlow 2.4s ease-in-out infinite;
}

.active-instruction[hidden] {
  display: none;
}

.active-instruction-label {
  display: block;
  margin: 0 0 6px;
  color: rgba(255, 248, 255, 0.78);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 900;
}

.active-instruction p {
  margin: 0;
  color: #fff;
  font-size: clamp(14px, 2.15vw, 16px);
  line-height: 1.36;
  font-weight: 740;
  letter-spacing: -0.02em;
}

.oracle-button {
  width: min(310px, 100%);
  margin: 26px auto 0;
  min-height: 310px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease;
}

.oracle-button:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.015);
  filter: saturate(1.1);
}

.oracle-button:active:not(:disabled),
.oracle-button.pressed {
  transform: scale(0.965);
}

.oracle-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.crystal-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: -1;
}

.crystal-ball {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,0.96), rgba(255,255,255,0.18) 14%, transparent 22%),
    radial-gradient(circle at 50% 48%, rgba(204, 247, 255, 0.96), rgba(160, 105, 255, 0.82) 46%, rgba(56, 24, 105, 0.94) 76%, rgba(22, 8, 45, 1));
  box-shadow:
    inset 0 9px 26px rgba(255, 255, 255, 0.78),
    inset 0 -28px 44px rgba(20, 6, 47, 0.62),
    0 0 24px rgba(167, 118, 255, 0.72),
    0 0 80px rgba(73, 214, 255, 0.28),
    0 30px 70px rgba(49, 18, 91, 0.38);
}

.crystal-ball::before {
  content: '';
  position: absolute;
  inset: 17%;
  border-radius: 46% 54% 45% 55%;
  background: radial-gradient(circle, rgba(255,255,255,0.38), transparent 62%);
  animation: drift 7s ease-in-out infinite alternate;
}

.crystal-ball::after {
  content: '';
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.34), transparent, rgba(98, 224, 255, 0.24), transparent);
  animation: rotateAura 8s linear infinite;
  mix-blend-mode: screen;
}

.crystal-glow {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.46), rgba(105, 218, 255, 0.26) 42%, transparent 68%);
  animation: pulse 2.8s ease-in-out infinite;
}

.crystal-shine {
  position: absolute;
  top: 36px;
  left: 52px;
  width: 58px;
  height: 26px;
  border-radius: 50%;
  transform: rotate(-28deg);
  background: rgba(255,255,255,0.78);
  filter: blur(1px);
}

.crystal-mist {
  position: absolute;
  width: 190px;
  height: 56px;
  left: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  filter: blur(5px);
  opacity: 0.7;
}

.mist-one { top: 88px; animation: mistSlide 5s ease-in-out infinite alternate; }
.mist-two { top: 128px; animation: mistSlide 6.2s ease-in-out infinite alternate-reverse; }

.crystal-base {
  position: absolute;
  width: 152px;
  height: 42px;
  top: 218px;
  border-radius: 50%;
  background: linear-gradient(180deg, #53306f, #24102e);
  box-shadow: 0 18px 28px rgba(28, 7, 46, 0.34);
}

.button-text {
  position: relative;
  z-index: 2;
  margin-top: 188px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 8, 34, 0.56);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.oracle-button.spark .crystal-ball {
  animation: crystalPress 520ms ease;
}

.oracle-button.spark::after {
  content: '';
  position: absolute;
  inset: 21px;
  border-radius: 50%;
  border: 2px solid rgba(213, 247, 255, 0.88);
  animation: ripple 680ms ease-out;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.result-panel {
  margin-top: 24px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.interpretation {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  line-height: 1.62;
  white-space: pre-wrap;
}

.interpretation.loading { color: var(--muted); }


.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 4, 14, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.modal[hidden] {
  display: none;
}

.modal.show {
  opacity: 1;
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 30px;
  padding: clamp(20px, 4vw, 28px);
  color: #fff8ff;
  background:
    radial-gradient(circle at 22% 10%, rgba(192, 131, 255, 0.32), transparent 18rem),
    linear-gradient(145deg, rgba(36, 17, 64, 0.98), rgba(16, 8, 32, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  text-align: left;
  transform: translateY(8px) scale(0.98);
  transition: transform 180ms ease;
}

.modal.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-eyebrow {
  margin: 0 0 6px;
  color: #d7b7ff;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 820;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 4.8vw, 34px);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.modal-card p {
  margin: 0 0 10px;
  color: rgba(255, 248, 255, 0.8);
  font-size: 14px;
  line-height: 1.42;
}

.modal-button {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 15px;
  color: #231034;
  background: #f4eaff;
  font-weight: 950;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  transition: transform 140ms ease, background 140ms ease;
}

.modal-button:hover {
  transform: translateY(-1px);
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 0.52; transform: scale(0.96); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

@keyframes drift {
  from { transform: translate(-10px, -4px) rotate(0deg); }
  to { transform: translate(12px, 8px) rotate(18deg); }
}

@keyframes rotateAura {
  to { transform: rotate(360deg); }
}

@keyframes mistSlide {
  from { transform: translateX(-18px) rotate(-4deg); opacity: 0.38; }
  to { transform: translateX(18px) rotate(4deg); opacity: 0.78; }
}

@keyframes crystalPress {
  0% { transform: scale(1); filter: brightness(1); }
  38% { transform: scale(0.94); filter: brightness(1.45); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ripple {
  0% { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.36); opacity: 0; }
}


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

@keyframes instructionGlow {
  0%, 100% {
    box-shadow:
      0 16px 40px rgba(72, 29, 123, 0.24),
      0 0 0 4px rgba(139, 79, 214, 0.08);
  }
  50% {
    box-shadow:
      0 18px 46px rgba(72, 29, 123, 0.34),
      0 0 0 7px rgba(139, 79, 214, 0.14);
  }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 700px); }
  .card { border-radius: 26px; }
  .oracle-button { min-height: 270px; }
  .crystal-ball { width: 205px; height: 205px; }
  .crystal-base { top: 198px; }
  .button-text { margin-top: 170px; }
}

/* Simpler clearer instruction card */
.active-instruction {
  background: rgba(36, 17, 64, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(46, 20, 86, 0.2);
  animation: instructionEntrance 300ms ease both;
}

.active-instruction p {
  color: #fff;
  font-size: clamp(14px, 2.1vw, 16px);
  line-height: 1.36;
  font-weight: 740;
  text-shadow: none;
}

.active-instruction-label {
  color: rgba(255, 248, 255, 0.68);
}


/* Registering state after each crystal-ball press */
.oracle-button.registering:disabled {
  opacity: 0.82;
  cursor: wait;
}

.oracle-button.registering .crystal-ball {
  animation: registeringPulse 940ms ease-in-out infinite;
}

.oracle-button.registering .crystal-glow {
  animation: registeringGlow 720ms ease-in-out infinite alternate;
}

.oracle-button.registering .crystal-mist {
  opacity: 0.94;
  animation-duration: 1.25s;
}

.oracle-button.registering::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 2px solid rgba(213, 247, 255, 0.58);
  animation: registeringRing 1.05s ease-in-out infinite;
}

.oracle-button.registering .button-text {
  background: rgba(17, 8, 34, 0.72);
}

@keyframes registeringPulse {
  0%, 100% { transform: scale(0.98); filter: brightness(0.98) saturate(0.92); }
  50% { transform: scale(1.035); filter: brightness(1.28) saturate(1.16); }
}

@keyframes registeringGlow {
  from { opacity: 0.42; transform: scale(0.94); }
  to { opacity: 0.98; transform: scale(1.16); }
}

@keyframes registeringRing {
  0% { transform: scale(0.92); opacity: 0.28; }
  50% { transform: scale(1.08); opacity: 0.76; }
  100% { transform: scale(1.22); opacity: 0; }
}

#interpretation h1,
#interpretation h2,
#interpretation h3,
#interpretation h4,
#interpretation h5,
#interpretation h6 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1em 0 0.35em;
}

#interpretation p {
  margin: 0 0 0.9em;
}

#interpretation > *:first-child {
  margin-top: 0;
}

#interpretation > *:last-child {
  margin-bottom: 0;
}

/* Feedback buttons shown after a completed reading */
.feedback-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.feedback-panel[hidden] {
  display: none;
}

.feedback-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.feedback-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  color: var(--text);
  background: #fff;
  font-weight: 850;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.feedback-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(139, 79, 214, 0.52);
  box-shadow: 0 8px 18px rgba(46, 20, 86, 0.12);
}

.feedback-button.selected {
  border-color: rgba(139, 79, 214, 0.72);
  background: rgba(139, 79, 214, 0.12);
}

.feedback-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.feedback-message {
  height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
}

.feedback-message.show {
  height: auto;
  min-height: 18px;
  margin: 9px 0 0;
  opacity: 1;
}


.billing-panel[hidden] {
  display: none !important;
}

.billing-panel {
  width: min(340px, 100%);
  margin: 22px auto 0;
  padding: 18px;
  border: 1px solid rgba(139, 79, 214, 0.2);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.62);
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.billing-copy {
  display: contents;
}

.plan-pill {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(139, 79, 214, 0.11);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-panel strong {
  max-width: 260px;
  color: var(--text);
  font-size: clamp(20px, 4.2vw, 25px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.025em;
  text-align: center;
}

.billing-panel span,
.auth-message {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}

#usageStatus {
  display: block;
  margin-top: -4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}

.premium-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.premium-benefits li {
  border: 1px solid rgba(139, 79, 214, 0.16);
  border-radius: 16px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.22;
}

.billing-actions {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0;
}


.small-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, filter 150ms ease;
}

.small-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

.small-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.small-button.ghost {
  color: var(--accent-dark);
  background: rgba(139, 79, 214, 0.1);
}

.small-button.premium {
  min-width: 148px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 26px rgba(97, 47, 166, 0.22);
}

.auth-message {
  min-height: 16px;
  margin: 9px 0 0;
}

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

.auth-modal-card {
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: #fff8ff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.google-button {
  display: block;
  width: 100%;
  margin-top: 16px;
}


@media (max-width: 520px) {
  .billing-actions {
    align-items: stretch;
  }

  .premium-benefits {
    grid-template-columns: 1fr;
  }

  .small-button {
    width: 100%;
  }
}


.billing-panel .auth-message:empty {
  display: none;
}

.billing-panel .auth-message {
  width: 100%;
  margin: 0;
  text-align: center;
}

@media (max-width: 560px) {
  
.billing-panel[hidden] {
  display: none !important;
}

.billing-panel {
    width: 100%;
    border-radius: 24px;
  }

  .billing-actions {
    justify-content: center;
  }
}

#usageStatus[hidden],
#upgradeBtn[hidden],
#manageBillingBtn[hidden],
#signOutBtn[hidden] {
  display: none !important;
}
