/* Wight Flight – the menus between rounds (menus.js): ONE BOOK called "Wight Flight" (owner, 2026-10-31; his GRUNDKRAV in
   docs/WIGHTFLIGHT_MENYER_PLAN.md). The cover, then an open book on a desk: two pages of notebook paper, three bookmarks
   on its right edge (Äventyr, Uppgradera, Butik), ribbons on its top edge for the cleared stages, pages that turn.
   The notebook look (paper, pencil outline, crayon colours, cut-out shadows) comes from skyfyre.css.

   Everything is sized in em, and the book's font-size follows the game box (container units of .sf-menu), so the book
   looks the same on a Chromebook, an iPad and in fullscreen: it is laid out for ~66 x 39 em. */

/* ===================== The desk and the book ===================== */

.wb {
  position: absolute;
  inset: 0;
  font-size: clamp(10px, min(1.48cqw, 2.62cqh), 40px);
  line-height: 1.2;
  color: var(--ink);
  /* A school desk: warm wood under the book */
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 236, 200, 0.18), transparent 70%),
    repeating-linear-gradient(178deg, rgba(0, 0, 0, 0.04) 0 0.35em, transparent 0.35em 1.1em),
    linear-gradient(180deg, #8a5e3c, #6d462b);
  overflow: hidden;
  perspective: 160em;
}

.wb[hidden] {
  display: none;
}

/* Buttons do NOT inherit font-size from the page (the browser gives them ~13 px): every button's em sizes must follow the
   book (owner, 2026-10-31: on 1920 x 1080 the pictures sat tiny in huge empty boxes). Zero specificity. */
:where(.wb, .hm-sheet) :where(button) {
  font-size: inherit;
}

.wb :focus-visible {
  outline: 0.18em solid var(--ink);
  outline-offset: 0.2em;
}

.wb-book,
.wb-cover {
  position: absolute;
  inset: calc(0.5rem + var(--safe-top)) calc(3.7rem + var(--safe-right)) calc(0.5rem + var(--safe-bottom)) calc(0.7rem + var(--safe-left));
}

.wb-book[hidden],
.wb-cover[hidden] {
  display: none;
}

/* Starting a stage: THE DIVE (menus.js DIVE + dive()). The book flies past the camera (it accelerates: ease-in), the
   picture's frame comes closer more calmly and fills the box, and inside it the stage's layers spread apart. Then the
   paper fades in and the game takes over. --dive-ms / --dive-fade come from DIVE. */
/* ONE curve for every layer, so the book always stays ahead of the picture (only their sizes differ): it speeds up,
   like the camera rushing in */
.wb {
  --dive-curve: cubic-bezier(0.5, 0, 0.7, 0.4);
}

.sf-menu.is-zooming .wb-book {
  transition: transform var(--dive-ms, 1.1s) var(--dive-curve);
}

/* ".wb >" so these win over .wb-photo / .hm-place-art (their copies keep those classes for the look) */
.wb > .wb-dive,
.wb > .wb-dive-marks {
  position: absolute;
  z-index: 15;
  box-sizing: border-box;
  margin: 0;
  pointer-events: none;
}

/* The picture's frame lifted out of the page: turned like the photo first, straight when it fills the box */
.wb > .wb-dive {
  transform: rotate(-2deg);
  transition: transform var(--dive-ms, 1.1s) var(--dive-curve);
}

.wb-dive-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: center / cover no-repeat;
  transition: transform var(--dive-ms, 1.1s) var(--dive-curve);
}

.wb-dive-layer > svg {
  width: 100%;
  height: 100%;
}

/* The tape and the stamp ride with the book: same speed, same curve */
.wb > .wb-dive-marks {
  z-index: 16;
  transform: rotate(-2deg);
  transition: transform var(--dive-ms, 1.1s) var(--dive-curve);
}

.wb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
}

.sf-menu.is-zooming .wb::after {
  opacity: 1;
  transition: opacity calc(var(--dive-ms, 1.1s) - var(--dive-fade, 0.8s)) var(--dive-fade, 0.8s) ease-in;
}

/* The board: the book's cloth cover round the pages */
.wb-board {
  position: absolute;
  top: 1.2em;
  right: 5em;
  bottom: 0.3em;
  left: 0.3em;
  z-index: 2;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 5px),
    #34478c;
  border-radius: 0.8em 1em 1em 0.8em;
  box-shadow: 0.4em 0.6em 0 rgba(30, 18, 8, 0.35), inset 0 0 0 0.15em rgba(0, 0, 0, 0.25);
}

/* The pages, with the paper's stacked edges at the bottom */
.wb-pages {
  position: absolute;
  inset: 0.6em 0.7em 1em;
  border-radius: 0.3em;
  box-shadow:
    0 0.18em 0 #e9e2d0, 0 0.36em 0 #ddd5c0, 0 0.54em 0 #e9e2d0, 0 0.72em 0 #cfc6af;
}

/* The spread: two pages of lined paper, a margin line on each, the fold in the middle. The view carries the paper, so
   a copy of it (the turning leaf) looks the same. */
.wb-view {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);   /* two equal pages, whatever is on them */
  grid-template-rows: 100%;
  overflow: hidden;
  border-radius: 0.3em;
  background:
    linear-gradient(90deg, transparent calc(50% - 2.2em), rgba(44, 49, 80, 0.08) calc(50% - 0.5em), rgba(44, 49, 80, 0.28) 50%, rgba(44, 49, 80, 0.08) calc(50% + 0.5em), transparent calc(50% + 2.2em)),
    linear-gradient(90deg, transparent 2.2em, var(--paper-margin) 2.2em, var(--paper-margin) calc(2.2em + 2px), transparent calc(2.2em + 2px) calc(50% + 2.2em), var(--paper-margin) calc(50% + 2.2em), var(--paper-margin) calc(50% + 2.2em + 2px), transparent calc(50% + 2.2em + 2px)),
    repeating-linear-gradient(transparent 0 calc(1.7em - 1px), var(--paper-line) calc(1.7em - 1px) 1.7em),
    var(--paper);
}

.wb-left,
.wb-right,
.wb-wide {
  position: relative;
  min-height: 0;
  padding: 1.7em 2.2em 2.6em 3em;
}

.wb-right {
  padding: 1.7em 3em 2.6em 3.2em;
}

