@font-face {
  font-family: "Source Han Serif";
  src: url("fonts/02_SourceHanSerif-VF/Variable/WOFF2/OTF/Subset/SourceHanSerifCN-VF.otf.woff2") format("woff2");
  font-display: swap;
  font-weight: 200 900;
}

@font-face {
  font-family: "Ma Shan";
  src: url("fonts/Ma_Shan_Zheng/MaShanZheng-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #0b0f0c;
  --ink-soft: #171b15;
  --paper: #e8ddc4;
  --paper-muted: #a99e87;
  --bronze: #b98a43;
  --bronze-bright: #e1b766;
  --bronze-dark: #604322;
  --cinnabar: #9e3e2c;
  --line: rgba(196, 157, 91, 0.23);
  --panel: rgba(10, 13, 10, 0.9);
  --serif: "Source Han Serif", "Noto Serif", Georgia, serif;
  --body: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 53% 43%, rgba(132, 96, 48, 0.34), transparent 46%),
    #0a0d0a;
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

#loading-screen {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #080a08;
  color: var(--paper-muted);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 10px;
}

.loading-seal {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(194, 66, 42, 0.8);
  color: #c4523d;
  font-family: "Ma Shan", var(--serif);
  font-size: 36px;
  transform: rotate(-2deg);
}

#experience {
  position: relative;
  min-height: 100dvh;
  isolation: isolate;
}

#scene-container,
#scene-container canvas {
  position: fixed;
  z-index: -4;
  inset: 0;
  width: 100%;
  height: 100%;
}

.atmosphere {
  position: fixed;
  z-index: -2;
  inset: 0;
  pointer-events: none;
}

.atmosphere-ink {
  background:
    radial-gradient(ellipse at 57% 48%, transparent 0 38%, rgba(4, 7, 5, 0.06) 63%, rgba(2, 4, 3, 0.42) 100%),
    linear-gradient(90deg, rgba(2, 4, 3, 0.17), transparent 30%, transparent 75%, rgba(2, 4, 3, 0.16));
}

.atmosphere-grain {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(231, 210, 165, 0.13) 0 0.45px, transparent 0.8px),
    radial-gradient(circle at 73% 64%, rgba(202, 169, 106, 0.1) 0 0.4px, transparent 0.75px),
    radial-gradient(circle at 41% 87%, rgba(255, 240, 205, 0.07) 0 0.35px, transparent 0.7px);
  background-position: 0 0, 13px 7px, 5px 17px;
  background-size: 19px 23px, 29px 31px, 37px 41px;
  mix-blend-mode: soft-light;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(24px, 3.6vw, 68px);
  pointer-events: none;
}

.brand,
.sound-button {
  border: 0;
  pointer-events: auto;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
}

.brand-seal {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(173, 61, 41, 0.72);
  color: #c2563f;
  font-family: "Ma Shan", var(--serif);
  font-size: 22px;
  line-height: 1;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.34em;
}

.brand-domain {
  color: var(--paper-muted);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.sound-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--paper-muted);
  background: transparent;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sound-rings {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 22px;
  height: 20px;
}

.sound-rings i {
  display: block;
  width: 2px;
  height: 6px;
  background: var(--bronze);
  border-radius: 1px;
  transition: height 180ms ease;
}

.sound-rings i:nth-child(2) {
  height: 12px;
}

.sound-rings i:nth-child(3) {
  height: 18px;
}

.sound-button[aria-pressed="false"] .sound-rings i {
  height: 2px;
  opacity: 0.55;
}

.consultation-panel {
  position: fixed;
  z-index: 8;
  top: 50%;
  left: clamp(30px, 5.2vw, 100px);
  width: min(390px, 34vw);
  transform: translateY(-46%);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--bronze-bright);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.28em;
  line-height: 1.5;
  text-transform: uppercase;
}

.eyebrow span {
  margin-right: 8px;
  font-size: 14px;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(42px, 4.15vw, 76px);
  font-weight: 360;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

h1 em {
  color: #c7bba4;
  font-weight: 290;
}

.intro-copy {
  max-width: 360px;
  margin: 25px 0 27px;
  color: var(--paper-muted);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.7;
}

.question-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--paper-muted);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.question-label span {
  opacity: 0.62;
}

