/* Quest Tails look: every color, font and size lives here.
   To change the look, change the values in :root. Nothing else needs to move. */

:root {
  /* paper and ink */
  --kraft: #ecd9c9;          /* the craft-paper page */
  --paper: #f6f0ea;          /* notebook paper cards and popups */
  --charcoal: #5d4d4a;       /* the header */
  --ink: #2a2222;            /* text and the thick outlines */
  --quiet: #6b5b57;          /* secondary text */
  --line: #e2c8b6;           /* faint lines and borders */

  /* accents */
  --terracotta: #c4693a;     /* decoration: margin lines, tape details */
  --button: #a84f28;         /* button fill: white text on it is 5.5 to 1 */
  --button-dark: #7d3a1c;    /* the button's bottom edge */
  --button-ink: #ffffff;
  --link: #8a3f1e;           /* text on paper for secondary buttons */
  --brand-red: #d63a1f;
  --cream: #fce1c5;
  --gold: #efc834;
  --leaf: #86ba6e;
  --good: #1f6a3f;      /* a deeper green, so the success lines are easy to read on the tan page */
  --crit: #b3372f;

  /* sticker art placeholders */
  --box1: #e8c9a0; --box2: #bcd4c5; --box3: #c9c3e0; --box4: #e6b8b0;

  /* shape */
  --outline: 3px;
  --radius: 1rem;
  --shadow: 0 4px 0 rgba(42, 34, 34, .22);

  /* fonts: Fredoka for headings and buttons, Nunito for reading, Caveat for little handwritten notes */
  --font-head: 'Fredoka', 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

  /* paper grain, drawn here so no image file is needed */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .9 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* the guild town's sky strip, sun and moon (the brand palette) */
  --warm-noir: #2c1f1d;
  --pomegranate: #ed4118;
  --pearl-bush: #eae2d8;
  --dorado: #72615f;
  --sun-rays: #d4a84b;           /* the sun's disc uses --gold, the same gold as the coin */

  /* night mode: change these to retune it */
  --night-tint: #5b3a4f;          /* deep warm plum that dims everything */
  --night-strength: .42;          /* 0 is off, 1 is fully tinted */
  --night-fade: 1.2s;             /* how slowly it fades in and out */
  --night-sky-top: #43304a;       /* the page behind the cards at night */
  --night-sky-bottom: #54383f;
  --night-header: #382a2c;        /* a darker header, so it stays distinct from the page */
}

