:root {
  color-scheme: dark;
  --ink: #090806;
  --ink-soft: #11100d;
  --paper: #e8d3a5;
  --paper-dim: #aa9874;
  --gold: #ad8243;
  --gold-bright: #d0a45e;
  --line: rgba(181, 139, 74, 0.42);
  --cinnabar: #9e2f20;
  --cinnabar-bright: #bd3d29;
  --danger: #d76e5f;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 70% 44%, rgba(115, 78, 28, 0.08), transparent 32%),
    linear-gradient(110deg, #0c0b09 0%, #080806 54%, #0b0907 100%);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.mist {
  position: fixed;
  z-index: -1;
  width: 600px;
  height: 180px;
  border-radius: 50%;
  background: rgba(202, 165, 104, 0.05);
  filter: blur(48px);
  pointer-events: none;
}

.mist-one {
  top: 3%;
  right: -12%;
  transform: rotate(-12deg);
}

.mist-two {
  bottom: 3%;
  left: -18%;
  transform: rotate(10deg);
}

.site-header {
  display: flex;
  align-items: center;
  height: 104px;
  padding: 0 clamp(24px, 4vw, 64px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-decoration: none;
}

.wordmark i {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--cinnabar-bright);
  color: var(--cinnabar-bright);
  font-family: var(--serif);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.08em;
  line-height: 1;
  transform: rotate(-2deg);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
  align-items: center;
  width: min(1370px, calc(100% - 64px));
  min-height: calc(100vh - 208px);
  margin: 0 auto;
}

.question-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px clamp(46px, 6vw, 92px) 66px 16px;
}

.intro {
  margin-bottom: 28px;
}

h1 {
  margin: 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(48px, 5vw, 73px);
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.23;
  text-shadow: 0 0 30px rgba(206, 163, 91, 0.1);
}

.ornament {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(440px, 100%);
  gap: 14px;
  margin: 22px 0 18px;
  color: var(--cinnabar-bright);
}

.ornament span {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.ornament span:last-child {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ornament b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 400;
}

.intro p {
  max-width: 560px;
  margin: 0;
  color: var(--paper-dim);
  font-family: var(--serif);
  font-size: clamp(16px, 1.35vw, 19px);
  letter-spacing: 0.12em;
  line-height: 1.8;
}

.textarea-wrap {
  position: relative;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(11, 10, 8, 0.62);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.textarea-wrap:focus-within {
  border-color: var(--gold-bright);
  box-shadow:
    0 0 0 1px rgba(208, 164, 94, 0.25),
    0 0 28px rgba(176, 125, 56, 0.12);
}

.corner {
  position: absolute;
  z-index: 2;
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.corner::before,
.corner::after {
  position: absolute;
  background: var(--gold-bright);
  content: "";
}

.corner::before {
  width: 17px;
  height: 1px;
}

.corner::after {
  width: 1px;
  height: 17px;
}

.corner-tl { top: 2px; left: 2px; }
.corner-tr { top: 2px; right: 2px; transform: rotate(90deg); }
.corner-br { right: 2px; bottom: 2px; transform: rotate(180deg); }
.corner-bl { bottom: 2px; left: 2px; transform: rotate(270deg); }

textarea {
  display: block;
  width: 100%;
  min-height: 208px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--paper);
  padding: 27px 27px 48px;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.07em;
  line-height: 1.8;
}

textarea::placeholder {
  color: rgba(197, 177, 137, 0.52);
}

.counter {
  position: absolute;
  right: 20px;
  bottom: 16px;
  color: rgba(196, 174, 131, 0.58);
  font-family: var(--serif);
  font-size: 13px;
}

.counter b {
  font-weight: 400;
}

.form-error {
  margin: 11px 0 -3px;
  color: var(--danger);
  font-size: 14px;
}

.primary-button,
.secondary-button {
  cursor: pointer;
  transition:
    transform 150ms ease,
    filter 150ms ease,
    opacity 150ms ease;
}

.primary-button {
  display: flex;
  width: min(420px, 88%);
  min-height: 70px;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 28px auto 0;
  border: 1px solid #c05039;
  border-radius: 2px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.08)),
    var(--cinnabar);
  box-shadow:
    inset 0 0 0 3px rgba(74, 15, 9, 0.2),
    0 9px 25px rgba(65, 12, 7, 0.25);
  color: #f0d9aa;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.13);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.button-flourish {
  color: rgba(238, 206, 149, 0.62);
  font-size: 23px;
}