.wb-left { grid-column: 1; }
.wb-right { grid-column: 2; }

.wb-wide {
  grid-column: 1 / -1;
  padding: 1.6em 1.6em 2.4em;
}

/* ----- Turning pages: a leaf lifts and lands on the other side (menus.js turnLeaf) ----- */

.wb-flip {
  position: absolute;
  inset: 0;
  z-index: 5;
  perspective: 120em;
  pointer-events: none;
}

.wb-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
}

.wb-half-left { left: 0; }
.wb-half-right { left: 50%; }

.wb-half .wb-half-content {
  inset: 0 auto 0 0;
  width: 200%;
}

.wb-half-right .wb-half-content {
  left: -100%;
}

.wb-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  transform-style: preserve-3d;
}

.wb-leaf.is-forward {
  left: 50%;
  transform-origin: left center;
  animation: wb-turn-forward 0.62s cubic-bezier(0.45, 0.05, 0.4, 1) forwards;
}

.wb-leaf.is-back {
  left: 0;
  transform-origin: right center;
  animation: wb-turn-back 0.62s cubic-bezier(0.45, 0.05, 0.4, 1) forwards;
}

.wb-leaf > .wb-half {
  left: 0;
  width: 100%;
  backface-visibility: hidden;
}

.wb-leaf > .wb-leaf-back {
  transform: rotateY(180deg);
}

/* A shadow that darkens the leaf while it stands up */
.wb-leaf > .wb-half::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(44, 49, 80, 0.25), transparent 60%);
  animation: wb-leaf-shade 0.62s ease-in-out forwards;
}

.wb-leaf.is-back > .wb-half::after {
  background: linear-gradient(270deg, rgba(44, 49, 80, 0.25), transparent 60%);
}

@keyframes wb-turn-forward {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-180deg); }
}

@keyframes wb-turn-back {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}

