/* ==========================================================================
   fortune.css: the look of the Golden Lotus fortune teller.
   "Birthday Card after dark": the hand-lettered invitation (lanterns, peonies, vermilion and gold)
   on dark teak. Layout: Auntie on the left, one panel on the right that changes screen by screen;
   on a phone Auntie sits on top.
   ========================================================================== */

:root {
  --bg: #2B1512;          /* dark teak */
  --bg-2: #3D1B15;
  --bg-3: #54261C;
  --cream: #FFF3D9;
  --paper: #FFF6E5;
  --muted: #EBD3B4;
  --gold: #F4CF7A;
  --gold-2: #E9B949;
  --red: #C8321F;         /* vermilion */
  --red-deep: #8E1B1B;
  --coral: #F4947C;
  --ink: #3A1A14;
  --ink-soft: #6A4A40;
  /* "Storybook" (Lehan, 2026-11-15): Fraunces, a soft serif, for titles and Auntie's voice; Nunito, a
     rounded sans, for everything else. Both from Google Fonts (index.html); system fonts if Google can't be reached. */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --voice: "Fraunces", Georgia, "Times New Roman", serif;
  --text: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --han: "GL Han", "Songti TC", "Songti SC", "PMingLiU", "SimSun", "Noto Serif CJK TC", serif;
}

