:root {
  --bg-top: #2a1d4b;
  --bg-low: #4b2a5c;
  --ink: #fff6e8;
  --ink-soft: #d9c6e6;
  --gold: #f4c35a;
  --gold-lo: #a8771f;
  --plum: #3a2560;
  --sheet: #fff7ea;
  --sheet-ink: #3d2448;
  --sheet-soft: #7d5b80;
  --accent: #f0707e;
  --accent-lo: #b23f55;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; touch-action: manipulation; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
body {
  position: fixed;
  inset: 0;
  font-family: "Baloo 2", ui-rounded, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 196, 120, 0.22), transparent 55%),
    radial-gradient(ellipse at 10% 110%, rgba(240, 112, 160, 0.18), transparent 50%),
    linear-gradient(180deg, var(--bg-top), var(--bg-low));
  -webkit-tap-highlight-color: transparent;
}
/* No text magnifier, selection or long-press callouts anywhere in the game UI (iPhone). */
.app, dialog, .toast {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.app { touch-action: manipulation; }
button { font: inherit; color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sg-corner-top) - 4px) 12px calc(var(--safe-bottom) + 8px);
  max-width: 560px;
  margin: 0 auto;
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Title screen art: the next picture in its gold frame (the screen itself is shared/mainmenu.js) */
.logo-frame {
  position: relative; height: 140px; aspect-ratio: 5 / 4; padding: 7px; border-radius: 10px;
  background: linear-gradient(150deg, #ffe29a, var(--gold) 40%, var(--gold-lo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 28px rgba(10, 0, 30, 0.45);
}
.logo-frame canvas { display: block; width: 100%; height: 100%; border-radius: 4px; image-rendering: pixelated; background: #1d1433; }
.logo-art { display: flex; align-items: flex-end; gap: 6px; }
.logo-pail { width: 40px; height: 46px; flex: none; margin-bottom: -4px; }

/* Play */
.top { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; min-height: 52px; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #3a2205;
  background: linear-gradient(160deg, #ffe39b, var(--gold)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 var(--gold-lo);
}
.icon-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 1px 0 var(--gold-lo); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.hud { display: grid; gap: 2px; justify-items: center; min-width: 0; }
.hud-level { display: flex; align-items: baseline; gap: 8px; font-size: 21px; font-weight: 800; line-height: 1.05; max-width: 100%; }
.hud-level > span:first-child { color: var(--gold); }
.hud-name { font-size: 17px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-progress { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bar { width: 110px; height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ff8f8f, #ffc861, #8ee08a, #6fd0f0, #c79bff); background-size: 130px 100%; transition: width 0.3s; }
.field { flex: 1; min-height: 0; position: relative; margin: 0 -12px; } /* edge to edge: the track's pails ride right out to the screen's sides */
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.status { position: absolute; left: 0; right: 0; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; pointer-events: none; }
.belt-count {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px 0 10px; border-radius: 999px; font-size: 20px; font-weight: 800;
  background: rgba(14, 6, 30, 0.55); box-shadow: inset 0 0 0 2px rgba(244, 195, 90, 0.55); font-variant-numeric: tabular-nums; transition: box-shadow 0.2s, background 0.2s;
}
.belt-count span { opacity: 0.6; }
.belt-count.near { box-shadow: inset 0 0 0 2px #ffb04a; }
.belt-count.full { box-shadow: inset 0 0 0 2px #ffc861; background: rgba(60, 30, 10, 0.6); }
.pail-ico {
  width: 20px; height: 20px; margin-right: 4px; opacity: 1 !important;
  background: no-repeat center / contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 7h14l-1.8 11H4.8Z' fill='%23f4c35a'/><ellipse cx='10' cy='7' rx='7' ry='2.2' fill='%23ffe9a8'/><path d='M4 6.5l1-3 2 2.3M16 6.5l-1-3-2 2.3' fill='%23f4c35a'/></svg>");
}
.slot-btn {
  pointer-events: auto; min-width: 56px; height: 44px; padding: 0 14px; border: 0; border-radius: 999px; font-size: 21px; font-weight: 800; cursor: pointer;
  color: #3a2205; background: linear-gradient(160deg, #ffe39b, var(--gold)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 var(--gold-lo);
}
.slot-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1; padding: 0 12px; }
.slot-btn .slot-plus { font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.slot-btn .slot-cost { display: inline-flex; align-items: center; color: #8a2a00; }
.slot-btn .star-ico { width: 13px; height: 13px; margin-left: 1px; }
.slot-btn small { font-size: 11px; font-weight: 800; letter-spacing: 0.02em; opacity: 0.75; margin-top: 3px; font-variant-numeric: tabular-nums; }
.sheet .lose-left { font-size: 15px; font-weight: 700; margin: 0 0 4px !important; }
#lose-text { margin-bottom: 6px; }
#lose .stack { gap: 8px; margin-top: 8px; }
.slot-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 1px 0 var(--gold-lo); }
.slot-btn:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; }
.slot-btn.nudge { animation: nudge 0.9s ease-in-out 3; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }

/* Sheets */
.sheet {
  width: min(calc(100vw - 32px), 380px); max-height: calc(100dvh - 40px); padding: 22px 20px 20px; border: 0; border-radius: 26px;
  background: var(--sheet); color: var(--sheet-ink); text-align: center;
  box-shadow: 0 0 0 5px var(--gold), 0 0 0 8px rgba(255, 255, 255, 0.85), 0 24px 50px rgba(10, 0, 30, 0.6); overflow-y: auto;
}
.sheet.wide { width: min(calc(100vw - 24px), 440px); }
.sheet::backdrop { background: rgba(15, 5, 35, 0.6); }
.sheet[open] { animation: sheet-in 0.28s cubic-bezier(0.3, 1.3, 0.5, 1); }
@keyframes sheet-in { from { transform: translateY(24px) scale(0.94); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 31px; font-weight: 800; line-height: 1.1; }
.sheet p { margin: 6px 0 12px; font-size: 17px; color: var(--sheet-soft); line-height: 1.3; }
.kicker { margin: 0 0 2px !important; font-size: 14px !important; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sheet-soft); }
.over-cat { height: 76px; margin: -8px auto 0; display: flex; justify-content: center; }
.over-cat svg { height: 100%; width: auto; }
.intro-art { height: 96px; margin: 4px auto; display: flex; justify-content: center; }
.intro-art svg { height: 100%; width: auto; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.primary, .secondary {
  min-height: 52px; padding: 0 20px; border-radius: 16px; font-size: 20px; font-weight: 800; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.primary { border: 0; color: #3a2205; background: linear-gradient(160deg, #ffe39b, var(--gold)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 4px 0 var(--gold-lo); }
.primary:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 2px 0 var(--gold-lo); }
.secondary { border: 2px solid rgba(61, 36, 72, 0.22); background: transparent; color: var(--sheet-ink); }
.win-pic { margin: 10px auto 2px; width: 200px; padding: 6px; border-radius: 8px; background: linear-gradient(150deg, #ffe29a, var(--gold) 40%, var(--gold-lo)); box-shadow: 0 6px 14px rgba(40, 10, 50, 0.3); }
.win-pic canvas { display: block; width: 100%; height: auto; border-radius: 3px; image-rendering: pixelated; }

.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 78px; }
.star {
  width: 54px; height: 54px; background: rgba(61, 36, 72, 0.14); transform: scale(0.9);
  clip-path: polygon(50% 2%, 62% 36%, 98% 38%, 69% 60%, 80% 96%, 50% 75%, 20% 96%, 31% 60%, 2% 38%, 38% 36%);
}
.star.big { width: 70px; height: 70px; }
.star.on { background: linear-gradient(160deg, #ffe58a, #ffb81f); animation: star-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) backwards; animation-delay: var(--d, 0ms); transform: scale(1); }
@keyframes star-pop { from { transform: scale(0); } }

.level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 4px; }
.lvl {
  position: relative; padding: 4px 4px 3px; display: grid; gap: 1px; justify-items: center; border: 0; border-radius: 10px; cursor: pointer;
  font-weight: 800; font-size: 14px; line-height: 1.1; color: var(--sheet-ink);
  background: linear-gradient(150deg, #ffe29a, var(--gold) 45%, var(--gold-lo)); box-shadow: 0 3px 0 rgba(120, 80, 20, 0.5);
}
.lvl canvas { width: 100%; aspect-ratio: 5 / 4; display: block; border-radius: 4px; background: #2a1d4b; image-rendering: pixelated; }
.lvl .lvl-n { position: absolute; left: 7px; top: 6px; min-width: 22px; padding: 0 5px; border-radius: 8px; font-size: 13px; background: rgba(20, 8, 40, 0.72); color: #fff; }
.lvl small { display: block; max-width: 100%; font-size: 11.5px; line-height: 1.15; color: #7a4a06; min-height: 14px; overflow-wrap: anywhere; }
.lvl small.stars { font-size: 13px; letter-spacing: 1px; }
.lvl.todo { background: linear-gradient(150deg, #fff2d1, #ead3a8); box-shadow: 0 3px 0 #c9ae7c; }
.lvl.locked { background: rgba(61, 36, 72, 0.1); box-shadow: none; cursor: default; color: rgba(61, 36, 72, 0.4); }
.lvl.locked canvas { opacity: 0.25; }
.lvl.current { outline: 3px solid var(--accent); outline-offset: 1px; }

/* The gallery's rooms (wings): a wall each; a hung picture's frame follows its best stars; a finished room has its
   picture lights on; a room of gold frames is golden. */
.wing { margin: 12px 0 0; padding: 10px 10px 12px; border-radius: 16px; background: var(--wall, #3a2a52); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -24px 30px -20px rgba(0, 0, 0, 0.35); text-align: left; }
.wing h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 2px; font-size: 19px; font-weight: 800; line-height: 1.15; color: #fff6e8; }
.wing h3 small { font-size: 13px; font-weight: 700; color: rgba(255, 246, 232, 0.78); white-space: nowrap; }
.gallery { display: block; margin: 4px 0; }
.wing .level-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 8px 0 0; gap: 12px 6px; }
.wing .lvl { padding: 3px 3px 2px; border-radius: 8px; }
.wing .lvl .lvl-n { left: 4px; top: 4px; min-width: 18px; padding: 0 4px; font-size: 12px; border-radius: 6px; }
.wing .lvl small.stars { font-size: 12px; letter-spacing: 0; }
.wing-hall { --wall: linear-gradient(180deg, #2f6268, #22494f); }
.wing-garden { --wall: linear-gradient(180deg, #57754a, #3f5836); }
.wing-portrait { --wall: linear-gradient(180deg, #74303f, #55202f); }
.wing-seaside { --wall: linear-gradient(180deg, #33558a, #243e68); }
.wing-night { --wall: linear-gradient(180deg, #2d2756, #1d1840); }
.wing-grand { --wall: linear-gradient(180deg, #5e3062, #44204a); }
.wing-parlour { --wall: linear-gradient(180deg, #7a4a32, #573222); }
.wing-seasons { --wall: linear-gradient(180deg, #7a6127, #594618); }
.wing-enchanted { --wall: linear-gradient(180deg, #2c5a37, #1d4025); }
.wing-vault { --wall: linear-gradient(180deg, #3c1b26, #241018); }
.wing-sweets { --wall: linear-gradient(180deg, #8a4562, #683049); }
.wing-aquarium { --wall: linear-gradient(180deg, #1f6a7a, #154f5c); }
.wing-observatory { --wall: linear-gradient(180deg, #232a5c, #151a40); }
.wing-tour { --wall: linear-gradient(180deg, #6a5a3a, #4d4026); }
.wing-masters { --wall: linear-gradient(180deg, #5a1e1e, #3d1212); }
.wing.closed { --wall: repeating-linear-gradient(135deg, #4b4256 0 10px, #453c50 10px 20px); }
.wing.closed h3 { color: rgba(255, 246, 232, 0.7); }
.wing .lvl small { color: rgba(255, 246, 232, 0.9); }
.wing .lvl.done small.stars { color: #ffe39b; }
.wing .lvl.todo { background: linear-gradient(150deg, #fff2d1, #ead3a8); }
.wing .lvl.todo small { color: #7a4a06; }
.wing .lvl.locked { background: rgba(255, 255, 255, 0.07); color: rgba(255, 246, 232, 0.4); }
.lvl.frame-walnut { background: linear-gradient(150deg, #a8704a, #7a4a2c 50%, #4f2e1a); box-shadow: 0 3px 0 rgba(30, 10, 0, 0.45); }
.lvl.frame-silver { background: linear-gradient(150deg, #ffffff, #c9d0dc 45%, #7f899b); box-shadow: 0 3px 0 rgba(40, 45, 60, 0.45); }
.lvl.frame-silver small.stars { color: #fff; text-shadow: 0 1px 1px rgba(20, 20, 40, 0.6); }
.lvl.frame-gold { background: linear-gradient(150deg, #ffe29a, var(--gold) 45%, var(--gold-lo)); }
.lvl.frame-gold small.stars { color: #fff6d2; text-shadow: 0 1px 1px rgba(110, 60, 0, 0.7); }
/* picture lights: a little brass lamp over each frame, and a warm pool of light below it */
.wing.lit .lvl.done::before {
  content: ""; position: absolute; left: 50%; top: -7px; width: 30px; height: 6px; margin-left: -15px; border-radius: 3px 3px 6px 6px;
  background: linear-gradient(180deg, #ffe7a8, #c18a2c); box-shadow: 0 0 0 1px rgba(60, 30, 0, 0.35);
}
.wing.lit .lvl.done::after {
  content: ""; position: absolute; inset: -2px; border-radius: 12px; pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 236, 170, 0.35), transparent 70%);
}
.wing.golden { box-shadow: inset 0 0 0 3px var(--gold), inset 0 2px 0 rgba(255, 255, 255, 0.2); }
.wing.golden h3 small { color: #ffe39b; }
.wing-note { margin: 12px 2px 0 !important; font-size: 15px !important; text-align: left; }

/* Pail looks */
.looks { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.looks-head { margin: 0; font-size: 17px; font-weight: 700; color: var(--sheet-soft); }
.looks-head b { color: var(--sheet-ink); font-weight: 800; }
.looks-pb { --pb-track: rgba(61, 36, 72, 0.12); --pb-fill: linear-gradient(90deg, #ffe39b, var(--gold) 60%, var(--gold-lo)); }
.looks-next, .looks-note { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--sheet-soft); }
.looks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0; }
.look-tile {
  appearance: none; -webkit-appearance: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px;
  padding: 8px 4px 7px; border: 0; border-radius: 16px; font: inherit; color: var(--sheet-ink); cursor: pointer;
  background: linear-gradient(180deg, #3a2a5c, #2a1d4b); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 0 rgba(40, 20, 60, 0.35);
}
.look-tile canvas { display: block; }
.look-name { font-size: 15px; font-weight: 800; color: #fff6e8; }
.look-sub { min-height: 15px; font-size: 13px; font-weight: 700; color: #ffe39b; }
.look-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--gold), 0 3px 0 rgba(40, 20, 60, 0.35); }
.look-tile.locked { cursor: default; background: rgba(61, 36, 72, 0.12); box-shadow: none; }
.look-tile.locked canvas { opacity: 0.3; filter: grayscale(1); }
.look-tile.locked .look-name { color: var(--sheet-soft); }
.look-tile.locked .look-sub { color: var(--sheet-soft); }

/* What a picture opened, on its win or stuck sheet */
.sheet-new { display: grid; gap: 6px; margin: 0 0 8px; padding: 8px 10px; border-radius: 14px; background: rgba(244, 195, 90, 0.2); text-align: left; }
.sheet-new p { display: flex; align-items: center; gap: 8px; margin: 0 !important; font-size: 15px !important; color: var(--sheet-ink) !important; }
.sheet-new .new-pail { flex: none; }
.sheet-new .use-btn {
  flex: none; margin-left: auto; min-width: 72px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; cursor: pointer;
  font: 800 15px/1 "Baloo 2", ui-rounded, sans-serif; color: #3a2205; background: linear-gradient(160deg, #ffe39b, var(--gold));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 var(--gold-lo);
}
.sheet-new .use-btn:disabled { opacity: 0.55; box-shadow: none; }

.ach-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.ach { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(61, 36, 72, 0.07); }
.ach .medal { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(61, 36, 72, 0.16); }
.ach .medal::after { content: ""; width: 22px; height: 22px; background: rgba(61, 36, 72, 0.4); clip-path: polygon(50% 2%, 62% 36%, 98% 38%, 69% 60%, 80% 96%, 50% 75%, 20% 96%, 31% 60%, 2% 38%, 38% 36%); }
.ach.got { background: rgba(244, 195, 90, 0.28); }
.ach.got .medal { background: linear-gradient(160deg, #ffe58a, #ffb81f); box-shadow: 0 2px 0 #b97c0f; }
.ach.got .medal::after { background: #fff8e0; }
.ach b { display: block; font-size: 18px; line-height: 1.1; }
.ach span { display: block; font-size: 15px; color: var(--sheet-soft); line-height: 1.25; }
.ach-text { flex: 1; min-width: 0; }

.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 14px); z-index: 60; transform: translate(-50%, -20px); width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 18px; border-radius: 16px; background: #1a0f30; color: #fff3f8; font-weight: 700; font-size: 17px; text-align: center;
  box-shadow: 0 0 0 2px rgba(244, 195, 90, 0.6), 0 10px 24px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .sheet[open], .slot-btn.nudge { animation: none; }
  .star.on { animation: none; }
  .bar i, .toast, .belt-count { transition: none; }
}
#mute-btn .cross { display: none; }
#mute-btn[aria-pressed="true"] .cross { display: block; }
#mute-btn[aria-pressed="true"] .wave { display: none; }

/* Play: the track's slots as pips, fast-forward, and color swatches on the stuck sheet */
.belt-count .pail-ico { display: none; }
.pips { display: inline-flex; align-items: center; gap: 2px; margin-left: 7px; opacity: 1 !important; }
.pips i { display: block; width: 7px; height: 13px; border-radius: 2px 2px 3px 3px; box-shadow: inset 0 0 0 1.5px rgba(244, 195, 90, 0.5); }
.pips i.on { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 245, 220, 0.35); }
.pips i.extra:not(.on) { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55); opacity: 0.8; }
.status-right { display: flex; align-items: center; gap: 8px; pointer-events: none; }
.speed-btn {
  pointer-events: auto; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 999px; font-size: 16px; font-weight: 800; cursor: pointer;
  color: #ffe9b0; background: rgba(14, 6, 30, 0.6); box-shadow: inset 0 0 0 2px rgba(244, 195, 90, 0.55); font-variant-numeric: tabular-nums;
}
.speed-btn[aria-pressed="true"] { color: #3a2205; background: linear-gradient(160deg, #ffe39b, var(--gold)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5); }
.speed-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.intro-line { display: block; }
.intro-line + .intro-line { margin-top: 6px; }
.sheet-ach { margin: 2px 0 10px; font-weight: 800; color: #b26a00; }
.sheet-ach::before { content: "★ "; }
.chip { display: inline-block; width: 0.8em; height: 0.8em; margin: 0 3px 0 1px; border-radius: 50%; vertical-align: -0.05em; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }

/* Play: the stars this picture is worth right now (3, locked in until a slot is added) */
.star-ico, .hud-stars i {
  display: inline-block; flex: none;
  background: no-repeat center / contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2.2l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.1l-5.9 3.2 1.3-6.6-4.9-4.6 6.6-.8Z' fill='%23b45a00'/></svg>");
}
.hud-stars { display: inline-flex; align-items: center; gap: 1px; margin-left: 2px; }
.hud-stars i {
  width: 18px; height: 18px; opacity: 0.28; filter: grayscale(1);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2.2l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.1l-5.9 3.2 1.3-6.6-4.9-4.6 6.6-.8Z' fill='%23ffd257' stroke='%237a4200' stroke-width='1.4' stroke-linejoin='round'/></svg>");
}
.hud-stars i.on { opacity: 1; filter: none; }
.hud-stars i.lost { animation: star-lost 0.9s ease-out; }
@keyframes star-lost { 0% { transform: scale(1.5); opacity: 1; filter: none; } 40% { transform: scale(1.2) rotate(-25deg); opacity: 1; filter: none; } 100% { transform: none; } }
.win-why { margin: 2px 0 4px; font-weight: 800; color: #b26a00; }
@media (prefers-reduced-motion: reduce) { .hud-stars i.lost { animation: none; } }

/* ---------- the shared menus (shared/mainmenu.js): colors only, through the --sg-* variables ---------- */
#mm {
  --sg-bg: radial-gradient(ellipse at 50% -10%, rgba(255, 196, 120, 0.22), transparent 55%), radial-gradient(ellipse at 10% 110%, rgba(240, 112, 160, 0.18), transparent 50%), linear-gradient(180deg, var(--bg-top), var(--bg-low));
  --sg-ink: var(--ink); --sg-ink-soft: var(--ink-soft);
  --sg-title: #ffe29a; --sg-title-shadow: 0 3px 0 rgba(20, 6, 40, 0.6), 0 0 22px rgba(255, 158, 196, 0.45);
  --sg-accent: var(--gold); --sg-accent-ink: #3a2205;
  --sg-card: var(--sheet); --sg-card-ink: var(--sheet-ink); --sg-line: rgba(255, 226, 154, 0.5);
}
.sg-sheet { --sg-sheet-bg: var(--sheet); --sg-sheet-ink: var(--sheet-ink); --sg-accent: var(--gold); --sg-accent-ink: #3a2205; --sg-ink-soft: var(--sheet-soft); }
@media (max-width: 380px) {
  .belt-count { font-size: 18px; padding: 0 10px 0 8px; }
  .pips i { width: 6px; }
  .slot-btn { padding: 0 10px; }
}

/* The first-play hint: a finger taps a pail, the pail rides the track and takes blocks of its color */
.hint { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.hint > * { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.hint-hand { width: 40px; height: 48px; margin: -3px 0 0 -12px; filter: drop-shadow(0 3px 4px rgba(10, 0, 30, 0.55)); opacity: 0; transform-origin: 13px 3px; }
.hint-ring { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--gold); opacity: 0; }
.hint-ghost {
  width: 32px; height: 34px; border-radius: 6px 6px 10px 10px; opacity: 0; background: var(--c, var(--gold));
  box-shadow: inset 0 0 0 2.5px #fff6e8, inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 3px 8px rgba(10, 0, 30, 0.5);
}
.hint-bit { width: 9px; height: 9px; border-radius: 2px; opacity: 0; background: var(--c, var(--gold)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.hint-line {
  left: 50%; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 8px 16px; border-radius: 16px; text-align: center;
  font-size: 17px; font-weight: 700; line-height: 1.2; color: #fff3f8; background: rgba(14, 6, 30, 0.82);
  box-shadow: 0 0 0 2px rgba(244, 195, 90, 0.6), 0 8px 20px rgba(0, 0, 0, 0.4); transform: translateX(-50%);
}

.hint-ghost::before, .hint-ghost::after { content: ""; position: absolute; top: -7px; width: 0; height: 0; border-style: solid; }
.hint-ghost::before { left: 2px; border-width: 0 0 9px 8px; border-color: transparent transparent var(--c, var(--gold)) transparent; }
.hint-ghost::after { right: 2px; border-width: 0 8px 9px 0; border-color: transparent transparent var(--c, var(--gold)) transparent; }