@keyframes wb-leaf-shade {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ----- Page order: visible arrows and the name of the destination (separate from Back) ----- */

.wb-corner {
  position: absolute;
  bottom: 0.2em;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  width: max(9em, 114px);
  height: max(2.8em, 44px);
  padding: 0.2em 0.5em;
  font-family: var(--hand);
  color: var(--ink);
  background: #fff8df;
  border: 0.12em solid var(--ink);
  border-radius: 0.5em;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

.wb-corner[hidden] {
  display: none;
}

.wb-corner-prev {
  left: 0;
}

.wb-corner-next {
  right: 0;
}

.wb-corner svg {
  position: relative;
  width: 1.5em;
  height: 1.5em;
}

.wb-corner-label {
  display: flex;
  flex-direction: column;
  font-size: max(0.95em, 12px);
  line-height: 1.05;
}

.wb-corner-label small {
  font-size: max(0.75em, 10px);
}

.wb-location {
  position: absolute;
  bottom: 0.6em;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 0.2em 0.6em;
  font-family: var(--hand);
  font-size: max(0.85em, 11px);
  white-space: nowrap;
  background: var(--paper);
  border-radius: 0.4em;
}

.wb-corner:hover,
.wb-corner:focus-visible {
  translate: 0 -0.1em;
}

/* The next page has news (a stage just opened): the corner calls */
.wb-corner.is-calling {
  color: #d0342c;
  background: #ffe18a;
}

/* ----- The bookmarks on the right edge ----- */

.wb-tabs {
  position: absolute;
  top: 3.6em;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  width: 7em;
}

.wb-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  min-height: max(6.2em, 52px);
  padding: 0.4em 0.3em 0.4em 2.1em;           /* the left part is tucked under the book */
  font-family: var(--hand);
  color: var(--ink);
  background: var(--tab-colour);
  border: 0.12em solid var(--ink);
  border-left: 0;
  border-radius: 0 0.7em 0.7em 0;
  box-shadow: 0.2em 0.25em 0 rgba(30, 18, 8, 0.3);
  cursor: pointer;
  transition: transform 0.15s;
}

.wb-tab > span:last-of-type {
  font-size: 0.95em;
  line-height: 1;
}

.wb-tab[data-tab="adventure"] { --tab-colour: #cfe2ff; }
.wb-tab[data-tab="upgrade"] { --tab-colour: #d6f2c4; }
.wb-tab[data-tab="shop"] { --tab-colour: #ffdcb8; }

.wb-tab-icon {
  display: grid;
  place-items: center;
  width: 2.6em;
  height: 2.6em;
}

.wb-tab-icon svg {
  width: 100%;
  height: 100%;
}

.wb-tab:hover,
.wb-tab:focus-visible {
  transform: translateX(0.3em);
}

/* The open bookmark: pulled out a little further, brighter */
.wb-tab.is-current {
  background: #fff;
  transform: translateX(0.55em);
  box-shadow: 0.2em 0.25em 0 rgba(30, 18, 8, 0.3), inset 0.4em 0 0 var(--tab-colour);
}

.wb-tab.is-current > span:last-of-type {
  font-weight: 700;
}

/* "+2": points waiting on Uppgradera */
.hm-dot {
  position: absolute;
  top: -0.6em;
  right: -0.5em;
  min-width: 1.9em;
  padding: 0.05em 0.4em 0.1em;
  font-family: var(--bold);
  font-style: normal;
  font-size: 1.05em;
  color: #fff;
  text-align: center;
  background: var(--crayon-red);
  border: 0.12em solid var(--ink);
  border-radius: 999px;
  animation: hm-beat 1.1s ease-in-out infinite;
}

.hm-dot[hidden] {
  display: none;
}

/* ----- Ribbons on the top edge: the map, the cleared stages, the next stage (a star) ----- */

.wb-ribbons {
  position: absolute;
  top: 0;
  left: max(8.5em, 110px);
  z-index: 4;
  display: flex;
  gap: 0.4em;
}

.wb-ribbon {
  position: relative;
  display: grid;
  place-items: start center;
  width: max(2.5em, 40px);
  height: max(3.6em, 46px);
  padding: 0.45em 0 0;
  font-family: var(--bold);
  font-size: 1em;
  color: var(--ink);
  background: #8fd66a;
  border: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  box-shadow: inset 0 0.25em 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s;
}

.wb-ribbon b {
  font-weight: 400;
  font-size: 1.15em;
  line-height: 1;
}

.wb-ribbon svg {
  width: 1.5em;
  height: 1.5em;
}

.wb-ribbon.is-map {
  background: #9cc2ff;
}

.wb-ribbon.is-next {
  background: var(--crayon-yellow);
}

.wb-ribbon:hover,
.wb-ribbon:focus-visible,
.wb-ribbon.is-current {
  transform: translateY(0.45em);
}

/* ----- Back through visited views, and the little "i" for grown-ups ----- */

.hm-back {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  width: max(7.8em, 100px);
  height: max(2.8em, 44px);
  padding: 0;
  font-family: var(--hand);
  color: var(--ink);
  background: #fff;
  border: 0.14em solid var(--ink);
  border-radius: 0.7em;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

.hm-back svg {
  width: 1.5em;
  height: 1.5em;
}

.hm-back:hover,
.hm-back:focus-visible {
  transform: translate(-1px, -2px);
}

.hm-info {
  position: absolute;
  right: 2.2em;
  bottom: 0.6em;
  z-index: 3;
  width: max(2.2em, 32px);
  height: max(2.2em, 32px);
  padding: 0;
  font: italic 700 1.15em Georgia, "Times New Roman", serif;
  color: #f4e6d0;
  background: rgba(0, 0, 0, 0.18);
  border: 0.12em solid #f4e6d0;
  border-radius: 50%;
  opacity: 0.75;
  cursor: pointer;
}

.hm-info[aria-pressed="true"] {
  color: var(--ink);
  background: var(--crayon-green);
  border-color: var(--ink);
  opacity: 1;
}

.sf-menu:not(.show-advanced) .advanced-only {
  display: none;
}

/* ===================== The cover ===================== */

.wb-cover {
  z-index: 10;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 0.5em 1.5em;
  padding: 1.6em 3em 2em 5.4em;
  /* A sketchbook's cardboard cover with a cloth spine on the left (stitched), and doodles */
  background:
    linear-gradient(90deg, #34478c 0 3.4em, rgba(0, 0, 0, 0.25) 3.4em 3.6em, transparent 3.6em),
    radial-gradient(circle at 88% 16%, rgba(255, 217, 59, 0.55) 0 2.6em, transparent 2.7em),
    radial-gradient(circle at 12% 92%, rgba(111, 216, 238, 0.35) 0 4em, transparent 4.1em),
    repeating-linear-gradient(-30deg, rgba(120, 80, 40, 0.05) 0 2px, transparent 2px 7px),
    #f0d9a8;
  border: 0.15em solid #6d4a2b;
  border-radius: 0.6em 1.2em 1.2em 0.6em;
  box-shadow: 0.5em 0.7em 0 rgba(30, 18, 8, 0.4), inset -0.5em 0 0 rgba(0, 0, 0, 0.08);
  transform-origin: left center;
}

/* The spine's stitches */
.wb-cover::before {
  content: "";
  position: absolute;
  top: 1.2em;
  bottom: 1.2em;
  left: 1.6em;
  border-left: 0.2em dashed rgba(255, 255, 255, 0.55);
}

.wb-cover.is-opening {
  animation: wb-open 0.52s ease-in forwards;
}

@keyframes wb-open {
  to { transform: rotateY(-100deg); opacity: 0; }
}

.wb-title {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--bold);
  font-size: 5em;
  font-weight: 400;
  line-height: 1;
  color: var(--crayon-pink);
  -webkit-text-stroke: 0.05em #fff;
  paint-order: stroke fill;
  text-shadow: 0.05em 0.07em 0 rgba(44, 49, 80, 0.3);
  transform: rotate(-2deg);
}

.wb-cover-hero {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.wb-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  margin: 0;
}

/* The Väsen taped onto the cover like a photo */
.wb-hero-picture {
  width: 15em;
  height: 15em;
  padding: 0.5em;
  object-fit: contain;
  background: #fff;
  border: 0.08em solid var(--ink);
  box-shadow: var(--cutout-shadow);
  transform: rotate(-3deg);
}

.wb-hero-picture.is-flipped {
  animation: sf-pop 0.35s ease-out;
}

.wb-hero figcaption {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.wb-hero figcaption strong {
  font-family: var(--bold);
  font-size: 2.2em;
  font-weight: 400;
  -webkit-text-stroke: 0.05em #fff;
  paint-order: stroke fill;
}

.wb-arrow {
  display: grid;
  place-items: center;
  width: max(3.2em, 44px);
  height: max(3.2em, 44px);
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0.14em solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

.wb-arrow svg {
  width: 1.6em;
  height: 1.6em;
}

.wb-arrow:hover,
.wb-arrow:focus-visible {
  transform: translate(-1px, -2px);
}

.wb-hero-picks {
  display: flex;
  gap: 0.6em;
  grid-column: 1;
  align-self: start;
}

/* The four Väsen as small pictures you can tap */
.hm-hero-pick {
  display: grid;
  place-items: center;
  width: max(3.6em, 44px);
  height: max(3.6em, 44px);
  padding: 0.15em;
  background: #fff;
  border: 0.12em solid var(--ink-soft);
  border-radius: 0.5em;
  opacity: 0.7;
  cursor: pointer;
}

.hm-hero-pick img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hm-hero-pick.is-current {
  border-color: var(--ink);
  box-shadow: 0 0 0 0.2em var(--hero-color);
  opacity: 1;
}

.wb-cover > .wb-cover-hero {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}

.wb-cover > .wb-hero-picks {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
}

.wb-cover-right {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6em;
}

.wb-cover-gems {
  padding: 0.4em 0.8em;
  background: rgba(255, 255, 255, 0.55);
  border: 0.1em dashed #9a7a50;
  border-radius: 0.8em;
}

.wb-cover-gems[hidden] {
  display: none;
}

.wb-open {
  flex-direction: column;
  width: auto;
  min-width: 7em;
  padding: 0.35em 0.7em 0.4em;
  font-size: 2.5em;
}

.wb-open .hm-play-icon {
  width: 2em;
  height: 2em;
}

/* ===================== Shared pieces ===================== */

/* "Nivå 3": a yellow label */
.hm-level {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 0.05em 0.7em 0.1em;
  font-size: 1.35em;
  background: var(--crayon-yellow);
  border: 0.1em solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--cutout-shadow);
  transform: rotate(-2deg);
}

.hm-level b {
  font-family: var(--bold);
  font-weight: 400;
}

.hm-level-big {
  font-size: 2em;
}

/* The big yellow button: one per page */
.hm-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: max(2.4em, 44px);
  padding: 0.15em 0.8em 0.25em;
  font-family: var(--bold);
  font-size: 2.3em;
  line-height: 1;
  color: var(--ink);
  background: var(--crayon-yellow);
  border: 0.09em solid var(--ink);
  border-radius: 0.45em 0.15em 0.4em 0.2em / 0.2em 0.4em 0.15em 0.45em;
  box-shadow: 0.08em 0.1em 0 rgba(44, 49, 80, 0.3);
  transform: rotate(-1deg);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.hm-play:hover:not(:disabled),
.hm-play:focus-visible {
  transform: translate(-1px, -2px) rotate(0deg);
  box-shadow: 0.12em 0.16em 0 rgba(44, 49, 80, 0.25);
}

.hm-play:active:not(:disabled) {
  transform: translate(1px, 1px);
}

.hm-play:disabled {
  opacity: 0.5;
}

.hm-play-icon,
.hm-quiet-icon,
.hm-quit-icon {
  display: grid;
  place-items: center;
  width: 1em;
  height: 1em;
}

.hm-play-icon svg,
.hm-quiet-icon svg,
.hm-quit-icon svg {
  width: 100%;
  height: 100%;
}

.hm-play.is-suggested {
  animation: sf-wiggle 1.6s ease-in-out infinite;
}

/* A quieter white button beside the big one ("Spela igen" after a new stage opened) */
.hm-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  min-height: max(2.2em, 44px);
  padding: 0.1em 0.7em 0.15em;
  font-family: var(--bold);
  font-size: 1.45em;
  color: var(--ink);
  background: #fff;
  border: 0.1em solid var(--ink);
  border-radius: 0.4em 0.15em 0.35em 0.2em;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

/* A pointing hand: "tap here". It bobs towards what it points at. */
.hm-hand {
  position: absolute;
  z-index: 3;
  width: 2.6em;
  height: 2.6em;
  color: var(--ink);
  filter: drop-shadow(0 0 0.08em #fff) drop-shadow(0 0 0.08em #fff);
  pointer-events: none;
  animation: hm-poke 0.9s ease-in-out infinite;
}

.hm-hand svg {
  width: 100%;
  height: 100%;
}

@keyframes hm-poke {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -0.35em; }
}

@keyframes hm-beat {
  0%, 60%, 100% { transform: scale(1); }
  30% { transform: scale(1.22); }
}

@keyframes hm-shake {
  20%, 60% { transform: translateX(-0.3em) rotate(-4deg); }
  40%, 80% { transform: translateX(0.3em) rotate(4deg); }
}

@keyframes hm-breathe {
  50% { transform: scale(1.07); }
}

/* A small picture with a number: "heart 60" */
.hm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
  white-space: nowrap;
}

.hm-chip svg {
  width: 1.7em;
  height: 1.7em;
}

.hm-chip b {
  font-family: var(--bold);
  font-size: 1.35em;
  font-weight: 400;
}

/* "+5" floats up from what was just changed */
.hm-float {
  position: absolute;
  top: 0.3em;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.5em;
  margin-inline: auto;
  width: max-content;
  padding: 0.1em 0.7em;
  background: #fff;
  border: 0.1em solid var(--ink);
  border-radius: 999px;
  pointer-events: none;
  animation: sf-float 1.3s ease-out forwards;
}

.wb .sf-sticker {
  gap: 0.35em;
  padding: 0.1em 0.8em 0.15em 0.5em;
  font-size: 1.5em;
  border-width: 0.1em;
}

.wb .sf-coin,
.wb .sf-sticker-gold::before {
  width: 0.9em;
  height: 0.9em;
  border-width: 0.12em;
}

.wb .sf-meter {
  height: 1.2em;
  border-width: 0.12em;
}

.sf-level {
  display: flex;
  align-items: center;
  gap: 0.7em;
  width: 100%;
}

.sf-level .sf-meter {
  flex: 1;
}

.wb .sf-gem-row .sf-gem {
  width: 2.6em;
}

.sf-sticker.is-short-of-gold {
  animation: hm-shake 0.4s;
}

/* ===================== Äventyr: the map over the spread ===================== */
/* (Owner, 2026-10-31: "kartan över uppslaget" – every stage is a picture taped in along a crayon trail, solid as far as
   the stages are open, pencil dashes after; a closed stage is the same picture only sketched in pencil.) */

.wb-map {
  padding: 1em 1.2em 1.8em;
  background:
    radial-gradient(ellipse 16% 22% at 21% 30%, rgba(111, 216, 238, 0.28), transparent),
    radial-gradient(ellipse 14% 20% at 31% 70%, rgba(61, 79, 134, 0.18), transparent),
    radial-gradient(ellipse 14% 20% at 42% 30%, rgba(242, 154, 74, 0.24), transparent),
    radial-gradient(ellipse 14% 20% at 58% 70%, rgba(170, 150, 220, 0.24), transparent),
    radial-gradient(ellipse 14% 20% at 69% 30%, rgba(242, 184, 98, 0.3), transparent),
    radial-gradient(ellipse 14% 20% at 80% 70%, rgba(61, 79, 134, 0.2), transparent),
    radial-gradient(ellipse 12% 20% at 90% 30%, rgba(155, 89, 208, 0.18), transparent);
}

.hm-map {
  position: relative;
  width: 100%;
  height: 100%;
}

.hm-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.hm-trail path {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.hm-trail-done {
  stroke: var(--crayon-pink);
  stroke-width: 0.42em;
  opacity: 0.75;
}

.hm-trail-todo {
  stroke: #9a95a8;
  stroke-width: 0.2em;
  stroke-dasharray: 0.5em 0.6em;
}

.hm-places {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-places .hm-stop {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
}

.hm-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  font-family: var(--hand);
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}

.hm-place {
  padding: 0.6em 0.2em 0.2em;
  transform: rotate(var(--tilt));
  transition: transform 0.15s;
}

.hm-place:hover,
.hm-place:focus-visible {
  transform: rotate(0deg) scale(1.06);
}

/* A stage's picture: a photo with a white edge (the map's places, the stage's spread, the result) */
.hm-place-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff center / cover no-repeat;
  border: 0.34em solid #fff;
  border-radius: 0.3em;
  outline: 0.08em solid var(--ink);
  box-shadow: var(--cutout-shadow);
}

.hm-place-art > svg {
  width: 100%;
  height: 100%;
}

.hm-place .hm-place-art {
  width: 9em;
  height: 6.75em;
}

.hm-place-art:has(.sf-gem-holes) {
  background: #f4efff;
}

.hm-place-art .sf-gem-holes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.05em;
  width: 86%;
}

.hm-place-art .sf-gem-holes .sf-gem svg {
  width: 100%;
  height: auto;
}

/* The number on a strip of tape over the picture's top */
.hm-place-tape {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  min-width: 1.6em;
  padding: 0.05em 0.45em 0.1em;
  font-family: var(--bold);
  font-size: 1.5em;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  background: rgba(255, 233, 140, 0.9);
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 20% 0, 80% 0, 88% 9%, 94% 0, 100% 10%, 100% 92%, 94% 100%, 88% 90%, 80% 100%, 20% 100%, 12% 92%, 6% 100%, 0 90%);
  transform: translateX(-50%) rotate(-4deg);
}

/* The stage's gems: found = coloured, not yet = an empty dashed hole */
.hm-place-gems {
  display: flex;
  gap: 0.2em;
  margin-top: 0.3em;
}

.hm-place-gems .sf-gem svg {
  width: 1.7em;
  height: 1.7em;
}

/* Beaten: a red rubber stamp across the corner */
.hm-place-stamp {
  position: absolute;
  right: -0.7em;
  bottom: 1.9em;
  z-index: 2;
  padding: 0 0.3em;
  font-family: var(--bold);
  font-size: 1.15em;
  letter-spacing: 0.06em;
  color: #d0342c;
  background: rgba(255, 255, 255, 0.55);
  border: 0.16em solid #d0342c;
  border-radius: 0.25em;
  transform: rotate(-14deg);
  opacity: 0.92;
}

/* Closed: the same place only sketched in pencil – grey, hatched, a dashed edge, no shadow */
.hm-place.is-locked .hm-place-art,
.wb-photo.is-locked .hm-place-art {
  background-color: #f6f3ea;
  border-color: #f6f3ea;
  outline: 0.08em dashed #8a8597;
  box-shadow: none;
}

.hm-place.is-locked .hm-place-art > *,
.hm-place.is-locked .hm-place-art.has-picture,
.wb-photo.is-locked .hm-place-art > *,
.wb-photo.is-locked .hm-place-art.has-picture {
  filter: grayscale(1) contrast(1.5) brightness(1.2);
  opacity: 0.45;
}

.hm-place.is-locked .hm-place-art::after,
.wb-photo.is-locked .hm-place-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-35deg, rgba(60, 60, 85, 0.16) 0 1px, transparent 1px 0.4em);
}

.hm-place.is-locked .hm-place-tape,
.wb-photo.is-locked .hm-place-tape {
  color: var(--ink-soft);
  background: rgba(225, 222, 214, 0.9);
}

.hm-place.is-locked .hm-place-gems {
  opacity: 0.5;
}

.hm-node.is-shaking {
  animation: hm-shake 0.4s;
}

/* Next: a breathing yellow ring round the picture and a hand under it */
.hm-place.is-next .hm-place-art {
  box-shadow: 0 0 0 0.25em var(--crayon-yellow), 0 0 0 0.4em var(--ink);
  animation: hm-breathe 1.4s ease-in-out infinite;
}

.hm-place.is-next .hm-hand {
  bottom: -2.1em;
  left: 50%;
  margin-left: -1.3em;
}

/* The Väsen: above the top left corner of its place, bobbing; flies to a tapped place */
.hm-map-fyre {
  position: absolute;
  left: var(--x, 9%);
  top: var(--y, 70%);
  z-index: 4;
  width: 4.4em;
  height: 4.4em;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0.12em 0.18em 0 rgba(44, 49, 80, 0.25));
  transform: translate(calc(-4.3em - 50%), calc(-3.6em - 75%));
  transition: left 0.5s ease-in-out, top 0.5s cubic-bezier(0.3, -0.6, 0.6, 1);
  animation: hm-bob 1.6s ease-in-out infinite;
}

