/* Catsle: a royal castle, chunky and glossy. Purple velvet, gold trim, cream parchment. */
:root {
  --ink: #2b1840;
  --velvet: #3a2668;
  --velvet-deep: #24164a;
  --gold: #e9b949;
  --gold-hi: #ffe28a;
  --gold-lo: #9a6416;
  --cream: #fff6e0;
  --crimson: #c8324a;
  --green: #3fae4a;
  --font: "Baloo 2", ui-rounded, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; touch-action: manipulation; }
html, body { margin: 0; height: 100%; background: var(--velvet-deep); color: var(--ink); font-family: var(--font); overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
button { font-family: var(--font); color: inherit; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[hidden] { display: none !important; }

/* ---------- the title screen's colors (shared/mainmenu.js) ---------- */
#mm, .sg-sheet {
  --sg-bg: radial-gradient(120% 70% at 50% 0%, #8a6ad0 0%, #4a2f8c 45%, #24164a 100%);
  --sg-ink: #fff6e0; --sg-ink-soft: #e6d6ff;
  --sg-title: #ffd34a; --sg-title-shadow: 0 3px 0 #9a6416, 0 6px 0 #2b1840; /* no blur: the 48px title box would clip it into a dark band */
  --sg-accent: #3fae4a; --sg-accent-ink: #2b1840;
  --sg-card: rgba(255, 246, 224, 0.95); --sg-card-ink: #2b1840; --sg-line: rgba(233, 185, 73, 0.6);
  --sg-sheet-bg: #fff6e0; --sg-sheet-ink: #2b1840;
  --sg-font: var(--font);
}
/* the sheets are cream: quiet text on them must be dark (the title screen's pale lilac vanished on cream) */
.sg-sheet { --sg-ink-soft: #6b5780; }
#mm .sg-play { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -5px 0 rgba(0, 60, 0, 0.35), 0 5px 0 #1e6a26; }
#mm .sg-btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(120, 80, 20, 0.18); }
.title-art { position: relative; width: min(340px, calc(100vw - 32px)); height: 150px; } /* a grid item: max-width 100% would not shrink it below its own 340 px */
.title-art canvas { width: 100%; height: 100%; display: block; }

/* ---------- playing ---------- */
.play { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: stretch; gap: 8px;
  padding: var(--sg-corner-top) 10px 0 var(--sg-corner-left); /* the corner's menu button (shared/menu.css) heads the row */
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud > .sg-corner-slot { align-self: flex-start; }
.hud-goals {
  flex: 1; min-width: 0; min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 4px 8px; border-radius: 18px;
  background: linear-gradient(#4f3596, #2f1d63); border: 3px solid var(--gold);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), 0 4px 0 #1c0f3a, 0 6px 14px rgba(10,0,30,0.4);
}
.goal { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.goal canvas { width: 36px; height: 36px; display: block; }
.goal b { font: 800 18px/1 var(--font); color: #fff; text-shadow: 0 2px 0 #1c0f3a, 0 0 4px #1c0f3a; margin-top: -4px; font-variant-numeric: tabular-nums; }
.goal.bump canvas { animation: bump 0.22s ease-out; }
.goal.done b { visibility: hidden; }
.goal.done::after {
  content: ''; position: absolute; right: 2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;
  border: 2px solid #fff; box-shadow: 0 2px 0 #1c0f3a;
}
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
.hud-moves {
  flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 18px 18px 30px 30px; padding-bottom: 4px;
  background: linear-gradient(#ffe28a, #e9b949 55%, #b9821e); border: 3px solid #fff3c4;
  box-shadow: inset 0 -4px 0 rgba(120,70,0,0.35), 0 4px 0 #6a420c, 0 6px 14px rgba(10,0,30,0.4);
}
.hud-moves b { font: 800 32px/1 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; }
.hud-moves small { font: 800 12px/1 var(--font); color: #5a3a08; text-transform: uppercase; letter-spacing: 0.06em; }
.hud-moves.low b { color: #c8324a; animation: pulse 0.9s ease-in-out infinite; }
.hud-moves.tick b { animation: bump 0.2s ease-out; }
/* Under the moves count: the stars a win would give now, and for how many more moves (Bri asked for this). */
.hud-moves { position: relative; }
.hud-stars {
  position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 7px 4px; white-space: nowrap;
  border-radius: 12px; background: rgba(28, 15, 58, 0.8); border: 2px solid rgba(233, 185, 73, 0.75);
}
.hud-stars[hidden] { display: none; }
.hs-row { display: flex; gap: 1px; }
.hs-row i {
  width: 15px; height: 15px; display: block;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2l2.9 6.3 6.9.7-5.2 4.6 1.5 6.8L12 17.1l-6.1 3.5 1.5-6.8L2.2 9.2l6.9-.7z' fill='%23ffd34a' stroke='%23a8640a' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.hs-row i.off { opacity: 0.3; filter: grayscale(1); }
#star-more { font: 800 11px/1 var(--font); font-style: normal; color: #fff6e0; }
#star-more:empty { display: none; }
.hud-stars.drop .hs-row { animation: bump 0.32s ease-out; }
@keyframes pulse { 50% { transform: scale(1.14); } }
.hud-level {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sg-corner-top) + 72px); z-index: 2;
  padding: 2px 14px; border-radius: 999px; background: rgba(28, 15, 58, 0.72); border: 2px solid rgba(233,185,73,0.7);
  color: #fff6e0; font: 800 14px/22px var(--font); white-space: nowrap; pointer-events: none;
}
.hud-level.hard { background: #8a1a34; border-color: #ffb0a0; }
.hud-level.super { background: linear-gradient(90deg, #4a1a6a, #d0381e); border-color: #ffd34a; }
.hud-level.rescue { background: #13303c; border-color: #9fe0ff; }
.hud-level.bonus { background: #1e6a26; border-color: #c4f5a0; }

.tip {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 14px); z-index: 3;
  display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center;
  padding: 10px 14px 8px 10px; border-radius: 20px; background: var(--cream); border: 3px solid var(--gold);
  box-shadow: 0 5px 0 var(--gold-lo), 0 10px 24px rgba(10,0,30,0.5); cursor: pointer;
  animation: rise 0.35s cubic-bezier(.2,1.4,.4,1);
}
.tip img { grid-row: 1 / 3; width: 64px; height: 64px; }
.tip p { margin: 0; font: 700 16px/1.3 var(--font); color: var(--ink); }
.tip small { font: 700 12px/1.2 var(--font); color: #8a6aa8; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- sheets ---------- */
dialog.sheet {
  width: min(360px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow: auto;
  border: 4px solid var(--gold); border-radius: 26px; padding: 20px 18px 18px;
  background: linear-gradient(#fffaf0, var(--cream)); color: var(--ink); text-align: center;
  box-shadow: 0 6px 0 var(--gold-lo), 0 16px 40px rgba(10, 0, 30, 0.6);
}
dialog.sheet::backdrop { background: rgba(20, 8, 44, 0.62); }
dialog.sheet[open] { animation: pop 0.32s cubic-bezier(.2,1.5,.4,1); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 2px 0 6px; font: 800 30px/1.1 var(--font); color: var(--velvet); }
.sheet p { margin: 0 0 10px; font: 600 16px/1.4 var(--font); }
.banner {
  margin: -6px auto 10px; width: max-content; max-width: 100%; padding: 4px 22px; border-radius: 10px;
  font: 800 18px/1.3 var(--font); color: #fff; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--crimson); box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 3px 0 #6a1020;
}
.banner.super { background: linear-gradient(90deg, #4a1a6a, #d0381e 60%, #ff9a3a); box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 3px 0 #3a0c20; }
.banner.rescue { background: #1f6f8a; box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 3px 0 #0a3040; }
.banner.bonus { background: var(--green); box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 3px 0 #1e6a26; }
.intro-cat { width: 96px; height: 96px; margin: -6px auto 0; display: block; }
.intro-goals { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.intro-goals .goal { padding: 6px 8px 4px; border-radius: 14px; background: linear-gradient(#4f3596, #2f1d63); border: 2px solid var(--gold); }
.intro-goals .goal canvas { width: 44px; height: 44px; }
.intro-moves { font-weight: 800 !important; color: #6a4fa8; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn {
  height: 54px; border: 0; border-radius: 16px; font: 800 20px/1 var(--font); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn small { font: 700 13px/1 var(--font); opacity: 0.85; }
.btn.primary { color: #1f0f33; background: linear-gradient(#7fdc7c, #5cc666 55%, #45b050); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), inset 0 -4px 0 rgba(0,60,0,0.3), 0 4px 0 #1e6a26; text-shadow: 0 1px 0 rgba(255,255,255,0.35); }
.btn.secondary { height: 48px; font-size: 17px; color: var(--velvet); background: linear-gradient(#ffffff, #f1e6ff); box-shadow: inset 0 -3px 0 rgba(90,60,140,0.18), 0 3px 0 #b9a6dc; }
.btn:active { transform: translateY(2px); }
.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 92px; margin: -4px 0 4px; }
:root {
  --star-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3.1 1.1-6.5L2.6 9.4l6.5-.9z' fill='%23d8cce8' stroke='%239a88b8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E");
  --star-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3.1 1.1-6.5L2.6 9.4l6.5-.9z' fill='%23ffd34a' stroke='%239a6416' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M8.5 8.6l2.3-.4 1.2-2.4' fill='none' stroke='white' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
/* the win: each star drops into its slot with a squash and a ring; the cat hops for each one */
.star { position: relative; width: 64px; height: 64px; background: no-repeat center/contain var(--star-off); }
.star.big { width: 86px; height: 86px; }
.star::before, .star::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.star::before { background: no-repeat center/contain var(--star-on); }
.star.on::before { animation: starLand 0.44s cubic-bezier(.3,1.3,.5,1) var(--d, 0ms) both; }
.star::after { inset: -6px; border-radius: 50%; border: 4px solid #ffd34a; }
.star.landed::after { animation: starRing 0.5s ease-out both; }
@keyframes starLand {
  0% { transform: translateY(-80px) scale(2.2) rotate(-40deg); opacity: 0; }
  55% { transform: translateY(0) scale(1.12, 0.86) rotate(0); opacity: 1; }
  78% { transform: scale(0.94, 1.08); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes starRing { from { transform: scale(0.5); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
.win-cat { display: block; width: 96px; height: 96px; margin: -18px auto -8px; transform-origin: 50% 90%; }
.win-cat.hop { animation: catHop 0.4s cubic-bezier(.3,1.5,.5,1); }
.win-cat.joy { animation: catJoy 1.1s ease-in-out infinite; }
@keyframes catHop { 0% { transform: none; } 35% { transform: translateY(-16px) scale(0.94, 1.08); } 70% { transform: translateY(0) scale(1.08, 0.92); } 100% { transform: none; } }
@keyframes catJoy { 0%, 100% { transform: rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }
.win-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 22px; z-index: 1; }
.win-confetti i { position: absolute; top: -14px; width: 8px; height: 13px; border-radius: 2px; animation: confettiFall 1.4s cubic-bezier(.35,.1,.6,1) both; }
.win-confetti i:nth-child(3n) { width: 10px; height: 10px; border-radius: 50%; }
@keyframes confettiFall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(var(--x, 0), 560px) rotate(var(--r, 180deg)); opacity: 0; } }
.sheet.skip .star.on::before { animation: none; opacity: 1; transform: none; }
.sheet.skip .win-confetti { display: none; }
/* the end of the road (the last level for now) */
.win-end { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(#fff3c8, #ffe28a); border: 2px dashed #c48a1c; color: var(--ink); }
.win-end b { font: 800 18px/1.2 var(--font); color: #6a3fb8; }
.win-end span { font: 600 14px/1.35 var(--font); color: #5a4a72; }
/* "What's this?" (pause menu) */
.whats-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.whats-list li { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: #f1e6ff; font: 600 15px/1.35 var(--font); color: var(--ink); }
.whats-list li[data-kind="peril"] { background: #dff1f6; }
.whats-list li b { display: block; font-weight: 800; font-size: 16px; }
.whats-pic { flex: none; width: 44px; height: 44px; }
.whats-goal { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: #6a3fb8; color: #fff; font: 800 12px/20px var(--font); vertical-align: 2px; }

/* ---------- full screens: the map and the throne room ---------- */
.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; background: radial-gradient(120% 70% at 50% 0%, #8a6ad0 0%, #4a2f8c 45%, #24164a 100%); color: #fff6e0; }
.screen-top { flex: none; display: flex; align-items: center; gap: 10px; padding: var(--sg-corner-top) 14px 8px var(--sg-corner-left); }
.screen-top h2 { flex: 1; margin: 0; font: 800 22px/1.1 var(--font); color: #ffd34a; text-shadow: 0 2px 0 #2b1840; text-align: center; }
.screen-top .sg-corner-slot { flex: none; }
.pill { flex: none; min-width: 64px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 246, 224, 0.95); color: var(--ink); font: 800 16px/1 var(--font); text-align: center; }
.pill::before { content: '★ '; color: #e9a400; }
.map-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 226, 138, 0.5) 0 1.5px, transparent 2.5px) 0 0 / 120px 140px,
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.35) 0 1px, transparent 2px) 0 0 / 90px 110px,
    radial-gradient(circle at 50% 50%, rgba(159, 224, 255, 0.35) 0 1.2px, transparent 2px) 30px 40px / 160px 180px;
}
.map-path { position: relative; margin: 0 auto; width: min(420px, 100%); }
.map-path svg.road { position: absolute; inset: 0; width: 100%; height: 100%; }
.node {
  position: absolute; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; border: 4px solid #fff3c4; cursor: pointer;
  display: grid; place-items: center; font: 800 24px/1 var(--font); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.35);
  background: radial-gradient(circle at 35% 30%, #9a7ae0, #5a3aa8 60%, #3a2668); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.3), 0 4px 0 #1c0f3a;
}
.node.done { background: radial-gradient(circle at 35% 30%, #ffe9a0, #e9b949 60%, #9a6416); color: var(--ink); text-shadow: none; }
.node.locked { background: radial-gradient(circle at 35% 30%, #8a8098, #5a5068 70%); border-color: #b8b0c4; color: #d8d0e4; cursor: default; }
.node.hard { border-color: #ff7a7a; }
.node.super { border-color: #ff9a3a; box-shadow: inset 0 -4px 0 rgba(0,0,0,0.3), 0 4px 0 #1c0f3a, 0 0 0 4px rgba(255, 120, 40, 0.45); }
.node.rescue { border-color: #9fe0ff; }
.node.bonus { border-color: #c4f5a0; }
.node.current { z-index: 3; animation: nodeBob 1.1s ease-in-out infinite; }
.node .tag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 8px; font: 800 11px/1.4 var(--font); letter-spacing: 0.03em; color: #fff; white-space: nowrap; text-shadow: none; }
.node.hard .tag { background: #c8324a; }
.node.super .tag { background: linear-gradient(90deg, #4a1a6a, #d0381e); }
.node.rescue .tag { background: #1f6f8a; }
.node.bonus .tag { background: #2e8a38; }
.node .st { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font: 800 14px/1 var(--font); color: #ffd34a; text-shadow: 0 1px 0 #2b1840, 0 0 3px #2b1840; letter-spacing: -1px; white-space: nowrap; }
.node .face { position: absolute; width: 50px; height: 50px; top: -44px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.node .face.high { top: -62px; }
@keyframes nodeBob { 50% { transform: translateY(-5px); } }
.castle-in { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 12px calc(var(--safe-bottom) + 16px); }
#castle-cv { display: block; width: 100%; max-width: 420px; margin: 0 auto 10px; aspect-ratio: 360 / 300; }
.castle-row { display: flex; align-items: center; gap: 10px; max-width: 420px; margin: 0 auto 4px; }
.castle-progress { flex: 1; position: relative; height: 30px; border-radius: 15px; background: rgba(20, 8, 44, 0.55); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35); overflow: hidden; }
.castle-bar { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--u, 0)); background: linear-gradient(#ffe48a, #e9b949 60%, #c48a1c); transition: transform 0.6s cubic-bezier(.2, 1.3, .4, 1); }
.castle-progress span { position: relative; display: block; text-align: center; font: 800 15px/30px var(--font); color: #fff; text-shadow: 0 1px 0 #2b1840, 0 0 3px #2b1840; }
.castle-rooms { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 14px; font: 800 15px/1 var(--font); color: var(--ink); background: rgba(255, 246, 224, 0.95); box-shadow: 0 3px 0 rgba(20, 8, 44, 0.5); cursor: pointer; }
.castle-rooms svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.castle-rooms:active { transform: translateY(2px); }
.task.next { box-shadow: 0 0 0 3px #ffd34a; }
.fly-star { position: fixed; left: 0; top: 0; z-index: 50; width: 20px; height: 20px; font: 900 20px/20px var(--font); color: #ffd34a; text-shadow: 0 0 6px #fff3b0, 0 1px 0 #8a5200; pointer-events: none; font-style: normal; }
/* the castle overview */
.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.room-card { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; background: #fff1c4; font: 600 15px/1.3 var(--font); color: var(--ink); cursor: pointer; min-height: 44px; }
.room-card canvas { flex: none; border-radius: 12px; }
.room-card b { display: block; font-weight: 800; font-size: 17px; }
.room-card small { display: block; font-size: 14px; color: #5a4a72; }
.room-card.here { box-shadow: 0 0 0 3px #e9b949; }
.room-card.locked { background: #e6dff0; cursor: default; }
.room-list-note { margin: 2px 4px 0; font: 600 14px/1.35 var(--font); color: #5a4a72; text-align: center; }
/* the level map's room sections */
.map-band { position: absolute; left: 50%; width: 100vw; transform: translateX(-50%); pointer-events: none; opacity: 0.55; }
.map-band.library { background: linear-gradient(rgba(122, 74, 58, 0) 0, rgba(122, 74, 58, 0.6) 8%, rgba(122, 74, 58, 0.6) 92%, rgba(122, 74, 58, 0)), repeating-linear-gradient(90deg, rgba(255, 220, 160, 0.08) 0 9px, rgba(60, 20, 10, 0.12) 9px 14px, rgba(160, 60, 70, 0.1) 14px 22px, rgba(40, 80, 120, 0.1) 22px 30px); }
.map-band.armory { background: linear-gradient(rgba(74, 78, 106, 0) 0, rgba(74, 78, 106, 0.75) 8%, rgba(74, 78, 106, 0.75) 92%, rgba(74, 78, 106, 0)), repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 24px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 46px); }
.map-band.throne { background: linear-gradient(rgba(90, 63, 152, 0) 0, rgba(140, 60, 160, 0.6) 8%, rgba(140, 60, 160, 0.6) 92%, rgba(90, 63, 152, 0)), repeating-linear-gradient(45deg, rgba(255, 211, 74, 0.1) 0 3px, transparent 3px 26px), repeating-linear-gradient(-45deg, rgba(255, 211, 74, 0.1) 0 3px, transparent 3px 26px); }
.map-sign { position: absolute; left: 50%; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 10px; width: min(300px, 86%); min-height: 96px; padding: 8px 12px 8px 8px; border: 3px solid #e9b949; border-radius: 18px; background: linear-gradient(#fff6e0, #f1e0b8); color: var(--ink); box-shadow: 0 5px 0 #2b1840; text-align: left; cursor: pointer; font-family: var(--font); }
.map-sign canvas { flex: none; border-radius: 10px; }
.map-sign-text { display: block; flex: 1; min-width: 0; }
.map-sign b { display: block; font: 800 19px/1.1 var(--font); color: #6a3fb8; }
.map-sign small { display: block; margin-top: 4px; font: 700 14px/1.25 var(--font); color: #5a4a72; }
.map-sign.locked { background: linear-gradient(#e8e0f0, #cfc4dc); border-color: #9a8ab8; cursor: default; }
.map-sign.locked b { color: #5a4a72; }
.map-end { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 10px; width: min(300px, 86%); padding: 10px 14px; border: 3px dashed #e9b949; border-radius: 18px; background: rgba(36, 22, 74, 0.88); color: #fff6e0; pointer-events: none; }
.map-end svg { flex: none; width: 36px; height: 36px; fill: none; stroke: #ffd34a; stroke-width: 1.8; stroke-linejoin: round; }
.map-end b { display: block; font: 800 17px/1.2 var(--font); color: #ffd34a; }
.map-end small { display: block; margin-top: 2px; font: 700 13px/1.3 var(--font); color: #e6d6ff; }
.tasks { list-style: none; margin: 0 auto; padding: 0; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 8px 6px 14px; border-radius: 16px; background: rgba(255, 246, 224, 0.95); color: var(--ink); font: 700 16px/1.2 var(--font); }
.task span { flex: 1; }
.task.done { background: rgba(255, 246, 224, 0.55); }
.task.done span::after { content: ' ✓'; color: var(--green); font-weight: 800; }
.task button { flex: none; min-width: 92px; height: 44px; padding: 0 12px; border: 0; border-radius: 12px; font: 800 16px/1 var(--font); color: #1f0f33; background: linear-gradient(#7fdc7c, #5cc666 55%, #45b050); box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 3px 0 #1e6a26; cursor: pointer; }
.task button:disabled { background: #b8b0c4; box-shadow: 0 3px 0 #8a8098; color: #f4f0f8; cursor: default; }
.task button:not(:disabled):active { transform: translateY(2px); }
.castle-note { max-width: 420px; margin: 12px auto 0; text-align: center; font: 700 15px/1.4 var(--font); color: #e6d6ff; }

.ach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ach-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: #f1e6ff; font: 600 15px/1.3 var(--font); }
.ach-list li b { display: block; font-weight: 800; }
.ach-list li.got { background: #fff1c4; }
.ach-list li i { flex: none; width: 32px; height: 32px; background: no-repeat center/contain var(--star-off); }
.ach-list li.got i { background-image: var(--star-on); }

.toast {
  position: fixed; inset: auto; margin: 0; overflow: visible;
  left: 50%; top: calc(var(--safe-top) + 10px); z-index: 20; transform: translate(-50%, -20px);
  width: max-content; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 16px; background: var(--cream); border: 3px solid var(--gold);
  color: var(--ink); font: 700 15px/1.35 var(--font); text-align: center; box-shadow: 0 4px 0 var(--gold-lo);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .node.current, .hud-moves.low b, .hud-stars.drop .hs-row { animation: none; }
  dialog.sheet[open], .tip { animation-duration: 0.01s; }
  /* the stars still arrive one by one, but fade in where they sit; the cat keeps still */
  .star.on::before { animation-name: starFade; animation-duration: 0.2s; }
  .star.landed::after, .win-cat.hop, .win-cat.joy { animation: none; }
  .win-confetti { display: none; }
}
@keyframes starFade { from { opacity: 0; } to { opacity: 1; } }
