/* Layout: one centered column — carved logo, wooden wallet planks, stone score panel, the board inside a
   carved dragon frame, rune medallion boosters, stone rule cards. Dark Viking dusk: weathered wood,
   iron and stone lit by embers, gold for anything you can press. Single dark theme by choice. */
:root {
  --ink: #0d0b0a;
  --stone: #23201d;
  --stone-2: #2e2a26;
  --line: rgba(231, 180, 80, .32);
  --gold: #e7b450;
  --gold-soft: #f6d98e;
  --ember: #ff8a2a;
  --text: #f4ead6;
  --muted: #c4b59b;
  --danger: #ff7a59;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { min-height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  padding-inline: 16px;
  padding-block: 14px 32px;
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
}
/* Dusk landscape behind everything, darkened toward the bottom where the board sits. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(8, 6, 6, .05), rgba(8, 6, 6, .45) 55%, rgba(8, 6, 6, .7)),
    url("img/bg_dusk.jpg") center top / cover no-repeat;
}
#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
/* One column, top to bottom: logo, wallet, score, board, boosters, restart, rules. */
.app { position: relative; max-width: 600px; margin-inline: auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Header ---------- */
.top { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* Music and sound-effect toggles: small round iron studs in the top-right corner. */
.sound-ctrl { position: absolute; top: 0; right: 0; z-index: 2; display: flex; gap: 8px; }
.round {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #6b5230;
  background: radial-gradient(circle at 35% 30%, #4a3a28, #1e1610 70%);
  color: var(--gold-soft);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .2), 0 3px 8px rgba(0, 0, 0, .6);
}
.round svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 1px #000); }
/* Off: dimmed with a red slash. */
.round[aria-pressed="false"] { color: #8a7a62; }
.round[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: #d9534f;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 1px #1e1610;
}
h1 { width: 100%; margin: 0; line-height: 0; text-align: center; }
.logo { width: min(92%, 440px); max-width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
.sub {
  margin: -4px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(.8rem, 2.6vw, .95rem);
  letter-spacing: .04em;
  color: #efe2c4;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
}

/* ---------- Buttons ---------- */
button {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .03em;
  border-radius: 10px;
  padding: .55em 1.15em;
  cursor: pointer;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #3a2a1c, #22180f);
  color: var(--gold-soft);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .15), 0 3px 8px rgba(0, 0, 0, .45);
}
button:hover { filter: brightness(1.15); }
button:focus-visible, #board:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.btn-primary {
  border-color: #8a5f14;
  background: linear-gradient(180deg, #ffe08a 0%, #e8b042 55%, #c98a22 100%);
  color: #3a2405;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 3px 10px rgba(0, 0, 0, .5);
}

/* ---------- Wallet: wooden planks with the icon breaking over the left end ---------- */
.wallet {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px clamp(14px, 4vw, 26px);
  width: 100%;
  padding-left: 12px;
  box-sizing: border-box;
}
.res, .shop-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: clamp(38px, 10vw, 46px);
  padding: 0 10px 0 clamp(26px, 7vw, 34px);
  border: 0;
  border-radius: 0;
  background: url("img/plank.png") center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6));
  color: #fff4dc;
  font-family: var(--font-display);
  font-size: clamp(.95rem, 3.6vw, 1.2rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}
.res-icon, .shop-btn img {
  position: absolute;
  left: clamp(-16px, -3vw, -10px);
  top: 50%;
  width: clamp(40px, 11vw, 52px);
  height: clamp(40px, 11vw, 52px);
  transform: translateY(-50%);
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .7));
}
.res small { color: var(--muted); font-family: var(--font-body); font-size: .7rem; font-weight: 700; }
/* ---------- Odin's Wheel (daily spin) ---------- */
/* Directly under the Map button. */
.map-btn.wheel-btn { left: 1px; top: 80px; }
.wheel-btn canvas { width: 56px; height: 56px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .7)); transition: transform .3s ease-out; }
.wheel-btn:hover canvas { transform: rotate(45deg); }
.wheel-btn .badge {
  position: absolute;
  top: 0;
  right: 2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #6b1010;
  background: radial-gradient(circle at 35% 30%, #ff9a8a, #d9342b 60%, #8c1c16);
  color: #fff;
  font-family: var(--font-body);
  font-style: normal;
  font-size: .75rem;
  font-weight: 900;
  animation: badge-bob 1.2s ease-in-out infinite;
}
@keyframes badge-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.wheel-modal {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 5, 4, .82);
}
.wheel-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(600px, calc(100vh - 20px));
  box-sizing: border-box;
  padding: 104px 80px 76px;
  background: url("img/dialog_panel.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .8));
}
.wheel-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.2vh, 2rem);
  background: linear-gradient(180deg, #fff6cf 0%, #f2c45a 45%, #c27f1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 1px #2a1606);
}
.wheel-sub { margin: -4px 0 0; font-family: var(--font-display); font-weight: 700; font-size: .8rem; color: #e9d6ac; text-shadow: 0 1px 2px #000; }
.wheel-stage { position: relative; width: min(310px, calc(100vh - 370px)); height: min(310px, calc(100vh - 370px)); margin-top: 6px; }
#wheel { width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
/* Gold arrowhead at the top pointing down at the winning slice. */
.wheel-pointer {
  position: absolute;
  left: 50%;
  top: -6px;
  width: 30px;
  height: 38px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff3c4, #e2a93a 60%, #9a6416);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .8));
}
.wheel-result { margin: 0; min-height: 1.3em; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #ffd36b; text-shadow: 0 2px 3px #000; }
.wheel-spin {
  min-width: 170px;
  height: 48px;
  padding: 0 22px 3px;
  border: 0;
  border-radius: 0;
  background: url("img/btn_gold.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #4a2a06;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 240, 190, .8);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6));
}
.wheel-spin:disabled { opacity: .55; cursor: default; }
.wheel-spin:focus-visible { outline: none; filter: drop-shadow(0 0 3px #fff3c4) drop-shadow(0 0 8px rgba(255, 190, 80, .9)); }
.wheel-spin:hover:not(:disabled) { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6)) brightness(1.1); }
.wheel-close { top: 78px; right: 76px; width: 40px; font-size: 1.1rem; }
@media (prefers-reduced-motion: reduce) { .wheel-btn .badge { animation: none; } }

/* Pre-level boosters on the intro card: three small medallions you can toggle on. */
#ov-extra { width: 100%; }
.overlay .card.compact { gap: 6px; padding-top: 17%; padding-bottom: 14%; }
.overlay .card.compact h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); }
.overlay .card.compact #ov-text { padding-bottom: 8px; font-size: .85rem; }
.overlay .card.compact .rewards { gap: 4px; }
.overlay .card.compact .rewards li.goal-chip { max-width: 250px; font-size: .95rem; }
.overlay .card.compact .ov-actions { margin-top: 0; }
.overlay .card.compact .ov-actions button { height: 40px; min-width: 112px; font-size: 1rem; }
.pre-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pre-label { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: .8rem; color: #e9d6ac; text-shadow: 0 1px 2px #000; }
.pre-list { display: flex; justify-content: center; gap: 10px; }
.pre {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 76px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #f4ead6;
  font-family: var(--font-display);
  letter-spacing: 0;
  transition: transform .12s ease-out;
}
.pre:hover { transform: translateY(-2px); filter: none; }
.pre-medal {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: url("img/medallion.png") center / 100% 100% no-repeat, radial-gradient(circle, rgba(0, 0, 0, .55) 38%, transparent 39%);
  filter: grayscale(.6) brightness(.75) drop-shadow(0 3px 4px rgba(0, 0, 0, .7));
  transition: filter .15s ease-out;
}
.pre-medal img { width: 58%; height: 58%; object-fit: contain; }
.pre-name { font-size: .62rem; font-weight: 800; line-height: 1.1; text-align: center; text-shadow: 0 1px 2px #000; }
.pre-price { display: flex; align-items: center; gap: 2px; font-family: var(--font-body); font-size: .7rem; font-weight: 800; color: #ffd36b; text-shadow: 0 1px 2px #000; }
.pre-price img { width: 14px; height: 14px; }
.pre.on .pre-medal { filter: drop-shadow(0 0 6px #ffd36b) drop-shadow(0 0 2px #fff3c4); }
.pre.on::after {
  content: "✔";
  position: absolute;
  top: -2px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #1d5a1d;
  background: #3e9a35;
  color: #fff;
  font-size: .6rem;
}

/* Green "+" gem on the right end of the lives and coins planks: opens the shop there. */
.res { padding-right: 34px; }
.plus {
  position: absolute;
  right: -8px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0 0 2px;
  transform: translateY(-50%);
  border: 2px solid #1d5a1d;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c8ffb0, #4fae3f 60%, #2b6d22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 3px 6px rgba(0, 0, 0, .6);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #0f2a0c;
  transition: transform .12s ease-out;
}
.plus:hover { transform: translateY(-50%) scale(1.12); filter: brightness(1.1); }
.plus:active { transform: translateY(-50%) scale(.95); }
.plus:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
/* Shop section the player jumped to with a "+" button. */
.shop-grid.flash { animation: shop-flash 1.4s ease-out; border-radius: 12px; }
.shop-grid.flash .item { animation: card-pop .6s ease-out; }
@keyframes card-pop { 40% { transform: scale(1.05); } }
@keyframes shop-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(246, 217, 142, .7); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .shop-grid.flash { animation: none; } .plus { transition: none; } }
.shop-btn { color: var(--gold-soft); letter-spacing: .06em; padding-left: clamp(34px, 9vw, 44px); }
.shop-btn img { width: clamp(46px, 12.5vw, 58px); height: clamp(46px, 12.5vw, 58px); transform: translateY(-58%); }
.shop-btn:hover { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6)) brightness(1.15); }

/* ---------- Score panel: stone slab in an iron frame ---------- */
.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(10px, 3vw, 18px);
  align-items: center;
  aspect-ratio: 972 / 217;
  padding: 0 8.5%;
  background: url("img/panel.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6));
}
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat:last-child { align-items: flex-end; }
.label { font-family: var(--font-display); font-weight: 700; font-size: clamp(.68rem, 2.4vw, .82rem); letter-spacing: .05em; color: var(--muted); }
.value {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.6vw, 1.7rem);
  font-weight: 800;
  line-height: 1.05;
  color: #fff6e2;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .9);
}
.value small { font-size: .55em; font-weight: 700; color: var(--muted); }
.value.low { color: var(--danger); }
/* Molten progress bar in a dark groove. */
.bar {
  position: relative;
  height: clamp(7px, 1.8vw, 10px);
  margin-top: 4px;
  border-radius: 999px;
  background: #0c0a09;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 220, 160, .12);
  overflow: hidden;
}
#bar-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8340a, #ff7a1a 45%, #ffc34d 85%, #fff0b0);
  box-shadow: 0 0 10px rgba(255, 138, 42, .9);
  transition: width .35s ease-out;
}
#bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { background-position: -60% 0; } to { background-position: 160% 0; } }

/* ---------- Board inside the carved dragon frame ----------
   The frame image is 998×974 with a 718×718 opening at (140, 128); the slot is placed on that
   opening. The frame is drawn wider than the column so its dragon heads can reach into the gutters. */
.board-wrap {
  position: relative;
  width: 112%;
  margin-inline: -6%;
  aspect-ratio: 998 / 974;
}
.board-slot {
  position: absolute;
  left: 14.03%;
  top: 13.14%;
  width: 71.94%;
  height: 73.72%;
}
.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .7));
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  background: #0f0d0c;
  touch-action: none;
  cursor: pointer;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(8, 6, 5, .72);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  max-width: 320px;
  padding: 22px 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--stone-2), var(--stone));
  border: 2px solid #4a3a26;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, .7);
}
.card h2 { margin: 0; font-family: var(--font-display); color: var(--gold-soft); font-size: 1.4rem; text-wrap: balance; text-shadow: 0 2px 4px #000; }
.card p { margin: 0; color: var(--text); line-height: 1.5; }
.toast {
  position: absolute;
  left: 50%;
  top: 10%;
  z-index: 3;
  opacity: 0;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  color: var(--gold-soft);
  text-shadow: 0 0 12px rgba(255, 138, 42, .8), 0 2px 6px #000;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { animation: pop .95s ease-out forwards; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(1); }
}

/* ---------- Boosters: rune medallions with a wooden name plaque ---------- */
.booster-tip { margin: 0; text-align: center; color: var(--gold-soft); font-weight: 700; text-shadow: 0 2px 4px #000; }
.boosters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.booster {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--gold-soft);
  transition: transform .12s ease-out;
}
.booster:hover { transform: translateY(-2px); filter: none; }
.booster:active { transform: translateY(1px); }
.medal {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 86px);
  aspect-ratio: 1;
  background:
    url("img/medallion.png") center / 100% 100% no-repeat,
    radial-gradient(circle, var(--glow, rgba(255, 170, 80, .45)) 0%, rgba(0, 0, 0, .55) 38%, transparent 39%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7));
}
.booster.active .medal { filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 0 4px var(--gold)); }
.b-icon { width: 54%; height: 54%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7)); }
.b-name {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 24px;
  padding: 0 4px;
  box-sizing: border-box;
  background: url("img/plank.png") center / 100% 100% no-repeat;
  font-family: var(--font-display);
  font-size: clamp(.5rem, 1.9vw, .68rem);
  font-weight: 800;
  letter-spacing: .03em;
  line-height: 1.1;
  text-align: center;
  color: var(--gold-soft);
  text-shadow: 0 1px 2px #000;
}
.count {
  position: absolute;
  top: -2px;
  right: 2%;
  min-width: clamp(17px, 4.6vw, 22px);
  height: clamp(17px, 4.6vw, 22px);
  padding: 0 4px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid #6b4a10;
  background: radial-gradient(circle at 35% 30%, #fff1b8, #e2a93a 60%, #a8721c);
  color: #2e1c04;
  font-family: var(--font-body);
  font-size: clamp(.6rem, 2.2vw, .75rem);
  font-weight: 900;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .6);
}
.count.buy { border-color: #1d5a1d; background: radial-gradient(circle at 35% 30%, #c8ffb0, #4fae3f 60%, #2b6d22); color: #0f2a0c; }
.actions { display: flex; justify-content: center; }

/* ---------- Rule cards ---------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.rule {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(46, 42, 38, .92), rgba(30, 27, 24, .92));
  border: 1px solid #4a3a26;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(231, 180, 80, .12);
}
.icon { width: 44px; height: 44px; flex: none; border-radius: 8px; background: #141210; box-shadow: inset 0 0 0 1px #4a3a26; }
.rule p { margin: 0; min-width: 0; font-size: .88rem; line-height: 1.45; color: var(--text); }
.rule b { color: var(--gold-soft); }

/* ---------- Overlay extras ---------- */
.ov-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stars { margin: 0; font-size: 1.8rem; letter-spacing: .15em; color: var(--gold-soft); text-shadow: 0 0 10px rgba(255, 170, 60, .7); }
.rewards { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.rewards li { padding: .3em .8em; background: #1a1714; border: 1px solid var(--line); border-radius: 999px; font-weight: 700; font-size: .85rem; }

/* ---------- Shop ---------- */
.shop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 5, 4, .82);
}
/* Carved wooden shop window (753×978 picture with wolf heads); the list scrolls inside its
   wooden middle, the gold SHOP title sits on the top border. */
.shop-panel {
  position: relative;
  width: min(580px, calc(100vw - 16px), calc((100vh - 24px) * 753 / 978));
  aspect-ratio: 753 / 978;
  background: url("img/shop_panel.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .85));
}
.shop-title {
  position: absolute;
  top: 1.5%;
  left: 50%;
  z-index: 2;
  margin: 0;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5.6vh, 3.4rem);
  letter-spacing: .06em;
  line-height: 1;
  background: linear-gradient(180deg, #fff6cf 0%, #f2c45a 45%, #b8741a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 1px #2a1606) drop-shadow(0 0 14px rgba(255, 170, 60, .7));
}
.shop-close {
  position: absolute;
  top: 11.5%;
  right: 16%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 2px;
  border: 0;
  border-radius: 0;
  background: url("img/btn_wood.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #f6d98e;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px #000;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6));
}
.shop-close:hover { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)) brightness(1.15); }
.shop-close:focus-visible, .item .buy:focus-visible { outline: none; filter: drop-shadow(0 0 3px #fff3c4) drop-shadow(0 0 8px rgba(255, 190, 80, .9)); }
.shop-body {
  position: absolute;
  left: 16.5%;
  right: 16.5%;
  top: 17.5%;
  bottom: 14%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #8a6a32 transparent;
}
.shop-have {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 2px 16px 2px 4px;
  border: 1px solid #6b5230;
  border-radius: 999px;
  background: rgba(12, 10, 8, .75);
  font-size: .9rem;
  color: #efe2c4;
}
.shop-have img { width: 34px; height: 34px; object-fit: contain; }
.shop-have b { color: #ffd36b; font-family: var(--font-display); font-size: 1.05rem; }
/* Section headers with ornamental gold lines on both sides. */
.shop-sec {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #f2c45a;
  text-shadow: 0 2px 2px #000;
}
.shop-sec::before, .shop-sec::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, #c99a4a 30%, #f6d98e); }
.shop-sec::after { transform: scaleX(-1); }
.shop-msg { margin: 0; color: var(--gold-soft); font-weight: 700; text-align: center; }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shop-grid.lives-grid { grid-template-columns: 1fr; }
/* Item card: bronze-framed board with name, picture and price. */
.item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12% 9% 10%;
  text-align: center;
  background: url("img/shop_card.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6));
}
.i-name { font-family: var(--font-display); font-weight: 800; font-size: .8rem; line-height: 1.1; color: #fff1c8; text-shadow: 0 1px 2px #000; }
.i-desc { font-size: .66rem; line-height: 1.25; color: #c9b896; }
.i-img { width: 64%; aspect-ratio: 1; height: auto; margin: 2px 0; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .7)); }
.i-icon { font-size: 1.6rem; }
.tag {
  position: absolute;
  left: 50%;
  bottom: 31%;
  transform: translateX(-50%);
  padding: .05em .6em;
  border: 1px solid #7a5512;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffe08a, #d9a23a);
  color: #3a2405;
  font-size: .62rem;
  font-weight: 800;
  white-space: nowrap;
}
.item .buy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 30px;
  margin-top: auto;
  padding: 0 6px 2px;
  border: 0;
  border-radius: 0;
  background: url("img/btn_wood.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #fff1c8;
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px #000;
}
.item .buy img { width: 16px; height: 16px; }
.item .buy.real { background-image: url("img/btn_gold.png"); color: #4a2a06; text-shadow: 0 1px 0 rgba(255, 240, 190, .7); }
.item .buy:hover:not(:disabled) { filter: brightness(1.15); }
.item .buy:disabled { opacity: .45; cursor: default; }
/* The lives offer is one wide row: heart, text, price. */
.item.wide { flex-direction: row; gap: 12px; padding: 4% 6%; text-align: left; }
.item.wide .i-img { width: 64px; margin: 0; }
.item.wide .i-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.item.wide .i-name { font-size: .95rem; }
.item.wide .buy { width: 110px; margin: 0; }
.note { margin: 0; font-size: .7rem; color: #a8997d; text-align: center; }
.confirm {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(8, 6, 5, .95);
}
.confirm p { margin: 0; line-height: 1.5; }

/* ---------- Map button (top-left, mirrors the sound toggles) ---------- */
.map-btn {
  position: absolute;
  top: -4px;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--gold-soft);
  font-size: .75rem;
  text-shadow: 0 1px 3px #000;
}
.map-btn img { width: 58px; height: 56px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .7)); transition: transform .15s ease-out; }
.map-btn:hover { filter: none; }
.map-btn:hover img { transform: rotate(-6deg) scale(1.08); }

/* ---------- Goals strip: one plank per goal ---------- */
.goals { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 44px; }
.goal {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px 0 10px;
  background: url("img/plank.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6));
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff4dc;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px #000;
}
.goal img, .goal canvas { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.goal small { font-family: var(--font-body); font-size: .7rem; font-weight: 700; color: var(--muted); }
.goal.done { color: #9cf08a; }
.goal.done::after {
  content: "✔";
  position: absolute;
  top: -6px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3e9a35;
  border: 2px solid #1d5a1d;
  color: #fff;
  font-size: .7rem;
}
/* Goal chips inside the level-intro card. */
/* ---------- Dialog card (level intro, win, out of moves...) ----------
   The carved panel image is 720×702; the padding keeps content on its wooden middle
   (the right side is wider because of the crossed axes). */
.overlay .card {
  width: 100%;
  max-width: 470px;
  min-height: min(100%, 440px);
  box-sizing: border-box;
  justify-content: center;
  gap: 10px;
  padding: 15% 17% 12% 13.5%;
  background: url("img/dialog_panel.png") center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .8));
}
.overlay .card h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: .03em;
  background: linear-gradient(180deg, #fff6cf 0%, #f2c45a 45%, #c27f1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 1px #2a1606) drop-shadow(0 0 10px rgba(255, 170, 60, .55));
}
/* Subtitle with an ornamental divider under it. */
.overlay .card #ov-text {
  position: relative;
  padding-bottom: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(.85rem, 1.5vw, 1.05rem);
  color: #f0e2c0;
  text-shadow: 0 2px 2px #000;
}
.overlay .card #ov-text::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c99a4a 20%, #f6d98e 50%, #c99a4a 80%, transparent);
}
.overlay .card #ov-text::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 9px;
  height: 9px;
  background: #f6d98e;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 0 6px rgba(255, 190, 80, .8);
}
.overlay .rewards { flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.overlay .rewards li { background: rgba(20, 16, 12, .75); border-color: #6b5230; color: #f4ead6; }
/* Goal plaque: icon in the round socket on the left, text on the metal plate. */
.rewards li.goal-chip {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 330px;
  aspect-ratio: 640 / 168;
  box-sizing: border-box;
  padding: 0 6% 0 35%;
  border: 0;
  border-radius: 0;
  background: url("img/goal_plaque.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6));
  font-family: var(--font-display);
  font-size: clamp(.95rem, 1.7vw, 1.25rem);
  font-weight: 800;
  line-height: 1.1;
  color: #fff3d0;
  text-shadow: 0 2px 2px #000;
}
.rewards li.goal-chip img {
  position: absolute;
  left: 23.4%;
  top: 46%;
  width: 15.5%;
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255, 190, 80, .6));
}
/* Image buttons: gold for the main action, carved wood for the others. */
.overlay .ov-actions { gap: 12px; margin-top: 4px; }
.overlay .ov-actions button {
  min-width: 128px;
  height: 46px;
  padding: 0 22px 3px;
  border: 0;
  border-radius: 0;
  background: url("img/btn_wood.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #f6d98e;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 2px 2px #000;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6));
  transition: transform .12s ease-out;
}
.overlay .ov-actions button.btn-primary {
  background-image: url("img/btn_gold.png");
  color: #4a2a06;
  text-shadow: 0 1px 0 rgba(255, 240, 190, .8);
}
.overlay .ov-actions button:hover { transform: translateY(-2px) scale(1.03); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .6)) brightness(1.1); }
/* Keyboard focus: a warm glow around the button shape instead of a box outline. */
.overlay .ov-actions button:focus-visible { outline: none; filter: drop-shadow(0 0 3px #fff3c4) drop-shadow(0 0 8px rgba(255, 190, 80, .9)); }

/* ---------- Level map ---------- */
/* Full-screen map. The map picture keeps its 1024×572 shape and covers the window (edges may be
   cropped), so level buttons placed in % of the picture always sit on the painted road. */
.map-modal {
  --plaque-w: min(480px, 36vw);
  --band: calc(var(--plaque-w) * 292 / 900 * .88);   /* space the hanging plaque takes at the top */
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  background: #0d0b0a;
}
/* The same map, blurred and dark, fills the screen behind the sharp one. */
#map-bg {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(18px) brightness(.45) saturate(1.2);
}
/* The sharp map sits below the plaque, as large as fits, so no level button is hidden. */
.map-view {
  position: absolute;
  left: 50%;
  top: calc(var(--band) + (100vh - var(--band) - 12px) / 2);
  width: min(calc(100vw - 150px), calc((100vh - var(--band) - 12px) * 1024 / 572));
  aspect-ratio: 1024 / 572;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(231, 180, 80, .45), 0 0 0 5px rgba(40, 28, 16, .9), 0 20px 50px rgba(0, 0, 0, .8);
}
/* Soft dark vignette so the plaque and buttons read on bright maps. */
.map-view::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 66%, rgba(0, 0, 0, .4));
}
#map-img, #map-path, #map-nodes { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-img { object-fit: cover; }
#map-path { pointer-events: none; }
#map-nodes { z-index: 1; }
.map-open #embers { z-index: 10; }
/* The page behind the map must not scroll while the map is open. */
html:has(body.map-open), body.map-open { overflow: hidden; }