@keyframes hm-bob {
  50% { translate: 0 -0.35em; }
}

/* ===================== Äventyr: one stage's spread ===================== */

.wb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1em;
}

.wb-photo {
  position: relative;
  width: min(23em, 100%);
  transform: rotate(-2deg);
}

.wb-photo-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  border-width: 0.55em;
}

.wb-photo .wb-photo-tape {
  font-size: 2.4em;
}

.wb-photo .wb-photo-stamp {
  right: -0.4em;
  bottom: 1.2em;
  font-size: 2.6em;
}

.wb-photo-art .sf-gem-holes .sf-gem svg {
  width: 100%;
}

.wb-stage-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.wb-stage-number {
  font-family: var(--bold);
  font-size: 2.6em;
  color: var(--crayon-pink);
  -webkit-text-stroke: 0.04em #fff;
  paint-order: stroke fill;
}

.wb-stage-title {
  font-family: var(--hand);
  font-size: 2.2em;
}

.wb-stage-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4em;
}

.wb-facts {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1em;
}

.wb-gems {
  display: flex;
  gap: 0.3em;
  padding: 0.3em 0.6em;
  background: rgba(255, 255, 255, 0.7);
  border: 0.1em dashed var(--ink-soft);
  border-radius: 0.6em;
}

.wb-gems .sf-gem svg {
  width: 3em;
  height: 3em;
}