.question-field {
  position: relative;
}

.question-field input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 14px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--paper);
  background: rgba(16, 19, 15, 0.72);
  font-family: var(--serif);
  font-size: 13px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.question-field input::placeholder {
  color: rgba(181, 170, 148, 0.5);
}

.question-field input:focus {
  border-color: rgba(213, 167, 86, 0.58);
  background: rgba(10, 13, 10, 0.84);
  box-shadow: 0 0 0 3px rgba(181, 132, 58, 0.08);
}

.field-mark {
  position: absolute;
  top: 50%;
  right: 15px;
  color: var(--bronze);
  font-family: var(--serif);
  transform: translateY(-50%);
}

.cast-button,
.again-button {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(190, 138, 69, 0.5);
  cursor: pointer;
  background: rgba(110, 72, 31, 0.2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cast-button {
  display: flex;
  width: 188px;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 14px 0 17px;
  font-size: 9px;
  font-weight: 700;
}

.cast-button::before,
.again-button::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(192, 135, 61, 0.22), transparent);
  content: "";
  transform: translateX(-104%);
  transition: transform 350ms ease;
}

.cast-button:hover::before,
.cast-button:focus-visible::before,
.again-button:hover::before,
.again-button:focus-visible::before {
  transform: translateX(0);
}

.cast-button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.button-mark {
  color: var(--bronze-bright);
  font-family: var(--serif);
  font-size: 18px;
}

.method-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 11px 0 0;
  color: rgba(178, 167, 144, 0.55);
  font-size: 7px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.method-note span {
  color: var(--cinnabar);
  font-size: 5px;
}

.cast-progress {
  position: fixed;
  z-index: 8;
  top: 50%;
  right: clamp(32px, 5vw, 96px);
  width: min(285px, 24vw);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-44%) translateX(20px);
  transition: opacity 580ms ease, transform 580ms ease;
  visibility: hidden;
}

body[data-state="casting"] .cast-progress {
  opacity: 1;
  transform: translateY(-44%) translateX(0);
  visibility: visible;
}

.progress-heading,
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--paper-muted);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.progress-heading strong {
  color: var(--bronze-bright);
  font-size: 10px;
}

.line-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.line-stack li {
  display: grid;
  min-height: 13px;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: 10px;
  opacity: 0.52;
}

.line-stack li.is-cast {
  opacity: 1;
}

.line-stack li.is-new {
  animation: line-reveal 580ms cubic-bezier(0.22, 0.75, 0.25, 1);
}

@keyframes line-reveal {
  0% {
    opacity: 0;
    transform: translateX(18px);
  }
}

.line-stack small {
  color: rgba(189, 177, 152, 0.5);
  font-size: 8px;
}

.line-placeholder,
.line-visual {
  display: flex;
  width: 100%;
  height: 9px;
  align-items: center;
  justify-content: space-between;
}

.line-placeholder::before {
  width: 100%;
  height: 1px;
  background: rgba(181, 151, 99, 0.17);
  content: "";
}

.line-visual::before,
.line-visual::after {
  display: block;
  height: 7px;
  background: linear-gradient(90deg, #98713a, #d1a75f);
  box-shadow: 0 0 12px rgba(182, 127, 53, 0.12);
  content: "";
}

.line-visual.yang::before {
  width: 100%;
}

.line-visual.yang::after {
  display: none;
}

.line-visual.yin::before,
.line-visual.yin::after {
  width: 43%;
}

.line-visual.moving::before,
.line-visual.moving::after {
  background: linear-gradient(90deg, #a44731, #d66a4e);
}

.line-visual.moving {
  position: relative;
}

.line-visual.moving b {
  position: absolute;
  top: 50%;
  right: -1px;
  display: grid;
  width: 12px;
  height: 12px;
  place-items: center;
  border: 1px solid rgba(204, 87, 60, 0.7);
  border-radius: 50%;
  color: #dc795f;
  background: var(--ink);
  font-size: 7px;
  transform: translate(135%, -50%);
}

.cast-message {
  min-height: 76px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cast-message > * {
  display: block;
}

#cast-kicker {
  margin-bottom: 4px;
  color: var(--bronze);
  font-size: 7px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#cast-status {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 420;
  line-height: 1.35;
}

#coin-result {
  margin-top: 6px;
  color: var(--paper-muted);
  font-size: 10px;
  letter-spacing: 0.07em;
}

.reading-panel {
  position: fixed;
  z-index: 12;
  top: 50%;
  right: clamp(25px, 3.5vw, 68px);
  width: min(760px, 55vw);
  max-height: calc(100dvh - 130px);
  overflow: auto;
  padding: 25px 29px 22px;
  border: 1px solid rgba(183, 143, 78, 0.23);
  outline: 0;
  background:
    linear-gradient(135deg, rgba(182, 129, 53, 0.035), transparent 46%),
    rgba(13, 17, 13, 0.9);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  scrollbar-color: rgba(183, 143, 78, 0.4) transparent;
  transform: translateY(-48%);
  backdrop-filter: blur(16px);
}

.reading-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.reading-header .eyebrow {
  margin-bottom: 7px;
}

.reading-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(31px, 3vw, 46px);
  font-weight: 350;
  letter-spacing: -0.04em;
  line-height: 1;
}

