/* Josh's Tiny Worlds — UI. Chunky, saturated, rounded. No off-whites. */
:root {
  --ink: #1b2160;
  --ink-soft: #4a55a8;
  --white: #ffffff;
  --blue: #2f6bff;
  --blue-deep: #1b3fd0;
  --blue-dark: #142c9c;
  --sky: #34c3ff;
  --green: #2fd35c;
  --green-deep: #169c3c;
  --yellow: #ffcf1f;
  --yellow-deep: #e39a00;
  --orange: #ff8a1f;
  --pink: #ff4fa0;
  --purple: #8b5cff;
  --red: #ff4655;
  --card-shadow: 0 4px 0 rgba(10, 20, 90, 0.28);
  --sheet-h: 44vh;
  --display: 'Lilita One', 'Arial Rounded MT Bold', ui-rounded, system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--blue-deep);
  font-family: var(--body); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- icons: Lucide svgs painted with currentColor ---------- */
.i { display: inline-block; width: 1em; height: 1em; background: currentColor; flex: 0 0 auto;
  -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat; }

/* ---------- the coin (pure CSS) ---------- */
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; flex: 0 0 auto; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff7b0 0 12%, #ffe04a 13% 45%, #ffbe0b 46% 100%);
  box-shadow: inset 0 -0.08em 0 #d88a00, 0 0.06em 0 #b86f00; }
.coin::after { content: ''; position: absolute; inset: 22%; border-radius: 50%;
  border: 0.07em solid rgba(200, 120, 0, 0.55); }

/* ---------- layout ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: none; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#sheet { position: relative; flex: 0 0 var(--sheet-h); min-height: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  border-radius: 26px 26px 0 0; margin-top: -26px; z-index: 5;
  box-shadow: 0 -6px 0 rgba(10, 30, 120, 0.25);
  transition: flex-basis .35s cubic-bezier(.3, 1.3, .5, 1); }
#app.collapsed #sheet { flex-basis: calc(64px + var(--safe-bottom)); }

@media (min-width: 880px) and (min-aspect-ratio: 1/1) {
  #app { flex-direction: row; }
  #sheet { flex: 0 0 420px; margin: 0; border-radius: 28px 0 0 28px; box-shadow: -6px 0 0 rgba(10, 30, 120, 0.25); margin-left: -28px; }
  #app.collapsed #sheet { flex-basis: 420px; }
  #sheet-toggle { display: none !important; }
  :root { --sheet-h: 0px; --hud-r: 40px; }
  #toasts { transform: translateX(calc(-50% - 14px)); }
}

/* ---------- HUD on the stage ---------- */
#hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(10px + var(--safe-top)) var(--hud-r, 12px) 0 12px; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; z-index: 3; }
#hud > * { pointer-events: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--white); color: var(--ink);
  border-radius: 99px; padding: 6px 12px 6px 8px; font-weight: 900; font-size: 14px; box-shadow: var(--card-shadow);
  white-space: nowrap; }
.chip .i { font-size: 18px; color: var(--blue); }
#world-chip { justify-self: start; max-width: 100%; overflow: hidden; }
#world-chip .wn { display: none; }
@media (max-width: 520px) { #world-name { display: none; } #world-chip .wn { display: inline; } #world-chip .mult { display: none; } }
#world-chip .mult { color: var(--green-deep); margin-left: 2px; }
#menu-btn { justify-self: end; width: 44px; height: 44px; border-radius: 50%; background: var(--white);
  box-shadow: var(--card-shadow); display: grid; place-items: center; }
#menu-btn .i { font-size: 22px; color: var(--ink); }
#menu-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(10,20,90,.28); }

#bank { text-align: center; pointer-events: none; }
#coins { font-family: var(--display); font-size: clamp(34px, 9vw, 52px); line-height: 1; color: var(--white);
  display: flex; justify-content: center; align-items: center; gap: 8px;
  -webkit-text-stroke: 0; text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 3px 0 var(--ink), -2px 3px 0 var(--ink);
  transition: transform .08s; }
