:root {
  --ink: #08090b;
  --ink-soft: #0d1012;
  --panel: rgba(16, 18, 18, .84);
  --gold: #d9ab4e;
  --gold-bright: #ffe8a0;
  --gold-dim: #88692d;
  --line: rgba(208, 162, 67, .28);
  --mist: #a3a6a1;
  --paper: #f2e8c7;
  --muted-paper: #b9ab83;
  --shadow: rgba(0, 0, 0, .55);
  color-scheme: dark;
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 15%, rgba(93, 73, 36, .16), transparent 27rem),
    radial-gradient(circle at 50% 100%, rgba(72, 52, 27, .13), transparent 28rem),
    var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 4px; }

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 720px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 20px clamp(18px, 6vw, 42px) 18px;
  isolation: isolate;
}

.app-shell::before,
.app-shell::after {
  position: fixed;
  z-index: -3;
  inset: 0;
  pointer-events: none;
  content: "";
}

.app-shell::before {
  opacity: .26;
  background-image:
    linear-gradient(115deg, transparent 0 47%, rgba(193, 147, 57, .09) 47.1% 47.2%, transparent 47.3%),
    linear-gradient(21deg, transparent 0 63%, rgba(193, 147, 57, .06) 63.1% 63.2%, transparent 63.3%);
  background-size: 170px 220px, 230px 310px;
  mask-image: radial-gradient(circle at center, black, transparent 77%);
}

.app-shell::after {
  z-index: -2;
  opacity: .45;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
}

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

.ambient { position: fixed; z-index: -1; border: 1px solid rgba(203, 154, 57, .07); border-radius: 50%; pointer-events: none; }
.ambient--one { width: 62vw; height: 62vw; max-width: 440px; max-height: 440px; top: 9vh; right: -33vw; transform: rotate(25deg); }
.ambient--two { width: 72vw; height: 72vw; max-width: 520px; max-height: 520px; bottom: 5vh; left: -46vw; border-color: rgba(203, 154, 57, .05); }

.site-header,
.site-footer { position: relative; z-index: 2; flex: 0 0 auto; }

.site-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
}

