/* THE RETURN — "Gilded Miniature" UI. Tokens from docs/DIRECTION.md, patterns from docs/UI-REFS.md. */
@font-face { font-family: 'Bodoni Moda'; src: url(/fonts/bodoni-moda.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url(/fonts/bodoni-moda-italic.woff2) format('woff2'); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Barlow SC'; src: url(/fonts/barlow-sc-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow SC'; src: url(/fonts/barlow-sc-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow SC'; src: url(/fonts/barlow-sc-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow SC'; src: url(/fonts/barlow-sc-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }
/* games.js still draws its canvas captions in Cinzel */
@font-face { font-family: Cinzel; src: url(/fonts/cinzel.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }

:root {
  /* materials */
  --lacquer: #0B1330; --lacquer-deep: #060A1D; --lapis: #1C2C66; --lapis-hi: #2E4392; --lapis-lo: #111B45;
  --gold: #E8B54A; --gold-hi: #FFE2A0; --gold-lo: #8C6118; --gold-edge: #5E3F0C;
  --ivory: #F2EADB; --ivory-dim: #BDB6A6; --garnet: #A3203A; --garnet-hi: #D9455F;
  --ink: #2A1A04;
  --metal: linear-gradient(180deg, #FFF3CF 0%, #FFE2A0 16%, #E8B54A 48%, #C08B2C 74%, #8C6118 100%);
  --metal-side: linear-gradient(90deg, #8C6118, #E8B54A 30%, #FFE2A0 50%, #E8B54A 70%, #8C6118);
  --enamel: radial-gradient(130% 90% at 50% -10%, #34489A 0%, #1C2C66 42%, #131F50 100%);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .7 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* type */
  --display: 'Bodoni Moda', 'Didot', Georgia, serif;
  --ui: 'Barlow SC', 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  /* motion */
  --spring: cubic-bezier(.34, 1.56, .64, 1); --out: cubic-bezier(.2, .8, .2, 1);
  /* layout */
  --tabs-h: 70px; --hud-h: 56px; --safe-b: env(safe-area-inset-bottom); --safe-t: env(safe-area-inset-top);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
/* phone: no double-tap zoom anywhere, no pull-to-refresh / overscroll back-swipe (Chrome reads it on html) */
html { touch-action: manipulation; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  color: var(--ivory); font: 500 17px/1.4 var(--ui); overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  background: var(--grain), radial-gradient(120% 70% at 50% 0%, #22357A 0%, #0B1330 55%, #060A1D 100%) fixed, var(--lacquer);
  font-variant-numeric: tabular-nums lining-nums;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; color: var(--ivory); text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: 30px; line-height: 1.05; } h2 { font-size: 25px; line-height: 1.1; }
p { margin: 0; }
[hidden] { display: none !important; }
img { -webkit-user-drag: none; user-select: none; }
/* an app, not a page: long presses (hold games, coins, art) must not select text or pop the image menu */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.ic { display: inline-block; width: 1.15em; height: 1.15em; background: currentColor; -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; flex: none; }
.err { color: #FF8FA3; min-height: 1.3em; font-size: 15px; font-weight: 600; }
.fine { color: var(--ivory-dim); font-size: 13px; text-align: center; margin-top: 14px; opacity: .8; }
.gold-text { background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- materials ---------- */
/* gold rim: a metal gradient ring drawn as a masked pseudo-element */
.rim, .plate, .pill, .orb, .banner-plate, .ribbon, .raise, .sku, .bless, .deco, .tablet { position: relative; }
.rim::before, .plate::before, .pill::before, .orb::before, .banner-plate::before, .sku::before, .bless::before, .tablet::before, .raise::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: var(--metal); pointer-events: none; z-index: 1;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.plate { background: var(--grain), var(--enamel); border-radius: 22px; box-shadow: inset 0 1px 0 #ffffff26, inset 0 -18px 30px #0007, 0 18px 40px #000b; }
.plate p { color: #D9D1C0; }

/* physical buttons: face + thickness, press sinks the face into its edge */
.btn {
  --edge: var(--gold-edge); --lift: 5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 24px; border-radius: 14px;
  background: var(--metal); color: var(--ink); font: 800 18px/1 var(--ui); letter-spacing: .01em;
  text-shadow: 0 1px 0 #FFF4D299;
  box-shadow: inset 0 2px 0 #FFFBEA, inset 0 -2px 0 #8C611866, 0 var(--lift) 0 var(--edge), 0 calc(var(--lift) + 6px) 16px #000a;
  transform: translateY(0); transition: transform .09s ease-out, box-shadow .09s ease-out, filter .2s;
  position: relative; isolation: isolate; overflow: hidden;
}
.btn::after { /* moving sheen */
  content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, #fff8 48%, transparent 60%); transform: translateX(-120%); pointer-events: none;
}
.btn.shine::after, .btn.big::after { animation: sheen 3.6s 1s infinite; }
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.btn:active:not(:disabled) { transform: translateY(calc(var(--lift) - 1px)); box-shadow: inset 0 2px 0 #FFFBEA, inset 0 -2px 0 #8C611866, 0 1px 0 var(--edge), 0 3px 8px #000a; }
.btn.pop { animation: btnpop .32s var(--spring); }
@keyframes btnpop { 0% { transform: translateY(3px) scale(.97); } 60% { transform: translateY(-2px) scale(1.02); } 100% { transform: none; } }
.btn:disabled { cursor: default; filter: saturate(.25) brightness(.62); }
.btn.big { min-height: 58px; font-size: 20px; border-radius: 16px; }
.btn.enamel { --edge: #070D26; background: var(--grain), var(--enamel); color: var(--gold-hi); text-shadow: 0 1px 0 #0008; box-shadow: inset 0 1px 0 #ffffff33, inset 0 0 0 1.5px #E8B54A99, 0 var(--lift) 0 var(--edge), 0 calc(var(--lift) + 6px) 14px #000a; }
.btn.enamel:active:not(:disabled) { box-shadow: inset 0 1px 0 #ffffff33, inset 0 0 0 1.5px #E8B54A99, 0 1px 0 var(--edge), 0 3px 8px #000a; }
.btn.garnet { --edge: #4A0717; background: linear-gradient(180deg, #E0566E, #A3203A 60%, #7D1328); color: #FFF1E8; text-shadow: 0 1px 0 #0006; }
.btn .coin { width: 20px; height: 20px; }

/* struck coin made of CSS: rim + face + highlight */
.coin { display: inline-block; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF6D8 0 12%, transparent 30%), radial-gradient(circle, #E8B54A 0 52%, #B88328 53% 60%, #FFE2A0 61% 68%, #8C6118 69%);
  box-shadow: 0 1px 0 #5E3F0C, 0 2px 4px #0008; }

/* pills: HUD currencies */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 6px; border-radius: 999px;
  background: linear-gradient(180deg, #0F1A45ee, #070D26ee); box-shadow: inset 0 1px 0 #ffffff22, 0 4px 12px #0009; color: var(--ivory);
  font: 800 17px/1 var(--ui); white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pill b { font-weight: 800; }
.pill-btn { color: #fffc; font: 700 15px var(--ui); padding: 10px 16px; border-radius: 999px; background: #0007; box-shadow: inset 0 0 0 1px #fff3; }

/* round floating action (orb) */
.orb { display: grid; place-items: center; align-content: center; gap: 1px; width: 62px; height: 62px; border-radius: 50%;
  background: var(--grain), var(--enamel); color: var(--gold-hi); box-shadow: inset 0 2px 0 #ffffff30, 0 4px 0 #070D26, 0 10px 20px #000b;
  transition: transform .1s; font: 700 11px/1 var(--ui); }
.orb .ic { width: 26px; height: 26px; }
.orb:active { transform: translateY(3px) scale(.96); }

/* ribbon banner (grace/decay, toasts) */
.ribbon { margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); padding: 9px 22px; text-align: center; font: 700 15px/1.25 var(--ui); color: var(--ink);
  background: var(--metal); clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%, 12px 50%); filter: drop-shadow(0 6px 12px #000a); }
.ribbon.dim { background: linear-gradient(180deg, #3A4570, #1E2750); color: #E6DFCF; }

/* ---------- HUD ---------- */
#hud { position: fixed; z-index: 16; inset: 0 0 auto; padding: calc(10px + var(--safe-t)) 10px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; pointer-events: none; }
#hud > * { pointer-events: auto; }
/* scrolling screens slide under the HUD: give the pills a lacquer backdrop there */
#hud::before { content: ''; position: absolute; z-index: -1; inset: 0 0 -22px; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: linear-gradient(180deg, #0B1330 0, #0B1330ee calc(100% - 34px), transparent); }
body:has(#offerings:not([hidden])) #hud::before { opacity: 1; }
.who { justify-self: start; max-width: 100%; padding-right: 12px; font: 700 14px var(--ui); }
.who #rank { overflow: hidden; text-overflow: ellipsis; }
.who-crest { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--metal); color: var(--gold-edge); flex: none; box-shadow: 0 1px 0 #5E3F0C; }
.who-crest .ic { width: 18px; height: 18px; }
.purse { min-width: 108px; justify-content: flex-start; padding-right: 18px; font-size: 19px; }
.purse .coin { width: 28px; height: 28px; }
.purse.bump .coin { animation: coinpop .5s var(--spring); }
@keyframes coinpop { 0% { transform: scale(1); } 35% { transform: scale(1.45) rotate(-12deg); } 100% { transform: scale(1); } }
.purse.bump b { animation: numglow .9s; } @keyframes numglow { 30% { color: var(--gold-hi); text-shadow: 0 0 12px #FFC94A; } }
.flame { justify-self: end; padding: 0 14px 0 10px; }
.flame .ic { width: 20px; height: 22px; color: #FF9D3C; filter: drop-shadow(0 0 6px #FF7A1A); animation: flick 1.1s infinite alternate; transform-origin: 50% 90%; }
.flame.out { color: var(--ivory-dim); } .flame.out .ic { color: #6E7593; filter: none; animation: none; }
@keyframes flick { to { transform: scale(1.12, 1.18) rotate(-4deg); } }

/* ---------- screens + transitions ---------- */
main { max-width: 520px; margin: 0 auto; }
.screen.enter { animation: screen-in .34s var(--out); }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- Shrine: the temple full-bleed, UI floats ---------- */
#shrine { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
#scene { position: absolute; inset: 0; background: radial-gradient(90% 55% at 50% 52%, #2A3D86 0%, #142058 45%, #070C24 100%); }
#scene::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--grain), radial-gradient(130% 90% at 50% 50%, transparent 55%, #03061499 100%), linear-gradient(180deg, #060A1Dcc 0, transparent 22%, transparent 58%, #060A1Dee 86%); }
#art-img { position: absolute; left: 50%; top: 47%; width: min(118vw, 620px); aspect-ratio: 1; height: auto; translate: -50% -50%; transition: filter 1s, transform .5s var(--out); }
#temple { position: absolute; inset: 0; }
#temple:empty { display: none; }
body.t3d #art-img { display: none; }
#shrine.decay1 #art-img, #shrine.decay1 #temple { filter: saturate(.6) brightness(.88); }
#shrine.decay2 #art-img, #shrine.decay2 #temple { filter: saturate(.3) brightness(.68); }
#shrine.decay3 #art-img, #shrine.decay3 #temple { filter: grayscale(1) brightness(.45); }
#shrine.blessed #scene { animation: bless 1.1s ease-out; }
@keyframes bless { 25% { filter: brightness(1.55) saturate(1.25); } }
#shrine.picking #art-img { transform: translateY(-17%) scale(.92); }
#floaters { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.floater { position: absolute; left: 50%; top: 52%; translate: -50% 0; font: 800 30px var(--ui); color: var(--gold-hi); text-shadow: 0 0 18px #FFB52E, 0 2px 0 #5E3F0C, 0 3px 6px #000; animation: rise 1.6s var(--out) forwards; white-space: nowrap; }
@keyframes rise { 0% { opacity: 0; transform: translateY(30px) scale(.6); } 18% { opacity: 1; transform: translateY(0) scale(1.15); } 30% { transform: scale(1); } 100% { opacity: 0; transform: translateY(-140px); } }

#shrine-top { position: absolute; z-index: 4; inset: calc(var(--hud-h) + var(--safe-t) + 4px) 0 auto; display: grid; gap: 8px; justify-items: center; padding: 0 14px; pointer-events: none; }
#shrine-top > * { pointer-events: auto; }
.stage-plate { text-align: center; }
#stage { font-size: 31px; font-weight: 800; text-shadow: 0 2px 18px #000c, 0 0 2px #000; }
#stats { margin-top: 3px; font: 600 13px var(--ui); color: var(--ivory-dim); letter-spacing: .02em; text-shadow: 0 1px 4px #000; }

/* six stages as gems on a gold chain */
#ladder { list-style: none; margin: 2px 0 0; padding: 0; width: min(100%, 300px); display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
#ladder::before { content: ''; position: absolute; left: 8.33%; right: 8.33%; top: 15px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) calc(var(--done, 0) * 20%), #ffffff1f 0); box-shadow: 0 1px 2px #000a; }
#ladder li { position: relative; display: grid; justify-items: center; }
#ladder button { width: 26px; height: 26px; margin: 2px; transform: rotate(45deg); border-radius: 6px; background: #0D1538; box-shadow: inset 0 0 0 1.5px #ffffff2a, 0 2px 4px #000a; position: relative; }
#ladder button span { display: block; transform: rotate(-45deg); font: 800 10px/26px var(--display); color: var(--ivory-dim); }
#ladder button::after { content: ''; position: absolute; inset: -10px; }
#ladder .done button { background: linear-gradient(135deg, #C9943A, #8C6118); } #ladder .done span { color: var(--ink); }
#ladder .now button { width: 32px; height: 32px; margin: -1px; background: var(--metal); box-shadow: 0 0 0 2px var(--lacquer), 0 0 0 3.5px var(--gold-hi), 0 0 18px #FFC94Aaa; animation: gem 2.6s infinite; }
#ladder .now span { color: var(--ink); line-height: 32px; font-size: 12px; }
@keyframes gem { 50% { box-shadow: 0 0 0 2px var(--lacquer), 0 0 0 3.5px var(--gold-hi), 0 0 28px #FFC94A; } }
#ladder .next button { box-shadow: inset 0 0 0 1.5px var(--gold), 0 2px 4px #000a; } #ladder .next span { color: var(--gold-hi); }
#ladder small { font: 700 10.5px var(--ui); color: var(--gold-hi); min-height: 14px; margin-top: 5px; text-shadow: 0 1px 3px #000; }

#adorn { position: absolute; z-index: 5; right: 14px; top: 46%; width: 66px; height: 66px; }
#adorn span { font-size: 11px; } #adorn b { position: absolute; top: -6px; right: -8px; z-index: 2; min-width: 30px; padding: 3px 6px; border-radius: 10px; background: var(--metal); color: var(--ink); font: 800 11px/1 var(--ui); box-shadow: 0 2px 0 #5E3F0C; }

#shrine-ui { position: absolute; z-index: 5; inset: auto 0 calc(var(--tabs-h) + var(--safe-b) + 48px); /* clears the PRAY medallion, which rises 44px above the dock */ padding: 0 14px; display: grid; gap: 10px; max-width: 520px; margin: 0 auto; }
#oracle { display: grid; grid-template-columns: 58px 1fr; gap: 8px; align-items: center; }
#her { width: 58px; height: 58px; border-radius: 50%; padding: 0; position: relative; filter: drop-shadow(0 4px 10px #000c); transition: transform .15s var(--spring); }
#her:active { transform: scale(.92); }
#her img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 20%; box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px #0B1330, 0 0 0 5px var(--gold-lo); }
#her.speaking img { animation: nod .6s var(--spring); } @keyframes nod { 40% { transform: scale(1.08) rotate(-4deg); } }
.scroll { position: relative; padding: 8px 14px 9px; border-radius: 4px 16px 16px 16px; background: var(--grain), linear-gradient(180deg, #F6EEDCf2, #E3D6BCf2); color: var(--ink); box-shadow: inset 0 0 0 1px #fff8, inset 0 -3px 0 #C9B48A, 0 8px 18px #000a; }
.scroll::before { content: ''; position: absolute; left: -7px; top: 14px; border: 7px solid transparent; border-right-color: #F2E9D6; border-left: 0; }
.scroll b { display: block; font: 800 11px var(--ui); color: var(--gold-lo); letter-spacing: .08em; text-transform: uppercase; }
#voice { font: italic 600 16.5px/1.25 var(--display); color: #2A1E0C; }
#voice.typing { animation: voicein .4s var(--out); } @keyframes voicein { from { opacity: 0; transform: translateY(4px); } }

#sin { padding: 10px 12px; border-radius: 14px; background: linear-gradient(180deg, #5B1124, #3A0A17); color: #FFD9DF; box-shadow: inset 0 0 0 1.5px var(--garnet-hi), 0 8px 16px #000a; font-size: 15px; font-weight: 600; text-align: center; }
#sin button { color: var(--gold-hi); text-decoration: underline; font-weight: 800; padding: 4px 0; }

/* raise: a physical progress button */
.raise { display: block; width: 100%; min-height: 56px; border-radius: 16px; overflow: hidden; background: #070D26; color: var(--gold-hi);
  box-shadow: inset 0 3px 8px #000c, 0 5px 0 #03061A, 0 12px 20px #000a; font: 800 17px var(--ui); transition: transform .09s; }
.raise::before { z-index: 3; }
#raise-fill { position: absolute; inset: 3px auto 3px 3px; width: 0; max-width: calc(100% - 6px); border-radius: 13px; background: linear-gradient(180deg, #F8D27A, #C08B2C 60%, #8C6118); box-shadow: inset 0 1px 0 #FFF2C8; transition: width .9s var(--out); }
#raise-fill::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(115deg, #fff2 0 8px, transparent 8px 18px); animation: march 1.2s linear infinite; }
@keyframes march { to { background-position: 40px 0; } }
#raise-label { position: relative; z-index: 2; padding: 0 12px; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.raise.ready { background: var(--metal); color: var(--ink); box-shadow: inset 0 2px 0 #FFFBEA, 0 5px 0 var(--gold-edge), 0 0 30px #FFC94A88, 0 12px 20px #000a; }
.raise.ready #raise-label { text-shadow: 0 1px 0 #FFF4D2; font-size: 19px; }
.raise.ready #raise-fill { display: none; }
.raise:active:not(:disabled) { transform: translateY(4px); }
.raise:disabled { opacity: .85; }
#raise-note { color: var(--ivory-dim); font-size: 13px; font-weight: 600; text-align: center; min-height: 1.2em; margin-top: -4px; text-shadow: 0 1px 3px #000; }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { filter: none; transform: scale(1); } 50% { filter: drop-shadow(0 0 14px #FFD36E); transform: scale(1.035); } }

/* ---------- decoration picker (in place over the temple) ---------- */
#picker { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.picker-panel { pointer-events: auto; position: absolute; inset: auto 0 0; max-width: 520px; margin: 0 auto; padding: 10px 0 calc(12px + var(--safe-b));
  border-radius: 26px 26px 0 0; background: var(--grain), linear-gradient(180deg, #1E2D6Af5, #0E1640fa 40%, #080E2Cfc); box-shadow: inset 0 1.5px 0 #FFE2A0aa, 0 -20px 50px #000c;
  animation: sheet-up .42s var(--spring); display: grid; gap: 10px; }
.picker-panel.out { animation: sheet-down .22s ease-in forwards; }
.seg { display: flex; gap: 4px; margin: 0 14px; padding: 4px; border-radius: 12px; background: #050A20; box-shadow: inset 0 2px 4px #000a; }
.seg button { flex: 1; min-height: 34px; border-radius: 9px; font: 700 13px var(--ui); color: var(--ivory-dim); }
.seg button.on { background: var(--enamel); color: var(--gold-hi); box-shadow: inset 0 1px 0 #fff3, inset 0 0 0 1px #E8B54A88; }
.slot-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 14px 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.slot-tabs::-webkit-scrollbar { display: none; }
.slot-tabs button { flex: none; display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; background: #0A1233; box-shadow: inset 0 0 0 1px #ffffff1c; font: 700 14px var(--ui); color: var(--ivory-dim); scroll-snap-align: start; }
.slot-tabs button.on { background: var(--metal); color: var(--ink); box-shadow: 0 3px 0 var(--gold-edge); }
.slot-tabs button.locked { opacity: .55; }
.slot-tabs .ic { width: 14px; height: 14px; }
.inv { --tw: calc((min(100vw, 520px) - 58px) / 4); grid-auto-rows: calc(var(--tw) / .82); /* fixed row height: Safari squashed aspect-ratio tiles to fit a short scroll box */ display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px 14px 6px; max-height: 32dvh; overflow-y: auto; scrollbar-width: none; align-content: start; }
.inv-note { grid-column: 1 / -1; text-align: center; color: var(--ivory-dim); font-size: 14px; padding: 18px 0; }

/* inventory tile: frame colour = tier (Humble bronze, Fine silver-blue, Rich violet, Divine gold) */
.deco { --f1: #B98A5A; --f2: #6B4526; --bg: linear-gradient(180deg, #3A2A20, #1A120D);
  display: grid; grid-template-rows: 1fr auto; aspect-ratio: .82; padding: 0; border-radius: 12px; overflow: hidden; background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--f1), inset 0 0 0 3.5px var(--f2), 0 3px 0 #0008; transition: transform .14s var(--spring); }
.deco.t1 { --f1: #B8CCE8; --f2: #4A6189; --bg: linear-gradient(180deg, #2E4470, #141F3E); }
.deco.t2 { --f1: #C7A0F0; --f2: #5A2C8A; --bg: linear-gradient(180deg, #4A2A78, #1E1236); }
.deco.t3 { --f1: #FFE2A0; --f2: #8C6118; --bg: radial-gradient(circle at 50% 35%, #7A5718, #2A1A06 80%); }
.deco.t3::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, #fff5 50%, transparent 60%); background-size: 250% 100%; animation: tile-sheen 3s infinite; pointer-events: none; }
@keyframes tile-sheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.deco img { width: 100%; height: 100%; object-fit: contain; padding: 8px 6px 0; filter: drop-shadow(0 4px 4px #0009); min-height: 0; }
.deco small { display: flex; align-items: center; justify-content: center; gap: 3px; height: 22px; font: 800 12px var(--ui); color: var(--ivory); background: #0008; }
.deco small .coin { width: 12px; height: 12px; }
.deco.owned small { color: #CDE7C0; }
.deco.on small { background: var(--metal); color: var(--ink); }
.deco.on::before { content: '✓'; position: absolute; top: 4px; right: 4px; z-index: 2; width: 18px; height: 18px; border-radius: 50%; background: var(--metal); color: var(--ink); font: 900 11px/18px var(--ui); text-align: center; }
.deco.sel { transform: translateY(-4px) scale(1.04); box-shadow: inset 0 0 0 2px var(--f1), inset 0 0 0 3.5px var(--f2), 0 0 0 2.5px #fff, 0 0 18px #FFE2A0aa, 0 6px 0 #0008; }
.deco.poor small { color: #FF9FB0; }
.deco:disabled { filter: grayscale(.8) brightness(.5); }
.pk-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 4px 14px 0; }
#pk-info { min-width: 0; }
#pk-name { display: block; font: 700 19px/1.1 var(--display); color: var(--ivory); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pk-tier { font: 700 13px var(--ui); color: var(--ivory-dim); }
#pk-tier i { font-style: normal; } .tier1 { color: #B8CCE8; } .tier2 { color: #D3B1F5; } .tier3 { color: var(--gold-hi); } .tier0 { color: #D7AD80; }
#pk-act { min-width: 148px; }
.x { position: absolute; top: 10px; right: 12px; z-index: 4; width: 40px; height: 40px; border-radius: 50%; font: 400 26px/1 var(--ui); color: var(--gold-hi);
  background: radial-gradient(circle at 50% 30%, #2A3C80, #0B1330); box-shadow: inset 0 0 0 1.5px #E8B54Aaa, 0 3px 0 #03061A; }
.x:active { transform: translateY(2px); }
.grab { width: 44px; height: 5px; border-radius: 3px; background: #FFE2A066; margin: 0 auto; touch-action: none; }

/* ---------- dock with the raised PRAY medallion ---------- */
#tabs { position: fixed; z-index: 15; inset: auto 0 0; height: calc(var(--tabs-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 100px 1fr 1fr; grid-template-rows: var(--tabs-h); align-items: end;
  background: var(--grain), linear-gradient(180deg, #24367Cf7, #111B48fa 45%, #080E2Cfd); border-radius: 22px 22px 0 0;
  box-shadow: inset 0 2px 0 #FFE2A0, inset 0 3px 0 #8C6118, inset 0 5px 10px #0006, 0 -10px 30px #000b; }
#tabs > button:not(.medal) { height: var(--tabs-h); padding-top: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #8F9BC8; font: 700 12px var(--ui); position: relative; transition: color .2s; }
#tabs > button .ic { width: 27px; height: 27px; transition: transform .3s var(--spring); }
#tabs > button.on { color: var(--gold-hi); }
#tabs > button.on .ic { transform: translateY(-3px) scale(1.12); filter: drop-shadow(0 0 8px #FFC94A99); }
#tabs > button.on::before { content: ''; position: absolute; top: 6px; width: 7px; height: 7px; transform: rotate(45deg); background: var(--metal); box-shadow: 0 0 8px #FFC94A; }
#tabs > button:active:not(.medal) .ic { transform: scale(.88); }
#runs { position: absolute; top: 6px; left: calc(50% + 7px); min-width: 20px; height: 20px; border-radius: 10px; background: linear-gradient(180deg, #E0566E, #A3203A); color: #fff; font: 800 12px/20px var(--ui); font-style: normal; padding: 0 5px; box-shadow: 0 0 0 2px #111B48, 0 2px 4px #000a; }
#runs:empty { display: none; }
.medal { position: relative; width: 96px; height: 96px; margin-bottom: 18px; border-radius: 50%; justify-self: center;
  background: radial-gradient(circle at 50% 38%, #FFF3CF 0 6%, transparent 40%), url(/art/medal.webp) center/cover, var(--metal);
  box-shadow: 0 6px 0 var(--gold-edge), 0 14px 24px #000c, 0 0 0 4px #111B48, 0 0 0 5.5px var(--gold); transition: transform .1s ease-out, box-shadow .1s, filter .4s; }
.medal:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--gold-edge), 0 6px 12px #000c, 0 0 0 4px #111B48, 0 0 0 5.5px var(--gold); }
.medal span { position: absolute; inset: 0; display: grid; place-items: center; font: 900 21px var(--display); color: #4A2F04; text-shadow: 0 1px 0 #FFF1B8, 0 -1px 0 #8C611888; }
.medal svg { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; }
.medal circle { fill: none; stroke: #0000; stroke-width: 3.2; }
#pray-ring { stroke: var(--gold-hi); stroke-linecap: round; stroke-dasharray: 295.3; stroke-dashoffset: 295.3; filter: drop-shadow(0 0 4px #FFC94A); transition: stroke-dashoffset 1s linear; }
.medal.cool { filter: saturate(.3) brightness(.7); } .medal.cool span { font: 800 16px var(--ui); color: #2A1A04; }
.medal.ready { animation: glow 2.4s infinite; }
@keyframes glow { 50% { box-shadow: 0 6px 0 var(--gold-edge), 0 14px 24px #000c, 0 0 0 4px #111B48, 0 0 0 5.5px var(--gold), 0 0 40px 8px #FFC94Acc; } }
.medal.nope { animation: nope .35s; } @keyframes nope { 25% { transform: translateX(-6px) rotate(-4deg); } 75% { transform: translateX(6px) rotate(4deg); } }

/* ---------- World ---------- */
#world { position: fixed; inset: 0; z-index: 1; }
#map { position: absolute; inset: 0; background: var(--lacquer); }
#world::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(130% 90% at 50% 50%, transparent 60%, #030614aa 100%), linear-gradient(180deg, #060A1Daa 0, transparent 16%, transparent 80%, #060A1Dcc 100%); }
.banner-plate { position: absolute; z-index: 3; top: calc(var(--hud-h) + var(--safe-t) + 6px); left: 50%; translate: -50% 0; max-width: calc(100% - 28px);
  padding: 8px 18px; border-radius: 12px; background: var(--grain), var(--enamel); box-shadow: inset 0 1px 0 #fff3, 0 8px 18px #000b;
  font: 700 13px/1.3 var(--ui); color: var(--ivory); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-plate b { font: 700 16px var(--display); color: var(--gold-hi); margin-right: 6px; }
#world-side { position: absolute; z-index: 4; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 40px); display: grid; gap: 14px; justify-items: end; }
#agon-btn span, .her-orb span { font-size: 11px; }
.her-orb { width: 66px; height: 66px; padding: 0; overflow: visible; }
.her-orb img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; }
.her-orb span { position: absolute; bottom: -9px; left: 50%; translate: -50% 0; z-index: 2; white-space: nowrap; padding: 3px 8px; border-radius: 8px; background: var(--metal); color: var(--ink); font: 800 11px var(--ui); box-shadow: 0 2px 0 #5E3F0C; }
.her-orb::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; box-shadow: 0 0 0 2px #FFE2A0; animation: ping 2s infinite; }
@keyframes ping { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.35); } }
#aim { position: absolute; z-index: 3; left: 50%; top: 34%; width: 0; height: 0; pointer-events: none; }
#aim i { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px var(--gold-hi), 0 0 24px #FFC94A, inset 0 0 18px #FFC94A88; animation: aim 1.6s infinite; }
#aim::before, #aim::after { content: ''; position: absolute; background: var(--gold-hi); box-shadow: 0 0 8px #FFB52E; }
#aim::before { left: -1px; top: -40px; width: 2px; height: 80px; } #aim::after { top: -1px; left: -40px; height: 2px; width: 80px; }
@keyframes aim { 50% { transform: scale(1.22); opacity: .65; } }
#placer { position: absolute; z-index: 5; inset: auto 0 var(--kb, 0px); transition: bottom .2s; max-width: 520px; margin: 0 auto; border-radius: 26px 26px 0 0; padding: 20px 16px calc(16px + var(--safe-b)); text-align: center; display: grid; gap: 10px; animation: sheet-up .5s var(--spring); }
#placer h2 { font-size: 27px; }
#placer:focus-within h2, #placer:focus-within > p:not(.err) { display: none; } /* typing a city: the keyboard owns the space */
#placer .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#placer #locate { min-height: 50px; padding: 0 16px; font-size: 16px; }
.search { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 14px; border-radius: 14px; background: #050A20; box-shadow: inset 0 3px 6px #000c, inset 0 0 0 1px #E8B54A55, 0 1px 0 #ffffff1a; color: var(--gold); }
.search:focus-within { box-shadow: inset 0 3px 6px #000c, inset 0 0 0 1.5px var(--gold-hi), 0 0 14px #FFC94A55; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ivory); font: 600 17px var(--ui); padding: 0; }
.search input::placeholder { color: #7F88AE; }
#city-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#city-list:empty { display: none; }
#city-list button { padding: 9px 14px; border-radius: 999px; background: #0A1233; box-shadow: inset 0 0 0 1px #E8B54A77, 0 3px 0 #03061A; font: 700 14px var(--ui); color: var(--gold-hi); }
#city-list button:active { transform: translateY(2px); }
.maplibregl-ctrl-attrib { font: 10px/1.4 var(--ui) !important; background: #0B1330aa !important; color: #8E96B8 !important; } .maplibregl-ctrl-attrib a { color: #8E96B8 !important; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(var(--tabs-h) + 50px + var(--safe-b)); /* clear the PRAY medallion, which rises above the dock */ }
.me-ring { width: 78px; height: 78px; pointer-events: none; } /* MapLibre positions markers with an inline transform: animate the child, never the marker */
.me-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--gold-hi), 0 0 22px #FFC94A; animation: aim 1.8s infinite; }
.beam { width: 26px; height: 220px; background: linear-gradient(180deg, transparent, #FFE2A0cc); filter: blur(3px); pointer-events: none; } /* anchored at its foot in JS */
/* She Walks: her struck coin walking the streets */
.her { width: 64px; height: 120px; cursor: pointer; padding: 0; background: none; border: 0; }
.her i { display: block; width: 100%; height: 100%; background: url(/art/v2/her-walk.webp) 0 0 / 512px 120px; animation: stride 1.1s steps(8) infinite; filter: drop-shadow(0 0 6px #FFC94A99); } /* 8-frame walk cycle, she strides between shrines */
.her::after { content: ''; position: absolute; left: 50%; bottom: -4px; width: 46px; height: 10px; translate: -50% 0; border-radius: 50%; background: #FFC94A; filter: blur(7px); opacity: .7; z-index: -1; }
.her.west i { scale: -1 1; }
@keyframes stride { to { background-position: -512px 0; } }
@media (prefers-reduced-motion: reduce) { .her i { animation: none; } }
@keyframes walk { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-7px) rotate(6deg); } }

/* ---------- Offerings: a shop shelf ---------- */
#offerings { min-height: 100dvh; padding: calc(var(--hud-h) + var(--safe-t) + 14px) 14px calc(var(--tabs-h) + 64px + var(--safe-b));
  background: radial-gradient(90% 40% at 50% 8%, #3A2C1Aaa, transparent 70%); }
.shop-head { text-align: center; margin-bottom: 16px; }
.shop-head h1 { font-size: 40px; font-style: italic; font-weight: 800; }
.lede { color: var(--ivory-dim); margin-top: 4px; font-size: 15px; }
#skus { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 12px; }
.sku { display: grid; grid-template-rows: auto auto 1fr auto; justify-items: center; gap: 4px; text-align: center; padding: 0 10px 14px; border-radius: 18px;
  background: var(--grain), linear-gradient(180deg, #1A2860, #0D1640); box-shadow: inset 0 1px 0 #fff3, 0 12px 22px #000a; }
.sku:disabled { opacity: .55; filter: grayscale(.7); } .sku:disabled .price { background: none; box-shadow: none; color: var(--ivory-dim); }
.sku.star:disabled { opacity: 1; filter: none; } .sku.star:disabled .price { color: var(--gold-hi); } /* a member: a status, not a dead button */
.sku-art { position: relative; width: 100%; aspect-ratio: 1.15; margin-top: -14px; display: grid; place-items: end center; }
.sku-art::before { content: ''; position: absolute; left: 50%; bottom: 8%; width: 80%; height: 60%; translate: -50% 0; background: radial-gradient(closest-side, #FFC94A55, transparent); }
.sku-art::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: 2%; height: 10px; border-radius: 50%; background: #0009; filter: blur(4px); } /* contact shadow on the shelf */
.sku-art img { position: relative; z-index: 1; width: 92%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 10px #000a); transition: transform .3s var(--spring); }
.sku-art .ic { position: relative; z-index: 1; width: 54%; height: 70%; color: var(--gold); filter: drop-shadow(0 0 16px #FFC94A88); margin-bottom: 12%; }
.sku:active .sku-art img { transform: scale(1.06) translateY(-4px); }
.sku b { font: 700 19px/1.1 var(--display); color: var(--ivory); }
.sku .what { font: 600 13.5px/1.25 var(--ui); color: var(--ivory-dim); align-self: start; }
.sku .what .amt { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-hi); font: 800 17px var(--ui); }
.sku .what .amt .coin { width: 16px; height: 16px; }
.sku .price { margin-top: 8px; width: 100%; min-height: 42px; font-size: 17px; padding: 0 8px; border-radius: 12px; --lift: 4px; }
.sku.star { grid-column: 1 / -1; grid-template-columns: 42% 1fr; grid-template-rows: auto auto 1fr auto; text-align: left; justify-items: start; padding: 14px 14px 14px 6px; column-gap: 10px;
  background: var(--grain), radial-gradient(120% 120% at 20% 30%, #6E1C34, #3A0A1E 60%, #200612); }
.sku.star .sku-art { grid-row: 1 / -1; margin: 0; aspect-ratio: auto; height: 100%; min-height: 150px; }
.sku.star .tag { font: 800 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); background: var(--metal); padding: 3px 8px; border-radius: 6px; }
.sku.star b { font-size: 26px; }
.sku.star .what { color: #F2D9DE; }
.sku.wide { grid-column: 1 / -1; }

/* ---------- sheet: an enamel plate that springs up, drag down to dismiss ---------- */
#sheet { position: fixed; z-index: 30; inset: 0; background: radial-gradient(120% 80% at 50% 100%, #0B133088, #02040Ccc); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
#sheet.out { animation: fade .22s reverse forwards; pointer-events: none; } /* a closing sheet takes no second tap */
#sheet .panel { position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto; overscroll-behavior: contain; text-align: center;
  border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: sheet-up .42s var(--spring); scrollbar-width: none; }
#sheet .panel::before { border-radius: 26px 26px 0 0; }
#sheet.out .panel { animation: sheet-down .22s ease-in forwards; }
#sheet.dragging .panel { animation: none; transition: none; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(105%); } }
@keyframes fade { from { opacity: 0; } }
#sheet-x { position: sticky; float: right; top: 0; margin: 0 -6px -40px 0; }
#sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; justify-items: center; padding-top: 14px; }
#sheet-body > h2 { margin-top: 4px; padding: 0 30px; }
#sheet-body > p { max-width: 36ch; }
#sheet-body .btn { width: 100%; }
#sheet-body > .ic.hero-ic { width: 64px; height: 64px; color: var(--gold); filter: drop-shadow(0 0 18px #FFC94A99); margin-top: 6px; }
.hero { width: 100%; max-height: 40dvh; object-fit: cover; border-radius: 16px; box-shadow: 0 0 0 1.5px var(--gold-lo), 0 10px 24px #000a; }
.hero.locked { filter: brightness(.7) saturate(.5); }
canvas.hero { max-width: 300px; aspect-ratio: 1; height: auto; object-fit: contain; background: radial-gradient(circle, #24357A, #0B1330 70%); }
.her-pic { max-width: 280px; aspect-ratio: 3 / 4; object-position: 50% 20%; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.stats3 div { padding: 10px 4px; border-radius: 14px; background: #050A20; box-shadow: inset 0 2px 5px #000a, inset 0 0 0 1px #E8B54A33; }
.stats3 b { display: block; font: 800 22px var(--ui); color: var(--gold-hi); } .stats3 small { font: 600 12px var(--ui); color: var(--ivory-dim); }
.how { display: grid; gap: 10px; text-align: left; width: 100%; }
.how div { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #050A2088; box-shadow: inset 0 0 0 1px #ffffff12; font-size: 15px; color: #D9D1C0; }
.how .ic { width: 44px; height: 44px; padding: 9px; border-radius: 50%; background: var(--metal); color: var(--gold-edge); -webkit-mask: none; mask: none; position: relative; }
.how .ic::after { content: ''; position: absolute; inset: 9px; background: currentColor; -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; }
.how b { font: 700 17px var(--display); color: var(--ivory); }
.agon { list-style: none; padding: 0; margin: 0; width: 100%; display: grid; gap: 8px; text-align: left; counter-reset: a; }
.agon li { counter-increment: a; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #050A20aa; box-shadow: inset 0 0 0 1px #ffffff14, 0 3px 0 #03061A; cursor: pointer; }
.agon li::before { content: counter(a); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 800 15px var(--ui); color: var(--ivory-dim); background: #1A2558; }
.agon li:nth-child(1)::before { background: var(--metal); color: var(--ink); } .agon li:nth-child(2)::before { background: linear-gradient(180deg, #F2F4F8, #9AA3B5); color: #222; } .agon li:nth-child(3)::before { background: linear-gradient(180deg, #F0B98A, #9A5A2A); color: #2A1404; }
.agon li.mine { box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 16px #FFC94A44, 0 3px 0 #03061A; }
.agon b { font: 700 17px var(--display); } .agon small { color: var(--ivory-dim); display: block; font-size: 13px; } .agon em { font: 800 17px var(--ui); font-style: normal; color: var(--gold-hi); }

/* ---------- registration: a stone tablet you carve into ---------- */
dialog:is(#reg, #login) { background: none; border: 0; padding: 0; width: min(94vw, 400px); max-height: 94dvh; overflow: visible; color: var(--ink); }
dialog:is(#reg, #login)[open] { animation: tablet-in .5s var(--spring); }
@keyframes tablet-in { from { transform: translateY(40px) scale(.9) rotate(-2deg); opacity: 0; } }
dialog:is(#reg, #login)::backdrop { background: radial-gradient(120% 80% at 50% 40%, #1C2C66cc, #02040Cf2); }
.tablet { display: grid; gap: 10px; padding: 46px 20px 20px; border-radius: 22px 22px 18px 18px; text-align: center;
  background: var(--grain), radial-gradient(120% 70% at 50% 0%, #FBF5E8, #E8DCC4 70%, #D6C6A6); box-shadow: inset 0 2px 0 #fff, inset 0 -6px 0 #BCA77E, 0 24px 50px #000c; }
.tablet::before { padding: 2.5px; }
.tablet-coin { position: absolute; left: 50%; top: -38px; translate: -50% 0; width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; box-shadow: 0 0 0 3px var(--gold), 0 0 0 5px #E8DCC4, 0 8px 18px #000a; z-index: 2; }
.tablet h2 { color: #2A1E0C; font-size: 28px; }
.tablet p { color: #5A4A2E; font-size: 15px; }
.carve { display: grid; gap: 2px; text-align: left; }
.carve span { font: 800 11px var(--ui); color: #8C6118; letter-spacing: .1em; text-transform: uppercase; padding-left: 4px; }
.carve input { width: 100%; min-height: 50px; padding: 10px 14px; border: 0; border-radius: 12px; outline: 0; font: 700 20px var(--display); color: #2A1E0C;
  background: linear-gradient(180deg, #CDBB98, #DDCDAE); box-shadow: inset 0 3px 5px #8A764E99, inset 0 -1px 0 #fff8, 0 1px 0 #fff; }
.carve input::placeholder { color: #8E7B58; font-style: italic; font-weight: 500; }
.carve input:focus { box-shadow: inset 0 3px 5px #8A764E99, 0 0 0 2px var(--gold), 0 0 14px #E8B54A88; }
.tablet .err { color: var(--garnet); }
.tablet .btn.enamel { min-height: 44px; font-size: 15px; }

/* ---------- toast: a ribbon that drops from under the HUD ---------- */
#toast { position: fixed; z-index: 40; left: 50%; top: calc(var(--hud-h) + var(--safe-t) + 132px); /* below the stage title and ladder, never over them */ translate: -50% 0; width: max-content; max-width: calc(100vw - 28px);
  padding: 11px 26px; text-align: center; font: 700 15px/1.3 var(--ui); color: var(--ink); background: var(--metal);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%); filter: drop-shadow(0 8px 14px #000c); animation: drop .45s var(--spring); }
#toast.out { animation: lift .25s ease-in forwards; }
@keyframes drop { from { transform: translateY(-80px) scaleY(.6); opacity: 0; } }
@keyframes lift { to { transform: translateY(-80px); opacity: 0; } }

/* ---------- intro ---------- */
#intro { position: fixed; inset: 0; z-index: 50; background: #000; overflow: hidden; }
#intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#intro::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--grain), linear-gradient(180deg, #000a 0, transparent 22%, transparent 45%, #000e 88%); transition: opacity .6s; }
#intro.playing::after, #intro.playing #intro-tap { opacity: 0; animation: none; }
#intro-copy { position: absolute; z-index: 2; inset: auto 0 calc(48px + var(--safe-b)); padding: 0 26px; text-align: center; display: grid; gap: 22px; justify-items: center; }
#intro-go, #intro-play { width: min(100%, 320px); }
#intro-tap { font: 600 13px var(--ui); color: #fff8; animation: blink 2s infinite; } @keyframes blink { 50% { opacity: .35; } }
#intro-go:not([hidden]) ~ #intro-tap { display: none; }
#intro-skip { position: absolute; z-index: 3; right: 10px; top: calc(2px + var(--safe-t)); }

/* ---------- pilgrimage ---------- */
#run { position: fixed; inset: 0; z-index: 20; background: var(--lacquer) url(/art/g-street.webp) center/cover; display: flex; flex-direction: column; padding: var(--safe-t) 0 var(--safe-b); }
#run { transition: background-image .4s; }
#run::before { content: ''; position: absolute; inset: 0; background: var(--grain), radial-gradient(100% 60% at 50% 45%, #0B133099, #060A1De6 80%); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#run > * { position: relative; }
.runbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 12px; }
#run-step { font: 800 14px var(--ui); color: var(--ivory); padding: 6px 14px; border-radius: 999px; background: #0008; box-shadow: inset 0 0 0 1px #ffffff22; }
#run-candles { display: flex; gap: 2px; }
#run-candles .ic { width: 26px; height: 30px; color: #FF9D3C; filter: drop-shadow(0 0 6px #FF7A1A); animation: flick 1s infinite alternate; transform-origin: 50% 90%; }
#run-candles .ic.lost { color: #4A5272; filter: none; animation: none; }
#run-gold { justify-self: end; height: 34px; font-size: 16px; }
#run-card { margin: auto; padding: 18px 16px; width: min(100%, 460px); text-align: center; display: grid; gap: 10px; justify-items: center; }
#run-card.in > :not(#run-rays) { animation: cardin .45s var(--spring) backwards; }
#run-card.in > :nth-child(3) { animation-delay: .04s; } #run-card.in > :nth-child(4) { animation-delay: .1s; } #run-card.in > :nth-child(5) { animation-delay: .16s; } #run-card.in > :nth-child(6) { animation-delay: .22s; }
@keyframes cardin { from { opacity: 0; transform: translateY(24px) scale(.94); } }
#run-rays { position: absolute; left: 50%; top: 32%; width: 620px; height: 620px; translate: -50% -50%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(from 0deg, #FFE2A022 0 6deg, transparent 6deg 18deg); -webkit-mask: radial-gradient(closest-side, #000 20%, transparent); mask: radial-gradient(closest-side, #000 20%, transparent); }
#run-card.glory #run-rays { opacity: 1; animation: spin 24s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
#run-grade { width: 132px; height: 132px; display: grid; place-items: center; border-radius: 50%; font: 900 84px/1 var(--display); color: var(--ink);
  background: radial-gradient(circle at 35% 30%, #FFF6D8 0 10%, transparent 35%), radial-gradient(circle, #F2C562 0 58%, #B88328 59% 63%, #FFE2A0 64% 70%, #8C6118 71%);
  box-shadow: 0 8px 0 #5E3F0C, 0 16px 30px #000c, 0 0 50px #FFC94A88; text-shadow: 0 2px 0 #FFF1B8; }
#run-card.in #run-grade { animation: stamp .55s var(--spring) .05s backwards; }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 60% { transform: scale(.92) rotate(3deg); opacity: 1; } 100% { transform: none; } }
#run-grade.gC, #run-grade.gB { filter: saturate(.5) brightness(.9); }
#run-grade:empty { display: none; }
#run-title { font-size: 32px; font-weight: 800; }
#run-title .num { font-family: var(--ui); }
#run-text { font: italic 600 20px/1.3 var(--display); color: #E6DCC6; max-width: 26ch; }
#run-choices { display: grid; gap: 12px; width: 100%; margin-top: 10px; }
#run-choices .btn { width: 100%; }
#run-choices.cards { grid-template-columns: repeat(3, 1fr); gap: 10px; perspective: 800px; }
/* blessing cards: dealt like Hades boons */
.bless { display: grid; grid-template-rows: auto auto 1fr; gap: 8px; justify-items: center; align-content: start; padding: 16px 8px 14px; border-radius: 16px; min-height: 196px;
  background: var(--grain), radial-gradient(120% 80% at 50% 0%, #3A4FA0, #1C2C66 45%, #0E1640); color: var(--ivory); box-shadow: inset 0 1px 0 #fff3, 0 6px 0 #070D26, 0 16px 26px #000b;
  animation: deal .55s var(--spring) backwards; transition: transform .18s var(--spring), opacity .25s; }
.bless:nth-child(1) { animation-delay: .05s; --r: -5deg; } .bless:nth-child(2) { animation-delay: .15s; --r: 0deg; } .bless:nth-child(3) { animation-delay: .25s; --r: 5deg; }
@keyframes deal { from { opacity: 0; transform: translateY(160px) rotate(var(--r)) scale(.7); } }
.bless .med { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--metal); color: var(--gold-edge); box-shadow: 0 3px 0 #5E3F0C, 0 0 20px #FFC94A66; }
.bless .med .ic { width: 34px; height: 34px; }
.bless b { font: 700 17px/1.1 var(--display); }
.bless span { font: 600 13.5px/1.2 var(--ui); color: #C9CFE8; }
.bless:active { transform: translateY(-8px) scale(1.04); }
#run-choices.picked .bless { opacity: 0; transform: translateY(60px) scale(.9); }
#run-choices.picked .bless.chosen { opacity: 1; transform: translateY(-16px) scale(1.08); box-shadow: inset 0 1px 0 #fff3, 0 0 0 2px var(--gold-hi), 0 0 40px #FFC94Aaa, 0 16px 26px #000b; }
#run-canvas { flex: 1; width: 100%; min-height: 0; touch-action: none; display: block; }
#run-img { width: 170px; height: 170px; object-fit: contain; margin: 0 auto 4px; filter: drop-shadow(0 0 30px #FFC94A99); }
#run-card.in #run-img { animation: relic 1s var(--spring) backwards; } @keyframes relic { from { transform: translateY(60px) scale(.3) rotate(-30deg); opacity: 0; } }

/* ---------- upgrade ceremony ---------- */
#ceremony { position: fixed; inset: 0; z-index: 35; background: var(--grain), radial-gradient(80% 60% at 50% 42%, #2A3D86, #060A1D 75%); display: grid; place-items: center; overflow: hidden; }
#cer-rays { position: absolute; left: 50%; top: 40%; width: 160vmax; height: 160vmax; translate: -50% -50%; opacity: 0;
  background: repeating-conic-gradient(from 0deg, #FFE2A030 0 5deg, transparent 5deg 15deg); -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 70%); mask: radial-gradient(closest-side, #000 10%, transparent 70%);
  animation: rays-in 1s 1.7s forwards, spin 40s 1.7s linear infinite; }
@keyframes rays-in { to { opacity: 1; } }
#cer-stage { position: absolute; left: 50%; top: 40%; width: min(110vw, 560px); aspect-ratio: 1; translate: -50% -50%; }
#cer-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#cer-old { animation: cer-old 2.2s forwards; } @keyframes cer-old { 0%, 55% { opacity: 1; filter: brightness(1); transform: scale(1); } 62% { transform: translateX(-4px) scale(1.01); } 68% { transform: translateX(4px) scale(1.02); } 74% { transform: translateX(-3px) scale(1.03); } 88% { opacity: 1; filter: brightness(2.6); transform: scale(1.06); } 100% { opacity: 0; filter: brightness(4); transform: scale(1.1); } }
/* the flash that hides the swap between the old and the new shrine */
#cer-stage::after { content: ''; position: absolute; inset: 10%; border-radius: 50%; background: radial-gradient(closest-side, #FFF8E0, #FFD36E99 45%, transparent); opacity: 0; animation: cer-flash 1.1s 1.35s ease-out forwards; pointer-events: none; }
@keyframes cer-flash { 30% { opacity: 1; transform: scale(1.15); } 100% { opacity: 0; transform: scale(1.5); } }
#cer-new { opacity: 0; animation: cer-new 1.6s 1.7s var(--spring) forwards; } @keyframes cer-new { 0% { opacity: 0; filter: brightness(5); transform: scale(.7) translateY(60px); } 100% { opacity: 1; filter: brightness(1); transform: none; } }
#ceremony::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, #060A1Df2 85%); pointer-events: none; }
#cer-copy { position: absolute; z-index: 2; inset: auto 0 calc(30px + var(--safe-b)); padding: 0 24px; text-align: center; display: grid; gap: 10px; justify-items: center; }
#cer-copy > * { opacity: 0; animation: cer-in .6s var(--spring) forwards; }
@keyframes cer-in { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
#cer-copy p { font: italic 600 19px var(--display); color: var(--gold-hi); animation-delay: 2.9s; }
#cer-copy h1 { font-size: 40px; font-weight: 900; animation-delay: 3.1s; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #2A1A04); }
#cer-copy .btn { width: 100%; max-width: 360px; animation-delay: 3.5s; } #cer-copy .btn.enamel { animation-delay: 3.6s; min-height: 46px; }
.cardpic { width: min(100%, 300px); border-radius: 12px; box-shadow: 0 12px 30px #000c; }

/* ---------- flying coins (resource flow to the purse) ---------- */
.fly-coin { position: fixed; z-index: 60; width: 22px; height: 22px; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .fly-coin { display: none; }
}

/* desktop: the game stays a phone-width column */
@media (min-width: 560px) {
  body { background: #02040A; }
  #hud, #tabs, #world, #intro, #run, #ceremony, #shrine, #toast-wrap { left: calc(50% - 260px); right: calc(50% - 260px); }
  main { min-height: 100dvh; background: var(--grain), radial-gradient(120% 70% at 50% 0%, #22357A 0%, #0B1330 55%, #060A1D 100%); }
}

/* picking: the temple takes the stage, everything else steps back */
#shrine-top, #shrine-ui, #adorn { transition: opacity .25s, transform .3s var(--out); }
#shrine.picking #shrine-ui, #shrine.picking #adorn { opacity: 0; transform: translateY(30px); pointer-events: none; }
#shrine.picking #shrine-top { opacity: 0; pointer-events: none; }
#tabs { transition: transform .3s var(--out); }
body.picking #tabs { transform: translateY(110%); }
.deco .thumb { display: block; min-height: 0; padding: 6px 4px 0; }
.deco .thumb canvas { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 4px #0009); }
/* the v2 offering photos sit on their own dark studio sweep: fade their edges into the card */
.sku-art img { width: 100%; object-fit: cover; border-radius: 18px 18px 0 0; -webkit-mask: radial-gradient(75% 70% at 50% 52%, #000 55%, transparent 100%); mask: radial-gradient(75% 70% at 50% 52%, #000 55%, transparent 100%); filter: none; }
.sku-art { margin-top: 0; aspect-ratio: 1; place-items: center; }
.sku-art::before, .sku-art::after { display: none; }
.sku-art:has(.ic)::before { display: block; }
/* HUD needs its own ground over scrolling content */
body[data-tab=offerings] #hud { padding-bottom: 18px; background: linear-gradient(180deg, #060A1D 0%, #060A1Dd9 65%, transparent); }
body.picking #tabs { transform: translateY(calc(100% + 90px)); }
.picker-panel .x { top: -54px; right: 14px; width: 44px; height: 44px; }
#art-img { -webkit-mask: linear-gradient(transparent, #000 14%, #000 84%, transparent); mask: linear-gradient(transparent, #000 14%, #000 84%, transparent); }

/* short screens (iPhone SE / mini in Safari, ~550 px of page): keep Adorn clear of Christy's line, tighten the stack */
@media (max-height: 620px) {
  #stage { font-size: 25px; }
  #adorn { top: 33%; width: 58px; height: 58px; }
  #raise-note { display: none; }
  #shrine-ui { gap: 8px; bottom: calc(var(--tabs-h) + var(--safe-b) + 40px); }
  #voice { font-size: 15px; }
  .raise { min-height: 48px; }
}

/* phones on their side: the game is portrait-only (Safari can't lock it), ask to turn back */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body::after { content: 'Turn your phone upright'; position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
    background: #0B1330; color: #FFE2A0; font: 600 22px/1.3 'Bodoni Moda', Georgia, serif; }
}

.engraved { font: italic 600 16px/1.3 var(--display); color: var(--gold-hi); letter-spacing: .02em; }
#intro-login { font: 600 13px var(--ui); color: #fffb; background: none; border: 0; text-decoration: underline; padding: 10px; }
#intro.playing #intro-login { opacity: 0; pointer-events: none; }
.carve input.code { text-align: center; letter-spacing: .4em; font-size: 28px; }
.fine a { color: inherit; }
/* Hall of Devotion: names carved into a marble slab */
.hall-h { font: 800 12px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); margin: 10px 0 0; }
.stone { list-style: none; margin: 0; padding: 14px 12px; width: 100%; display: grid; gap: 10px; border-radius: 14px; text-align: center;
  background: linear-gradient(160deg, #F2EADB, #D9CDB5 55%, #EDE3CF); box-shadow: inset 0 2px 6px #0004, inset 0 0 0 1.5px #8C611866, 0 3px 0 #03061A; }
.stone b { display: block; font: 700 20px/1.15 var(--display); color: #3A2A10; letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 1px 0 #fff9, 0 -1px 0 #0003; }
.stone small { color: #6E5A36; font-size: 12px; }
.stone li.mine b { color: #8C6118; }