/* The few Chinese characters on the page (tiles, envelope, banknote), cut from Noto Serif CJK. */
@font-face {
  font-family: "GL Han";
  src: url("fonts/gl-han.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--cream); font: 18px/1.5 var(--text); }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--cream); color: var(--ink); padding: 8px 14px; z-index: 5; }
.skip:focus { left: 8px; top: 8px; }
a { color: var(--gold); }
a:hover { color: var(--cream); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1:focus, h2:focus { outline: none; }
/* Read by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

.room { max-width: 1080px; min-height: 100vh; margin: 0 auto; padding: 0 20px; display: flex; flex-direction: column; }

/* ---- Lanterns and banner ---- */
.top { position: relative; height: 124px; flex: none; }
.garland { position: absolute; left: -20px; top: 0; width: calc(100% + 40px); height: 60px; }
.lantern { position: absolute; top: 2px; width: 118px; z-index: 0; }
.lantern::before { content: ""; position: absolute; left: 50%; top: 42%; width: 170%; aspect-ratio: 1; transform: translate(-50%, -50%);
                   background: radial-gradient(circle, rgba(240, 138, 60, 0.5), rgba(240, 138, 60, 0) 62%); animation: flicker 2.8s ease-in-out infinite alternate;
                   pointer-events: none; z-index: -1; }
.lantern svg { display: block; width: 100%; height: auto; transform-origin: 50% 0; animation: swing 5.5s ease-in-out infinite; }
.lantern-left { left: 0; }
.lantern-right { right: 0; width: 100px; top: 8px; }
.lantern-right svg { animation-delay: -2.6s; }
.lantern-right::before { animation-delay: -1.3s; }
@keyframes swing { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@keyframes flicker { 0% { opacity: 0.55; } 35% { opacity: 0.95; } 55% { opacity: 0.7; } 100% { opacity: 1; } }

/* The sign: CLOSED on the front, flips to THE FORTUNE TELLER IS IN when the page has loaded. */
.banner { position: absolute; left: 50%; top: 30px; z-index: 1; transform: translateX(-50%) rotate(-1.5deg); perspective: 700px; }
.banner::before { content: ""; position: absolute; left: 22%; right: 22%; top: -30px; height: 30px; border-left: 2px solid #C8962E; border-right: 2px solid #C8962E; }
.banner-inner { display: grid; transform-style: preserve-3d; transition: transform 1.9s cubic-bezier(0.35, 1.35, 0.5, 1); }
.banner.flipped .banner-inner { transform: rotateX(180deg); }
.banner-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 8px 28px; border-radius: 6px;
               font-size: 16px; font-weight: 700; letter-spacing: 3px; white-space: nowrap; text-align: center; }
.banner-closed { background: #4A2A22; color: #D7C2A6; border: 2px solid #6E3A2C; }
.banner-open { background: var(--red); color: var(--paper); border: 2px solid #E9B949; transform: rotateX(180deg); }
/* The sign is a button: once it reads IN, tapping it closes the table. */
button.banner { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: default; }
.banner.flipped { cursor: pointer; }
.banner.flipped .banner-open { animation: sign-glow 3.2s ease-in-out 2s infinite; }
.banner[aria-disabled="true"] { cursor: default; }
.banner.flipped:hover .banner-open { filter: brightness(1.1); }
.banner:focus-visible { outline: none; }
.banner:focus-visible .banner-face { outline: 3px solid var(--gold); outline-offset: 3px; }
@keyframes sign-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 199, 106, 0); } 50% { box-shadow: 0 0 10px 1px rgba(242, 199, 106, 0.55); } }
/* After all three readings it pulses harder, with a whispered hint underneath. */
.banner.beckon { animation: beckon 1.5s ease-in-out infinite; }
.banner.beckon .banner-open { animation: beckon-glow 1.5s ease-in-out infinite; }
@keyframes beckon { 0%, 100% { transform: translateX(-50%) rotate(-1.5deg) scale(1); } 50% { transform: translateX(-50%) rotate(1deg) scale(1.08); } }
@keyframes beckon-glow { 0%, 100% { box-shadow: 0 0 4px 0 rgba(242, 199, 106, 0.4); } 50% { box-shadow: 0 0 22px 5px rgba(242, 199, 106, 0.9); } }
.banner-hint { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; font: italic 15px var(--voice); color: var(--gold);
               opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
.banner.beckon .banner-hint { opacity: 1; }

/* Closing time: Auntie behind her blinds. */
.closed-scene { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px;
                background: radial-gradient(circle at 50% 40%, #3A1A14, #120707 75%); opacity: 0; transition: opacity 0.5s ease; text-align: center; }
.closed-scene.on { opacity: 1; }
.blinds-svg { height: min(58vh, 520px); width: auto; max-width: 92vw; overflow: visible; }
.blinds-svg .smoke { transform-box: fill-box; transform-origin: 50% 100%; animation: smoke 3.6s ease-in-out infinite; }
.blinds-svg .smoke-2 { animation-delay: -1.2s; }
.blinds-svg .smoke-3 { animation-delay: -2.4s; }
.peeker .pupil > * { animation: shifty 3.4s ease-in-out 1.8s infinite; }
@keyframes shifty { 0%, 100% { transform: translateX(-3px); } 40%, 55% { transform: translateX(3px); } }
.closed-line { margin: 4px 0 0; font: 600 26px/1.25 var(--display); color: var(--gold); }
.closed-go { margin: 0 0 8px; font: italic 21px/1.35 var(--voice); color: var(--cream); max-width: 26em; }
.closed-home { margin: 2px 0 0; font-size: 16px; }
.closed-home a { display: inline-block; padding: 6px 8px; }   /* a target of at least 24px */

/* ---- The table: Auntie and the panel ---- */
.table { flex: 1; display: grid; grid-template-columns: minmax(240px, 370px) minmax(0, 1fr); gap: 36px; align-items: center; padding: 8px 0 28px; }
.auntie-col { position: relative; }
.auntie { background: radial-gradient(closest-side, var(--bg-2) 72%, transparent 100%); border-radius: 50%; }
.auntie-svg { display: block; width: 100%; height: auto; }
.bubble { position: relative; margin: 6px 0 0; padding: 12px 18px; background: var(--paper); color: var(--ink); border-radius: 18px; font: italic 20px/1.35 var(--voice); }
.bubble::before { content: ""; position: absolute; left: 50%; top: -11px; margin-left: -12px; border: 12px solid transparent; border-top: 0; border-bottom-color: var(--paper); }

.panel { min-width: 0; padding-top: 14px; }
.panel:focus { outline: none; }
.screen { display: flex; flex-direction: column; gap: 14px; }
.title-small { margin: 0; font: 400 28px/1.15 var(--display); color: var(--cream); }
/* The page's one h1 is for screen readers (index.html); "Fortune Table" on the first screen is an h2 drawn this size. */
h1, .title-big { margin: -6px 0 0; font: 600 clamp(44px, 7vw, 64px)/1.08 var(--display); color: var(--gold); }
h2 { margin: 0; font: 600 clamp(28px, 4.4vw, 38px)/1.15 var(--display); color: var(--gold); }
h3 { margin: 0 0 6px; font: 600 24px/1.2 var(--display); }
.intro, .lead { margin: 0; max-width: 34em; font-size: 19px; }
.small { margin: 0; font-size: 16px; color: var(--muted); }
.eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 1.8px; color: var(--coral); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.btn { min-height: 48px; padding: 0 24px; border-radius: 24px; border: 2px solid var(--gold-2); background: transparent; color: var(--cream);
       font: 700 18px var(--text); cursor: pointer; }
.btn:hover { background: var(--bg-3); }
.btn-main { background: var(--red); border-color: var(--red); color: var(--paper); }
.btn-main:hover { background: #D03A26; }   /* 4.5:1 with the cream text */
.btn:disabled, .round:disabled { opacity: 0.45; cursor: default; }

/* ---- 1. Guests ---- */
.guests { margin: 0; padding: 0; border: 0; min-width: 0; }
.guests legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 700; letter-spacing: 1.8px; color: var(--coral); }
.guest-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.guest { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 104px; padding: 10px 12px; background: var(--paper); color: var(--ink);
         border: 3px solid var(--paper); border-radius: 12px; cursor: pointer; }
.guest input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.guest.guest-on { border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--red); }
.guest:focus-within { outline: 3px solid var(--gold); outline-offset: 4px; }
.guest-name { font: 600 21px/1.15 var(--display); color: #B3261E; }
.guest-line { font-size: 16px; line-height: 1.25; }

/* ---- 2. The red envelope ---- */
.money { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pile { position: relative; width: 262px; height: 150px; flex: none; }
.pile-note { position: absolute; left: calc(var(--i) * 7px); top: calc(8px + var(--i) * 5px); width: 200px; transform: rotate(var(--turn)); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45)); }
.note-svg { display: block; width: 100%; height: auto; }
.envelope { width: 92px; flex: none; }
.envelope-svg { display: block; width: 100%; height: auto; }
.stepper { display: flex; align-items: center; gap: 16px; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--gold-2); background: transparent; color: var(--cream); font: 700 26px/1 var(--text); cursor: pointer; }
.round-main { background: var(--red); border-color: var(--red); color: var(--paper); }
.count { min-width: 5.2em; text-align: center; font-size: 24px; font-weight: 700; }
.mood { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 2px dashed #6E3A2C; }
.pearls { display: flex; gap: 7px; }
.pearl { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gold-2); }
.pearl-on { background: var(--paper); box-shadow: inset -3px -3px 0 #E3C9A8; }
.mood-label { margin: 0; font: 600 24px var(--display); color: var(--gold); }

/* ---- 3. Choosing a ritual ---- */
.rituals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ritual { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 132px; padding: 14px; background: var(--paper); color: var(--ink);
          border: 3px solid var(--paper); border-radius: 12px; font: inherit; text-align: left; cursor: pointer; }
.ritual:hover { border-color: var(--gold-2); }
.ritual .icon { width: 40px; height: 40px; color: #B3261E; }
.ritual-name { font: 600 26px/1.1 var(--display); color: #B3261E; }
.ritual-line { font-size: 17px; line-height: 1.25; }
.icon { width: 22px; height: 22px; flex: none; }

/* ---- 4. Rituals ---- */
.rite { min-width: 0; }
.waiting { margin: 0; font: italic 21px var(--voice); color: var(--gold); }

.palm-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.palm-track { position: relative; width: 100%; max-width: 540px; height: 256px; border-radius: 16px; background: var(--bg-3); border: 2px solid #6E3A2C; overflow: hidden; }
.cushion { position: absolute; left: 14px; bottom: 10px; width: 180px; }
.cushion svg { display: block; width: 100%; height: auto; }
.cushion-label { display: block; text-align: center; font-size: 15px; color: var(--muted); transition: opacity 0.4s; }
.given .cushion-label { opacity: 0; }
.palm-hand { position: absolute; right: 18px; top: 12px; width: 136px; height: 180px; z-index: 1; touch-action: none; cursor: grab;
             perspective: 700px; transition: transform 0.55s ease; }
.palm-hand.dragging { transition: none; cursor: grabbing; }
.palm-hand.palm-given { cursor: default; }
.hand-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.8s ease; }
.flipped .hand-flip { transform: rotateY(180deg); }
.hand-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.hand-face-palm { transform: rotateY(180deg); }
.hand-svg { display: block; width: 100%; height: 100%; }
.line-base { fill: none; stroke: #D3A286; stroke-width: 2.2; stroke-linecap: round; }
.line { fill: none; stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.1s ease; }
.line.lit { stroke-dashoffset: 0; }

.wall { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; max-width: 640px; }
.wall.dealing { pointer-events: none; }
.wall .tile { width: 100%; }
.wall-tile { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; display: flex; justify-content: center; transition: transform 0.5s cubic-bezier(0.3, 1.2, 0.5, 1), opacity 0.35s ease; }
.wall-tile:hover .tile { transform: translateY(-3px); }
.wall-tile.taken { visibility: hidden; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin-top: 18px; text-align: center; }
.slot .tile { width: 92px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slot-tile { min-height: 132px; display: flex; align-items: flex-end; perspective: 400px; }
.slot-name, .slot-meaning { margin: 0; }
.slot-name { font-size: 19px; line-height: 1.2; }
.slot-meaning { font-size: 16px; line-height: 1.25; color: var(--muted); }

.tile { display: block; width: 66px; height: auto; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35)); transition: transform 0.2s; }
.tile-small { width: 40px; }
.turned .tile { animation: turn 0.5s ease; }
@keyframes turn { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }

.tea-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.cup { width: min(250px, 72vw); touch-action: none; cursor: grab; }
.cup-svg { display: block; width: 100%; height: auto; }
.leaves { transform-origin: 100px 100px; transition: transform 1.3s ease; }
.leaf { transition: transform 1.3s ease, opacity 1s; }
.tea { transition: fill 1.3s; }
.settled .tea { fill: #E7C79A; }

/* ---- Auntie, alive ---- */
.auntie-svg { overflow: visible; }
.auntie-svg .sway { transform-box: view-box; transform-origin: 120px 290px; animation: sway 7s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-0.8deg); } 50% { transform: rotate(0.8deg); } }
.auntie-svg .head-part { transform-box: view-box; transform-origin: 120px 180px; animation: breathe 4.2s ease-in-out infinite; transition: translate 0.5s ease; }
@keyframes breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.4px); } }
.auntie-svg.bow .head-part { translate: 0 10px; }
.auntie-svg .halo { transform-box: view-box; transform-origin: 120px 112px; animation: halo 4.5s ease-in-out infinite; }
@keyframes halo { 0%, 100% { opacity: 0.5; transform: scale(0.97); } 50% { opacity: 1; transform: scale(1.04); } }
.auntie-svg .trigrams { animation: shimmer 4.5s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }
.auntie-svg .smoke { transform-box: fill-box; transform-origin: 50% 100%; animation: smoke 3.6s ease-in-out infinite; }
.auntie-svg .smoke-2 { animation-delay: -1.2s; }
.auntie-svg .smoke-3 { animation-delay: -2.4s; }
@keyframes smoke { 0% { transform: translate(0, 4px) scaleY(0.6); opacity: 0; } 25% { opacity: 0.8; } 100% { transform: translate(3px, -18px) scaleY(1.25); opacity: 0; } }
.auntie-svg .ember { animation: ember 1.8s ease-in-out infinite alternate; }
@keyframes ember { from { opacity: 0.55; } to { opacity: 1; } }
.eyes-peek { opacity: 0; }
.peek .eyes-peek { opacity: 1; }
.peek .eyes-shut { opacity: 0; }
.auntie-svg .sparkles path { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite alternate; }
@keyframes twinkle { from { transform: scale(0.6); opacity: 0.6; } to { transform: scale(1.15); opacity: 1; } }
.auntie-svg .props { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { transform: translateY(70px); opacity: 0; } to { transform: none; opacity: 1; } }
.auntie-svg .props-envelope, .auntie-svg .props-count { animation: none; }
.auntie-svg .lid { transform-box: view-box; transform-origin: 120px 224px; animation: lid 0.7s ease 0.6s both; }
@keyframes lid { from { transform: scaleY(0.05); } to { transform: scaleY(1); } }
.auntie-svg .pour { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pour 0.9s ease 0.8s forwards; }
@keyframes pour { to { stroke-dashoffset: 0; } }
.auntie-svg .cup-steam { opacity: 0; animation: steam 2.2s ease-in-out 1.6s infinite; }
@keyframes steam { 0% { opacity: 0; transform: translateY(4px); } 40% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-8px); } }
.auntie-svg .riffle { transform-box: view-box; transform-origin: 122px 236px; animation: riffle 0.45s ease-in-out infinite alternate; }
@keyframes riffle { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* The hand-over: the notes go into the envelope, it closes, and it flies to Auntie. */
.offering { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(20, 8, 6, 0.5);
            opacity: 0; transition: opacity 0.4s ease; cursor: pointer; }
.offering.on { opacity: 1; }
.offering.leaving { background: transparent; }
.offer-stage { height: min(80vh, 640px); aspect-ratio: 220 / 410; max-width: 86vw; transform: scale(0.55); transition: transform 0.6s cubic-bezier(0.3, 1.3, 0.5, 1); }
.offering.on .offer-stage { transform: scale(1); }
.offer-stage.flying { transition: transform 0.85s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.35s ease 0.55s; }
.envelope-open { display: block; width: 100%; height: 100%; overflow: visible; }
.envelope-open .note-in { transition: transform 0.75s cubic-bezier(0.5, 0, 0.5, 1) calc(var(--i) * 80ms); }
.stuffed .note-in { transform: translateY(var(--drop)); }
.envelope-open .flap, .envelope-open .flap-open { transform-box: view-box; transform-origin: 110px 72px; transition: transform 0.35s ease; }
.envelope-open .flap { transform: scaleY(0); transition-delay: 0.3s; }
.sealed .flap-open { transform: scaleY(0); }
.sealed .flap { transform: scaleY(1); }

/* The ritual's opening scene, filling the page. */
.ritual-intro { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
                background: radial-gradient(circle at 50% 42%, #4A2018, #1A0B0A 72%); opacity: 0; transition: opacity 0.45s ease; cursor: pointer; }
.ritual-intro.on { opacity: 1; }
.ritual-intro .auntie-svg { height: min(76vh, 640px); width: auto; max-width: 92vw; }
.ritual-intro p { margin: 0; padding: 0 20px; font: italic 26px/1.3 var(--voice); color: var(--gold); text-align: center; }
.ritual-intro .skip { font: 14px var(--text); color: var(--muted); font-style: normal; }

/* ---- The reading ---- */
.reading { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; max-width: 36em; }
.reading .eyebrow { color: #B3261E; }
.reading p { margin: 0; }
.part, .closing { font: 18px/1.45 var(--voice); }
.part-name { font-weight: 600; }
.part-name { color: #B3261E; }
.part-head .part-name { color: #1F5F82; }
.part-fate .part-name { color: #7A5A08; }
.closing { padding-top: 10px; border-top: 2px dashed #D9C2A0; }
.reading .small { color: var(--ink-soft); }
.reading:focus:not(:focus-visible) { outline: none; }

.ask { display: flex; flex-direction: column; gap: 8px; max-width: 36em; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.said { margin: 0; padding: 8px 14px; max-width: 88%; }
.said-visitor { align-self: flex-end; background: var(--bg-3); border-radius: 16px 16px 4px 16px; }
.said-auntie { align-self: flex-start; background: var(--paper); color: var(--ink); border-radius: 16px 16px 16px 4px; font: italic 18px/1.4 var(--voice); }
.said-wait { opacity: 0.7; }
.ask label { font-size: 18px; }
.ask-row { display: flex; gap: 10px; }
.ask-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--gold-2); background: var(--paper); color: var(--ink); font: 19px var(--text); }
.ask-row input::placeholder { color: #7A5E52; }

/* ---- Footer ---- */
.foot { flex: none; padding-bottom: 18px; }
.cloth { height: 56px; margin: 0 -20px; padding-left: 20px; background: var(--red-deep); }
.cloth { overflow-x: clip; }   /* clips the sweep sideways while the tiles still overhang the top edge */
/* The tile oracle: tiles are laid one at a time from the left, then the row is swept off to the right. */
.cloth { position: relative; }
.cloth #foot-tiles { display: flex; align-items: flex-start; gap: 8px; }
.reshuffle { position: absolute; z-index: 2; right: 22px; bottom: 9px; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1.5px solid var(--gold-2);
             background: rgba(26, 11, 10, 0.35); color: var(--cream); font: 600 14px var(--text); cursor: pointer; }
.reshuffle:hover { background: rgba(26, 11, 10, 0.6); }
.oracle-tile { flex: none; width: 48px; margin-top: -30px; }
.oracle-tile .tile { display: block; width: 100%; height: auto; }
.oracle-tile { opacity: 0; transform: translate(-18px, -40px) rotate(-10deg); transition: transform 0.6s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.25s ease; }
.oracle-tile.placed { opacity: 1; transform: none; }
.swept .oracle-tile { transform: translateX(110vw) rotate(18deg); transition: transform 2s cubic-bezier(0.55, 0, 0.8, 0.4) calc(var(--j) * 60ms); }
/* Browsers without overflow: clip (Safari before 16) would scroll sideways with the sweep, so there
   the tiles slide a little and fade instead. */
@supports not (overflow-x: clip) {
  .swept .oracle-tile { transform: translateX(40px) rotate(8deg); opacity: 0;
                        transition: transform 0.9s ease-in calc(var(--j) * 60ms), opacity 0.9s ease-in calc(var(--j) * 60ms); }
}
/* The riddle's tiles pulse gently, one after another, so they read as a word. */
.oracle-tile.clue.placed .tile { transform-origin: 50% 80%; animation: clue 2.6s ease-in-out calc(0.6s + var(--k) * 0.3s) infinite; }
@keyframes clue { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(242, 199, 106, 0)); }
                  50% { transform: scale(1.07); filter: drop-shadow(0 0 7px rgba(242, 199, 106, 0.9)); } }
.still .oracle-tile { opacity: 1; transform: none; }
.foot-line { margin: 12px 0 0; font-size: 16px; color: var(--muted); max-width: 60em; }

/* ---- Behind the curtain ---- */
.curtain { width: min(1120px, 94vw); max-height: 90vh; padding: 0; border: 3px solid var(--gold-2); border-radius: 14px; background: #FBF6EE; color: #2B2422; font: 17px/1.45 var(--text); }
.curtain::backdrop { background: rgba(20, 8, 6, 0.72); }
.curtain-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; background: var(--red-deep); }
.curtain-head h2 { color: var(--gold); }
.curtain-body { padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.curtain .lead { max-width: 50em; }
.curtain .small { color: #5A4E48; }
.curtain .eyebrow { color: #B3261E; font-size: 13px; }
.notice { margin: 0; padding: 10px 14px; border: 2px dashed #9C6B12; border-radius: 10px; background: #FBEFD2; color: #4A3608; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.col-wide { grid-column: 1 / -1; }
.told { display: grid; grid-template-columns: 1.3fr 1.2fr 1fr; gap: 24px; font-size: 16px; line-height: 1.35; }
.told ul { margin-bottom: 4px; }
.told .chip { font-size: 15px; }
.told .label:first-child { margin-top: 0 !important; }
.col { background: #FFFFFF; border: 2px solid #2B2422; border-radius: 14px; padding: 16px 18px; min-width: 0; }
.col p { margin: 0 0 8px; }
.col ul { margin: 0 0 8px; padding-left: 20px; }
.label { margin-top: 12px !important; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; color: #5A4E48; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 12px; border: 2px solid #B3261E; border-radius: 14px; background: #FFF1EC; font-size: 16px; }
.locked { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 6px; }
.locked li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: #2B2422; color: #FBF6EE; border-radius: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.status { flex: none; min-width: 5.6em; text-align: center; padding: 1px 10px; border: 2px solid #8A7F7A; border-radius: 14px; background: #F1ECE4; color: #4A4340; font-size: 15px; }
.status-passed { border-color: #2E6B3C; background: #E3F1E6; color: #1F4E2B; }
.status-failed { border-color: #B3261E; background: #FBE3DF; color: #7A1414; }
.status-used { border-color: #9C6B12; background: #FBEFD2; color: #4A3608; }

/* ---- Phones ---- */
@media (max-width: 780px) {
  body { font-size: 18px; }
  .top { height: 78px; }
  .top { height: 96px; }
  .lantern-left { width: 66px; }
  .lantern-right { width: 56px; }
  .slot .tile { width: 70px; }
  .oracle-tile { width: 40px; margin-top: -24px; }
  .cloth #foot-tiles { gap: 6px; }
  .reshuffle { right: 14px; padding: 0 12px; font-size: 13px; }
  .banner { top: 24px; }
  .banner-face { font-size: 13px; letter-spacing: 2px; padding: 6px 14px; }
  .table { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .auntie { width: min(230px, 62vw); margin: 0 auto; }
  body[data-screen="run"] .auntie, body[data-screen="envelope"] .auntie { width: min(150px, 40vw); }
  .title-small { font-size: 24px; }
  .pile { transform: scale(0.82); transform-origin: left center; margin-right: -46px; }
  .wall { gap: 6px; }
  .cushion { width: 150px; }
  .palm-hand { width: 118px; height: 156px; }
}
@media (max-width: 860px) {
  .cols, .told { grid-template-columns: minmax(0, 1fr); }
  .told { gap: 4px; }
}

/* ---- Reduced motion (the site's rule: honoured unless the reviewer's switch is on) ---- */
@media (prefers-reduced-motion: reduce) {
  html:not(.motion-on) *, html:not(.motion-on) *::before { transition: none !important; animation: none !important; }
}
