:root {
  color-scheme: light;
  --paper: #f2efe5;
  --ink: #2d4b41;
  --muted: #73786a;
  --red: #9e4936;
  --line: #d6d6c5;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #dfe4da; }
body { margin: 0; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--red); outline-offset: 6px; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
p, h1, h2, h3 { margin: 0; }
.app { width: 100%; max-width: 520px; min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 28px max(22px, env(safe-area-inset-bottom)); background-color: var(--paper); display: flex; flex-direction: column; }
.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand img { flex-shrink: 0; }
.brand-mark { position: relative; display: block; flex-shrink: 0; width: 34px; height: 34px; }
.brand-frame { display: block; width: 34px; height: 34px; }
.brand-logo { position: absolute; width: 26px; height: 26px; left: 4px; top: 4px; }
.brand strong { display: block; font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: 2px; }
.brand small { display: block; margin-top: 5px; font-family: var(--serif); font-size: 9px; letter-spacing: 3px; color: var(--muted); }
.edition { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.talisman-mark { margin-left: 4px; opacity: .8; }
main { flex: 1; }
.experience { padding-top: 50px; padding-top: clamp(50px, 8vh, 80px); padding-top: clamp(50px, 8svh, 80px); position: relative; isolation: isolate; }
.experience::before { content: ""; position: absolute; z-index: -1; pointer-events: none; top: 15px; left: -28px; right: -28px; height: 180px; background: url("assets/cloud-scroll.svg") no-repeat calc(100% + 105px) 10px / 300px auto; opacity: .23; }
.introduction { text-align: center; }
.eyebrow { font-size: 10px; letter-spacing: 4px; color: var(--red); }
h1 { font-family: var(--serif); font-size: 52px; font-weight: 400; letter-spacing: 6px; line-height: 1.25; }
.introduction h1 { margin: 19px 0 16px; padding-left: 9px; }
.question-mark { color: var(--red); }
.intro-copy { font-size: 12px; letter-spacing: 1px; color: var(--muted); line-height: 1.8; }
.ritual { width: 248px; width: min(248px, 76vw); height: 248px; height: min(248px, 76vw); aspect-ratio: 1; margin: 30px auto 0; border-radius: 50%; position: relative; display: grid; place-items: center; }
.ritual::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(ellipse at 20% 70%, rgba(90, 125, 95, .12), transparent 65%), radial-gradient(ellipse at 82% 20%, rgba(155, 130, 84, .08), transparent 60%); }
.bronze-rim { width: 100%; height: 100%; position: absolute; inset: 0; }
.nine-words { position: absolute; width: calc(100% + 36px); height: calc(100% + 36px); left: -18px; top: -18px; pointer-events: none; fill: #7d765f; font-family: var(--serif); font-size: 10px; letter-spacing: 6px; }
.ritual-label { position: absolute; top: calc(50% - 7px); font-family: var(--serif); font-size: 11px; color: #75836d; padding: 2px 0; }
.label-left { left: -12px; }
.label-right { right: -12px; }
.gateway { width: 154px; position: relative; transition: opacity 250ms; }
.gateway img { display: block; width: 100%; height: auto; }
.casting-lines { position: absolute; width: 100px; display: flex; flex-direction: column-reverse; }
.casting-lines .yao + .yao { margin-bottom: 12px; }
.yao { display: flex; width: 100%; height: 7px; flex-shrink: 0; }
.yao span { flex: 1; height: 100%; background: var(--ink); }
.yao span + span { margin-left: 18px; }
.casting-lines .yao { opacity: 0; transform: translateY(5px); }
.casting-lines .yao.is-visible { animation: line-arrive 460ms ease-out both; }
@keyframes line-arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.ritual-caption { display: flex; justify-content: center; align-items: center; gap: 13px; margin-top: 33px; min-height: 18px; }
.ritual-caption p { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; }
.caption-rule { width: 15px; height: 1px; background: #ccd0c3; }
.start-actions { margin-top: 35px; text-align: center; min-height: 99px; transition: opacity 200ms; }
.primary-button { width: 116px; min-height: 56px; margin: 0 auto; background: var(--red); color: var(--paper); border: 1px solid #8a4433; display: flex; align-items: center; justify-content: center; position: relative; letter-spacing: 7px; font-family: var(--serif); font-size: 21px; padding: 13px 16px 13px 23px; transition: background 200ms, transform 200ms; }
.primary-button::before { content: ""; position: absolute; pointer-events: none; inset: 3px; border: 1px solid rgba(242, 239, 229, .4); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.action-note { margin-top: 15px; font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.app[data-stage="casting"] .gateway, .app[data-stage="settled"] .gateway { opacity: 0; }
.app[data-stage="casting"] .start-actions, .app[data-stage="settled"] .start-actions { opacity: 0; visibility: hidden; pointer-events: none; }
.app[data-stage="casting"] .introduction h1 { font-size: 40px; line-height: 65px; letter-spacing: 4px; }
.app[data-stage="settled"] .introduction h1 { color: var(--red); }
.footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); position: relative; isolation: isolate; }
.footer::before { content: ""; position: absolute; z-index: -1; pointer-events: none; width: 190px; height: 65px; right: 30px; top: -19px; background: url("assets/cloud-scroll.svg") no-repeat center / contain; opacity: .14; transform: rotate(180deg); }
.footer-heading { display: flex; justify-content: space-between; align-items: center; color: #737969; font-family: var(--serif); font-size: 11px; letter-spacing: 2px; }
.footer-seal { border: 1px solid #bb6a52; color: var(--red); padding: 1px 2px 2px 3px; font-size: 12px; line-height: 1; }
.footer p { margin-top: 9px; font-size: 9px; color: var(--muted); letter-spacing: .7px; }
.result { padding-top: 43px; animation: result-arrive 650ms ease-out both; }
@keyframes result-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-intro { text-align: center; }
.result-intro .eyebrow { font-size: 9px; letter-spacing: 2px; }
.result-intro h1 { margin-top: 14px; font-size: 38px; padding-left: 4px; }
.result-intro h1:focus { outline: none; }
.hexagram-card { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 25px 0; margin: 30px 0 31px; padding: 29px 15px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; isolation: isolate; }
.hexagram-card::before { content: ""; position: absolute; z-index: -1; pointer-events: none; right: 0; bottom: 0; width: 145px; height: 47px; background: url("assets/cloud-scroll.svg") no-repeat center / contain; opacity: .17; }
.result-lines { width: 87px; display: flex; flex-direction: column-reverse; justify-self: center; }
.result-lines .yao + .yao { margin-bottom: 9px; }
.result-lines .yao { height: 6px; }
.result-lines .yao span + span { margin-left: 16px; }
.hexagram-heading { border-left: 1px solid var(--line); padding-left: 23px; }
.hexagram-number { font-size: 9px; letter-spacing: 2px; color: var(--red); }
.hexagram-heading h2 { font-family: var(--serif); font-size: 37px; line-height: 1.25; font-weight: 400; letter-spacing: 3px; margin: 7px 0; overflow-wrap: anywhere; }
.hexagram-full-name { font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.trigram-pair { grid-column: 1 / -1; text-align: center; font-size: 10px; color: var(--muted); letter-spacing: 2px; }
.reading-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reading-header h2 { font-family: var(--serif); font-size: 18px; font-weight: 500; letter-spacing: 2px; }
.reading-badge { flex-shrink: 0; font-size: 9px; color: var(--red); border: 1px solid #d8bcaa; padding: 4px 6px; letter-spacing: 1px; }
.reading-origin { margin-top: 22px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.origin-label { color: var(--muted); font-size: 9px; letter-spacing: 2px; margin-bottom: 7px; }
.origin-text { font-family: var(--serif); font-size: 17px; line-height: 1.8; letter-spacing: 1px; overflow-wrap: anywhere; }
.reading-source { margin-top: 24px; color: var(--muted); font-size: 10px; line-height: 1.8; letter-spacing: .5px; }
.reading-theme { font-family: var(--serif); font-size: 22px; line-height: 1.65; margin: 19px 0 22px; letter-spacing: 1px; }
.reading-section { margin-top: 22px; }
.reading-section h3 { font-size: 11px; font-weight: 500; letter-spacing: 2px; margin-bottom: 9px; }
.reading-section h3 span { color: var(--red); font-family: var(--serif); font-size: 10px; margin-right: 6px; }
.reading-section p { font-size: 13px; line-height: 1.95; color: #626b5f; letter-spacing: .4px; overflow-wrap: anywhere; }
.result-actions { margin-top: 32px; text-align: center; }
.closing-note { font-family: var(--serif); font-size: 11px; color: var(--muted); letter-spacing: .5px; margin-bottom: 22px; }
.secondary-button { min-height: 52px; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 13px 20px; background: transparent; color: var(--ink); border: 1px solid #bac1b3; font-size: 13px; letter-spacing: 3px; }
.small-yao { width: 18px; height: 9px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.fallback { line-height: 1.8; color: var(--red); font-size: 13px; padding-top: 20px; }
@media (hover: hover) { .primary-button:hover { background: #8b3f30; } .secondary-button:hover { background: #e8e9dc; } }
@media (min-width: 600px) { .app { border-left: 1px solid #dbded3; border-right: 1px solid #dbded3; padding-right: 42px; padding-left: 42px; } .experience { padding-top: 66px; } .ritual { width: 260px; height: 260px; } }
@media (max-height: 740px) { .experience { padding-top: 35px; } .ritual { width: 210px; height: 210px; margin-top: 24px; } .start-actions { margin-top: 25px; } .footer { margin-top: 24px; } }
@media (max-width: 350px) { .app { padding-left: 22px; padding-right: 22px; } .edition { font-size: 9px; gap: 5px; } .brand strong { font-size: 14px; } h1 { font-size: 46px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; } .casting-lines .yao.is-visible { opacity: 1; transform: none; } }
