:root {
  color-scheme: dark;
  --bg: #0b0911;
  --panel: rgba(22, 17, 30, 0.86);
  --panel-strong: rgba(35, 26, 44, 0.92);
  --line: rgba(243, 213, 154, 0.22);
  --text: #f7efe1;
  --muted: #c3b7a6;
  --gold: #f0c36b;
  --red: #a64255;
  --teal: #4aa8a1;
  --violet: #7664b4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 64vh;
  overflow: hidden;
  background-image: url("assets/tarot-hero.png");
  background-position: center;
  background-size: cover;
}

.app[data-system="lenormand"] .hero {
  background-image: url("assets/lenormand-hero.png");
}

.app[data-system="oracle"] .hero,
.app[data-system="gypsy"] .hero,
.app[data-system="astroDice"] .hero,
.app[data-system="runes"] .hero,
.app[data-system="liuYao"] .hero,
.app[data-system="meiHua"] .hero {
  background-image: url("assets/oracle-tools-hero.png");
}

.hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 7, 12, 0.9), rgba(8, 7, 12, 0.36) 54%, rgba(8, 7, 12, 0.72)),
    linear-gradient(0deg, var(--bg), rgba(11, 9, 17, 0.08) 42%);
}

.topbar,
.hero__content {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(18px, 4vw, 64px);
  color: var(--muted);
}

.topbar strong {
  color: var(--gold);
  letter-spacing: 0.16em;
}

.hero__content {
  width: min(760px, calc(100% - 36px));
  padding: clamp(56px, 12vh, 112px) 0 116px;
  margin-left: clamp(18px, 7vw, 96px);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 6vw, 5.8rem);
  line-height: 1.02;
  max-width: 840px;
}

.lead {
  max-width: 680px;
  color: #eadccb;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 22px;
  width: min(1440px, calc(100% - 32px));
  margin: -74px auto 40px;
  position: relative;
  z-index: 2;
}

.panel,
.reading {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel {
  border-radius: 8px;
  padding: 20px;
  align-self: start;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.system-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(7, 6, 11, 0.7);
}

.system-tab {
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.system-tab.active {
  border-color: rgba(240, 195, 107, 0.42);
  background: rgba(240, 195, 107, 0.16);
  color: var(--text);
  font-weight: 700;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 6, 11, 0.78);
  color: var(--text);
  outline: none;
  padding: 12px;
}

textarea {
  resize: vertical;
  min-height: 108px;
  line-height: 1.6;
}

.switch-row {
  display: grid;
  gap: 12px;
  margin: 14px 0 20px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.switch.disabled {
  opacity: 0.46;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  position: relative;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 4px;
  border-radius: 50%;
  background: var(--muted);
  transition: 0.18s ease;
}

.switch input:checked + span {
  background: rgba(240, 195, 107, 0.26);
}

.switch input:checked + span::after {
  transform: translateX(18px);
  background: var(--gold);
}

button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  min-height: 46px;
  cursor: pointer;
  color: var(--text);
}

.primary {
  background: linear-gradient(135deg, var(--red), #7b4ca2 55%, var(--teal));
  font-weight: 700;
}

.secondary {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line);
}

.reading {
  min-height: 620px;
  border-radius: 8px;
  padding: clamp(16px, 2.5vw, 28px);
}

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

.reading__head h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.deck-count {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.28);
  font-weight: 800;
}

.spread-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.card {
  min-height: 292px;
  perspective: 900px;
}

.card__inner {
  height: 100%;
  border-radius: 8px;
  position: relative;
  transform-style: preserve-3d;
  animation: reveal 0.64s ease both;
}

.card__face {
  min-height: 292px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 195, 107, 0.34);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    radial-gradient(circle at top, rgba(240, 195, 107, 0.2), transparent 45%),
    #130f19;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 40px rgba(0, 0, 0, 0.32);
}

.card__art {
  display: grid;
  place-items: center;
  min-height: 108px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 38%, rgba(240, 195, 107, 0.32), transparent 30%),
    linear-gradient(145deg, rgba(74, 168, 161, 0.28), rgba(118, 100, 180, 0.2)),
    url("assets/tarot-hero.png");
  background-size: 540px, auto, cover;
  background-position: center;
  font-size: 3.1rem;
}

.app[data-system="lenormand"] .card__face {
  border-color: rgba(74, 168, 161, 0.42);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    radial-gradient(circle at top, rgba(74, 168, 161, 0.22), transparent 45%),
    #101716;
}

.app[data-system="lenormand"] .card__art {
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 195, 107, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(20, 77, 71, 0.46), rgba(111, 43, 55, 0.24)),
    url("assets/lenormand-hero.png");
  background-size: 540px, auto, cover;
}

.app[data-system="oracle"] .card__face,
.app[data-system="gypsy"] .card__face,
.app[data-system="astroDice"] .card__face,
.app[data-system="runes"] .card__face,
.app[data-system="liuYao"] .card__face,
.app[data-system="meiHua"] .card__face {
  border-color: rgba(240, 195, 107, 0.3);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0)),
    radial-gradient(circle at top, rgba(166, 66, 85, 0.2), transparent 46%),
    #15111a;
}

.app[data-system="oracle"] .card__art,
.app[data-system="gypsy"] .card__art,
.app[data-system="astroDice"] .card__art,
.app[data-system="runes"] .card__art,
.app[data-system="liuYao"] .card__art,
.app[data-system="meiHua"] .card__art {
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 195, 107, 0.24), transparent 28%),
    linear-gradient(145deg, rgba(118, 100, 180, 0.28), rgba(74, 168, 161, 0.24)),
    url("assets/oracle-tools-hero.png");
  background-size: 540px, auto, cover;
}

.card.astroDice .card__art,
.card.runes .card__art,
.card.liuYao .card__art,
.card.meiHua .card__art {
  font-size: 4rem;
}

.card.reversed .card__art {
  transform: rotate(180deg);
}

.card__position {
  color: var(--gold);
  font-size: 0.78rem;
  line-height: 1.35;
}

.card__name {
  margin: 0;
  font-size: 1.05rem;
}

.card__meta,
.card__meaning {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.summary {
  display: none;
  margin-top: 22px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: #eadccb;
  line-height: 1.75;
}

.summary.active {
  display: block;
}

.summary h3 {
  margin-bottom: 8px;
  color: var(--gold);
}

.deep-reading {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(243, 213, 154, 0.18);
}

.deep-reading ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
  padding-left: 20px;
}

.deep-reading li {
  color: var(--muted);
}

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

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero__content {
    margin-left: 18px;
    padding-bottom: 96px;
  }

  .workspace {
    grid-template-columns: 1fr;
    margin-top: -54px;
  }

  .spread-board {
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  }
}