/* Hanging title plaque. */
.map-plaque {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: var(--plaque-w);
  aspect-ratio: 900 / 292;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2.2%;
  background: url("img/map_plaque.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .7));
  text-align: center;
  pointer-events: none;
}
.plaque-kicker { font-family: var(--font-display); font-weight: 800; font-size: clamp(.7rem, 1.1vw, .95rem); letter-spacing: .12em; color: #d9b25e; text-shadow: 0 1px 2px #000; }
.map-plaque h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.3rem, 2.7vw, 2.3rem);
  line-height: 1.05;
  background: linear-gradient(180deg, #fff3c4, #e2a93a 70%, #b77a1e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .9));
}
#map-range { font-family: var(--font-display); font-weight: 700; font-size: clamp(.7rem, 1.1vw, .95rem); color: #efe2c4; text-shadow: 0 1px 2px #000; }

/* Round bronze buttons. */
.ui-round {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(48px, 4.6vw, 66px);
  aspect-ratio: 1;
  padding: 0 0 4px;
  border: 0;
  border-radius: 50%;
  background: url("img/round_button.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #f6d98e;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  line-height: 1;
  text-shadow: 0 2px 3px #000;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7));
  transition: transform .12s ease-out;
}
.ui-round:hover:not(:disabled) { transform: scale(1.08); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7)) brightness(1.15); }
.ui-round:disabled { opacity: .35; cursor: default; }
.map-close-btn { top: 18px; right: 22px; font-size: clamp(1.1rem, 1.7vw, 1.6rem); }
.map-nav { top: 50%; margin-top: calc(clamp(48px, 4.6vw, 66px) / -2); }
.map-nav.prev { left: 18px; }
.map-nav.next { right: 18px; }
.map-nav:hover:not(:disabled) { transform: scale(1.08); }