#coins .coin { font-size: .82em; box-shadow: inset 0 -0.08em 0 #d88a00, 0 0.08em 0 var(--ink), 0 0 0 0.06em var(--ink); }
#coins.bump { transform: scale(1.08); }
#cps { display: inline-block; margin-top: 4px; font-weight: 900; font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,.92); border-radius: 99px; padding: 2px 10px; }
#cps.frenzy { background: var(--yellow); animation: throb .5s infinite alternate; }
@keyframes throb { to { transform: scale(1.08); } }

/* goal ribbon */
#goal { position: absolute; left: 50%; top: calc(98px + var(--safe-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; background: var(--white); border-radius: 16px; padding: 6px 12px 6px 6px;
  box-shadow: var(--card-shadow); z-index: 3; min-width: 220px; max-width: min(92vw, 340px); cursor: pointer; }
#goal img { width: 38px; height: 38px; border-radius: 10px; background: #d9f1ff; flex: 0 0 auto; }
#goal .g-txt { flex: 1 1 auto; min-width: 0; }
#goal .g-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
#goal .g-name { font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goal .bar { height: 8px; border-radius: 99px; background: #dfe6ff; margin-top: 3px; overflow: hidden; }
#goal .bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #7ff08f); border-radius: 99px; transition: width .25s; }
#goal.ready { animation: wiggle 1.2s infinite; }
#goal.ready .bar > i { background: linear-gradient(90deg, var(--yellow), #ffe98a); }
@keyframes wiggle { 0%, 80%, 100% { transform: translateX(-50%) rotate(0); } 85% { transform: translateX(-50%) rotate(-2deg); } 90% { transform: translateX(-50%) rotate(2deg); } 95% { transform: translateX(-50%) rotate(-1deg); } }

/* fever meter */
#fever { position: absolute; left: 50%; bottom: calc(40px); transform: translateX(-50%); width: min(62vw, 300px); height: 26px;
  z-index: 3; pointer-events: none; }
#fever .track { position: absolute; inset: 0; background: rgba(20, 30, 100, .45); border-radius: 99px; border: 3px solid var(--white);
  overflow: hidden; box-shadow: 0 3px 0 rgba(10,20,90,.3); }
#fever .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--orange), var(--pink)); border-radius: 99px; transition: width .12s; }
#fever .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  font-family: var(--display); font-size: 15px; color: var(--white); letter-spacing: .04em; text-shadow: 0 2px 0 rgba(20,20,80,.6); }
#fever .lbl .i { font-size: 16px; }
#fever.on .fill { background: linear-gradient(90deg, #ff4655, #ff8a1f, #ffcf1f, #2fd35c, #34c3ff, #8b5cff, #ff4fa0);
  background-size: 300% 100%; animation: rainbow 1s linear infinite; }
#fever.on { animation: throbC .35s infinite alternate; }
@keyframes rainbow { to { background-position: 300% 0; } }
@keyframes throbC { to { transform: translateX(-50%) scale(1.06); } }

/* big announcements */
#banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; z-index: 6;
  font-family: var(--display); font-size: clamp(40px, 12vw, 76px); color: var(--yellow); opacity: 0;
  text-shadow: 0 5px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 3px 5px 0 var(--ink), -3px 5px 0 var(--ink); }
#banner small { display: block; font-size: .36em; color: var(--white); margin-top: 6px; }
#banner.show { animation: bannerIn 1.9s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 15% { opacity: 1; transform: scale(1.1) rotate(2deg); }
  25% { transform: scale(1) rotate(0); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1) translateY(-20px); } }

/* floating numbers & flying coins */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.pop { position: absolute; font-family: var(--display); font-size: 26px; color: var(--white); white-space: nowrap;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink);
  transform: translate(-50%, -50%); will-change: transform, opacity; }