.brand-mark { position: relative; display: grid; place-items: center; width: 33px; height: 33px; color: var(--gold-bright); }
.brand-mark__ring { position: absolute; inset: 2px; border: 1px solid var(--gold-dim); border-radius: 50%; transform: rotate(45deg); }
.brand-mark__ring::after { position: absolute; inset: 5px; border: 1px solid rgba(219, 172, 79, .5); content: ""; }
.brand-mark__core { font-size: 14px; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--gold); font: 600 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .18em; }
.header-note { margin: 4px 0 0; color: #83857f; font-size: 10px; letter-spacing: .15em; }
.status-pill { display: flex; align-items: center; gap: 6px; margin-left: auto; color: #777970; font: 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; }
.status-pill span { width: 5px; height: 5px; border-radius: 50%; background: #b6c17f; box-shadow: 0 0 8px #d6dc96; }

.main-content { display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; }

.view { display: none; width: 100%; padding: 22px 0 30px; animation: view-in .6s ease both; }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.view--home { text-align: center; }
.hero-copy { position: relative; z-index: 1; margin: clamp(25px, 8vh, 62px) auto 0; }
.kicker { margin: 0 0 13px; color: var(--gold); font: 600 10px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .25em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--paper); font-size: clamp(40px, 13vw, 72px); font-weight: 600; letter-spacing: .08em; line-height: 1.13; text-shadow: 0 0 25px rgba(227, 185, 85, .13); }
h1 span { color: var(--gold-bright); }
.hero-subtitle { margin: 18px auto 0; color: #9b9d96; font-size: 13px; letter-spacing: .12em; line-height: 2; }

.oracle-stage { position: relative; display: grid; place-items: center; }
.oracle-stage--home { width: min(80vw, 335px); height: min(47vh, 370px); min-height: 290px; margin: clamp(8px, 3vh, 25px) auto 5px; }
.halo { position: absolute; border: 1px solid rgba(211, 167, 71, .2); border-radius: 50%; transform: rotate(37deg); }
.halo--large { width: 76%; height: 53%; box-shadow: 0 0 45px rgba(206, 153, 49, .09), inset 0 0 26px rgba(206, 153, 49, .07); }
.halo--small { width: 52%; height: 38%; border-color: rgba(224, 185, 91, .34); transform: rotate(-26deg); }
.halo--small::before, .halo--small::after { position: absolute; width: 5px; height: 5px; border: 1px solid var(--gold); border-radius: 50%; content: ""; }
.halo--small::before { top: -3px; left: 20%; }
.halo--small::after { right: 17%; bottom: -3px; }
.floating-glyph { position: absolute; color: var(--gold); font-size: 15px; opacity: .7; animation: glyph-float 4.5s ease-in-out infinite; }
.floating-glyph--left { top: 26%; left: 7%; }
.floating-glyph--right { right: 4%; bottom: 25%; animation-delay: -1.9s; font-size: 12px; }
@keyframes glyph-float { 0%,100% { transform: translateY(4px) rotate(0); opacity: .5; } 50% { transform: translateY(-6px) rotate(18deg); opacity: .9; } }

.talisman { position: relative; display: block; border: 0; padding: 0; color: var(--paper); background: transparent; cursor: pointer; }
.talisman__svg { display: block; width: 100%; height: 100%; overflow: visible; }
.talisman--hero { z-index: 1; width: 132px; height: 220px; filter: drop-shadow(0 14px 18px rgba(0,0,0,.45)); animation: talisman-hover 4.5s ease-in-out infinite; }
.talisman--hero::before, .talisman--seal::before { position: absolute; z-index: -1; inset: 15% 4%; border-radius: 50%; background: rgba(195, 145, 47, .18); box-shadow: 0 0 48px 14px rgba(191, 137, 36, .17); content: ""; filter: blur(15px); }
.talisman--hero:hover .talisman__runes, .talisman--seal:hover .talisman__runes { filter: drop-shadow(0 0 7px #ffeaa4); }
.talisman__caption { position: absolute; right: 0; bottom: 24px; left: 0; color: #f3dda0; font-size: 12px; letter-spacing: .24em; text-indent: .24em; text-shadow: 0 0 12px rgba(240, 204, 107, .6); }
@keyframes talisman-hover { 0%,100% { transform: translateY(5px) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }

.home-actions { margin-top: 5px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 24px; min-width: 180px; border: 1px solid rgba(224, 183, 89, .85); border-radius: 2px; padding: 13px 18px 13px 23px; color: #17130a; background: linear-gradient(115deg, #e7c26d, #b58131); box-shadow: 0 0 0 4px rgba(195, 142, 41, .07), 0 9px 27px rgba(0,0,0,.36), inset 0 0 12px rgba(255, 236, 165, .24); cursor: pointer; font-size: 13px; letter-spacing: .2em; text-indent: .2em; transition: transform .22s ease, filter .22s ease, box-shadow .22s ease; }
.primary-button:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 0 0 4px rgba(195, 142, 41, .11), 0 12px 30px rgba(0,0,0,.45), inset 0 0 12px rgba(255, 236, 165, .3); }
.primary-button:active { transform: translateY(1px); }
.button-arrow { font-family: ui-sans-serif, sans-serif; font-size: 16px; line-height: 1; }
.microcopy { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 17px 0 0; color: #70736c; font-size: 10px; letter-spacing: .08em; }
.microcopy__dot { width: 4px; height: 4px; border: 1px solid var(--gold); border-radius: 50%; }

.view-heading { margin-top: clamp(18px, 7vh, 58px); text-align: center; }
.view-heading h2, .interpretation-card h2 { margin: 0; color: var(--paper); font-size: clamp(20px, 6vw, 29px); font-weight: 500; letter-spacing: .08em; line-height: 1.5; }
.view-heading > p:last-child { margin: 10px 0 0; color: #858981; font-size: 12px; letter-spacing: .08em; }

.ritual-stage { position: relative; display: grid; place-items: center; height: min(50vh, 370px); min-height: 290px; margin-top: 8px; }
.ritual-spark { position: absolute; color: var(--gold-bright); opacity: .7; }
.ritual-spark--a { top: 17%; right: 19%; font-size: 15px; animation: spark-pulse 2.3s ease-in-out infinite; }
.ritual-spark--b { bottom: 19%; left: 19%; font-size: 20px; animation: spark-pulse 2.3s ease-in-out -1s infinite; }
@keyframes spark-pulse { 0%,100% { opacity: .22; transform: scale(.75); } 50% { opacity: 1; transform: scale(1.15); } }
.ritual-orbit { position: absolute; border: 1px solid rgba(218, 172, 74, .18); border-radius: 50%; pointer-events: none; }
.ritual-orbit--outer { width: min(88vw, 330px); height: min(24vw, 92px); transform: rotate(-18deg); animation: orbit-spin 12s linear infinite; }
.ritual-orbit--inner { width: min(68vw, 255px); height: min(18vw, 68px); border-color: rgba(218, 172, 74, .12); transform: rotate(22deg); animation: orbit-spin 9s linear -3s infinite reverse; }
@keyframes orbit-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
.ritual-svg { width: min(47vw, 190px); height: min(68vw, 295px); overflow: visible; filter: drop-shadow(0 0 3px rgba(255, 220, 119, .15)); }
.ritual-trace { fill: none; stroke: url(#ritualGold); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ritual-trace--frame { stroke-width: 1.5; opacity: .34; }
.ritual-trace--inner { stroke-width: 1.1; opacity: .19; }
.ritual-trace--runes { stroke-width: 2.3; opacity: .18; }
.ritual-trace--runes { stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-drawing .ritual-trace { opacity: 1; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-trace 3s cubic-bezier(.35,.01,.15,1) forwards; }
.is-drawing .ritual-trace--frame { animation-delay: .05s; }
.is-drawing .ritual-trace--inner { animation-delay: .65s; }
.is-drawing .ritual-trace--runes { animation-delay: 1.15s; }
.is-drawing g > .ritual-trace--runes:nth-child(2) { animation-delay: 1.42s; }
.is-drawing g > .ritual-trace--runes:nth-child(3) { animation-delay: 1.78s; }
@keyframes draw-trace { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.ritual-stage.is-complete .ritual-svg { filter: drop-shadow(0 0 12px rgba(255, 223, 125, .68)); animation: rune-finish .7s ease-in-out 2 alternate; }
@keyframes rune-finish { to { transform: scale(1.035); } }
.ritual-progress { width: min(100%, 275px); margin: -3px auto 0; text-align: center; }
.progress-line { height: 1px; overflow: hidden; background: rgba(204, 158, 59, .2); }
.progress-line span { display: block; width: 0; height: 100%; background: var(--gold-bright); box-shadow: 0 0 8px var(--gold); transition: width 3.6s cubic-bezier(.21,.83,.45,1); }
.is-drawing + .ritual-progress .progress-line span, .ritual-progress.is-progressing .progress-line span { width: 100%; }
.ritual-progress p { margin: 12px 0 0; color: #8b8d84; font-size: 11px; letter-spacing: .06em; }
.text-button { display: block; margin: 24px auto 0; border: 0; padding: 5px 10px; color: #a3946b; background: transparent; cursor: pointer; font-size: 11px; letter-spacing: .08em; }
.text-button span { margin-left: 8px; color: var(--gold); font-family: sans-serif; }
.text-button:hover { color: var(--gold-bright); }

.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: clamp(10px, 4vh, 32px); }
.result-topline .kicker { margin: 0; }
.result-count { display: flex; align-items: center; gap: 6px; color: #73766f; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .06em; white-space: nowrap; }
.result-count b { color: var(--gold); font-weight: 500; }
.result-count__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.poem-card { position: relative; width: min(100%, 390px); margin: 23px auto 0; padding: 31px 24px 28px; border: 1px solid rgba(207, 164, 71, .42); background: linear-gradient(145deg, rgba(56, 49, 32, .34), rgba(14, 16, 16, .82) 40%, rgba(29, 25, 16, .46)); box-shadow: 0 20px 45px rgba(0,0,0,.28), inset 0 0 30px rgba(217, 172, 82, .04); text-align: center; }
.poem-card::before { position: absolute; inset: 7px; border: 1px solid rgba(207, 164, 71, .11); pointer-events: none; content: ""; }
.poem-card__corner { position: absolute; width: 14px; height: 14px; border-color: var(--gold); border-style: solid; opacity: .75; }
.poem-card__corner--tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.poem-card__corner--br { right: -1px; bottom: -1px; border-width: 0 1px 1px 0; }
.seal { position: absolute; top: 16px; right: 18px; width: 36px; height: 42px; border: 1px solid rgba(203, 153, 53, .7); color: rgba(225, 186, 95, .75); font-size: 9px; line-height: 1.4; letter-spacing: .14em; text-align: center; transform: rotate(7deg); }
.seal span { font-size: 11px; }
.sign-id { margin: 0; color: var(--gold-bright); font-size: 13px; letter-spacing: .17em; }
.luck-badge { display: inline-block; margin-top: 10px; border: 1px solid rgba(211, 169, 82, .63); padding: 4px 11px; color: var(--gold-bright); font-size: 11px; letter-spacing: .16em; }
.poem-divider { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 22px auto 14px; width: 70%; color: var(--gold); }
.poem-divider span { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(220, 171, 71, .55)); }
.poem-divider span:last-child { transform: rotate(180deg); }
.poem-divider i { font-style: normal; font-size: 10px; }
.style-label { margin: 0 0 16px; color: #797a71; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .18em; }
.poem-text { margin: 0; color: var(--paper); font-size: clamp(18px, 5vw, 22px); letter-spacing: .12em; line-height: 2.15; white-space: pre-line; }
.poem-footnote { margin: 23px 0 0; color: #77786f; font-size: 10px; letter-spacing: .05em; }
.reveal-area { margin: 18px auto 0; text-align: center; }
.talisman--seal { width: 70px; height: 118px; margin: 0 auto; filter: drop-shadow(0 8px 13px rgba(0,0,0,.4)); transition: transform .22s ease; }
.talisman--seal:hover { transform: translateY(-3px); }
.talisman--seal.is-revealing { animation: seal-dissolve .52s ease forwards; pointer-events: none; }
@keyframes seal-dissolve { 0% { opacity: 1; filter: drop-shadow(0 8px 13px rgba(0,0,0,.4)) drop-shadow(0 0 0 rgba(255, 224, 130, 0)); transform: scale(1); } 48% { opacity: 1; filter: drop-shadow(0 0 18px rgba(255, 224, 130, .95)) drop-shadow(0 0 28px rgba(213, 160, 49, .75)); transform: scale(1.07); } 100% { opacity: 0; filter: drop-shadow(0 0 35px rgba(255, 224, 130, 0)); transform: scale(1.18) translateY(-5px); } }
.talisman--seal .talisman__caption { bottom: 11px; font-size: 9px; }
.reveal-area > p { margin: 12px 0 0; color: #aaa27d; font-size: 11px; letter-spacing: .14em; }

.view--reveal { align-self: stretch; }
.interpretation-card { position: relative; width: min(100%, 520px); margin: 23px auto 0; padding: 25px clamp(21px, 6vw, 34px) 24px; border-top: 1px solid rgba(218, 172, 74, .6); border-bottom: 1px solid rgba(218, 172, 74, .26); background: linear-gradient(120deg, rgba(31, 28, 19, .77), rgba(11, 14, 14, .85)); animation: reveal-card .75s cubic-bezier(.21,.83,.45,1) both; }
.interpretation-card::before, .interpretation-card::after { position: absolute; width: 28px; height: 6px; border-top: 1px solid var(--gold); border-bottom: 1px solid rgba(218,172,74,.3); content: ""; }
.interpretation-card::before { top: -4px; left: 0; }
.interpretation-card::after { right: 0; bottom: -4px; }
@keyframes reveal-card { from { opacity: 0; transform: translateY(18px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0 0); } }
.interpretation-card__header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.interpretation-card__header .sign-id { font-size: 11px; }
.interpretation-card h2 { margin-top: 6px; font-size: 23px; }
.interpretation-card__header .luck-badge { margin: 0; }
.reveal-line { width: 100%; height: 1px; margin: 20px 0 21px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .48; }
.interpretation-text { margin: 0; color: #e9dfbd; font-size: 16px; letter-spacing: .08em; line-height: 2.05; white-space: pre-line; }
.oracle-note { margin-top: 24px; padding: 14px 16px 13px; border-left: 2px solid var(--gold); background: rgba(211, 165, 68, .08); }
.oracle-note__label { display: block; color: var(--gold); font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.oracle-note p { margin: 7px 0 0; color: #b7ab83; font-size: 12px; letter-spacing: .06em; line-height: 1.7; }
.disclaimer { margin: 22px 0 0; color: #706f68; font-size: 10px; letter-spacing: .08em; }
.primary-button--again { display: flex; margin: 27px auto 0; }

.site-footer { display: flex; align-items: center; gap: 13px; justify-content: center; margin-top: auto; padding-top: 10px; }
.site-footer p { margin: 0; color: #65675f; font-size: 10px; letter-spacing: .15em; white-space: nowrap; }
.footer-line { width: min(12vw, 76px); height: 1px; background: linear-gradient(90deg, transparent, rgba(197, 150, 57, .33)); }
.footer-line:last-child { transform: rotate(180deg); }

[hidden] { display: none !important; }

@media (max-height: 680px) and (min-width: 420px) {
  .hero-copy { margin-top: 15px; }
  .oracle-stage--home { height: 270px; min-height: 230px; }
  .talisman--hero { width: 105px; height: 175px; }
  .view-heading { margin-top: 12px; }
  .ritual-stage { height: 265px; min-height: 225px; }
}

@media (max-width: 360px) {
  .app-shell { padding-right: 15px; padding-left: 15px; }
  .header-note { letter-spacing: .08em; }
  h1 { font-size: 39px; }
  .poem-card { padding-right: 18px; padding-left: 18px; }
  .poem-text { letter-spacing: .07em; }
  .result-topline { align-items: flex-start; }
  .result-topline .kicker { letter-spacing: .15em; }
  .footer-line { width: 9vw; }
}

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