:root {
  --ink: #302044;
  --lav: #A786CB;
  --lilac: #D9B0F3;
  --gold: #F0D4A4;
  --pink: #EACCF8;
  --white: #FFFFFF;
  --gold-deep: #C79F68;
  --night: #241733;
  --paper: #FBF3FD;
  --cream: #FFF9F1;
  --f-display: "Fraunces", "Anuphan", Georgia, serif;
  --f-body: "Anuphan", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-hand: "Sriracha", "Anuphan", cursive;
  --cw: clamp(60px, 17vw, 80px); /* tarot card width */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden;
  background: var(--night); color: #F8F0FF;
  font-family: var(--f-body); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  transition: color .6s ease;
}
body[data-scene="day"] { color: var(--ink); }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.hand { font-family: var(--f-hand); }

/* ---------- backgrounds ---------- */
.bg { position: fixed; inset: 0; z-index: -3; overflow: hidden; transition: opacity .9s ease; }
#sky { background: radial-gradient(130% 75% at 50% -10%, #5A3F7E 0%, #3A2754 38%, #2A1B3D 70%, #1E1329 100%); }
.nebula { position: absolute; border-radius: 50%; filter: blur(48px); animation: drift 28s ease-in-out infinite alternate; }
.n1 { width: 70vmax; height: 50vmax; left: -28vmax; top: 18vh; background: radial-gradient(closest-side, #A786CB, transparent); opacity: .42; }
.n2 { width: 60vmax; height: 46vmax; right: -26vmax; top: 48vh; background: radial-gradient(closest-side, #EACCF8, transparent); opacity: .24; animation-duration: 34s; }
.n3 { width: 44vmax; height: 30vmax; left: 18vw; top: -12vh; background: radial-gradient(closest-side, #F0D4A4, transparent); opacity: .14; animation-duration: 42s; }
@keyframes drift { to { transform: translate(6vw, -4vh) scale(1.08); } }
.sky-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky-moon { transition: opacity .8s ease; }
body[data-screen="tarot"] .sky-moon { opacity: 0; }
.clouds-svg { position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: 19vh; min-height: 110px; }
#paper {
  opacity: 0; background-color: var(--paper);
  background-image: radial-gradient(#E6CDF3 1.1px, transparent 1.4px);
  background-size: 20px 20px;
}
.doodles-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
body[data-scene="day"] #paper { opacity: 1; }
.grain {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .2; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.tw { animation: twinkle 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.tw1 { animation-delay: -.9s; } .tw2 { animation-delay: -1.8s; animation-duration: 4.2s; } .tw3 { animation-delay: -2.6s; animation-duration: 2.8s; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }

/* ---------- layout ---------- */
.app {
  position: relative; max-width: 460px; margin: 0 auto; min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 18px max(26px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.screen { display: none; flex-direction: column; flex: 1; animation: screenIn .6s cubic-bezier(.2, .8, .2, 1); }
.screen.active { display: flex; }
.center { align-items: center; justify-content: center; text-align: center; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; gap: 12px; height: 44px; margin-bottom: 8px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1.5px solid currentColor;
  background: transparent; display: grid; place-items: center; cursor: pointer; opacity: .85;
}
.icon-btn:disabled { visibility: hidden; }
.progress { display: flex; gap: 7px; flex: 1; justify-content: center; align-items: center; }
.pstar { width: 15px; height: 15px; overflow: visible; }
.pstar path { fill: none; stroke: currentColor; stroke-width: 1.5; opacity: .55; transition: fill .4s, stroke .4s, opacity .4s; }
.pstar:nth-child(5) { margin-right: 8px; }
.pstar.done path { fill: var(--gold); stroke: var(--gold-deep); opacity: 1; }
body[data-scene="night"] .pstar.done path { stroke: var(--gold); }
.pstar.now path { stroke: var(--gold-deep); opacity: 1; stroke-width: 2; }
body[data-scene="night"] .pstar.now path { stroke: var(--gold); }
.pstar.now { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.3); } }
.step-label { width: 40px; flex: none; text-align: right; font-size: .78rem; letter-spacing: .06em; opacity: .8; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 30px; border-radius: 999px;
  font-family: var(--f-body); font-weight: 650; font-size: .98rem; letter-spacing: .08em; text-transform: uppercase;
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-gold {
  color: var(--ink);
  background: linear-gradient(180deg, #FCEACB 0%, #F0D4A4 58%, #E7C48D 100%);
  box-shadow: 0 4px 0 #BE955D, 0 12px 26px rgba(240, 212, 164, .22);
}
.btn-gold:active { transform: translateY(3px); box-shadow: 0 1px 0 #BE955D, 0 5px 12px rgba(240, 212, 164, .2); }
.btn-ghost { background: rgba(36, 23, 51, .72); color: var(--gold); border: 1.5px solid rgba(240, 212, 164, .65); }
.btn-ghost:active { transform: translateY(2px); }
.btn:focus-visible, .icon-btn:focus-visible, .pol:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 3px; }
.btn-spark {
  width: 14px; height: 14px; background: currentColor; flex: none;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- crystal ball (shared) ---------- */
.ball-svg { width: 100%; height: auto; display: block; overflow: visible; }
.mist { transform-box: view-box; transform-origin: 100px 92px; }
.mist-a { animation: spin 11s linear infinite; }
.mist-b { animation: spin 8s linear infinite reverse; }
.mist-c { animation: spin 16s linear infinite; }
.ball-glow {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(217, 176, 243, .55), rgba(217, 176, 243, .18) 60%, rgba(217, 176, 243, 0));
  animation: glow 3.4s ease-in-out infinite;
}
@keyframes glow { 50% { transform: scale(1.08); opacity: .75; } }

/* ---------- welcome ---------- */
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 650; font-size: 1.08rem; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; overflow: hidden; }
.brand-th { font-family: var(--f-body); font-weight: 400; font-size: .8rem; opacity: .7; }
.hero { position: relative; height: min(34vh, 280px); min-height: 220px; margin: 4px 0 0; }
.hero-glow { position: absolute; left: 50%; top: 56%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; background: radial-gradient(closest-side, rgba(217, 176, 243, .45), transparent); animation: glow 4s ease-in-out infinite; }
.hero-ball { position: absolute; left: 50%; bottom: 0; width: min(44vw, 172px); transform: translateX(-50%); }
.hero-card {
  --x: 0px; --y: 0px; --r: 0deg;
  position: absolute; left: 50%; top: 38%; width: calc(var(--cw) * 1.08); aspect-ratio: 100 / 158;
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r));
  filter: drop-shadow(0 12px 18px rgba(10, 4, 20, .5));
  animation: heroFloat 5.5s ease-in-out infinite;
}
.hero-card svg { width: 100%; height: 100%; display: block; }
.hc1 { --x: calc(var(--cw) * -1.25); --y: 14px; --r: -16deg; animation-delay: -1.2s; z-index: 1; }
.hc2 { --x: 0px; --y: -18px; --r: 3deg; z-index: 2; animation-duration: 4.8s; }
.hc3 { --x: calc(var(--cw) * 1.25); --y: 14px; --r: 15deg; animation-delay: -2.6s; z-index: 1; animation-duration: 6.2s; }
@keyframes heroFloat { 50% { transform: translate(-50%, -50%) translate(var(--x), calc(var(--y) - 12px)) rotate(calc(var(--r) * .8)); } }
.hs { position: absolute; width: 16px; height: 16px; background: var(--gold); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: twinkle 3s ease-in-out infinite; }
.hs1 { left: 12%; top: 12%; } .hs2 { right: 10%; top: 30%; width: 11px; height: 11px; animation-delay: -1s; background: var(--pink); } .hs3 { left: 20%; bottom: 18%; width: 9px; height: 9px; animation-delay: -2s; }
h1 {
  font-family: var(--f-display); font-weight: 600; text-align: center;
  font-size: clamp(2.35rem, 10.4vw, 3.15rem); line-height: .98; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1; margin: 14px 0 12px;
}
h1 em { display: block; font-style: italic; font-weight: 500; color: var(--gold); }
.lede { font-family: var(--f-display); font-style: italic; font-size: 1.12rem; line-height: 1.35; text-align: center; margin: 0 auto 6px; max-width: 28ch; color: #F3E6FF; }
.lede-th { text-align: center; color: var(--lilac); font-size: .92rem; margin: 0 auto 14px; max-width: 34ch; }
.cta { display: flex; flex-direction: column; align-items: center; }
.meta { font-size: .84rem; letter-spacing: .04em; opacity: .82; margin: 16px 0 0; text-align: center; }
.dates {
  margin: 0 auto 22px; padding: 7px 16px 8px; border-radius: 14px; text-align: center;
  border: 1.5px dashed rgba(240, 212, 164, .6); color: var(--gold);
  font-family: var(--f-hand); font-size: .98rem; line-height: 1.25; transform: rotate(-1.5deg);
}
.dates span { display: block; font-family: var(--f-body); font-size: .78rem; color: var(--lilac); }
.tagline-dates { text-align: center; margin: 4px 0 0; font-size: .82rem; color: var(--lilac); }
.fineprint { text-align: center; font-size: .72rem; opacity: .55; margin: auto 0 0; padding-top: 24px; }

/* ---------- quiz ---------- */
.q-kicker { color: var(--lav); font-size: 1.05rem; margin: 2px 0 0; transform: rotate(-2deg); transform-origin: left; }
.q-title {
  font-family: var(--f-display); font-weight: 600; color: var(--ink);
  font-size: clamp(1.55rem, 6.8vw, 1.95rem); line-height: 1.08; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 100, "WONK" 1; margin: 2px 0 6px;
}
.q-th { margin: 0 0 22px; color: #6D5590; font-size: .95rem; }
.q-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 14px; }
.q-grid.enter-next { animation: slideNext .45s cubic-bezier(.2, .8, .2, 1); }
.q-grid.enter-back { animation: slideBack .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes slideNext { from { opacity: 0; transform: translateX(28px); } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-28px); } }
.pol {
  --tilt: -2deg;
  position: relative; display: block; width: 100%; text-align: left; color: var(--ink);
  background: #fff; border: 0; border-radius: 3px; padding: 7px 7px 0; cursor: pointer;
  box-shadow: 0 1px 0 rgba(48, 32, 68, .06), 0 12px 22px -10px rgba(48, 32, 68, .4);
  transform: rotate(var(--tilt));
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .28s, opacity .3s, filter .3s;
}
.pol:nth-child(2) { --tilt: 1.8deg; } .pol:nth-child(3) { --tilt: 1.2deg; } .pol:nth-child(4) { --tilt: -1.5deg; }
.pol .ph { display: block; aspect-ratio: 1; background: #EFE3F6; overflow: hidden; border-radius: 2px; }
.pol img { width: 100%; height: 100%; object-fit: cover; }
.pol .cap { display: block; font-family: var(--f-hand); font-size: .9rem; line-height: 1.2; padding: 8px 3px 10px; min-height: 2.6em; }
.pol .cap small { display: block; margin-top: 2px; font-family: var(--f-body); font-size: .72rem; color: #7A6399; }
.tape {
  position: absolute; top: -9px; left: 50%; width: 56px; height: 18px; z-index: 2;
  background: rgba(234, 204, 248, .88); transform: translateX(-50%) rotate(-4deg);
  clip-path: polygon(3% 0, 97% 6%, 100% 50%, 96% 100%, 2% 94%, 0 50%);
}
.pol:nth-child(even) .tape { background: rgba(240, 212, 164, .9); transform: translateX(-50%) rotate(5deg); }
.stamp { position: absolute; right: -10px; top: -14px; width: 50px; height: 50px; z-index: 4; opacity: 0; transform: rotate(-35deg) scale(.3); transition: opacity .2s, transform .45s cubic-bezier(.3, 1.7, .5, 1); pointer-events: none; }
.stamp svg { width: 100%; height: 100%; }
@media (hover: hover) { .pol:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 1px 0 rgba(48, 32, 68, .06), 0 18px 28px -10px rgba(48, 32, 68, .45); } }
.pol.was { box-shadow: 0 0 0 2.5px var(--lav), 0 12px 22px -10px rgba(48, 32, 68, .4); }
.pol.picked { transform: rotate(0deg) scale(1.05); z-index: 3; box-shadow: 0 0 0 3px var(--gold-deep), 0 18px 32px -10px rgba(48, 32, 68, .5); }
.pol.picked .stamp { opacity: 1; transform: rotate(-12deg) scale(1); }
.q-grid.has-pick .pol:not(.picked) { opacity: .4; filter: saturate(.5); }
.q-grid.who { margin-top: 8px; }
.q-grid.who .pol .cap { text-align: center; font-size: 1.15rem; padding: 10px 3px 12px; }
.q-hint { text-align: center; color: var(--lav); margin: 22px 0 0; font-size: .95rem; }

/* ---------- interlude ---------- */
.i-ball, .c-ball { position: relative; width: min(56vw, 220px); margin-bottom: 18px; }
.i-ball .ball-glow, .c-ball .ball-glow { left: -40%; top: -40%; width: 180%; height: 140%; }
.i-1, .i-2 { font-family: var(--f-display); font-size: clamp(1.45rem, 6.4vw, 1.8rem); line-height: 1.15; margin: 0; font-variation-settings: "SOFT" 100, "WONK" 1; opacity: 0; animation: rise .8s ease forwards; }
.i-1 { animation-delay: .3s; }
.i-2 { font-style: italic; color: var(--gold); animation-delay: 1.3s; }
.i-th { color: var(--lilac); font-size: .92rem; margin: 12px 0 26px; max-width: 30ch; opacity: 0; animation: rise .8s ease 2s forwards; }
.i-btn { opacity: 0; animation: rise .8s ease 2.5s forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- tarot ---------- */
.t-kicker { font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 2px 0 4px; text-align: center; }
.t-title { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.4rem, 6.2vw, 1.8rem); line-height: 1.1; text-align: center; margin: 0 0 4px; font-variation-settings: "SOFT" 100, "WONK" 1; }
.t-th { text-align: center; color: var(--lilac); font-size: .9rem; margin: 0; }
.stage { position: relative; height: clamp(calc(var(--cw) * 4.6), 44vh, 420px); margin: 2px -18px 0; touch-action: manipulation; }
.stage .ball { position: absolute; z-index: 20; pointer-events: none; }
.stage .ball-glow { z-index: 0; }
.tcard { position: absolute; left: 0; top: 0; width: var(--cw); aspect-ratio: 100 / 158; cursor: pointer; will-change: transform; user-select: none; -webkit-user-select: none; outline: none; }
.tcard.moving { transition: transform .75s cubic-bezier(.2, .85, .25, 1), opacity .5s ease; }
.tcard.away { opacity: 0 !important; pointer-events: none; }
.tcard.sum { cursor: default; }
.tcard:focus-visible .face.back { outline: 3px solid var(--gold); outline-offset: 3px; }
.tfloat { width: 100%; height: 100%; perspective: 700px; animation: bob 3.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes bob { 50% { transform: translateY(-7px); } }
.tinner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, .7, .2, 1); }
.tinner.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: calc(var(--cw) * .09); overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 8px 18px rgba(10, 4, 20, .45); }
.face.back svg { width: 100%; height: 100%; display: block; }
.face.front {
  transform: rotateY(180deg); background: var(--cream); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10% 7% 11%; font-size: calc(var(--cw) * .135);
  box-shadow: inset 0 0 0 3px var(--cream), inset 0 0 0 4px var(--gold-deep), 0 8px 18px rgba(10, 4, 20, .45);
}
.fr-deck { font-size: .56em; letter-spacing: .14em; text-transform: uppercase; color: #8A6F4A; white-space: nowrap; }
.fr-icon { width: 66%; aspect-ratio: 1; display: block; }
.fr-icon svg { width: 100%; height: 100%; display: block; }
.fr-name { font-family: var(--f-display); font-weight: 650; font-size: 1em; line-height: 1.05; text-align: center; font-variation-settings: "SOFT" 100; }
.fr-th { font-size: .66em; color: #7A6399; line-height: 1.1; text-align: center; }
.spark { position: absolute; z-index: 70; width: 12px; height: 12px; pointer-events: none; background: var(--gold); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: spark 1s ease-out forwards; }
.spark:nth-child(3n) { background: var(--pink); width: 9px; height: 9px; }
@keyframes spark { from { transform: translate(-50%, -50%) scale(.2); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(90deg); opacity: 0; } }
.t-hint { text-align: center; color: var(--lilac); margin: 0; font-size: 1rem; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.t-after { display: flex; flex-direction: column; align-items: center; gap: 12px; animation: rise .5s ease; }
.t-reveal { margin: 0; text-align: center; font-family: var(--f-display); font-size: 1.12rem; line-height: 1.3; }
.t-reveal b { color: var(--gold); font-weight: 650; }
.t-reveal span { display: block; font-family: var(--f-body); font-size: .85rem; color: var(--lilac); }
.spread { display: flex; justify-content: center; gap: 16px; margin-top: auto; padding: 18px 0 18px; }
.slot { position: relative; width: calc(var(--cw) * .6); aspect-ratio: 100 / 158; border: 1.5px dashed rgba(240, 212, 164, .45); border-radius: 7px; }
.slot .lbl { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; opacity: .7; white-space: nowrap; }
.slot.filled { border-color: transparent; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.6); } }
.mini { position: absolute; inset: 0; border-radius: 7px; background: var(--cream); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: inset 0 0 0 2px var(--cream), inset 0 0 0 2.6px var(--gold-deep); }
.mini svg { width: 62%; height: auto; }
.mini span { font-size: .55rem; font-weight: 650; text-align: center; line-height: 1.05; padding: 0 2px; }

/* ---------- weighing ---------- */
.c-ball .js-ball { animation: charge 1.2s ease-in-out infinite; }
@keyframes charge { 50% { transform: scale(1.04); filter: brightness(1.15); } }
.c-label { font-family: var(--f-display); font-size: 1.25rem; margin: 0; }
.c-name { font-family: var(--f-display); font-style: italic; font-size: clamp(1.5rem, 7vw, 2rem); color: var(--gold); min-height: 1.4em; margin: 10px 0 4px; }
.c-name.landed { animation: land .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes land { from { transform: scale(1.35); } }
.c-th { color: var(--lilac); font-size: .9rem; margin: 0; }

/* ---------- result ---------- */
.r-kicker { text-align: center; font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 6px 0 14px; }
.r-stage { display: flex; justify-content: center; margin-bottom: 20px; perspective: 1400px; }
.r-float { animation: bob 4.6s ease-in-out infinite; }
.r-card { position: relative; width: min(62vw, 246px); aspect-ratio: 100 / 158; transform-style: preserve-3d; transition: transform 1.2s cubic-bezier(.3, .7, .2, 1); }
.r-card.flipped { transform: rotateY(180deg); }
.r-face { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 22px 44px rgba(10, 4, 20, .55); }
.r-back svg { width: 100%; height: 100%; display: block; }
.r-front {
  transform: rotateY(180deg); background: var(--cream); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; padding: 9% 9% 8%;
  box-shadow: inset 0 0 0 5px var(--cream), inset 0 0 0 6.5px var(--gold-deep), inset 0 0 0 9px var(--cream), inset 0 0 0 9.8px var(--gold-deep), 0 22px 44px rgba(10, 4, 20, .55);
}
.r-num { font-family: var(--f-display); font-weight: 600; color: #A07A45; letter-spacing: .12em; font-size: .95rem; }
.r-art { width: 88%; flex: 1; display: flex; align-items: center; }
.r-art svg, .r-art img { width: 100%; height: auto; display: block; }
.r-art img { aspect-ratio: 100 / 124; object-fit: cover; border-radius: 50% 50% 0 0 / 34% 34% 0 0; border: 1.5px solid var(--gold-deep); background: #EFE3F6; }
.r-card-name { font-family: var(--f-display); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; font-size: .9rem; line-height: 1.15; text-align: center; margin: 6px 0 0; }
.r-credit { text-align: center; margin: -8px 0 12px; font-size: .68rem; opacity: .6; }
.r-credit a, .fineprint a { color: inherit; }
.r-group { text-align: center; margin: 0 0 6px; font-family: var(--f-hand); color: var(--lilac); font-size: .95rem; }
.r-name { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.9rem, 8.4vw, 2.5rem); line-height: 1.04; text-align: center; margin: 0; letter-spacing: -.01em; font-variation-settings: "SOFT" 100, "WONK" 1; }
.r-title { text-align: center; font-family: var(--f-display); font-style: italic; color: var(--gold); font-size: 1.15rem; margin: 6px 0 16px; }
.r-spread { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(240, 212, 164, .35); font-size: .86rem; line-height: 1.1; }
.chip svg { width: 30px; height: 30px; padding: 2px; background: var(--cream); border-radius: 50%; flex: none; }
.chip small { display: block; font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; opacity: .65; }
.note { position: relative; background: var(--cream); color: var(--ink); border-radius: 5px; padding: 24px 20px 6px; margin: 0 4px 24px; box-shadow: 0 14px 30px rgba(10, 4, 20, .35); transform: rotate(-.6deg); }
.note.odds { transform: rotate(.7deg); }
.note-tape { position: absolute; top: -10px; left: 50%; width: 76px; height: 20px; transform: translateX(-50%) rotate(-3deg); background: rgba(234, 204, 248, .9); clip-path: polygon(3% 0, 97% 6%, 100% 50%, 96% 100%, 2% 94%, 0 50%); }
.odds .note-tape { background: rgba(240, 212, 164, .92); transform: translateX(-50%) rotate(4deg); }
.note h3 { font-family: var(--f-hand); font-weight: 400; color: var(--lav); font-size: 1.12rem; margin: 0 0 2px; }
.note p { margin: 0 0 16px; }
.r-reading { font-family: var(--f-display); font-style: italic; font-size: 1.13rem; line-height: 1.4; }
.r-trend { background: #F5E8FC; border-radius: 8px; padding: 10px 12px; font-size: .95rem; }
.r-trend span { display: block; font-family: var(--f-hand); color: var(--lav); }
.odds ul { list-style: none; padding: 0; margin: 0 0 14px; }
.odds li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin: 0 0 12px; font-size: .92rem; }
.odds li b { font-weight: 600; }
.odds li.you b::after { content: "\00a0\00a0" attr(data-you); font-family: var(--f-hand); font-weight: 400; color: var(--lav); }
.odds .bar { grid-column: 1 / -1; height: 9px; background: #EFE2F7; border-radius: 99px; overflow: hidden; }
.odds .bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--lav); transition: width 1.1s .25s cubic-bezier(.2, .8, .2, 1); }
.odds.go .bar i { width: var(--w); }
.odds li.you .bar i { background: linear-gradient(90deg, #E2BC80, var(--gold)); }
.actions { display: flex; flex-direction: column; gap: 12px; margin: 4px 6px 0; }
.tagline { text-align: center; margin: 18px 0 0; font-size: .92rem; }
.tagline b { color: var(--gold); }
.tagline .ig {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; padding: 8px 16px; border-radius: 999px;
  color: var(--gold); font-weight: 700; text-decoration: none; border: 1.5px solid rgba(240, 212, 164, .6); background: rgba(240, 212, 164, .08);
}
.tagline .ig:hover, .tagline .ig:focus-visible { background: rgba(240, 212, 164, .18); outline: none; }
.tagline .ig svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.tagline .ig svg .dot { fill: currentColor; stroke: none; }

/* ---------- language switch (TH / EN) ---------- */
.lang {
  position: absolute; z-index: 30; top: calc(max(14px, env(safe-area-inset-top)) - 4px); right: 18px;
  display: flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(240, 212, 164, .45);
}
.lang button {
  appearance: none; border: 0; background: transparent; color: #F8F0FF; cursor: pointer;
  min-width: 40px; min-height: 30px; padding: 0 10px; border-radius: 999px;
  font-family: var(--f-body); font-weight: 650; font-size: .74rem; letter-spacing: .08em; opacity: .75;
}
.lang button[aria-pressed="true"] { background: var(--gold); color: var(--ink); opacity: 1; }
.lang button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
body[data-screen="quiz"] .lang, body[data-screen="tarot"] .lang, body[data-screen="calc"] .lang { display: none; }
#s-result .r-kicker { margin-top: 46px; }

/* Thai needs taller lines for vowels and tone marks, no faux italics and little letter spacing. */
:lang(th) h1 { font-size: clamp(1.7rem, 7.6vw, 2.25rem); line-height: 1.28; letter-spacing: 0; text-wrap: balance; }
:lang(th) h1 em, :lang(th) .lede, :lang(th) .i-2, :lang(th) .r-title, :lang(th) .r-reading { font-style: normal; }
:lang(th) .lede { max-width: 30ch; }
:lang(th) .q-title, :lang(th) .t-title { line-height: 1.32; letter-spacing: 0; text-wrap: balance; }
:lang(th) .i-1, :lang(th) .i-2 { line-height: 1.4; }
:lang(th) .pol .cap { line-height: 1.35; }
:lang(th) .fr-name { line-height: 1.3; }
:lang(th) .btn { letter-spacing: .02em; }
:lang(th) .t-kicker, :lang(th) .r-kicker { letter-spacing: .04em; }
:lang(th) .chip small { letter-spacing: .02em; }

/* ---------- story modal + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(20, 12, 30, .8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(100%, 380px); max-height: 94dvh; overflow: auto; background: var(--cream); color: var(--ink); border-radius: 18px; padding: 20px 16px 18px; text-align: center; }
.modal-card h3 { font-family: var(--f-display); font-size: 1.35rem; margin: 0 0 4px; }
.story-tip { font-family: var(--f-hand); color: var(--lav); margin: 0 0 10px; line-height: 1.3; }
.story-tip span { font-family: var(--f-body); font-size: .8rem; color: #7A6399; }
.modal-card img { width: 64%; margin: 0 auto 16px; border-radius: 12px; box-shadow: 0 12px 26px rgba(48, 32, 68, .3); -webkit-touch-callout: default; }
.modal .btn-ghost { color: var(--ink); border-color: var(--ink); background: transparent; }
.modal-x { position: absolute; right: 8px; top: 6px; width: 40px; height: 40px; border: 0; background: none; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-size: .9rem; box-shadow: 0 10px 24px rgba(10, 4, 20, .4); animation: rise .3s ease; }

@media (min-width: 700px) {
  .app { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
  .i-1, .i-2, .i-th, .i-btn { opacity: 1; }
}
