/* v2 role picker: sits exactly over the globe card; the zoomed, blurred globe is its background. */
.wheel-screen, .mesh {
  position: fixed; top: 5.5vh; bottom: 5.2vh; left: 4.4vw; right: 2.1vw; z-index: 20;
  pointer-events: none;
}
.mesh { z-index: 19; width: calc(100vw - 6.5vw); height: calc(100vh - 10.7vh); opacity: 1; }
@media (max-width: 740px) {
  .wheel-screen, .mesh { top: 10px; bottom: 10px; left: 10px; right: 10px; }
  .mesh { width: calc(100vw - 20px); height: calc(100vh - 20px); }
}
.wheel-screen { opacity: 0; transition: opacity 500ms ease; color: #2e2418; font-family: Inter, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
body.is-wheel .wheel-screen, body.is-meshing .wheel-screen { opacity: 1; pointer-events: auto; }
/* the picker background is the same globe, zoomed and blurred, rising behind the live globe-ball */
.ball-bg { position: absolute; inset: 0; z-index: 0; opacity: 0; pointer-events: none; overflow: hidden; background: #cbbd9f; border-radius: inherit;
  --mx: 50%; --my: 50%; --mr: 200vmax;
  -webkit-mask-image: radial-gradient(circle at var(--mx) var(--my), #000 calc(var(--mr) - 40px), transparent calc(var(--mr) + 60px));
  mask-image: radial-gradient(circle at var(--mx) var(--my), #000 calc(var(--mr) - 40px), transparent calc(var(--mr) + 60px)); }
#stage { z-index: 1; }
.compass { z-index: 2; }
.ball-bg img { position: absolute; left: var(--bx, 50%); top: var(--by, 50%); width: 150%; max-width: none; height: auto; z-index: 0;
  transform: translate(-58%, -46%) scale(var(--bz, 1.4)); filter: blur(34px) saturate(.9) sepia(.15); }
.ball-bg::after { content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(110% 95% at var(--bx, 50%) var(--by, 50%), rgba(239,233,220,.18) 0%, rgba(239,233,220,.5) 45%, rgba(239,233,220,.72) 100%); }
.ball-glow { position: absolute; z-index: 2; left: var(--bx, 50%); top: var(--by, 50%); width: min(62vh, 600px); aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); filter: blur(28px); opacity: .42; transition: background 450ms ease; }

/* copy fades in after the ball has formed */
.wheel-copy { opacity: 0; transform: translateY(8px); transition: opacity 600ms ease 150ms, transform 600ms ease 150ms; }
body.is-wheel .wheel-copy { opacity: 1; transform: none; }

.wheel-stage { position: relative; height: 100%; display: flex; align-items: center; padding: 0 6% 0 9%; gap: 7%; }
.orb-wrap { position: relative; flex: 0 0 auto; width: clamp(170px, 31vh, 330px); height: clamp(170px, 31vh, 330px); }

.wheel-copy { flex: 1 1 auto; min-width: 0; max-width: 640px; }
.wheel-place {
  margin: 0; font-family: "IM Fell English", Georgia, serif; font-weight: 400;
  font-size: clamp(34px, 4.7vw, 72px); line-height: 1.02; letter-spacing: -.01em; color: #2e2418;
  text-wrap: balance;
}
.wheel-time {
  margin: .35em 0 1.1em; font-family: Inter, Arial, sans-serif; font-weight: 600; font-variant-numeric: tabular-nums lining-nums;
  font-size: clamp(20px, 2.3vw, 34px); letter-spacing: .14em; color: #7a5130;
}
.wheel-kicker { margin: 0 0 .2em; font-family: "IM Fell English", serif; font-style: italic; font-size: 15px; color: #6c5d47; }
.wheel-window {
  position: relative; overflow: hidden; width: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 70%, transparent 100%);
}
.wheel-list { list-style: none; margin: 0; padding: 0; will-change: transform; }
.wheel-item {
  display: flex; align-items: center; white-space: nowrap; transform-origin: left center;
  font-weight: 500; font-size: clamp(20px, 3.1vh, 30px); line-height: 1; letter-spacing: -.012em; color: #2e2418;
}
.wheel-item span { display: inline-block; padding: .12em .3em .12em 0; }

.wheel-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 1.4em; opacity: 0; transform: translateY(6px); transition: opacity 450ms ease, transform 450ms ease; }
.wheel-actions.show { opacity: 1; transform: none; }

/* restyled action button: engraved cartouche, IM Fell DW Pica italic */
.seal-btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: .7em;
  font-family: "IM Fell DW Pica", "IM Fell English", Georgia, serif; font-style: italic; font-size: 19px; letter-spacing: .01em;
  color: #2e2418; background: rgba(243, 238, 227, .75);
  border: 0; padding: .62em 1.3em .6em 1.4em; border-radius: 2px;
  box-shadow: inset 0 0 0 1px #7a5130, inset 0 0 0 3px rgba(243,238,227,.9), inset 0 0 0 4px rgba(122,81,48,.55), 0 2px 10px rgba(46,36,24,.12);
  transition: background 200ms ease, color 200ms ease, transform 150ms ease;
}
.seal-btn svg { width: 22px; height: 12px; transition: transform 200ms ease; }
.seal-btn:hover { background: #2e2418; color: #efe9dc; }
.seal-btn:hover svg { transform: translateX(3px); }
.seal-btn:active { transform: translateY(1px); }
.seal-btn.small { font-size: 16px; padding: .5em 1.05em .48em; }

@media (max-width: 740px) {
  .wheel-stage { flex-direction: column; align-items: flex-start; justify-content: center; padding: 8% 8% 10%; gap: 0; }
  .orb-wrap { width: 40vw; height: 40vw; margin: 0 0 5vh; align-self: center; }
  .wheel-copy { width: 100%; }
  .wheel-place { font-size: clamp(32px, 10vw, 46px); }
  .wheel-time { font-size: 21px; margin-bottom: .9em; }
  .wheel-item { font-size: 6.6vw; }
}

/* ================= v10 picker typography =================
   One serif family pair, one scale (18 / 34 / 72 on a 1440 screen), one left edge for every line, and the
   orb + copy centred as a pair so the stage is balanced. */
.wheel-stage { justify-content: center; padding: 0 5vw; gap: clamp(40px, 6vw, 110px); }
.wheel-copy { flex: 0 1 600px; max-width: 600px; }
.wheel-copy .wheel-place { font-size: clamp(42px, 5vw, 76px); line-height: 1.04; letter-spacing: -.015em; white-space: nowrap; text-wrap: nowrap; }
.wheel-copy .wheel-place > span { display: inline-block; }
.wheel-copy .wheel-place.wrap { white-space: normal; text-wrap: balance; }
.wheel-copy .wheel-time { margin: 18px 0 0; font-family: "EB Garamond", Georgia, serif; font-style: italic; font-weight: 400;
  font-size: clamp(16px, 1.25vw, 19px); letter-spacing: .01em; color: #7a5130; font-variant-numeric: oldstyle-nums proportional-nums; }
.wheel-copy .wheel-time abbr.sc { font-style: normal; font-variant-caps: all-small-caps; letter-spacing: .1em; text-decoration: none; }
.wheel-copy .wheel-kicker { margin: 30px 0 4px; font-family: "EB Garamond", Georgia, serif; font-style: italic; font-size: clamp(16px, 1.25vw, 19px); letter-spacing: .01em; color: #6c5d47; }
.wheel-item { font-family: "IM Fell English", Georgia, serif; font-weight: 400; font-size: clamp(26px, 3.8vh, 36px); letter-spacing: -.005em; }
.wheel-item span { padding: .1em .3em .14em 0; }
.wheel-actions { margin-top: 30px; gap: 12px; }

/* ================= v10 globe-material buttons =================
   Cut from the globe itself: the same painted texture file, the same dark limb shading at the edges, the same
   soft top-left light and the drop shadow the orb casts; cream type with a dark halo so it reads over sea or land. */
#wheel-go.parch, #wheel-respin.parch, #again-btn.parch {
  --pl: 0px; clip-path: none; border-radius: 999px; color: #fbf4e2; font-family: "IM Fell English", Georgia, serif; font-style: italic;
  font-size: clamp(17px, 1.3vw, 20px); letter-spacing: .015em; padding: .7em 1.5em .68em;
  text-shadow: 0 1px 1px rgba(22,16,9,.85), 0 0 10px rgba(22,16,9,.55);
  background-color: #6f8aa0;
  background-image:
    radial-gradient(120% 140% at 30% 18%, rgba(255,248,230,.38) 0, rgba(255,248,230,0) 46%),
    radial-gradient(140% 180% at 70% 120%, rgba(28,20,12,.55) 0, rgba(28,20,12,0) 60%),
    linear-gradient(rgba(40,52,64,.18), rgba(40,52,64,.18)),
    url("../textures/painted-globe-2k.webp?v=47");
  background-size: 100% 100%, 100% 100%, 100% 100%, 1500px 750px; background-position: 0 0, 0 0, 0 0, -60px -450px;
  background-blend-mode: normal, multiply, multiply, normal;
  box-shadow: inset 0 0 0 1px rgba(30,22,14,.55), inset 0 0 14px 2px rgba(30,22,14,.5), inset 0 1px 0 rgba(255,248,230,.35),
    0 1px 1px rgba(40,28,14,.35), 0 10px 22px -8px rgba(40,28,14,.5);
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease, background-position 900ms cubic-bezier(.2,.7,.2,1); }
/* v37: the painted texture behind these buttons (a CSS image, so its own download) waits until the first screen is live (body.ll-warm, js/game.js) */
body:not(.ll-warm) #wheel-go.parch, body:not(.ll-warm) #wheel-respin.parch { background-image: none; }
#wheel-respin.parch { background-position: 0 0, 0 0, 0 0, -620px -300px; font-size: clamp(16px, 1.2vw, 18px); padding: .7em 1.3em .68em; }
#wheel-go.parch::after, #wheel-respin.parch::after, #again-btn.parch::after { display: none; }
#wheel-go.parch:hover { background-position: 0 0, 0 0, 0 0, -110px -450px; }
#wheel-respin.parch:hover { background-position: 0 0, 0 0, 0 0, -670px -300px; }
/* v13: the story page's Spin again is cut from the same globe as the picker's buttons */
#again-btn.parch { background-position: 0 0, 0 0, 0 0, -620px -300px; font-size: clamp(15px, 1.15vw, 18px); padding: .6em 1.25em .58em; }
#again-btn.parch:hover { background-position: 0 0, 0 0, 0 0, -670px -300px; }
@media (max-width: 740px) { #again-btn.parch { font-size: 14px; padding: .5em 1em .48em; } }
#wheel-go.parch:hover, #wheel-respin.parch:hover, #again-btn.parch:hover { transform: translateY(-1px); filter: saturate(1.1) brightness(1.04);
  box-shadow: inset 0 0 0 1px rgba(30,22,14,.6), inset 0 0 14px 2px rgba(30,22,14,.5), inset 0 1px 0 rgba(255,248,230,.4), 0 0 0 3px rgba(255,248,232,.5), 0 14px 26px -8px rgba(40,28,14,.55); }
#wheel-go.parch:active, #wheel-respin.parch:active, #again-btn.parch:active { transform: translateY(1px); }
#wheel-go.parch:focus-visible, #wheel-respin.parch:focus-visible, #again-btn.parch:focus-visible { outline: 2px solid #fbf4e2; outline-offset: 3px; }

@media (max-width: 740px) {
  .wheel-stage { padding: 9vh 8% 6vh; gap: 0; justify-content: flex-start; } /* top-anchored: the ball is placed from the orb slot before the copy fills in */
  .wheel-copy { flex: 0 0 auto; width: 100%; max-width: none; }
  .wheel-copy .wheel-place { font-size: clamp(32px, 10vw, 44px); }
  .wheel-copy .wheel-time { margin-top: 12px; font-size: 16px; }
  .wheel-copy .wheel-kicker { margin-top: 22px; font-size: 16px; }
  .wheel-item { font-size: clamp(24px, 7vw, 30px); }
  .wheel-actions { margin-top: 22px; }
  #wheel-go.parch { font-size: 17px; } #wheel-respin.parch { font-size: 16px; }
}
/* v10: the picker scales with the window HEIGHT too, so a 3440x1440 screen gets the same proportions as 1440x900 */
@media (min-width: 741px) {
  .orb-wrap { width: clamp(170px, 31vh, 520px); height: clamp(170px, 31vh, 520px); }
  .wheel-copy { flex-basis: min(46vw, 66vh); max-width: min(46vw, 66vh); }
  .wheel-copy .wheel-place { font-size: clamp(42px, min(5vw, 8vh), 120px); }
  .wheel-copy .wheel-time, .wheel-copy .wheel-kicker { font-size: clamp(16px, min(1.25vw, 2vh), 30px); }
  .wheel-copy .wheel-time { margin-top: 2vh; }
  .wheel-copy .wheel-kicker { margin-top: 3.3vh; }
  .wheel-item { font-size: clamp(26px, 3.8vh, 56px); }
  .wheel-actions { margin-top: 3.3vh; gap: 1.3vh; }
  #wheel-go.parch { font-size: clamp(17px, 2.1vh, 30px); }
  #wheel-respin.parch { font-size: clamp(16px, 1.95vh, 28px); }
}

/* ================= v11/v12: aura tiers around the settled role =================
   gold = a real named person, silver = elite / ruler, light blue = middle and skilled roles; commoners stay plain.
   One recipe for all three: a slow metallic sheen across the letters and a soft halo that breathes behind them. */
.wheel-item.aura-gold   { --a0: #4a300c; --a1: #7d5a1a; --a2: #b98c34; --a3: #d9b45e; --ah: 244,206,120; --as: 222,178,84; }
/* v31 t144u: the "silver" tier (elites, rulers) is now oxblood garnet: the colour of museum velvet and wax seals,
   warm like the rest of the palette and far from both the blue and the gold. The class name stays "silver". */
.wheel-item.aura-silver { --a0: #3b0d12; --a1: #6b1b23; --a2: #93303a; --a3: #c4646a; --ah: 212,124,120; --as: 168,58,66; }
.wheel-item.aura-blue   { --a0: #10304d; --a1: #1e4f7a; --a2: #33699a; --a3: #5a91c0; --ah: 160,204,240; --as: 112,168,218; }
.wheel-item.aura span { position: relative; isolation: isolate;
  background: linear-gradient(100deg, var(--a0) 0%, var(--a1) 26%, var(--a2) 44%, var(--a3) 50%, var(--a2) 56%, var(--a1) 74%, var(--a0) 100%);
  background-size: 260% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 .5px rgba(30,24,16,.45)) drop-shadow(0 0 12px rgba(var(--as),.5));
  animation: gild 3.6s cubic-bezier(.45,0,.25,1) 200ms infinite; }
.wheel-item.aura span::before { content: ""; position: absolute; z-index: -1; inset: -.42em -.7em; border-radius: 999px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--ah),.5), rgba(var(--ah),.2) 55%, rgba(var(--ah),0) 100%);
  filter: blur(9px); opacity: 0; animation: halo 3.6s ease-in-out infinite, halo-in 700ms ease forwards; }
@keyframes gild { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0% 0; } }
@keyframes halo { 0%, 100% { transform: scale(.94); } 50% { transform: scale(1.06); } }
@keyframes halo-in { to { opacity: 1; } }
.wheel-list.settled .wheel-item.aura:not(.win) span::before { animation: none; opacity: 0; }
.wheel-list:not(.settled) .wheel-item.aura span::before { animation: halo 3.6s ease-in-out infinite; opacity: .8; }
@media (prefers-reduced-motion: reduce) { .wheel-item.aura span, .wheel-item.aura span::before { animation: halo-in 1ms forwards; } }

/* v26 t128u: the "born" pill is gone (the timeline's big year above the globe is the one year on screen; the element
   stays, hidden, for the code that fills it). The ball moves down a row to clear that year. Over the light picker the
   timeline sits on a slim dark band so it reads (t135u). */
#wheel-time { display: none; }
.orb-wrap { margin-top: 9vh; }
/* v44 t164u: no plaque on the picker either; the timeline sits on the light ground with ink labels. */
body.is-wheel .spin-tl { top: 10px; left: 30%; right: 3%; padding: 4px 26px 0; border-radius: 0;
  background: none; box-shadow: none; }
body.is-wheel .spin-tl .tl { --tl-year-size: clamp(24px, 2.6vw, 36px); }
body.is-wheel .spin-tl .tl-year { margin: -4px 0 4px; }
@media (max-width: 740px) {
  .orb-wrap { margin-top: 64px; }
  body.is-wheel .spin-tl { left: 10px; right: 10px; top: 8px; padding: 2px 16px 0; }
}

/* v31 t144u: the aura used to stop in a hard vertical line at the left of the role. The halo (::before, inset -.7em,
   blur 9px) and the 12px drop-shadow spill left of the text, but .wheel-window clips its overflow (it has to, for the
   scrolling list) and its left edge was the text's left edge. The window now reaches out past the text on both sides
   (negative margin, matching padding), so the text stays exactly where it was and the glow has room to fade out. */
.wheel-window { --aura-room: 56px; margin-inline: calc(var(--aura-room) * -1); padding-inline: var(--aura-room); width: calc(100% + var(--aura-room) * 2); }
@media (max-width: 740px) { .wheel-window { --aura-room: 30px; } }