.wb-record {
  font-size: 1.7em;
  transform: rotate(2deg);
}

.wb-record-star svg {
  width: 1em;
  height: 1em;
  color: #e0a800;
}

/* Who flies: the chosen Väsen standing on the page beside the button */
.wb-flyer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
}

.wb-flyer-picture {
  width: 9em;
  height: 9em;
  object-fit: contain;
  filter: drop-shadow(0.12em 0.18em 0 rgba(44, 49, 80, 0.25));
  animation: hm-bob 1.6s ease-in-out infinite;
}

.wb-stage-play .hm-play-icon {
  width: 0.9em;
  height: 0.9em;
}

/* A closed stage: the stage before it with a hand – play that one first */
.wb-way-back {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6em 0.4em 0.4em;
  background: none;
  border: 0;
  cursor: pointer;
  transform: rotate(2deg);
}

.wb-way-art {
  width: 13em;
  height: 9.75em;
  box-shadow: 0 0 0 0.25em var(--crayon-yellow), 0 0 0 0.4em var(--ink);
  animation: hm-breathe 1.4s ease-in-out infinite;
}

.wb-way-back .hm-hand {
  right: -1.4em;
  bottom: -0.8em;
  rotate: -60deg;
}

.wb-all-gems {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4em;
}

.wb-all-gems .sf-gem svg {
  width: 4.4em;
  height: 4.4em;
}

