:root {
  --ink: #f8f4ff;
  --muted: #aeb9d7;
  --deep: #030610;
  --panel: rgba(11, 16, 39, 0.76);
  --panel-strong: rgba(14, 20, 48, 0.94);
  --line: rgba(191, 207, 255, 0.22);
  --cyan: #66eef8;
  --violet: #a88bff;
  --gold: #f1c777;
  --rose: #ff8cc7;
  --green: #99ffc8;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(102, 238, 248, 0.2), transparent 34rem),
    radial-gradient(circle at 13% 60%, rgba(168, 139, 255, 0.22), transparent 30rem),
    radial-gradient(circle at 86% 72%, rgba(255, 140, 199, 0.12), transparent 26rem),
    linear-gradient(145deg, #02040c 0%, #071126 55%, #13091c 100%);
  overflow-x: hidden;
}

button,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

#sky,
.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#sky {
  width: 100%;
  height: 100%;
  opacity: 0.78;
}

.veil {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 76%);
}

.ritual-app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 56px;
}

.site-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(241, 199, 119, 0.56);
  border-radius: 50%;
  color: var(--gold);
  box-shadow: 0 0 30px rgba(241, 199, 119, 0.24);
}

.brand strong {
  display: block;
  font-size: 23px;
}

.brand small,
.subcopy,
.mode-card small,
.field span,
.ritual-hint,
.reading-report p,
.daily-card li,
.result-head span,
.step-title span {
  color: var(--muted);
}

