:root {
  --ink: #120D0A;
  --paper: #F1E5CB;
  --aged-paper: #DCC49B;
  --cinnabar: #94291E;
  --cinnabar-bright: #B83B2C;
  --bronze: #C49A55;
  --jade: #31584D;
  --night-purple: #24152C;
  --star-gold: #F4D48A;
  --paper-light: #FFF7E7;
  --muted-ink: #654B35;
  --line: rgba(76, 48, 24, 0.18);
  --shadow: 0 24px 80px rgba(18, 13, 10, 0.18);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-display: var(--font-serif);
  --font-sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 10% 12%, rgba(196, 154, 85, 0.24), transparent 24rem),
    radial-gradient(circle at 90% 4%, rgba(36, 21, 44, 0.18), transparent 25rem),
    linear-gradient(135deg, var(--paper-light), var(--paper));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(18, 13, 10, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 13, 10, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--star-gold);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-140%);
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper-light);
  border-radius: 999px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 1rem;
  backdrop-filter: blur(16px);
}

.nav-shell {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(196, 154, 85, 0.34);
  border-radius: 999px;
  background: rgba(255, 247, 231, 0.78);
  box-shadow: 0 12px 34px rgba(18, 13, 10, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--paper-light);
  background: radial-gradient(circle, var(--cinnabar-bright), var(--cinnabar));
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-family: var(--font-serif);
  letter-spacing: 0.12em;
}

.brand-copy small {
  color: var(--muted-ink);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.nav-links a {
  padding: 0.58rem 0.78rem;
  border-radius: 999px;
  color: var(--muted-ink);
  transition: color 180ms ease, background-color 180ms ease;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(196, 154, 85, 0.16);
}

.hero-section,
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 1rem;
}

.hero-scroll {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  min-height: 560px;
  padding: clamp(2rem, 6vw, 4.5rem);
  overflow: hidden;
  border: 1px solid rgba(99, 64, 31, 0.26);
  border-radius: 32px;
  background:
    linear-gradient(90deg, rgba(148, 41, 30, 0.10), transparent 14%, transparent 86%, rgba(148, 41, 30, 0.10)),
    radial-gradient(circle at 82% 16%, rgba(244, 212, 138, 0.36), transparent 12rem),
    linear-gradient(135deg, rgba(255, 250, 238, 0.96), rgba(232, 207, 161, 0.90));
  box-shadow: var(--shadow), inset 0 0 80px rgba(105, 68, 32, 0.12);
}

.hero-scroll::before,
.hero-scroll::after {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  width: 9px;
  border-radius: 999px;
  background: linear-gradient(#7b4a24, var(--bronze), #6b3d20);
}

.hero-scroll::before {
  left: 1rem;
}

.hero-scroll::after {
  right: 1rem;
}

.hero-copy {
  align-self: center;
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--cinnabar);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
}

h1 {
  max-width: 11em;
  margin: 0;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1;
  letter-spacing: 0.08em;
}

.hero-lede,
.section-heading p,
.type-card span:last-child,
.field-hint,
.site-footer {
  color: var(--muted-ink);
  line-height: 1.85;
}

.hero-lede {
  max-width: 34rem;
  margin: 1.35rem 0 0;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(18, 13, 10, 0.18);
  padding: 0.78rem 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: var(--paper-light);
  background: linear-gradient(135deg, var(--cinnabar), var(--cinnabar-bright));
  box-shadow: 0 14px 32px rgba(148, 41, 30, 0.24);
}

.button.ghost {
  color: var(--ink);
  background: rgba(255, 247, 231, 0.70);
}

.button.compact {
  min-height: 38px;
  padding: 0.55rem 0.9rem;
}

.hero-scroll .oracle-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
}

.hero-scroll .oracle-stage::before {
  content: "";
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(circle at 78% 18%, var(--star-gold), transparent 0.35rem),
    radial-gradient(circle at 64% 32%, rgba(244, 212, 138, 0.75), transparent 0.24rem),
    radial-gradient(circle at 42% 18%, rgba(244, 212, 138, 0.65), transparent 0.22rem),
    radial-gradient(circle, rgba(36, 21, 44, 0.92), rgba(18, 13, 10, 0.96));
  border-radius: 45%;
  filter: blur(0.2px);
}