/* Colors that fade smoothly when night mode switches (browsers that cannot do this simply switch) */
@property --button { syntax: '<color>'; inherits: true; initial-value: #a84f28; }
@property --button-dark { syntax: '<color>'; inherits: true; initial-value: #7d3a1c; }
@property --quiet { syntax: '<color>'; inherits: true; initial-value: #6b5b57; }
@property --link { syntax: '<color>'; inherits: true; initial-value: #8a3f1e; }
@property --good { syntax: '<color>'; inherits: true; initial-value: #2e7d4f; }
@property --crit { syntax: '<color>'; inherits: true; initial-value: #b3372f; }
@property --dock { syntax: '<color>'; inherits: true; initial-value: #ecd9c9; }

/* ---- Settings people can change (see the Settings screen) ---- */
html[data-text="large"] { font-size: 112.5%; }
html[data-text="xlarge"] { font-size: 125%; }
html[data-plain="1"] { --font-head: var(--font-body); --font-hand: var(--font-body); }
html[data-reduce="1"] *, html[data-reduce="1"] *::before, html[data-reduce="1"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Page ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 400 1rem/1.55 var(--font-body); background-color: var(--kraft); background-image: url("art/textures/kraft.png"), var(--grain); min-height: 100vh; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 34rem; margin: 0 auto; padding: 0 1.1rem calc(7.5rem + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
.quiet { color: var(--quiet); }
.hand { font-family: var(--font-hand); font-size: 1.35rem; line-height: 1.25; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: .9rem; align-items: center; }
.center { display: flex; justify-content: center; margin-top: .8rem; }

/* ---- Header ---- */
.top { display: flex; align-items: center; gap: 1rem; background-color: var(--charcoal); background-image: url("art/textures/header.png"), var(--grain-dark); border-bottom: var(--outline) solid var(--ink); padding: calc(.8rem + env(safe-area-inset-top)) 1.1rem .8rem; }
.avatar { flex: none; width: 4.25rem; height: 4.25rem; min-height: 0; padding: 0; border-radius: 50%; border: var(--outline) solid var(--ink); background: var(--paper); display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); overflow: hidden; }
.avatar svg { width: 70%; height: 70%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.logo { flex: 1; text-align: center; min-width: 0; }
.logo img { max-width: 100%; max-height: 4.5rem; }
.logo-text { font-family: var(--font-head); font-weight: 700; font-size: min(2.1rem, 9.5vw); line-height: 1; color: var(--brand-red); -webkit-text-stroke: .35rem var(--cream); paint-order: stroke fill; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); }

/* ---- Art: pictures that replace the placeholder boxes once the files exist ---- */
.art, .medal { position: relative; }
.art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.art.has-img, .medal.has-img { color: transparent; }
.art.has-img.sticker, .medal.has-img.sticker { background: none !important; border-color: transparent; box-shadow: none; }
.art.has-img.sticker .art-img, .medal.has-img.sticker .art-img { filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .25)); }
.art.has-img.frame .art-img { object-fit: cover; border-radius: inherit; }
#tokenRow .art.has-img > svg, #popArt.has-img > svg, #arcTokenArt.has-img > svg { visibility: hidden; }      /* the drawn token steps aside once the token art loads */
.coinbox { position: relative; display: inline-grid; width: 2.1rem; height: 2.1rem; flex: none; }
.coin-img, .pin-img { width: 100%; height: 100%; object-fit: contain; }
.pin-img { width: 2.8rem; height: 2.8rem; }
.banner { display: block; width: 100%; border: var(--outline) solid var(--ink); border-radius: var(--radius); margin: 0 0 .9rem; box-shadow: var(--shadow); }

/* ---- Gold and tokens ---- */
.wallet { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .7rem; }
.pill { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.9rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 999px; padding: .1rem .95rem .1rem .3rem; font: 600 1.2rem var(--font-head); box-shadow: var(--shadow); }
.pill b { font-variant-numeric: tabular-nums; font-weight: 600; }
.coin { width: 2.1rem; height: 2.1rem; flex: none; }

/* ---- Cards: notebook paper ---- */
.card { position: relative; background: var(--paper) url("art/textures/paper.png"); border: var(--outline) solid var(--ink); border-radius: var(--radius); padding: 1.1rem 1rem 1rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.notebook { margin-top: 1.9rem; padding-left: 1.7rem; padding-top: 1.4rem; }
.notebook::before { content: ''; position: absolute; left: .9rem; top: 0; bottom: 0; width: 2px; background: var(--terracotta); opacity: .55; pointer-events: none; }
.top-row { display: flex; gap: .9rem; align-items: flex-start; }
.portrait { position: relative; flex: none; width: 7.6rem; height: 7.6rem; margin-left: -2.4rem; margin-top: -.9rem; border: var(--outline) solid var(--ink); border-radius: 1.2rem; background: #ece6df; overflow: hidden; display: grid; place-items: center; transform: rotate(-2.5deg); box-shadow: var(--shadow); z-index: 3; font: 700 2.8rem var(--font-head); color: rgba(42, 34, 34, .5); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
/* An adventurer stands in their box: the flat bottom sits on the box's floor and follows its rounded corners, while ears, gills and fur are free to rise above the box and past its sides. */
.portrait { overflow: visible; }
.portrait .pop, .art.has-img.popout .pop { position: absolute; inset: 0; pointer-events: none; clip-path: inset(-100% -60% 0 -60% round 0 0 calc(1.2rem - var(--outline)) calc(1.2rem - var(--outline))); }
.art.has-img.popout .pop { clip-path: inset(-100% -60% 0 -60% round 0 0 calc(1rem - var(--outline)) calc(1rem - var(--outline))); }
.portrait .pop img, .art.has-img.popout .pop img.art-img { position: absolute; inset: auto; left: 50%; bottom: 0; width: 128%; height: auto; max-width: none; transform: translateX(-50%); object-fit: contain; border-radius: 0; }
.info { flex: 1; min-width: 0; }
.info h2 { margin-bottom: .2rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .45rem; }
.tag { font: 600 .9rem var(--font-body); background: var(--cream); border: 2px solid var(--ink); border-radius: .5rem; padding: 0 .55rem; transform: rotate(-1.5deg); }
.tag + .tag { transform: rotate(1.5deg); }
.tag + .tag + .tag { transform: rotate(-1deg); }   /* the tier title, placed a little differently from the other two */
.tag + .tag + .tag + .tag { transform: rotate(1.5deg); }   /* the hat tag, after the tier title, tilts the other way */
.stats .line { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 2px solid rgba(180, 101, 69, .55); padding: .12rem 0; }
.stats b { font-variant-numeric: tabular-nums; }
.art { flex: none; width: 5.2rem; height: 5.2rem; border: var(--outline) solid var(--ink); border-radius: 1rem; display: grid; place-items: center; font: 700 1.8rem var(--font-head); color: rgba(42, 34, 34, .5); background: var(--box1); box-shadow: var(--shadow); }
.art.small { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; border-radius: .8rem; }

/* ---- Buttons ---- */
button { font: 600 1.05rem var(--font-head); cursor: pointer; border: 0; color: var(--button-ink); background: var(--button); border-radius: var(--radius); min-height: 3rem; padding: .5rem .9rem; box-shadow: 0 4px 0 var(--button-dark); transition: transform .08s, box-shadow .08s; }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--button-dark); }
button.secondary { background: var(--paper); color: var(--link); border: var(--outline) solid var(--ink); box-shadow: var(--shadow); }
button:disabled { cursor: not-allowed; background: #d9cfc6; color: #6f625c; box-shadow: none; border-color: #c9beb4; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--brand-red); outline-offset: 2px; }
.actions { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: .6rem; margin-top: 1rem; }
.actions button { padding: .5rem .2rem; font-size: 1.05rem; min-width: 0; }
/* with larger text the three buttons stack, so no word ever has to break */
html[data-text="large"] .actions, html[data-text="xlarge"] .actions { grid-template-columns: 1fr; }
.busy { margin-top: 1rem; padding-top: .8rem; border-top: 2px dashed var(--line); }
.busy button { width: 100%; }
.timebar { display: block; width: 100%; padding: 0; position: relative; height: 3.1rem; margin: .5rem 0 .7rem; border: var(--outline) solid var(--ink); border-radius: 999px; background: #e9e0d5; overflow: hidden; box-shadow: none; cursor: default; --pct: 0%; }
.timefill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct); min-width: 1.6rem; background: var(--brand-red); border-radius: 999px; transition: width .6s linear; box-shadow: 2px 0 0 rgba(42, 34, 34, .35); }
.timebar .t { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.2rem var(--font-head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timebar .base { color: var(--ink); }
.timebar:not(.ready):active { transform: none; box-shadow: none; }
.timebar.ready { cursor: pointer; border-radius: var(--radius); box-shadow: 0 4px 0 #8f2412; animation: nudge 1.8s ease-in-out infinite; }
.timebar.ready .timefill { border-radius: 0; box-shadow: none; }
.timebar.ready:active { animation: none; transform: translateY(3px); box-shadow: 0 1px 0 #8f2412; }
.timebar.ready .t { font-size: 1.3rem; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.timebar .over { color: #fff5ea; clip-path: inset(0 calc(100% - var(--pct)) 0 0); transition: clip-path .6s linear; }
.chev { width: 3.5rem; height: 3.5rem; min-height: 0; padding: 0; border-radius: 50%; background: var(--cream); color: var(--ink); border: var(--outline) solid var(--ink); font-size: 1.4rem; line-height: 1; box-shadow: var(--shadow); }
#message { min-height: 1.8rem; margin: 0 .2rem .8rem; font-weight: 600; }
#message.error { color: var(--crit); }
#message.ok { color: var(--good); }
.full { width: 100%; font-size: 1.15rem; margin-top: .5rem; }

/* ---- Sheet ---- */
.sheetbar { display: flex; align-items: center; gap: .9rem; margin: 1.1rem 0 .8rem; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.slot { position: relative; min-height: 6.6rem; border: 2px dashed #c9ad98; border-radius: 1rem; display: grid; place-items: center; color: var(--quiet); background: rgba(246, 240, 234, .65); text-align: center; padding: .5rem; }
.slot.filled { border: var(--outline) solid var(--ink); background: var(--paper); cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .25rem; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.slot.filled .art { width: 3.2rem; height: 3.2rem; font-size: 1.15rem; margin-top: .8rem; box-shadow: none; border-width: 2px; }
.slot .count { position: absolute; top: .35rem; right: .35rem; background: var(--button); color: #fff; border-radius: 999px; font: 600 .9rem var(--font-body); padding: 0 .55rem; line-height: 1.5rem; font-variant-numeric: tabular-nums; }
.slot .label { font: 600 .95rem/1.2 var(--font-body); }
.bar { height: .8rem; border-radius: 999px; background: #e4d8cd; border: 2px solid var(--ink); overflow: hidden; margin: .5rem 0; }
.fill { height: 100%; width: 0; background: var(--button); transition: width .4s linear; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.badge { background: transparent; color: var(--ink); border: 0; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .3rem .1rem; font: 600 .95rem var(--font-body); min-height: 2.75rem; }
.medal { width: 4.6rem; height: 4.6rem; border-radius: 50%; display: grid; place-items: center; font: 700 1.4rem var(--font-head); color: rgba(42, 34, 34, .65); border: var(--outline) solid var(--ink); box-shadow: 0 0 0 3px #fff, var(--shadow); }
.badge .stars { font-size: 1rem; letter-spacing: 2px; color: var(--button); }
.marks { list-style: none; margin: 0 0 1.1rem; padding: 0; }
.marks li { padding: .5rem 0; border-bottom: 2px dashed var(--line); }
.marks li.locked { opacity: .6; }
.marks b { display: block; font-weight: 700; }
.marks .sub { color: var(--quiet); }

/* ---- Sheet sections: a card with a banner label on its edge ---- */
.section { margin-top: 2.2rem; padding-top: 1.7rem; }
.section-title { position: absolute; top: -1.15rem; left: .9rem; margin: 0; padding: .25rem 1rem; background: var(--button); color: #fff; font: 600 1.2rem var(--font-head); border: var(--outline) solid var(--ink); border-radius: .7rem; box-shadow: var(--shadow); transform: rotate(-1deg); }
.stat-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin: .2rem 0 .3rem; padding-bottom: .25rem; border-bottom: var(--outline) solid var(--ink); }
.stat-head .quiet { font: 600 .95rem var(--font-body); }
.marks li.next { background: var(--cream); border: 2px solid var(--ink); border-radius: .8rem; padding: .5rem .7rem; margin: .5rem 0 .2rem; }
.marks li em { display: block; width: max-content; margin: 0 0 .3rem; font: 700 .85rem var(--font-body); font-style: normal; background: var(--button); color: #fff; border-radius: .4rem; padding: 0 .5rem; }
.morebtn { width: 100%; margin: .2rem 0 1.1rem; min-height: 2.9rem; }
.morebtn[aria-expanded="true"] { margin-bottom: .4rem; }
.marks { margin-bottom: .6rem; }

/* ---- General Hoot's Book Corner: a section heading, with the day's book under it ---- */
.shop-head { margin: 1.6rem 0 0; }
.shop-sub { margin: 0 0 .8rem; font-style: italic; color: var(--quiet); }

/* ---- Store and lists ---- */
.item { width: 100%; text-align: left; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: var(--radius); padding: .7rem; display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; font: 400 1rem var(--font-body); min-height: 4.2rem; box-shadow: var(--shadow); }
.item b { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; }
.item .cost { margin-left: auto; font: 600 1.05rem var(--font-head); white-space: nowrap; }
.speech { position: relative; background: #fff; border: 2px solid var(--ink); border-radius: .9rem; padding: .45rem .8rem; font-family: var(--font-hand); font-size: 1.3rem; line-height: 1.2; }

/* ---- Popups slide up from the bottom ---- */
.overlay { position: fixed; inset: 0; background: rgba(42, 34, 34, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.panel { position: relative; background: var(--paper); width: min(34rem, 100%); max-height: 88vh; overflow-y: auto; border: var(--outline) solid var(--ink); border-bottom: 0; border-radius: 1.5rem 1.5rem 0 0; padding: 2.3rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); }
.panel h2 { padding-right: 3.4rem; }
.close { position: absolute; top: .7rem; right: .7rem; width: 2.9rem; height: 2.9rem; min-height: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; font-size: 1.6rem; line-height: 1; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); box-shadow: none; z-index: 2; }
.option { width: 100%; text-align: left; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: .9rem; padding: .6rem .9rem; margin-bottom: .55rem; font: 400 1rem var(--font-body); min-height: 3.6rem; box-shadow: none; }
.option b { display: block; font: 600 1.1rem var(--font-head); }
.option.indent-1 { width: calc(100% - 1.2rem); margin-left: 1.2rem; }
.option.indent-2 { width: calc(100% - 2.4rem); margin-left: 2.4rem; }
.option.indent-3 { width: calc(100% - 3.6rem); margin-left: 3.6rem; }
.option { position: relative; }
.loc-marks { position: absolute; right: .8rem; top: .6rem; display: inline-flex; align-items: center; gap: .35rem; }      /* where the world goes on: a compass arrow and a down arrow */
.loc-compass { display: inline-flex; align-items: center; gap: .15rem; font: 700 .8rem var(--font-body); }
.loc-compass svg, .loc-deeper svg { width: 1.4rem; height: 1.4rem; display: block; }
.loc-deeper svg { width: 1.2rem; height: 1.2rem; }
.option i { color: var(--quiet); }
.option[aria-pressed="true"] { background: var(--cream); border-width: 3px; box-shadow: 0 3px 0 var(--button); }
.option:disabled { background: #efe7de; color: #6f625c; border-color: #cbbfb4; }
.option:disabled i { color: #6f625c; }
.sort { display: flex; gap: .5rem; margin: 0 0 .8rem; }
.sort button { flex: 1; min-height: 2.9rem; }
.sort button[aria-pressed="true"] { background: var(--button); color: #fff; border-color: var(--ink); }
.picker { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: .9rem 0 .5rem; }
.picker button { width: 3.4rem; height: 3.4rem; padding: 0; font-size: 1.7rem; }
.picker output { min-width: 4rem; text-align: center; font: 600 1.7rem var(--font-head); font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; font: 600 1.3rem var(--font-head); margin: .5rem 0 .9rem; }
.total.over b { color: var(--crit); }
.resultlines p { margin: .5rem 0; font-size: 1.15rem; }
.or { display: flex; align-items: center; gap: .8rem; margin: .1rem 0 .7rem; color: var(--quiet); font: 600 1.15rem var(--font-head); }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.field { margin: .7rem 0; }
.field label { display: block; margin-bottom: .25rem; font-weight: 600; }
.field select { width: 100%; min-height: 3rem; padding: .5rem; border-radius: .7rem; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: inherit; }

/* ---- Settings ---- */
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr)); gap: .5rem; margin: .3rem 0 1rem; }
.seg button { min-height: 3rem; min-width: 0; background: var(--paper); color: var(--link); border: var(--outline) solid var(--ink); box-shadow: var(--shadow); }
.seg button[aria-pressed="true"] { background: var(--button); color: #fff; }
.toggle { display: flex; align-items: center; gap: .8rem; min-height: 3.2rem; padding: .3rem 0; font-weight: 600; cursor: pointer; }
.toggle input { width: 1.7rem; height: 1.7rem; accent-color: var(--button); flex: none; }
.toggle small { display: block; font-weight: 400; color: var(--quiet); }

/* ---- World button ---- */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: .7rem 0 calc(.7rem + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--kraft) 65%, rgba(236, 217, 201, 0)); pointer-events: none; z-index: 5; }
.pin { pointer-events: auto; width: 4.4rem; height: 4.4rem; min-height: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--cream); border: 4px solid var(--ink); box-shadow: 0 4px 0 rgba(42, 34, 34, .3); }
.pin svg { width: 2.3rem; height: 2.3rem; }

/* ---- The guild town's clock: a white pill with the sun or moon travelling along it ---- */
.sky-holder { position: sticky; top: env(safe-area-inset-top); z-index: 6; max-width: 34rem; margin: -.8rem auto 0; padding: 0 1.1rem .75rem; filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .35)); pointer-events: none; }
.sky { position: relative; box-sizing: border-box; height: 3rem; background: #fff; border: var(--outline) solid var(--ink); border-radius: 999px; }      /* the town clock: a white pill, with the sun or moon travelling along it */
.sky-track { position: absolute; inset: 0 2rem; }
.orb { position: absolute; top: 50%; left: calc(var(--p, 0) * 100%); width: 2.5rem; height: 2.5rem; transform: translate(-50%, calc(-50% - var(--lift, 0px))); transition: left 1s linear, transform 1s linear; }
.orb.jump { transition: none !important; }
.orb img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(44, 31, 29, .35)); }

/* ---- Clouds behind the cards by day, the daytime match for the night stars ---- */
.day-sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; transition: opacity var(--night-fade) ease; }
.cloud { position: absolute; width: var(--w); aspect-ratio: 40 / 24; height: auto; transform: scaleX(var(--f)); fill: var(--paper); stroke: rgba(114, 97, 95, .3); stroke-width: .7; stroke-linejoin: round; opacity: .85; }
html.sky-night .day-sky { opacity: 0; }

/* ---- Night mode: stars behind the cards, and one warm plum dimmer over the whole screen ---- */
.night-sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity var(--night-fade) ease; background: linear-gradient(to bottom, var(--night-sky-top), var(--night-sky-bottom)); }
.nstar { position: absolute; width: var(--s); height: var(--s); transform: rotate(var(--r)); fill: var(--pearl-bush); stroke: var(--pearl-bush); stroke-width: .9; stroke-linejoin: round; opacity: .92; }
.night-shade { position: fixed; inset: 0; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity var(--night-fade) ease; background: var(--night-tint); mix-blend-mode: multiply; }
html { transition: --button var(--night-fade) ease, --button-dark var(--night-fade) ease, --quiet var(--night-fade) ease, --link var(--night-fade) ease, --good var(--night-fade) ease, --crit var(--night-fade) ease, --dock var(--night-fade) ease; }
.top { transition: background-color var(--night-fade) ease; }
.bottombar { background: linear-gradient(to top, var(--dock) 65%, rgba(0, 0, 0, 0)); }
/* The scenery (stars, the night backdrop) follows the guild town's clock: the sky-night class. */
html.sky-night { --dock: var(--night-sky-bottom); --on-backdrop: #f6efe9; --on-backdrop-quiet: #d8cbc4; }
/* The dimmer is Night mode, and follows the device: the night class. */
html.night {
  /* the dimmer lowers contrast, so text and buttons are a little deeper at night to stay readable */
  --button: #8f401f; --button-dark: #6a2f16; --quiet: #4a3d3a; --link: #703214; --good: #215c39; --crit: #8f2923; }
html.sky-night .night-sky { opacity: 1; }
html.night .night-shade { opacity: var(--night-strength); }
html.night .top { background-color: var(--night-header); }

/* ---- Accounts: the username under the avatar, and the logged-out pages ---- */
.who { flex: none; display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 5.2rem; }
.username { max-width: 100%; font: 600 .74rem/1.1 var(--font-head); color: var(--cream); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.booting .top, html.booting .sky-holder, html.booting .wrap { visibility: hidden; }
html.auth .top, html.auth .sky-holder, html.auth .wallet, html.auth .bottombar { display: none; }
.auth { padding-top: 1.4rem; }
.auth-logo { text-align: center; margin: .6rem 0 1.4rem; }
.auth-logo-img { max-width: 82%; max-height: 8.5rem; }
.auth-logo-text { display: block; font: 700 2.6rem/1.1 var(--font-head); color: var(--brand-red); -webkit-text-stroke: 2px var(--cream); paint-order: stroke fill; text-shadow: 0 3px 0 rgba(42, 34, 34, .35); }
.auth-logo-img:not([hidden]) + .auth-logo-text { display: none; }
.auth-buttons { display: grid; gap: .9rem; margin: 2rem 0 1rem; }
button.big { width: 100%; min-height: 3.5rem; font-size: 1.15rem; }
.auth-foot { text-align: center; font-size: .9rem; color: var(--quiet); }
.auth-foot a, .card a { color: var(--link); }
.step { margin: 0 0 .2rem; font: 600 .85rem var(--font-head); color: var(--quiet); text-transform: uppercase; letter-spacing: .06em; }
.field { margin: 0 0 1.1rem; }
.field label { display: block; margin: 0 0 .3rem; font: 600 1rem var(--font-head); }
.field input, .field select { width: 100%; min-height: 3rem; padding: .5rem .8rem; font: 400 1rem var(--font-body); color: var(--ink); background: #fff; border: var(--outline) solid var(--ink); border-radius: .9rem; }
.field input:focus, .field select:focus { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.field input.code { font: 600 1.6rem var(--font-head); letter-spacing: .3em; text-align: center; }
.hint { margin: .35rem 0 0; font-size: .88rem; line-height: 1.35; color: var(--quiet); }
.hint.good { color: var(--good); font-weight: 700; }
.hint.bad { color: var(--crit); font-weight: 700; }
.err { margin: 0 0 .8rem; min-height: 0; color: var(--crit); font-weight: 700; }
.err:empty { display: none; }
.notice { margin: 0 0 1rem; padding: .6rem .8rem; background: var(--cream); border: 2px solid var(--ink); border-radius: .8rem; }
.devnote { margin: 0 0 1rem; padding: .5rem .8rem; background: #fff7d6; border: 2px dashed var(--ink); border-radius: .8rem; font-size: .9rem; }
.pw { position: relative; }
.pw input { padding-right: 4.6rem; }
.showpw { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); min-height: 2.2rem; padding: 0 .7rem; background: var(--paper); color: var(--link); border: 2px solid var(--ink); box-shadow: none; font-size: .9rem; }
.auth-switch { margin: 1rem 0 0; text-align: center; font-size: .95rem; color: var(--quiet); }
.linkbtn { min-height: 2.6rem; padding: 0 .5rem; background: none; border: 0; box-shadow: none; color: var(--link); font: 600 .95rem var(--font-body); text-decoration: underline; }
.linkbtn:active:not(:disabled) { transform: none; box-shadow: none; }
.linkbtn:disabled { color: var(--quiet); text-decoration: none; background: none; }
.turnstile { margin: 0 0 1rem; min-height: 0; display: flex; justify-content: center; }
.turnstile[hidden] { display: none; }

/* the reveal and the grid */
.reveal-card { text-align: center; position: relative; }
.reveal-card .big { margin-top: .7rem; }
.reveal-art { display: grid; place-items: center; margin: .6rem 0 .8rem; }
.reveal-art .art { width: 11rem; height: 11rem; font-size: 4.5rem; transform: rotate(-2deg); }
.burst { position: relative; height: 0; pointer-events: none; z-index: 5; }
.spark { position: absolute; left: 50%; top: 13rem; width: var(--s); height: var(--s); margin: calc(var(--s) / -2); fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; opacity: 0; animation: pop 1.4s ease-out both; }
@keyframes pop { 0% { transform: translate(0, 0) scale(.2) rotate(0); opacity: 0; } 18% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; } }
.roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: .8rem; }
.cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; min-height: 0; padding: .55rem .3rem .5rem; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.cell .art { width: 100%; height: auto; aspect-ratio: 1; font-size: 2rem; }
.cell b { font: 600 .95rem var(--font-head); }
.cell[aria-pressed="true"] { background: var(--cream); outline: 4px solid var(--button); outline-offset: 2px; }
.cell .drawn { position: absolute; top: -.55rem; left: 50%; transform: translateX(-50%); padding: 0 .5rem; background: var(--button); color: #fff; border: 2px solid var(--ink); border-radius: .5rem; font: 700 .7rem var(--font-body); font-style: normal; white-space: nowrap; }
#choose.has-bar { padding-bottom: 13rem; }
.confirm-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: .9rem 1.1rem calc(.9rem + env(safe-area-inset-bottom)); background: var(--paper); border-top: var(--outline) solid var(--ink); display: grid; gap: .7rem; }
.confirm-bar[hidden] { display: none; }
.confirm-text { display: grid; gap: .1rem; max-width: 34rem; margin: 0 auto; width: 100%; }
.confirm-text b { font: 600 1.2rem var(--font-head); }
.confirm-buttons { display: grid; grid-template-columns: 1fr 2fr; gap: .7rem; max-width: 34rem; margin: 0 auto; width: 100%; }

/* the fade to the home page */
.veil { position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0; background: var(--kraft); transition: opacity .6s ease; }
.veil.on { opacity: 1; pointer-events: auto; }
html.sky-night .veil { background: var(--night-sky-bottom); }

/* polish: the welcome page sits in the middle, card headings get room, and grid cells have one border, not two */
#welcome { min-height: calc(100vh - 3rem); display: flex; flex-direction: column; justify-content: center; padding-top: 0; }
#welcome .auth-logo { margin-bottom: .6rem; }
.auth .card h2 { margin: 0 0 1rem; }
.cell { border-color: transparent; background: transparent; box-shadow: none; }
.cell[aria-pressed="true"] { border-color: var(--ink); background: var(--cream); outline: 3px solid var(--button); outline-offset: 2px; }
.cell .drawn { top: -.7rem; }

/* ---- Celebrations in result popups: a highlighted box, with the stars bursting around it ---- */
.panel > .burst { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 5; }
.spark { top: var(--oy, 13rem); }
.cheer { position: relative; margin: .8rem 0; padding: .8rem 2.4rem; text-align: center; background: var(--cream); border: var(--outline) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.cheer b { display: block; font: 600 1.15rem/1.3 var(--font-head); }
.cheer b + b { margin-top: .25rem; }
.cheer .sub { display: block; margin-top: .25rem; color: var(--quiet); }
.cheer-star { position: absolute; top: .6rem; width: 1.5rem; height: 1.5rem; fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.cheer-star.left { left: .7rem; transform: rotate(-12deg); }
.cheer-star.right { right: .7rem; transform: rotate(12deg); }

/* ---- Account settings ---- */
.account-actions { display: grid; gap: .6rem; }
.account-actions button { width: 100%; }
button.danger { color: var(--crit); }
button.danger-solid { background: var(--crit); border-color: var(--ink); box-shadow: 0 4px 0 #6a1f1a; }
button.danger-solid:disabled { background: #d9cdc4; color: #6b5b57; box-shadow: none; }
ul.plain { margin: .4rem 0 1rem; padding-left: 1.2rem; }
ul.plain li { margin: 0 0 .4rem; }

/* ---- The bell, opposite the avatar ---- */
.bellbox { flex: none; display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 5.2rem; }
.avatar.bell { position: relative; overflow: visible; }
.bell img { width: 72%; height: 72%; object-fit: contain; }
.bell .count { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.5rem; height: 1.5rem; padding: 0 .35rem; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 999px; background: var(--brand-red); color: #fff; font: 700 .82rem/1 var(--font-body); }
.bell .count[hidden] { display: none; }
html.no-bell .bellbox { visibility: hidden; }
.notice-box { display: grid; gap: .2rem; width: 100%; margin: 0 0 .7rem; padding: .8rem 1rem; text-align: left; background: var(--cream); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.notice-box b { font: 600 1.05rem var(--font-head); }
.notice-box .when { font-size: .82rem; color: var(--quiet); }

/* the avatar and the bell are a little narrower, so the logo keeps its room */
.top { gap: .5rem; padding-left: .9rem; padding-right: .9rem; }
.who, .bellbox { width: 4.7rem; }

.notice-box .quiet { font: 400 .95rem/1.35 var(--font-body); }

/* ---- Library sharing in Settings ---- */
.subhead { margin: 1.1rem 0 .5rem; font: 600 1rem var(--font-head); }
.shareform { display: flex; gap: .6rem; }
.shareform input { flex: 1; min-width: 0; min-height: 3rem; padding: .5rem .8rem; font: 400 1rem var(--font-body); color: var(--ink); background: #fff; border: var(--outline) solid var(--ink); border-radius: .9rem; }
.shareform input:disabled { background: #e9e0d5; color: var(--quiet); }
.shareform input:focus { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.shareform button { flex: none; min-width: 5rem; }
.sharelist { list-style: none; margin: .4rem 0 0; padding: 0; }
.sharelist li { display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem; padding: .35rem .5rem .35rem .8rem; background: var(--cream); border: 2px solid var(--ink); border-radius: .9rem; }
.sharelist li.empty { padding: .4rem .2rem; background: none; border: 0; color: var(--quiet); }
.sharelist .name { flex: 1; font: 600 1rem var(--font-head); overflow: hidden; text-overflow: ellipsis; }
.sharelist .state { font-size: .85rem; color: var(--quiet); }
.minus { flex: none; width: 2.6rem; height: 2.6rem; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--crit); color: #fff; border: var(--outline) solid var(--ink); box-shadow: 0 3px 0 #6a1f1a; font: 700 1.6rem/1 var(--font-body); }
.minus:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #6a1f1a; }

/* ---- A borrowed book: the globe before its title ---- */
.globe { width: 1.05em; height: 1.05em; margin-right: .4rem; vertical-align: -.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 5.6; stroke-linejoin: round; }

/* ---- A newer version of the game is ready ---- */
.updatebar { position: relative; z-index: 7; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem .8rem; padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: var(--cream); color: var(--ink); border-bottom: var(--outline) solid var(--ink); font-weight: 700; text-align: center; }   /* in the page, above the header, so it never covers the bell */
.updatebar[hidden] { display: none; }
.updatebar button { min-height: 2.4rem; padding: 0 1rem; }

/* ---- Text that sits straight on the page, not on a card, is light against the night scenery ---- */
#message, .shop-head, .shop-sub, .sheetbar h2, #sheet > p.hand, .auth-foot, .auth-foot a { transition: color var(--night-fade) ease; }
/* Only on the guild home page: it is the one page where the night sky shows behind the text. Every other page stays on its plain tan, so its text keeps its dark colours at night. */
html.sky-night body.on-home #message { color: var(--on-backdrop); }
html.sky-night body.on-home #message.ok { color: #c9efd3; }
html.sky-night body.on-home #message.error { color: #ffcfc6; }

/* ---- The guild party: up to four adventurer cards, and the recruit box ---- */
#party { display: grid; gap: 1.6rem; }
.recruit-box { display: grid; place-items: center; gap: .5rem; min-height: 8.5rem; padding: 1.2rem; text-align: center; background: transparent; border: 3px dashed var(--ink); box-shadow: none; }
.recruit-plus { width: 4rem; height: 4rem; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; font: 700 2.4rem/1 var(--font-body); }
.recruit-label { margin: 0; font: 600 1.15rem var(--font-head); color: var(--ink); }
html.sky-night .recruit-box { border-color: var(--on-backdrop); }
html.sky-night .recruit-label { color: var(--on-backdrop); }



/* ---- The Boardwalk Arcade ---- */
.world-group { font-size: 1rem; margin: .4rem 0 .3rem; color: var(--ink2, #6a5a55); letter-spacing: .02em; }
.note-link { display: inline; background: none; border: 0; box-shadow: none; min-height: 0; padding: .25rem 0; font: inherit; font-weight: 700; color: var(--button); text-decoration: underline; text-underline-offset: .15em; cursor: pointer; }
.linklike { background: none; border: 0; box-shadow: none; text-decoration: underline; color: #6a5a55; font: inherit; padding: .4rem; cursor: pointer; min-height: 44px; }
.sc-msg { margin: .4rem 0; font-weight: 700; }
.sc-msg.error { color: #a3341f; }
.marquee { display: block; width: 100%; background: none; border: 0; box-shadow: none; padding: 0; cursor: pointer; }
.marquee svg { display: block; width: 100%; height: auto; }
.mq-b { fill: #b8964a; stroke: #2c1f1d; stroke-width: 1.2; opacity: .5; transition: opacity .6s ease, fill .6s ease; }      /* by day the bulbs are dim and still */
.mq-l { animation: mq-bob 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * .09s); }
@keyframes mq-bob { 0%, 50%, 100% { transform: translateY(0); } 18% { transform: translateY(-9px); } 30% { transform: translateY(1px); } }
/* At night the bulbs come on, chase around the sign and glow, so the sign has all its punch. */
html.sky-night .mq-b { fill: #ffd45a; opacity: 1; animation: mq-chase 1.2s linear infinite; animation-delay: var(--d); filter: drop-shadow(0 0 3px #ffd45a); }
@keyframes mq-chase { 0%, 33% { opacity: 1; } 34%, 100% { opacity: .3; } }
html.sky-night .marquee svg { filter: drop-shadow(0 0 12px rgba(200, 35, 27, .5)); }
@media (prefers-reduced-motion: reduce) { .mq-l, html.sky-night .mq-b { animation: none; } html.sky-night .mq-b { opacity: 1; } }

.rec-game { margin: .3rem 0 .9rem; }
.rec-name { font-weight: 800; font-size: 1.2rem; margin-bottom: .35rem; }
.rec-row { display: flex; gap: .5rem; }
.rec-box { flex: 1; text-align: center; background: #fff8ee; border: 3px solid #2a2222; border-radius: 14px; padding: .35rem 0; display: flex; flex-direction: column; }
.rec-box b { font-size: 1.25rem; }

.sc-top { display: flex; justify-content: space-between; align-items: center; margin: .2rem 0 .5rem; }
.sc-screen { background: #2c1f1d; border: 4px solid #8a6a52; border-radius: 16px; padding: .5rem .25rem .45rem; color: #fbf1de; }
.sc-crew { display: flex; justify-content: center; }
.sc-member { width: 33.3%; text-align: center; }
.sc-sprite { display: inline-block; border: 3px solid #fbf1de; border-radius: 6px; background: #1b3a4a; line-height: 0; }
.sc-sprite svg { width: 40px; height: 40px; }
.sc-name { font-weight: 800; font-size: .78rem; margin-top: 2px; }
.sc-total { font-size: .7rem; color: #cdbfa3; margin-bottom: 3px; }
.sc-mini { display: grid; grid-template-columns: repeat(3, 28px); gap: 3px; justify-content: center; }
.sc-mini .mini { width: 28px; height: 39px; border-radius: 4px; border: 1.5px solid #2c1f1d; overflow: hidden; line-height: 0; }
.sc-mini .mini svg { width: 100%; height: 100%; }
.sc-mini .mini.face { background: #fbf1de; color: #2c1f1d; display: grid; place-items: center; line-height: 1; font-size: .95rem; }
.sc-rule { height: 1px; background: #5a463e; margin: .4rem .6rem .2rem; }
.sc-mid { display: flex; justify-content: center; gap: 1.1rem; align-items: flex-end; margin: .2rem 0 .1rem; }
.sc-pile { text-align: center; }
.sc-pile button, .sc-hand { width: 58px; padding: 0; background: none; border: 0; box-shadow: none; line-height: 0; display: block; min-height: 0; }
.sc-hand { height: 81px; border-radius: 7px; }
.sc-hand.has { outline: 3px solid #e9a23b; outline-offset: 2px; }
.sc-pile button:disabled { opacity: .85; }
.sc-pile button:not(:disabled) { outline: 3px solid rgba(233, 162, 59, .55); outline-offset: 2px; border-radius: 7px; cursor: pointer; }
.sc-empty { width: 58px; height: 81px; box-sizing: border-box; border: 2px solid #5a463e; border-radius: 7px; background: #261b19; }
.sc-cap { font-size: .7rem; font-weight: 700; color: #cdbfa3; margin-top: 2px; min-height: 1em; }
.sc-cap.hot { color: #e9a23b; }
.sc-hint { text-align: center; font-weight: 700; font-size: .8rem; margin: 0 .4rem; min-height: 1.95em; line-height: 1.15; }
.sc-total-line { text-align: center; font-size: .75rem; color: #cdbfa3; font-weight: 700; margin-bottom: .3rem; }
.sc-grid { display: grid; grid-template-columns: repeat(3, 76px); gap: 6px; justify-content: center; }
.sc-slot { position: relative; width: 76px; padding: 0; background: none; border: 0; box-shadow: none; line-height: 0; min-height: 0; border-radius: 9px; }
.sc-slot:not(:disabled) { cursor: pointer; outline: 2px dashed rgba(233, 162, 59, .7); outline-offset: 2px; }
.sc-slot.match { outline: 3px solid #e9a23b; outline-offset: 2px; }
.sc-slot .zero { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); z-index: 2; background: #e9a23b; color: #2c1f1d; font: 800 .66rem sans-serif; border: 2px solid #2c1f1d; border-radius: 10px; padding: 0 .4rem; line-height: 1.2; }
.sc-card { width: 100%; height: auto; display: block; }
.sc-log { min-height: 2.5em; line-height: 1.22; text-align: center; font-size: .72rem; color: #cdbfa3; margin: .2rem .4rem 0; }
.sc-buttons { display: flex; justify-content: center; gap: .6rem; margin-top: .3rem; flex-wrap: wrap; }
.sc-table { width: 100%; border-collapse: collapse; margin: .3rem 0 .5rem; }
.sc-table th { text-align: left; font-size: .8rem; color: #6a5a55; padding: .2rem .3rem; }
.sc-table td { padding: .35rem .3rem; border-bottom: 2px dashed #d9c3ad; }
.sc-table tr.best td { background: #f6e69a; font-weight: 800; }
.sc-gift { background: #f6e69a; border: 3px solid #2a2222; border-radius: 14px; padding: .5rem .7rem; text-align: center; }
body.sc-busy .sc-screen { pointer-events: none; }      /* no dimming while the server answers: the dip in brightness read as the game stalling */
.sc-pile button.pending { transform: translateY(-.35rem) rotate(-3deg); transition: transform .12s ease; }
.sc-slot.pending { transform: scale(1.05); transition: transform .12s ease; }

/* The crew's turns: whoever is playing lights up, and the card he changed flashes. */
.sc-member .sc-sprite { transition: box-shadow .2s ease; }
.sc-member.acting .sc-sprite { outline: 3px solid #e9a23b; outline-offset: 2px; box-shadow: 0 0 14px rgba(233, 162, 59, .9); animation: scGlow 1s ease-in-out infinite alternate; }
.sc-member.acting .sc-name { color: #e9a23b; }
@keyframes scGlow { from { box-shadow: 0 0 6px rgba(233, 162, 59, .5); } to { box-shadow: 0 0 16px rgba(233, 162, 59, 1); } }
.sc-mini .mini.flash { outline: 2px solid #e9a23b; outline-offset: 1px; animation: scFlash .9s ease-out; }
@keyframes scFlash { 0% { transform: scale(1.3); } 100% { transform: scale(1); } }
.sc-pile.flash .sc-cap { color: #e9a23b; }
.sc-pile.flash button { outline: 3px solid #e9a23b; outline-offset: 2px; border-radius: 7px; }
.sc-log b { color: #fbf1de; }
#scSee { flex: 1 1 auto; max-width: 340px; }
@media (prefers-reduced-motion: reduce) { .sc-member.acting .sc-sprite, .sc-mini .mini.flash { animation: none; } }

/* At the card table, the sky strip, the wallet row and the map pin step aside, so the whole table fits one phone screen. */
body.on-table #sky, body.on-table .wallet, body.on-table #message, body.on-table .bottombar { display: none; }
body.on-table .sc-top { margin-top: .3rem; }


/* Scuttle on the beach: the moonlit beach stays behind the table, a little dimmed, and the crew show their faces instead of 8-bit sprites. */
body.sc-beach header.top { display: none; }
.sc-captain { text-align: center; }
.sc-captain img { width: 96px; height: 96px; border-radius: 50%; border: var(--outline) solid var(--ink); background: #2b3557; object-fit: cover; }
body.sc-beach #scuttle { position: relative; z-index: 10; }
body.sc-beach #beach::after { content: ""; position: absolute; inset: 0; background: rgba(20, 18, 40, .35); }
body.sc-beach .sc-screen { background: rgba(28, 20, 19, .84); border-color: rgba(251, 241, 222, .55); }
body.sc-beach #scTitle, body.sc-beach #scMsg { color: #fbf1de; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
body.sc-beach .sc-sprite { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: #2b3557; }
body.sc-beach .sc-sprite img { width: 100%; height: 100%; object-fit: cover; }

/* ---- QT Beach: a full-screen illustration with Lido, the activity menu and the friends' checklist ---- */
body.on-beach header.top, body.on-beach #sky, body.on-beach .wallet, body.on-beach #message, body.on-beach .bottombar { display: none; }
body.on-beach { overflow: hidden; }
#beach { position: fixed; inset: 0; z-index: 9; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#beach[hidden], .beach-top[hidden], .beach-ask[hidden], .beach-menus[hidden] { display: none; }
.beach-scene { position: absolute; inset: 0; background-size: cover, cover; background-position: center bottom, center; background-repeat: no-repeat; }
.beach-top { position: absolute; top: calc(.7rem + env(safe-area-inset-top)); left: .7rem; right: .7rem; display: flex; justify-content: space-between; gap: .6rem; z-index: 2; }
.beach-ask { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 0 1rem calc(.3rem + env(safe-area-inset-bottom)); transition: opacity 1s; }
.beach-ask.leaving { opacity: 0; pointer-events: none; }
.beach-bubble { position: relative; z-index: 2; width: min(20rem, 100%); margin-bottom: -.4rem; padding: .8rem 1rem; text-align: center; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1.2rem; box-shadow: var(--shadow); }
.beach-bubble p { margin: 0 0 .65rem; font-size: 1.2rem; font-weight: 700; }
.beach-choices { display: flex; gap: .6rem; }
.beach-choices button { flex: 1; }
.beach-lido { width: min(15rem, 62vw); max-height: 40vh; height: auto; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(42, 34, 34, .35)); }
/* Full moon stage: 1024 x 1526 art. It covers the screen, except on very tall phones, where it shrinks just enough to keep the whole crew and Driftwood in view and the moon sky fills above. */
.moon-stage { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); aspect-ratio: 1024 / 1526; width: max(100vw, min(calc(100vh * 1024 / 1526), calc(100vw / .96))); width: max(100vw, min(calc(100dvh * 1024 / 1526), calc(100vw / .96))); pointer-events: none; }
.moon-stage[hidden], .moon-ask[hidden] { display: none; }
.moon-stage img { position: absolute; display: block; height: auto; }
.ms-bg { inset: 0; width: 100%; height: 100% !important; -webkit-mask-image: linear-gradient(transparent, #000 7%); mask-image: linear-gradient(transparent, #000 7%); }
.ms-crew { left: 1.5625%; top: 61.795%; width: 51.66%; }
.ms-drift { position: absolute; left: 45.703%; top: 42.202%; width: 51.855%; height: 53.735%; }
.ms-alive { left: 0; top: 0; width: 99.62% !important; }
.ms-ghost { left: 1.51%; top: 2.44%; width: 98.49% !important; opacity: 0; }
.ms-drift.glitch .ms-ghost { animation: ghost-flicker .7s steps(1) both; }
.ms-drift.glitch .ms-alive { animation: alive-flicker .7s steps(1) both; }
@keyframes ghost-flicker { 0% { opacity: 1; transform: translateX(3px); } 12% { opacity: 0; } 22% { opacity: 1; transform: translateX(-2px); } 70% { opacity: 1; transform: none; } 82% { opacity: 0; } 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes alive-flicker { 0% { opacity: 0; } 12% { opacity: 1; transform: translateX(-3px); } 22% { opacity: 0; } 82% { opacity: 1; } 90% { opacity: 0; } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ms-drift.glitch .ms-ghost { animation: ghost-fade .7s ease both; }
  .ms-drift.glitch .ms-alive { animation: none; }
  @keyframes ghost-fade { 0%, 100% { opacity: 0; } 40%, 60% { opacity: .85; } }
}
.moon-ask { position: absolute; z-index: 2; width: min(16rem, calc(100vw - 1rem)); }
.moon-ask .beach-choices { flex-direction: column; }      /* a column, with room for the Shop when it opens */
.beach-menus { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; align-items: start; padding: .8rem .8rem calc(.8rem + env(safe-area-inset-bottom)); }
.beach-menu { max-height: 46vh; overflow-y: auto; padding: .6rem; background: rgba(252, 241, 226, .95); border: var(--outline) solid var(--ink); border-radius: 1.1rem; box-shadow: var(--shadow); }
.beach-menu h3 { margin: 0 0 .4rem; font-size: 1rem; }
#beachActivity { width: 100%; padding: .55rem .3rem; font: inherit; font-size: .9rem; font-weight: 700; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: .8rem; }
.beach-row { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .2rem .1rem; }
.beach-row input { flex: none; width: 1.4rem; height: 1.4rem; accent-color: var(--button); }
.beach-row.off { opacity: .55; }
.beach-count { font: 800 .85rem var(--font-body); color: var(--quiet); margin-left: .4rem; white-space: nowrap; }
.beach-group { margin: .5rem 0 .1rem; padding-bottom: .1rem; font: 600 .8rem var(--font-head); letter-spacing: .04em; text-transform: uppercase; color: var(--quiet); border-bottom: 2px solid var(--line); }
.beach-face { flex: none; width: 2.6rem; height: 2.6rem; border: var(--outline) solid var(--ink); border-radius: 50%; background-repeat: no-repeat; background-size: cover; background-position: center; }
.beach-row .why { display: block; font-size: .8rem; }
.beach-note { grid-column: 1 / -1; margin: 0; padding: .4rem .7rem; text-align: center; font-weight: 700; color: var(--ink); background: rgba(252, 241, 226, .95); border: 3px solid var(--ink); border-radius: 1rem; }
.beach-note:empty { display: none; }
.beach-actions { grid-column: 1 / -1; display: flex; gap: .6rem; }
.beach-actions button { flex: 1; }

/* ---- Relationships, at the bottom of an adventurer's sheet ---- */
.rel-row { margin: .1rem 0 .9rem; }
.rel-tier { margin: 0 0 .45rem; font-size: 1.05rem; }
.rel-faces { display: flex; flex-wrap: wrap; gap: .55rem; }
.rel-face { width: 2.9rem; height: 2.9rem; border: var(--outline) solid var(--ink); border-radius: 50%; background-repeat: no-repeat; background-size: cover; background-position: center; box-shadow: var(--shadow); }


/* ---- Shopkeepers stand in a tall frame on their shop pages, in their own isolated pose ---- */
.art.tall { width: 6rem; height: 8.6rem; }
.art.has-img.figure .art-img { box-sizing: border-box; padding: .35rem .2rem .1rem; object-fit: contain; object-position: center bottom; border-radius: inherit; }

/* ---- The flavours in a stack of taffy ---- */
.flavors { margin: .1rem 0 .7rem; }
.flavor-row { display: flex; align-items: center; gap: .6rem; padding: .15rem 0; font-weight: 700; }
.flavor-row img { flex: none; width: 3.2rem; height: 1.8rem; object-fit: contain; }

/* Salt and Fin: the line in the Study, Adventure and Train picker that says which coffee will be drunk */
.coffee-note { margin: .2rem 0 .6rem; padding: .45rem .7rem; border: 2px dashed var(--ink); border-radius: .8rem; font-weight: 700; background: var(--box3); }

/* ---- Polarville full-screen places: the Sacred Pine and Nicholas North's office ---- */
.place { position: fixed; inset: 0; z-index: 9; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.place[hidden], .helpline[hidden] { display: none; }
.place-scene { position: absolute; inset: 0; background-size: cover; background-position: center bottom; background-repeat: no-repeat; }
.place-ask { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 0 1rem calc(1rem + env(safe-area-inset-bottom)); }
.place-ask .beach-bubble { margin-bottom: 0; }
.place-choices { display: flex; flex-direction: column; gap: .5rem; }
.place-choices button.small { align-self: center; padding: .3rem .8rem; font-size: .85rem; }
.help-link { background: transparent; border: none; box-shadow: none; color: var(--ink); font-weight: 600; text-decoration: underline; padding: .2rem; line-height: 1.3; }
.helpline { width: min(20rem, 100%); background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; padding: .6rem .9rem; box-shadow: var(--shadow); font-size: .9rem; line-height: 1.35; max-height: 45vh; overflow-y: auto; }
.helpline h3 { margin: 0 0 .3rem; font-size: 1rem; }
.helpline p { margin: .3rem 0; }
.helpline a { color: var(--ink); font-weight: 700; }
.ribbon-panel textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 1.05rem; padding: .7rem .9rem; color: var(--ink); background: #fbe9e2; border: 3px solid var(--ink); border-radius: .8rem; resize: none; background-image: repeating-linear-gradient(90deg, transparent 0 18px, rgba(181, 83, 47, .08) 18px 20px); }
.ribbon-count { text-align: right; margin: .2rem 0 0; }
#ribbonOverlay { transition: opacity 1.2s ease; }
#ribbonOverlay.fading { opacity: 0; pointer-events: none; }

/* Snow Hills by day: Comet on the edited background (1024 x 1526), placed from the example scene. */
.ss-comet { left: 30.469%; top: 32.765%; width: 64.063%; }
.beach-ask.anchored { position: absolute; padding: 0; width: min(20rem, calc(100vw - 1rem)); z-index: 2; }

/* The Resources parchment in Nicholas North's office */
.parchment { background: #f3e4c4; background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 250, 235, .7), transparent 70%), radial-gradient(ellipse at 50% 100%, rgba(160, 110, 60, .18), transparent 70%); border-radius: .6rem 1.4rem .8rem 1.2rem; max-height: 85vh; overflow-y: auto; }
.parchment h2 { font-family: var(--font-head); }
.parch-intro { margin: .2rem 0 .5rem; }
.parch-danger { margin: 0 0 .6rem; padding: .45rem .7rem; border: 2px solid var(--ink); border-radius: .7rem; background: rgba(255, 255, 255, .5); }
.parch-line { padding: .5rem 0; border-top: 1px dashed rgba(42, 34, 34, .35); }
.parch-line h3 { margin: 0; font-size: 1rem; }
.parch-line p { margin: .15rem 0; }
.parch-line a, .parch-danger a { color: var(--ink); font-weight: 700; }
.parch-checked { margin-top: .6rem; text-align: center; }

/* ---- Ambient motion in the full-screen places, and a soft fade on arrival. All of it stops for reduce motion. ---- */
.place.arrive, #beach.arrive { animation: place-in .6s ease both; }
@keyframes place-in { from { opacity: 0; } to { opacity: 1; } }
/* A stage the size of the 941 x 1672 scenery, placed exactly where the background sits, so effects line up with the art. */
.fx-stage { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); aspect-ratio: 941 / 1672; width: max(100vw, calc(100vh * 941 / 1672)); width: max(100vw, calc(100dvh * 941 / 1672)); pointer-events: none; overflow: hidden; }
.fx-stage > div, .fx-window { position: absolute; }
/* Drifting snow: two layers of soft flakes falling at different speeds */
.fx-snow { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .85;
  background-image: radial-gradient(circle, rgba(255,255,255,.95) 0 1.6px, transparent 2.2px), radial-gradient(circle, rgba(255,255,255,.8) 0 1.1px, transparent 1.6px), radial-gradient(circle, rgba(255,255,255,.7) 0 2.2px, transparent 3px);
  background-size: 140px 160px, 90px 110px, 230px 260px; background-position: 0 0, 40px 30px, 100px 60px;
  animation: snow-fall 18s linear infinite; }
@keyframes snow-fall { from { background-position: 0 0, 40px 30px, 100px 60px; } to { background-position: 40px 160px, 10px 140px, 160px 320px; } }
#beach:not([data-scene^="snow"]) #beachSnow { display: none; }
/* Warm breathing glow on the Sacred Pine, and the firelight in the office */
.fx-glow { border-radius: 50%; mix-blend-mode: screen; }
.fx-pine-glow { left: 10%; top: 8%; width: 80%; height: 45%; background: radial-gradient(closest-side, rgba(255, 214, 140, .45), rgba(255, 190, 110, .15) 60%, transparent); animation: breathe 6s ease-in-out infinite; }
.fx-fire { left: 34%; top: 36%; width: 36%; height: 26%; background: radial-gradient(closest-side, rgba(255, 170, 80, .5), rgba(255, 140, 60, .18) 55%, transparent); animation: flicker 2.3s ease-in-out infinite, breathe 5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes flicker { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.04, .98); } 45% { transform: scale(.97, 1.03); } 70% { transform: scale(1.03, 1); } }
.fx-window { left: 0; top: 2%; width: 17%; height: 38%; overflow: hidden; }
.fx-window .fx-snow { background-size: 70px 80px, 45px 55px, 115px 130px; }
/* A faint shimmer of light on the beach water, by day and by night */
.fx-water { left: 0; top: 41%; width: 100%; height: 21%; mix-blend-mode: screen; opacity: .5;
  background-image: radial-gradient(ellipse 14px 1.6px, rgba(255,255,255,.85), transparent), radial-gradient(ellipse 9px 1.2px, rgba(255,255,255,.7), transparent), radial-gradient(ellipse 20px 2px, rgba(255,255,255,.6), transparent);
  background-size: 120px 34px, 76px 22px, 190px 46px; background-position: 0 0, 30px 10px, 70px 20px;
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  animation: water-drift 14s linear infinite, breathe 3.5s ease-in-out infinite; }
@keyframes water-drift { from { background-position: 0 0, 30px 10px, 70px 20px; } to { background-position: 120px 0, -46px 10px, 260px 20px; } }
#beach:not([data-scene="day"]):not([data-scene="night"]) .fx-water { display: none; }
/* The aurora gently shimmering over Snow Hills at night */
.fx-aurora { left: 25%; top: 2%; width: 75%; height: 28%; mix-blend-mode: screen; opacity: .0;
  background: radial-gradient(ellipse at 40% 50%, rgba(140, 255, 190, .45), transparent 60%), radial-gradient(ellipse at 75% 40%, rgba(200, 150, 255, .35), transparent 55%);
  animation: aurora 8s ease-in-out infinite; }
@keyframes aurora { 0%, 100% { opacity: .15; transform: translateX(0); } 50% { opacity: .6; transform: translateX(3%); } }
#beach:not([data-scene="snow-night"]) .fx-aurora { display: none; }
/* By day, Snow Hills is drawn on its own stage, so the beach effects stage is not needed there */
#beach[data-scene="snow-day"] #beachFx { display: none; }
@media (prefers-reduced-motion: reduce) { .fx-snow, .fx-water, .fx-aurora, .fx-glow { animation: none !important; } .place.arrive, #beach.arrive { animation-duration: .01s; } }
html[data-reduce="1"] .fx-snow, html[data-reduce="1"] .fx-water, html[data-reduce="1"] .fx-aurora, html[data-reduce="1"] .fx-glow { animation: none !important; }

/* ---- Shops as little rooms (Salt and Fin is the first): wallpaper, a floor, the shopkeeper at their counter, items in a grid ---- */
body.on-shop header.top, body.on-shop .sky-holder, body.on-shop .wallet, body.on-shop #message, body.on-shop .bottombar { display: none; }
.shop-screen { margin: calc(-1 * env(safe-area-inset-top)) -1.1rem 0; background: var(--pearl-bush); min-height: 100vh; }      /* indoors: a solid pearl floor of colour, not the sky */
.shop-scene { position: relative; height: min(62vh, 34rem); overflow: hidden; border-bottom: var(--outline) solid var(--ink); }
.sf-wall { background-color: #f6efdc; background-image: repeating-linear-gradient(90deg, rgba(233, 214, 150, .55) 0 26px, transparent 26px 58px), repeating-linear-gradient(45deg, transparent 0 46px, rgba(150, 150, 170, .18) 46px 47px), repeating-linear-gradient(-45deg, transparent 0 46px, rgba(150, 150, 170, .18) 46px 47px); }
.shop-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 9%; background: #c4733e; border-top: 2px solid rgba(42, 34, 34, .35); }
.shop-keeper { position: absolute; left: 46%; bottom: 3%; transform: translateX(-50%); height: 74%; width: auto; max-width: 94%; object-fit: contain; }
.shop-wallet { position: absolute; top: calc(.7rem + env(safe-area-inset-top)); left: .8rem; z-index: 2; display: flex; gap: .4rem; }
.shop-coin { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem .25rem .3rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 999px; font-weight: 800; box-shadow: var(--shadow); }
.shop-coin img { width: 1.6rem; height: 1.6rem; }
.shop-exit { position: absolute; top: calc(3.6rem + env(safe-area-inset-top)); left: .8rem; z-index: 2; min-height: 0; padding: .35rem 1rem; }
.shop-bubble { position: absolute; top: 14%; right: .5rem; z-index: 2; max-width: 40%; padding: .5rem .7rem; font-size: .92rem; background: #fff; border: var(--outline) solid var(--ink); border-radius: 1.2rem; font-weight: 700; text-align: center; box-shadow: var(--shadow); }
.shop-grid { background: var(--pearl-bush); display: grid; grid-template-columns: repeat(auto-fill, minmax(4.9rem, 1fr)); gap: .9rem .3rem; padding: 1.1rem .8rem 2rem; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-height: 0; padding: .3rem .1rem; background: none; border: 0; box-shadow: none; color: var(--ink); font: inherit; cursor: pointer; }
.shop-item:active { transform: translateY(1px); }
.shop-art { width: 4.4rem; height: 4.4rem; border: 0; background: none !important; box-shadow: none; }
.shop-name { font-weight: 700; font-size: .85rem; line-height: 1.15; text-align: center; }
.shop-price { font-size: .85rem; color: var(--quiet); }
/* The shop popup as a centered card: name, big picture, description, price, Gift to, how many, buy */
#overlay.pop-center { align-items: center; padding: 1rem; }
#overlay.pop-center .panel { width: min(22rem, 100%); border-bottom: var(--outline) solid var(--ink); border-radius: 1.5rem; padding-bottom: 1.1rem; text-align: center; }
#overlay.pop-center .panel > .row { flex-direction: column; align-items: center; gap: .4rem; }
#overlay.pop-center .panel > .row > .grow { display: contents; }
#overlay.pop-center #popName { order: -1; padding-right: 0; }
#overlay.pop-center #popArt { width: 8rem; height: 8rem; border: 0; background: none !important; box-shadow: none; }
#overlay.pop-center #popDesc { font-size: .92rem; line-height: 1.35; }
#overlay.pop-center .field { text-align: left; }

/* The Sacred Pine at night: its own painting, with a softer warm glow around the trunk */
#pine.night .fx-pine-glow { left: 15%; top: 28%; width: 70%; height: 44%; background: radial-gradient(closest-side, rgba(255, 200, 130, .32), rgba(255, 170, 100, .12) 60%, transparent); }
body.on-shop { background: var(--pearl-bush); }      /* indoors all the way down */
body:not(.on-home) #daySky, body:not(.on-home) #nightSky { display: none; }      /* clouds and stars belong to the guild adventurer page only */

/* The General Store: white horizontal shiplap, a warm floor, Agnes at her desk to the right of centre */
.gs-wall { background-color: #f3efe7; background-image: repeating-linear-gradient(180deg, transparent 0 40px, rgba(120, 104, 90, .28) 40px 42px, rgba(255, 255, 255, .6) 42px 43px), linear-gradient(90deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, .03)); }
.gs-floor { background: #bf6f3d; }
.gs-wall { height: auto; aspect-ratio: 1024 / 862; }      /* the room keeps the founder's mock-up proportions, so the decor stays where she placed it */
.gs-floor { height: 11%; }
.gs-keeper { left: 49.3%; bottom: 3%; width: 73%; height: auto; max-width: none; }
.decor { position: absolute; height: auto; pointer-events: none; }
.decor-front { z-index: 1; }
.gs-pups { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.gs-pup { position: absolute; bottom: 1.5%; height: 21%; --face: 1; transform: scaleX(var(--face)); }
.gs-pup[hidden] { display: none; }
.gs-pup img { display: block; height: 100%; width: auto; transform-origin: 50% 100%; }
.gs-pup.moving img { animation: pup-hop .34s ease-in-out infinite; }
@keyframes pup-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10%) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .gs-pup.moving img { animation: none; } }
.shop-run { display: contents; }

/* Darling's Taffy Shop: warm plaster walls, a dark wood floor, Darling at her counter. Proportions from the founder's mock-up (1024 x 878). */
.dt-wall { height: auto; aspect-ratio: 1024 / 878; background: #fbeaa6; }      /* a plain light yellow paint, in place of the stucco */
.dt-floor { height: 13.1%; background: #6e2f1d; }
.dt-keeper { left: 54.64%; bottom: 1.25%; width: 78.6%; height: auto; max-width: none; }

/* General Hoot Books: blue and cream striped wallpaper with little yellow flowers, a dark wood floor. Proportions from the founder's mock-up (1024 x 878). */
.hb-wall { height: auto; aspect-ratio: 1024 / 878; background-color: #ece2c8;
  background-image:
    radial-gradient(circle at 31% 22%, #d8a53a 0 2.6px, transparent 3.2px), radial-gradient(circle at 22% 46%, #d8a53a 0 2.2px, transparent 2.8px), radial-gradient(circle at 34% 70%, #d8a53a 0 2.6px, transparent 3.2px),
    radial-gradient(ellipse 3px 1.6px at 26% 34%, #8ea36a 0 100%, transparent 110%), radial-gradient(ellipse 3px 1.6px at 30% 58%, #8ea36a 0 100%, transparent 110%),
    linear-gradient(90deg, transparent 0 62%, #3f5f80 62% 100%);
  background-size: 13.5% 64px, 13.5% 64px, 13.5% 64px, 13.5% 64px, 13.5% 64px, 13.5% 100%; }
.hb-floor { height: 13.1%; background: #6e2f1d; }
.hb-keeper { left: 46.24%; bottom: .9%; width: 84.28%; height: auto; max-width: none; }
/* The day's ten books: equal widths and equal gaps, the last row centred, titles wrapping about two words a line */
.hb-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem .5rem; }
.hb-grid .shop-item { flex: 0 0 calc((100% - 1.5rem) / 4); }
.hb-grid .shop-name { max-width: 6.4em; overflow-wrap: anywhere; hyphens: auto; }

/* Salt and Fin decorated: the room keeps the founder's mock-up proportions (1024 x 862) */
.sf-wall { height: auto; aspect-ratio: 1024 / 862; }
.sf-floor { height: 11.5%; background: #c0703d; }
.sf-keeper { left: 50.1%; bottom: .7%; width: 65.82%; height: auto; max-width: none; }

/* ---- The Boardwalk Arcade: a full-screen scene, Bliss by the machines, a column of choices at the bottom left ---- */
.arcade-place .shop-wallet, .arcade-place .shop-exit { z-index: 3; }
.arc-stage { z-index: 0; }
.arc-bliss { position: absolute; height: auto; pointer-events: none; }
.arc-menu { position: absolute; z-index: 3; left: max(.8rem, 3vw); bottom: calc(1.2rem + env(safe-area-inset-bottom)); width: min(56vw, 15rem); display: flex; flex-direction: column; gap: .55rem; }
.arc-tile { align-self: center; width: 7.2rem; min-height: 0; padding: .5rem .4rem .45rem; display: flex; flex-direction: column; align-items: center; gap: .15rem; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1rem; box-shadow: var(--shadow); font: inherit; }
.arc-tile .shop-art { width: 3.6rem; height: 3.6rem; }
.arc-tile .shop-name { font-size: .85rem; }
.arc-btn { width: 100%; display: block; text-align: center; line-height: 1.2; padding-left: 0; padding-right: 0; }      /* text centred on the button itself */
.arc-caption { display: block; font-size: .75rem; font-weight: 600; opacity: .9; }
.arc-caption:empty { display: none; }
.arc-menu .sc-msg { margin: 0; background: var(--paper); border: 2px solid var(--ink); border-radius: .8rem; padding: .35rem .6rem; }
/* Night: the neon and the lights pop. Soft glows drawn over the art, screen-blended so they only ever brighten it. */
.neon { position: absolute; display: none; border-radius: 50%; mix-blend-mode: screen; pointer-events: none; }
.arcade-place.night .neon { display: block; }
.neon-sign { left: 10%; top: 6%; width: 76%; height: 26%; background: radial-gradient(closest-side, rgba(255, 150, 120, .55), rgba(255, 90, 140, .22) 55%, transparent); animation: neon-hum 3.2s ease-in-out infinite; }
.neon-sign2 { left: 14%; top: 20%; width: 66%; height: 10%; background: radial-gradient(closest-side, rgba(120, 170, 255, .55), rgba(150, 110, 255, .2) 60%, transparent); animation: neon-hum 2.4s ease-in-out infinite reverse; }
.neon-bulbs { left: 4%; top: 32%; width: 76%; height: 12%; border-radius: 40%; background: radial-gradient(closest-side, rgba(255, 210, 130, .5), transparent); animation: bulbs 1.6s steps(2) infinite; }
.neon-scuttle { left: 5%; top: 39%; width: 36%; height: 40%; background: radial-gradient(closest-side, rgba(255, 120, 80, .45), rgba(255, 70, 70, .15) 60%, transparent); animation: neon-flicker 5s linear infinite; }
.neon-cabs { left: 30%; top: 44%; width: 46%; height: 30%; background: radial-gradient(closest-side, rgba(200, 110, 255, .4), rgba(90, 160, 255, .18) 60%, transparent); animation: neon-hum 2.8s ease-in-out infinite; }
.neon-carousel { left: 78%; top: 39%; width: 30%; height: 20%; background: radial-gradient(closest-side, rgba(255, 200, 120, .55), transparent); animation: bulbs 2.2s steps(2) infinite; }
.neon-lamp { width: 12%; height: 7%; background: radial-gradient(closest-side, rgba(255, 200, 120, .7), transparent); animation: neon-hum 4s ease-in-out infinite; }
.neon-boards { left: 18%; top: 72%; width: 60%; height: 16%; background: radial-gradient(closest-side, rgba(255, 140, 180, .22), rgba(140, 120, 255, .1) 60%, transparent); animation: neon-hum 3.2s ease-in-out infinite; }
@keyframes neon-hum { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes neon-flicker { 0%, 100% { opacity: .9; } 61% { opacity: .9; } 62% { opacity: .35; } 63% { opacity: .95; } 66% { opacity: .5; } 67% { opacity: .9; } }
@keyframes bulbs { 0% { opacity: .65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .neon { animation: none !important; opacity: .85; } }
html[data-reduce="1"] .neon { animation: none !important; opacity: .85; }
/* Scuttle at the Arcade: the boardwalk stays behind the table, dimmed; Bliss and the menu step out of the frame */
body.sc-arcade #arcade::after { content: ""; position: absolute; inset: 0; background: rgba(20, 18, 40, .35); }
body.sc-arcade .arc-bliss, body.sc-arcade .arc-menu, body.sc-arcade #arcade .shop-wallet, body.sc-arcade #arcadeBack { display: none; }

/* QT Beach and Snow Hills: Rest, Have Fun and Leave stacked in one column, like the other places */
.beach-choices.beach-column { flex-direction: column; gap: .5rem; }
.beach-choices.beach-column button.small { align-self: center; flex: none; padding: .3rem .8rem; font-size: .85rem; }
#beachAsk .beach-bubble { width: min(20rem, calc(100vw - 2rem)); box-sizing: border-box; }      /* the panel keeps its width when Rest and Have Fun step aside */

/* Resting at the beach or in the snow: the attendant fades, the panel glides to the bottom */
.beach-lido, .ss-comet { transition: opacity .8s ease; }
.beach-lido.fading, .ss-comet.fading { opacity: 0; }
#beachAsk .beach-bubble { transition: transform .8s ease; }
#beachAsk.anchored { transition: top .8s ease; }
@media (prefers-reduced-motion: reduce) { .beach-lido, .ss-comet, #beachAsk .beach-bubble, #beachAsk.anchored { transition: none; } }
#beachAsk.resting .beach-bubble { margin-bottom: calc(1rem + env(safe-area-inset-bottom)); }      /* resting: the panel sits fully on screen at the bottom */

/* The Arcade's token card: centered, like every shop purchase */
.overlay.pop-card { align-items: center; padding: 1rem; }
.overlay.pop-card .panel { width: min(22rem, 100%); border-bottom: var(--outline) solid var(--ink); border-radius: 1.5rem; padding-bottom: 1.1rem; text-align: center; }
.overlay.pop-card .pop-big { display: block; margin: .2rem auto .3rem; width: 8rem; height: 8rem; border: 0; background: none; box-shadow: none; }
.overlay.pop-card .pop-big img { width: 100%; height: 100%; object-fit: contain; }
.overlay.pop-card .pop-desc { font-size: .92rem; line-height: 1.35; }
.qty-input { width: 4rem; text-align: center; font: 600 1.7rem var(--font-head); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: .7rem; padding: .15rem 0; }

/* ---- Town pages: QT Central and Polarville. The pills are measured from the founder's mock-ups: centred, the same size and
   spacing in both towns, and lined up from the bottom so both towns' menus end at the same height. ---- */
.town-thumb { background-size: cover; background-position: center 70%; }
.town .town-back { z-index: 3; top: calc(.7rem + env(safe-area-inset-top)); }
.town-pills { position: absolute; z-index: 2; left: 50%; transform: translateX(-50%); bottom: 28%; width: min(84vw, calc(100vh * 941 / 1672 * .56), 22rem); width: min(84vw, calc(100dvh * 941 / 1672 * .56), 22rem); display: flex; flex-direction: column; gap: 2vh; }
/* The list of places scrolls inside its own panel if a town ever has more than fit: it never grows up over the picture or under the Back button. With the buttons there now it does not scroll at all and looks exactly as measured. */
.town-list { display: flex; flex-direction: column; gap: 2vh; padding: 3px 4px 9px; margin: -3px -4px -9px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  /* four buttons show at a time, with a hint of the fifth under the fade, then it scrolls (and never grows over the Back button on a short screen) */
  --four: calc(4 * clamp(2.8rem, 6.6vh, 3.6rem) + 3 * 2vh + 2.5rem + 12px);
  max-height: min(var(--four), calc(100vh - 28vh - 5.5rem - env(safe-area-inset-top))); max-height: min(var(--four), calc(100dvh - 28dvh - 5.5rem - env(safe-area-inset-top)));
  --ft: 0px; --fb: 0px; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%); }
.town-list::-webkit-scrollbar { display: none; }
.town-list > .town-pill { flex: none; }      /* the buttons keep their size: when the list is capped at four it scrolls, it does not squash them smaller */
.town-pill { width: 100%; height: 6.6vh; min-height: 2.8rem; max-height: 3.6rem; border-radius: 999px; font-size: clamp(1rem, 2.6vh, 1.25rem); font-weight: 700; padding: 0 1rem; }
.town-moon { position: absolute; left: 78%; top: 15.6%; width: 12%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 1.2rem .5rem rgba(255, 238, 200, .28), 0 0 3rem 1.4rem rgba(255, 230, 190, .14); }      /* a faint glow so the moon sits in the sky */
.town-moon[hidden] { display: none; }
.town-moon img { width: 100%; height: 100%; display: block; }

/* The map pin under each town's pills, so the player can change towns without going back to base */
.town-pin { position: absolute; top: 100%; left: 0; right: 0; margin: 2vh auto 0; }      /* centred by margins, so the press effect cannot push it sideways */
.town-pin:active:not(:disabled) { transform: translateY(3px); }      /* hangs below the pills, so the pills keep their measured place */
/* Darling's: pay with gold or taffy tokens */
.pay-choice { text-align: center; margin: .4rem 0 .6rem; }
.pay-choice p { margin: .15rem 0; }
.pay-head { font-weight: 700; }
.pay-or { font-weight: 700; opacity: .7; }
.pay-opt { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; cursor: pointer; }
.pay-opt input { width: 1.2rem; height: 1.2rem; accent-color: var(--button, #b5532f); }
.pay-opt:has(input:disabled) { opacity: .4; cursor: not-allowed; }

/* ---- Taffy Tumble ---- */
.tumble { position: absolute; inset: 0; z-index: 4; }
.tumble[hidden] { display: none; }
#arcade.tumbling .arc-bliss, #arcade.tumbling .arc-menu, #arcade.tumbling #arcadeBack { display: none; }
#arcade.tumbling::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(20, 18, 40, .3); pointer-events: none; }
.tumble .shop-exit { top: calc(3.6rem + env(safe-area-inset-top)); }
.tm-machine { position: absolute; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(88vw, 23rem, calc((100vh - 7.5rem) * 642 / 1015)); aspect-ratio: 642 / 1015; }
.tm-window { position: absolute; left: 17.3%; top: 31.5%; width: 64.6%; height: 34.6%; overflow: hidden; background: #123b6e; }
.tm-playfield { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.tm-pile img { position: absolute; width: 15%; height: auto; transform: translateX(-10%); }
.tm-pusher { position: absolute; left: 3%; width: 94%; top: 60%; height: auto; animation: tm-push 2.4s ease-in-out infinite; }
.tm-machine.pushing .tm-pusher { animation-duration: .6s; }
@keyframes tm-push { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14%); } }
.tm-cabinet { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#arcade.night .tm-cabinet { filter: drop-shadow(0 0 .5rem rgba(255, 170, 200, .55)); }      /* a steady glow; no fading */
.tm-slot { position: absolute; top: 23.6%; width: 13%; height: 4.4%; margin-left: -6.5%; min-height: 0; padding: 0; border-radius: .4rem; background: transparent; border: 2px dashed transparent; box-shadow: none; }
.tm-slot:not(:disabled):hover, .tm-slot:focus-visible { border-color: rgba(255, 255, 255, .8); }
.tm-fly { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.tm-piece { position: absolute; width: 9%; height: auto; }
.tm-piece.tm-card-piece { width: 14%; }
.tm-miss { position: absolute; left: 50%; top: 42%; width: min(70vw, 18rem); transform: translate(-50%, -50%); z-index: 5; }
.tm-miss.fade, .tm-toast.fade { animation: tm-fade 1.4s ease both; }
@keyframes tm-fade { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.85); } 20%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.tm-toast { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 6; margin: 0; padding: .6rem 1.1rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; font-weight: 800; }
.tm-result .panel, #tmSwap .panel { background: var(--pearl-bush); }
.tm-result.closing { animation: tm-out .35s ease both; }
@keyframes tm-out { to { opacity: 0; } }
.tm-word { display: block; width: 80%; margin: .2rem auto .6rem; }
.tm-prizes { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.tm-prize { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; }
.tm-prize img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.tm-card-prize { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin: .6rem 0; }
.tm-card-prize .card-face { width: 8.5rem; }
.tm-swap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; margin: .6rem 0; }
.tm-swap-pick { padding: 0; min-height: 0; background: none; border: 3px solid transparent; border-radius: .6rem; box-shadow: none; }
.tm-swap-pick.picked { border-color: var(--ink); }
/* ---- Cards ---- */
.card-face { position: relative; container-type: inline-size; width: 100%; aspect-ratio: 296 / 334; }      /* every card sits in the same shaped frame, so no card can come out bigger than the rest */
.card-face img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card-face.shimmer::after { content: ""; position: absolute; inset: 0; border-radius: 6%; -webkit-mask: var(--card-art) center / contain no-repeat; mask: var(--card-art) center / contain no-repeat; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 45%, rgba(255, 220, 250, .35) 50%, transparent 65%); background-size: 250% 100%; animation: holo 2.6s ease-in-out infinite; mix-blend-mode: screen; }
@keyframes holo { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .card-face.shimmer::after, .tm-pusher { animation: none; } .binder-page.flip { animation: none; } }
.card-big-panel { width: min(20rem, 90vw); }
#cardBigBody .card-face { width: 100%; }
/* ---- My Cards: the binder ---- */
.cards-screen { background: var(--kraft, #d9c3a3); }
.cards-screen .shop-exit { top: calc(.7rem + env(safe-area-inset-top)); z-index: 3; }
.binder { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); width: min(86vw, calc((100vh - 9rem) * 800 / 1189), 26rem); perspective: 1200px; }
.binder-page { position: relative; transform-origin: left center; }
.binder-page.flip { animation: page-flip .4s ease-out; }
@keyframes page-flip { from { transform: rotateY(-70deg); opacity: .4; } to { transform: rotateY(0); opacity: 1; } }
.binder-img { display: block; width: 100%; height: auto; }
.binder-contents { position: absolute; left: 16%; right: 10%; top: 12%; display: flex; flex-direction: column; gap: .7rem; align-items: stretch; }
.binder-contents h2 { text-align: center; margin: 0 0 .3rem; }
.binder-pill { display: flex; justify-content: space-between; align-items: center; height: auto; padding: .5rem 1rem; }
.binder-count { font-weight: 800; opacity: .8; }
.binder-card { position: absolute; width: 22.5%; padding: 0; min-height: 0; background: none; border: 0; box-shadow: none; }
.binder-arrows { position: absolute; left: 0; right: 0; bottom: calc(1rem + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 2.5rem; }
.binder-arrows button { width: 3.6rem; height: 3.6rem; border-radius: 50%; font-size: 1.8rem; padding: 0; }
/* The red dot for a new card */
.who { position: relative; }
.avatar-dot, .menu-dot { width: .8rem; height: .8rem; border-radius: 50%; background: #e0362c; border: 2px solid #fff; }
.avatar-dot { position: absolute; left: 2.6rem; top: .1rem; z-index: 3; pointer-events: none; }
.menu-dot { display: inline-block; margin-left: .3rem; vertical-align: middle; }
.avatar-dot[hidden], .menu-dot[hidden], .avatar-menu[hidden] { display: none; }
.avatar-menu { position: absolute; left: 0; top: 100%; z-index: 40; margin-top: .3rem; display: flex; flex-direction: column; min-width: 10.5rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; box-shadow: var(--shadow); overflow: hidden; }
.avatar-menu button { display: flex; align-items: center; gap: .55rem; padding: .7rem .9rem; min-height: 0; background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--ink); font-weight: 700; justify-content: flex-start; }
.avatar-menu button + button { border-top: 2px solid rgba(42, 34, 34, .15); }
.avatar-menu svg { width: 1.3rem; height: 1.3rem; }
.tm-swap-grid { max-height: 52vh; overflow-y: auto; padding: .2rem; }
.avatar-menu { min-width: 12rem; }
.avatar-menu button { white-space: nowrap; }

/* ---- Desktop and wide windows: the full-screen places show the whole painting as a phone-shaped frame, centred,
   instead of blowing it up to the window's width (which cut most of it off). Phones are unchanged. ---- */
@media (min-aspect-ratio: 4/5) {
  body.on-beach { background: #2b2326; }
  body.on-beach .place:not([hidden]), body.on-beach #beach:not([hidden]) {
    left: 50%; right: auto; width: min(100vw, calc(100vh * 941 / 1672)); width: min(100vw, calc(100dvh * 941 / 1672));
    transform: translateX(-50%); box-shadow: 0 0 0 100vmax #2b2326;
  }
  body.on-beach .fx-stage, body.on-beach .tr-stage { width: 100%; }      /* the train car too: it fills the frame instead of the window */
  body.on-beach .moon-stage { width: auto; height: 100%; }      /* the full-moon painting fills the frame top to bottom (no empty band of sky) */
  body.on-beach .place-scene, body.on-beach #beachScene { background-size: cover; background-position: center bottom; }
  body.on-beach .moon-ask, body.on-beach .beach-ask.anchored, body.on-beach #beachAsk .beach-bubble { max-width: calc(100% - 1rem); }
  body.on-beach .tm-machine { width: min(88%, 23rem, calc((100vh - 7.5rem) * 642 / 1015)); }
  body.on-beach .cw-machine { width: min(88%, 23rem, calc((100vh - 9.25rem) * 571 / 962)); }
  body.on-beach .town-pills { width: min(84%, 22rem); }
  body.on-beach .arc-menu { width: min(56%, 15rem); left: 3%; }
}

.tm-slot, .tm-slot:active, .tm-slot:disabled, .tm-slot:active:not(:disabled) { transform: none !important; background: transparent !important; box-shadow: none !important; opacity: 1 !important; border-color: transparent; }
.tm-slot:not(:disabled):hover, .tm-slot:focus-visible { border-color: rgba(255, 255, 255, .8); }
.tm-lure-taffy { width: 17% !important; transform: rotate(-12deg); }
.tm-lure-card { width: 13% !important; transform: rotate(8deg); }
.tm-audio { position: absolute; right: .8rem; top: calc(3.6rem + env(safe-area-inset-top)); z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.tm-sound { font-size: .85rem; padding: .3rem .8rem; }
.card-big-name { text-align: center; font-weight: 800; margin: .6rem 0 0; }

.arc-buy-max { font-weight: 800; margin-top: -.3rem; }

/* Slide switches: Calm or Fun, All or Bits */
.tm-switch { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .55rem; min-height: 0; font-size: .78rem; font-weight: 800; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; box-shadow: none; }
.tm-switch i { position: relative; width: 2.1rem; height: 1.1rem; border-radius: 999px; background: #e7c2cf; border: 2px solid var(--ink); }
.tm-switch i::after { content: ""; position: absolute; top: 50%; left: .12rem; width: .8rem; height: .8rem; border-radius: 50%; background: #c4406d; transform: translateY(-50%); transition: left .2s ease; }
.tm-switch[aria-checked="true"] i::after { left: calc(100% - .92rem); }
.tm-switch[aria-checked="false"] span:first-child, .tm-switch[aria-checked="true"] span:last-child { color: #c4406d; }
.tm-switch:active:not(:disabled) { transform: none; box-shadow: none; }
.tm-switch:disabled { opacity: .45; background: var(--paper); color: var(--ink); border-color: var(--ink); }

/* Blissful Chance, the claw machine. One art unit is 1/571 of the cabinet's width; the window is 403 x 387 at (81, 277). */
.claw { position: absolute; inset: 0; z-index: 4; }
.claw[hidden] { display: none; }
.claw .shop-exit { top: calc(3.6rem + env(safe-area-inset-top)); }
.cw-machine { position: absolute; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(88vw, 23rem, calc((100vh - 9.25rem) * 571 / 962)); aspect-ratio: 571 / 962; container-type: inline-size; }
.cw-art { position: absolute; inset: 0; --u: calc(100cqw / 571); }
.cw-hint { position: absolute; left: 50%; bottom: calc(100% + .3rem); transform: translateX(-50%); width: 100%; margin: 0; text-align: center; font-weight: 800; font-size: .9rem; white-space: nowrap; color: #fff; text-shadow: 0 1px 3px rgba(20, 18, 40, .8); min-height: 1.2em; }
.cw-window { position: absolute; left: calc(81 * var(--u)); top: calc(277 * var(--u)); width: calc(403 * var(--u)); height: calc(387 * var(--u)); overflow: hidden; touch-action: none; }
.cw-back { position: absolute; left: calc(-81 * var(--u)); top: calc(-277 * var(--u)); width: calc(571 * var(--u)); height: calc(962 * var(--u)); max-width: none; }
.cw-caps { position: absolute; inset: 0; }
.cw-cap { position: absolute; width: calc(70 * var(--u)); height: auto; left: calc((var(--x) - 35) * var(--u)); top: calc(var(--y) * var(--u)); }
.cw-cap.held { z-index: 100 !important; }
.cw-cap.pop { animation: cw-pop .45s ease-out both; }
.cw-rig { position: absolute; inset: 0; --cx: 204; --cy: 105; pointer-events: none; z-index: 300; }
.cw-trolley { position: absolute; width: calc(92.4 * var(--u)); height: auto; left: calc((var(--cx) - 46.2) * var(--u)); top: calc(28 * var(--u)); z-index: 3; }
.cw-cable { position: absolute; width: calc(5 * var(--u)); left: calc((var(--cx) - 2.5) * var(--u)); top: calc(84 * var(--u)); height: calc((var(--cy) - 76) * var(--u)); background: linear-gradient(90deg, #5c616b, #c3c7cf 45%, #5c616b); border-radius: 2px; z-index: 2; }
.cw-claw { position: absolute; height: auto; left: calc(var(--cx) * var(--u)); top: calc(var(--cy) * var(--u)); z-index: 4; }
.cw-claw.open { width: calc(116 * var(--u)); margin-left: calc(-58 * var(--u)); }
.cw-claw.closed { width: calc(84.3 * var(--u)); margin-left: calc(-44.3 * var(--u)); }
.cw-sticker { position: absolute; left: 50%; top: 46%; width: 78%; height: auto; transform: translate(-50%, -50%); z-index: 500; pointer-events: none; }
.cw-sticker.show { animation: cw-sticker .4s cubic-bezier(.2, 1.4, .4, 1) both; }
.cw-front { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.cw-btn, .cw-btn:active, .cw-btn:disabled, .cw-btn:active:not(:disabled) { position: absolute; top: calc(715 * var(--u)); width: calc(140 * var(--u)); height: calc(140 * var(--u)); min-height: 0; padding: 0; border-radius: 50%; background: transparent !important; border: 0; box-shadow: none !important; transform: none !important; opacity: 1 !important; z-index: 6; }
.cw-play { left: calc(181 * var(--u)); }
.cw-drop { left: calc(350 * var(--u)); }
.cw-btn.cue:not(:disabled) { animation: cw-cue 1.4s ease-in-out infinite; }
.cw-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.cw-token { position: absolute; left: calc(95 * var(--u)); top: calc(640 * var(--u)); width: calc(40 * var(--u)); height: auto; z-index: 7; pointer-events: none; }
.cw-token.fall { animation: cw-token .5s ease-in both; }
.cw-book img { width: 3.6rem; height: 3.6rem; }
.cw-book b { font-size: 1rem; text-align: left; }
#cwToast.fade { animation: tm-fade 1.4s ease both; }
@keyframes cw-pop { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes cw-sticker { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes cw-cue { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .0) !important; } 50% { box-shadow: 0 0 0 calc(6 * var(--u)) rgba(255, 255, 255, .55) !important; } }
@keyframes cw-token { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(calc(130 * var(--u))); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cw-btn.cue:not(:disabled), .cw-cap.pop, .cw-sticker.show { animation: none; } }
/* The contents page: everything stays inside the page's inner border (measured at 15% to 91% of the page), with room to spare */
.binder-contents { left: 19%; right: 17%; }
.binder-pill { box-sizing: border-box; width: 100%; max-width: 100%; font-size: clamp(.85rem, 3.6vw, 1.05rem); }

.settings-back { display: inline-block; margin: 0 0 .8rem; }
#beach[data-scene="snow-night"] #beachAsk .beach-bubble { margin-bottom: calc(1rem + env(safe-area-inset-bottom)); }      /* no attendant at night: the panel sits fully on screen */

/* ---- Guild Look-Up button and the Player Look-Up ---- */
.guild-lookup { display: block; width: 11.5rem; margin: 0 auto .9rem; padding: .55rem 0; }      /* the same size either way, so Back to Base lands exactly where Guild Look-Up was */
.lu-head { display: flex; gap: 1rem; align-items: center; }
.lu-avatar { flex: 0 0 auto; width: min(200px, 52vw); aspect-ratio: 1; border-radius: 1.2rem; border: var(--outline) solid var(--ink); background: var(--cream); overflow: hidden; display: grid; place-items: center; }
.lu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lu-info { min-width: 0; }
.lu-info h2 { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.lu-info p { margin: .25rem 0; font-size: 1.05rem; }
.lu-actions { display: flex; gap: .5rem; margin-top: .9rem; width: min(200px, 52vw); justify-content: space-between; flex-wrap: nowrap; }
.lu-act { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem .1rem; min-height: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: .8rem; box-shadow: none; }
.lu-act svg { width: 1.5rem; height: 1.5rem; }
.lu-act span { font: 600 .68rem var(--font-body); }
.lu-act:disabled { background: var(--paper); color: var(--ink); opacity: .45; border-color: var(--ink); }
.lu-team { display: flex; flex-direction: column; gap: .8rem; }
.lu-member { display: flex; gap: .8rem; align-items: center; }
.lu-portrait { flex: 0 0 auto; width: 4.6rem; height: 4.6rem; border-radius: 1rem; border: 2px solid var(--ink); background: var(--cream); overflow: hidden; }
.lu-portrait img { width: 100%; height: 100%; object-fit: cover; }
.lu-member-info .tags { margin-bottom: .3rem; }
.lu-badges { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; min-height: 2.2rem; }
.lu-badges img { width: 2.2rem; height: 2.2rem; object-fit: contain; }
.lu-confirm-row { display: flex; gap: .6rem; justify-content: center; margin-top: .8rem; }
#luReason { width: 100%; box-sizing: border-box; font: inherit; border: 2px solid var(--ink); border-radius: .7rem; padding: .5rem; }
.lu-paw { width: 55%; height: 55%; display: grid; place-items: center; }
.lu-paw svg { width: 100%; height: 100%; }
.lu-paw[hidden] { display: none; }

/* ---- Ghost Post ---- */
.ghost-btn { position: absolute; right: calc(50% + 2.2rem + .9rem); bottom: calc(.7rem + env(safe-area-inset-bottom)); }      /* to the left of the map pin, which stays centred */
.town-ghost { bottom: auto; top: 100%; margin-top: 2vh; }
.ghost-btn svg { width: 2.4rem; height: 2.4rem; }
.gp-dot { position: absolute; top: .2rem; right: .2rem; width: .85rem; height: .85rem; border-radius: 50%; background: #e0362c; border: 2px solid #fff; }
.gp-dot[hidden] { display: none; }
.gp-wall { height: auto; aspect-ratio: 1024 / 862; background: #e6e3ee repeating-linear-gradient(90deg, transparent 0 46px, rgba(90, 95, 140, .08) 46px 48px); }
.gp-floor { height: 11.6%; background: #c0703d; }
.gp-body { padding: .8rem 1rem 6rem; }
.gp-title { margin: .2rem 0 .6rem; text-align: center; }
/* The player Look-Up is one pill: the field, then an orange magnifier button attached at its end */
.gp-search { display: flex; align-items: stretch; overflow: hidden; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); }
.gp-search:focus-within { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.gp-search input { flex: 1; min-width: 0; font: inherit; padding: .55rem .9rem; border: 0; border-radius: 0; background: transparent; outline: none; }
.gp-search button { flex: none; display: grid; place-items: center; width: 3.5rem; min-height: 0; padding: 0; border: 0; border-left: 2px solid var(--ink); border-radius: 0; box-shadow: none; }
.gp-search button svg { width: 1.55rem; height: 1.55rem; }
.gp-search button:active:not(:disabled) { transform: none; filter: brightness(.9); }
.gp-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0; }
.gp-tabs button { padding-left: .2rem; padding-right: .2rem; }
.gp-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.gp-panel { display: flex; flex-direction: column; gap: .4rem; }
.gp-line { display: flex; gap: .6rem; align-items: baseline; width: 100%; text-align: left; padding: .65rem .8rem; min-height: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: .8rem; box-shadow: none; font-weight: 400; }
.gp-line b { flex: 0 0 auto; }
.gp-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-line.unread { font-weight: 800; border-color: #b5532f; }
.gp-line.unread b::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #e0362c; margin-right: .4rem; vertical-align: middle; }
.gp-panel h3 { margin: .8rem 0 .2rem; }
.gp-ab-row { display: flex; gap: .4rem; align-items: center; }
.gp-name { flex: 1; text-align: left; background: none; border: 0; box-shadow: none; color: var(--ink); font-weight: 800; padding: .3rem 0; min-height: 0; text-decoration: underline; }
.gp-ab-row button:not(.gp-name) { padding: .3rem .8rem; font-size: .85rem; min-height: 0; }
.gp-setting { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; font-weight: 700; }
.gp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .6rem; margin: .6rem 0; max-height: 55vh; overflow-y: auto; }
.gp-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .5rem; min-height: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: .8rem; box-shadow: none; }
.gp-tile b { font-size: .8rem; }
.gp-qty { position: absolute; top: .3rem; right: .3rem; z-index: 1; padding: .05rem .45rem; font-weight: 800; font-size: .78rem; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 1rem; }
.gp-sheet-wrap { align-items: center; padding: .8rem; }
.overlay.gp-sheet-wrap { background: rgba(28, 22, 26, .9); }      /* dark enough that the room behind never shows through the letter */
.gp-sheet-actions { display: flex; justify-content: space-between; margin-top: .6rem; }
.gp-field { margin: .25rem 0; }
.gp-read-tools { display: flex; justify-content: flex-end; gap: .4rem; }
.gp-mini { padding: .2rem .7rem; min-height: 0; font-size: .78rem; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 999px; box-shadow: none; }

/* Expertise badges: the badge art, with its stars drawn as little star stickers */
.star-art { display: inline-flex; gap: 1px; letter-spacing: 0; }
.star-art img { width: 1.15rem; height: 1.15rem; object-fit: contain; }
.star-art img.star-off { opacity: .22; filter: grayscale(1); }
.badge-big { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.badge-big img:first-child { width: min(10rem, 50vw); height: auto; }
.badge-big .star-art img { width: 1.7rem; height: 1.7rem; }
.medal.has-img { border: 0; background: none !important; border-radius: 0; width: 5.2rem; height: 5.2rem; }      /* the new badge art has its own frame */
.medal.has-img img { object-fit: contain; }

/* ---- Signature Stationary: Memo's shop (proportions from the founder's mock-up, 1024 x 862) ---- */
.ss-wall { height: auto; aspect-ratio: 1024 / 862; background: #5d566a repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 10px, rgba(0, 0, 0, .14) 10px 20px, rgba(255, 255, 255, .03) 20px 34px); }
.ss-floor { height: 11.6%; background: #b793a4; }
.ss-keeper { left: 48.84%; bottom: 3.5%; width: 70.7%; height: auto; max-width: none; }
.ss-buy-box { display: block; width: 9rem; height: auto; margin: .2rem auto .4rem; }
.ss-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin: .5rem 0; }
.ss-pack { display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .45rem .2rem; min-height: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: .8rem; box-shadow: none; font-weight: 400; }
.ss-pack[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.ss-pack i { font-style: normal; font-size: .72rem; opacity: .85; }
.ss-pack:active:not(:disabled) { transform: none; }



/* ---- Ghost Post polish: the letter and its conversation, inbox status and date, sheet counts, the Address Book dot ---- */
.gp-stack { width: min(30rem, 100%); max-height: 94vh; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; }
.gp-stack > .gp-sheet { flex: none; width: 100%; max-height: none; overflow: visible; }
.gp-stack > .gp-chain { margin-top: 0; padding-bottom: .5rem; }
.gp-chain-title { margin: .2rem 0 0; color: #fff; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.gp-date { flex: 0 0 auto; font-style: normal; font-weight: 700; font-size: .85em; opacity: .75; }
.gp-line span { flex: 1 1 auto; min-width: 0; }
.gp-status { flex: 0 0 auto; font-style: normal; font-size: .72rem; font-weight: 800; padding: .1rem .5rem; border: 2px solid; border-radius: 1rem; }
.gp-status.unread { color: #b5342a; background: #fde2de; border-color: #b5342a; }
.gp-status.read { color: #6d625f; background: #eee7e0; border-color: #9a8f8c; }
.gp-status.replied { color: #2f6b34; background: #dff0dc; border-color: #2f6b34; }
.gp-tabs button { position: relative; }
.gp-last { font-style: normal; font-size: .7rem; font-weight: 800; color: #fff; background: #b5532f; border-radius: 1rem; padding: .05rem .5rem; }
.ss-pack.full { opacity: .45; cursor: not-allowed; }
.shop-price { font-weight: 700; }

/* ---- Letters: every stationery is a paper with a decorative frame (art/stationery/sheet-*.webp, from the founder's finals).
   The letter sits in the frame's open middle (--st-a*), the To / Subject header sits above the sheet, and the sheet keeps its true 3:4 shape. ---- */
.st-blank-slate { --st-head-bg: var(--paper); --st-head-line: var(--ink); --st-head-ink: var(--ink); --st-ax: 8%; --st-ay: 7%; --st-aw: 84%; --st-ah: 86%; --st-ink: #000; --st-font: Arial, Helvetica, sans-serif; --st-fs: 1; }
.st-artistic { --st-sheet: url('art/stationery/sheet-artistic.webp'); --st-thumb: url('art/stationery/thumb-artistic.webp'); --st-ax: 21.9%; --st-ay: 25.0%; --st-aw: 62.0%; --st-ah: 40.2%; --st-ink: #6a3d7a; --st-font: 'Satisfy', Georgia, serif; --st-fs: 1.15; --st-head-bg: #fae4cb; --st-head-line: #e46c3c; --st-head-ink: #6a3d7a; }
.st-botanical { --st-sheet: url('art/stationery/sheet-botanical.webp'); --st-thumb: url('art/stationery/thumb-botanical.webp'); --st-ax: 15.1%; --st-ay: 36.3%; --st-aw: 55.2%; --st-ah: 40.2%; --st-ink: #3e5130; --st-font: 'Lora', Georgia, serif; --st-fs: 1; --st-head-bg: #fce5ca; --st-head-line: #6c6c24; --st-head-ink: #3e5130; }
.st-crafty { --st-sheet: url('art/stationery/sheet-crafty.webp'); --st-thumb: url('art/stationery/thumb-crafty.webp'); --st-ax: 11.5%; --st-ay: 16.8%; --st-aw: 76.0%; --st-ah: 54.7%; --st-ink: #8a3b3b; --st-font: 'Gochi Hand', Georgia, serif; --st-fs: 1.05; --st-head-bg: #f9e0c6; --st-head-line: #b43c24; --st-head-ink: #8a3b3b; }
.st-dungeon { --st-sheet: url('art/stationery/sheet-dungeon.webp'); --st-thumb: url('art/stationery/thumb-dungeon.webp'); --st-ax: 16.7%; --st-ay: 19.5%; --st-aw: 66.1%; --st-ah: 60.9%; --st-ink: #4a3420; --st-font: 'MedievalSharp', Georgia, serif; --st-fs: 1; --st-head-bg: #fad29d; --st-head-line: #6c3c0c; --st-head-ink: #4a3420; }
.st-elegant { --st-sheet: url('art/stationery/sheet-elegant.webp'); --st-thumb: url('art/stationery/thumb-elegant.webp'); --st-ax: 16.1%; --st-ay: 16.0%; --st-aw: 66.1%; --st-ah: 68.0%; --st-ink: #5b1a24; --st-font: 'Cormorant Garamond', Georgia, serif; --st-fs: 1.15; --st-head-bg: #fce6c9; --st-head-line: #8b6321; --st-head-ink: #5b1a24; }
.st-goth { --st-sheet: url('art/stationery/sheet-goth.webp'); --st-thumb: url('art/stationery/thumb-goth.webp'); --st-ax: 16.1%; --st-ay: 14.5%; --st-aw: 67.7%; --st-ah: 66.4%; --st-ink: #3a1f3a; --st-font: 'IM Fell English', Georgia, serif; --st-fs: 1.05; --st-head-bg: #f2cfca; --st-head-line: #6c3c3c; --st-head-ink: #3a1f3a; }
.st-holiday { --st-sheet: url('art/stationery/sheet-holiday.webp'); --st-thumb: url('art/stationery/thumb-holiday.webp'); --st-ax: 19.3%; --st-ay: 16.4%; --st-aw: 60.4%; --st-ah: 62.1%; --st-ink: #7a1f1f; --st-font: 'Mountains of Christmas', Georgia, serif; --st-fs: 1; --st-head-bg: #fbe1c0; --st-head-line: #cc843c; --st-head-ink: #7a1f1f; }
.st-kawaii { --st-sheet: url('art/stationery/sheet-kawaii.webp'); --st-thumb: url('art/stationery/thumb-kawaii.webp'); --st-ax: 15.6%; --st-ay: 17.6%; --st-aw: 67.2%; --st-ah: 53.5%; --st-ink: #a3486b; --st-font: 'Mali', Georgia, serif; --st-fs: 1; --st-head-bg: #fcdfd3; --st-head-line: #fc8484; --st-head-ink: #a3486b; }
.st-lady-luck { --st-sheet: url('art/stationery/sheet-lady-luck.webp'); --st-thumb: url('art/stationery/thumb-lady-luck.webp'); --st-ax: 14.1%; --st-ay: 19.1%; --st-aw: 74.0%; --st-ah: 51.2%; --st-ink: #7a1c1c; --st-font: 'Rye', Georgia, serif; --st-fs: 0.92; --st-head-bg: #fcddbb; --st-head-line: #cc3c24; --st-head-ink: #7a1c1c; }
.st-minimalist { --st-sheet: url('art/stationery/sheet-minimalist.webp'); --st-thumb: url('art/stationery/thumb-minimalist.webp'); --st-ax: 9.4%; --st-ay: 12.1%; --st-aw: 81.8%; --st-ah: 57.8%; --st-ink: #444444; --st-font: 'Work Sans', Georgia, serif; --st-fs: 1; --st-head-bg: #fbe5cc; --st-head-line: #cc8454; --st-head-ink: #444444; }
.st-neon { --st-sheet: url('art/stationery/sheet-neon.webp'); --st-thumb: url('art/stationery/thumb-neon.webp'); --st-ax: 14.1%; --st-ay: 18.8%; --st-aw: 71.4%; --st-ah: 60.9%; --st-ink: #ffe0fa; --st-font: 'VT323', Georgia, serif; --st-fs: 1.3; --st-head-bg: #7e4ea0; --st-head-line: #fcfc9c; --st-head-ink: #ffe0fa; }
.st-coastal { --st-sheet: url('art/stationery/sheet-coastal.webp'); --st-thumb: url('art/stationery/thumb-coastal.webp'); --st-ax: 10.9%; --st-ay: 16.8%; --st-aw: 79.2%; --st-ah: 61.7%; --st-ink: #24476b; --st-font: 'Shadows Into Light Two', Georgia, serif; --st-fs: 1.2; --st-head-bg: #fbe1c4; --st-head-line: #546c84; --st-head-ink: #24476b; }
.st-rainbow { --st-sheet: url('art/stationery/sheet-rainbow.webp'); --st-thumb: url('art/stationery/thumb-rainbow.webp'); --st-ax: 22.9%; --st-ay: 18.0%; --st-aw: 62.5%; --st-ah: 47.7%; --st-ink: #6a4b8a; --st-font: 'Fredoka', Georgia, serif; --st-fs: 1; --st-head-bg: #fcdeb9; --st-head-line: #843c84; --st-head-ink: #6a4b8a; }
.st-rainy-day { --st-sheet: url('art/stationery/sheet-rainy-day.webp'); --st-thumb: url('art/stationery/thumb-rainy-day.webp'); --st-ax: 9.9%; --st-ay: 28.5%; --st-aw: 79.7%; --st-ah: 40.2%; --st-ink: #36507a; --st-font: 'Indie Flower', Georgia, serif; --st-fs: 1.05; --st-head-bg: #f9e5d1; --st-head-line: #6c3c24; --st-head-ink: #36507a; }
.st-rustic { --st-sheet: url('art/stationery/sheet-rustic.webp'); --st-thumb: url('art/stationery/thumb-rustic.webp'); --st-ax: 19.8%; --st-ay: 18.8%; --st-aw: 70.8%; --st-ah: 53.1%; --st-ink: #5a3b22; --st-font: 'Kalam', Georgia, serif; --st-fs: 1; --st-head-bg: #fde0bc; --st-head-line: #cc843c; --st-head-ink: #5a3b22; }
.st-stark-modern { --st-sheet: url('art/stationery/sheet-stark-modern.webp'); --st-thumb: url('art/stationery/thumb-stark-modern.webp'); --st-ax: 8.3%; --st-ay: 25.4%; --st-aw: 71.4%; --st-ah: 50.4%; --st-ink: #111111; --st-font: 'Space Grotesk', Georgia, serif; --st-fs: 1; --st-head-bg: #f6e6d4; --st-head-line: #6c3c3c; --st-head-ink: #111111; }
.st-starlit { --st-sheet: url('art/stationery/sheet-starlit.webp'); --st-thumb: url('art/stationery/thumb-starlit.webp'); --st-ax: 16.1%; --st-ay: 20.3%; --st-aw: 68.2%; --st-ah: 52.3%; --st-ink: #3d3470; --st-font: 'Quicksand', Georgia, serif; --st-fs: 1; --st-head-bg: #fbe5cb; --st-head-line: #cc846c; --st-head-ink: #3d3470; }
.st-treasure-hunter { --st-sheet: url('art/stationery/sheet-treasure-hunter.webp'); --st-thumb: url('art/stationery/thumb-treasure-hunter.webp'); --st-ax: 13.0%; --st-ay: 14.5%; --st-aw: 59.4%; --st-ah: 48.4%; --st-ink: #5a3a1a; --st-font: 'Pirata One', Georgia, serif; --st-fs: 1.12; --st-head-bg: #fbd095; --st-head-line: #843c0c; --st-head-ink: #5a3a1a; }
.st-valentine { --st-sheet: url('art/stationery/sheet-valentine.webp'); --st-thumb: url('art/stationery/thumb-valentine.webp'); --st-ax: 10.4%; --st-ay: 20.3%; --st-aw: 78.1%; --st-ah: 55.5%; --st-ink: #9a3050; --st-font: 'Dancing Script', Georgia, serif; --st-fs: 1.2; --st-head-bg: #fedfd1; --st-head-line: #cc5454; --st-head-ink: #9a3050; }
.st-whimsical { --st-sheet: url('art/stationery/sheet-whimsical.webp'); --st-thumb: url('art/stationery/thumb-whimsical.webp'); --st-ax: 9.9%; --st-ay: 23.8%; --st-aw: 79.7%; --st-ah: 46.1%; --st-ink: #3b4f7a; --st-font: 'Sniglet', Georgia, serif; --st-fs: 0.95; --st-head-bg: #fce8d0; --st-head-line: #b45454; --st-head-ink: #3b4f7a; }
.gp-tile-paper { width: 100%; aspect-ratio: 3 / 4; border-radius: .35rem; background: var(--st-thumb, none) center / contain no-repeat; }
.gp-tile.st-blank-slate .gp-tile-paper { background: #fff; border: 1px solid #bbb; }
.gp-head { padding: .55rem .8rem; background: var(--st-head-bg, var(--paper)); color: var(--st-head-ink, var(--ink)); border: 2px solid var(--st-head-line, var(--ink)); border-radius: .9rem; }      /* the pill takes the stationery's own colours */
.gp-head label { display: flex; gap: .5rem; align-items: center; margin: .15rem 0; font-weight: 700; }
.gp-head input { flex: 1; min-width: 0; font: inherit; padding: .3rem .4rem; border: 0; border-bottom: 2px solid var(--st-head-line, var(--ink)); border-radius: 0; background: transparent; color: inherit; }
.gp-head input[readonly] { border-bottom-color: transparent; }
.gp-head .gp-field { margin: .15rem 0; overflow-wrap: anywhere; }
.gp-head .gp-read-tools { margin-bottom: .1rem; }
.gp-sheet { width: 100%; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .35)); }
.gp-page { position: relative; width: 100%; aspect-ratio: 3 / 4; container-type: inline-size; background: var(--st-sheet, none) center / 100% 100% no-repeat; color: var(--st-ink); font-family: var(--st-font); }
.st-blank-slate .gp-page { background: #fff; border-radius: .5rem; }
.gp-write { position: absolute; left: var(--st-ax); top: var(--st-ay); width: var(--st-aw); height: var(--st-ah); box-sizing: border-box; margin: 0; padding: .35rem .45rem; border: 0; border-radius: .3rem; background: transparent; color: inherit; font: inherit; font-size: calc(var(--st-fs, 1) * .95rem); line-height: 1.45; resize: none; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
@supports (font-size: 1cqw) { .gp-write { font-size: calc(var(--st-fs, 1) * max(.85rem, 4.1cqw)); } }
textarea.gp-write:focus-visible { outline: 1.5px dashed color-mix(in srgb, currentColor 28%, transparent); outline-offset: -3px; }
.gp-count { margin: .1rem .4rem 0; text-align: right; font-size: .8rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.gp-chain { display: flex; flex-direction: column; gap: .8rem; margin-top: .2rem; }
.gp-chain-head { margin: 0 .3rem .3rem; font-size: .8rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.gp-sheet-actions { padding: 0 .2rem; }


/* ---- Ghost Post: the Address Book's sections are separate pills; Exit sits at the top left of a letter; the reply row ---- */
.gp-panel { gap: .8rem; }
.gp-ab-card { display: flex; flex-direction: column; gap: .35rem; padding: .6rem .8rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 1rem; }
.gp-ab-card h3 { margin: 0 0 .1rem; }
.gp-setting.gp-ab-card { flex-direction: row; justify-content: space-between; align-items: center; padding: .6rem .8rem; }
.gp-read-tools { align-items: center; }
.gp-spacer { flex: 1; }
.gp-reply-row { justify-content: flex-end; }


/* ---- Name tags: a little black tag with white letters on the top edge of a speaker's frame, at its left end (from the founder's Aurora mock-up:
   the tag is ~31% of the frame's height, a third of it above the edge, 0.65 tag-heights in from the left) ---- */
.shop-bubble[data-name]:not([data-name=""])::before, .beach-bubble[data-name]:not([data-name=""])::before {
  content: attr(data-name); position: absolute; left: 1.15em; top: 0; transform: translateY(-32%); z-index: 3;
  padding: .3em .7em; background: #111; color: #fff; border-radius: 999px;
  font: 800 .95em/1.2 var(--font-head); letter-spacing: .01em; white-space: nowrap; pointer-events: none;
}
.beach-bubble[data-name]:not([data-name=""])::before { font-size: 1.05rem; }      /* the beach frames have larger text, so the tag does too */
#beachAsk.resting .beach-bubble::before { display: none; }      /* resting: the attendant has gone, so has the name */
#arcBubble { top: 74%; left: 68%; right: 3%; max-width: none; }      /* beside Bliss's hip; the page then places it exactly from her picture */
body.sc-arcade #arcBubble, #arcade.tumbling #arcBubble { display: none; }      /* not over a game */
/* the text starts below the tag, as in the mock-up (the tag dips ~0.68 of its height into the frame) */
.shop-bubble[data-name]:not([data-name=""]) { padding-top: 1.45rem; }
.beach-bubble[data-name]:not([data-name=""]) { padding-top: 1.55rem; }
#beachAsk.resting .beach-bubble { padding-top: .8rem; }
/* a tag on the right end of the top edge, when the speaker stands to that side of the frame */
.shop-bubble[data-name][data-side="right"]:not([data-name=""])::before, .beach-bubble[data-name][data-side="right"]:not([data-name=""])::before { left: auto; right: 1.15em; }

/* ---- Taffy Tumble's rules screen: the Jackpot picture, with the twelve Gen 1 cards that can drop under it ---- */
.tm-rules-jackpot { display: block; width: min(100%, 10.5rem); height: auto; margin: .2rem auto .1rem; }
.tm-rules-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; width: 93%; margin: .1rem auto .5rem; }
.tm-rules-cards .card-face { width: 100%; }
/* a popup's text scrolls by itself and its buttons stay fixed underneath, so they are always in reach however long the text is (Scuttle's rules, Taffy Tumble's) */
#scPopup .panel { display: flex; flex-direction: column; }
#scPopup #scPopBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#scPopup #scPopButtons { flex: none; padding-top: .6rem; }
#scPopup .panel { max-height: 94vh; }      /* a little more room for long popups */

#ridleyScene.night-dim { filter: brightness(.55) saturate(.85); }      /* until the night picture arrives, night shows the day picture, dimmed */

/* ---- Little City: Buggingham Palace. The guards' places were measured from the founder's mock-up by matching it to the artwork (feet on one line, 76% down). ---- */
.pal-guard { position: absolute; display: block; height: auto; transition: opacity .7s ease; }
#palGuard1 { left: 15.46%; top: 61.7%; width: 17.08%; }
#palGuard2 { left: 71.56%; top: 61.7%; width: 17.08%; }
#palGuard2Doze { left: 70.43%; top: 62.2%; width: 19.04%; opacity: 0; }
#palace.dozing #palGuard2 { opacity: 0; }
#palace.dozing #palGuard2Doze { opacity: 1; }
#palBubble { left: 30.5%; top: 65%; right: auto; width: 35%; max-width: none; pointer-events: auto; }      /* at Guard #1's waist, beside him, not floating above his head */
@media (prefers-reduced-motion: reduce) { .pal-guard { transition: none; } }

/* ---- Little City: Mel's Taffy Cart. Measured from the founder's mock-up by matching it to the artwork. ---- */
.cart-mel { position: absolute; display: block; left: 30.76%; top: 36.42%; width: 63.43%; height: auto; }
#cartBubble { left: 45.7%; top: 65.78%; right: auto; width: 32.2%; max-width: none; pointer-events: auto; }
.cart-tiles { position: absolute; left: 5.08%; top: 34.33%; width: 32.23%; height: 51.96%; display: flex; flex-direction: column; justify-content: space-between; pointer-events: auto; }
.cart-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 0 0 32.49%; width: 100%; box-sizing: border-box; padding: .35rem .4rem .5rem; background: #fff; color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1.6rem; box-shadow: 0 .2rem 0 rgba(42, 34, 34, .25); font: inherit; font-weight: 700; text-align: center; line-height: 1.15; cursor: pointer; }
.cart-pic { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 0; }
.cart-taffy { width: 26%; height: auto; transform: translateY(.2rem); }      /* the taffy is drawn tiny: 1/18 */
.cart-name { font-size: .88rem; }
.cart-price { font-size: .88rem; margin-top: .15rem; }
.cart-pop { text-align: center; }
.cart-pop-pic { width: 3.4rem; height: auto; margin: .2rem auto .3rem; display: block; transform: scale(.55); }
.cart-who { display: block; margin: .6rem 0; font-weight: 700; }
.cart-who select { font: inherit; margin-left: .4rem; padding: .25rem .4rem; border: var(--outline) solid var(--ink); border-radius: .7rem; background: #fff; }
.cart-qty { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: .4rem 0; }
.cart-qty button { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: var(--outline) solid var(--ink); background: #fff; color: var(--ink); padding: 0; display: flex; align-items: center; justify-content: center; font: inherit; font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.cart-qty button:disabled { opacity: .35; cursor: default; }
.art.mini .art-img { transform: scale(.3); }      /* Mel's 1/18 taffy in the inventory: as small as it can be and still be read */
.flavor-row img.mini { transform: scale(.3); }

/* ---- Tiny hats ---- */
.portrait .pop, .art.has-img.popout .pop { container-type: inline-size; }      /* so a hat can be placed in the picture's own units: 128% of the box is the 400px-wide picture */
.portrait .pop img.art-hat, .art.has-img.popout .pop img.art-hat {
  position: absolute; inset: auto; display: block; height: auto; max-width: none; object-fit: contain; border-radius: 0; pointer-events: none;
  width: calc(var(--hw) / 400 * 128cqw); left: calc(50% + (var(--hx) - 200) / 400 * 128cqw); bottom: calc((330 - var(--hy)) / 400 * 128cqw);
  transform-origin: 50% calc(var(--hp) * 100%); transform: translate(-50%, calc((1 - var(--hp)) * 100%)) rotate(calc(var(--ht) * 1deg));
}
.portrait .pop img.art-hat[hidden], .art.has-img.popout .pop img.art-hat[hidden] { display: none; }
.head-slot { display: flex; flex-direction: row; justify-content: center; align-items: flex-start; gap: .9rem; padding: 1.1rem 0 1.5rem; margin: .2rem 0 .9rem; border-bottom: 2px dotted #d9c3b1; }
.head-slot[hidden], .slot-cell[hidden] { display: none; }
.slot-cell { display: flex; flex-direction: column; align-items: center; gap: .45rem; }
.head-label { font: 700 1rem/1 var(--font-head); color: var(--ink); }
.head-box { position: relative; width: min(6.6rem, 23vw); height: min(6.6rem, 23vw); padding: .4rem; border: 2px dashed #c9ad98; border-radius: 1rem; background: rgba(246, 240, 234, .65); display: grid; place-items: center; cursor: pointer; }
.head-box:focus-visible { outline: 3px solid var(--button); outline-offset: 2px; }
.head-hat { position: absolute; inset: .45rem; width: calc(100% - .9rem); height: calc(100% - .9rem); object-fit: contain; filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .25)); }
.overlay.hat-overlay { align-items: center; padding: 1rem; }
.hat-panel { position: relative; width: min(30rem, 100%); max-height: min(34rem, 92dvh); display: flex; flex-direction: column; padding: 1rem 1rem 1.1rem; border-bottom: var(--outline) solid var(--ink); border-radius: 1.5rem; }
.hat-panel h2 { margin: 0 2.2rem .6rem 0; font-size: 1.15rem; }
.hat-body { display: flex; gap: .9rem; align-items: flex-start; min-height: 0; }
.hat-left { flex: none; width: 8.4rem; text-align: center; }
.portrait.hat-preview { margin: 1.3rem auto .5rem; transform: none; width: 7.2rem; height: 7.2rem; }
.hat-name { margin: 0; font-weight: 700; font-size: .92rem; min-height: 1.2rem; }
.hat-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; max-height: 15rem; overflow-y: auto; padding: .15rem; -webkit-overflow-scrolling: touch; }
.hat-tile { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .35rem .25rem; border: 2px solid #d9c3b1; border-radius: .9rem; background: #fff; color: var(--ink); font: inherit; cursor: pointer; text-align: center; }
.hat-tile.selected { border-color: var(--button); box-shadow: 0 0 0 2px var(--button); }
.hat-tile:disabled { opacity: .5; cursor: default; }
.hat-tile-name { font-size: .78rem; font-weight: 700; line-height: 1.15; }
.hat-by { font-size: .7rem; color: var(--quiet); }
.hat-msg { margin: .6rem 0 0; color: #a3241a; font-weight: 700; font-size: .9rem; }
.hat-msg[hidden] { display: none; }
.hat-foot { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: .8rem; }
.hat-confirm { display: block; margin: 0 0 0 auto; }

/* a hat on a Look-Up portrait: the picture fills the square box from top to bottom, so one picture pixel is 1/330 of the box's height */
.lu-portrait { position: relative; container-type: size; }
.lu-portrait img.art-hat { position: absolute; inset: auto; display: block; height: auto; max-width: none; object-fit: contain; pointer-events: none;
  width: calc(var(--hw) * 100cqh / 330); left: calc(50% + (var(--hx) - 200) * 100cqh / 330); bottom: calc((330 - var(--hy)) * 100cqh / 330);
  transform-origin: 50% calc(var(--hp) * 100%); transform: translate(-50%, calc((1 - var(--hp)) * 100%)) rotate(calc(var(--ht) * 1deg)); }
.lu-portrait img.art-hat[hidden] { display: none; }

/* ---- Little Hatters: laid out in the units of the founder's mock-up (1024 wide, 972 tall with the rug), so everything keeps its place at every screen width ---- */
#hatShop.hat-room { display: flex; flex-direction: column; justify-content: flex-start; overflow: hidden; background: #f6f0ea url(art/hatshop/wall.webp) top center / 100% auto repeat-y; }
.hat-scene { position: relative; flex: none; width: 100%; aspect-ratio: 1024 / 862; overflow: hidden; }      /* the same room size as every other shop */
.hat-set { position: absolute; left: 6%; width: 88%; top: 0; aspect-ratio: 1024 / 972; container-type: inline-size; }      /* the whole frame of the mock-up, drawn 12% smaller so it fits the shared room size, with wallpaper at the sides */
.hat-set .hs { position: absolute; display: block; max-width: none; height: auto; }
.hs-floor { position: absolute; left: 0; right: 0; top: 77.893%; bottom: 0; background: rgb(110, 47, 29); border-top: 3px solid rgba(60, 22, 12, .5); }      /* brown from the wall line to the bottom, edge to edge */
.hs-rug { left: 21.367%; top: 86.656%; width: 59.844%; }
.hs-rack { left: 5.967%; top: 36.574%; width: 30.322%; }
.hs-shelf { left: 5.85%; top: 13.755%; width: 52.744%; }
.hs-window { left: 61.816%; top: 17.181%; width: 33.379%; aspect-ratio: 341.8 / 372.3; }
.hs-window img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hs-window .hs-night { opacity: 0; transition: opacity 1.4s ease; }
#hatShop.night .hs-window .hs-night { opacity: 1; }      /* the window follows the town clock: its painted sky by day, stars and a moon by night */
.hs-blythe { left: 32.588%; top: 34.928%; width: 53.33%; transform: scaleX(-1); }      /* facing left */
.hat-set .hat-bubble { left: 14.941%; top: 68.107%; width: 27.930%; right: auto; max-width: none; font-size: max(.78rem, 3.4cqw); padding: .45em .5em .5em; }
.hat-set .hat-bubble[data-name]:not([data-name=""]) { padding-top: 1.45em; }
.hat-panel-shop { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; z-index: 2; padding: .8rem .8rem 1rem; background: #f6f0ea; border-top: var(--outline) solid var(--ink); }
.hat-shop-title { margin: 0 0 .6rem; font-size: 1.05rem; text-align: center; }
.hat-shelf { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(7.4rem, 1fr); gap: .55rem; }
.hat-shelf-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: .4rem .3rem .5rem; min-height: 0; background: #fff; color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1.2rem; box-shadow: 0 .2rem 0 rgba(42, 34, 34, .25); font: inherit; text-align: center; cursor: pointer; }
.hat-shelf-tile:disabled { opacity: .55; cursor: default; box-shadow: none; }
.hat-shelf-name { font-size: .8rem; font-weight: 800; line-height: 1.15; }
.hat-shelf-price { font-size: .8rem; font-weight: 700; color: var(--button); }
.hat-buy-right { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: .35rem; text-align: center; }
.hat-preview-who { font-weight: 800; font-size: .85rem; text-align: left; }
#bpWho { font: inherit; padding: .4rem .5rem; border: var(--outline) solid var(--ink); border-radius: .8rem; background: #fff; color: var(--ink); }
.hat-price { margin: .4rem 0 0; font-weight: 800; font-size: 1.1rem; color: var(--button); }

/* ---- one universal hat box: every hat fits a square of the same size, whatever its shape, and never reaches its name ---- */
.hat-box { position: relative; flex: none; width: 3.7rem; height: 3.7rem; margin: 0 auto; }
.hat-box img { position: absolute; inset: 0; width: 100%; height: 100%; padding: .25rem; box-sizing: border-box; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .22)); }
.hat-box.none::before { content: ''; position: absolute; inset: .7rem; border: 2px dashed #c9ad98; border-radius: .6rem; }
.hat-shelf-tile .hat-box { width: 4.6rem; height: 4.6rem; }
.hat-buy-right .hat-box { width: 4.8rem; height: 4.8rem; align-self: center; margin: .2rem 0 .3rem; }
/* a long item name wraps instead of running under the X */
#popName { padding-inline: 2.8rem; text-wrap: balance; }

/* ---- every shop is one fixed room: the picture stays put and the goods scroll in their own box, so the keeper never scrolls away ---- */
body.on-fixed-shop { overflow: hidden; }
body.on-fixed-shop .shop-screen:not([hidden]) { position: fixed; top: 0; bottom: 0; left: max(0px, calc(50% - 17rem)); right: max(0px, calc(50% - 17rem)); margin: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; z-index: 2; }
body.on-fixed-shop .shop-screen > .shop-scene { flex: none; }
body.on-fixed-shop .shop-screen > .shop-grid { flex: 1 1 auto; min-height: 9rem; overflow-y: auto; align-content: start; padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }

/* ---- the goods box: rows take the height of their tallest item (they used to be squeezed to fit the box, which made them overlap) ---- */
body.on-fixed-shop .shop-screen > .shop-grid { grid-auto-rows: max-content; }
/* ---- items line up: every picture stands on the same line, names have room for two lines, and each price sits at the foot of its tile ---- */
.shop-item { justify-content: flex-start; }
.shop-art .art-img { object-position: 50% 100%; }
.shop-name { min-height: 2.3em; }
.shop-item .shop-price { margin-top: auto; }
/* ---- Little Hatters has exactly the same width and left edge as every other shop, at any window size ---- */
body.on-fixed-shop { background: var(--pearl-bush); }
body.on-fixed-shop #hatShop:not([hidden]) { left: max(0px, calc(50% - 17rem)); right: max(0px, calc(50% - 17rem)); width: auto; transform: none; box-shadow: none; }      /* not the narrow phone-shaped frame the other places get on a wide window */

/* ---- the binder's clasp is in front of the cards ---- */
.binder-clasp { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }

/* ---- Adventure: how long to go. The list scrolls and the bar with the lengths, what it pays and Go stays pinned at the bottom of the sheet. ---- */
#pickerOverlay .panel.has-bar { display: flex; flex-direction: column; overflow: hidden; }
#pickerOverlay .panel.has-bar #pickerBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: .3rem; }
#pickerOverlay .panel.has-bar .picker-foot { flex: none; margin: .4rem -1.1rem calc(-1.1rem - env(safe-area-inset-bottom)); padding: .1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); background: var(--paper); }
#pickerOverlay .panel.has-bar .picker-foot:has(.picker-bar:not([hidden])) { border-top: 2px solid var(--ink); box-shadow: 0 -6px 12px rgba(42, 34, 34, .08); padding-top: .6rem; }
.picker-bar { margin: 0 0 .5rem; }
.bar-head { margin: 0 0 .4rem; font: 600 1.05rem var(--font-head); }
.bar-chips { flex-wrap: wrap; margin: 0 0 .45rem; }
.bar-chips button { flex: 1 0 auto; min-height: 2.6rem; padding: 0 .8rem; }
.bar-sum { margin: .1rem 0; font-weight: 700; }
.bar-flag { margin: .1rem 0 .1rem; font-weight: 700; }
.bar-risk { margin: .1rem 0; font-weight: 700; }
.bar-risk.high { color: var(--crit); }
.bar-risk[hidden] { display: none; }
.bar-flag.counts { color: var(--good); }
.bar-flag.quick { color: #7a4a05; }
.bar-perk { margin: .1rem 0 0; }

/* ---- the QT Central Depot: every piece is placed as a share of the picture, measured from the founder's mock-ups ---- */
.st-stage { z-index: 1; }
.st-stage > * { position: absolute; }
.st-sprite { height: auto; pointer-events: none; }
.st-small { transform: scaleX(-1); }      /* Elroy by the train faces the other way */
/* the ticket box and the Board buttons follow the Arcade's: the box is the Arcade's token tile, the buttons its buttons. They sit at the right, at the heights the mock-up gave. */
.st-menu { position: absolute; z-index: 3; right: max(.8rem, 3vw); top: 48.1%; width: min(46vw, 12rem); display: flex; flex-direction: column; gap: .6rem; }
.st-tile { width: 7.2rem; }
.st-token-art { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; }      /* the same size as the Arcade's taffy token */
.st-token-art img { max-width: 100%; max-height: 100%; object-fit: contain; }
.st-boards { display: flex; flex-direction: column; gap: .5rem; }
.st-boards .arc-btn { font-size: 1rem; }
.st-boards .arc-btn:disabled { background: #c9beb3; color: #6f635a; border-color: #6f635a; box-shadow: none; cursor: not-allowed; }      /* solid grey, still readable against the picture */
.st-bubble { pointer-events: auto; left: 24.68%; top: 76.74%; right: auto; width: 56.34%; max-width: none; }
.st-bubble[data-name]:not([data-name=""])::before { left: 11.8%; right: auto; }

/* ---- the ride: the car fills the screen the way the other places do, the scenery sits behind its window, Skip is top left ---- */
.train-ride { background: #2b1b1a; }
.tr-stage { position: absolute; left: 0; bottom: 0; aspect-ratio: 941 / 1671;      /* anchored left, as in the mock-up: the window is at the left edge, and a phone crops the right side */ width: max(100vw, calc(100vh * 941 / 1671)); width: max(100vw, calc(100dvh * 941 / 1671)); overflow: hidden; }
.tr-car { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; display: block; pointer-events: none; }
.tr-window { position: absolute; z-index: 1; left: -0.0699%; top: 17.794%; width: 19.273%; height: 44.898%; object-fit: fill; background: #3b2f3a; display: block; }
.tr-window[hidden] { display: none; }
.tr-skip { top: calc(.7rem + env(safe-area-inset-top)); z-index: 5; }
.tr-fade { position: fixed; inset: 0; z-index: 60; background: #1c1414; opacity: 0; pointer-events: none; transition: opacity .65s ease; }
.tr-fade.on { opacity: 1; pointer-events: auto; }

/* Red dots: a new place or shop that has not been looked at yet */
.rd-on { position: relative; }
.rd-on::after { content: ''; position: absolute; top: .3rem; right: .3rem; width: .85rem; height: .85rem; border-radius: 50%; background: #e0362c; border: 2px solid #fff; pointer-events: none; z-index: 3; }
.town-pill.rd-on::after { top: 50%; right: .9rem; transform: translateY(-50%); }
.pin.rd-on::after { top: .1rem; right: .1rem; }
.actions button.rd-on::after { top: -.35rem; right: -.2rem; }

/* ============ Moonlight Barista ============ */
body.on-barista #sky, body.on-barista .wallet, body.on-barista #message, body.on-barista .bottombar { display: none; }
#barista { position: fixed; inset: 0; z-index: 12; overflow-y: auto; margin: 0; color: #fbf1de; background: #17110e; }
#barista[hidden] { display: none; }
.bw-frame { background: linear-gradient(rgba(0, 0, 0, .68), rgba(0, 0, 0, .68)), #17110e url(art/barista/bg.webp) center top / cover no-repeat; position: relative; width: 100%; max-width: 30rem; min-height: 100%; margin: 0 auto; padding: calc(.5rem + env(safe-area-inset-top)) .6rem calc(.6rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .3rem; }
.bw-top { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.bw-top b { font-size: .95rem; text-align: center; flex: 1; }
.bw-top button { min-height: 0; padding: .3rem .6rem; font-size: .8rem; }
.bw-audio { display: flex; justify-content: flex-end; gap: .4rem; }
body.on-barista .tm-switch:disabled { opacity: .45; }
.bw-stage { position: relative; flex: 1 1 auto; min-height: 12.5rem; z-index: 1; }      /* spare height on a tall phone goes to Aurora's zone */
.bw-aurora { position: absolute; left: .1rem; top: 0; height: calc(100% + 4.2rem); max-height: 18rem; width: auto; max-width: 7.8rem; object-fit: contain; object-position: left top; image-rendering: pixelated; z-index: 3; pointer-events: none; }
.bw-bubble { position: relative; margin: .6rem 0 0 7.6rem; padding: .6rem .7rem; background: #fff; color: #2a1d27; border: 3px solid #2a1d27; border-radius: 14px; font-weight: 800; font-size: 1.05rem; line-height: 1.25; min-height: 3.2rem; z-index: 2; }
.bw-bubble::before { content: ""; position: absolute; left: -.95rem; top: 1rem; border: .55rem solid transparent; border-right-color: #2a1d27; border-left: 0; }
.bw-bubble::after { content: ""; position: absolute; left: -.62rem; top: 1.1rem; border: .42rem solid transparent; border-right-color: #fff; border-left: 0; }
.bw-bubble p { margin: 0; }
.bw-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.bw-chips:empty { display: none; }
.bw-chip { position: relative; width: 2.7rem; height: 2.7rem; display: grid; place-items: center; border: 3px solid #d8cdb8; border-radius: 10px; background: #f4ecdb; }
.bw-chip img { width: 92%; height: 92%; object-fit: contain; image-rendering: pixelated; }      /* every coffee sits on the same square canvas at the same scale */
.bw-chip i { position: absolute; right: -.2rem; bottom: -.35rem; min-width: 1rem; padding: 0 .2rem; border-radius: 999px; background: #2a1d27; color: #fff; font-size: .65rem; font-style: normal; line-height: 1rem; text-align: center; }
.bw-chip.now { border-color: #f0b232; box-shadow: 0 0 0 3px rgba(240, 178, 50, .55); animation: bwFlash .5s ease-in-out infinite alternate; }
@keyframes bwFlash { from { background: #fff3c4; } to { background: #f4ecdb; } }
.bw-wheel { position: relative; width: min(100%, calc(100dvh - 21rem)); min-width: 13rem; aspect-ratio: 1; margin: -3.6rem auto 0; z-index: 4; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.bw-wheel img { display: block; width: 100%; height: 100%; pointer-events: none; }
.bw-wheel:not(.live) { filter: saturate(.8) brightness(.92); }
.bw-wheel.live { cursor: pointer; }
.bw-glow { position: absolute; inset: 0; border-radius: 9%; pointer-events: none; opacity: 0; transition: opacity .15s ease-out; }
.bw-strip { min-height: 3.4rem; display: flex; justify-content: center; align-items: center; }
.bw-strip > button { min-width: 9rem; }
.bw-play { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; max-width: 21rem; }
.bw-timer { width: 3.2rem; height: 3.2rem; flex: none; border-radius: 50%; background: rgba(0, 0, 0, .35); outline: 2px solid #fbf1de; outline-offset: -2px; }
.bw-w { fill: rgba(255, 255, 255, .1); transition: fill .2s; }
.bw-w.on { fill: var(--c); }
.bw-xs { display: flex; gap: .25rem; }
.bw-x { width: 2rem; height: 2rem; fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: square; }
.bw-x.on { stroke: #e03a3a; }
@media (prefers-reduced-motion: reduce) { .bw-chip.now { animation: none; } }

/* ---- Encounters: a blocking pop-up at the bottom of the screen. Placed from the founder's mock-up (1024 wide): the character is ~49% of the width,
   its left edge 5.9% in and its feet 3.5% of the width above the bottom; the bubble runs 37.6% to 91.3% across, sits in front of the character, bottom 26% (of the width) up, and is ~21% tall;
   the name tag starts 2.4% in from the bubble's left; the X sits in the strip to the bubble's right ---- */
.enc { position: fixed; inset: 0; z-index: 9000; }
.enc[hidden] { display: none; }
.enc-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); }      /* nothing behind is clickable */
.enc-stage { position: absolute; inset: 0; pointer-events: none; }

.enc-art { position: absolute; left: -1.2vw; bottom: calc(3vw + env(safe-area-inset-bottom)); height: min(90vw, 62vh); width: auto; max-width: 74vw; object-fit: contain; object-position: bottom left; filter: drop-shadow(0 .2rem .3rem rgba(0, 0, 0, .45)); pointer-events: auto; }
.enc-row { position: absolute; left: 37.6vw; right: 1.2vw; bottom: calc(5vw + env(safe-area-inset-bottom)); height: 42vw; display: flex; align-items: flex-start; gap: 1.2vw; pointer-events: none; }
.enc-bubble { position: relative; flex: 1 1 auto; min-width: 0; min-height: 21vw; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem .8rem .7rem; background: #fff; border-radius: 1.6rem; font-weight: 600; font-size: 1.05rem; line-height: 1.3; text-align: center; color: #111; cursor: pointer; pointer-events: auto; box-shadow: 0 .15rem .5rem rgba(0, 0, 0, .35); }
.enc-bubble[data-name]:not([data-name=""])::before {
  content: attr(data-name); position: absolute; left: 2.4%; top: 0; transform: translateY(-48%); z-index: 3;
  padding: .28em .8em; background: #000; color: #fff; border-radius: 999px;
  font: 600 1rem/1.2 var(--font-head); white-space: nowrap; pointer-events: none;
}
.enc-text { margin: 0; }
.enc-gift { margin: .45rem 0 0; font-size: .95rem; font-weight: 800; color: #e0700d; }      /* gifts are in orange */
.enc-more { position: absolute; right: .8rem; bottom: .2rem; font-size: 1rem; color: #111; animation: encBob 1s ease-in-out infinite; }
@keyframes encBob { 50% { transform: translateY(.18rem); } }
html[data-reduce="1"] .enc-more { animation: none; }
.enc-x { flex: 0 0 auto; margin-top: 7vw; width: 7vw; min-width: 1.9rem; height: 7vw; min-height: 1.9rem; border-radius: 50%; padding: 0; font-size: 1rem; font-weight: 800; background: #fff; border: 0; color: #111; box-shadow: 0 .1rem .4rem rgba(0, 0, 0, .35); pointer-events: auto; }
body.enc-open { overflow: hidden; }
@media (max-width: 380px) { .enc-bubble { font-size: .92rem; } }

.enc[data-npc="ridley"] .enc-art { height: min(77vw, 54vh); }      /* Mayor Ridley is shorter than General Hoot */
/* the newer visitors' pictures are cut tight to the figure, so they stand 5.9% in as in the mock-up; heights are in screen widths, and a figure never grows past 58% of the width */
.enc[data-npc="dolly"] .enc-art, .enc[data-npc="idler"] .enc-art, .enc[data-npc="hopscotch"] .enc-art, .enc[data-npc="lido"] .enc-art, .enc[data-npc="chippy"] .enc-art, .enc[data-npc="pierce"] .enc-art, .enc[data-npc="truffle"] .enc-art { left: 5.9vw; max-width: 56vw; }
.enc[data-npc="dolly"] .enc-art { height: min(74vw, 54vh); }
.enc[data-npc="idler"] .enc-art { height: min(84vw, 60vh); }
.enc[data-npc="hopscotch"] .enc-art { height: min(80vw, 60vh); max-width: 66vw; left: 0; }      /* big enough that her face stays above the name tag */
.enc[data-npc="lido"] .enc-art { height: min(78vw, 56vh); }
.enc[data-npc="pierce"] .enc-art { height: min(80vw, 58vh); }
.enc[data-npc="truffle"] .enc-art { height: min(80vw, 58vh); }

/* the newest visitors, cut tight like the others: sized so each face stays above the name tag and no figure grows past 62% of the width */
.enc[data-npc="bella"] .enc-art, .enc[data-npc="allan"] .enc-art, .enc[data-npc="kragla"] .enc-art, .enc[data-npc="falcon"] .enc-art, .enc[data-npc="pigeon"] .enc-art, .enc[data-npc="duck"] .enc-art, .enc[data-npc="harpy"] .enc-art, .enc[data-npc="bat"] .enc-art, .enc[data-npc="lynx"] .enc-art, .enc[data-npc="collie"] .enc-art, .enc[data-npc="gecko"] .enc-art { left: 5.9vw; max-width: 56vw; }
.enc[data-npc="bella"] .enc-art { height: min(86vw, 60vh); }
.enc[data-npc="allan"] .enc-art { height: min(84vw, 60vh); }
.enc[data-npc="kragla"] .enc-art { height: min(90vw, 63vh); }
.enc[data-npc="falcon"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="pigeon"] .enc-art { height: min(72vw, 52vh); max-width: 62vw; }
.enc[data-npc="duck"] .enc-art { height: min(82vw, 59vh); }
.enc[data-npc="harpy"] .enc-art { height: min(80vw, 58vh); }
.enc[data-npc="bat"] .enc-art { height: min(76vw, 55vh); max-width: 60vw; }
.enc[data-npc="lynx"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="collie"] .enc-art { height: min(74vw, 54vh); max-width: 62vw; }
.enc[data-npc="gecko"] .enc-art { height: min(86vw, 61vh); }

/* Little City: the Queen, the Royal Guards and the townsfolk, cut tight like the others */
.enc[data-npc="queen"] .enc-art, .enc[data-npc="guard"] .enc-art, .enc[data-npc="florist"] .enc-art, .enc[data-npc="lamplighter"] .enc-art, .enc[data-npc="landscaper"] .enc-art, .enc[data-npc="courier"] .enc-art, .enc[data-npc="townie"] .enc-art, .enc[data-npc="pedestrian"] .enc-art { left: 5.9vw; max-width: 58vw; }
.enc[data-npc="queen"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="guard"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="florist"] .enc-art { height: min(84vw, 60vh); max-width: 62vw; }
.enc[data-npc="lamplighter"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="landscaper"] .enc-art { height: min(90vw, 63vh); }
.enc[data-npc="courier"] .enc-art { height: min(84vw, 60vh); }
.enc[data-npc="townie"] .enc-art { height: min(84vw, 60vh); }
.enc[data-npc="pedestrian"] .enc-art { height: min(90vw, 63vh); max-width: 62vw; }
.enc[data-npc="shopper"] .enc-art { left: 3vw; max-width: 74vw; }      /* the snail is wide and low */

/* Polarville: Nicholas North, Aurora and Comet */
.enc[data-npc="north"] .enc-art, .enc[data-npc="comet"] .enc-art, .enc[data-npc="aurora"] .enc-art { left: 5.9vw; max-width: 58vw; }
.enc[data-npc="north"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="comet"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="aurora"] .enc-art { height: min(78vw, 56vh); max-width: 66vw; left: 3vw; }      /* her tail makes her wide */

/* More of Polarville. The wide groups (the rabbits, the triplets) stand lower, like the snail */
.enc[data-npc="dan"] .enc-art, .enc[data-npc="eleven"] .enc-art, .enc[data-npc="grandmother"] .enc-art, .enc[data-npc="lenny"] .enc-art, .enc[data-npc="fjord"] .enc-art, .enc[data-npc="mama"] .enc-art, .enc[data-npc="mamafam"] .enc-art, .enc[data-npc="virginia"] .enc-art, .enc[data-npc="starla"] .enc-art, .enc[data-npc="memo"] .enc-art { left: 5.9vw; max-width: 58vw; }
.enc[data-npc="dan"] .enc-art { height: min(90vw, 63vh); }
.enc[data-npc="eleven"] .enc-art { height: min(92vw, 64vh); }
.enc[data-npc="grandmother"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="lenny"] .enc-art { height: min(80vw, 57vh); max-width: 62vw; }
.enc[data-npc="fjord"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="mama"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="mamafam"] .enc-art { height: min(84vw, 60vh); max-width: 62vw; }
.enc[data-npc="virginia"] .enc-art { height: min(86vw, 61vh); }
.enc[data-npc="starla"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="memo"] .enc-art { height: min(88vw, 62vh); }
.enc[data-npc="rabbits"] .enc-art { left: 3vw; max-width: 76vw; }
.enc[data-npc="triplets"] .enc-art { left: 3vw; max-width: 76vw; }

/* Short characters: they keep their small size, the speech bubble lifts to sit above them, and the name tag moves to the bubble's bottom edge so nothing covers a face.
   --h is the figure's height; to give another visitor this layout, add them to these lists and give them an --h. */
.enc[data-npc="chippy"] { --h: min(50vw, 36vh); }
.enc[data-npc="shopper"] { --h: min(62vw, 44vh); }
.enc[data-npc="rabbits"] { --h: min(58vw, 42vh); }
.enc[data-npc="triplets"] { --h: min(40vw, 30vh); }
.enc[data-npc="chippy"] .enc-art, .enc[data-npc="shopper"] .enc-art, .enc[data-npc="rabbits"] .enc-art, .enc[data-npc="triplets"] .enc-art { height: var(--h); }
.enc[data-npc="chippy"] .enc-row, .enc[data-npc="shopper"] .enc-row, .enc[data-npc="rabbits"] .enc-row, .enc[data-npc="triplets"] .enc-row { bottom: calc(3vw + var(--h) + 6vw + env(safe-area-inset-bottom)); }
.enc[data-npc="chippy"] .enc-bubble[data-name]:not([data-name=""])::before, .enc[data-npc="shopper"] .enc-bubble[data-name]:not([data-name=""])::before,
.enc[data-npc="rabbits"] .enc-bubble[data-name]:not([data-name=""])::before, .enc[data-npc="triplets"] .enc-bubble[data-name]:not([data-name=""])::before { top: auto; bottom: 0; transform: translateY(48%); }
.enc[data-npc="chippy"] .enc-row, .enc[data-npc="shopper"] .enc-row, .enc[data-npc="rabbits"] .enc-row, .enc[data-npc="triplets"] .enc-row { height: auto; align-items: flex-end; }
.enc[data-npc="chippy"] .enc-x, .enc[data-npc="shopper"] .enc-x, .enc[data-npc="rabbits"] .enc-x, .enc[data-npc="triplets"] .enc-x { align-self: center; margin-top: 0; }
.enc[data-npc="chippy"] .enc-bubble, .enc[data-npc="shopper"] .enc-bubble, .enc[data-npc="rabbits"] .enc-bubble, .enc[data-npc="triplets"] .enc-bubble { padding: .7rem .8rem 1.5rem; }

/* Captain Driftwood's Wares: the stage is the founder's mock-up (1024 x 1526), so everything is placed in its percentages and scales with the width */
#driftShop.drift-room { display: block; overflow-y: auto; overflow-x: hidden; background: #26243c url(art/places/driftwood-moonlit.jpg) center top / cover no-repeat; }
.drift-stage { position: relative; width: min(100%, 36rem); margin: 0 auto; aspect-ratio: 1024 / 1526; container-type: inline-size; }
.drift-man { position: absolute; left: 8.594%; top: 14.809%; width: 84.668%; height: auto; display: block; }
.drift-items { position: absolute; inset: 0; }
.drift-tile { position: absolute; width: 29.492%; height: 19.9%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5cqw; padding: 1cqw 1cqw 1.8cqw; background: #fff; color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 4.2cqw; box-shadow: 0 .2rem 0 rgba(42, 34, 34, .3); font: inherit; text-align: center; cursor: pointer; }
.drift-tile:focus-visible { outline: 3px solid var(--button); outline-offset: 2px; }
.drift-tile img { flex: none; width: 52%; height: 38%; object-fit: contain; }
.drift-name { font-size: 3.1cqw; font-weight: 800; line-height: 1.1; }
.drift-eff { font-size: 2.3cqw; line-height: 1.15; color: #5a4a44; }
.drift-price { font-size: 2.7cqw; font-weight: 800; color: var(--button); line-height: 1.1; }
.drift-tile[data-item="best-friend-chains"] { left: 8.789%; top: 41.939%; }
.drift-tile[data-item="captains-compass"] { left: 66.992%; top: 40.105%; }
.drift-tile[data-item="gold-pocketwatch"] { left: 8.789%; top: 63.893%; }
.drift-tile[data-item="pirate-eyeglass"] { left: 66.992%; top: 63.893%; }
.drift-buy { width: min(22rem, 100%); }
.drift-buy-body { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .2rem 0 .4rem; }
.drift-buy-body .hat-box { width: 6rem; height: 6rem; }
.drift-effect { margin: 0; font-weight: 700; text-align: center; }
.drift-qty { display: flex; align-items: center; gap: 1rem; }
.drift-qty output { min-width: 2.5rem; text-align: center; font: 800 1.4rem/1 var(--font-head); }
.drift-qty button { min-width: 2.6rem; padding: .3rem .8rem; font-size: 1.2rem; }

#weaponRows { display: contents; }
#weaponRows .shop-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .25)); }

/* ---- The Rumpus Ring: a 512 x 763 stage drawn by rumpus.js and scaled to fit; --rrs is the scale, --dh the extra height on tall phones ---- */
.rr-room { position: fixed; inset: 0; z-index: 9; background: #000; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; --rrs: .76; --dh: 0px; }
.rr-room[hidden] { display: none; }
.rr-frame { position: relative; width: calc(512px * var(--rrs)); height: calc((763px + var(--dh)) * var(--rrs)); overflow: hidden; }
.rr-canvas { position: absolute; left: 0; top: 0; width: 512px; height: calc(763px + var(--dh)); transform-origin: 0 0; transform: scale(var(--rrs)); overflow: hidden; background: #FDF8E8; color: #1E1A16; font-family: var(--font-body); }
:where(.rr-canvas) button { font-family: var(--font-body); min-height: 0; box-shadow: none; padding: 0; transition: none; background: none; border: 0; }
.rr-canvas button:active:not(:disabled) { transform: none; }
.rr-canvas button.rr-portrait:active, .rr-canvas button.rr-circle:active, .rr-canvas button.rr-pill:active, .rr-canvas button.rr-boss:active, .rr-canvas button.rr-skip:active, .rr-canvas button.rr-go:active { box-shadow: none; }
.rr-canvas button.rr-portrait.sel:active { box-shadow: 0 0 0 4px #F0924A; }
.rr-canvas button.rr-circle.sel:active { box-shadow: 0 0 0 3px #FDF8E8, 0 0 0 6px #F0924A; }
.rr-canvas button.rr-go:disabled { background: #C8D1D9; color: #4A5560; }
.rr-canvas img { -webkit-user-drag: none; user-select: none; }
.rr-abs { position: absolute; }
.rr-btn { position: absolute; border: 3px solid #2A2222; border-radius: 14px; background: #F6F0EA; color: #8A3F1E; font: 600 15px var(--font-head); padding: 0 14px; height: 34px; box-shadow: 0 3px 0 rgba(42, 34, 34, .22); display: flex; align-items: center; z-index: 5; box-sizing: border-box; }
.rr-btn.forfeit { color: #B3372F; height: 32px; }
.rr-go { position: absolute; width: 126px; height: 33px; border: 0; border-radius: 17px; background: #C8D1D9; color: #4A5560; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; z-index: 4; }
.rr-go.ready { background: #F0924A; color: #1E1A16; }
.rr-fade { position: absolute; left: 0; width: 512px; height: 73px; background: linear-gradient(to top, #FDF8E8 40%, rgba(253, 248, 232, 0)); pointer-events: none; z-index: 3; }
.rr-scroll { position: absolute; overflow-y: auto; overscroll-behavior: contain; }
.rr-circle { border-radius: 50%; flex: none; padding: 0; border: 0; background: none; position: relative; display: block; }
.rr-circle img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.rr-circle.sel { box-shadow: 0 0 0 3px #FDF8E8, 0 0 0 6px #F0924A; }
.rr-circle.off { opacity: .45; }
.rr-circle .rr-faint { position: absolute; left: -6px; top: -10px; width: 44%; height: auto; border-radius: 0; }
.rr-tier { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rr-tier > b { font-weight: 800; }
.rr-tier .rr-faces { display: flex; flex-wrap: wrap; justify-content: center; }
.rr-fig { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.rr-fig small { font-size: 11px; font-weight: 800; line-height: 1; }
.rr-record { position: relative; margin-top: 24px; width: 150px; box-sizing: border-box; background: #F6F0EA; border: 3px solid #2A2222; border-radius: 14px; box-shadow: 0 4px 0 rgba(42, 34, 34, .22); padding: 16px 10px 8px; font-size: 12.5px; line-height: 1.4; }
.rr-record .tab { position: absolute; top: -15px; left: 8px; padding: 1px 10px; background: #A84F28; color: #fff; font: 600 14px var(--font-head); border: 3px solid #2A2222; border-radius: 9px; transform: rotate(-1deg); box-shadow: 0 3px 0 rgba(42, 34, 34, .22); white-space: nowrap; }
.rr-advrow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0 14px 24px; border-bottom: 2px solid #EFE6CC; }
.rr-advrow.off .rr-portrait { opacity: .5; }
.rr-portrait { display: block; position: relative; width: 150px; height: 150px; padding: 0; border: 0; background: none; border-radius: 20px; }
.rr-portrait img.pic { width: 150px; height: 150px; display: block; object-fit: contain; }
.rr-portrait.sel { box-shadow: 0 0 0 4px #F0924A; }
.rr-portrait .rr-faint { position: absolute; left: 4px; top: 4px; width: 56px; }
.rr-weapon { width: 80px; height: 88px; border-radius: 20px; background: #fff; display: flex; align-items: center; justify-content: center; }
.rr-weapon img { width: 46px; height: auto; max-height: 78px; object-fit: contain; }
.rr-expgrid { display: grid; grid-template-columns: repeat(3, 26px); gap: 4px 3px; margin-top: 2px; }
.rr-expgrid img { width: 26px; height: 26px; object-fit: contain; }
.rr-expgrid img.no { opacity: .3; filter: grayscale(1); }
.rr-pill { height: 40px; border: 0; border-radius: 20px; font-weight: 900; font-size: 17px; width: 100%; }
.rr-pill.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #1E1A16; }
.rr-boss { position: relative; height: 62px; border-radius: 12px; overflow: hidden; background: #fff; border: 0; padding: 0; flex: none; }
.rr-boss.sel { box-shadow: 0 0 0 4px #F0924A; }
.rr-boss > img.ban { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rr-boss > span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 8px; background: rgba(253, 248, 232, .9); font-weight: 800; font-size: 11px; display: flex; justify-content: space-between; color: #1E1A16; text-align: left; }
.rr-boss > img.dbadge { position: absolute; right: 5px; top: 4px; height: 20px; width: auto; }
.rr-bar { position: absolute; box-sizing: border-box; border: 3px solid #111; background: #111; overflow: hidden; }
.rr-bar.thin { border-width: 2px; }
.rr-bar i { display: block; height: 100%; background: #03843D; transition: width .35s ease, background-color .35s; }
.rr-abil { position: absolute; width: 76px; height: 72px; border: 0; border-radius: 18px; background: #C8D1D9; display: flex; align-items: center; justify-content: center; padding: 0; transition: background-color .15s; pointer-events: none; }
.rr-abil.on { background: #F0924A; }
.rr-canvas button.rr-abil { flex-direction: column; gap: 2px; pointer-events: auto; font-weight: 900; font-size: 13px; color: #6F7782; opacity: .55; }
.rr-canvas button.rr-abil.ready { opacity: 1; background: #F0924A; color: #1E1A16; box-shadow: 0 4px 0 #A8571F; }
.rr-canvas button.rr-abil.ready svg { stroke: #1E1A16; }
.rr-canvas button.rr-abil.ready:active { box-shadow: none; transform: translateY(3px); }
.rr-mode { display: flex; border: 3px solid #2A2222; border-radius: 18px; overflow: hidden; background: #F6F0EA; box-sizing: border-box; }
.rr-mode button { flex: 1; font-weight: 900; font-size: 16px; color: #5D4D4A; }
.rr-mode button.sel { background: var(--button); color: #fff; }
.rr-abil svg { stroke: #6F7782; }
.rr-abil.on svg { stroke: #1E1A16; }
.rr-skip { position: absolute; width: 78px; height: 78px; border: 0; border-radius: 12px; background: #FDF8E8; padding: 0; display: flex; align-items: center; justify-content: center; z-index: 4; }
.rr-boss-img { position: absolute; object-fit: contain; object-position: center bottom; transition: transform .12s; }
.rr-boss-img.shake { animation: rrShake .28s; }
@keyframes rrShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-9px); } 75% { transform: translateX(9px); } }
.rr-float { position: absolute; z-index: 8; pointer-events: none; transform: translate(-50%, 0); font: 900 30px var(--font-body); color: #fff; -webkit-text-stroke: 1px #111; text-shadow: 0 2px 0 #111, 0 0 6px #000; animation: rrFloat 1s ease-out forwards; white-space: nowrap; }
.rr-float.hurt { color: #FFD166; }
.rr-float.big { font-size: 42px; color: #F0924A; }
.rr-float.ally { color: #FF6B5E; }
.rr-float.heal { color: #8FE388; }
.rr-float.note { font-size: 22px; color: #FDF8E8; }
@keyframes rrFloat { 0% { opacity: 0; margin-top: 14px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -58px; } }
.rr-veil { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); z-index: 6; }
.rr-pop { position: absolute; z-index: 7; box-sizing: border-box; border: 3px solid #2A2222; border-radius: 26px; background: #F6F0EA; box-shadow: 0 6px 0 rgba(42, 34, 34, .3); text-align: center; }
.rr-pop.cream { background: #FDF8E8; border: 0; border-radius: 30px; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
.rr-pop h3 { margin: 0; font: 600 28px/1.15 var(--font-head); }
.rr-pop.cream h3 { font: 900 32px/40px var(--font-body); }
.rr-loot { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; }
.rr-loot img { width: 52px; height: 52px; flex: none; object-fit: contain; }
/* Collect, Continue, Back and Bring it on look like every other main button in the game: the rust fill, white writing and the dark bottom edge that presses down */
.rr-canvas button.rr-collect { border: 0; border-radius: 22px; background: var(--button); color: var(--button-ink); font: 600 26px var(--font-head); height: 58px; width: 250px; box-shadow: 0 5px 0 var(--button-dark); touch-action: manipulation; }
.rr-canvas button.rr-collect:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--button-dark); }
.rr-canvas button.rr-collect:disabled { background: #d9cfc6; color: #6f625c; box-shadow: none; }
.rr-empty { padding: 40px 30px; text-align: center; font-weight: 800; font-size: 17px; line-height: 1.4; }

.revive-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 0 rgba(42, 34, 34, .25)); }
#reviveRow .shop-art { display: block; }

/* a fainted adventurer on the guild page: the faint badge on the portrait, a dimmed picture, and the time left */
.portrait .faint-badge { position: absolute; left: .1rem; top: -.5rem; width: 3.1rem; height: auto; z-index: 3; pointer-events: none; object-fit: contain; }
.portrait.is-fainted .pop img:not(.art-hat) { opacity: .55; filter: grayscale(.4); }
.faint-line { margin: .3rem 0; padding: .35rem .6rem; border: var(--outline) solid var(--ink); border-radius: .8rem; background: #f6ece6; color: #8a2f28; font-weight: 700; font-size: .85rem; line-height: 1.35; }
.faint-line[hidden], .portrait .faint-badge[hidden] { display: none; }

.rr-item { width: 270px; box-sizing: border-box; background: #fff7e6; border: 2px solid #2A2222; border-radius: 14px; padding: 4px 14px 4px 8px; }
.rr-item img { width: 56px; height: 56px; }

.rr-card img { width: 44px; height: 66px; }

/* the Rumpus Ring entry in the map pin is just its logo, with no scenery behind it */
#goRumpus { justify-content: center; background: #5D4D4A; padding: .5rem .7rem; }
#goRumpus .rr-pin-logo { display: block; width: min(100%, 15rem); height: auto; }

/* hats on the Rumpus Ring screens */
.rr-hatq { container-type: size; }
.rr-artbox { position: absolute; left: 0; top: 50%; width: 100%; aspect-ratio: 400 / 330; transform: translateY(-50%); }
.rr-hat { position: absolute; z-index: 2; display: block; height: auto; max-width: none; border-radius: 0; pointer-events: none;
  transform-origin: 50% calc(var(--hp) * 100%); transform: translate(-50%, calc((1 - var(--hp)) * 100%)) rotate(calc(var(--ht) * 1deg)); }
.rr-hat.onart { width: calc(var(--hw) / 400 * 100cqw); left: calc(50% + (var(--hx) - 200) / 400 * 100cqw); bottom: calc((330 - var(--hy)) / 400 * 100cqw); }
.rr-hat.onface { width: calc(var(--hw) / var(--fw) * 100cqw); left: calc((var(--hx) - var(--fx)) / var(--fw) * 100cqw); bottom: calc((var(--fy) + var(--fw) - var(--hy)) / var(--fw) * 100cqw); }

/* who is acting glows orange, who is being hit glows red, and one line in the arena says what happened */
.rr-abs.acting, #rrBoss.acting { filter: drop-shadow(0 0 4px #F0924A) drop-shadow(0 0 9px #F0924A) drop-shadow(0 0 14px #F0924A); z-index: 4; }
.rr-abs.targeted { filter: drop-shadow(0 0 4px #D64B3C) drop-shadow(0 0 9px #D64B3C); }
.rr-say { z-index: 5; box-sizing: border-box; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px 14px; border-radius: 16px; background: rgba(20, 14, 12, .78); color: #FDF8E8; font: 800 19px/1.2 var(--font-body); text-shadow: 0 1px 2px #000; }
.rr-say[hidden] { display: none; }

/* ---- Fishing: the water scene fills the screen; the bobber, line and ripples are drawn in code over it (percentages of the frame) ---- */
#fishing { justify-content: flex-end; }
.fish-stage { position: absolute; inset: 0; pointer-events: auto; touch-action: manipulation; }
.fish-line { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .3s; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
#fishing:not([data-state="idle"]):not([data-state="result"]) .fish-line { opacity: .9; }
.fish-bobber { position: absolute; left: var(--wx, 50%); top: var(--wy, 57%); width: var(--bw, 11%); aspect-ratio: 269 / 252; transform: translate(-50%, -100%); clip-path: inset(-45% -25% 0 -25%); opacity: 0; pointer-events: none; }      /* clipped only at the waterline, so the bobber is never cut off when it bobs up */
#fishing[data-water="little-city-pond"] .fish-bobber { aspect-ratio: 270 / 255; }
#fishing[data-water="arctic-fishing-hole"] .fish-bobber { aspect-ratio: 270 / 261; }      /* the pond's round yellow bobber: its upper 70% shows above the water */
.fish-bobber img { display: block; width: 100%; position: absolute; left: 0; top: 0; }
#fishing:not([data-state="idle"]):not([data-state="result"]) .fish-bobber { opacity: 1; }
.fish-bobber.cast { animation: fish-cast .7s cubic-bezier(.2, .7, .3, 1) both; }
#fishing[data-state="waiting"] .fish-bobber img { animation: fish-bob 2.6s ease-in-out infinite; }
#fishing[data-state="bite"] .fish-bobber img { animation: fish-sink .3s ease-in forwards; }
#fishing .fish-bobber.yank img { animation: fish-yank .3s cubic-bezier(.2, .9, .3, 1.3) forwards; }
#fishing .fish-bobber.nib img { animation: fish-nib .45s ease-out 1; }
@keyframes fish-cast { from { transform: translate(-50%, 0) translateY(60vh) scale(.5); opacity: 0; } 60% { opacity: 1; } to { transform: translate(-50%, -100%); opacity: 1; } }
@keyframes fish-bob { 0%, 100% { transform: translateY(2%); } 50% { transform: translateY(-3%); } }
@keyframes fish-sink { from { transform: translateY(6%); } to { transform: translateY(112%); } }      /* pulled completely under */
@keyframes fish-yank { from { transform: translateY(var(--yank-from, 0%)); } to { transform: translateY(-16%); } }      /* the tap: it snaps up out of the water */
@keyframes fish-nib { 0% { transform: translateY(0); } 30% { transform: translateY(26%); } 60% { transform: translateY(-4%); } 100% { transform: translateY(0); } }
.fish-splash { position: absolute; left: var(--wx, 50%); top: var(--wy, 57%); width: 0; height: 0; pointer-events: none; }
.fish-splash i { position: absolute; left: 0; top: 0; width: 1.1vmin; height: 1.1vmin; margin: -.55vmin; border-radius: 50%; background: rgba(255, 255, 255, .9); opacity: 0; }
.fish-splash.go i { animation: fish-drop .55s ease-out 1; }
.fish-splash i:nth-child(1) { --dx: -5vmin; --dy: -6vmin; } .fish-splash i:nth-child(2) { --dx: -2.5vmin; --dy: -8vmin; } .fish-splash i:nth-child(3) { --dx: 0; --dy: -9vmin; } .fish-splash i:nth-child(4) { --dx: 2.5vmin; --dy: -8vmin; } .fish-splash i:nth-child(5) { --dx: 5vmin; --dy: -6vmin; }
@keyframes fish-drop { 0% { transform: translate(0, 0) scale(.6); opacity: 1; } 40% { transform: translate(var(--dx), var(--dy)) scale(.9); opacity: 1; } 100% { transform: translate(calc(var(--dx) * 1.4), 0) scale(.3); opacity: 0; } }
.fish-ripples { position: absolute; inset: 0; pointer-events: none; opacity: 0; clip-path: var(--water-clip, none); }      /* rings are sized in percent of the screen and cut off at the water's edge */
#fishing[data-state="waiting"] .fish-ripples, #fishing[data-state="bite"] .fish-ripples { opacity: 1; }
.fish-ripples i { position: absolute; left: var(--wx, 50%); top: var(--wy, 57%); width: var(--rw, 18%); height: var(--rh, 2.5%); border: 2px solid rgba(255, 255, 255, .75); border-radius: 50%; animation: fish-ring 3s ease-out infinite; opacity: 0; }
.fish-ripples i:nth-child(2) { animation-delay: 1s; } .fish-ripples i:nth-child(3) { animation-delay: 2s; }
#fishing[data-state="bite"] .fish-ripples i { animation-duration: 1.1s; border-width: 3px; }
@keyframes fish-ring { from { transform: translate(-50%, -50%) scale(.25); opacity: .85; } to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }
.fish-bite { position: absolute; left: var(--wx, 50%); top: calc(var(--wy, 57%) - 17%); width: 4.2rem; height: 4.2rem; margin-left: -2.1rem; border-radius: 50%; background: #ED4118; border: 4px solid #fff8e6; color: #fff; font: 900 2.6rem/3.6rem var(--font-head, inherit); text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.25); transform: scale(0); pointer-events: none; }
.fish-bite.on { animation: fish-pop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes fish-pop { from { transform: scale(0) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
.fish-top { position: absolute; left: .6rem; right: .6rem; top: calc(.6rem + env(safe-area-inset-top)); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; z-index: 3; }
.fish-top button { flex: none; }
.fish-count { margin-left: auto; font-weight: 800; font-size: .85rem; color: #fff8e6; background: rgba(30, 24, 22, .7); border-radius: 1rem; padding: .25rem .7rem; }
.fish-msg { position: absolute; left: 50%; transform: translateX(-50%); top: 16%; max-width: 90%; margin: 0; padding: .5rem 1rem; border-radius: 1.2rem; background: rgba(30, 24, 22, .78); color: #fff8e6; font-weight: 800; font-size: 1.05rem; text-align: center; z-index: 3; }
.fish-controls { position: relative; z-index: 3; display: flex; justify-content: center; padding: 0 1rem calc(1.4rem + env(safe-area-inset-bottom)); }
.fish-big { min-width: 14rem; font-size: 1.4rem; padding: .8rem 2rem; }
#fishing[data-state="bite"] .fish-big { animation: fish-pulse .5s ease-in-out infinite alternate; }
@keyframes fish-pulse { to { transform: scale(1.06); } }
.fish-catch { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: min(62%, 15rem); display: flex; flex-direction: column; align-items: center; gap: .25rem; z-index: 4; text-align: center; }
.fish-catch[hidden] { display: none; }
.fish-catch.pop .fish-card-slot { animation: fish-flip .6s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes fish-flip { from { transform: translateY(35vh) rotateY(180deg) scale(.25); opacity: 0; } 55% { opacity: 1; } to { transform: none; opacity: 1; } }
.fish-card-slot { width: 100%; perspective: 800px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.fish-card-slot img { width: 100%; max-height: 28vh; object-fit: contain; display: block; }
#luTrophies { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.lu-trophy { display: flex; flex-direction: column; align-items: center; gap: .35rem; width: 7.5rem; min-height: 0; padding: .3rem; background: none; border: 0; box-shadow: none; color: inherit; cursor: pointer; text-align: center; }
.lu-trophy img { height: 5.5rem; width: auto; }
.lu-trophy b { font-size: .95rem; line-height: 1.15; }
.fish-name, .fish-sub, .fish-bonus { margin: 0; padding: .15rem .8rem; border-radius: 1rem; background: rgba(30, 24, 22, .8); color: #fff8e6; font-weight: 800; }
.fish-bonus { display: flex; gap: .8rem; align-items: center; justify-content: center; padding: .2rem .9rem; }
.fish-bonus[hidden] { display: none; }
.fish-bonus-item { display: flex; align-items: center; gap: .3rem; font-size: 1.15rem; }
.fish-bonus-item img { height: 2.4rem; width: auto; animation: fish-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.fish-name { font-size: 1.1rem; } .fish-sub { font-size: .9rem; } .fish-bonus { background: #2F6B3A; font-size: .95rem; }
@media (prefers-reduced-motion: reduce) { .fish-bobber img, .fish-ripples i, .fish-splash i, .fish-big { animation: none !important; } }
#fishing[data-state="result"] .fish-msg { display: none; }

/* Help Out in Mayor Ridley's garden: pieces laid over the scene, each tappable, with a soft glow so they are easy to spot */
.chore-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.chore { position: absolute; transform: translate(-50%, -100%); pointer-events: none; }
.chore img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.chore.night { filter: brightness(.82) saturate(.92) sepia(.12); }
.chore-tool { position: absolute; z-index: 2; pointer-events: none; width: auto; }
.chore-float { position: absolute; z-index: 3; transform: translate(-50%, -100%); font: 700 1.25rem var(--font-head, inherit); color: #fff7d6; text-shadow: 0 2px 0 #2A2222, 0 0 6px #2A2222; pointer-events: none; animation: choreFloat 1.6s ease-out forwards; white-space: nowrap; }
.chore-drop { position: absolute; z-index: 2; width: 6px; height: 10px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #9fd4ee; opacity: 0; pointer-events: none; animation: choreDrop .7s ease-in forwards; }
#yard.helping .place-ask { opacity: 0; pointer-events: none; }
#yard .place-ask { transition: opacity .5s ease; }
@keyframes choreGlow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 240, 170, 0)); } 50% { filter: drop-shadow(0 0 5px rgba(255, 236, 150, .95)); } }
@keyframes choreFloat { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -3rem; } }
@keyframes choreDrop { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translateY(42px); } }

#yard.helping .chore-layer { pointer-events: auto; touch-action: none; }
.chore-held { position: absolute; z-index: 4; width: auto; transform: translate(-50%, -62%); pointer-events: none; filter: drop-shadow(0 3px 3px rgba(42, 34, 34, .35)); transition: transform .15s ease; }
.chore-held.can { transform: translate(-50%, -62%) rotate(-22deg); }
.chore-pill { position: absolute; top: calc(3.6rem + env(safe-area-inset-top)); right: .8rem; z-index: 3; display: flex; gap: .35rem; padding: .3rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 2.2rem; box-shadow: var(--shadow); }
.chore-pill button { position: relative; width: 3.5rem; height: 3.5rem; min-height: 0; padding: .3rem; border: 0; border-radius: 50%; background: transparent; box-shadow: none; }
.chore-pill button img { width: 100%; height: 100%; object-fit: contain; display: block; }
.chore-pill button.on { background: #F7D58C; box-shadow: inset 0 0 0 2px var(--ink); }
.chore-pill button.done { opacity: .5; }
.chore-pill button b { position: absolute; right: -.15rem; bottom: -.15rem; min-width: 1.25rem; height: 1.25rem; padding: 0 .25rem; box-sizing: border-box; border-radius: .7rem; background: var(--ink); color: #fff; font: 700 .8rem/1.25rem var(--font-head, inherit); text-align: center; }
#yard.helping, #yard.helping * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.shop-exit.right { left: auto; right: .8rem; }
#yard.helping .yard-nav { display: none; }
/* a green dot: somewhere nearby needs help (the red dot is for something new) */
.gd-on { position: relative; }
.gd-on:not(.rd-on)::after { content: ''; position: absolute; top: .3rem; right: .3rem; width: .85rem; height: .85rem; border-radius: 50%; background: #3fa65a; border: 2px solid #fff; pointer-events: none; z-index: 3; }
.town-pill.gd-on:not(.rd-on)::after { top: 50%; right: .4rem; transform: translateY(-50%); }
.actions button.gd-on:not(.rd-on)::after { top: -.35rem; right: -.2rem; }
.chore-held.grab { transform: translate(-12%, -70%); }
.clean-foot { position: absolute; left: 0; right: 0; bottom: calc(.9rem + env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 0 .8rem; pointer-events: none; }
.clean-foot p { margin: 0; padding: .4rem .9rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; box-shadow: var(--shadow); font-weight: 700; font-size: .95rem; text-align: center; }
.clean-foot button { pointer-events: auto; }
#clean .chore-layer { pointer-events: auto; touch-action: none; }
#clean, #clean * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chore-pill button img[src*="grabber"] { transform: rotate(-32deg) scale(1.25); }
.clean-foot p { flex: 1 1 auto; max-width: 15rem; } .clean-foot button { white-space: nowrap; }

/* Help Out at the Boardwalk Arcade: the broken machine, its cord and plug, and the tools */
#repair .chore-layer { pointer-events: auto; touch-action: none; }
#repair, #repair * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rep-g { position: absolute; inset: 0; pointer-events: none; }
.rep-p { position: absolute; display: block; object-fit: contain; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); pointer-events: none; max-width: none; }
.rep-p.night { filter: brightness(.82) saturate(.92) sepia(.12); }
.rep-p.rep-glow { mix-blend-mode: screen; }
.rep-p.rep-grab { animation: repNudge 1.6s ease-in-out infinite; }
.rep-p.rep-held { animation: none; filter: drop-shadow(0 6px 5px rgba(42, 34, 34, .4)); z-index: 2; }
.rep-p.rep-loose { filter: drop-shadow(0 3px 2px rgba(42, 34, 34, .45)); }
.rep-cord { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.rep-flip { position: absolute; z-index: 3; right: .8rem; top: calc(3.6rem + 4.5rem + env(safe-area-inset-top)); }
#repair.zooming .chore-pill, #repair.zooming .rep-flip { display: none; }
.rep-zoom { position: absolute; inset: 0; z-index: 5; background: rgba(30, 20, 40, .9); touch-action: none; }
#repair.zooming #repBackG, #repair.zooming #repFront, #repair.zooming #repProps, #repair.zooming #repCord { visibility: hidden; }
.rep-z { position: absolute; display: block; max-width: none; pointer-events: none; }
.rep-z.zsock { transform: translate(-50%, -50%); }
.rep-z.zconn { z-index: 2; filter: drop-shadow(0 6px 5px rgba(0, 0, 0, .4)); }
.rep-zwire { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.rep-zx { position: absolute; left: .8rem; top: calc(6.4rem + env(safe-area-inset-top)); z-index: 3; }
.rep-puff { position: absolute; z-index: 3; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: rgba(255, 255, 255, .92); pointer-events: none; animation: repPuff .6s ease-out forwards; }
.rep-spark { position: absolute; z-index: 4; width: 7px; height: 26px; margin: -13px 0 0 -3px; border-radius: 4px; background: #f2b01e; border: 2px solid #b87a10; box-sizing: border-box; pointer-events: none; transform: rotate(var(--a, 0deg)) translateY(-18px); animation: repSpark .7s ease-out forwards; }
@keyframes repPuff { 0% { opacity: .95; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(var(--dx, -40px), var(--dy, 0)) scale(2.4); } }
@keyframes repSpark { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a, 0deg)) translateY(-40px); } }
@keyframes repNudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.chore-pill button img[src*="arc-wrench"] { transform: rotate(-34deg) scale(1.3); }
.arc-menu .arc-btn.gd-on::after { top: -.35rem; right: -.2rem; }
@media (prefers-reduced-motion: reduce) { .rep-p.rep-grab { animation: none; } }

/* ---- Help Out at the General Store: Agnes's four pups, each with a bed on its own row ---- */
.pup-help { flex: none; width: auto; margin: .55rem .8rem .8rem; position: relative; z-index: 1; }      /* a gap below it, so the goods never seem to slide into the button */
body.on-fixed-shop .shop-screen > #storeGrid { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 .8rem); mask-image: linear-gradient(to bottom, transparent 0, #000 .8rem); }      /* goods fade out at the top edge as they scroll away */
.pup-place { justify-content: flex-start; background-color: #f3efe7; background-image: repeating-linear-gradient(180deg, transparent 0 40px, rgba(120, 104, 90, .28) 40px 42px, rgba(255, 255, 255, .6) 42px 43px), linear-gradient(90deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, .03)); }      /* the store's white shiplap */
#puppies, #puppies * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pup-room { position: absolute; left: 0; right: 0; top: calc(3.6rem + 3rem + env(safe-area-inset-top)); bottom: calc(5.6rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; touch-action: none; z-index: 1; }
.pup-row { position: relative; flex: 1 1 0; min-height: 0; }
.pup-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 12%; background: #bf6f3d; border-top: 2px solid rgba(42, 34, 34, .35); }      /* the store's floorboards */
.pup-bed { position: absolute; left: 2%; bottom: 4%; height: 112%; aspect-ratio: 598 / 493; z-index: 1; pointer-events: none; }
.pup-bed img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.pup-bed img[hidden] { display: none; }
.pup-bed .pb-bot { inset: auto; }      /* the bottle is placed at the pup's mouth from the script */
.pb-fx.bang { transform-origin: 40% 90%; animation: pup-bang .3s ease-in-out infinite alternate; }
.pb-fx.zzz { animation: pup-zzz 2.6s ease-in-out infinite; }
.pup-pup { position: absolute; bottom: 2%; height: 46%; z-index: 3; touch-action: none; cursor: grab; }
.pup-body { width: 100%; height: 100%; --face: 1; transform: scaleX(var(--face)); pointer-events: none; }
.pup-body img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 100%; }
.pup-pup.moving .pup-body img { animation: pup-hop .34s ease-in-out infinite; }
.pup-up { position: absolute; left: 50%; bottom: 96%; height: 62%; width: auto; transform: translateX(-50%); pointer-events: none; animation: pup-bob 1.8s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(42, 34, 34, .3)); }
.pup-held { position: absolute; z-index: 8; pointer-events: none; transform: translate(-50%, -58%) rotate(-5deg); filter: drop-shadow(0 6px 5px rgba(42, 34, 34, .4)); }
.pup-held[hidden] { display: none; }
.pup-held > img:first-child { display: block; width: 100%; height: 100%; object-fit: contain; }
@keyframes pup-bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6%); } }
@keyframes pup-bang { from { transform: scale(1) rotate(-2deg); } to { transform: scale(1.06) rotate(2deg); } }
@keyframes pup-zzz { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-4%); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .pup-pup.moving .pup-body img, .pup-up, .pb-fx.bang, .pb-fx.zzz { animation: none; } }

/* the one line in the inventory that points players at the best way to cut mishaps */
.gear-tip { color: #b04510; font-weight: 800; }

/* ---- Buggingham Palace: sort the Queen's mail ---- */
.pal-help { position: absolute; left: 50%; bottom: calc(1.3rem + env(safe-area-inset-bottom)); translate: -50% 0; width: auto; padding: .55rem 1.8rem; z-index: 4; }      /* centred with translate, so the button's press effect (which sets transform) cannot knock it sideways */
.pal-help[hidden] { display: none; }
/* The table picture is 941 x 1672, fitted "cover, bottom" like the other scenes, so everything on it is placed in the picture's own fractions. */
.mail-place { justify-content: flex-start; background-color: #f4ad7b; container-type: size; }      /* sized by the screen's own frame, so on desktop the table fits the phone-shaped column */
.mail-stage { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: max(100cqw, calc(100cqh * 941 / 1672)); height: max(100cqh, calc(100cqw * 1672 / 941)); z-index: 1; touch-action: none; container-type: inline-size; }
.mail-room { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.mail-rule { position: absolute; inset: 0; pointer-events: none; }
.mail-sample { position: absolute; left: 12%; top: 15.5%; width: 18%; display: block; filter: drop-shadow(0 3px 2px rgba(42, 34, 34, .3)); }
.mail-arrow { position: absolute; top: 27.5%; width: 22.5%; height: auto; overflow: visible; }
.mail-arrow.left { left: 11%; } .mail-arrow.right { left: 67%; }
.mail-arrow path { fill: #fbf0ea; stroke: #2a2222; stroke-width: 7; stroke-linejoin: round; filter: drop-shadow(0 3px 2px rgba(42, 34, 34, .3)); }
.mail-arrow text { fill: #2a2222; stroke: none; filter: none; font: 700 30px var(--font-head, system-ui, sans-serif); }
.mail-bag { position: absolute; top: 72%; width: 34%; height: 24%; padding: 0; min-height: 0; border: 0; border-radius: 1.2rem; background: transparent; box-shadow: none; z-index: 2; }
.mail-bag.left { left: 2%; } .mail-bag.right { left: 64%; }
.mail-bag:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.mail-pile { position: absolute; left: 50%; top: 54.5%; width: 0; height: 0; z-index: 3; }
.mail-letter { position: absolute; left: 0; top: 0; width: 40vw; width: 40cqw; max-width: none; display: block; touch-action: none; user-select: none; -webkit-user-drag: none; cursor: grab;
  filter: drop-shadow(0 6px 4px rgba(42, 34, 34, .35));
  transform: translate(-50%, -50%) translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--rot, 0deg)) scale(var(--sc, 1)); transition: transform .2s ease-out; }
.mail-letter[hidden] { display: none; }
.mail-letter.dragging { transition: none; cursor: grabbing; }
.mail-letter.in { animation: mailIn .24s ease-out; }
.mail-letter.fly { transition: transform .3s cubic-bezier(.3, .7, .4, 1), opacity .12s linear .2s; opacity: 0; pointer-events: none; }
.mail-letter.nope { animation: mailNope .4s ease-out; }
@keyframes mailIn { from { opacity: 0; transform: translate(-50%, -50%) translateY(-1.6rem) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes mailNope { 0%, 100% { transform: translate(-50%, -50%); } 20% { transform: translate(-50%, -50%) translateX(-11px) rotate(-3deg); } 40% { transform: translate(-50%, -50%) translateX(11px) rotate(3deg); } 60% { transform: translate(-50%, -50%) translateX(-7px); } 80% { transform: translate(-50%, -50%) translateX(4px); } }
.mail-count { position: absolute; top: calc(3.6rem + env(safe-area-inset-top)); right: .8rem; z-index: 3; padding: .4rem .9rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; box-shadow: var(--shadow); font: 700 .9rem var(--font-head, inherit); }
@media (prefers-reduced-motion: reduce) { .mail-letter, .mail-letter.fly { transition-duration: .01s; } .mail-letter.in, .mail-letter.nope { animation-duration: .01s; } }

/* ---- Nicholas North's office: wrap the presents ---- */
/* The table picture is 941 x 1671, fitted "cover, bottom"; --u is one picture pixel, so every piece is placed in the picture's own pixels. */
.wrap-place { justify-content: flex-start; background-color: #3a2018; container-type: size; }      /* sized by the screen's own frame: on desktop that is the phone-shaped column, not the whole window */
.wrap-stage { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: max(100cqw, calc(100cqh * 941 / 1671)); height: max(100cqh, calc(100cqw * 1671 / 941)); z-index: 1; touch-action: none; container-type: inline-size; user-select: none; -webkit-user-select: none; }
.wrap-room { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.wrap-world { position: absolute; inset: 0; --u: calc(100cqw / 941); }
.wrap-sheetw { position: absolute; z-index: 2; left: calc(var(--u) * 210.5); top: calc(var(--u) * 560); width: calc(var(--u) * 520); height: calc(var(--u) * 520); filter: drop-shadow(0 calc(var(--u) * 5) calc(var(--u) * 6) rgba(20, 8, 4, .4)); pointer-events: none; }
.wrap-sheetw[hidden] { display: none; }
.wrap-sheet { position: absolute; inset: 0; background: var(--paper, none) center / 100% 100% no-repeat; }
.wrap-gift { position: absolute; z-index: 5; left: calc(var(--u) * 352.5); top: calc(var(--u) * 708); width: calc(var(--u) * 236); height: calc(var(--u) * 224); perspective: calc(var(--u) * 1000); pointer-events: none; }
.wrap-box { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: drop-shadow(0 calc(var(--u) * 6) calc(var(--u) * 6) rgba(20, 8, 4, .4)); -webkit-user-drag: none; }
.wrap-flap { position: absolute; transform-style: preserve-3d; }
.wrap-flap > i { position: absolute; inset: 0; display: block; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--paper, none) no-repeat; background-size: calc(var(--u) * 520) calc(var(--u) * 520); box-shadow: 0 calc(var(--u) * 2) calc(var(--u) * 7) rgba(20, 8, 4, .3); }
.wrap-flap.wf-top { left: 0; top: calc(var(--u) * -148); width: 100%; height: calc(var(--u) * 148); transform-origin: 50% 100%; }
.wrap-flap.wf-top > i { background-position: calc(var(--u) * -142) 0; }
.wrap-flap.wf-bottom { left: 0; top: 100%; width: 100%; height: calc(var(--u) * 148); transform-origin: 50% 0; }
.wrap-flap.wf-bottom > i { background-position: calc(var(--u) * -142) calc(var(--u) * -372); }
.wrap-flap.wf-left { left: calc(var(--u) * -142); top: 0; width: calc(var(--u) * 142); height: 100%; transform-origin: 100% 50%; }
.wrap-flap.wf-left > i { background-position: 0 calc(var(--u) * -148); }
.wrap-flap.wf-right { left: 100%; top: 0; width: calc(var(--u) * 142); height: 100%; transform-origin: 0 50%; }
.wrap-flap.wf-right > i { background-position: calc(var(--u) * -378) calc(var(--u) * -148); }
.wrap-flap.wf-top > i.back, .wrap-flap.wf-bottom > i.back { transform: rotateX(180deg); }
.wrap-flap.wf-left > i.back, .wrap-flap.wf-right > i.back { transform: rotateY(180deg); }
.wrap-top { position: absolute; inset: 0; display: none; box-sizing: border-box; background: var(--paper, none) no-repeat; background-size: calc(var(--u) * 520) calc(var(--u) * 520); background-position: calc(var(--u) * -142) calc(var(--u) * -148); background-origin: border-box; border: calc(var(--u) * 4) solid #4c251d; border-radius: calc(var(--u) * 16);
  box-shadow: inset 0 calc(var(--u) * 6) 0 rgba(255, 255, 255, .22), inset 0 calc(var(--u) * -9) 0 rgba(0, 0, 0, .2), 0 calc(var(--u) * 9) calc(var(--u) * 10) rgba(20, 8, 4, .42); }
.wrap-gift.flipped .wrap-top { display: block; }
.wrap-gift.flipped .wrap-box, .wrap-gift.flipped .wrap-flap, .wrap-gift.flipped .wrap-tape-on { visibility: hidden; }
.wrap-bowed { position: absolute; z-index: 50; left: 50%; top: 46%; transform: translate(-50%, -50%); display: block; filter: drop-shadow(0 calc(var(--u) * 5) calc(var(--u) * 4) rgba(20, 8, 4, .4)); -webkit-user-drag: none; }
.wrap-bowed[hidden], .wrap-tape-on[hidden], .wrap-tape-drag[hidden], .wrap-ghost[hidden], .wrap-tray[hidden] { display: none; }
.wrap-tape-on { position: absolute; z-index: 40; left: 50%; top: 50%; width: calc(var(--u) * 200); transform: translate(-50%, -50%) rotate(-4deg); display: block; filter: drop-shadow(0 calc(var(--u) * 3) calc(var(--u) * 3) rgba(20, 8, 4, .4)); -webkit-user-drag: none; }
#wrapTool { touch-action: none; }
#wrapTool.nudge { animation: wrapNudge 1s ease-in-out infinite; }
#wrapCount { top: calc(8.4rem + env(safe-area-inset-top)); }
.wrap-tape-drag { position: absolute; z-index: 8; left: 0; top: 0; width: calc(var(--u) * 190); transform: translate(-50%, -50%) rotate(-6deg); display: block; touch-action: none; cursor: grab; filter: drop-shadow(0 calc(var(--u) * 4) calc(var(--u) * 4) rgba(20, 8, 4, .45)); -webkit-user-drag: none; }
.wrap-tape-drag.pop, .wrap-tape-on.pop, .wrap-bowed.pop { animation: wrapPop .32s ease-out; }
.wrap-tray { position: absolute; z-index: 5; left: .5rem; right: .5rem; bottom: calc(5.4rem + env(safe-area-inset-bottom)); display: flex; gap: .25rem; padding: .4rem .5rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1.1rem; box-shadow: var(--shadow); animation: wrapTray .3s ease-out; }
.wrap-bowbtn { flex: 1 1 0; min-width: 0; height: 3.7rem; padding: .15rem; min-height: 0; border: 0; background: transparent; box-shadow: none; display: flex; align-items: center; justify-content: center; touch-action: none; }
.wrap-bowbtn[data-bow="pink"], .wrap-bowbtn[data-bow="purple"] { flex-grow: 1.4; }      /* the long, low bows get a little more room */
.wrap-bowbtn img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.wrap-bowbtn:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.wrap-ghost { position: fixed; z-index: 30; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 6px 4px rgba(20, 8, 4, .45)); }
@keyframes wrapNudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes wrapPop { 0% { transform: translate(-50%, -50%) scale(.6) rotate(var(--r, -4deg)); opacity: 0; } 60% { transform: translate(-50%, -50%) scale(1.12) rotate(var(--r, -4deg)); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(var(--r, -4deg)); } }
@keyframes wrapTray { from { opacity: 0; transform: translateY(1.2rem); } to { opacity: 1; transform: none; } }
.wrap-tape-drag { --r: -6deg; } .wrap-bowed { --r: 0deg; }
@media (prefers-reduced-motion: reduce) { #wrapTool.nudge, .wrap-tape-drag.pop, .wrap-tape-on.pop, .wrap-bowed.pop, .wrap-tray { animation: none; } }

/* ---- Polarville: shovel the snow off the square ---- */
/* While helping, the town list, the pins and Back to Base step aside; the picture stays. */
#townPolar:not(.helping) .chore-layer, #townPolar:not(.helping) #polarPill, #townPolar:not(.helping) #polarFoot, #townPolar:not(.helping) #polarChoreBack { display: none; }
#townPolar.helping .town-pills, #townPolar.helping #polarBack { display: none; }
#townPolar.helping .chore-layer { pointer-events: auto; touch-action: none; }
#townPolar.helping #polarChoreBack, #townPolar.helping #polarPill, #townPolar.helping #polarFoot { display: flex; }
#townPolar.helping #polarChoreBack { display: block; }
.chore-held.shovel { transform: translate(-46%, -84%); }
.snow-pile { --sc: 1; transform: translate(-50%, -100%) scale(var(--sc)); transform-origin: 50% 100%; transition: transform .26s ease-out, opacity .36s ease-out; filter: drop-shadow(0 2px 2px rgba(42, 34, 34, .25)); }
.snow-pile.night { filter: brightness(.82) saturate(.92) sepia(.12) drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.snow-puff { position: absolute; z-index: 2; width: var(--sz, 7px); height: var(--sz, 7px); margin: -3px 0 0 -3px; border-radius: 50%; background: #fbf8ff; box-shadow: 0 0 0 1.5px #b9b3d4; pointer-events: none; animation: snowPuff .62s ease-out forwards; }
@keyframes snowPuff { from { opacity: 1; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -40px)) scale(.4); } }
@media (prefers-reduced-motion: reduce) { .snow-pile { transition-duration: .01s; } .snow-puff { animation-duration: .01s; } }

.build-stamp { text-align: center; font-size: .8rem; margin: 1rem 0 .5rem; }      /* compare this number across devices to see whether a page is out of date */

/* Plushies: in the adventurer's inventory, under the gear, each at its own size (--pw is the art's width in art units; about three of a typical size fit a row), standing on a shared baseline and wrapping into rows. */
.plush-section { margin-top: 1rem; padding-top: .9rem; border-top: 2px dotted #d9c3b1; }
.plush-title { margin: 0 0 .6rem; font-size: 1.05rem; text-align: center; }
.plush-box { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: .55rem .35rem; container-type: inline-size; }
.plush { all: unset; box-sizing: border-box; display: block; cursor: pointer; width: calc(var(--pw) / 1600 * 100cqw); border-radius: .5rem; }
.plush img { display: block; width: 100%; height: auto; }
.plush:focus-visible { outline: 3px solid #b04510; outline-offset: 2px; }
.plush-name { text-align: center; min-height: 1.4em; margin: .6rem 0 0; font-weight: 800; }
/* Blissful Chance: the plushie on its prize card, and the Swap grid */
.cw-plush { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: .2rem 0 .4rem; }
.cw-plush img { width: calc(var(--pw) / 480 * 8rem); max-width: 70%; height: auto; }
.cw-plush b { font-size: 1.1rem; }
.cw-swap-grid { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: .5rem; margin: .6rem 0; max-height: 52vh; overflow-y: auto; padding: .2rem; container-type: inline-size; }
.cw-swap-pick { all: unset; box-sizing: border-box; display: block; cursor: pointer; width: calc(var(--pw) / 1650 * 100cqw); border: 3px solid transparent; border-radius: .6rem; }
.cw-swap-pick img { display: block; width: 100%; height: auto; }
.cw-swap-pick.picked { border-color: var(--ink); }
.cw-swap-pick:focus-visible { outline: 3px solid #b04510; }
#cwSwap .panel { background: var(--pearl-bush); }

/* ---- Encounter gallery (the founder's account only): every visitor, with where they appear, and a Play button that shows them without changing the game ---- */
.encg { position: fixed; inset: 0; z-index: 8800; overflow-y: auto; background: #f4ecdb; padding: 1rem .8rem 3rem; }
.encg[hidden] { display: none; }
.encg-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.encg-head h2 { margin: 0; }
.encg-q { width: 100%; margin: .4rem 0 .8rem; padding: .55rem .7rem; font: inherit; border: var(--outline, 2px) solid var(--ink, #2a2222); border-radius: .8rem; background: #fff; }
.encg-row { display: flex; gap: .7rem; align-items: center; padding: .5rem .6rem; margin-bottom: .5rem; background: #fff; border: 2px solid var(--ink, #2a2222); border-radius: 1rem; }
.encg-row img { flex: none; width: 3.4rem; height: 4.2rem; object-fit: contain; object-position: bottom center; }
.encg-txt { flex: 1 1 auto; min-width: 0; }
.encg-txt b { display: block; }
.encg-txt small { display: block; opacity: .75; line-height: 1.25; }
.encg-play { display: flex; flex-direction: column; gap: .3rem; flex: none; }
.encg-play button { padding: .35rem .7rem; }

/* The penguin children's name chips: one place each along the bottom of the bubble, so the position says which child is speaking */
.enc-chips { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 3; pointer-events: none; }
.enc-chips[hidden] { display: none; }
.enc-chips span { position: absolute; bottom: 0; transform: translateY(48%); padding: .28em .8em; background: #000; color: #fff; border-radius: 999px; font: 600 1rem/1.2 var(--font-head); white-space: nowrap; opacity: .45; }
.enc-chips span.now { opacity: 1; }
.enc-chips span[hidden] { display: none; }
.enc-chips span[data-kid="Blue"] { left: 2.4%; }
.enc-chips span[data-kid="Pistachio"] { left: 50%; transform: translate(-50%, 48%); }
.enc-chips span[data-kid="Maple"] { right: 2.4%; }
.enc[data-chips="1"] .enc-bubble { padding-bottom: 1.5rem; }
.enc[data-chips="1"] .enc-more { bottom: 1rem; }
@media (max-width: 380px) { .enc-chips span { font-size: .85rem; padding: .25em .6em; } }
/* Short treatment for single encounters whose pose is wide (Royal Guards #2 and #5): the bubble lifts above the figure and the chip drops to the bottom */
.enc[data-short="1"] { --h: min(66vw, 47vh); }
.enc[data-short="1"] .enc-art { height: var(--h); }
.enc[data-short="1"] .enc-row { bottom: calc(3vw + var(--h) + 6vw + env(safe-area-inset-bottom)); height: auto; align-items: flex-end; }
.enc[data-short="1"] .enc-bubble[data-name]:not([data-name=""])::before { top: auto; bottom: 0; transform: translateY(48%); }
.enc[data-short="1"] .enc-x { align-self: center; margin-top: 0; }
.enc[data-short="1"] .enc-bubble { padding: .7rem .8rem 1.5rem; }
.enc[data-npc="triplets"] .enc-row { left: 3vw; right: 3vw; }      /* the children stand below the bubble, so it can run the full width and hold all three chips */
.enc-chips span { font-size: .92rem; }

/* The pups' ten-minute nap after Help Out: Dashing sleeps in the basket (its front rim hides his lower edge), the others stand still and drowse */
#gsNap { position: absolute; height: auto; pointer-events: none; }
#gsNap[hidden] { display: none; }
.gs-pup.asleep::after { content: "z z"; position: absolute; left: 50%; top: -22%; transform: translateX(-50%); font: 700 .85rem/1 var(--font-head); color: #6b4a2b; opacity: .8; animation: pup-z 2.4s ease-in-out infinite; white-space: nowrap; }
@keyframes pup-z { 50% { transform: translate(-50%, -.35rem); opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .gs-pup.asleep::after { animation: none; } }
#yardFoot { display: none; }
#yard.helping #yardFoot { display: flex; }      /* the garden's instruction line, like the other chores */
#yardFoot p { max-width: 15rem; text-align: center; white-space: nowrap; padding-left: .6rem; padding-right: .6rem; }

/* Choosing an avatar */
.av-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: .6rem 0 .8rem; }
.av-tile { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .35rem .25rem .45rem; min-height: 0; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--line); border-radius: 1.1rem; box-shadow: none; font-weight: 700; font-size: .8rem; line-height: 1.15; }
.av-tile.on { border-color: var(--button); box-shadow: 0 0 0 3px #f7c9a0; }
.av-pic { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: .8rem; overflow: hidden; background: var(--cream); }
.av-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-pic svg { width: 60%; height: 60%; }
.av-name { text-align: center; }
#avSave { width: 100%; }
#avSave:disabled { opacity: .55; }

/* ---- Map pin: each place is a band of its scene with its name over it ---- */
.item.band { position: relative; padding: 0; min-height: 0; aspect-ratio: 941 / 314; justify-content: center; background-size: cover; background-position: center; background-repeat: no-repeat; background-color: #5D4D4A; overflow: hidden; }
.item.band::before { content: ''; position: absolute; inset: 0; background: rgba(20, 14, 14, .28); pointer-events: none; }
.item.band.band-plain::before { display: none; }
.item.band .band-name { position: relative; z-index: 1; font: 600 clamp(1.25rem, 6vw, 1.7rem) var(--font-head); color: #fff7e6; text-align: center; padding: 0 .6rem; -webkit-text-stroke: .28rem var(--ink); paint-order: stroke fill; line-height: 1.1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Ominous Sealed Portal and the Underborough: a stage the size of the picture, centred, so everything on it stays on the art ---- */
.u-stage { position: absolute; left: 50%; top: 50%; height: 100%; aspect-ratio: 941 / 1672; transform: translate(-50%, -50%); container-type: size; background-size: 100% 100%; background-repeat: no-repeat; }
@media (min-aspect-ratio: 5628 / 10000) { .u-stage { height: auto; width: 100%; } }      /* a wider screen fits the picture's width instead (the place itself stops at a phone's shape on a desktop) */
.u-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.metro-hit { fill: transparent; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.metro-hit:active, .metro-hit:focus-visible { fill: rgba(255, 247, 230, .22); }
.portal-riddle { position: absolute; left: 30%; width: 40%; top: 36%; margin: 0; text-align: center; font: 600 calc(100cqw * .036) / 1.3 var(--font-head); color: #f6cf62; text-shadow: 0 0 .5em rgba(246, 207, 98, .75), 0 0 1.4em rgba(246, 170, 40, .5), 0 .06em 0 #2a1c08; animation: portal-pulse 2.6s ease-in-out infinite; }
.portal-riddle.swap { animation: portal-swap .9s ease both, portal-pulse 2.6s ease-in-out .9s infinite; }
@keyframes portal-pulse { 0%, 100% { opacity: .78; } 50% { opacity: 1; } }
@keyframes portal-swap { from { opacity: 0; transform: translateY(.4em); } to { opacity: 1; transform: none; } }
.portal-star { position: absolute; left: 49.95%; top: 17.6%; width: 16%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 214, 110, .95) 0%, rgba(255, 190, 70, .55) 28%, rgba(255, 170, 40, 0) 68%); mix-blend-mode: screen; opacity: 0; pointer-events: none; animation: star-pulse 2.8s ease-in-out infinite; }
#portalStage[data-locks="1"] .portal-star { opacity: .35; }
#portalStage[data-locks="2"] .portal-star { opacity: .65; }
#portalStage[data-locks="3"] .portal-star { opacity: 1; }
@keyframes star-pulse { 0%, 100% { transform: translate(-50%, -50%) scale(.92); } 50% { transform: translate(-50%, -50%) scale(1.08); } }
.portal-ask form { display: flex; gap: .5rem; width: min(24rem, 100%); }
.portal-ask input { flex: 1; min-width: 0; font: 600 1.1rem var(--font-body); color: var(--ink); background: var(--paper); border: var(--outline) solid var(--ink); border-radius: var(--radius); padding: .55rem .8rem; }
.portal-ask form[hidden], .portal-ask button[hidden] { display: none; }
.portal-err { margin: 0; min-height: 1.5rem; font: 700 1.05rem var(--font-body); color: #ff5a4d; text-shadow: 0 1px 0 #2a1c08, 0 0 6px rgba(0, 0, 0, .8); text-align: center; }
#portal.fading .u-stage, #portal.fading .place-ask { transition: opacity 1.4s ease; opacity: 0; }
.borough-card { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: .3rem; background: #2a2230; color: #fff7e6; }
.borough-card h2 { font-size: 2rem; margin: 0; }
.borough-card .quiet { color: #cdbfd6; }

/* ---- Fate's dialogue box: the same bubble as every other place, with a tap-for-more arrow ---- */
.fate-bubble { cursor: pointer; }
.fate-bubble.more::after { content: '\25BE'; position: absolute; right: .8rem; bottom: .3rem; font-size: .9rem; color: var(--quiet); animation: portal-pulse 1.6s ease-in-out infinite; }
.fate-bubble p { margin-bottom: 0; }
.place-ask > button.small { align-self: center; padding: .3rem .8rem; font-size: .85rem; min-height: 0; }

/* ---- Every screen in the game shares one set of button sizes and fonts. The Underborough keeps all of them and changes only the
   colour: each borough has one primary colour, in place of the orange, so the whole borough reads as a single colour.
   To theme a new borough, add one block of these seven colours. ---- */
#borough[data-b="ashwick"], #fate { --button: #3769a0; --button-dark: #274b73; --button-ink: #ffffff; --link: #2a5a8c; --paper: #eef4fb; --ink: #1d2b45; --quiet: #56698a; }
#borough[data-b="velmoor"], #velParty, #meeting { --button: #8a2f49; --button-dark: #5c1d30; --button-ink: #ffffff; --link: #7a2840; --paper: #f8eef0; --ink: #2b1219; --quiet: #7a5a62; }
#borough[data-b="ward"], #armWrestle, #championship { --button: #141012; --button-dark: #000000; --button-ink: #ffffff; --link: #9a2a31; --paper: #f8eeee; --ink: #2a1a1b; --quiet: #735a5b; }      /* The Ward: black buttons, white letters */
#borough[data-b="selene"] { --button: #804689; --button-dark: #5a2f61; --button-ink: #ffffff; --link: #6e3a77; --paper: #f3eef5; --ink: #261b29; --quiet: #675a6b; }
#borough[data-b="grabbleton"], #commissary, #races, #shells { --button: #5e7a25; --button-dark: #42561a; --button-ink: #ffffff; --link: #4f6720; --paper: #f1f4ea; --ink: #1f2616; --quiet: #5f6a4d; }
.place-ask[hidden] { display: none; }

/* ---- Velmoor: Prince Obscura's lines, the party bubbles and the meeting doors ---- */
.talk-line { cursor: pointer; }
.talk-line.more::after { content: '\25BE'; display: inline-block; box-sizing: border-box; width: 1.55rem; height: 1.55rem; line-height: 1.3rem; text-align: center; margin-left: .45rem; vertical-align: middle; border: .13rem solid var(--ink, currentColor); border-radius: 50%; color: var(--ink, currentColor); animation: arrow-ring 1.6s ease-in-out infinite; }      /* a ring round the arrow: tap the line for the next one */
@keyframes arrow-ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .0); opacity: .75; transform: translateY(0); } 50% { box-shadow: 0 0 0 .3rem rgba(255, 255, 255, .28); opacity: 1; transform: translateY(.1rem); } }
#meetLine, #boroughLine { margin-bottom: .65rem; }
.say-layer { position: absolute; inset: 0; pointer-events: none; }
.say { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 38cqw; box-sizing: border-box; transform: translate(-50%, -50%); padding: 1.7rem 1rem .8rem; text-align: center; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1.2rem; box-shadow: var(--shadow); font: 700 max(1rem, 4.3cqw) / 1.25 var(--font-body); pointer-events: auto; cursor: pointer; animation: say-in .35s ease both; }
.say::before { content: 'Party Go-er'; position: absolute; left: 1.15em; top: 0; transform: translateY(-32%); padding: .3em .7em; background: #111; color: #fff; border-radius: 999px; font: 800 1.05rem / 1.2 var(--font-head); white-space: nowrap; pointer-events: none; }
.say::after { content: ''; position: absolute; left: calc(50% + var(--tx) * 100%); width: .9rem; height: .9rem; background: var(--paper); transform: translateX(-50%) rotate(45deg); }
.say.down::after { bottom: -.58rem; border-right: var(--outline) solid var(--ink); border-bottom: var(--outline) solid var(--ink); }
.say.up::after { top: -.58rem; border-left: var(--outline) solid var(--ink); border-top: var(--outline) solid var(--ink); }
.say.up { min-width: max(38cqw, 11.4rem); }      /* room on the top edge for the tail, past the name chip */
.say.up::after { left: calc(100% - 1.25rem); }
.say.out { animation: say-out .4s ease both; }
@keyframes say-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes say-out { to { opacity: 0; transform: translate(-50%, -54%) scale(.96); } }
.doors { position: absolute; inset: 0; z-index: 2; cursor: pointer; perspective: 120cqw; outline: none; }
.doors[hidden] { display: none; }
.door-half { position: absolute; top: 0; height: 100%; width: 50%; background-image: url('art/underborough/velmoor-doors.webp'); background-size: 200% 100%; transition: transform 1.6s cubic-bezier(.5, 0, .3, 1); backface-visibility: hidden; }
.door-half.l { left: 0; background-position: 0 0; transform-origin: 0 50%; }
.door-half.r { right: 0; background-position: 100% 0; transform-origin: 100% 50%; }
.doors.open { pointer-events: none; }
.doors.open .door-half.l { transform: rotateY(82deg); }
.doors.open .door-half.r { transform: rotateY(-82deg); }
@media (prefers-reduced-motion: reduce) { .door-half { transition: opacity .3s ease; } .doors.open .door-half { transform: none; opacity: 0; } .say, .say.out { animation-duration: .01s; } }

/* ---- Grabbleton: the Commissary's four things over the counter, and the race tags over the start line ---- */
.comm-items { position: absolute; inset: 0; }
.comm-tile { position: absolute; width: 39.2%; height: 13.2%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6cqw; padding: 1cqw 1.4cqw; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 4.2cqw; box-shadow: 0 .2rem 0 rgba(42, 34, 34, .3); font: inherit; text-align: center; cursor: pointer; }
.comm-tile:disabled { opacity: .75; cursor: default; }
.comm-tile:focus-visible { outline: 3px solid var(--button); outline-offset: 2px; }
.comm-tile img { flex: none; height: 46%; width: auto; max-width: 60%; object-fit: contain; }
.comm-name { font: 700 max(.78rem, 3.4cqw) / 1.1 var(--font-body); }
.comm-price { font: 600 max(.72rem, 3.1cqw) / 1.1 var(--font-body); color: var(--quiet); }
.comm-tile[data-item="rations"] { left: 10.6%; top: 66.4%; }
.comm-tile[data-item="goblin-dagger"] { left: 50.9%; top: 66.4%; }
.comm-tile[data-item="goblin-shield"] { left: 10.6%; top: 80.9%; }
.comm-tile[data-item="tortishell"] { left: 50.9%; top: 80.9%; }
.race-tags { position: absolute; inset: 0; }
.race-tags[hidden] { display: none; }
.race-tag { position: absolute; left: calc(var(--x) * 1%); top: 33%; min-width: 12.6%; white-space: nowrap; translate: -50% 0; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 0; padding: .9cqw 1.3cqw; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 2.6cqw; box-shadow: 0 .15rem 0 rgba(42, 34, 34, .3); font: inherit; cursor: pointer; }
.race-tag b { font: 800 max(.62rem, 2.9cqw) / 1.1 var(--font-head); }
.race-tag i { font: 700 max(.62rem, 2.8cqw) / 1.1 var(--font-body); font-style: normal; color: var(--quiet); }
.race-tag, button.race-tag:hover, button.race-tag:active:not(:disabled), button.race-tag:focus { transform: none; box-shadow: 0 .15rem 0 rgba(42, 34, 34, .3); }      /* the page's button press effect must not move the tag out from under the finger */
.race-tag.on { background: var(--button); color: var(--button-ink); }
.race-tag.on i { color: var(--button-ink); }
.race-tag:disabled { cursor: default; }
.race-tag:focus-visible { outline: 3px solid var(--button); outline-offset: 2px; }
#raceBubble p { margin-bottom: .5rem; }
#raceBubble .race-fine { font-size: .85rem; font-weight: 600; margin-bottom: .6rem; }
#raceResult { font-size: 1.05rem; }
.bet-row { display: flex; align-items: stretch; justify-content: center; gap: .5rem; margin-bottom: .45rem; }
.bet-row[hidden], #raceBubble [hidden], #shellBubble [hidden] { display: none; }
.bet-row button { flex: none; width: 3.2rem; min-height: 0; padding: 0; font-size: 1.6rem; line-height: 1; }
.bet-row input { flex: 1; min-width: 0; max-width: 11rem; box-sizing: border-box; text-align: center; font: 800 1.35rem / 1.2 var(--font-head); color: var(--ink); background: #fff; border: var(--outline) solid var(--ink); border-radius: .9rem; padding: .35rem .4rem; }
.bet-row input:focus-visible { outline: 3px solid var(--button); outline-offset: 2px; }
#shellBubble { padding-bottom: .65rem; }
#shellBubble.beach-bubble[data-name]:not([data-name=""]) { padding-top: 1.4rem; }
#shellBubble p { margin: 0 0 .35rem; font-size: 1.05rem; line-height: 1.25; }
#shellBubble .race-fine { font-size: .8rem; font-weight: 600; margin-bottom: .4rem; }
#shellBubble .bet-row { margin-bottom: .3rem; }
#shellBubble .bet-row button, #shellBubble .bet-row input { min-height: 2.5rem; }
#shellBubble .bet-row input { font-size: 1.15rem; padding-top: .15rem; padding-bottom: .15rem; }
#shellBubble .place-choices button { min-height: 2.6rem; padding-top: .35rem; padding-bottom: .35rem; }
#shells #shellMute { position: fixed; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 3; margin: 0; }
.comm-say { position: absolute; left: 59.5%; bottom: 53.2%; width: 30%; box-sizing: border-box; padding: .6rem .7rem 1.5rem; text-align: center; background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1.2rem; box-shadow: var(--shadow); font: 700 max(.95rem, 4.1cqw) / 1.25 var(--font-body); z-index: 2; }
.comm-say p { margin: 0; }
.comm-say::before { content: attr(data-name); position: absolute; left: 1.15em; bottom: 0; transform: translateY(40%); padding: .3em .7em; background: #111; color: #fff; border-radius: 999px; font: 800 1.05rem / 1.2 var(--font-head); white-space: nowrap; }
.shell-cans { position: absolute; inset: 0; }
.shell-can { position: absolute; left: calc((25 + var(--p) * 25) * 1%); top: 66%; width: 15.4%; aspect-ratio: .92; translate: -50% 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; min-height: 0; color: inherit; cursor: pointer; transition: left .38s ease, top .38s ease; -webkit-tap-highlight-color: transparent; }
button.shell-can:hover, button.shell-can:active:not(:disabled), button.shell-can:disabled, button.shell-can:focus { background: none; box-shadow: none; transform: none; }
.shell-can:disabled { cursor: default; }
.shell-can:focus-visible { outline: 3px solid var(--button); outline-offset: 4px; border-radius: 1rem; }
.shell-can.fore { top: 68.6%; z-index: 3; }
.shell-can.back { top: 63.4%; z-index: 1; }
.shell-can .can-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 2; transition: transform .5s ease; pointer-events: none; }
.shell-can .ball { position: absolute; left: 50%; bottom: 4%; width: 36%; transform: translateX(-50%); z-index: 1; opacity: 0; pointer-events: none; }
.shell-can.has-ball .ball { opacity: 1; }
.shell-can.lift .can-img { transform: translateY(-62%); }
@media (max-height: 780px) { .shell-can { top: 64%; } .shell-can.fore { top: 66.6%; } .shell-can.back { top: 61.4%; } }
@media (prefers-reduced-motion: reduce) { .shell-can, .shell-can .can-img { transition: none; } }

/* the metro station: a mute button, and the headlight of a train sliding across the tiled wall (it never catches a tap) */
#metro #metroMute { position: fixed; bottom: calc(1.1rem + env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; z-index: 3; margin: 0; }      /* bottom centre, like every other Sound button (translate, not transform: the press effect would otherwise make it jump) */
#metro #metroMute:active:not(:disabled) { transform: none; }
.train-glow { position: absolute; top: 0; bottom: 0; left: 20%; width: 60%; pointer-events: none; opacity: 0; mix-blend-mode: multiply; background: linear-gradient(90deg, transparent 0%, rgba(255, 190, 60, 0) 16%, rgba(255, 196, 70, .55) 40%, rgba(255, 214, 110, .75) 50%, rgba(255, 196, 70, .55) 60%, rgba(255, 190, 60, 0) 84%, transparent 100%); }      /* warm light over the wall; multiply keeps the black lines and the map's colours reading as they are */

#commissary #commMute { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 3; margin: 0; }      /* top right, out of the way of the items */

/* The Ward: the Dark Knights' noises, popping up beside each knight on the road */
.ono-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ono { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); translate: -50% -50%; rotate: var(--r, 0deg); font: 900 italic clamp(1.5rem, 8cqw, 2.4rem) / 1 var(--font-head); letter-spacing: .02em; color: #fff7ea; -webkit-text-stroke: .28rem #140b0c; paint-order: stroke fill; text-shadow: 0 .15rem 0 rgba(0, 0, 0, .35); white-space: nowrap; animation: ono-pop 2.5s ease both; }
@keyframes ono-pop { 0% { opacity: 0; transform: scale(.5); } 12% { opacity: 1; transform: scale(1.18); } 22% { transform: scale(1); } 80% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-.8rem); } }
/* Arm wrestling: the tug-of-war track. Gold is the guild, blue the Dark Knight, the token starts in the middle. */
.arm-track { position: relative; display: grid; grid-template-columns: 1.15fr 1fr 1fr 1.1fr 1fr 1fr 1.15fr; height: 2.3rem; margin: .1rem 0 .7rem; border: var(--outline) solid var(--ink); border-radius: .8rem; overflow: hidden; background: #111; }
.arm-track .z { display: grid; place-items: center; font: 800 .8rem / 1 var(--font-head); font-style: normal; color: #fff; }
.arm-track .z.gold { background: #f2a024; } .arm-track .z.blue { background: #4fc3e8; } .arm-track .z.mid { background: #cfc7c2; } .arm-track .z.end { background: #141012; letter-spacing: .04em; }
.arm-track .z + .z { border-left: .12rem solid #141012; }
.arm-token { --i: 3; position: absolute; top: 50%; left: calc((var(--i) + .5) / 7 * 100%); translate: -50% -50%; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: #5bbf3a; border: .17rem solid #141012; box-shadow: 0 .1rem 0 rgba(0, 0, 0, .35), inset 0 0 0 .18rem #b9f08e; transition: left .34s cubic-bezier(.3, 1.4, .5, 1); }
.arm-track.live { animation: arm-strain .5s ease-in-out infinite alternate; }
@keyframes arm-strain { from { transform: translateX(-1px); } to { transform: translateX(1px); } }
#armWrestle #armGo:active:not(:disabled) { transform: none; }
@media (prefers-reduced-motion: reduce) { .arm-track.live { animation: none; } .ono { animation-duration: 3s; } }

/* The Ward Championship: cards over the arena */
#champStage { filter: brightness(.5) saturate(.9); }
.champ-scroll { position: absolute; left: 0; right: 0; bottom: 0; top: calc(6.2rem + env(safe-area-inset-top)); overflow-y: auto; padding: .2rem .8rem 1rem; box-sizing: border-box; -webkit-overflow-scrolling: touch; }
.champ-title { margin: 0 0 .15rem; font: 900 1.55rem / 1.1 var(--font-head); color: #fff; text-align: center; text-shadow: 0 .12rem 0 #000; }
.champ-sub { margin: 0 0 .7rem; text-align: center; color: #f4dede; font-weight: 700; font-size: .95rem; }
.fight, .champ-last, .champ-slip { background: var(--paper); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: 1rem; padding: .6rem .6rem .5rem; margin: 0 auto .8rem; max-width: 30rem; box-sizing: border-box; }
.fight.title { border-color: #d6a32a; box-shadow: 0 0 0 .18rem #d6a32a55; }
.fight-head { margin: 0 0 .45rem; text-align: center; font: 900 1.05rem / 1.1 var(--font-head); letter-spacing: .02em; text-transform: uppercase; }
.fight.title .fight-head { color: #9b6a00; }
.fight-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .3rem; align-items: start; }
.vs { align-self: center; font: 900 1.25rem / 1 var(--font-head); color: var(--button); }
button.side { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 100%; min-height: 0; padding: .45rem .25rem .5rem; background: transparent; color: var(--ink); border: .17rem solid transparent; border-radius: .9rem; box-shadow: none; font: inherit; text-align: center; }
button.side:disabled { opacity: 1; }
button.side[aria-pressed="true"] { background: #141012; color: #fff; border-color: #141012; }
button.side .face { position: relative; display: block; width: 4.6rem; height: 4.6rem; border-radius: 50%; background: #3b1219; border: .17rem solid #141012; overflow: visible; }
button.side .face img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
button.side .crown { position: absolute; left: 50%; bottom: -.55rem; translate: -50% 0; padding: .05rem .5rem; background: #d6a32a; color: #231900; border: .12rem solid #141012; border-radius: 999px; font: 900 .68rem / 1.3 var(--font-head); text-transform: uppercase; white-space: nowrap; }
button.side .pays { margin-top: .35rem; font: 900 1.05rem / 1 var(--font-head); }
button.side .kstats { display: flex; flex-direction: column; gap: .08rem; font-size: .74rem; line-height: 1.2; font-weight: 600; opacity: .85; }
button.side:active:not(:disabled) { transform: none; }
button.side.won { background: #d9efc9; border-color: #3f8f1f; color: #14310a; }
button.side.won .face { border-color: #3f8f1f; }
button.side.lost { opacity: .55; }
.fight-note { margin: .45rem 0 0; text-align: center; font-weight: 700; font-size: .92rem; }
.fight-note.won { color: #2f7a14; } .fight-note.lost { color: #9a2a31; }
.fight-note.combo { max-width: 30rem; margin: -.3rem auto .8rem; padding: .5rem .6rem; background: var(--paper); border: var(--outline) solid var(--ink); border-radius: 1rem; box-sizing: border-box; }
.champ-slip { position: sticky; bottom: 0; z-index: 2; margin-bottom: 0; box-shadow: 0 -.3rem 0 rgba(0, 0, 0, .25); }
.champ-slip[hidden] { display: none; }
.champ-slipline { margin: 0 0 .45rem; text-align: center; font-weight: 800; }
#champBet { margin-bottom: .3rem; }
.champ-slip .place-choices { display: flex; flex-direction: column; gap: .4rem; }
.champ-last .last-head { margin: 0 0 .4rem; text-align: center; font: 900 .95rem / 1 var(--font-head); text-transform: uppercase; opacity: .8; }
.last-row { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: .3rem; }
.last-row img { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #3b1219; border: .14rem solid #141012; object-fit: cover; }
.last-row img.won { border-color: #3f8f1f; box-shadow: 0 0 0 .16rem #3f8f1f66; } .last-row img.lost { opacity: .45; }
.last-row .lv { min-width: 5rem; text-align: center; font: 800 .8rem / 1 var(--font-head); text-transform: uppercase; }

/* Arm wrestling: keep pushing. A bar fills with each tap, and the button flashes. */
.arm-meter { height: .55rem; margin: -.3rem 0 .6rem; border: .12rem solid #141012; border-radius: 999px; background: #2a2224; overflow: hidden; }
.arm-meter[hidden] { display: none; }
.arm-meter i { display: block; height: 100%; width: calc(var(--f, 0) * 100%); background: #f2a024; transition: width .07s linear; }
#armWrestle #armGo.flash { animation: arm-flash .2s ease-out; }
@keyframes arm-flash { from { background: #f2a024; color: #141012; } to { } }

/* Championship 106: black banners, a bet area inside each fight, and a Current Bets panel */
.fight { overflow: hidden; }
.fight-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: -.6rem -.6rem .6rem; padding: .5rem .7rem; background: #141012; color: #fff; text-align: center; }
.fight-head > span:first-child { flex: 1; }
.fight.title .fight-head { color: #fff; }
.fight.book .fight-head > span:first-child { text-align: left; }
.fight-head .champ-badge { flex: none; align-self: center; display: inline-block; height: auto; min-height: 0; margin: 0; padding: .15rem .65rem; border-radius: 999px; background: #f4dede; color: #141012; font: 800 .72rem / 1.4 var(--font-body); text-transform: none; letter-spacing: 0; }
.fight-bet { margin-top: .6rem; padding-top: .5rem; border-top: .1rem dashed #2a1a1b44; }
.fight-bet .fight-note { margin: 0 0 .4rem; }
.fight-bet .bet-row { margin-bottom: .45rem; }
.fight-bet .place-bet, .book-body .place-bet { width: 100%; }
.fight-bet.placed { text-align: center; }
.fight-bet.placed .fight-note { margin: 0; }
.fight-bet.combo { margin-top: .7rem; }
.combo-head { margin: 0 0 .45rem; padding: .3rem .6rem; background: #141012; color: #fff; border-radius: .6rem; text-align: center; font: 900 .85rem / 1.1 var(--font-head); letter-spacing: .02em; text-transform: uppercase; }
.book-body { display: flex; flex-direction: column; gap: .45rem; }
.book-body:empty { display: none; }
.fight.book { margin-bottom: 1rem; }
.book-row { display: flex; align-items: center; gap: .55rem; padding: .35rem .5rem; border: .12rem solid #2a1a1b33; border-radius: .7rem; background: #fff8; }
.book-row .faces { display: flex; flex: none; }
.book-row .faces img { width: 2.3rem; height: 2.3rem; border-radius: 50%; border: .14rem solid #141012; background: #3b1219; object-fit: cover; margin-left: -.5rem; }
.book-row .faces img:first-child { margin-left: 0; }
.book-row .btxt { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: .82rem; line-height: 1.25; }
.book-row .btxt b { font: 900 .92rem / 1.2 var(--font-head); }
.book-row .btag { flex: none; font: 900 .85rem / 1.1 var(--font-head); }
.book-row.won { background: #d9efc9; border-color: #3f8f1f; } .book-row.won .btag { color: #2f7a14; }
.book-row.lost .btag { color: #9a2a31; } .book-row.lost { opacity: .85; }

/* Ward sound buttons: top right, like the Commissary, so they stay out of the cards and the table */
#armWrestle #armMute, #championship #champMute { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 3; margin: 0; }

/* Selene: the moths' cafeteria. Bubbles are smaller than the ballroom's, since the room is crowded; the tail can sit on the left. */
.say.moth::before { content: 'Mothkin'; }
.say.sm { width: 27cqw; min-width: 0; padding: 1.55rem .7rem .6rem; font-size: .95rem; }
.say.sm.up { min-width: 0; }
.say.sm.up::after { left: calc(100% - 1.25rem); }
.say.sm.up.l::after { left: 1.6rem; }
.bowl-pop { width: 11rem; max-width: 70%; height: auto; margin: .2rem 0 .4rem; }

/* Selene's ceremony room and Nut Jacks: the same purple as the borough, Sound button top right */
#ceremony, #jacks, #music, #throne { --button: #804689; --button-dark: #5a2f61; --button-ink: #ffffff; --link: #6e3a77; --paper: #f3eef5; --ink: #261b29; --quiet: #675a6b; }
#ceremony #cereMute, #jacks #jacksMute, #music #musicMute, #throne #throneMute { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 3; margin: 0; }
.jacks-layer { position: absolute; inset: 0; }
.jacks-nut { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 15cqw; aspect-ratio: 1; transform: translate(-50%, -50%); cursor: pointer; touch-action: manipulation; animation: nut-pop .25s ease-out; z-index: 2; }
.jacks-nut img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 .2rem 0 rgba(0, 0, 0, .35)); }
.jacks-nut.missed { opacity: .45; filter: grayscale(.6); pointer-events: none; }
.jacks-toss { position: absolute; left: 50%; top: 93%; width: 18cqw; transform: translate(-50%, -50%); pointer-events: none; z-index: 1; filter: drop-shadow(0 .3rem 0 rgba(0, 0, 0, .3)); }
.jacks-toss.caught { animation: toss-catch .6s ease-in forwards; }
.jacks-hud { position: absolute; left: 0; right: 0; top: calc(6.1rem + env(safe-area-inset-top)); z-index: 3; text-align: center; pointer-events: none; font: 800 1.1rem / 1.2 var(--font-head); color: #fff; text-shadow: 0 .12rem 0 #000, 0 0 .6rem #000; }
#jacks.playing .place-ask { display: none; }
@keyframes nut-pop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes toss-catch { to { transform: translate(-50%, -50%) scale(.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .jacks-nut { animation: none; } }

/* the music game: a staff across the floor, crescent moons travelling left to the ring, one big Sing button */
.staff { position: absolute; inset: 0; pointer-events: none; }
.staff::before { content: ''; position: absolute; left: 0; right: 0; top: calc(1250 / 1672 * 100%); height: calc(250 / 1672 * 100%); background: rgba(28, 12, 38, .6); border-block: .2rem solid rgba(255, 211, 107, .45); }
.staff .sl { position: absolute; left: 0; right: 0; top: calc(var(--y) / 1672 * 100%); height: 0; border-top: .16rem solid rgba(255, 238, 200, .55); }
.staff .ring { position: absolute; left: calc(230 / 941 * 100%); top: calc(1262 / 1672 * 100%); height: calc(236 / 1672 * 100%); width: 5.5cqw; transform: translateX(-50%); border-radius: .9rem; border: .28rem solid #ffd36b; background: rgba(255, 211, 107, .16); box-shadow: 0 0 1.2rem #ffd36b, inset 0 0 .8rem rgba(255, 211, 107, .6); }
.mnote { position: absolute; left: 110%; top: calc(var(--y) * 1%); width: 8cqw; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(-25deg); border-radius: 50%; box-shadow: inset -2.1cqw .2cqw 0 0 #ffd36b; filter: drop-shadow(0 0 .35rem rgba(255, 211, 107, .8)); transition: opacity .25s; }
.mnote.perfect { box-shadow: inset -2.1cqw .2cqw 0 0 #fff6c8; animation: mnote-hit .35s ease-out forwards; }
.mnote.good { animation: mnote-hit .35s ease-out forwards; }
.mnote.miss { box-shadow: inset -2.1cqw .2cqw 0 0 #8a6a8a; filter: none; opacity: .5; }
.m-fb { position: absolute; left: calc(230 / 941 * 100%); top: calc(1270 / 1672 * 100%); transform: translate(-50%, -100%); font: 800 1.2rem / 1 var(--font-head); color: #fff; text-shadow: 0 .1rem 0 #000, 0 0 .5rem #000; opacity: 0; white-space: nowrap; }
.m-fb.show { animation: m-fb .7s ease-out forwards; }
.m-fb.perfect { color: #fff6c8; } .m-fb.miss { color: #d7b4d7; }
.sing-btn { position: absolute; left: 50%; bottom: calc(.8rem + env(safe-area-inset-bottom)); transform: none; translate: -50% 0; width: min(78%, 22rem); height: 3.6rem; z-index: 4; font-size: 1.5rem; touch-action: manipulation; }
.sing-btn.hit { filter: brightness(1.25); }
.sing-btn:active:not(:disabled) { transform: none; }
#music.playing .place-ask { display: none; }
@keyframes mnote-hit { 0% { transform: translate(-50%, -50%) rotate(-25deg) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(-25deg) scale(2); opacity: 0; } }
@keyframes m-fb { 0% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -1.6rem; } }

/* the throne room: the Queen's name above her words */
.queen-who { margin: 0 0 .15rem; font: 800 .8rem / 1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: #804689; }

/* the surface sound button: top right on QT Central and the places that share its sound */
.ssnd { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 6; margin: 0; }
.ssnd.needs-tap { animation: ssnd-pulse 2s ease-in-out infinite; }
@keyframes ssnd-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 211, 107, 0); } 50% { box-shadow: 0 0 0 .5rem rgba(255, 211, 107, .45); } }
@media (prefers-reduced-motion: reduce) { .ssnd.needs-tap { animation: none; } }
#ridleyMute { display: none !important; }      /* the surface Sound button at the top covers Mayor Ridley's office now */
#yardMute { display: none !important; }
#yardSnd { top: calc(6.3rem + env(safe-area-inset-top)); }
#arcSnd { top: calc(3.75rem + env(safe-area-inset-top)); }      /* the arcade's wallet pills fill the first row */
#palSnd, #cartSnd, #hatSnd { top: calc(3.75rem + env(safe-area-inset-top)); }      /* same: wallet pills in the first row */

/* ---- Telegrams (Ghost Post): yellow wire paper and a typewriter ---- */
.gp-tabs { grid-template-columns: repeat(4, 1fr); }
.gp-tabs button { font-size: .82rem; }
.gp-wire-dot { position: absolute; top: .3rem; right: .35rem; }
.gp-status.wire-active { background: #f6e27a; color: #3a2e12; }
.gp-status.wire-answered { background: #b5532f; color: #fff; }
.gp-status.wire-complete { background: #cfe8cf; color: #1d3a1d; }
.gp-status.wire-declined, .gp-status.wire-trade_declined, .gp-status.wire-returned { background: #eadcd0; color: #5a3a2a; }
.wire-overlay { align-items: flex-start; justify-content: center; padding: .6rem .5rem calc(.6rem + env(safe-area-inset-bottom)); overflow-y: auto; background: rgba(30, 22, 12, .6); z-index: 60; }
.wire-overlay[hidden] { display: none; }
.wire-paper { --wire-ink: #2b2518; width: min(30rem, 100%); max-height: calc(100dvh - 1.2rem); overflow-y: auto; box-sizing: border-box; padding: 1rem .9rem 1rem; color: var(--wire-ink);
  font-family: "Courier New", Courier, "Liberation Mono", "Nimbus Mono PS", monospace; font-size: .95rem; line-height: 1.35; letter-spacing: .02em;
  background: repeating-linear-gradient(0deg, rgba(120, 90, 20, .045) 0 1px, transparent 1px 3px), linear-gradient(#f7e58c, #f2d96d); border: 2px solid #8a6b1f; border-radius: 4px; box-shadow: 0 .5rem 1.4rem rgba(0, 0, 0, .4); position: relative; }
.wire-head { text-align: center; border-bottom: 2px double var(--wire-ink); padding-bottom: .5rem; margin-bottom: .7rem; }
.wire-head b { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; letter-spacing: .22em; text-indent: .22em; }
.wire-head span { display: inline-block; margin-top: .15rem; padding: .05rem .8rem; border: 1px solid var(--wire-ink); font-size: .8rem; letter-spacing: .35em; text-indent: .35em; }
.wire-head i { display: block; margin-top: .3rem; font-style: normal; font-size: .62rem; letter-spacing: .12em; opacity: .75; }
.wire-paper h3 { margin: 0 0 .35rem; font: inherit; font-weight: 700; letter-spacing: .12em; font-size: .85rem; }
.wire-box { margin: .5rem 0; padding: .55rem .6rem; border: 1px solid var(--wire-ink); }
.wire-field { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; }
.wire-field > span { flex: none; min-width: 4.2ch; font-weight: 700; letter-spacing: .1em; font-size: .85rem; }
.wire-paper input, .wire-paper textarea { flex: 1; min-width: 0; font: inherit; color: var(--wire-ink); background: rgba(255, 255, 255, .35); border: 0; border-bottom: 2px solid var(--wire-ink); border-radius: 0; padding: .35rem .4rem; width: 100%; box-sizing: border-box; }
.wire-paper textarea { border: 1px solid var(--wire-ink); resize: vertical; }
.wire-paper input:focus, .wire-paper textarea:focus { outline: 2px solid #b5532f; outline-offset: 1px; }
.wire-count { margin: 0 0 .4rem; font-size: .72rem; letter-spacing: .08em; }
.wire-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.3rem, 1fr)); gap: .45rem; }
.wire-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .2rem; min-height: 0; background: rgba(255, 255, 255, .3); border: 2px solid transparent; border-radius: 6px; color: var(--wire-ink); font: inherit; box-shadow: none; }
.wire-tile:disabled { opacity: 1; }
.wire-tile.picked { border-color: #b5532f; background: rgba(255, 255, 255, .6); }
.wire-tile .card-face { width: 100%; }
.wire-tile small { font-size: .6rem; letter-spacing: .04em; }
.wire-qty { position: absolute; top: -.35rem; right: -.2rem; padding: .05rem .35rem; background: #b5532f; color: #fff; border-radius: 999px; font-style: normal; font-size: .72rem; font-weight: 700; }
.wire-none { grid-column: 1 / -1; margin: 0; font-size: .72rem; letter-spacing: .06em; }
.wire-swap { text-align: center; font-size: 1.6rem; line-height: 1; margin: .2rem 0; }
.wire-line { margin: .3rem 0; font-size: .78rem; letter-spacing: .08em; }
.wire-gold { margin: .2rem 0; font-weight: 700; letter-spacing: .1em; }
.wire-msg { margin: .3rem 0 0; letter-spacing: .06em; overflow-wrap: anywhere; }
.wire-err { margin: .4rem 0; padding: .35rem .5rem; border: 1px solid #8f2216; color: #8f2216; font-weight: 700; font-size: .8rem; }
.wire-btns { display: flex; justify-content: space-between; gap: 1rem; margin-top: .8rem; }
.wire-btns button { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-height: 0; padding: .45rem .9rem; font: inherit; background: transparent; color: var(--wire-ink); border: 2px solid var(--wire-ink); border-radius: 999px; box-shadow: none; }
.wire-btns button span { font-size: 1.4rem; line-height: 1; }
.wire-btns button small { font-size: .62rem; letter-spacing: .14em; }
.wire-btns .wire-ok { background: var(--wire-ink); color: #f7e58c; }
.wire-btns button:active:not(:disabled) { transform: translateY(2px); }
.wire-stamp { float: right; margin: -.2rem 0 0 .6rem; padding: .15rem .5rem; transform: rotate(-6deg); border: 3px double #b5321f; color: #b5321f; font-weight: 700; font-size: .78rem; letter-spacing: .12em; opacity: .85; }
.wire-stamp.wire-complete { color: #2e6b2e; border-color: #2e6b2e; }
.binder-spare { position: absolute; top: -.2rem; right: -.2rem; padding: 0 .3rem; background: #b5532f; color: #fff; border-radius: 999px; font-style: normal; font-size: .7rem; font-weight: 700; line-height: 1.3; pointer-events: none; }
.binder-card { position: absolute; }
.binder-arrows { align-items: center; }
.binder-swap { padding: .5rem .8rem; min-height: 0; font-size: .85rem; }
.cs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr)); gap: .45rem; margin: .4rem 0; }
.cs-for { margin: .6rem 0 .2rem; font-size: 1rem; }
.cs-grid .wire-tile { color: var(--ink); background: transparent; }
.cs-grid .wire-tile.picked { border-color: #b5532f; }
.binder-swap { position: absolute; top: calc(.9rem + env(safe-area-inset-top)); right: .9rem; z-index: 6; margin: 0; }
.wire-head .wire-logo { display: block; width: 100%; max-width: 20rem; height: auto; margin: 0 auto .35rem; }