.pop.gold { color: var(--yellow); font-size: 32px; }
.pop.big { font-size: 40px; color: var(--yellow); }
.pop.fever { color: #ffd6f0; }
.fly { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; font-size: 22px; will-change: transform; }

/* tutorial hand */
#hand { position: absolute; z-index: 20; pointer-events: none; display: none; width: 64px; height: 64px; margin: -6px 0 0 -18px; }
#hand .i { font-size: 54px; color: var(--white); filter: drop-shadow(0 3px 0 var(--ink)) drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)); }
#hand.show { display: block; animation: handTap .9s infinite; }
#hand .tip { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--ink); color: var(--white); font-weight: 900; font-size: 14px; padding: 4px 10px; border-radius: 10px; }
@keyframes handTap { 0%, 100% { transform: translate(0, 0) scale(1); } 45% { transform: translate(4px, 8px) scale(.9); } 55% { transform: translate(4px, 8px) scale(.9); } }

/* ---------- the shop sheet ---------- */
#sheet-toggle { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 64px; height: 28px; z-index: 6;
  border-radius: 99px; background: var(--white); box-shadow: var(--card-shadow); display: grid; place-items: center; }
#sheet-toggle .i { font-size: 20px; color: var(--blue-deep); transition: transform .3s; }
#app.collapsed #sheet-toggle .i { transform: rotate(180deg); }
#tabs { display: flex; gap: 6px; padding: 18px 12px 8px; flex: 0 0 auto; }
.tab { flex: 1; height: 42px; border-radius: 14px; font-family: var(--display); font-size: 17px; letter-spacing: .02em;
  color: rgba(255,255,255,.8); background: rgba(10, 25, 110, .35); display: flex; align-items: center; justify-content: center; gap: 6px; position: relative; }
.tab .i { font-size: 18px; }
.tab.on { background: var(--white); color: var(--blue-deep); box-shadow: 0 4px 0 rgba(10,20,90,.35); }
.tab .badge { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px;
  background: var(--red); color: var(--white); font-family: var(--body); font-weight: 900; font-size: 12px; display: none;
  align-items: center; justify-content: center; border: 2px solid var(--white); }
.tab .badge.show { display: flex; animation: popIn .4s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes popIn { from { transform: scale(0); } }

.panel { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 4px 12px calc(16px + var(--safe-bottom)); display: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.4) transparent; }
.panel.on { display: block; }
#app.collapsed .panel { visibility: hidden; }

.buyamt { display: flex; gap: 4px; justify-content: flex-end; margin: 2px 0 8px; position: relative; z-index: 1; }
.buyall { display: flex; justify-content: flex-end; margin: 2px 0 8px; }
.buyall button { font-family: var(--display); font-size: 15px; color: var(--ink); background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-deep); border-radius: 99px; padding: 5px 14px; }
.buyall button:disabled { opacity: .5; }
.buyamt button { font-weight: 900; font-size: 13px; color: var(--white); background: rgba(10,25,110,.35); border-radius: 99px; padding: 4px 12px; }
.buyamt button.on { background: var(--yellow); color: var(--ink); }

.card { display: flex; align-items: center; gap: 10px; background: var(--white); border-radius: 18px; padding: 8px 8px 8px 8px;
  margin-bottom: 9px; box-shadow: var(--card-shadow); position: relative; transition: transform .1s; }