.asked-question {
  max-width: 42%;
  margin: 0;
  color: var(--paper-muted);
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
  line-height: 1.4;
  text-align: right;
}

.hexagram-reading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 15px;
  padding: 22px 0;
}

.hexagram-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 17px;
}

.hexagram-figure {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 6px;
  width: 82px;
}

.hexagram-figure .line-visual {
  height: 8px;
}

.hexagram-figure .line-visual::before,
.hexagram-figure .line-visual::after {
  height: 6px;
}

.hexagram-label {
  margin: 0 0 5px;
  color: var(--bronze);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hexagram-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  font-family: var(--serif);
}

.hexagram-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 6px;
}

.hexagram-title-row .hexagram-title {
  flex: 1 1 auto;
}

.hexagram-title b {
  color: var(--paper);
  font-size: 19px;
  font-weight: 470;
}

.hexagram-title em {
  color: var(--cinnabar);
  font-family: "Ma Shan", var(--serif);
  font-size: 29px;
  font-style: normal;
  line-height: 1;
}

.meaning-audio-button {
  position: relative;
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(225, 183, 102, 0.62);
  border-radius: 50%;
  outline: 0;
  color: var(--bronze-bright);
  background:
    radial-gradient(circle, rgba(185, 138, 67, 0.16), rgba(11, 15, 12, 0.76) 68%);
  box-shadow:
    inset 0 0 0 3px rgba(185, 138, 67, 0.045),
    0 0 0 0 rgba(225, 183, 102, 0.42);
  cursor: pointer;
  animation: meaning-audio-pulse 1.9s ease-out infinite;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.meaning-audio-button:hover {
  border-color: rgba(225, 183, 102, 0.94);
  color: #f2cf86;
  transform: translateY(-1px);
}

.meaning-audio-button:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.meaning-audio-button[data-audio-state="playing"] {
  border-color: var(--bronze-bright);
  color: var(--paper);
  background: rgba(185, 138, 67, 0.22);
  animation: none;
}

.meaning-audio-button[data-audio-state="loading"] {
  cursor: wait;
}

.meaning-audio-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  animation: none;
}

.meaning-audio-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.meaning-audio-icon::before {
  position: absolute;
  top: 1px;
  left: 4px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  content: "";
}

.meaning-audio-icon::after {
  content: none;
}

.meaning-audio-button[data-audio-state="playing"] .meaning-audio-icon::before,
.meaning-audio-button[data-audio-state="playing"] .meaning-audio-icon::after {
  position: absolute;
  top: 1px;
  width: 4px;
  height: 12px;
  border: 0;
  background: currentColor;
  content: "";
}

.meaning-audio-button[data-audio-state="playing"] .meaning-audio-icon::before {
  left: 2px;
}

.meaning-audio-button[data-audio-state="playing"] .meaning-audio-icon::after {
  right: 2px;
}

@keyframes meaning-audio-pulse {
  0% {
    box-shadow:
      inset 0 0 0 3px rgba(185, 138, 67, 0.045),
      0 0 0 0 rgba(225, 183, 102, 0.42);
  }

  72% {
    box-shadow:
      inset 0 0 0 3px rgba(185, 138, 67, 0.045),
      0 0 0 10px rgba(225, 183, 102, 0);
  }

  100% {
    box-shadow:
      inset 0 0 0 3px rgba(185, 138, 67, 0.045),
      0 0 0 0 rgba(225, 183, 102, 0);
  }
}

