/* Roadside Revival interface. Cream paper, cherry red, teal and mustard: a roadside diner menu, not a phone app. */
:root {
  --ink: #3a1e2e; --ink-2: #6a4a58; --cream: #fff4dc; --paper: #fffaf0; --line: #ead8b8;
  --cherry: #e8434e; --cherry-d: #a8202c; --teal: #1fa6a0; --teal-d: #0f6e6a; --mustard: #ffc42e; --mustard-d: #c98a00;
  --mint: #3fcf6e; --mint-d: #1f8f48; --sky: #3d8bff; --night: #2a1a3a;
  --font-d: 'Shrikhand', 'Fredoka', system-ui, sans-serif; --font-t: 'Fredoka', system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --z: 1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-variant-ligatures: no-common-ligatures; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1a3a; color: var(--ink); font: 600 16px/1.3 var(--font-t); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#board { display: none; }
body.playing #board { display: block; }
body.playing #scene { display: none; }
#ui { position: fixed; inset: 0; pointer-events: none; zoom: var(--z); }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
svg { display: block; }

/* ------------------------------------------------------------ buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 0 18px; border-radius: 18px; font: 700 19px/1 var(--font-t); letter-spacing: 0.2px; color: #fff; background: var(--teal); box-shadow: 0 5px 0 var(--teal-d); transition: transform 90ms ease, box-shadow 90ms ease; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--teal-d); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.go { background: var(--mint); box-shadow: 0 5px 0 var(--mint-d); }
.btn.go:active { box-shadow: 0 1px 0 var(--mint-d); }
.btn.red { background: var(--cherry); box-shadow: 0 5px 0 var(--cherry-d); }
.btn.red:active { box-shadow: 0 1px 0 var(--cherry-d); }
.btn.gold { background: var(--mustard); color: #4a2a00; text-shadow: none; box-shadow: 0 5px 0 var(--mustard-d); }
.btn.gold:active { box-shadow: 0 1px 0 var(--mustard-d); }
.btn.quiet { background: #f2e2c4; color: var(--ink); text-shadow: none; box-shadow: 0 5px 0 #d8c09a; }
.btn.quiet:active { box-shadow: 0 1px 0 #d8c09a; }
.btn .sub { font-size: 14px; opacity: 0.9; font-weight: 600; }
.btn .price { margin-left: auto; display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.16); font-size: 17px; }
.btn .price svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.linkbtn { margin: 12px auto 0; display: block; padding: 8px 14px; color: var(--ink-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.stack { display: grid; gap: 14px; margin-top: 18px; }

/* ------------------------------------------------------------ pills along the top */
.topbar { position: absolute; left: 10px; right: 10px; top: calc(var(--sat) + 10px); display: flex; gap: 8px; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.pill { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 6px; border-radius: 20px; background: rgba(42, 26, 58, 0.78); color: #fff; font: 700 17px/1 var(--font-t); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pill .ic { width: 30px; height: 30px; flex: none; }
.pill .ic svg { width: 100%; height: 100%; }
.pill .plus { width: 22px; height: 22px; border-radius: 50%; background: var(--mint); color: #0a3a1a; display: grid; place-items: center; font-size: 18px; line-height: 1; margin-left: 2px; }
.pill .tm { font-size: 13px; opacity: 0.85; font-weight: 600; }
.pill.bump { animation: bump 380ms ease; }
@keyframes bump { 40% { transform: scale(1.14); } }
.spacer { flex: 1; }
.roundbtn { width: 46px; height: 46px; border-radius: 16px; background: rgba(42, 26, 58, 0.78); color: #fff; display: grid; place-items: center; position: relative; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14); }
.roundbtn svg { width: 26px; height: 26px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--cherry); color: #fff; font: 700 12px/20px var(--font-t); text-align: center; box-shadow: 0 0 0 2px #fff; }

/* ------------------------------------------------------------ home */
.home .stopname { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 62px); text-align: center; pointer-events: none; }
.home .stopname b { display: inline-block; padding: 6px 18px 8px; border-radius: 14px; background: var(--cherry); color: #fff; font: 400 24px/1 var(--font-d); box-shadow: 0 4px 0 var(--cherry-d); transform: rotate(-2deg); }
.home .stopname small { display: block; margin-top: 8px; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.home .progress { position: absolute; left: 50%; top: calc(var(--sat) + 132px); width: 200px; margin-left: -100px; height: 14px; border-radius: 8px; background: rgba(42, 26, 58, 0.6); overflow: hidden; pointer-events: none; }
.home .progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--mustard), #ffe27a); border-radius: 8px; transition: width 600ms ease; }
.side { position: absolute; right: 10px; top: calc(var(--sat) + 170px); display: grid; gap: 12px; pointer-events: none; }
.side > * { pointer-events: auto; }
.side.left { right: auto; left: 10px; }
.bottom { position: absolute; left: 14px; right: 14px; bottom: calc(var(--sab) + 18px); display: grid; grid-template-columns: 1fr 1.25fr; gap: 12px; pointer-events: none; }
.bottom > * { pointer-events: auto; }
.bottom .btn { min-height: 66px; border-radius: 22px; font-size: 21px; }
.bottom .btn .lvl { display: grid; text-align: left; line-height: 1.05; }
.bottom .btn .lvl small { font-size: 13px; opacity: 0.9; font-weight: 600; }
.bottom .tasks { position: relative; }
.bottom .tasks .star { width: 26px; height: 26px; }
.tag-hard { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 8px; background: var(--cherry); color: #fff; font-size: 12px; vertical-align: 2px; }
.tag-super { background: var(--night); }
.rosie { position: absolute; left: 8px; bottom: calc(var(--sab) + 96px); width: 112px; pointer-events: none; transition: transform 300ms ease, opacity 300ms ease; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25)); }
.rosie.away { transform: translateX(-140px); opacity: 0; }
.rosie img, .rosie svg { width: 100%; height: auto; }
.say { position: absolute; left: 112px; bottom: calc(var(--sab) + 170px); right: 20px; max-width: 280px; padding: 12px 14px; border-radius: 18px 18px 18px 4px; background: var(--paper); color: var(--ink); font-size: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); pointer-events: none; transition: opacity 250ms ease, transform 250ms ease; }
.say.hidden { display: block !important; opacity: 0; transform: translateY(8px); }

/* ------------------------------------------------------------ play */
.goalbar { position: absolute; left: 10px; right: 10px; top: calc(var(--sat) + 8px); display: flex; align-items: stretch; gap: 8px; pointer-events: none; }
.goalbar > * { pointer-events: auto; }
.goals { flex: 1; display: flex; justify-content: center; gap: 6px; padding: 8px 10px; border-radius: 20px; background: var(--paper); box-shadow: 0 4px 0 var(--line), 0 6px 16px rgba(0, 0, 0, 0.2); }
.goal { position: relative; width: 52px; display: grid; justify-items: center; gap: 2px; }
.goal img { width: 40px; height: 40px; }
.goal b { font: 700 17px/1 var(--font-t); color: var(--ink); }
.goal.done b { color: transparent; }
.goal.done::after { content: ''; position: absolute; bottom: -2px; left: 50%; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--mint) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 12.5l4 4 8-9" fill="none" stroke="white" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></svg>') center/16px no-repeat; }
.goal.bump { animation: bump 300ms ease; }
.moves { width: 76px; display: grid; place-items: center; align-content: center; border-radius: 20px; background: var(--cherry); color: #fff; box-shadow: 0 4px 0 var(--cherry-d), 0 6px 16px rgba(0, 0, 0, 0.2); }
.moves b { font: 400 30px/1 var(--font-d); }
.moves small { font-size: 12px; opacity: 0.9; margin-top: 2px; }
.moves.low { animation: throb 900ms ease infinite; }
@keyframes throb { 50% { transform: scale(1.07); } }
.pausebtn { width: 46px; border-radius: 16px; background: rgba(42, 26, 58, 0.78); color: #fff; display: grid; place-items: center; }
.pausebtn svg { width: 24px; height: 24px; }
.levelname { position: absolute; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); pointer-events: none; }
.boosters { position: absolute; left: 0; right: 0; bottom: calc(var(--sab) + 12px); display: flex; justify-content: center; gap: 14px; pointer-events: none; }
.boosters > * { pointer-events: auto; }
.bst { position: relative; width: 66px; height: 66px; border-radius: 20px; background: var(--paper); box-shadow: 0 4px 0 var(--line), 0 6px 14px rgba(0, 0, 0, 0.2); display: grid; place-items: center; }
.bst svg, .bst img { width: 40px; height: 40px; object-fit: contain; }
.prebst .bst svg, .prebst .bst img { width: 46px; height: 46px; }
.bst .n { position: absolute; right: -6px; bottom: -6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--teal); color: #fff; font: 700 14px/24px var(--font-t); text-align: center; box-shadow: 0 0 0 2px #fff; }
.bst .n.buy { background: var(--mint); font-size: 18px; }
.bst.on { background: var(--mustard); box-shadow: 0 4px 0 var(--mustard-d), 0 0 0 4px rgba(255, 255, 255, 0.8); transform: translateY(-4px); }
.aimtip { position: absolute; left: 20px; right: 20px; bottom: calc(var(--sab) + 96px); text-align: center; pointer-events: none; }
.aimtip span { display: inline-block; padding: 10px 16px; border-radius: 16px; background: rgba(42, 26, 58, 0.9); color: #fff; }
.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none; font: 400 44px/1.1 var(--font-d); color: #fff; text-shadow: 0 4px 0 var(--cherry-d), 0 8px 20px rgba(0, 0, 0, 0.35); -webkit-text-stroke: 2px var(--cherry-d); animation: bannerin 1.6s ease forwards; }
.banner small { display: block; margin-top: 8px; font: 700 18px/1.2 var(--font-t); -webkit-text-stroke: 0; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
@keyframes bannerin { 0% { transform: scale(0.4); opacity: 0; } 18% { transform: scale(1.08); opacity: 1; } 28% { transform: scale(1); } 82% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
.tutbox { position: absolute; left: 14px; right: 14px; display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
.tutbox .face { width: 76px; flex: none; }
.tutbox .face svg, .tutbox .face img { width: 100%; height: auto; }
.tutbox p { margin: 0 0 14px; padding: 12px 14px; border-radius: 18px 18px 18px 4px; background: var(--paper); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); font-size: 16px; }

/* ------------------------------------------------------------ sheets */
.scrim { position: absolute; inset: 0; z-index: 30; background: rgba(28, 12, 30, 0.6); display: grid; place-items: center; padding: calc(var(--sat) + 16px) 14px calc(var(--sab) + 16px); animation: fadein 160ms ease; }
@keyframes fadein { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-width: 400px; max-height: 100%; overflow: auto; padding: 24px 20px 22px; border-radius: 28px; background: var(--paper); box-shadow: 0 8px 0 var(--line), 0 20px 50px rgba(0, 0, 0, 0.35); text-align: center; animation: pop 260ms cubic-bezier(0.3, 1.4, 0.5, 1); scrollbar-width: none; }
.sheet::-webkit-scrollbar { display: none; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.sheet h2 { margin: 0; padding: 0 34px; font: 400 30px/1.1 var(--font-d); color: var(--cherry); text-wrap: balance; }
.sheet h3 { margin: 18px 0 0; font-size: 15px; color: var(--ink-2); font-weight: 600; }
.sheet p { margin: 10px 0 0; color: var(--ink-2); font-weight: 500; }
.sheet .close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; background: #f2e2c4; color: var(--ink-2); display: grid; place-items: center; }
.sheet .close svg { width: 18px; height: 18px; }
.sheet .face { width: 110px; margin: -8px auto 4px; }
.sheet .face svg, .sheet .face img { width: 100%; height: auto; max-height: 130px; object-fit: contain; }
.goalrow { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.goalrow .goal { width: 64px; padding: 8px 0 6px; border-radius: 16px; background: var(--cream); }
.goalrow .goal img { width: 44px; height: 44px; }
.prebst { display: flex; justify-content: center; gap: 12px; margin-top: 10px; }
.prebst .bst { width: 70px; height: 70px; }
.prebst .bst.free::before { content: 'FREE'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 8px; background: var(--cherry); color: #fff; font-size: 11px; }
.streak { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 14px; background: #ffe7b0; color: #7a4a00; font-size: 14px; }
.reward { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.reward div { display: grid; justify-items: center; gap: 4px; font: 700 22px/1 var(--font-t); }
.reward svg, .reward img { width: 46px; height: 46px; object-fit: contain; }
.tasklist { display: grid; gap: 10px; margin-top: 16px; text-align: left; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--cream); }
.task .thumb { width: 54px; height: 54px; border-radius: 14px; overflow: hidden; flex: none; background: #f0d8b0; }
.task .thumb canvas { width: 100%; height: 100%; position: static; }
.task .name { flex: 1; font-size: 16px; }
.task .btn { width: auto; min-height: 44px; padding: 0 14px; font-size: 17px; border-radius: 14px; }
.task .btn svg { width: 20px; height: 20px; }
.task.done { opacity: 0.55; }
.task.done .name { text-decoration: line-through; }
.shopgrid { display: grid; gap: 12px; margin-top: 16px; text-align: left; }
.offer { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 20px; background: var(--cream); }
.offer.hot { background: linear-gradient(135deg, #ffe7b0, #ffd0d8); box-shadow: inset 0 0 0 3px var(--mustard); }
.offer .ic { width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.offer .ic svg { width: 100%; height: 100%; }
.offer .txt { flex: 1; min-width: 0; }
.offer .txt b { display: block; font-size: 17px; }
.offer .txt small { display: block; color: var(--ink-2); font-size: 13px; font-weight: 500; margin-top: 2px; }
.offer .btn { width: auto; min-width: 86px; min-height: 46px; font-size: 16px; border-radius: 14px; padding: 0 12px; }
.offer .ribbon { position: absolute; top: -9px; left: 14px; padding: 2px 9px; border-radius: 9px; background: var(--cherry); color: #fff; font-size: 12px; }
.cal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.cal div { position: relative; padding: 10px 2px 8px; border-radius: 16px; background: var(--cream); display: grid; justify-items: center; gap: 4px; font-size: 13px; }
.cal div:last-child { grid-column: span 2; }
.cal div svg, .cal div img { width: 34px; height: 34px; object-fit: contain; }
.cal div span { margin-top: -2px; }
.cal div.got { opacity: 0.45; }
.cal div.today { background: #ffe7b0; box-shadow: inset 0 0 0 3px var(--mustard); }
.cal div small { color: var(--ink-2); }
.setrow { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.toggle { width: 54px; height: 32px; border-radius: 16px; background: #d8c8b0; position: relative; transition: background 150ms; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 150ms; }
.toggle.on { background: var(--mint); }
.toggle.on::after { transform: translateX(22px); }
.small { font-size: 12px; color: var(--ink-2); margin-top: 14px; font-weight: 500; }
.piggybig { width: 120px; margin: 0 auto; }
.piggybig svg { width: 100%; height: auto; }
.bar { height: 16px; border-radius: 9px; background: #f0dcc0; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff8ab8, #ffc0d8); }
iframe.doc { width: 100%; height: 60vh; border: 0; border-radius: 14px; background: #fff; margin-top: 10px; }

/* ------------------------------------------------------------ toast, curtain, flying things */
.toast { position: absolute; left: 50%; bottom: calc(var(--sab) + 110px); z-index: 50; max-width: 86%; padding: 12px 18px; border-radius: 16px; background: rgba(42, 26, 58, 0.94); color: #fff; text-align: center; transform: translate(-50%, 20px); opacity: 0; transition: all 220ms ease; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.curtain { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(20, 8, 24, 0.82); color: #fff; font-size: 20px; }
.fly { position: absolute; z-index: 40; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; transition: transform 620ms cubic-bezier(0.5, -0.3, 0.6, 1), opacity 620ms ease; }
.fly svg, .fly img { width: 100%; height: 100%; }
#ui > #fade { position: absolute; inset: 0; z-index: 55; background: #2a1a3a; opacity: 0; pointer-events: none; transition: opacity 260ms ease; }
#ui > #fade.on { opacity: 1; pointer-events: auto; }
#ui > .home, #ui > .play { pointer-events: none; }
#ui > .home > *, #ui > .play > * { pointer-events: auto; }
#ui > .home > .topbar, #ui > .home > .side, #ui > .home > .bottom, #ui > .play > .goalbar, #ui > .play > .boosters { pointer-events: none; }
#ui > .banner, #ui > .home .say, #ui > .home .rosie, #ui > .home .stopname, #ui > .home .progress, #ui > .play .levelname, #ui > .play .aimtip, #ui > .play .tutbox { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .banner, .sheet, .pill.bump, .moves.low { animation: none; } }

/* ------------------------------------------------------------ candy gloss: a wet highlight on everything you can press */
.btn, .moves, .bst { position: relative; }
.btn::after, .moves::after, .bst::after { content: ''; position: absolute; left: 8%; right: 8%; top: 4px; height: 40%; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.05)); pointer-events: none; }
.goals { background: linear-gradient(180deg, #ffffff 0%, #fff7e6 55%, #ffeacb 100%); border: 2px solid #fff; box-shadow: inset 0 -3px 0 rgba(234, 216, 184, 0.7), 0 4px 0 #d6b483, 0 8px 18px rgba(20, 0, 40, 0.32); }
.moves { background: radial-gradient(130% 95% at 35% 22%, #ff8a92 0%, #ec4652 52%, #b51f2c 100%); border: 2px solid rgba(255, 255, 255, 0.9); }
.moves b { text-shadow: 0 2px 0 rgba(120, 0, 20, 0.35); }
.moves::after { top: 3px; height: 30%; background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0)); }
.bst { background: linear-gradient(180deg, #ffffff 0%, #fff6e2 65%, #ffe4b8 100%); border: 2px solid #fff; box-shadow: 0 4px 0 #d6b483, 0 8px 16px rgba(20, 0, 40, 0.32); }
.sheet { background: linear-gradient(180deg, #fffefa 0%, #fff6e4 100%); border: 3px solid #fff; }
.pausebtn { background: rgba(37, 28, 90, 0.82); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), 0 6px 14px rgba(20, 0, 40, 0.3); }
