/* Pear Presser — interface styles.
   Visual language: juice-bottle stickers. Cream labels, dark leaf-ink outlines, solid offset
   shadows and chunky buttons that physically press down. */

@font-face { font-family: "Fredoka"; src: url("../assets/fonts/fredoka-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../assets/fonts/nunito-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --ink: #23341a;
  --ink-soft: #4d5f3c;
  --cream: #fff8e0;
  --paper: #f7ecc4;
  --paper-deep: #e6d69c;
  --pear: #9fdc34;
  --pear-deep: #4f9d1e;
  --juice: #ffc928;
  --juice-deep: #e08a00;
  --berry: #ff4d86;
  --berry-deep: #c41f5a;
  --sky: #3fb2ff;
  --violet: #8d5cff;
  --w-accent: #6cc832;
  --w-deep: #1f7a3a;
  --display: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --nav-h: 62px;
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* no pull-to-refresh, no double-tap zoom, no text inflation in landscape */
body {
  background: #1f7a3a; color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.35;
  overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
h2, h3 { text-wrap: balance; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--ink); }

#stage { position: fixed; top: 0; left: 0; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 0; }

/* ---------- icons (masked so they take the text colour) ---------- */
.ico { display: inline-block; width: 1em; height: 1em; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -0.12em; }
.ico-drop { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c3.8 4.8 7 8.4 7 12.2A7 7 0 0 1 12 21a7 7 0 0 1-7-6.8C5 10.400 8.2 6.800 12 2z'/%3E%3C/svg%3E"); background: linear-gradient(160deg, #fff59a 10%, #ffc928 55%, #ef8f00); }
.ico-gem { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.500 3h11l4.500 6.200L12 21.500 2 9.200z'/%3E%3C/svg%3E"); background: linear-gradient(150deg, #ffd0e2 5%, #ff4d86 50%, #b3154e); }
.ico-essence { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2.500h6v2l-1 1v4.200l5.300 8.600a2 2 0 0 1-1.700 3.200H6.400a2 2 0 0 1-1.700-3.200L10 9.700V5.500l-1-1z'/%3E%3C/svg%3E"); background: linear-gradient(160deg, #e3d4ff, #8d5cff 55%, #4a1fb8); }
.ico-ticket { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2.500 6.500h19V10a2 2 0 0 0 0 4v3.500h-19V14a2 2 0 0 0 0-4z'/%3E%3C/svg%3E"); background: linear-gradient(160deg, #ffe7a8, #ff9d2e 60%, #d95f00); }
.ico-gear { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='5' stroke-width='4.200'/%3E%3Cpath stroke-width='3.600' d='M12 2.800v2M12 19.200v2M2.800 12h2M19.200 12h2M5.500 5.500l1.400 1.400M17.100 17.100l1.400 1.400M5.500 18.500l1.400-1.400M17.100 6.900l1.400-1.400'/%3E%3C/g%3E%3C/svg%3E"); }
.ico-tap { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 11.500V5a2 2 0 1 1 4 0v5l5.300 1.100a2 2 0 0 1 1.600 2.300l-.8 5.100A3 3 0 0 1 16.100 21h-4.700a3 3 0 0 1-2.300-1.100L4.800 15l.9-1a2 2 0 0 1 2.700-.2z'/%3E%3C/svg%3E"); }
.ico-cog { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.800' stroke-linecap='round' d='M4.500 11a7.600 7.600 0 0 1 13.200-4M19.500 13a7.600 7.600 0 0 1-13.200 4'/%3E%3Cpath d='M19.500 2.500v6h-6zM4.500 21.500v-6h6z'/%3E%3C/svg%3E"); }
.ico-pear { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5.500c1.700 0 2.500 1.400 2.800 3 .4 1.900 3.700 3.200 3.700 7a6.500 6.500 0 0 1-13 0c0-3.800 3.300-5.100 3.700-7 .3-1.600 1.100-3 2.800-3z'/%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.800' stroke-linecap='round' d='M12 5.500c0-1.500.6-2.600 1.800-3.300'/%3E%3C/svg%3E"); }
.ico-up { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l8 8-2.300 2.300L12 7.600l-5.700 5.700L4 11zM12 10.700l8 8L17.700 21 12 15.300 6.300 21 4 18.700z'/%3E%3C/svg%3E"); }
.ico-bolt { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.500 1.500L4 13.500h6.500L9 22.500l10-12.500h-6.500z'/%3E%3C/svg%3E"); }
.ico-game { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7 6.500h10a5.500 5.500 0 0 1 5.500 5.500v1.500a4 4 0 0 1-7.600 1.800H9.100A4 4 0 0 1 1.500 13.500V12A5.500 5.500 0 0 1 7 6.500zm0 3v1.300H5.700v1.600H7v1.300h1.600v-1.300h1.300v-1.600H8.600V9.500zm9 0a1.100 1.100 0 1 0 0 2.200 1.100 1.100 0 0 0 0-2.200zm2 2.500a1.100 1.100 0 1 0 0 2.200 1.100 1.100 0 0 0 0-2.200z'/%3E%3C/svg%3E"); }
.ico-map { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M2.500 6l6.500-2.500L15 6l6.500-2.500V18L15 20.500 9 18l-6.500 2.500zM8.300 5.500v11.300h1.400V5.500zm6 2v11.300h1.400V7.500z'/%3E%3C/svg%3E"); }
.ico-book { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.200l2.900 6.300 6.900.8-5.100 4.700 1.400 6.800L12 17.400l-6.100 3.400 1.400-6.800-5.100-4.700 6.900-.8z'/%3E%3C/svg%3E"); }
.ico-x { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.200 4L12 9.800 17.800 4 20 6.200 14.200 12l5.800 5.800-2.200 2.200-5.800-5.800L6.200 20 4 17.800 9.800 12 4 6.200z'/%3E%3C/svg%3E"); }
.ico-lock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7 10V8a5 5 0 0 1 10 0v2h.500A1.500 1.500 0 0 1 19 11.500v8a1.500 1.500 0 0 1-1.500 1.500h-11A1.500 1.500 0 0 1 5 19.500v-8A1.500 1.500 0 0 1 6.500 10zm2.200 0h5.600V8a2.800 2.800 0 0 0-5.600 0z'/%3E%3C/svg%3E"); }
.ico-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.500 15.800L5 11.300l-2.300 2.300 6.800 6.800L21.300 8.600 19 6.300z'/%3E%3C/svg%3E"); }
.ico-clock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1.200 4.500h-2.400v6.200l4.800 2.900 1.200-2-3.600-2.200z'/%3E%3C/svg%3E"); }
.ico-heart { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21S3 15 3 8.800A4.800 4.800 0 0 1 12 6.500a4.800 4.800 0 0 1 9 2.300C21 15 12 21 12 21z'/%3E%3C/svg%3E"); }

/* ---------- shared pieces ---------- */
.btn {
  --b1: #c5f24f; --b2: #7cc91f; --lip: #3f7d14;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 8px 16px;
  font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink); line-height: 1.1; text-align: center;
  background: linear-gradient(180deg, var(--b1), var(--b2)); border: 2.5px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.55), inset 0 -3px 0 var(--lip);
  transition: transform .06s, box-shadow .06s, filter .15s; position: relative;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.4), inset 0 -2px 0 var(--lip); }
.btn-gold { --b1: #ffe873; --b2: #ffb81f; --lip: #c57600; }
.btn-pink { --b1: #ffa6c4; --b2: #ff4d86; --lip: #b3154e; color: #fff; text-shadow: 0 1.5px 0 var(--berry-deep); }
.btn-violet { --b1: #c9b0ff; --b2: #8d5cff; --lip: #4a1fb8; color: #fff; text-shadow: 0 1.5px 0 #3a1a8a; }
.btn-sky { --b1: #a4e2ff; --b2: #3fb2ff; --lip: #1672b8; }
.btn-ghost { --b1: #fffdf2; --b2: #f2e7bd; --lip: #cdbd82; }
.btn-danger { --b1: #ff9a8a; --b2: #f0483a; --lip: #a81a12; color: #fff; text-shadow: 0 1.5px 0 #8a140e; }
.btn-sm { min-height: 36px; padding: 5px 12px; font-size: 14px; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn.is-off { filter: saturate(.25) brightness(1.02); opacity: .62; cursor: default; }
.btn .ico { font-size: 1.05em; background: currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 12px 4px 8px;
  background: var(--cream); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink); pointer-events: auto;
}
.chip .ico { font-size: 20px; }
.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center; background: var(--cream); border: 2.5px solid var(--ink);
  border-radius: 14px; box-shadow: 0 3px 0 var(--ink); font-size: 22px; color: var(--ink); pointer-events: auto; transition: transform .06s, box-shadow .06s;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.bar { position: relative; height: 16px; background: #d9cc98; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px 0 0 999px; background: linear-gradient(180deg, #e2ff73, #86d41c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.14); transition: width .18s linear; }
.bar-shine { position: absolute; left: 6px; right: 6px; top: 2px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.55); pointer-events: none; }
.bar.bar-sm { height: 10px; border-width: 2px; }
.bar.bar-sm .bar-shine { display: none; }

.seg { display: flex; gap: 0; background: var(--paper-deep); border: 2.5px solid var(--ink); border-radius: 14px; padding: 3px; }
.seg button { flex: 1; min-height: 36px; padding: 4px 6px; border-radius: 10px; font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.seg button.is-on { background: var(--cream); color: var(--ink); box-shadow: 0 2px 0 var(--ink), 0 0 0 2px var(--ink); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-family: var(--display); font-weight: 600; font-size: 11.5px; color: #fff; background: var(--tag, #8fa3a8); border: 2px solid var(--ink); }
.muted { color: var(--ink-soft); }
.num { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- main screen ---------- */
#app { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 1; display: flex; flex-direction: column; pointer-events: none;
  padding: calc(8px + var(--sat)) calc(10px + var(--sar)) 0 calc(10px + var(--sal)); }
#hud { display: flex; flex-direction: column; gap: 8px; max-width: 520px; width: 100%; margin: 0 auto; }
#hud-low { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 520px; width: 100%; margin: 0 auto; padding-bottom: 2px; }
.juice-rates { margin-top: 0; pointer-events: auto; }
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-spacer { flex: 1; }
.chip-world { padding-left: 6px; text-align: left; min-width: 0; transition: transform .06s, box-shadow .06s; }
.chip-world:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.world-dot { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); flex: none;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--w-accent) 40%, var(--w-deep)); }
.chip-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.chip-text b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-text small { font-size: 11.5px; font-family: var(--body); font-weight: 800; color: var(--ink-soft); }

.juice-card { text-align: center; padding-top: 2px; }
.juice-amount { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 700; font-size: clamp(38px, 12.5vw, 54px); line-height: 1;
  color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.juice-amount .ico { font-size: .72em; filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(0 2.5px 0 var(--ink)) drop-shadow(1.5px 0 0 var(--ink)) drop-shadow(-1.5px 0 0 var(--ink)) drop-shadow(0 -1.5px 0 var(--ink)); }
.juice-card.bump .juice-amount { animation: bump .16s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }
.juice-label { font-family: var(--display); font-weight: 600; font-size: 12.5px; color: #fff; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; margin-top: 1px; letter-spacing: .4px; }
.juice-rates { display: inline-flex; gap: 0; margin-top: 5px; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.rate { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.rate + .rate { border-left: 2.5px solid var(--ink); }
.rate b { font-family: var(--display); font-weight: 600; font-size: 14.5px; color: var(--ink); }
.rate .ico { font-size: 14px; color: var(--pear-deep); }
.rate.is-boost b { color: #d4380d; }

.level-card { display: block; width: 100%; text-align: left; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink); padding: 6px 10px 6px; pointer-events: auto; }
.level-top { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.level-top span:last-child { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.level-reward { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 11.5px; font-weight: 800; color: var(--ink-soft); }
.level-reward span:last-child { color: var(--ink); text-align: right; display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.rw { display: inline-flex; align-items: center; gap: 3px; font-family: var(--display); font-weight: 600; white-space: nowrap; }
.rw .ico { font-size: 13px; }
.rw-emoji { font-size: 12px; }

.buffs { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; min-height: 0; }
.buff { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 6px; border-radius: 999px; border: 2px solid var(--ink); background: var(--b, #ffe873);
  font-family: var(--display); font-weight: 600; font-size: 12.5px; box-shadow: 0 2px 0 var(--ink); animation: pop .22s cubic-bezier(.3,1.6,.5,1); }
.buff b { font-variant-numeric: tabular-nums; font-weight: 600; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#pear-zone { flex: 1; min-height: 120px; position: relative; }

#banner { position: absolute; left: 0; right: 0; top: 60px; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.lvl-banner { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 18px 9px; background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
  transform-origin: center; animation: banner-in .35s cubic-bezier(.2,1.5,.4,1), banner-out .3s ease-in var(--stay, 1.9s) forwards; max-width: min(92vw, 380px); }
.lvl-banner h3 { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--pear-deep); }
.lvl-banner.is-mile { background: linear-gradient(180deg, #fff6c2, #ffd95a); }
.lvl-banner.is-mile h3 { color: #b85c00; font-size: 23px; }
.lvl-banner .rewards { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 14px; }
@keyframes banner-in { from { transform: translateY(26px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes banner-out { to { transform: translateY(-34px) scale(.92); opacity: 0; } }

#power-bar { display: flex; gap: 6px; justify-content: safe center; align-items: center; padding: 6px 8px 8px; overflow-x: auto; scrollbar-width: none; pointer-events: auto; min-height: 66px; max-width: 520px; width: 100%; margin: 0 auto; }
#power-bar::-webkit-scrollbar { display: none; }
.pwb { position: relative; flex: 0 1 50px; min-width: 38px; aspect-ratio: 1; border-radius: 50%; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  background: linear-gradient(160deg, var(--c1), var(--c2)); display: grid; place-items: center; font-size: 24px; line-height: 1; transition: transform .06s; }
.pwb:active { transform: translateY(2px) scale(.96); }
.pwb::before { content: ""; position: absolute; inset: 3px 9px auto 9px; height: 11px; border-radius: 50%; background: rgba(255,255,255,.45); pointer-events: none; }
.pwb-cd { position: absolute; inset: -1px; border-radius: 50%; background: conic-gradient(rgba(25,35,20,.74) var(--cd, 0%), transparent 0); pointer-events: none; }
.pwb-time { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); padding: 0 6px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--display); font-weight: 600; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pwb.is-ready { animation: ready 1.5s ease-in-out infinite; }
.pwb.is-active { box-shadow: 0 3px 0 var(--ink), 0 0 0 4px #fff, 0 0 18px 6px var(--c1); }
.pwb.is-active .pwb-time { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.pwb.is-cool { filter: saturate(.55); }
@keyframes ready { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.power-hint { font-family: var(--display); font-weight: 600; font-size: 13px; color: #fff; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; }

#nav { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin: 0 calc(-10px - var(--sar)) 0 calc(-10px - var(--sal)); padding: 0 max(4px, var(--sar)) var(--sab) max(4px, var(--sal));
  background: var(--cream); border-top: 3px solid var(--ink); pointer-events: auto; position: relative; z-index: 30; min-height: calc(var(--nav-h) + var(--sab)); }
.nav-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); padding: 6px 0 5px;
  font-family: var(--display); font-weight: 600; font-size: 10px; color: var(--ink-soft); letter-spacing: -.2px; min-width: 0; }
.nav-btn .ico { font-size: 24px; transition: transform .15s cubic-bezier(.3,1.7,.5,1); }
.nav-btn.is-active { color: var(--ink); }
.nav-btn.is-active .ico { transform: translateY(-3px) scale(1.14); color: var(--pear-deep); }
.nav-btn.is-active::before { content: ""; position: absolute; top: -3px; left: 18%; right: 18%; height: 5px; border-radius: 0 0 6px 6px; background: var(--pear-deep); }
.badge { position: absolute; top: 4px; right: max(1px, calc(50% - 27px)); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--berry); border: 2px solid var(--ink); color: #fff;
  font-style: normal; font-size: 10px; line-height: 13px; text-align: center; font-family: var(--display); font-weight: 600; }
.badge:empty { min-width: 12px; width: 12px; height: 12px; padding: 0; }

/* ---------- panels ---------- */
.panel { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--nav-h) + var(--sab) + 3px); z-index: 20; display: flex; flex-direction: column;
  background-color: var(--paper); background-image: radial-gradient(rgba(35,52,26,.07) 1.2px, transparent 1.3px); background-size: 16px 16px;
  animation: panel-in .2s cubic-bezier(.2,.9,.3,1); }
@keyframes panel-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + var(--sat)) calc(14px + var(--sar)) 10px calc(14px + var(--sal));
  background: linear-gradient(180deg, var(--ph1, #b6ea4a), var(--ph2, #7cc91f)); border-bottom: 3px solid var(--ink); }
.panel-head h2 { font-family: var(--display); font-weight: 700; font-size: 27px; color: #fff; -webkit-text-stroke: 5.5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); line-height: 1.1; }
#panel-powers .panel-head { --ph1: #c7a8ff; --ph2: #8d5cff; }
#panel-games .panel-head { --ph1: #ffd27a; --ph2: #ff9d2e; }
#panel-worlds .panel-head { --ph1: #9fe0ff; --ph2: #3fb2ff; }
#panel-collection .panel-head { --ph1: #ffb4cf; --ph2: #ff5c92; }
#panel-settings .panel-head { --ph1: #e9e2c4; --ph2: #c9bd8c; }
.panel-wallet { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.panel-wallet .chip { min-height: 34px; font-size: 14.5px; padding: 2px 11px 2px 7px; box-shadow: 0 2.5px 0 var(--ink); }
.panel-tools { padding: 10px calc(12px + var(--sar)) 0 calc(12px + var(--sal)); display: flex; flex-direction: column; gap: 8px; max-width: 620px; width: 100%; margin: 0 auto; }
.panel-tools:empty { display: none; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px calc(12px + var(--sar)) 22px calc(12px + var(--sal)); display: flex; flex-direction: column; gap: 10px; }
.panel-body > * { max-width: 596px; width: 100%; margin-left: auto; margin-right: auto; flex: none; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 17px; margin-top: 6px; }
.section-note { font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }

.card { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--paper-deep), 0 4px 0 2.5px var(--ink); padding: 11px; }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; }
.stat-strip .stat { padding: 5px 6px; text-align: center; min-width: 0; }
.stat-strip .stat + .stat { border-left: 2.5px solid var(--ink); }
.stat small { display: block; font-size: 11px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.stat b { font-family: var(--display); font-weight: 600; font-size: 15.5px; white-space: nowrap; }
.tool-row { display: flex; gap: 8px; align-items: center; }
.tool-row .seg { flex: 1; }
.tool-row .seg.seg-amt { flex: 0 0 auto; }
.seg-amt button { min-width: 42px; }

/* upgrade cards */
.up-card { display: grid; grid-template-columns: 52px 1fr; gap: 4px 10px; align-items: start; position: relative; transition: transform .1s; }
.up-icon { width: 52px; height: 52px; border-radius: 15px; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 27px; line-height: 1;
  background: linear-gradient(160deg, var(--i1, #e8ffa0), var(--i2, #9fdc34)); box-shadow: inset 0 3px 0 rgba(255,255,255,.55), inset 0 -4px 0 rgba(0,0,0,.12); grid-row: span 2; }
.cat-auto .up-icon { --i1: #c8efff; --i2: #57bfff; }
.cat-crit .up-icon { --i1: #ffe3a0; --i2: #ff9d2e; }
.cat-boost .up-icon { --i1: #f3d6ff; --i2: #c07bff; }
.cat-essence .up-icon { --i1: #e3d4ff; --i2: #8d5cff; }
.up-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.up-name { font-family: var(--display); font-weight: 600; font-size: 16.5px; line-height: 1.15; }
.up-lvl { font-family: var(--display); font-weight: 600; font-size: 12.5px; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; white-space: nowrap; flex: none; }
.up-desc { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-top: 1px; }
.up-foot { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.up-eff { font-family: var(--display); font-weight: 500; font-size: 13px; line-height: 1.25; min-width: 0; }
.up-eff .arrow { color: var(--pear-deep); font-weight: 700; }
.up-eff b { font-weight: 600; }
.up-eff .next { color: #2f8a12; font-weight: 600; }
.up-buy { min-width: 112px; padding: 6px 10px; flex-direction: column; gap: 0; margin-left: auto; }
.up-buy small { font-size: 11px; font-weight: 600; font-family: var(--display); opacity: .8; line-height: 1.1; }
.up-buy .price { display: inline-flex; align-items: center; gap: 3px; font-size: 15px; white-space: nowrap; }
.up-mile { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; color: var(--ink-soft); }
.up-mile .bar { flex: 1; }
.up-mile .bar-fill { background: linear-gradient(180deg, #a7e6ff, #3fb2ff); }
.up-card.is-locked { background: #ece2bd; box-shadow: 0 4px 0 2.5px rgba(35,52,26,.4); border-style: dashed; grid-template-columns: 52px 1fr; align-items: center; }
.up-card.is-locked .up-icon { background: #d6cb9d; filter: grayscale(1); opacity: .7; }
.up-card.just-bought { animation: bought .28s cubic-bezier(.3,1.6,.5,1); }
.up-card.just-bought .up-icon { animation: spin-pop .4s ease-out; }
@keyframes bought { 0% { transform: scale(1); } 40% { transform: scale(1.035); box-shadow: 0 4px 0 var(--paper-deep), 0 4px 0 2.5px var(--ink), 0 0 0 5px rgba(159,220,52,.7); } 100% { transform: scale(1); } }
@keyframes spin-pop { 0% { transform: scale(1) rotate(0); } 50% { transform: scale(1.25) rotate(-10deg); } 100% { transform: scale(1) rotate(0); } }
.fly { position: fixed; z-index: 60; pointer-events: none; font-family: var(--display); font-weight: 700; font-size: 17px; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; animation: fly .8s ease-out forwards; }
@keyframes fly { from { transform: translateY(0) scale(.8); opacity: 1; } to { transform: translateY(-48px) scale(1.1); opacity: 0; } }

/* rebirth */
.rebirth-hero { background: linear-gradient(160deg, #2a1466, #6b2fd6 60%, #b06bff); color: #fff; border-radius: 18px; border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); padding: 14px; text-align: center; position: relative; overflow: hidden; }
.rebirth-hero h3 { font-family: var(--display); font-weight: 700; font-size: 22px; }
.rebirth-hero p { font-size: 13.5px; font-weight: 600; opacity: .92; margin-top: 4px; }
.rebirth-hero .big { font-family: var(--display); font-weight: 700; font-size: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 2px; }
.rebirth-hero .btn { margin-top: 10px; }
.keep-lose { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; margin-top: 10px; }
.keep-lose > div { background: var(--cream); color: var(--ink); border-radius: 12px; border: 2px solid var(--ink); padding: 8px 10px; font-size: 12.5px; font-weight: 700; }
.keep-lose h4 { margin: 0 0 3px; font-family: var(--display); font-weight: 600; font-size: 14px; }
.keep-lose ul { margin: 0; padding-left: 16px; }
.keep-lose .lose h4 { color: #c2330a; }
.keep-lose .keep h4 { color: #2f8a12; }

/* powers */
.pw-card { padding: 0; overflow: hidden; display: grid; grid-template-columns: 92px 1fr; }
.pw-art { position: relative; background: linear-gradient(160deg, var(--c1), var(--c2)); display: grid; place-items: center; font-size: 44px; border-right: 2.5px solid var(--ink); min-height: 132px; overflow: hidden; }
.pw-art::before { content: ""; position: absolute; inset: -40%; background: repeating-conic-gradient(rgba(255,255,255,.2) 0 12deg, transparent 12deg 30deg); animation: spin 14s linear infinite; }
.pw-art span { position: relative; filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }
@keyframes spin { to { transform: rotate(360deg); } }
.pw-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pw-pips { display: flex; gap: 3px; margin-top: 2px; }
.pw-pips i { width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--ink); background: #e0d5a8; }
.pw-pips i.on { background: var(--c1); }
.pw-meta { display: flex; gap: 10px; font-size: 12px; font-weight: 800; color: var(--ink-soft); flex-wrap: wrap; }
.pw-meta .ico { font-size: 12px; margin-right: 2px; }
.pw-actions { display: flex; gap: 7px; margin-top: 3px; flex-wrap: wrap; }
.pw-actions .btn { flex: 1 1 108px; }
.pw-card.is-locked { filter: saturate(.3); }
.pw-card.is-locked .pw-art::before { animation: none; }
.pw-card.is-active { box-shadow: 0 4px 0 var(--paper-deep), 0 4px 0 2.5px var(--ink), 0 0 0 5px var(--c1); }

/* arcade */
.ticket-card { display: flex; align-items: center; gap: 12px; background: linear-gradient(160deg, #fff3c2, #ffd27a); }
.ticket-card .big-ico { font-size: 44px; }
.ticket-card .grow { flex: 1; min-width: 0; }
.ticket-card h3 { font-family: var(--display); font-weight: 600; font-size: 18px; }
.mg-card { padding: 0; overflow: hidden; display: grid; grid-template-columns: 96px 1fr; }
.mg-art { background: linear-gradient(160deg, var(--c1), var(--c2)); display: grid; place-items: center; font-size: 46px; border-right: 2.5px solid var(--ink); position: relative; overflow: hidden; }
.mg-art::after { content: ""; position: absolute; left: -20%; right: -20%; top: -30%; height: 60%; background: rgba(255,255,255,.22); border-radius: 50%; }
.mg-art span { position: relative; z-index: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }
.mg-info { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mg-info .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* world map */
.world-card { padding: 0; overflow: hidden; }
.world-thumb { position: relative; height: 96px; border-bottom: 2.5px solid var(--ink); overflow: hidden; background: #888; }
.world-thumb canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.world-thumb .world-title { position: absolute; left: 10px; bottom: 6px; right: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.world-title h3 { font-family: var(--display); font-weight: 700; font-size: 21px; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; line-height: 1.1; }
.world-title .tag { flex: none; }
.world-main { padding: 9px 11px 11px; }
.world-nodes { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 8px; }
.node { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); background: #e6dbb0; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 11px; color: var(--ink-soft); min-width: 0; padding: 0; }
.node.mile { border-radius: 9px; background: #ffeaa0; }
.node.end { background: #ffc0d6; }
.node.done { background: var(--w, #9fdc34); color: var(--ink); }
.node.current { background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--juice); animation: pulse 1.2s ease-in-out infinite; }
.node.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,201,40,.45); } }
.world-detail { margin-top: 9px; padding: 8px 10px; border-radius: 12px; background: var(--paper); border: 2px dashed var(--ink-soft); font-size: 13px; font-weight: 700; }
.world-detail b { font-family: var(--display); font-weight: 600; }
.world-card.is-locked .world-thumb canvas { filter: grayscale(1) brightness(.55) blur(1.5px); }
.world-card.is-locked .world-main { color: var(--ink-soft); }

/* collection */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
@media (min-width: 520px) { .grid3 { grid-template-columns: repeat(4, 1fr); } }
.col-card { padding: 6px 5px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 16px; position: relative; min-width: 0;
  background: linear-gradient(180deg, #fffdf2 40%, color-mix(in srgb, var(--tag) 26%, #fff8e0)); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--tag); }
.col-card canvas { width: 100%; max-width: 96px; aspect-ratio: 1; height: auto; }
.col-card .nm { font-family: var(--display); font-weight: 600; font-size: 12.5px; line-height: 1.1; min-height: 2.2em; display: grid; place-items: center; }
.col-card.is-unknown { background: #e9dfb8; box-shadow: 0 4px 0 #bdb07c; }
.col-card.is-unknown canvas { filter: brightness(0) opacity(.28); }
.col-card.is-new::after { content: "New"; position: absolute; top: -7px; right: -5px; background: var(--berry); color: #fff; font-family: var(--display); font-weight: 600; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 2px solid var(--ink); }
.skin-card { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; }
.skin-card canvas { width: 84px; height: 84px; }
.skin-card.is-locked canvas { filter: brightness(0) opacity(.3); }
.skin-card.is-on { background: linear-gradient(160deg, #f2ffc8, #d5f58a); }
.ach-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 9px; align-items: center; padding: 8px 10px; }
.ach-ico { width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 21px; background: #e0d5a8; filter: grayscale(1); }
.ach-row.is-done .ach-ico { background: linear-gradient(160deg, #fff3a0, #ffc928); filter: none; }
.ach-row h4 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 14.5px; }
.ach-row p { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.ach-row .bar { margin-top: 4px; }
.ach-gems { font-family: var(--display); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.ach-row.is-done .ach-gems { color: #2f8a12; }
.stats-list { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: 14px; font-weight: 700; }
.stats-list b { font-family: var(--display); font-weight: 600; text-align: right; }
.progress-card { display: flex; align-items: center; gap: 12px; }
.progress-card .ring { width: 58px; height: 58px; border-radius: 50%; flex: none; border: 2.5px solid var(--ink); background: conic-gradient(var(--pear) var(--p, 0%), #e0d5a8 0); display: grid; place-items: center; }
.progress-card .ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--cream); border: 2.5px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 12px; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); }
.set-row + .set-row { border-top: 2px dashed rgba(35,52,26,.2); padding-top: 8px; margin-top: 8px; }
.set-row label, .set-row .lbl { font-family: var(--display); font-weight: 600; font-size: 15.5px; }
.set-row small { display: block; font-family: var(--body); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.switch { position: relative; width: 58px; height: 34px; flex: none; border-radius: 999px; border: 2.5px solid var(--ink); background: #d6cb9d; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 25px; height: 25px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); transition: transform .15s cubic-bezier(.3,1.6,.5,1); }
.switch[aria-checked="true"] { background: var(--pear); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 130px; height: 28px; background: transparent; margin: 0; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; border: 2.5px solid var(--ink); background: linear-gradient(90deg, var(--pear) var(--v, 50%), #d6cb9d 0); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; border: 2.5px solid var(--ink); background: linear-gradient(90deg, var(--pear) var(--v, 50%), #d6cb9d 0); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); margin-top: -9px; box-shadow: 0 2px 0 var(--ink); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); }
textarea.save-box { width: 100%; min-height: 76px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fffdf2; padding: 8px; font: 600 12px/1.3 ui-monospace, Menlo, monospace; color: var(--ink); resize: vertical; -webkit-user-select: text; user-select: text; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 120px; }

/* ---------- dialogs ---------- */
dialog.dlg { border: 3px solid var(--ink); border-radius: 24px; padding: 0; background: var(--cream); color: var(--ink); box-shadow: 0 7px 0 var(--ink); width: min(92vw, 380px); max-height: min(88vh, 640px); max-height: min(88dvh, 640px); overflow: visible; }
dialog.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .3s cubic-bezier(.2,1.4,.4,1); }
dialog.dlg:modal { overscroll-behavior: contain; }
dialog.dlg::backdrop { background: rgba(16,30,10,.66); overflow: hidden; overscroll-behavior: contain; animation: fade .2s; }
@keyframes dlg-in { from { transform: translateY(20px) scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dlg-ribbon { margin: -18px auto 0; padding: 5px 22px 6px; border-radius: 14px; border: 3px solid var(--ink); background: linear-gradient(180deg, var(--r1, #c5f24f), var(--r2, #7cc91f)); box-shadow: 0 4px 0 var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 21px; color: #fff; -webkit-text-stroke: 4.5px var(--ink); paint-order: stroke fill; text-align: center; max-width: 92%; line-height: 1.15; }
.dlg.gold .dlg-ribbon { --r1: #ffe873; --r2: #ffb81f; }
.dlg.violet .dlg-ribbon { --r1: #c9b0ff; --r2: #8d5cff; }
.dlg.pink .dlg-ribbon { --r1: #ffa6c4; --r2: #ff4d86; }
.dlg.sky .dlg-ribbon { --r1: #a4e2ff; --r2: #3fb2ff; }
.dlg.red .dlg-ribbon { --r1: #ff9a8a; --r2: #f0483a; }
.dlg-body { padding: 14px 16px 6px; overflow-y: auto; overscroll-behavior: contain; text-align: center; font-size: 14.5px; font-weight: 600; display: flex; flex-direction: column; gap: 9px; align-items: center; }
.dlg-body p { text-wrap: pretty; max-width: 34ch; }
.dlg-body .left { text-align: left; align-self: stretch; }
.dlg-actions { display: flex; gap: 9px; padding: 10px 16px 16px; }
.dlg-actions .btn { flex: 1; }
.dlg-big { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.05; display: inline-flex; align-items: center; gap: 7px; }
.reward-list { display: flex; flex-direction: column; gap: 6px; align-self: stretch; }
.reward-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 12px; background: #fffdf2; border: 2px solid var(--ink); font-family: var(--display); font-weight: 600; font-size: 15px; text-align: left; animation: slide-in .3s backwards cubic-bezier(.2,1.3,.4,1); animation-delay: calc(var(--n, 0) * 90ms + 80ms); }
.reward-item .ri { width: 30px; height: 30px; display: grid; place-items: center; font-size: 21px; flex: none; }
.reward-item .ri .ico { font-size: 24px; }
.reward-item small { display: block; font-family: var(--body); font-weight: 700; font-size: 12px; color: var(--ink-soft); }
.reward-item canvas { width: 44px; height: 44px; flex: none; }
@keyframes slide-in { from { transform: translateX(-16px); opacity: 0; } }
.dlg-thumb { align-self: stretch; height: 92px; border-radius: 14px; border: 2.5px solid var(--ink); overflow: hidden; position: relative; }
.dlg-thumb canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.dlg-art { width: 150px; height: 150px; }
.sunburst { position: relative; display: grid; place-items: center; width: 150px; height: 150px; }
.sunburst::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: repeating-conic-gradient(rgba(255,201,40,.55) 0 10deg, transparent 10deg 24deg); animation: spin 12s linear infinite; -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.sunburst > * { position: relative; }
.chest { width: 120px; height: 104px; position: relative; cursor: pointer; animation: chest-wiggle 1.1s ease-in-out infinite; }
.chest .lid, .chest .box { position: absolute; left: 0; right: 0; border: 3px solid var(--ink); background: linear-gradient(180deg, var(--ch1, #d99a4a), var(--ch2, #a8641f)); }
.chest .lid { top: 6px; height: 44px; border-radius: 44px 44px 6px 6px; transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3,1.6,.5,1); z-index: 2; }
.chest .box { bottom: 0; height: 56px; border-radius: 6px 6px 12px 12px; }
.chest .lid::after, .chest .box::after { content: ""; position: absolute; left: 50%; width: 22px; margin-left: -11px; background: var(--ch3, #ffd23d); border: 3px solid var(--ink); }
.chest .lid::after { bottom: -3px; height: 16px; border-radius: 6px 6px 0 0; }
.chest .box::after { top: -3px; height: 20px; border-radius: 0 0 8px 8px; }
.chest .glow { position: absolute; left: 10%; right: 10%; top: 30px; height: 40px; background: radial-gradient(ellipse, #fff8c2, rgba(255,216,90,0) 70%); opacity: 0; transition: opacity .3s; z-index: 1; }
.chest.is-open { animation: none; }
.chest.is-open .lid { transform: translateY(-22px) rotate(-16deg); }
.chest.is-open .glow { opacity: 1; }
.chest.rare { --ch1: #dfe7ee; --ch2: #8fa0b3; --ch3: #57bfff; }
.chest.epic { --ch1: #ffe873; --ch2: #e69a00; --ch3: #ff4d86; }
.chest.legendary { --ch1: #d9b8ff; --ch2: #7a3df0; --ch3: #ffe873; }
@keyframes chest-wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-5deg); } 80% { transform: rotate(5deg); } 90% { transform: rotate(-3deg); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(var(--sat) + 8px); left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 10px; }
.toast { display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 8px; background: var(--ink); color: #fff; border-radius: 16px; border: 2.5px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.35);
  font-family: var(--display); font-weight: 600; font-size: 14.5px; max-width: 100%; animation: toast-in .3s cubic-bezier(.2,1.4,.4,1), toast-out .3s ease-in 2.9s forwards; }
.toast .ti { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(160deg, #fff3a0, #ffc928); display: grid; place-items: center; font-size: 18px; flex: none; }
.toast canvas { width: 38px; height: 38px; flex: none; }
.toast small { display: block; font-family: var(--body); font-size: 12px; font-weight: 700; opacity: .85; }
@keyframes toast-in { from { transform: translateY(-30px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-20px); opacity: 0; } }

/* ---------- boot ---------- */
#boot { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 14px; background: linear-gradient(180deg, #7fd4ff, #d9f7c4 70%, #7bd14e); font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--ink); transition: opacity .35s; }
#boot.is-done { opacity: 0; pointer-events: none; }
.boot-pear { width: 76px; height: 96px; border-radius: 46% 46% 50% 50% / 62% 62% 40% 40%; background: radial-gradient(circle at 35% 40%, #f2ff9a, #a8dd3a 55%, #3f9a2c); border: 3px solid var(--ink); animation: boot-bounce .7s ease-in-out infinite alternate; }
@keyframes boot-bounce { from { transform: scale(1.06, .92); } to { transform: scale(.95, 1.06) translateY(-10px); } }

/* ---------- mini-games ---------- */
#mg-root { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 50; background: linear-gradient(170deg, var(--c1, #7ed957), var(--c2, #2e9e4f)); display: flex; flex-direction: column; animation: fade .2s; touch-action: none; }
.mg-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) calc(10px + var(--sar)) 8px calc(10px + var(--sal)); }
.mg-top h2 { font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; -webkit-text-stroke: 4.5px var(--ink); paint-order: stroke fill; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-stats { display: flex; gap: 7px; padding: 0 calc(10px + var(--sar)) 8px calc(10px + var(--sal)); flex-wrap: wrap; justify-content: center; }
.mg-stat { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); padding: 2px 10px 3px; text-align: center; min-width: 68px; }
.mg-stat small { display: block; font-size: 10.5px; font-weight: 800; color: var(--ink-soft); }
.mg-stat b { font-family: var(--display); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.mg-stat.warn b { color: #d4200d; }
.mg-stat.hot { background: #ffe873; }
.mg-stage { flex: 1; position: relative; min-height: 0; margin: 0 calc(8px + var(--sar)) calc(10px + var(--sab)) calc(8px + var(--sal)); border-radius: 20px; border: 3px solid var(--ink); overflow: hidden; background: rgba(255,255,255,.16); box-shadow: 0 5px 0 var(--ink); }
.mg-stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.mg-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(16,30,10,.55); overflow-y: auto; }
.mg-sheet { width: min(100%, 360px); background: var(--cream); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 14px 16px 16px; text-align: center; display: flex; flex-direction: column; gap: 9px; align-items: center; animation: dlg-in .3s cubic-bezier(.2,1.4,.4,1); }
.mg-sheet h3 { font-family: var(--display); font-weight: 700; font-size: 25px; line-height: 1.1; }
.mg-sheet ul { text-align: left; margin: 0; padding-left: 20px; font-size: 14px; font-weight: 700; display: flex; flex-direction: column; gap: 4px; align-self: stretch; }
.mg-sheet .btn-row { align-self: stretch; }
.mg-stars { display: flex; gap: 6px; font-size: 34px; }
.mg-stars span { filter: grayscale(1) opacity(.3); animation: none; }
.mg-stars span.on { filter: none; animation: pop .35s backwards cubic-bezier(.3,1.8,.5,1); animation-delay: calc(var(--n) * 160ms + 150ms); }
.mg-score { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; }
.mg-pop { position: absolute; z-index: 4; pointer-events: none; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; animation: fly .8s ease-out forwards; transform-origin: center; white-space: nowrap; }
.mg-countdown { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 110px; color: #fff; -webkit-text-stroke: 12px var(--ink); paint-order: stroke fill; pointer-events: none; }
.mg-countdown span { animation: count .7s ease-out; }
@keyframes count { from { transform: scale(2); opacity: 0; } 40% { opacity: 1; } to { transform: scale(.8); opacity: .2; } }

/* Orchard Match */
.m-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; }
.m-board { position: relative; background: rgba(35,20,60,.38); border-radius: 16px; border: 3px solid var(--ink); touch-action: none; }
.m-tile { position: absolute; left: 0; top: 0; padding: 2px; transition: transform .2s cubic-bezier(.3,1.2,.5,1), opacity .18s; will-change: transform; }
.m-tile i { display: block; width: 100%; height: 100%; border-radius: 26%; background: rgba(255,255,255,.2); background-size: 86% 86%; background-position: center; background-repeat: no-repeat; box-shadow: inset 0 0 0 2px rgba(255,255,255,.22); transition: transform .12s; }
.m-tile.sel i { transform: scale(1.12); box-shadow: inset 0 0 0 3px #fff, 0 0 12px #fff; background-color: rgba(255,255,255,.5); }
.m-tile.gone { opacity: 0; }
.m-tile.gone i { transform: scale(.2) rotate(40deg); transition: transform .18s; }
.m-tile.sp-h i::after, .m-tile.sp-v i::after, .m-tile.sp-b i::after { content: ""; position: absolute; inset: 14%; border-radius: 22%; pointer-events: none; }
.m-tile i { position: relative; }
.m-tile.sp-h i::after { background: linear-gradient(0deg, transparent 36%, rgba(255,255,255,.95) 36% 64%, transparent 64%); mix-blend-mode: screen; }
.m-tile.sp-v i::after { background: linear-gradient(90deg, transparent 36%, rgba(255,255,255,.95) 36% 64%, transparent 64%); mix-blend-mode: screen; }
.m-tile.sp-b i { box-shadow: inset 0 0 0 3px #fff, 0 0 10px 3px #ffd23d; animation: bomb-pulse .9s ease-in-out infinite; }
.m-tile.sp-r i { animation: hue 2s linear infinite; box-shadow: inset 0 0 0 3px #fff, 0 0 12px 3px #fff; }
@keyframes bomb-pulse { 50% { transform: scale(1.08); } }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.m-zap { position: absolute; background: #fff; border-radius: 999px; box-shadow: 0 0 16px 6px #fff8a8; pointer-events: none; animation: zap .32s ease-out forwards; z-index: 3; }
@keyframes zap { from { opacity: 1; } to { opacity: 0; transform: scale(1.02, 1.6); } }

/* Perfect Press */
.pp-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 12px 14px; gap: 8px; }
.pp-pear { width: min(58vw, 240px, 34vh); aspect-ratio: 1; flex: none; }
.pp-rating { font-family: var(--display); font-weight: 700; font-size: 30px; color: #fff; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; min-height: 40px; text-align: center; }
.pp-rating.show { animation: pop .3s cubic-bezier(.3,1.8,.5,1); }
.pp-meter { position: relative; width: 100%; max-width: 420px; height: 52px; border-radius: 16px; border: 3px solid var(--ink); background: linear-gradient(90deg, #ff6b5a, #ffd23d 30%, #ffd23d 70%, #ff6b5a); box-shadow: 0 4px 0 var(--ink); overflow: hidden; flex: none; }
.pp-zone { position: absolute; top: 0; bottom: 0; background: #6fdc3a; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.pp-zone::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: var(--core, 30%); transform: translateX(-50%); background: #e9ff9a; border-left: 2px dashed var(--ink); border-right: 2px dashed var(--ink); }
.pp-needle { position: absolute; top: -4px; bottom: -4px; width: 8px; margin-left: -4px; background: #fff; border: 2.5px solid var(--ink); border-radius: 5px; will-change: transform; left: 0; }
.pp-rounds { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.pp-rounds i { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--ink); background: rgba(255,255,255,.4); }
.pp-rounds i.perfect { background: #e9ff9a; box-shadow: 0 0 8px #fff; } .pp-rounds i.great { background: #6fdc3a; } .pp-rounds i.good { background: #ffd23d; } .pp-rounds i.miss { background: #ff6b5a; }
.pp-btn { width: min(72vw, 260px); min-height: 68px; font-size: 26px; border-radius: 22px; flex: none; }

/* Pear Expedition */
.ex-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 9px; padding: 10px; overflow-y: auto; }
.ex-scene { flex: none; border-radius: 16px; border: 2.5px solid var(--ink); background: var(--cream); padding: 10px 12px; text-align: center; min-height: 104px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.ex-scene .emoji { font-size: 40px; line-height: 1.1; animation: pop .35s cubic-bezier(.3,1.8,.5,1); }
.ex-scene h3 { font-family: var(--display); font-weight: 600; font-size: 18px; }
.ex-scene p { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.ex-scene .gain { font-family: var(--display); font-weight: 600; font-size: 15px; color: #2f8a12; }
.ex-scene .loss { color: #c2330a; }
.ex-path { display: flex; gap: 4px; justify-content: center; }
.ex-path i { width: 22px; height: 8px; border-radius: 6px; border: 2px solid var(--ink); background: rgba(255,255,255,.35); }
.ex-path i.on { background: #fff8a8; } .ex-path i.now { background: #fff; box-shadow: 0 0 8px #fff; }
.ex-choices { display: grid; gap: 8px; }
.ex-choice { display: grid; grid-template-columns: 50px 1fr; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 16px; border: 2.5px solid var(--ink); background: var(--cream); box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s; animation: slide-in .3s backwards; animation-delay: calc(var(--n) * 70ms); }
.ex-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ex-choice .em { width: 50px; height: 50px; border-radius: 14px; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 26px; background: linear-gradient(160deg, var(--e1, #e8ffa0), var(--e2, #9fdc34)); }
.ex-choice h4 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 15.5px; }
.ex-choice p { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.ex-choice .risk { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: 1px; }
.ex-choice .risk i { width: 8px; height: 8px; border-radius: 50%; background: #d6cb9d; border: 1.5px solid var(--ink); }
.ex-choice .risk i.on { background: #f0483a; }
.ex-choice.safe { --e1: #dfffb0; --e2: #8fd62a; } .ex-choice.mid { --e1: #ffeaa0; --e2: #ffb81f; } .ex-choice.wild { --e1: #ffb4a8; --e2: #f0483a; } .ex-choice.home { --e1: #c8efff; --e2: #57bfff; }
.ex-bag { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ex-bag span { background: rgba(255,255,255,.9); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 9px; font-family: var(--display); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 3px; }
.ex-tap { align-self: center; width: 130px; height: 130px; border-radius: 50%; font-size: 52px; }
.ex-chests { display: flex; gap: 12px; justify-content: center; }
.ex-chests button { font-size: 46px; padding: 6px; border-radius: 16px; transition: transform .1s; }
.ex-chests button:active { transform: scale(.9); }

/* ---------- reduced effects ---------- */
.fx-low .pw-art::before, .fx-low .sunburst::before { animation: none; }
.fx-low .pwb.is-ready, .fx-low .node.current, .fx-low .chest { animation: none; }
.fx-low .panel { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .pw-art::before, .sunburst::before, .pwb.is-ready, .node.current, .boot-pear { animation: none; }
  .panel, dialog.dlg[open] { animation-duration: .01s; }
}

/* ---------- small and short screens ---------- */
@media (max-height: 1px) {
  .juice-amount { font-size: clamp(32px, 10.5vw, 44px); }
  .juice-label { display: none; }
  .level-reward { display: none; }
  #power-bar { min-height: 60px; padding-top: 2px; }
  .pwb { flex-basis: 44px; font-size: 21px; }
}
@media (max-width: 350px) {
  .nav-btn { font-size: 8.1px; letter-spacing: -.35px; }
  .nav-btn .ico { font-size: 22px; }
  .rate { padding: 3px 8px; font-size: 11.5px; }
  .up-buy { min-width: 98px; }
  .pw-card { grid-template-columns: 72px 1fr; } .mg-card { grid-template-columns: 76px 1fr; }
}
@media (min-width: 700px) {
  #nav { max-width: 560px; width: 100%; margin: 0 auto; border: 3px solid var(--ink); border-bottom: 0; border-radius: 20px 20px 0 0; }
  .panel { left: 50%; right: auto; width: 620px; transform: translateX(-50%); border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); animation: none; }
}

/* =====================================================================
   Version 2: quests, arcade lobby, Rebirth tree, livelier interface
   ===================================================================== */
.ico-quest { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7 3h11a3 3 0 0 1 3 3v1.500h-3.500V18a3 3 0 0 1-3 3H5.500a3 3 0 0 1-3-3v-1.500H5V5a2 2 0 0 1 2-2zm1.500 5v1.700h6V8zm0 3.500v1.700h6v-1.700zm0 3.500v1.700h4V15z'/%3E%3C/svg%3E"); }
.ico-joy { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a3.300 3.300 0 0 1 1.300 6.300V12.500h4.200A2.500 2.500 0 0 1 20 15v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4a2.500 2.500 0 0 1 2.500-2.500h4.200V8.300A3.300 3.300 0 0 1 12 2z'/%3E%3Ccircle cx='16.500' cy='16.800' r='1.300' fill='%23fff'/%3E%3C/svg%3E"); }

/* --- springier buttons: press down, then bounce back --- */
.btn, .icon-btn, .nav-btn, .seg button, .chip-world, .pwb, .arcade-btn, .quest-chip, .node, .col-card, .ch-head { -webkit-user-select: none; user-select: none; }
.btn { transition: transform .09s cubic-bezier(.3,1.7,.5,1), box-shadow .09s, filter .15s; }
.btn:active:not(:disabled):not(.is-off) { transform: translateY(3px) scale(.97); }
.btn::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 50% 0%, rgba(255,255,255,.55), transparent 62%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.btn:active:not(.is-off)::before { opacity: 1; transition: none; }
.btn.is-off { cursor: default; }
.seg button { transition: background .15s, color .15s, transform .09s; position: relative; }
.seg button:active { transform: scale(.94); }
.nav-btn:active .ico { transform: translateY(1px) scale(.9); }
.icon-btn:active, .chip-world:active { transform: translateY(2px) scale(.96); }
.seg-dot { position: absolute; top: -7px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--berry); border: 2px solid var(--ink); color: #fff; font-style: normal; font-size: 9.500px; line-height: 12px; font-family: var(--display); font-weight: 600; }
.chip.bump, .arcade-btn.bump, .juice-card.bump .juice-amount { animation: bump .22s ease-out; }

/* --- reward particles and edge glow --- */
.burst { position: fixed; left: -10px; top: -10px; z-index: 95; font-size: 20px; pointer-events: none; filter: drop-shadow(0 1px 0 var(--ink)); }
#edge-glow { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .4s; box-shadow: inset 0 0 46px 10px var(--glow, transparent); }
#edge-glow.on { opacity: .85; animation: edge 1.600s ease-in-out infinite; }
@keyframes edge { 50% { opacity: .5; } }
.pw-active .level-card, .pw-active .juice-rates { box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--glow), 0 0 14px 2px var(--glow); transition: box-shadow .3s; }
.pw-active .bar-fill { background: linear-gradient(180deg, #fff, var(--glow)); }
.bar-fill { position: relative; }
#level-fill::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 26px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.75)); border-radius: 0 999px 999px 0; animation: fill-glint 1.400s ease-in-out infinite; }
@keyframes fill-glint { 50% { opacity: .25; } }

/* --- Press screen: quest chip and arcade button --- */
.hud-quick { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; }
.hud-quick .arcade-btn { margin-left: auto; }
.quest-chip { position: relative; flex: 0 1 auto; min-width: 0; max-width: calc(100% - 60px); display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 7px; text-align: left; pointer-events: auto;
  background: var(--cream); border: 2.500px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); transition: transform .09s; z-index: 2; }
.quest-chip:active { transform: translateY(2px) scale(.97); }
.quest-chip .ico { font-size: 22px; color: #c2742a; }
.qc-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.100; }
.qc-text b { font-family: var(--display); font-weight: 600; font-size: 12.500px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-text small { font-size: 11px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-chip.is-ready { background: linear-gradient(180deg, #fff6c2, #ffd95a); animation: ready 1.300s ease-in-out infinite; }
.quest-chip.is-ready small { color: #a04a00; }
.arcade-btn { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; pointer-events: auto; z-index: 2; color: #fff; font-size: 24px;
  background: radial-gradient(circle at 35% 28%, #ff9ad0, #d42a8a 55%, #7a1260); border: 2.500px solid var(--ink); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.5); transition: transform .09s; }
.arcade-btn:active { transform: translateY(2px) scale(.94); }
.arcade-btn .ico { filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.arcade-btn .badge { top: -5px; right: -5px; left: auto; }
.arcade-btn.is-ready { animation: joy 2.400s ease-in-out infinite; }
.arcade-btn.is-ready::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2.500px solid #ffe873; opacity: 0; animation: joy-ring 2.400s ease-out infinite; }
.arcade-btn.is-locked { filter: saturate(.35); }
@keyframes joy { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-9deg); } 94% { transform: rotate(9deg); } }
@keyframes joy-ring { 0% { transform: scale(.85); opacity: .9; } 60%, 100% { transform: scale(1.350); opacity: 0; } }

/* --- shop: livelier cards --- */
.panel-body.slide-l > * { animation: in-l .26s backwards cubic-bezier(.2,.9,.3,1); animation-delay: calc(var(--n, 0) * 28ms); }
.panel-body.slide-r > * { animation: in-r .26s backwards cubic-bezier(.2,.9,.3,1); animation-delay: calc(var(--n, 0) * 28ms); }
@keyframes in-l { from { transform: translateX(34px); opacity: 0; } }
@keyframes in-r { from { transform: translateX(-34px); opacity: 0; } }
.up-card.is-locked { border-style: dashed; background: #ece2bd; box-shadow: 0 4px 0 2.500px rgba(35,52,26,.35); align-items: start; }
.up-card.is-locked .up-icon { filter: grayscale(1); opacity: .6; background: #d6cb9d; }
.up-card.is-locked .up-name { color: var(--ink-soft); }
.up-lvl .ico { font-size: 11px; vertical-align: -1px; }
.up-lock { margin-top: 4px; font-family: var(--display); font-weight: 600; font-size: 12.500px; color: #a04a00; display: inline-flex; gap: 4px; align-items: center; }
.up-card.is-new::after { content: "New"; position: absolute; top: -9px; right: 10px; background: var(--berry); color: #fff; font-family: var(--display); font-weight: 600; font-size: 11.500px; padding: 0 9px; border-radius: 999px; border: 2px solid var(--ink); animation: pop .3s cubic-bezier(.3,1.800,.5,1); }
.up-card.just-unlocked { animation: unlock 0.700s cubic-bezier(.2,1.400,.4,1); }
@keyframes unlock { 0% { transform: scale(.9); filter: brightness(1.800); } 60% { transform: scale(1.030); } 100% { transform: scale(1); filter: none; } }
.up-card.sparkle { overflow: visible; }
.up-card.sparkle::before { content: "✦  ✧  ✦"; position: absolute; left: 0; right: 0; top: -14px; text-align: center; font-size: 20px; color: #ffb81f; letter-spacing: 26px; animation: sparkle .7s ease-out forwards; pointer-events: none; text-shadow: 0 0 0 var(--ink); }
@keyframes sparkle { from { transform: translateY(14px) scale(.6); opacity: 1; } to { transform: translateY(-16px) scale(1.200); opacity: 0; } }
.up-stars { display: inline-flex; gap: 1px; font-size: 13px; }
.up-stars i { font-style: normal; color: #cdbd82; }
.up-stars i.on { color: #ffb81f; text-shadow: 0 1px 0 var(--ink); }

/* --- Rebirth tree --- */
.tree-note { background: linear-gradient(160deg, #f3ebff, #e0d0ff); }
.branch { display: flex; flex-direction: column; gap: 8px; }
.branch-head { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.branch-head h3 { font-family: var(--display); font-weight: 600; font-size: 17px; line-height: 1.100; }
.branch-head p { font-size: 12.500px; font-weight: 700; color: var(--ink-soft); }
.branch-ico { width: 40px; height: 40px; border-radius: 50%; border: 2.500px solid var(--ink); display: grid; place-items: center; font-size: 20px; background: linear-gradient(160deg, #e3d4ff, #8d5cff); flex: none; }
.branch-nodes { display: flex; flex-direction: column; gap: 9px; padding-left: 19px; border-left: 3px dashed #8d5cff; margin-left: 19px; }
.node-card { position: relative; }
.node-card::before { content: ""; position: absolute; left: -22px; top: 32px; width: 19px; border-top: 3px dashed #8d5cff; }
.node-card.is-cap { background: linear-gradient(160deg, #fff6d8, #ffe08a); }
.node-card.is-cap.is-owned { box-shadow: 0 4px 0 var(--paper-deep), 0 4px 0 2.500px var(--ink), 0 0 0 4px #ffc928; }
.node-card.is-locked .up-icon { filter: grayscale(1); opacity: .6; }

/* --- Quests --- */
#panel-quests .panel-head { --ph1: #ffd98a; --ph2: #f08a2e; }
.ch-head { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 7px 12px 7px 7px; border-radius: 16px; border: 2.500px solid var(--ink);
  background: linear-gradient(100deg, var(--w), var(--wd)); color: #fff; box-shadow: 0 4px 0 var(--ink); transition: transform .09s; }
.ch-head:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ch-num { width: 44px; height: 44px; border-radius: 50%; background: var(--cream); color: var(--ink); border: 2.500px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 20px; }
.ch-text { display: flex; flex-direction: column; min-width: 0; }
.ch-text b { font-family: var(--display); font-weight: 700; font-size: 17.500px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; line-height: 1.150; }
.ch-text small { font-size: 12px; font-weight: 800; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ch-state { font-size: 20px; }
.ch-head.is-locked { filter: grayscale(.9) brightness(.85); }
.ch-head.is-done .ch-num { background: #c5f24f; }
.ch-blurb { font-style: italic; padding: 0 4px; }
.q-card { display: flex; flex-direction: column; gap: 8px; position: relative; animation: card-in .28s backwards cubic-bezier(.2,.9,.3,1); animation-delay: calc(var(--n, 0) * 35ms); }
@keyframes card-in { from { transform: translateY(14px); opacity: 0; } }
.q-head { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; }
.q-facewrap { width: 54px; height: 54px; border-radius: 50%; border: 2.500px solid var(--ink); background: radial-gradient(circle at 50% 35%, #fffdf2, #e9d9a0); overflow: hidden; display: grid; place-items: center; padding: 0; flex: none; }
button.q-facewrap { transition: transform .12s cubic-bezier(.3,1.700,.5,1); }
button.q-facewrap:active { transform: scale(.9) rotate(-6deg); }
.q-face { display: block; }
.q-unknown { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--ink-soft); }
.q-title { min-width: 0; }
.q-title h4 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 16.500px; line-height: 1.150; }
.q-title small { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.q-say { text-align: left; padding: 7px 11px; border-radius: 4px 14px 14px 14px; background: #fffdf2; border: 2px solid var(--ink); font-size: 13.500px; font-weight: 700; font-style: italic; position: relative; }
.q-say small { display: block; font-style: normal; font-size: 11px; font-weight: 800; color: #a04a00; margin-top: 2px; }
.q-obj { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.q-obj li { display: grid; grid-template-columns: 22px 1fr auto; gap: 3px 8px; align-items: center; font-size: 13.500px; font-weight: 700; }
.q-check { width: 20px; height: 20px; border-radius: 6px; border: 2.500px solid var(--ink); background: #fffdf2; display: grid; place-items: center; font-size: 12px; }
.q-obj li.done .q-check { background: var(--pear); animation: pop .3s cubic-bezier(.3,1.800,.5,1); }
.q-obj li.done .q-otext { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 1.500px; }
.q-otext small { display: block; font-size: 11.500px; color: #a04a00; text-decoration: none; }
.q-num { font-family: var(--display); font-weight: 600; font-size: 12.500px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-obj .bar { grid-column: 2 / -1; }
.q-obj .bar-fill { background: linear-gradient(180deg, #ffe08a, #ff9d2e); }
.q-rew { display: flex; gap: 8px; align-items: baseline; padding-top: 7px; border-top: 2px dashed rgba(35,52,26,.2); font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.q-chips { display: flex; flex-wrap: wrap; gap: 3px 10px; color: var(--ink); font-size: 13px; }
.q-card.q-ready { background: linear-gradient(170deg, #fff8d8, #ffe690); box-shadow: 0 4px 0 var(--paper-deep), 0 4px 0 2.500px var(--ink), 0 0 0 4px #ffc928; }
.q-card.q-done { opacity: .78; padding: 7px 11px; }
.q-card.q-locked { background: #ece2bd; border-style: dashed; }
.q-card.q-locked .q-face, .q-card.q-done .q-face { filter: grayscale(.7); }
.q-lock { font-family: var(--display); font-weight: 600; font-size: 12.500px; color: #a04a00; }
.q-card.k-challenge:not(.q-done):not(.q-locked) { border-color: #a81a12; }
.q-card.k-hidden:not(.q-done) { background: linear-gradient(170deg, #f3ebff, #e0d0ff); }
.q-card.is-new::after { content: "New"; position: absolute; top: -9px; right: 10px; background: var(--berry); color: #fff; font-family: var(--display); font-weight: 600; font-size: 11.500px; padding: 0 9px; border-radius: 999px; border: 2px solid var(--ink); }
.q-claim { animation: ready 1.300s ease-in-out infinite; }
.talk { display: grid; grid-template-columns: 104px 1fr; gap: 4px 12px; align-items: center; text-align: left; align-self: stretch; }
.talk-face { grid-row: span 2; width: 104px; height: 104px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 50% 35%, #fffdf2, #e9d9a0); overflow: hidden; display: grid; place-items: center; }
.talk-face .q-face { margin-top: 0; }
.talk-who b { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.100; }
.talk-who small { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.talk-text { grid-column: 1 / -1; background: #fffdf2; border: 2.500px solid var(--ink); border-radius: 6px 16px 16px 16px; padding: 10px 12px; font-size: 15px; font-weight: 700; min-height: 78px; max-width: none !important; }
.talk-text.in { animation: card-in .22s ease-out; }
.talk-dots { grid-column: 1 / -1; display: flex; gap: 5px; justify-content: center; }
.talk-dots i { width: 8px; height: 8px; border-radius: 50%; background: #d6cb9d; border: 1.500px solid var(--ink); }
.talk-dots i.on { background: var(--juice); }
.q-done-face { width: 120px; height: 120px; display: grid; place-items: center; }

/* --- world map secrets and reveal --- */
.glint { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: none; z-index: 2; }
.glint::before { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: #fff; text-shadow: 0 0 6px #fff, 0 0 12px #ffe873; animation: glint 3.200s ease-in-out infinite; }
@keyframes glint { 0%, 70%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 80% { opacity: 1; transform: scale(1.100) rotate(40deg); } 90% { opacity: .5; transform: scale(.8) rotate(80deg); } }
.secret-line { display: block; margin-top: 3px; font-size: 12px; color: var(--ink); }
.world-card { animation: card-in .28s backwards cubic-bezier(.2,.9,.3,1); animation-delay: calc(var(--n, 0) * 40ms); }
.dlg-thumb.reveal canvas { animation: iris 1.100s cubic-bezier(.2,.8,.2,1) .15s backwards; }
@keyframes iris { from { clip-path: circle(0% at 50% 50%); filter: brightness(2.500); } to { clip-path: circle(80% at 50% 50%); filter: none; } }
.stamp { position: absolute; right: 8px; top: 8px; padding: 1px 10px; border-radius: 8px; border: 2.500px solid var(--ink); background: var(--berry); color: #fff; font-family: var(--display); font-weight: 700; font-size: 13px; transform: rotate(6deg); animation: stamp .4s cubic-bezier(.3,1.900,.5,1) 1s backwards; z-index: 2; }
@keyframes stamp { from { transform: rotate(6deg) scale(2.600); opacity: 0; } }

/* --- the Pear Arcade --- */
#panel-arcade { background-color: #1c0a3e; background-image: radial-gradient(rgba(255,255,255,.07) 1.200px, transparent 1.300px), linear-gradient(180deg, #2a0f5a, #12062e); background-size: 18px 18px, auto; color: #fff; z-index: 25; bottom: 0; }
#panel-arcade .panel-head { --ph1: #ff7ad0; --ph2: #b0208a; gap: 8px; }
#panel-arcade .panel-head h2 { flex: 1; }
#panel-arcade .panel-body { padding-bottom: calc(22px + var(--sab)); }
.ar-sign { align-self: center; width: auto !important; display: flex; gap: 10px; padding: 6px 18px; border-radius: 16px; border: 3px solid #ff7ad0; box-shadow: 0 0 14px #ff3df2, inset 0 0 10px rgba(255,61,242,.5); font-family: var(--display); font-weight: 700; font-size: 25px; letter-spacing: 2px; }
.ar-sign span:first-child { color: #c8ff4a; text-shadow: 0 0 10px #c8ff4a; }
.ar-sign span:last-child { color: #5ee7ff; text-shadow: 0 0 10px #5ee7ff; animation: flicker 4s linear infinite; }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: .35; } }
.ar-note { font-size: 13px; font-weight: 700; color: #d9c8ff; text-align: center; text-wrap: pretty; }
.ar-machine { display: grid; grid-template-columns: 92px 1fr; border-radius: 20px; border: 3px solid #0b0420; background: #2d1466; box-shadow: 0 5px 0 #0b0420, 0 0 0 2px var(--c1), 0 0 16px -2px var(--c1); overflow: hidden; animation: card-in .3s backwards cubic-bezier(.2,.9,.3,1); animation-delay: calc(var(--n) * 55ms); }
.ar-screen { position: relative; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, var(--c1), var(--c2) 78%); border-right: 3px solid #0b0420; min-height: 150px; overflow: hidden; }
.ar-screen::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 2px, transparent 2px 5px); }
.ar-icon { position: relative; font-size: 46px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); animation: bob 2.600s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.ar-medal { position: absolute; top: 5px; left: 6px; font-size: 22px; }
.ar-info { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ar-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ar-title h3 { font-family: var(--display); font-weight: 700; font-size: 18px; color: #fff; line-height: 1.100; }
.ar-diff { display: inline-flex; gap: 2px; flex: none; }
.ar-diff i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255,255,255,.2); transform: rotate(45deg); }
.ar-diff i.on { background: #ff5c7a; box-shadow: 0 0 6px #ff5c7a; }
.ar-info p { font-size: 13px; font-weight: 700; color: #d9c8ff; }
.ar-tiers { display: flex; flex-wrap: wrap; gap: 4px; }
.ar-tier { padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1.500px solid rgba(255,255,255,.3); font-family: var(--display); font-weight: 600; font-size: 12px; color: #fff; white-space: nowrap; }
.mg-sheet .ar-tier { background: var(--paper); border-color: var(--ink); color: var(--ink); }
.mg-sheet .ar-tiers { justify-content: center; }
.ar-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; font-weight: 800; color: #c8b8f0; }
.ar-meta b { color: #fff; }
.ar-meta .ico { font-size: 12px; }
.ar-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.ar-lockline { font-family: var(--display); font-weight: 600; font-size: 12px; color: #c8b8f0; display: inline-flex; gap: 4px; align-items: center; }
.ar-lockline.big { font-size: 15px; color: #ffe873; }
.ar-machine.is-locked { filter: saturate(.25) brightness(.8); }
.ar-machine.is-locked .ar-icon { animation: none; }
/* in-game medal track and result medal */
.mg-track { position: relative; height: 10px; margin: 0 calc(16px + var(--sar)) 14px calc(16px + var(--sal)); border-radius: 999px; background: rgba(0,0,0,.28); border: 2px solid var(--ink); }
.mg-track-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #fff, #ffe873); transition: width .2s; }
.mg-mark { position: absolute; top: -8px; transform: translateX(-50%); font-size: 15px; filter: grayscale(1) opacity(.55); transition: filter .2s, transform .25s cubic-bezier(.3,1.900,.5,1); }
.mg-mark.on { filter: none; transform: translateX(-50%) scale(1.300); }
.mg-medal { display: flex; flex-direction: column; align-items: center; font-family: var(--display); font-weight: 700; font-size: 17px; }
.mg-medal span { font-size: 56px; line-height: 1.100; animation: stamp .45s cubic-bezier(.3,1.900,.5,1) .15s backwards; }
.mg-medal.t0 span { filter: grayscale(1) opacity(.5); }
#mg-root.is-challenge { box-shadow: inset 0 0 0 5px #f0483a; }

/* --- reduced motion (setting, or the system preference) --- */
.motion-low *, .motion-low *::before, .motion-low *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
.motion-low #edge-glow { display: none; }
@media (prefers-reduced-motion: reduce) {
  .arcade-btn.is-ready, .quest-chip.is-ready, .q-claim, .ar-icon, .ar-sign span, #edge-glow.on, #level-fill::after, .glint::before { animation: none; }
  .glint::before { opacity: .8; }
}
@media (max-height: 1px) { .hud-quick { min-height: 44px; } .arcade-btn { width: 44px; height: 44px; font-size: 22px; } .quest-chip { padding: 2px 9px 2px 6px; } .quest-chip .ico { font-size: 18px; } }
@media (max-width: 350px) { .ar-machine { grid-template-columns: 70px 1fr; } .q-head { grid-template-columns: 46px 1fr auto; } .q-facewrap { width: 46px; height: 46px; } }

/* --- Bottom of the Press screen: candy-coloured bar, level card and rates (made for young players) --- */
:root { --nav-h: 78px; }
#nav { background: radial-gradient(rgba(255,255,255,.2) 1.5px, transparent 2.2px) 0 0 / 16px 16px, linear-gradient(180deg, #8de85a 0%, #48b83c 52%, #2a8f38 100%); box-shadow: inset 0 3px 0 rgba(255,255,255,.5); }
#nav .nav-btn { justify-content: flex-start; gap: 16px; padding: 16px 0 5px; color: #fff; font-size: 10.5px; letter-spacing: 0; --c1: #b8f06a; --c2: #3f9a2c; }
#nav .nav-btn > span:not(.ico) { color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; position: relative; z-index: 1; }
#nav .nav-btn .ico { font-size: 23px; color: #fff; position: relative; z-index: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.32)); transition: transform .18s cubic-bezier(.3,1.7,.5,1); }
#nav .nav-btn::before { content: ""; position: absolute; top: 6px; left: 50%; right: auto; width: 42px; height: 42px; margin-left: -21px; border-radius: 15px;
  background: radial-gradient(circle at 28% 22%, rgba(255,255,255,.85) 0 9%, rgba(255,255,255,0) 10%), linear-gradient(180deg, var(--c1), var(--c2));
  border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.55); transition: transform .18s cubic-bezier(.3,1.7,.5,1), box-shadow .18s; }
#nav .nav-btn[data-tab="press"]      { --c1: #d4ff6a; --c2: #4fae1e; }
#nav .nav-btn[data-tab="upgrades"]   { --c1: #ffd35a; --c2: #ff7a1a; }
#nav .nav-btn[data-tab="powers"]     { --c1: #d5a6ff; --c2: #7a3df0; }
#nav .nav-btn[data-tab="quests"]     { --c1: #7fdcff; --c2: #1f7fe6; }
#nav .nav-btn[data-tab="worlds"]     { --c1: #7ff0cf; --c2: #0f9f8a; }
#nav .nav-btn[data-tab="collection"] { --c1: #ffa6d2; --c2: #ec2f8c; }
#nav .nav-btn[data-tab="settings"]   { --c1: #ff9c8a; --c2: #e5383b; }
#nav .nav-btn.is-active > span:not(.ico) { color: #fff6a0; }
#nav .nav-btn.is-active .ico { transform: translateY(-5px) scale(1.16); color: #fff; }
#nav .nav-btn.is-active::before { transform: translateY(-5px) scale(1.14) rotate(-4deg); box-shadow: 0 4px 0 var(--ink), 0 0 0 3px #fff8b0, 0 0 14px 4px rgba(255,246,150,.75), inset 0 -5px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.55); animation: nav-bob 2.2s ease-in-out infinite; }
#nav .nav-btn:active::before { transform: translateY(2px) scale(.93); box-shadow: 0 1px 0 var(--ink), inset 0 -3px 0 rgba(0,0,0,.16); animation: none; }
#nav .nav-btn:active .ico { transform: translateY(2px) scale(.9); }
#nav .badge { top: 0; right: max(0px, calc(50% - 30px)); z-index: 2; background: #ff3d6e; animation: badge-hop 1.6s ease-in-out infinite; }
@keyframes nav-bob { 0%, 100% { transform: translateY(-5px) scale(1.14) rotate(-4deg); } 50% { transform: translateY(-8px) scale(1.17) rotate(4deg); } }
@keyframes badge-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-4px) scale(1.12); } 90% { transform: translateY(0); } }
@media (max-width: 350px) { #nav .nav-btn { font-size: 7.8px; letter-spacing: -.3px; } #nav .nav-btn > span:not(.ico) { -webkit-text-stroke-width: 2.4px; } #nav .nav-btn::before { width: 33px; height: 33px; margin-left: -16.5px; border-radius: 11px; top: 11px; } #nav .nav-btn .ico { font-size: 20px; margin-top: 1px; } }

.juice-rates { box-shadow: 0 3px 0 var(--ink); }
.juice-rates .rate:first-child { background: linear-gradient(180deg, #f1ffb8, #c6f06a); }
.juice-rates .rate + .rate { background: linear-gradient(180deg, #dff5ff, #a6dcff); }
.juice-rates .rate + .rate .ico { color: #1f7fe6; }
.juice-rates .rate { color: var(--ink); }
.level-card { background: linear-gradient(180deg, #fffdf2, #ffeeb0); border-radius: 18px; }
#level-title { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px 1px 7px; border-radius: 999px; border: 2px solid var(--ink); background: linear-gradient(180deg, #ffe066, #ffab1f); box-shadow: 0 2px 0 var(--ink); }
#level-title::before { content: "★"; color: #fff; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; font-size: 13px; }
#level-count { font-weight: 600; color: var(--ink) !important; }
#level-bar { height: 19px; background: #cdbf86; }
#level-fill { background: repeating-linear-gradient(-45deg, rgba(255,255,255,.3) 0 9px, rgba(255,255,255,0) 9px 18px) 0 0 / 51px 100%, linear-gradient(90deg, #7fe04a, #d8f23a 45%, #ffd23d 75%, #ff9a3d); animation: candy 1.4s linear infinite; }
@keyframes candy { to { background-position: 51px 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { #nav .nav-btn.is-active::before, #nav .badge, #level-fill { animation: none; } }
@keyframes nav-bob-sm { 0%, 100% { transform: translateY(-4px) scale(1.06) rotate(-3deg); } 50% { transform: translateY(-6px) scale(1.08) rotate(3deg); } }
@media (max-width: 350px) { #nav .nav-btn { font-size: 8.3px; } #nav .nav-btn.is-active::before { transform: translateY(-4px) scale(1.06) rotate(-3deg); animation-name: nav-bob-sm; } }

/* --- Press screen header: same candy look as the bottom bar --- */
#hud { gap: 6px; }
.chip { background: linear-gradient(180deg, #fffef4, #ffeaa0); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.8), inset 0 -3px 0 rgba(214,150,30,.22); }
.chip-world { padding: 4px 14px 4px 5px; background: linear-gradient(180deg, #e8fbff, #9fdcff); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.85), inset 0 -3px 0 rgba(30,110,200,.2); }
.world-dot { width: 30px; height: 30px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.chip-text small { color: #24567a; }
.chip-gems { background: linear-gradient(180deg, #ffe3f1, #ff9ccb); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.8), inset 0 -3px 0 rgba(200,30,110,.2); padding-right: 14px; }
.chip-gems b { color: #fff; font-size: 17px; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; }
.hud-quick { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 4px; min-height: 0; }
.hud-quick .juice-card { grid-column: 2; padding: 0; min-width: 0; }
.hud-quick .quest-chip { grid-column: 1; } .hud-quick .arcade-btn { grid-column: 3; margin: 0; }
.juice-amount { font-size: clamp(34px, 11.4vw, 50px); max-width: 100%; white-space: nowrap; }
.juice-amount.is-long { font-size: clamp(27px, 8.8vw, 40px); -webkit-text-stroke-width: 6px; }
.quick, .quick.quest-chip, .quick.arcade-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; height: auto; max-width: none; padding: 0; margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; color: #fff; pointer-events: auto; animation: none; filter: none; z-index: 2; }
.quick .tile { width: 50px; height: 50px; border-radius: 17px; display: grid; place-items: center; font-size: 27px; color: #fff; border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 28% 22%, rgba(255,255,255,.85) 0 9%, rgba(255,255,255,0) 10%), linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: 0 3px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.55); transition: transform .15s cubic-bezier(.3,1.7,.5,1); }
.quick .tile .ico { font-size: 27px; color: #fff; filter: drop-shadow(0 2px 0 rgba(0,0,0,.32)); }
.quick small { font-family: var(--display); font-weight: 600; font-size: 11px; line-height: 1; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.quick:active .tile { transform: translateY(2px) scale(.93); box-shadow: 0 1px 0 var(--ink), inset 0 -3px 0 rgba(0,0,0,.16); }
.quick.quest-chip { --c1: #7fdcff; --c2: #1f7fe6; }
.quick.arcade-btn { --c1: #ff9ad8; --c2: #c2209a; }
.quick.quest-chip.is-ready { --c1: #fff08a; --c2: #ffa01f; background: none; }
.quick.quest-chip.is-ready .tile, .quick.arcade-btn.is-ready .tile { animation: quick-hop 1.5s ease-in-out infinite; box-shadow: 0 3px 0 var(--ink), 0 0 0 3px #fff8b0, 0 0 12px 3px rgba(255,246,150,.8), inset 0 -5px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.55); }
.quick.quest-chip.is-ready small { color: #fff6a0; }
.quick.arcade-btn.is-ready::after { display: none; }
.quick.arcade-btn.is-locked .tile { filter: saturate(.3) brightness(.95); }
.quick.arcade-btn .badge { top: -6px; right: 0; left: auto; z-index: 3; background: #ff3d6e; }
@keyframes quick-hop { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-5px) rotate(-6deg); } 60% { transform: translateY(0) rotate(5deg); } }
.buffs { min-height: 27px; flex-wrap: nowrap; overflow: hidden; }
.buff { box-shadow: 0 2px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(0,0,0,.1); white-space: nowrap; }
.juice-label { font-size: 12px; margin-top: 0; }
@media (max-height: 1px) { .quick .tile { width: 44px; height: 44px; border-radius: 15px; } .quick .tile .ico { font-size: 23px; } .quick small { font-size: 10px; } .buffs { min-height: 0; } .world-dot { width: 26px; height: 26px; } }
@media (max-width: 350px) { .hud-quick { grid-template-columns: 56px minmax(0, 1fr) 56px; } .quick, .quick.quest-chip, .quick.arcade-btn { width: 56px; } }
@media (prefers-reduced-motion: reduce) { .quick .tile { animation: none !important; } }

/* rates sit under the juice counter so the combo meter below the pear stays clear */
.rates-row { display: flex; justify-content: center; margin-top: -2px; }
.rates-row .juice-rates { margin-top: 0; }
@media (max-height: 1px) { :root { --nav-h: 68px; } #nav .nav-btn { padding-top: 13px; gap: 11px; } #nav .nav-btn::before { top: 6px; } #hud { gap: 4px; } }

/* --- Short screens: scale the whole Press screen so it keeps the proportions of a tall phone --- */
.ui-scaled #app { right: auto; bottom: auto; width: calc(100% / var(--ui-s)); height: calc(100% / var(--ui-s)); transform: scale(var(--ui-s)); transform-origin: 0 0; }
.panel { bottom: calc((var(--nav-h) + 3px) * var(--ui-s, 1) + var(--sab)); }
/* a scaled screen is laid out wider than the real viewport, so undo the narrow-phone squeeze there */
@media (max-width: 350px) {
  .ui-scaled #nav .nav-btn { font-size: 10.5px; letter-spacing: 0; }
  .ui-scaled #nav .nav-btn > span:not(.ico) { -webkit-text-stroke-width: 3px; }
  .ui-scaled #nav .nav-btn::before { width: 42px; height: 42px; margin-left: -21px; border-radius: 15px; top: 6px; }
  .ui-scaled #nav .nav-btn .ico { font-size: 23px; margin-top: 0; }
  .ui-scaled #nav .nav-btn.is-active::before { transform: translateY(-5px) scale(1.14) rotate(-4deg); animation-name: nav-bob; }
  .ui-scaled .hud-quick { grid-template-columns: 64px minmax(0, 1fr) 64px; } .ui-scaled .quick, .ui-scaled .quick.quest-chip, .ui-scaled .quick.arcade-btn { width: 64px; }
  .ui-scaled .rate { padding: 3px 11px; font-size: 12.5px; }
}

/* ---------- launch QA ---------- */
/* Buff pills: when several effects run at once the row would be wider than a phone. The names fold away
   (icon and time stay) and, if even that is too wide, the row scrolls sideways instead of being cut off. */
.buff .t { display: inline-flex; align-items: center; }
.buffs.is-tight { justify-content: flex-start; justify-content: safe center; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; pointer-events: auto; -webkit-overflow-scrolling: touch; }
.buffs.is-tight::-webkit-scrollbar { display: none; }
.buffs.is-tight .bn { display: none; }
.buffs.is-tight .buff { flex: none; padding: 2px 7px 2px 5px; gap: 3px; }
/* Dialogs on browsers without <dialog> (see openModal in js/ui.js): the same sheet over a plain backdrop. */
.dlg-shade { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 119; background: rgba(16,30,10,.66); }
dialog.dlg.dlg-fallback { position: fixed; z-index: 120; left: 50%; top: 50%; right: auto; bottom: auto; margin: 0; transform: translate(-50%, -50%); animation: none; }
/* Fingers need a little more height than a mouse on the small buttons and segment tabs. */
@media (pointer: coarse) {
  .btn-sm { min-height: 40px; }
  .seg button { min-height: 40px; }
  .st-grown button { min-height: 40px; padding: 0 4px; }
}
/* A phone held sideways has room to spare left and right but very little height: the level card and the power
   buttons share one row, so the pear gets the height back and nothing sits on top of it. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023.98px) {
  #app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; column-gap: 10px; }
  #hud, #pear-zone, #nav { grid-column: 1 / -1; }
  #hud-low { grid-column: 1; grid-row: 3; justify-self: end; align-self: center; width: min(100%, 430px); max-width: none; margin: 0; padding-bottom: 6px; }
  #power-bar { grid-column: 2; grid-row: 3; justify-self: start; align-self: center; width: min(100%, 430px); max-width: none; margin: 0; justify-content: flex-start; }
  .juice-label { display: none; }
}

.install-steps { list-style: decimal; margin: 8px 0 0; padding-left: 24px; font-weight: 700; font-size: 13.5px; line-height: 1.45; }
.install-steps li { margin: 3px 0; }