.oracle-wheel {
  position: relative;
  display: grid;
  place-items: center;
  width: min(340px, 78vw);
  aspect-ratio: 1;
  border: 1px solid rgba(244, 212, 138, 0.56);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--night-purple) 0 16%, transparent 16.5%),
    radial-gradient(circle, transparent 0 32%, rgba(196, 154, 85, 0.24) 33% 35%, transparent 35.5% 47%, rgba(148, 41, 30, 0.18) 48% 50%, transparent 50.5%),
    conic-gradient(from 16deg, rgba(36, 21, 44, 0.96), rgba(78, 37, 54, 0.86), rgba(196, 154, 85, 0.46), rgba(36, 21, 44, 0.96));
  box-shadow: 0 28px 70px rgba(36, 21, 44, 0.34), inset 0 0 0 22px rgba(255, 239, 199, 0.06);
}

.oracle-wheel::before {
  content: "玄";
  position: absolute;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  color: var(--paper-light);
  background: radial-gradient(circle, var(--star-gold), var(--cinnabar-bright));
  font-family: var(--font-serif);
  font-size: 2.3rem;
  font-weight: 900;
  box-shadow: 0 0 32px rgba(244, 212, 138, 0.42);
}

.oracle-wheel span {
  position: absolute;
  color: rgba(244, 212, 138, 0.86);
  font-family: var(--font-serif);
  font-weight: 800;
}

.oracle-wheel span:nth-child(1) { transform: translateY(-142px); }
.oracle-wheel span:nth-child(2) { transform: rotate(45deg) translateY(-142px) rotate(-45deg); }
.oracle-wheel span:nth-child(3) { transform: rotate(90deg) translateY(-142px) rotate(-90deg); }
.oracle-wheel span:nth-child(4) { transform: rotate(135deg) translateY(-142px) rotate(-135deg); }
.oracle-wheel span:nth-child(5) { transform: rotate(180deg) translateY(-142px) rotate(-180deg); }
.oracle-wheel span:nth-child(6) { transform: rotate(225deg) translateY(-142px) rotate(-225deg); }
.oracle-wheel span:nth-child(7) { transform: rotate(270deg) translateY(-142px) rotate(-270deg); }
.oracle-wheel span:nth-child(8) { transform: rotate(315deg) translateY(-142px) rotate(-315deg); }

.seal-note {
  position: absolute;
  right: 6%;
  bottom: 12%;
  writing-mode: vertical-rl;
  padding: 0.8rem 0.45rem;
  color: var(--paper-light);
  background: rgba(148, 41, 30, 0.90);
  border: 1px solid rgba(255, 240, 205, 0.34);
  font-family: var(--font-serif);
  letter-spacing: 0.20em;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 1.5rem;
}

.section-heading.inline-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  max-width: none;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: 0.08em;
}

.type-grid,
.fortune-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.type-card,
.fortune-card,
.consult-form,
.reading-card,
.history-item,
.empty-state {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.88), rgba(232, 207, 161, 0.50));
  box-shadow: 0 16px 42px rgba(18, 13, 10, 0.08);
}

.type-card {
  min-height: 190px;
  padding: 1.2rem;
  text-align: left;
  color: var(--ink);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.type-card:hover,
.type-card.is-active {
  transform: translateY(-3px);
  border-color: rgba(148, 41, 30, 0.45);
  box-shadow: 0 20px 54px rgba(148, 41, 30, 0.14);
}

.type-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--paper-light);
  background: var(--jade);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-weight: 900;
}

.type-card.is-active .type-symbol {
  background: var(--cinnabar);
}

.type-card strong {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-serif);
  font-size: 1.18rem;
}

.consult-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 1.2rem;
}