.hexagram-theme {
  margin: 0 0 8px;
  color: #d0c3aa;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
}

.hexagram-meaning {
  margin: 0;
  color: var(--paper-muted);
  font-size: 12px;
  line-height: 1.5;
}

.hexagram-advice {
  margin: 9px 0 0;
  color: #c7b795;
  font-size: 11px;
  line-height: 1.45;
}

.hexagram-advice strong {
  color: var(--bronze-bright);
  font-weight: 550;
}

.transformation-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--cinnabar);
  font-family: "Ma Shan", var(--serif);
}

.transformation-mark span {
  width: 1px;
  height: 34px;
  background: linear-gradient(transparent, rgba(170, 68, 47, 0.6));
}

.transformation-mark span:last-child {
  background: linear-gradient(rgba(170, 68, 47, 0.6), transparent);
}

.transformation-mark b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(171, 67, 48, 0.62);
  font-size: 17px;
  font-weight: 400;
}

.hexagram-reading.no-change {
  grid-template-columns: 1fr;
}

.hexagram-reading.no-change .primary-card {
  max-width: 480px;
}

.hexagram-reading.no-change .transformation-mark,
.hexagram-reading.no-change .relating-card {
  display: none;
}

.changing-section {
  padding: 16px 0 18px;
  border-top: 1px solid var(--line);
}

.section-heading small {
  color: rgba(174, 162, 140, 0.6);
  font-size: 8px;
}

.changing-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 12px 0 0;
  padding: 0;
  background: var(--line);
  list-style: none;
}

.changing-lines li {
  min-height: 76px;
  padding: 11px 13px;
  background: rgba(9, 12, 9, 0.96);
}

.changing-lines li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.changing-lines strong {
  display: block;
  margin-bottom: 4px;
  color: var(--bronze-bright);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 520;
}

.changing-lines p {
  margin: 0;
  color: var(--paper-muted);
  font-size: 11px;
  line-height: 1.45;
}

.changing-section.no-moving-lines .changing-lines {
  display: block;
  background: transparent;
}

.changing-section.no-moving-lines .changing-lines li {
  min-height: 0;
  padding: 11px 0 0;
  color: var(--paper-muted);
  background: transparent;
  font-size: 10px;
}

.reading-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.reading-footer p {
  max-width: 74%;
  margin: 0;
  color: #b9ac93;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.5;
}

.again-button {
  flex: 0 0 auto;
  min-width: 116px;
  height: 36px;
  padding: 0 13px;
  font-size: 8px;
  font-weight: 650;
}

.again-button span {
  margin-right: 7px;
  color: var(--bronze-bright);
}