/* ===================== Äventyr: the result on the stage's right page ===================== */

.wb-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
}

.wb-result .sf-heading {
  margin: 0;
  font-size: 2.4em;
}

.wb .sf-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.wb .sf-score strong {
  font-family: var(--bold);
  font-size: 4.6em;
  font-weight: 400;
  color: var(--crayon-pink);
  -webkit-text-stroke: 0.04em #fff;
  paint-order: stroke fill;
  text-shadow: 0.05em 0.05em 0 rgba(44, 49, 80, 0.2);
}

.wb .sf-score small {
  font-size: 1.2em;
  color: var(--ink-soft);
}

.wb .sf-rewards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
}

.wb-result .sf-level {
  width: min(100%, 22em);
}

.wb-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6em 0.9em;
}

/* Go on to the stage that just opened: its picture in the button */
.wb-go-on {
  gap: 0.35em;
  padding-left: 0.35em;
}

.wb-go-on .wb-go-on-art {
  width: 2.4em;
  height: 1.8em;
  border-width: 0.1em;
  box-shadow: none;
}

.wb-result .medal-row {
  margin: 0;
}

/* ===================== Uppgradera ===================== */

.wb-up-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4em;
  font-size: 1.2em;
}

.wb-levelup-title {
  margin: 0;
  font-size: 3em;
  color: var(--crayon-pink);
  animation: sf-pop 0.5s ease-out;
}

.wb-up-level {
  width: min(100%, 22em);
}

/* One star per point to place (more than 5: a star and the number) */
.hm-points {
  display: flex;
  align-items: center;
  gap: 0.2em;
  margin: 0;
  padding: 0.2em 0.7em;
  font-family: var(--bold);
  font-size: 1.3em;
  background: #fff;
  border: 0.1em solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--cutout-shadow);
}

.hm-points[hidden] {
  display: none;
}

.hm-points-star svg {
  width: 1.8em;
  height: 1.8em;
  color: #e0a800;
}

/* What the Väsen can do now: four big chips */
.wb-now {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.7em 2em;
  padding: 0.8em 1.4em;
  background: rgba(255, 255, 255, 0.75);
  border: 0.1em dashed var(--ink-soft);
  border-radius: 0.8em;
}

.wb-now .hm-chip svg {
  width: 2.4em;
  height: 2.4em;
}

.wb-now .hm-chip b {
  font-size: 2em;
}

.wb-up-left .sf-facts {
  font-size: 0.85em;
}

/* The three things to train: picture, name, number – and a "+" that carries what ONE point gives */
.wb-up-right {
  display: flex;
  align-items: center;
  padding-left: 2.6em;
  padding-right: 1.8em;
}

/* The three rows share ONE set of columns (subgrid), so the + stands in the same place in every row, and every
   + is as wide as the widest (owner, 2026-10-31: "Pluset ... behöver vara på samma plats på alla tre") */
.wb-train {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr) auto;
  column-gap: 0.7em;
  row-gap: 1.2em;
  width: 100%;
  font-size: 1.12em;
}

.wb-train-row {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  grid-template-rows: auto auto;
  align-items: center;
  padding: 0.5em 0.7em;
  background: #fff;
  border: 0.13em solid var(--ink);
  border-radius: 0.8em 0.25em 0.7em 0.3em / 0.3em 0.7em 0.25em 0.8em;
  box-shadow: var(--cutout-shadow);
}

[data-stat="str"].wb-train-row { border-left: 0.5em solid var(--crayon-red); }
[data-stat="agi"].wb-train-row { border-left: 0.5em solid #5fb83a; }
[data-stat="wis"].wb-train-row { border-left: 0.5em solid var(--crayon-blue); }

.hm-attr-picture {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 4.2em;
  height: 4.2em;
}

.hm-attr-picture svg {
  width: 100%;
  height: 100%;
}

.hm-attr-name {
  grid-column: 2;
  font-size: 1.45em;
  font-weight: 400;
  line-height: 1;
}

.hm-attr-value {
  grid-column: 2;
  font-family: var(--bold);
  font-size: 2.4em;
  font-weight: 400;
  line-height: 1;
}

.wb-train-row.is-bumped .hm-attr-value {
  animation: sf-bump 0.35s ease-out;
}

.wb-plus {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: stretch;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4em;
  min-height: max(3.6em, 44px);
  padding: 0.25em 0.8em 0.25em 0.25em;
  font-family: var(--hand);
  color: var(--ink);
  background: #e6f7d3;
  border: 0.13em solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
  transition: transform 0.1s;
}

/* Older browsers without subgrid: every row's + column gets the same fixed width instead */
@supports not (grid-template-columns: subgrid) {
  .wb-train-row { grid-template-columns: 4.2em minmax(0, 1fr) 12.5em; column-gap: 0.7em; }
}

.wb-plus-sign {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.9em;
  height: 2.9em;
  color: #fff;
  background: var(--crayon-pink);
  border: 0.12em solid var(--ink);
  border-radius: 50%;
}

.wb-plus-sign svg {
  width: 1.6em;
  height: 1.6em;
}

.wb-plus .hm-gains {
  display: flex;
  gap: 0.4em;
  font-size: 0.92em;
  white-space: nowrap;
}

.wb-plus:hover:not(:disabled),
.wb-plus:focus-visible {
  transform: scale(1.05) rotate(-2deg);
}

.wb-plus:active:not(:disabled) {
  transform: scale(0.95);
}

.wb-plus:not(:disabled) {
  animation: hm-beat 1.6s ease-in-out infinite;
}

/* No points to place: the + is grey, what it would give stays faint */
.wb-plus:disabled {
  background: #f1f1f4;
  border-color: var(--ink-soft);
  box-shadow: none;
  cursor: default;
}

.wb-plus:disabled .wb-plus-sign {
  background: #c9ccd8;
  border-color: var(--ink-soft);
}

.wb-plus:disabled .hm-gains {
  opacity: 0.45;
}

.wb-plus .hm-hand {
  top: 100%;
  left: 0.3em;
  margin-top: -0.6em;
}

.wb-train-row .hm-float {
  top: -0.6em;
}

/* ===================== Butik: a market stand ===================== */

.wb-shop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 4.4em;
  padding: 5em 3em 2.4em 3em;
}