.consult-form,
.reading-card {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.consult-form {
  display: grid;
  gap: 0.8rem;
}

.consult-form label {
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(76, 48, 24, 0.24);
  background: rgba(255, 252, 244, 0.86);
  color: var(--ink);
  padding: 0.85rem;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

.field-hint {
  min-height: 1.5rem;
  margin: 0;
}

.reading-card {
  min-height: 360px;
  background:
    radial-gradient(circle at 92% 10%, rgba(244, 212, 138, 0.22), transparent 9rem),
    linear-gradient(135deg, rgba(36, 21, 44, 0.96), rgba(18, 13, 10, 0.96));
  color: var(--paper-light);
}

.reading-status {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(244, 212, 138, 0.34);
  color: var(--star-gold);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.result-panel {
  line-height: 1.95;
  white-space: pre-wrap;
}

.result-panel p {
  margin-top: 0;
}

.reading-card.is-ritual .reading-status {
  animation: pulseSeal 1.2s ease-in-out infinite;
}

.reading-card .oracle-stage {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 138px;
  margin: 0.35rem 0 1rem;
  overflow: hidden;
  isolation: isolate;
}

.reading-card .oracle-stage::before {
  content: "";
  position: absolute;
  inset: auto 12% 8px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(ellipse, rgba(71, 39, 23, 0.34), rgba(71, 39, 23, 0));
  filter: blur(3px);
}

.oracle-tube {
  position: relative;
  z-index: 3;
  width: 92px;
  height: 78px;
  border: 1px solid rgba(244, 212, 138, 0.38);
  border-radius: 14px 14px 26px 26px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14), transparent 24%, rgba(0, 0, 0, 0.2) 72%, rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, #6d321f, #321810 76%, #1d0d09);
  box-shadow: 0 18px 32px rgba(37, 19, 9, 0.32), inset 0 0 18px rgba(244, 212, 138, 0.13);
}

.tube-rim {
  position: absolute;
  left: 8px;
  right: 8px;
  top: -11px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #9a5035, #421b12);
  border: 1px solid rgba(244, 212, 138, 0.44);
}

.tube-mark {
  position: absolute;
  inset: 22px 0 auto;
  text-align: center;
  color: rgba(255, 232, 168, 0.84);
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.18em;
}

.oracle-stick {
  position: absolute;
  z-index: 2;
  bottom: 44px;
  width: 30px;
  min-height: 108px;
  display: grid;
  place-items: center;
  gap: 0.08rem;
  padding: 0.6rem 0.2rem;
  border: 1px solid rgba(161, 39, 31, 0.25);
  border-radius: 999px 999px 8px 8px;
  color: var(--cinnabar);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.52), transparent 42%),
    linear-gradient(180deg, #fff2c7, #e6c77b);
  box-shadow: 0 10px 24px rgba(143, 73, 32, 0.24);
  transform: translateY(86px) rotate(-2deg);
  transform-origin: center bottom;
}

.oracle-stick span {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
}

.oracle-sparks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

.oracle-sparks span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--star-gold);
  box-shadow: 0 0 16px rgba(244, 212, 138, 0.85);
}

.oracle-sparks span:nth-child(1) { left: 22%; top: 54%; }
.oracle-sparks span:nth-child(2) { left: 35%; top: 24%; }
.oracle-sparks span:nth-child(3) { left: 52%; top: 14%; }
.oracle-sparks span:nth-child(4) { left: 68%; top: 32%; }
.oracle-sparks span:nth-child(5) { left: 78%; top: 58%; }
.oracle-sparks span:nth-child(6) { left: 46%; top: 70%; }

.reading-card.is-ritual .oracle-tube {
  animation: shakeTube 900ms cubic-bezier(.36,.07,.19,.97) both;
}

.reading-card.is-ritual .oracle-stick,
.reading-card.is-revealing .oracle-stick {
  animation: riseStick 1200ms cubic-bezier(.18,.89,.32,1.28) both;
}

.reading-card.is-ritual .oracle-sparks,
.reading-card.is-revealing .oracle-sparks {
  animation: gatherSparks 1500ms ease-out both;
}

@keyframes shakeTube {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  16% { transform: translateX(-4px) rotate(-2deg); }
  32% { transform: translateX(5px) rotate(2deg); }
  48% { transform: translateX(-3px) rotate(-1deg); }
  64% { transform: translateX(3px) rotate(1deg); }
  80% { transform: translateX(-1px) rotate(-0.5deg); }
}