.card .thumb { width: 60px; height: 60px; flex: 0 0 auto; border-radius: 14px; position: relative;
  background: radial-gradient(circle at 50% 40%, #c9f0ff, #8ad8ff); display: grid; place-items: center; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .thumb .i { font-size: 30px; color: var(--white); }
.card .count { position: absolute; bottom: -5px; right: -5px; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 99px;
  background: var(--ink); color: var(--white); font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white); }
.card .count:empty { display: none; }
.card .meta { flex: 1 1 auto; min-width: 0; }
.card .name { font-family: var(--display); font-size: 18px; line-height: 1.1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .desc { font-weight: 800; font-size: 12.5px; color: var(--ink-soft); line-height: 1.25; margin-top: 2px; }
.card .desc b { color: var(--green-deep); font-weight: 900; }
.card .price { flex: 0 0 auto; min-width: 92px; height: 50px; border-radius: 14px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 10px;
  font-family: var(--display); font-size: 17px; color: var(--white);
  background: var(--green); box-shadow: 0 4px 0 var(--green-deep); text-shadow: 0 2px 0 rgba(0,60,20,.35); }
.card .price .coin { font-size: 17px; }
.card .price .fillbar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 207, 31, .55); }
.card .price span { position: relative; }
.card .price:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-deep); }
.card.cant .price { background: #b7c3ee; box-shadow: 0 4px 0 #8c9bd6; color: #eef2ff; text-shadow: 0 2px 0 rgba(20,30,100,.25); }
.card.cant .price:active { transform: none; box-shadow: 0 4px 0 #8c9bd6; }
.card.cant .price .coin { filter: saturate(.3) brightness(1.1); }
.card.locked .thumb img { filter: brightness(0) opacity(.35); }
.card.locked .name { color: #9aa4d6; }
.card.bought { animation: cardBuy .35s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes cardBuy { 0% { transform: scale(.95); } 100% { transform: scale(1); } }
.card.rocket { background: linear-gradient(135deg, #ffe46b, #ffb81f); }
.card.rocket .thumb { background: radial-gradient(circle at 50% 40%, #ffffff, #ffd76b); }
.card.rocket .desc { color: #7a4b00; }
.card.rocket .price { background: var(--pink); box-shadow: 0 4px 0 #c42274; }
.card.rocket.cant .price { background: #e7c27a; box-shadow: 0 4px 0 #c8962f; }
.card.rocket.launch .price { background: var(--red); box-shadow: 0 4px 0 #b3182a; animation: throb .45s infinite alternate; }
.teaser { text-align: center; color: rgba(255,255,255,.85); font-weight: 900; font-size: 13px; padding: 8px 0 4px; }
.teaser .row { display: flex; gap: 6px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.teaser img { width: 42px; height: 42px; filter: brightness(0) invert(1) opacity(.35); }

.upg .thumb { background: radial-gradient(circle at 50% 40%, #fff1a8, #ffc933); }
.upg .thumb.t0 { background: radial-gradient(circle at 50% 40%, #e4f7ff, #9fdcff); }
.upg .thumb.t1 { background: radial-gradient(circle at 50% 40%, #fff6c4, #ffd84a); }
.upg .thumb.t2 { background: radial-gradient(circle at 50% 40%, #ffe8a6, #ffae1f); }
.upg .thumb.t3 { background: radial-gradient(circle at 50% 40%, #ffd1ea, #ff6fb4); }
.upg .thumb.t4 { background: radial-gradient(circle at 50% 40%, #e6d9ff, #9a6bff); }
.upg .thumb.t5 { background: radial-gradient(circle at 50% 40%, #d1fbff, #2fd6e8); }
.upg .thumb.t6 { background: radial-gradient(circle at 50% 40%, #ffffff, #ff4655); }
.upg .thumb.sp-pointer, .upg .thumb.sp-zap { background: radial-gradient(circle at 50% 40%, #fff1a8, #ff9d1f); }
.upg .thumb.sp-droplets { background: radial-gradient(circle at 50% 40%, #d7f6ff, #34c3ff); }
.upg .thumb.sp-flame { background: radial-gradient(circle at 50% 40%, #ffe0d0, #ff5a3c); }
.upg .thumb.sp-users { background: radial-gradient(circle at 50% 40%, #e1ffd9, #2fd35c); }
.upg .thumb.sp-sparkles { background: radial-gradient(circle at 50% 40%, #fff7c4, #ffcf1f); }
.upg .x2 { position: absolute; top: -6px; left: -6px; background: var(--pink); color: var(--white); font-family: var(--display);
  font-size: 13px; border-radius: 99px; padding: 1px 6px; border: 2px solid var(--white); }
.empty { text-align: center; color: rgba(255,255,255,.9); font-weight: 900; padding: 26px 16px; font-size: 15px; line-height: 1.4; }
.empty .i { font-size: 40px; display: block; margin: 0 auto 8px; color: rgba(255,255,255,.6); }

/* awards */
.ach-head { color: var(--white); font-weight: 900; font-size: 14px; text-align: center; margin: 2px 0 10px; }
.ach-head b { color: var(--yellow); font-family: var(--display); font-weight: 400; font-size: 18px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.ach { background: var(--white); border-radius: 16px; padding: 8px 4px 6px; text-align: center; box-shadow: var(--card-shadow); }
.ach .medal { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 4px; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #fff5b0, #ffc21f 60%, #e09600); box-shadow: 0 3px 0 #b87400; }
.ach .medal .i { font-size: 22px; color: #7a4b00; }
.ach .an { font-weight: 900; font-size: 11px; line-height: 1.15; color: var(--ink); }
.ach.off { background: rgba(255,255,255,.18); box-shadow: none; }
.ach.off .medal { background: rgba(10,25,110,.35); box-shadow: none; }
.ach.off .medal .i { color: rgba(255,255,255,.45); }
.ach.off .an { color: rgba(255,255,255,.85); }
.ach .ap { height: 4px; border-radius: 99px; background: rgba(10,25,110,.35); margin: 4px 6px 0; overflow: hidden; }
.ach .ap i { display: block; height: 100%; background: var(--yellow); }

/* ---------- toasts ---------- */
#toasts { position: absolute; bottom: 82px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; flex-direction: column-reverse; gap: 6px; align-items: center; pointer-events: none; width: min(92%, 360px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--white); border-radius: 16px; padding: 6px 12px 6px 6px;
  box-shadow: 0 5px 0 rgba(10,20,90,.3); width: 100%; animation: toastIn .5s cubic-bezier(.2, 1.6, .4, 1); }
.toast.out { animation: toastOut .35s ease-in forwards; }
.toast .medal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: radial-gradient(circle at 40% 35%, #fff5b0, #ffc21f 60%, #e09600); box-shadow: 0 3px 0 #b87400; }
.toast .medal .i { font-size: 22px; color: #7a4b00; }
.toast .medal img { width: 40px; height: 40px; }
.toast .tt { font-size: 11px; font-weight: 900; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.toast .tn { font-family: var(--display); font-size: 18px; line-height: 1.1; }
.toast .td { font-weight: 800; font-size: 12px; line-height: 1.2; color: var(--green-deep); }
@keyframes toastIn { from { transform: translateY(40px) scale(.7); opacity: 0; } }
@keyframes toastOut { to { transform: scale(.8); opacity: 0; } }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10, 20, 90, .55); }
.modal.show { display: flex; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.box { background: var(--white); border-radius: 28px; padding: 24px 22px 22px; width: min(92vw, 380px); text-align: center; position: relative;
  box-shadow: 0 8px 0 rgba(10,20,90,.35); animation: boxIn .45s cubic-bezier(.2, 1.6, .4, 1); max-height: 90vh; overflow: auto; }
@keyframes boxIn { from { transform: scale(.6) translateY(40px); opacity: 0; } }
.box h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.05; color: var(--blue-deep); margin-bottom: 6px; }
.box p { font-weight: 800; color: var(--ink-soft); font-size: 15px; line-height: 1.4; }
.box .big-num { font-family: var(--display); font-size: 40px; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 56px; padding: 0 28px; border-radius: 18px;
  font-family: var(--display); font-size: 22px; color: var(--white); background: var(--green); box-shadow: 0 5px 0 var(--green-deep);
  text-shadow: 0 2px 0 rgba(0,60,20,.35); margin-top: 16px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--green-deep); }
.btn.blue { background: var(--blue); box-shadow: 0 5px 0 var(--blue-dark); }
.btn.red { background: var(--red); box-shadow: 0 5px 0 #b3182a; }
.btn.ghost { background: #e6ebff; color: var(--ink); box-shadow: 0 5px 0 #b9c4f0; text-shadow: none; }
.btn.small { height: 44px; font-size: 17px; padding: 0 18px; }
.x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; background: #e6ebff; display: grid; place-items: center; }
.x .i { font-size: 20px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 2px solid #e6ebff;
  font-weight: 900; font-size: 16px; text-align: left; }
.set-row .i { font-size: 20px; color: var(--blue); margin-right: 8px; vertical-align: -3px; }
.toggle { width: 58px; height: 34px; border-radius: 99px; background: #c9d2f5; position: relative; transition: background .2s; flex: 0 0 auto; }
.toggle::after { content: ''; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--white);
  box-shadow: 0 2px 0 rgba(10,20,90,.25); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(24px); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; text-align: left; margin-top: 12px; font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.stats b { color: var(--ink); font-weight: 900; }
.fine { font-size: 12px !important; margin-top: 14px; }
.fine a { color: var(--blue); }

/* title screen */
#title { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 42%, rgba(52,195,255,.35) 0%, rgba(27,63,208,.75) 70%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer; }
#title .logo { width: clamp(220px, 62vw, 340px); aspect-ratio: 1; border-radius: 36px; overflow: hidden;
  box-shadow: 0 10px 0 rgba(10,20,90,.4); animation: logoIn .9s cubic-bezier(.2, 1.5, .4, 1), bob 3s 1s ease-in-out infinite; }
#title .logo img { width: 100%; height: 100%; display: block; }
@keyframes logoIn { from { transform: scale(0) rotate(-20deg); } }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-1.5deg); } }
#title .btn { font-size: 28px; height: 66px; padding: 0 40px; animation: throb .6s infinite alternate; }
#title.out { animation: titleOut .45s ease-in forwards; pointer-events: none; }
@keyframes titleOut { to { opacity: 0; transform: scale(1.15); } }
#title .load { color: var(--white); font-weight: 900; font-size: 14px; height: 18px; text-shadow: 0 2px 0 rgba(10,20,90,.5); }

/* flash for the launch */
#flash { position: fixed; inset: 0; background: var(--white); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .6s; }
#flash.on { opacity: 1; transition: opacity .9s ease-in; }

/* the injected "About this game" disclosure: keep it out of the shop */
#bf-about-panel { bottom: calc(var(--sheet-h) + 6px) !important; left: 8px !important; font-size: 12px !important; }
#bf-about-panel > summary { padding: 3px 9px !important; opacity: .8; }
@media (min-width: 880px) and (min-aspect-ratio: 1/1) { #bf-about-panel { bottom: 12px !important; } }
#app.collapsed ~ #bf-about-panel { bottom: 76px !important; }

@media (max-height: 640px) {
  #goal { top: calc(88px + var(--safe-top)); }
  .card .thumb { width: 50px; height: 50px; }
  .card .price { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  #title .logo, #title .btn, #goal.ready, #fever.on, #cps.frenzy { animation: none !important; }
}

/* two-line price when buying several: the count sits on its own line */
.card .price { flex-direction: column; gap: 0; line-height: 1.05; }
.card .price .row { display: flex; align-items: center; gap: 5px; position: relative; }
.card .price .qty { position: relative; font-family: var(--body); font-weight: 900; font-size: 11px; letter-spacing: .04em; opacity: .9; }
.card .price .qty:empty { display: none; }

/* the fever meter glows as it gets close */
#fever.hot .fill { animation: hot .4s infinite alternate; }
@keyframes hot { to { filter: brightness(1.35) saturate(1.2); } }

/* nothing but the island and the logo until you press Play; nothing but the rocket during liftoff */
body.title #hud, body.title #goal, body.title #fever, body.title #tabs, body.title .panel,
body.launching #hud, body.launching #goal, body.launching #fever, body.launching #sheet, body.launching #toasts { opacity: 0; pointer-events: none; }
#hud, #goal, #fever, #tabs, .panel, #sheet { transition: opacity .5s; }

/* Play only appears once the island and the band are loaded */
#title .btn.wait { visibility: hidden; animation: none; }
#title .btn.go { animation: logoIn .5s cubic-bezier(.2, 1.6, .4, 1), throb .6s .5s infinite alternate; }