/* The stand's striped roof across both pages, with a scalloped edge under it */
.wb-awning {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.6em;
  background: repeating-linear-gradient(90deg, #ef5b62 0 3em, #fff6ea 3em 6em);
  box-shadow: inset 0 -0.12em 0 rgba(44, 49, 80, 0.35);
}

.wb-awning::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 1.5em;
  background:
    radial-gradient(circle at 1.5em 0, #ef5b62 1.45em, transparent 1.5em) 0 0 / 6em 1.5em repeat-x,
    radial-gradient(circle at 4.5em 0, #fff6ea 1.45em, transparent 1.5em) 0 0 / 6em 1.5em repeat-x;
  filter: drop-shadow(0 0.25em 0.15em rgba(44, 49, 80, 0.25));
}

.wb-shop-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9em;
  min-height: 0;
}

.wb-gold {
  font-size: 2.2em;
  transform: rotate(-2deg);
}

.wb-gold b {
  font-family: var(--bold);
}

/* What you wear: three big round places */
.wb-worn {
  display: flex;
  gap: 1em;
}

.sf-slot {
  display: grid;
  place-items: center;
  width: 5.4em;
  height: 5.4em;
  padding: 0;
  background: rgba(255, 255, 255, 0.6);
  border: 0.14em dashed var(--ink-soft);
  border-radius: 50%;
}

.sf-slot.is-full {
  background: #fff;
  border: 0.16em solid var(--ink);
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

.sf-slot svg,
.sf-slot img {
  width: 3.9em;
  height: 3.9em;
  object-fit: contain;
}

.sf-slot:disabled svg {
  width: 1.8em;
  height: 1.8em;
  color: var(--ink-soft);
}

.sf-slot.is-swap {
  background: #fff6c2;
  box-shadow: 0 0 0 0.2em var(--crayon-yellow), var(--cutout-shadow);
  animation: hm-beat 0.9s ease-in-out infinite;
}

/* The card of the chosen thing: a note taped onto the page */
.wb-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  width: 100%;
  min-height: 0;
  padding: 0.8em 1em;
  text-align: center;
  background: #fffef6;
  border: 0.13em solid var(--ink);
  border-radius: 0.8em 0.25em 0.7em 0.3em / 0.3em 0.7em 0.25em 0.8em;
  box-shadow: var(--cutout-shadow);
  transform: rotate(0.6deg);
}

.wb-card::before {
  content: "";
  position: absolute;
  top: -0.7em;
  left: 50%;
  width: 5em;
  height: 1.4em;
  background: rgba(255, 233, 140, 0.85);
  clip-path: polygon(0 10%, 8% 0, 92% 0, 100% 12%, 100% 90%, 92% 100%, 8% 100%, 0 88%);
  transform: translateX(-50%) rotate(-3deg);
}

.wb-card.is-new {
  animation: sf-bought 0.7s ease-out;
}

.wb-card-head {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.hm-detail-icon {
  box-sizing: content-box;
  width: 4em;
  height: 4em;
  padding: 0.4em;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0.12em rgba(44, 49, 80, 0.12), 0.12em 0.25em 0.22em rgba(44, 49, 80, 0.28);
  transform: rotate(-5deg);
}

.hm-detail-name {
  font-family: var(--bold);
  font-size: 1.9em;
  font-weight: 400;
  line-height: 1;
  text-align: left;
}

/* What sort it is: Anfall / Försvar / Strategi */
.wb-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.1em 0.7em 0.15em 0.3em;
  font-size: 1.25em;
  background: #fff;
  border: 0.1em solid var(--ink);
  border-radius: 999px;
}

.wb-kind svg {
  width: 1.5em;
  height: 1.5em;
}

.wb-kind.is-attack { background: #ffe1df; }
.wb-kind.is-defence { background: #dfe9ff; }
.wb-kind.is-strategy { background: #fff3c4; }

.hm-detail-about {
  margin: 0;
  font-size: 1.25em;
  line-height: 1.15;
  color: var(--ink-soft);
}

.hm-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  min-height: max(2.2em, 44px);
  padding: 0.1em 1em 0.15em;
  font-family: var(--bold);
  font-size: 1.8em !important;
}

.hm-action.sf-buy {
  background: var(--crayon-yellow);
}

.hm-action.sf-wear {
  background: #b9ea9b;
}

.hm-action-icon {
  display: grid;
  place-items: center;
}

.hm-action-icon svg {
  width: 0.9em;
  height: 0.9em;
}

.hm-action .sf-coin {
  width: 0.85em;
  height: 0.85em;
}

/* Too little gold: the button is grey, and a tap shakes the gold */
.hm-action.is-short {
  color: var(--ink-soft);
  background: #e3e5ec;
}

.hm-hand-up {
  position: absolute;
  top: -1.4em;
  right: 1.4em;
}

/* The goods on the stand's shelves: a wooden plank under every row */
.wb-shelves {
  --row: 9.2em;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: var(--row);
  align-content: start;
  column-gap: 0.3em;
  min-height: 0;
  background: repeating-linear-gradient(180deg,
    transparent 0 calc(var(--row) - 0.75em),
    #c48a52 calc(var(--row) - 0.75em) calc(var(--row) - 0.3em),
    #8a5a30 calc(var(--row) - 0.3em) var(--row));
}

.hm-charm {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15em;
  min-width: 44px;
  padding: 0 0 0.85em;
  font-family: var(--hand);
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}

/* The goods: round stickers with a white die-cut edge, leaning a little */
.hm-charm-icon {
  box-sizing: content-box;
  width: 3.7em;
  height: 3.7em;
  padding: 0.35em;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0.12em rgba(44, 49, 80, 0.12), 0.1em 0.2em 0.18em rgba(44, 49, 80, 0.28);
  transform: rotate(var(--lean, -4deg));
  transition: transform 0.15s;
}

.hm-charm:nth-child(3n + 1) { --lean: 5deg; }
.hm-charm:nth-child(4n + 2) { --lean: -7deg; }
.hm-charm:nth-child(5n + 3) { --lean: 2deg; }

.hm-charm:hover .hm-charm-icon,
.hm-charm:focus-visible .hm-charm-icon {
  transform: rotate(0deg) scale(1.08);
}

/* The price tag, hanging from the shelf */
.wb-price-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  padding: 0 0.35em;
  font-family: var(--bold);
  font-size: 1.05em;
  background: #fff;
  border: 0.08em solid var(--ink);
  border-radius: 0.2em 0.5em 0.5em 0.2em;
  transform: rotate(-3deg);
}

.wb-price-tag .sf-coin {
  width: 0.8em;
  height: 0.8em;
}

/* What sort it is: a small round badge on the sticker */
.wb-good-kind {
  position: absolute;
  top: 0.6em;
  left: 0.1em;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  background: #fff;
  border: 0.08em solid var(--ink);
  border-radius: 50%;
}

.wb-good-kind svg {
  width: 1.1em;
  height: 1.1em;
}

.hm-tier {
  position: absolute;
  top: 0.6em;
  right: 0.1em;
  z-index: 1;
  padding: 0 0.35em;
  font-family: var(--bold);
  font-size: 0.85em;
  background: var(--crayon-cyan);
  border: 0.09em solid var(--ink);
  border-radius: 999px;
}

.hm-charm-mark {
  display: grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  color: #fff;
  background: #4caf50;
  border: 0.1em solid var(--ink);
  border-radius: 50%;
}

.hm-charm-mark svg {
  width: 0.9em;
  height: 0.9em;
}

.hm-charm.is-dear .hm-charm-icon {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.hm-charm.is-dear .wb-price-tag {
  color: var(--ink-soft);
}

/* Worn: taken off the shelf – only a faint ghost of it stays */
.hm-charm.is-worn .hm-charm-icon {
  background: transparent;
  box-shadow: none;
  outline: 0.1em dashed #7f6a55;
  opacity: 0.35;
  filter: grayscale(1);
}

.hm-charm.is-selected .hm-charm-icon {
  box-shadow: 0 0 0 0.22em var(--crayon-yellow), 0 0 0 0.34em var(--ink), 0.1em 0.2em 0.18em rgba(44, 49, 80, 0.28);
}

.hm-charm.is-new {
  animation: sf-bought 0.7s ease-out;
}

/* ===================== Pause ===================== */

.hm-sheet {
  font-size: clamp(12px, min(1.7cqw, 3cqh), 40px);
  gap: 0.6em;
  max-width: none;
  padding: 1em 1.6em 1.2em;
  line-height: 1.2;
}

.stage.is-fullscreen .sf-menu > .hm-sheet {
  zoom: 1;
}

.hm-pause {
  height: auto;
  width: min(100%, 30em);
  align-items: center;
}

.hm-pause .sf-heading {
  font-size: 2.2em;
}

.hm-pause-choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.8em;
  width: 100%;
}

.hm-pause-choices[hidden] {
  display: none;
}

.hm-pause .hm-play {
  font-size: 2.2em;
}

/* "Avbryt uppdrag": a white button with a door – the way out, never yellow */
.hm-quit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: max(2.4em, 44px);
  padding: 0.15em 0.8em 0.2em;
  font-family: var(--bold);
  font-size: 1.6em;
  color: #b8303a;
  background: #fff;
  border: 0.1em solid var(--ink);
  border-radius: 0.4em 0.15em 0.35em 0.2em;
  box-shadow: var(--cutout-shadow);
  cursor: pointer;
}

.hm-quit:hover,
.hm-quit:focus-visible {
  background: #ffe6e6;
}

.hm-sure {
  margin: 0;
  font-family: var(--bold);
  font-size: 2em;
  text-align: center;
}

.hm-sure-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
}

.hm-sure-buttons .hm-play,
.hm-sure-buttons .hm-quit {
  font-size: 1.5em;
}

/* ===================== In the game: the magic button and the hand that points at it ===================== */

.stage .magic-button.is-ready {
  animation: hm-beat 0.9s ease-in-out infinite;
}

.sf-magic-hint {
  position: absolute;
  right: calc(3.6rem + var(--safe-right));
  bottom: calc(3.7rem + var(--safe-bottom));
  z-index: 3;
  width: 2.8rem;
  height: 2.8rem;
  color: var(--ink);
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff);
  rotate: 90deg;                            /* the finger points to the right, at the button */
  pointer-events: none;
  animation: hm-nudge 0.8s ease-in-out infinite;
}