/* Level buttons: bronze medallions. */
.node {
  position: absolute;
  width: 5.2%;
  aspect-ratio: 1;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: url("img/level_medallion.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #fff1c8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(12px, 1.25vw, 22px);
  text-shadow: 0 2px 2px #000, 0 0 6px #000;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .8));
  transition: transform .12s ease-out;
}
.node.boss { width: 7%; font-size: clamp(14px, 1.6vw, 28px); }
.node:hover:not(.locked) { transform: translate(-50%, -50%) scale(1.12); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .8)) brightness(1.15); }
/* Locked: dark medallion wrapped in chains with a padlock (the chains and lock are lifted back
   to normal brightness because the parent filter darkens them too). */
.node.locked { cursor: not-allowed; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .8)) grayscale(.7) brightness(.6); }
.node .chains, .node .lock { position: absolute; pointer-events: none; }
.node .chains { inset: -8%; width: 116%; height: 116%; filter: brightness(1.7); }
.node .lock { left: 50%; top: 55%; width: 46%; transform: translate(-50%, -50%); filter: brightness(2.2); }
.node.shake { animation: node-shake .4s ease-out; }
@keyframes node-shake {
  0%, 100% { transform: translate(-50%, -50%); }
  20% { transform: translate(calc(-50% - 5px), -50%) rotate(-4deg); }
  40% { transform: translate(calc(-50% + 5px), -50%) rotate(4deg); }
  60% { transform: translate(calc(-50% - 3px), -50%); }
  80% { transform: translate(calc(-50% + 3px), -50%); }
}
/* Just unlocked: the chains and padlock (drawn without the dark filter) jolt, then fly apart. */
.node.unlocking .chains.breaking { filter: brightness(1); animation: chains-break 1s ease-in .35s both; }
.node.unlocking .lock.breaking { filter: brightness(1.3); animation: lock-drop 1s ease-in .35s both; }
.node.unlocking::after {
  content: "";
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 160, .95), rgba(255, 170, 60, .4) 40%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  animation: unlock-flash .9s ease-out .55s both;
}
@keyframes chains-break {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  20% { transform: scale(1.06) rotate(-5deg); opacity: 1; }
  35% { transform: scale(1.04) rotate(5deg); opacity: 1; }
  100% { transform: scale(1.8) rotate(25deg); opacity: 0; }
}
@keyframes lock-drop {
  0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  30% { transform: translate(-50%, -50%) rotate(-12deg); opacity: 1; }
  100% { transform: translate(-50%, 140%) rotate(35deg); opacity: 0; }
}
@keyframes unlock-flash { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.2); } }