@keyframes riseStick {
  0% { transform: translateY(86px) rotate(-2deg); opacity: 0.65; }
  58% { transform: translateY(-10px) rotate(3deg); opacity: 1; }
  100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

@keyframes gatherSparks {
  0% { opacity: 0; transform: scale(0.82); filter: blur(2px); }
  42% { opacity: 1; transform: scale(1.04); filter: blur(0); }
  100% { opacity: 0.26; transform: scale(0.92); filter: blur(1px); }
}

@keyframes pulseSeal {
  0%, 100% { box-shadow: 0 0 0 rgba(244, 212, 138, 0); }
  50% { box-shadow: 0 0 28px rgba(244, 212, 138, 0.25); }
}

.fortune-card {
  padding: 1rem;
}

.fortune-card h3 {
  margin: 0 0 0.8rem;
}

.fortune-card dl {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.fortune-card div {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.5rem;
}

.fortune-card dt {
  color: var(--cinnabar);
  font-weight: 800;
}

.fortune-card dd {
  margin: 0;
  color: var(--muted-ink);
}

.history-list {
  display: grid;
  gap: 0.8rem;
}

.history-item,
.empty-state {
  padding: 1rem;
}

.history-item {
  display: grid;
  gap: 0.35rem;
}

.history-meta {
  color: var(--cinnabar);
  font-size: 0.85rem;
  font-weight: 800;
}

.history-question {
  margin: 0;
  color: var(--ink);
}

.history-summary {
  margin: 0;
  color: var(--muted-ink);
  line-height: 1.7;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0.3rem 0;
}

@media (max-width: 900px) {
  .hero-scroll,
  .consult-layout {
    grid-template-columns: 1fr;
  }

  .type-grid,
  .fortune-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-scroll .oracle-stage {
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 0.6rem;
  }

  .nav-shell {
    align-items: flex-start;
    border-radius: 24px;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero-section,
  .section {
    padding: 2.6rem 1rem;
  }

  .hero-scroll {
    min-height: auto;
    padding: 2rem 1.35rem;
    border-radius: 24px;
  }

  .hero-scroll::before,
  .hero-scroll::after {
    display: none;
  }

  .type-grid,
  .fortune-grid {
    grid-template-columns: 1fr;
  }

  .section-heading.inline-heading {
    align-items: start;
    flex-direction: column;
  }

  .oracle-wheel span:nth-child(1) { transform: translateY(-118px); }
  .oracle-wheel span:nth-child(2) { transform: rotate(45deg) translateY(-118px) rotate(-45deg); }
  .oracle-wheel span:nth-child(3) { transform: rotate(90deg) translateY(-118px) rotate(-90deg); }
  .oracle-wheel span:nth-child(4) { transform: rotate(135deg) translateY(-118px) rotate(-135deg); }
  .oracle-wheel span:nth-child(5) { transform: rotate(180deg) translateY(-118px) rotate(-180deg); }
  .oracle-wheel span:nth-child(6) { transform: rotate(225deg) translateY(-118px) rotate(-225deg); }
  .oracle-wheel span:nth-child(7) { transform: rotate(270deg) translateY(-118px) rotate(-270deg); }
  .oracle-wheel span:nth-child(8) { transform: rotate(315deg) translateY(-118px) rotate(-315deg); }

  .reading-card .oracle-stage {
    min-height: 118px;
    margin: 0.2rem 0 0.75rem;
  }

  .oracle-tube {
    width: 82px;
    height: 70px;
  }

  .tube-mark {
    inset: 19px 0 auto;
    font-size: 1.3rem;
  }

  .oracle-stick {
    bottom: 40px;
    width: 28px;
    min-height: 96px;
    padding: 0.5rem 0.18rem;
    transform: translateY(76px) rotate(-2deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .reading-card.is-ritual .oracle-tube,
  .reading-card.is-ritual .oracle-stick,
  .reading-card.is-ritual .oracle-sparks,
  .reading-card.is-revealing .oracle-stick,
  .reading-card.is-revealing .oracle-sparks {
    animation: none !important;
  }

  .oracle-stick {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
}