.icon-button,
.secondary-action,
.primary-action,
.mode-card,
.chip,
.borrow {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.icon-button {
  padding: 0 14px;
}

.step {
  display: none;
  min-height: calc(100vh - 120px);
  padding: clamp(18px, 4vw, 44px) 0;
}

.step.is-active {
  display: grid;
  align-content: center;
  animation: stepIn 460ms ease both;
}

.hero-copy {
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  line-height: 1.03;
}

h1 {
  max-width: 880px;
  font-size: clamp(52px, 8vw, 104px);
  text-shadow: 0 0 38px rgba(102, 238, 248, 0.22);
}

.subcopy {
  max-width: 620px;
  margin: 22px 0 0;
  font-size: 18px;
  line-height: 1.8;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 40px 0 24px;
}

.mode-card {
  min-height: 190px;
  display: grid;
  align-content: space-between;
  padding: 20px;
  text-align: left;
  background:
    linear-gradient(145deg, rgba(102, 238, 248, 0.08), transparent 44%),
    rgba(10, 16, 38, 0.76);
}

.mode-card span {
  color: var(--cyan);
  font-family: Cinzel, serif;
}

.mode-card strong {
  display: block;
  color: var(--ink);
  font-size: 26px;
}

.mode-card small {
  display: block;
  line-height: 1.6;
}

.mode-card:hover,
.mode-card.is-selected,
.chip:hover,
.chip.is-selected,
.borrow:hover {
  border-color: rgba(102, 238, 248, 0.72);
  background: rgba(102, 238, 248, 0.12);
  box-shadow: 0 0 32px rgba(102, 238, 248, 0.13);
  transform: translateY(-2px);
}

.primary-action {
  min-width: 220px;
  padding: 0 24px;
  border: 0;
  color: #041019;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  font-weight: 900;
  box-shadow: 0 18px 46px rgba(102, 238, 248, 0.18);
}

.secondary-action {
  min-width: 130px;
  padding: 0 18px;
}

.step-title {
  margin-bottom: 26px;
}

.step-title h2,
.result-head h2 {
  margin-top: 8px;
  font-size: clamp(36px, 5vw, 64px);
}

.question-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.question-card,
.daily-card,
.reading-report,
.ritual-card-list,
.result-card-face,
.settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.question-card {
  padding: clamp(20px, 3vw, 34px);
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  padding: 0 15px;
  border-radius: 999px;
}

.field {
  display: grid;
  gap: 8px;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(191, 207, 255, 0.24);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(3, 7, 20, 0.62);
  outline: none;
}

textarea {
  min-height: 164px;
  padding: 16px;
  line-height: 1.8;
  resize: vertical;
}

select {
  min-height: 48px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  border-color: rgba(102, 238, 248, 0.78);
  box-shadow: 0 0 0 3px rgba(102, 238, 248, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.daily-card {
  padding: 22px;
}

.daily-card span {
  color: var(--cyan);
}

.daily-card h3 {
  margin: 10px 0 16px;
  font-size: 26px;
  line-height: 1.25;
}

.daily-card ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.daily-card li {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  line-height: 1.55;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.altar {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(102, 238, 248, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 46%, rgba(102, 238, 248, 0.16), transparent 16rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.altar-ring {
  position: absolute;
  width: min(78vw, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(217, 231, 255, 0.36);
  border-radius: 50%;
  transform: rotateX(72deg);
  box-shadow: 0 0 70px rgba(102, 238, 248, 0.16);
}

.deck-stack {
  position: relative;
  width: 190px;
  height: 286px;
  transition: opacity 260ms ease, transform 420ms ease;
}

.deck-stack.is-hidden {
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
}

.stack-card,
.tarot-card {
  position: absolute;
  width: 170px;
  height: 260px;
  border: 1px solid rgba(241, 199, 119, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(102, 238, 248, 0.15), transparent 35%),
    linear-gradient(315deg, rgba(241, 199, 119, 0.18), transparent 38%),
    #081226;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
}

.stack-card::before,
.tarot-card.back::before {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(241, 199, 119, 0.44);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 50%, rgba(102, 238, 248, 0.2), transparent 28%),
    linear-gradient(45deg, transparent 47%, rgba(217, 231, 255, 0.18) 48%, rgba(217, 231, 255, 0.18) 52%, transparent 53%);
}

.stack-card::after,
.tarot-card.back::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 36px;
}

.stack-1 {
  transform: rotate(-4deg);
}

.stack-2 {
  transform: translate(10px, 6px) rotate(3deg);
}

.stack-3 {
  transform: translate(20px, 12px) rotate(8deg);
}

.deck-stack.cleansing .stack-card {
  animation: cleanse 900ms ease both;
}

.deck-stack.shuffling .stack-card {
  animation: stackShuffle 980ms ease both;
}

.deck-stack.cutting .stack-card {
  animation: cutDeck 820ms ease both;
}

.fan-deck {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
}

.fan-deck.is-visible {
  display: block;
}

.tarot-card {
  top: 50%;
  left: 50%;
  padding: 0;
  cursor: pointer;
  z-index: var(--z);
  transform: translate(calc(-50% + var(--x)), -50%) rotate(var(--angle)) translateY(var(--lift));
  transition: transform 260ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.tarot-card:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: 0 24px 76px rgba(102, 238, 248, 0.22);
  z-index: 30;
  transform: translate(calc(-50% + var(--x)), -50%) rotate(var(--angle)) translateY(calc(var(--lift) - 18px));
}

.tarot-card:disabled {
  cursor: default;
}

.tarot-card.is-dimmed {
  opacity: 0.28;
}

.tarot-card.is-drawn {
  z-index: 10;
  opacity: 1;
  transform: translate(-50%, -58%) rotate(0deg) scale(1.08);
}

.tarot-face {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 42px 1fr 52px;
  padding: 13px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.2), transparent 22%),
    linear-gradient(180deg, rgba(33, 43, 88, 0.96), rgba(12, 17, 45, 0.98));
}

.tarot-face::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(241, 199, 119, 0.5);
  border-radius: 6px;
}

.tarot-name,
.tarot-number {
  position: relative;
  z-index: 1;
  color: var(--gold);
  font-family: Cinzel, "Noto Serif SC", serif;
  text-align: center;
}

.tarot-name {
  align-self: end;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.tarot-art {
  position: relative;
  z-index: 1;
  align-self: center;
  justify-self: center;
  width: 104px;
  height: 126px;
}

.tarot-art::before,
.tarot-art::after {
  content: "";
  position: absolute;
}

.art-moon::before {
  width: 72px;
  height: 72px;
  right: 8px;
  top: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #fff, #dce8ff 58%, #87a7ff);
  box-shadow: 0 0 30px rgba(217, 231, 255, 0.72);
}

.art-moon::after {
  width: 86px;
  height: 42px;
  left: 8px;
  bottom: 12px;
  border: 2px solid rgba(102, 238, 248, 0.58);
  border-radius: 50%;
  transform: rotate(-14deg);
}

.art-star::before {
  inset: 16px;
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 56%, 79% 94%, 50% 70%, 21% 94%, 32% 56%, 2% 36%, 39% 36%);
  background: linear-gradient(180deg, #fff5bd, var(--gold));
  box-shadow: 0 0 30px rgba(241, 199, 119, 0.58);
}

.art-sun::before {
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c6, var(--gold) 48%, #ff9c68);
  box-shadow: 0 0 38px rgba(241, 199, 119, 0.7);
}

.art-sun::after {
  inset: 2px;
  border: 2px dashed rgba(241, 199, 119, 0.7);
  border-radius: 50%;
}

.art-lovers::before {
  width: 48px;
  height: 78px;
  left: 8px;
  bottom: 14px;
  border-radius: 999px 999px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 140, 199, 0.95), rgba(168, 139, 255, 0.72));
}

.art-lovers::after {
  width: 48px;
  height: 78px;
  right: 8px;
  bottom: 14px;
  border-radius: 999px 999px 18px 18px;
  background: linear-gradient(180deg, rgba(102, 238, 248, 0.9), rgba(100, 129, 255, 0.72));
}

.art-wheel::before {
  inset: 6px;
  border: 8px double rgba(241, 199, 119, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(241, 199, 119, 0.32);
}

.art-wheel::after {
  width: 8px;
  height: 112px;
  left: 48px;
  top: 8px;
  background: rgba(102, 238, 248, 0.72);
  transform: rotate(45deg);
}

.art-tower::before {
  width: 58px;
  height: 104px;
  left: 24px;
  bottom: 4px;
  clip-path: polygon(20% 0, 100% 10%, 76% 100%, 0 96%);
  background: linear-gradient(180deg, rgba(217, 231, 255, 0.88), rgba(168, 139, 255, 0.58));
}

.art-tower::after {
  width: 52px;
  height: 58px;
  right: 0;
  top: 0;
  clip-path: polygon(50% 0, 62% 40%, 100% 42%, 68% 60%, 76% 100%, 50% 72%, 24% 100%, 32% 60%, 0 42%, 38% 40%);
  background: var(--gold);
}

.art-priestess::before {
  width: 70px;
  height: 106px;
  left: 17px;
  top: 8px;
  border-radius: 999px 999px 18px 18px;
  background: linear-gradient(180deg, rgba(217, 231, 255, 0.88), rgba(102, 238, 248, 0.28));
}

.art-priestess::after {
  width: 90px;
  height: 22px;
  left: 7px;
  bottom: 8px;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
}

.ritual-hint {
  max-width: 720px;
  margin: 18px auto 0;
  text-align: center;
  font-size: 18px;
  line-height: 1.8;
}

.loading-oracle {
  position: relative;
  width: 240px;
  height: 320px;
  margin: 0 auto 32px;
  display: grid;
  place-items: center;
}

.loading-card {
  width: 178px;
  height: 270px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.34), transparent 22%),
    linear-gradient(180deg, rgba(39, 47, 98, 0.95), rgba(11, 16, 39, 0.98));
  animation: floatCard 1.8s ease-in-out infinite;
}