.map-toast {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 4;
  padding: 12px 26px;
  transform: translateX(-50%);
  background: url("img/btn_wood.png") center / 100% 100% no-repeat;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(.85rem, 1.3vw, 1.1rem);
  color: #f6d98e;
  text-shadow: 0 2px 2px #000;
  white-space: nowrap;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7));
  pointer-events: none;
}
.map-toast.show { animation: map-toast-in .25s ease-out; }
@keyframes map-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) {
  .node.shake, .map-toast.show { animation: none; }
  .node.unlocking .chains.breaking, .node.unlocking .lock.breaking { animation-duration: .01s; }
}
.node.current { animation: node-glow 1.4s ease-in-out infinite; }
@keyframes node-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 190, 80, .7)) drop-shadow(0 3px 4px rgba(0, 0, 0, .8)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 190, 80, 1)) drop-shadow(0 3px 4px rgba(0, 0, 0, .8)); }
}
.node-stars { position: absolute; left: 50%; top: 86%; display: flex; transform: translateX(-50%); }
.node-stars img { width: 38%; min-width: 12px; aspect-ratio: 1; }
.node-stars img.off { filter: grayscale(1) brightness(.45); }
.node-stars { width: 110%; justify-content: center; gap: 0; }

@media (prefers-reduced-motion: reduce) {
  .node.current { animation: none; }
  .toast.show { animation-duration: .01s; }
  #bar-fill { transition: none; }
  #bar-fill::after { animation: none; }
  .booster { transition: none; }
}