.sf-magic-hint svg {
  width: 100%;
  height: 100%;
}

.sf-magic-hint[hidden] {
  display: none;
}

@keyframes hm-nudge {
  50% { translate: 0.5rem 0; }
}

/* ===================== The menus' pictures: Phosphor Fill icons in crayon colours (menus.js PICTURES) ===================== */

.pic {
  filter: drop-shadow(0.04em 0.06em 0 rgba(44, 49, 80, 0.3));
}

.pic-red { color: var(--crayon-red); }
.pic-green { color: #5fb83a; }
.pic-blue { color: var(--crayon-blue); }
.pic-orange { color: #f08a24; }
.pic-brown { color: #c98a4b; }
.pic-ink { color: var(--ink); }
.pic-grey { color: #7b7f96; }
.pic-yellow { color: #e0a800; }
.pic-teal { color: #1fa8a0; }
.pic-purple { color: #6b55a8; }
.pic-spell { color: var(--spell, var(--crayon-pink)); }

@media (prefers-reduced-motion: reduce) {
  .stage .magic-button.is-ready,
  .sf-magic-hint,
  .hm-map-fyre,
  .hm-place.is-next .hm-place-art,
  .wb-flyer-picture,
  .wb-way-art,
  .wb-plus:not(:disabled),
  .hm-dot,
  .wb-corner.is-calling {
    animation: none !important;
  }
}