.site-footer {
  position: fixed;
  z-index: 5;
  right: clamp(24px, 3.6vw, 68px);
  bottom: 20px;
  left: clamp(24px, 3.6vw, 68px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(182, 170, 145, 0.34);
  font-size: 7px;
  letter-spacing: 0.22em;
  pointer-events: none;
}

.footer-trigrams {
  color: rgba(190, 147, 78, 0.46);
  font-size: 11px;
  letter-spacing: 0.42em;
}

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

body[data-state="casting"] .consultation-panel,
body[data-state="reading"] .consultation-panel {
  pointer-events: none;
}

@media (max-width: 1100px) {
  .consultation-panel {
    left: 38px;
    width: 350px;
  }

  .cast-progress {
    top: auto;
    right: 35px;
    bottom: clamp(22px, 4vh, 36px);
    width: 245px;
    transform: translateY(16px) translateX(20px);
  }

  body[data-state="casting"] .cast-progress {
    transform: translateY(0) translateX(0);
  }

  .reading-panel {
    right: 24px;
    width: min(660px, 63vw);
    padding-right: 22px;
    padding-left: 22px;
  }

  .hexagram-reading {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
    gap: 10px;
  }

  .hexagram-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .hexagram-figure {
    width: 68px;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #experience {
    min-height: 100dvh;
    padding-bottom: 58px;
  }

  .site-header {
    position: absolute;
    padding: calc(18px + env(safe-area-inset-top)) 18px 18px;
  }

  .brand-name {
    font-size: 11px;
  }

  .sound-button {
    font-size: 0;
  }

  .consultation-panel {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    max-width: 520px;
    min-height: 100dvh;
    margin: 0 auto;
    padding: clamp(156px, 24vh, 220px) 22px 58px;
    transform: none;
  }

  h1 {
    font-size: clamp(40px, 13.2vw, 60px);
  }

  .intro-copy {
    max-width: 330px;
    margin: 21px 0 23px;
    font-size: 13px;
  }

  .cast-button {
    width: 100%;
  }

  .cast-progress {
    position: fixed;
    top: auto;
    right: 22px;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 22px;
    display: none;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding-top: 0;
    opacity: 0;
    transform: translateY(16px);
  }

  body[data-state="casting"] .cast-progress {
    display: block;
    opacity: 1;
    transform: translateY(0);
  }

  body[data-state="casting"] .consultation-panel,
  body[data-state="reading"] .consultation-panel {
    position: absolute;
    inset: 0;
  }

  .line-stack {
    gap: 6px;
    margin: 14px 0;
  }

  .reading-panel {
    position: relative;
    top: auto;
    right: auto;
    width: calc(100% - 24px);
    max-height: none;
    margin: clamp(300px, 54vh, 500px) auto 28px;
    padding: 20px 16px;
    overflow: visible;
    transform: none;
    backdrop-filter: blur(12px);
  }

  .reading-header {
    display: block;
  }

  .asked-question {
    max-width: none;
    margin-top: 10px;
    text-align: left;
  }

  .hexagram-reading {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hexagram-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .transformation-mark {
    flex-direction: row;
  }

  .transformation-mark span {
    width: 35%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(170, 68, 47, 0.6));
  }

  .transformation-mark span:last-child {
    background: linear-gradient(90deg, rgba(170, 68, 47, 0.6), transparent);
  }

  .changing-lines {
    grid-template-columns: 1fr;
  }

  .reading-footer {
    display: block;
  }

  .reading-footer p {
    max-width: none;
    margin-bottom: 14px;
  }

  .again-button {
    width: 100%;
  }

  .site-footer {
    position: absolute;
    right: 18px;
    bottom: 16px;
    left: 18px;
  }

  .site-footer > span:first-child,
  .site-footer > span:last-child {
    display: none;
  }

  .footer-trigrams {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 1024px) {
  body[data-state="reading"] {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body[data-state="reading"] #experience {
    min-height: 100dvh;
    padding-bottom: 32px;
  }

  body[data-state="reading"] .site-header {
    position: fixed;
    padding: calc(18px + env(safe-area-inset-top)) clamp(18px, 3vw, 28px) 18px;
  }

  body[data-state="reading"] .reading-panel {
    position: relative;
    top: auto;
    right: auto;
    width: calc(100% - 24px);
    max-width: 900px;
    max-height: none;
    margin: calc(92px + env(safe-area-inset-top)) auto 28px;
    overflow: visible;
    transform: none;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .consultation-panel {
    transform: translateY(-42%) scale(0.9);
    transform-origin: left center;
  }

  .cast-progress {
    top: auto;
    bottom: 22px;
    transform: translateY(12px) scale(0.9);
    transform-origin: right bottom;
  }

  body[data-state="casting"] .cast-progress {
    transform: translateY(0) scale(0.9);
  }

  .reading-panel {
    max-height: calc(100dvh - 100px);
    transform: translateY(-48%) scale(0.92);
    transform-origin: right center;
  }
}

@media (min-width: 1025px) {
  body[data-state="reading"] .reading-panel {
    top: 64px;
    bottom: auto;
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    scroll-padding-bottom: 76px;
    transform: none;
  }

  body[data-state="reading"] .reading-footer {
    position: sticky;
    z-index: 3;
    bottom: -22px;
    margin-bottom: -22px;
    padding-bottom: 22px;
    background:
      linear-gradient(180deg, rgba(13, 17, 13, 0.72), rgba(13, 17, 13, 0.99) 28%);
    box-shadow: 0 -14px 22px rgba(13, 17, 13, 0.72);
  }
}

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