/* ==========================================================================
   Added for the platform build: the game fits a window of any size.
   The column is scaled as one piece by fitToWindow() in game.js, so wide
   windows keep the same layout. The rules below only change narrow windows.
   ========================================================================== */
body.fit { padding-block: 6px; }
.map-scroller { display: contents; }

/* The booster hint takes the Restart button's place, so the column keeps its height. */
.booster-tip:not([hidden]) ~ .actions { display: none; }

/* Very large windows: the shop and the wheel grow with the column. */
@media (min-width: 1100px) and (min-height: 1100px) {
  .shop-panel, .wheel-panel { zoom: max(1, var(--fit, 1)); }
}

/* Phones held upright */
@media (max-width: 560px) {
  /* Header: smaller buttons, so they sit beside the logo instead of on top of it. */
  .map-btn { font-size: .62rem; }
  .map-btn img { width: 40px; height: 38px; }
  .map-btn.wheel-btn { top: 48px; left: 0; }
  .wheel-btn canvas { width: 38px; height: 38px; }
  .wheel-btn .badge { top: -2px; right: 0; width: 16px; height: 16px; font-size: .62rem; }
  .sound-ctrl { gap: 5px; }
  .round { width: 32px; height: 32px; }
  .round svg { width: 18px; height: 18px; }
  .round[aria-pressed="false"]::after { width: 22px; }
  .logo { width: min(66%, 440px); }
  .booster-tip { font-size: .8rem; line-height: 1.25; }

  /* Windows over the board: as wide as the board's frame, so the text stays clear of the carved border. */
  .overlay { inset: -15% -19%; padding: 6px; }
  .overlay .card { padding: 19% 16% 14% 14%; }
  .overlay .card.compact { padding-top: 19%; padding-bottom: 15%; }
  .overlay .card h2 { font-size: 1.5rem; }
  .overlay .rewards { flex-direction: row; flex-wrap: wrap; gap: 6px; }

  /* Shop: two cards in a row. */
  .shop { padding: 8px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-title { font-size: clamp(1.6rem, 9vw, 3.4rem); }
  .shop-close { top: 10.5%; right: 15%; height: 30px; padding: 0 10px 2px; font-size: .72rem; }
  .shop-have { font-size: .8rem; }
  .item.wide { gap: 8px; }
  .item.wide .i-img { width: 44px; }
  .item.wide .i-name { font-size: .8rem; }
  .item.wide .buy { width: 78px; }

  /* Wheel: the same panel, as wide as the screen. */
  .wheel-modal { padding: 6px; }
  .wheel-panel { width: calc(100vw - 12px); padding: 17vw 13vw 12vw; }
  .wheel-stage { width: min(58vw, calc(100vh - 370px)); height: min(58vw, calc(100vh - 370px)); }
  .wheel-close { top: 13vw; right: 12vw; width: 36px; font-size: 1rem; }

  /* Map: the picture stays large enough to tap its levels and scrolls sideways along the road. */
  .map-modal { --plaque-w: 64vw; }
  .map-scroller {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--band);
    bottom: 68px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .map-scroller::-webkit-scrollbar { display: none; }
  .map-view {
    position: relative;
    left: auto;
    top: auto;
    flex: none;
    width: auto;
    height: min(100%, 572px);
    transform: none;
  }
  .map-nav { top: auto; bottom: 10px; margin-top: 0; }
  .map-nav.prev { left: 14px; }
  .map-nav.next { right: 14px; }
  .map-close-btn { top: 8px; right: 8px; }
  .map-toast { bottom: 76px; white-space: normal; width: 80vw; text-align: center; }
  .node { font-size: 17px; }
  .node.boss { font-size: 20px; }
}

/* Very small phones: icons only beside the logo. */
@media (max-width: 340px) {
  .map-btn span { display: none; }
  .map-btn.wheel-btn { top: 40px; }
  .sub { font-size: .68rem; }
  .overlay .card h2 { font-size: 1.25rem; }
}

/* PlayJazzy frames the game narrower than the phone it is on (334 px wide on a 390 px phone, 304 px on a 360 px one).
   There the lives, the timer and the coin count keep clear of their icons and plus buttons, and the window buttons keep
   their words inside them. */
@media (max-width: 360px) {
  .res { gap: 3px; padding-right: 23px; font-size: .8rem; letter-spacing: -.02em; }
  .res small { font-size: .6rem; letter-spacing: 0; }
  .overlay .ov-actions { gap: 8px; }
  .overlay .ov-actions button { min-width: 0; padding: 0 14px 3px; font-size: .95rem; letter-spacing: .02em; }
}
@media (max-width: 330px) {
  .res { padding-left: 21px; }
  .res-icon { left: -9px; width: 33px; height: 33px; }
}