.halo {
  position: absolute;
  width: 220px;
  height: 68px;
  border: 1px solid rgba(102, 238, 248, 0.64);
  border-radius: 50%;
  transform: rotate(-14deg);
  animation: spinHalo 2.4s linear infinite;
}

#step-loading {
  text-align: center;
}

#step-loading h2 {
  font-size: clamp(34px, 5vw, 58px);
}

#loadingText {
  color: var(--muted);
  font-size: 18px;
}

.progress {
  width: min(460px, 100%);
  height: 8px;
  margin: 24px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 420ms ease;
}

.result-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.result-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
}

.result-card-face {
  min-height: 360px;
  padding: 16px;
}

.result-card-face .tarot-card {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  height: 330px;
  transform: none;
  cursor: default;
}

.reading-report {
  padding: clamp(20px, 3vw, 34px);
}

.reading-report h3 {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 28px;
}

.reading-report p {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.9;
}

.reading-report strong {
  color: var(--gold);
}

.reading-report .answer-line {
  padding: 15px 17px;
  border-left: 2px solid var(--cyan);
  background: rgba(102, 238, 248, 0.075);
}

.ritual-card-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.ritual-card-list h3 {
  margin: 0 0 8px;
  color: var(--gold);
}

.borrow {
  width: 100%;
  text-align: left;
  padding: 0 14px;
}

.settings {
  width: min(420px, calc(100% - 30px));
  color: var(--ink);
  padding: 0;
}

.settings::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.settings form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings h2 {
  margin: 0;
  font-size: 34px;
}

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

@keyframes cleanse {
  50% {
    filter: brightness(1.35);
    transform: translateY(-18px) rotate(0deg);
  }
}

@keyframes stackShuffle {
  35% {
    transform: translateX(-86px) rotate(-15deg);
  }
  70% {
    transform: translateX(86px) rotate(15deg);
  }
}

@keyframes cutDeck {
  50% {
    transform: translateY(-58px) rotate(6deg);
  }
}

@keyframes floatCard {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-18px) rotate(2deg);
  }
}

@keyframes spinHalo {
  to {
    transform: rotate(346deg);
  }
}

@media (max-width: 980px) {
  .mode-grid,
  .question-layout,
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .reading-report {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .ritual-app {
    width: min(100% - 20px, 520px);
    padding-top: 14px;
  }

  .site-head,
  .result-head {
    align-items: start;
  }

  .mode-grid,
  .question-layout,
  .form-row,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 132px;
  }

  .step {
    min-height: calc(100vh - 96px);
    padding: 18px 0 34px;
  }

  .altar {
    min-height: 720px;
  }

  .tarot-card {
    position: relative;
    top: auto;
    left: auto;
    width: 98px;
    height: 152px;
    transform: none;
  }

  .tarot-card:hover:not(:disabled) {
    transform: translateY(-10px);
  }

  .fan-deck.is-visible {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-content: center;
    justify-items: center;
    gap: 12px;
    padding: 18px;
  }

  .tarot-art {
    width: 64px;
    height: 70px;
  }

  .tarot-name {
    font-size: 15px;
  }

  .step-actions,
  .result-head {
    display: grid;
  }

  .step-actions .primary-action,
  .step-actions .secondary-action,
  .result-head .secondary-action {
    width: 100%;
  }
}

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