.button-loading {
  display: none;
}

.primary-button.is-loading .button-label,
.primary-button.is-loading .button-flourish {
  display: none;
}

.primary-button.is-loading .button-loading {
  display: inline;
}

.button-loading span {
  display: inline-block;
  width: 1.4em;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1s steps(4, end) infinite;
}

.privacy-note {
  display: flex;
  justify-content: center;
  gap: 9px;
  align-items: center;
  margin: 18px 0 0;
  color: rgba(191, 169, 125, 0.68);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.1em;
}

.privacy-note svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.answer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 660px;
  padding: 18px 0 60px;
}

.oracle-wheel {
  position: relative;
  display: grid;
  width: min(620px, 47vw);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(153, 95, 34, 0.08) 0 27%, transparent 28%),
    radial-gradient(circle, transparent 0 65%, rgba(172, 123, 55, 0.035) 66% 100%);
  box-shadow:
    inset 0 0 50px rgba(172, 122, 50, 0.045),
    0 0 70px rgba(128, 81, 25, 0.04);
}

.oracle-wheel::before,
.oracle-wheel::after {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
}

.oracle-wheel::before {
  inset: 4.5%;
  background: repeating-conic-gradient(
    from 0deg,
    var(--gold) 0deg 0.28deg,
    transparent 0.28deg 3deg
  );
  -webkit-mask: radial-gradient(circle, transparent 0 92%, #000 92.5% 100%);
  mask: radial-gradient(circle, transparent 0 92%, #000 92.5% 100%);
  opacity: 0.72;
}

.oracle-wheel::after {
  inset: 14%;
}

.ring {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.ring-one { inset: 9%; }
.ring-two {
  inset: 25%;
  border-style: dashed;
  opacity: 0.72;
}
.ring-three {
  inset: 34%;
  border-color: rgba(189, 145, 76, 0.58);
}

.cardinal {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
}

.north { top: -17px; left: calc(50% - 17px); }
.south { bottom: -17px; left: calc(50% - 17px); }
.east { top: calc(50% - 17px); right: -17px; }
.west { top: calc(50% - 17px); left: -17px; }

.trigrams {
  position: absolute;
  inset: 0;
  color: var(--gold-bright);
  font-size: clamp(28px, 2.9vw, 43px);
}

.tri {
  position: absolute;
  line-height: 1;
}

.t1 { top: 16%; left: 47%; }
.t2 { top: 25%; right: 18%; transform: rotate(45deg); }
.t3 { top: 48%; right: 11%; transform: rotate(90deg); }
.t4 { right: 19%; bottom: 22%; transform: rotate(135deg); }
.t5 { bottom: 13%; left: 47%; transform: rotate(180deg); }
.t6 { bottom: 22%; left: 18%; transform: rotate(225deg); }
.t7 { top: 48%; left: 11%; transform: rotate(270deg); }
.t8 { top: 25%; left: 18%; transform: rotate(315deg); }

.star-map {
  position: absolute;
  inset: 17%;
  width: 66%;
  height: 66%;
  overflow: visible;
}

.constellation path {
  fill: none;
  stroke: rgba(200, 163, 99, 0.35);
  stroke-width: 1;
}

.constellation circle {
  fill: var(--paper);
  filter: drop-shadow(0 0 4px var(--paper));
}

.answer-top {
  position: relative;
  z-index: 2;
  width: 46%;
  text-align: center;
}

.answer-top > p {
  margin: 0 0 21px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(16px, 1.5vw, 21px);
  letter-spacing: 0.24em;
}

.answer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.9;
}

.answer-placeholder span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(72px, 7.5vw, 108px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.answer-placeholder span:first-child {
  color: var(--paper);
}

.answer-placeholder span:last-child {
  color: var(--cinnabar-bright);
}

.answer-placeholder em {
  width: 100%;
  height: 1px;
  margin: 17px 0;
  background:
    radial-gradient(circle, var(--cinnabar-bright) 0 3px, transparent 4px),
    linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
}

.answer-result strong {
  display: block;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(88px, 9vw, 138px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.9;
  text-shadow: 0 0 30px rgba(230, 199, 140, 0.13);
  animation: answer-in 650ms cubic-bezier(0.18, 0.8, 0.2, 1) both;
}

.answer-result strong.is-no {
  color: var(--cinnabar-bright);
  text-shadow: 0 0 30px rgba(180, 46, 30, 0.15);
}

.answer-result p {
  margin: 28px -60px 0;
  color: var(--paper-dim);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.7;
}

.secondary-button {
  width: 260px;
  min-height: 54px;
  margin-top: 28px;
  border: 1px solid var(--gold);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.16em;
}

.secondary-button:hover:not(:disabled) {
  background: rgba(176, 129, 62, 0.1);
  filter: brightness(1.16);
}

.secondary-button:disabled {
  cursor: default;
  opacity: 0.26;
}

.oracle-wheel.is-reading .ring-one {
  animation: spin 5s linear infinite;
}

.oracle-wheel.is-reading .ring-two {
  animation: spin-reverse 7s linear infinite;
}

.oracle-wheel.is-reading .constellation circle {
  animation: star-pulse 1.2s ease-in-out infinite alternate;
}

.oracle-wheel.has-answer {
  box-shadow:
    inset 0 0 70px rgba(172, 122, 50, 0.08),
    0 0 80px rgba(128, 81, 25, 0.08);
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 104px;
  border-top: 1px solid rgba(173, 130, 67, 0.26);
  padding: 20px 24px;
  color: rgba(202, 180, 136, 0.7);
  text-align: center;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.14em;
}

footer p {
  margin: 0;
}

.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;
}

[hidden] {
  display: none !important;
}

@keyframes answer-in {
  from {
    opacity: 0;
    transform: scale(0.72);
    filter: blur(7px);
  }
}

@keyframes dots {
  from { width: 0; }
}

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

@keyframes spin-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes star-pulse {
  to {
    opacity: 0.25;
    transform: scale(1.7);
    transform-origin: center;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 44px, 720px);
  }

  .question-panel {
    padding: 42px 0 74px;
  }

  .answer-panel {
    min-height: auto;
    padding: 64px 0 80px;
    border-top: 1px solid rgba(173, 130, 67, 0.28);
  }

  .oracle-wheel {
    width: min(620px, calc(100vw - 76px));
  }
}

@media (max-width: 560px) {
  .site-header {
    height: 84px;
    padding: 0 20px;
  }

  .wordmark {
    font-size: 23px;
  }

  .app-shell {
    width: calc(100% - 40px);
  }

  .question-panel {
    padding-top: 30px;
  }

  h1 {
    font-size: clamp(43px, 13vw, 62px);
  }

  .intro p {
    font-size: 15px;
    letter-spacing: 0.08em;
  }

  textarea {
    min-height: 190px;
    padding: 22px 20px 44px;
    font-size: 16px;
  }

  .primary-button {
    width: 92%;
    min-height: 62px;
    gap: 18px;
    font-size: 21px;
  }

  .answer-panel {
    padding-top: 56px;
  }

  .oracle-wheel {
    width: calc(100vw - 56px);
  }

  .cardinal {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .north { top: -14px; left: calc(50% - 14px); }
  .south { bottom: -14px; left: calc(50% - 14px); }
  .east { top: calc(50% - 14px); right: -14px; }
  .west { top: calc(50% - 14px); left: -14px; }

  .answer-top {
    width: 48%;
  }

  .answer-top > p {
    font-size: 14px;
  }

  .answer-placeholder span {
    font-size: clamp(50px, 17vw, 76px);
  }

  .answer-result strong {
    font-size: clamp(65px, 20vw, 92px);
  }

  .answer-result p {
    margin-right: -55px;
    margin-left: -55px;
    font-size: 11px;
  }

  .secondary-button {
    width: 230px;
  }

  footer {
    font-size: 12px;
    line-height: 1.8;
  }
}

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