/* Apple Ball: DOM overlays (title, corner buttons, game over card, unlock
   toast, apple locker). Everything lives in #ui > .ab-ui. #ui itself never
   takes pointer events; only the buttons and cards below turn them back on. */

#ui { pointer-events: none; }

.ab-ui {
  /* Palette */
  --ab-ink: #f5f7ff;
  --ab-ink-2: #c9d1f0;
  --ab-muted: #8f9bc8;
  --ab-navy-0: #060a1e;
  --ab-navy-1: #0d1434;
  --ab-navy-2: #172152;
  --ab-navy-3: #24316f;
  --ab-line: rgba(150, 172, 255, .16);
  --ab-orange: #ff7a1a;
  --ab-orange-hi: #ffad4a;
  --ab-orange-lo: #a84300;
  --ab-red: #ff3b47;
  --ab-gold: #ffc934;
  --ab-accent: #ffb23f;
  --ab-common: var(--tier-common, #b9c0d8);
  --ab-rare: var(--tier-rare, #59c8ff);
  --ab-epic: var(--tier-epic, #c77dff);
  --ab-legendary: var(--tier-legendary, #ffcf4a);
  /* Type */
  --ab-display: 'Archivo Expanded', 'Arial Black', system-ui, sans-serif;
  --ab-body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  /* Motion */
  --ab-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ab-spring-big: cubic-bezier(.2, 1.85, .45, 1);
  --ab-out: cubic-bezier(.22, 1, .36, 1);
  --ab-in: cubic-bezier(.55, 0, .8, .2);
  /* Safe areas */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);

  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
  container-name: abui;
  color: var(--ab-ink);
  font: 500 14px/1.35 var(--ab-body);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
.ab-ui *, .ab-ui *::before, .ab-ui *::after { box-sizing: border-box; }
.ab-ui button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ab-ui :focus { outline: none; }
.ab-ui :focus-visible { outline: 3px solid #ffd76a; outline-offset: 3px; }
.ab-ui [hidden] { display: none !important; }
.ab-svg { display: block; width: 1em; height: 1em; flex: none; }
.ab-appleicon { display: block; flex: none; }

/* Tier tokens (cards, minis, toast) */
.tier-common    { --tier: var(--ab-common);    --tier-tint: rgba(185, 192, 216, .10); --tier-ring: rgba(185, 192, 216, .36); --tier-glow: rgba(185, 192, 216, .16); }
.tier-rare      { --tier: var(--ab-rare);      --tier-tint: rgba(89, 200, 255, .15);  --tier-ring: rgba(89, 200, 255, .55);  --tier-glow: rgba(89, 200, 255, .26); }
.tier-epic      { --tier: var(--ab-epic);      --tier-tint: rgba(199, 125, 255, .18); --tier-ring: rgba(199, 125, 255, .6);  --tier-glow: rgba(199, 125, 255, .3); }
.tier-legendary { --tier: var(--ab-legendary); --tier-tint: rgba(255, 207, 74, .18);  --tier-ring: rgba(255, 207, 74, .7);   --tier-glow: rgba(255, 196, 50, .34); }

.ab-menus { position: absolute; inset: 0; pointer-events: none; }

/* ======================================================================
   Buttons
   ====================================================================== */
.ab-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 20px;
  border-radius: 18px;
  font: 800 16px/1 var(--ab-display) !important;
  letter-spacing: .05em;
  color: #fff;
  cursor: pointer;
  transition: transform .22s var(--ab-spring), box-shadow .22s ease, filter .2s ease;
}
.ab-btn .ab-svg { width: 22px; height: 22px; }
.ab-btn--primary {
  background: linear-gradient(180deg, #ffb14d 0%, #ff8124 48%, #f2600c 100%);
  box-shadow:
    0 6px 0 var(--ab-orange-lo),
    0 12px 26px rgba(255, 110, 20, .38),
    inset 0 2px 0 rgba(255, 255, 255, .5),
    inset 0 -3px 0 rgba(120, 30, 0, .18);
  text-shadow: 0 2px 0 rgba(130, 40, 0, .5);
}
.ab-btn--primary .ab-svg { filter: drop-shadow(0 2px 0 rgba(130, 40, 0, .5)); }
.ab-btn--ghost {
  background: linear-gradient(180deg, #33438a 0%, #222e68 100%);
  box-shadow:
    0 6px 0 #0b1132,
    0 10px 22px rgba(0, 0, 0, .3),
    inset 0 2px 0 rgba(255, 255, 255, .16),
    inset 0 0 0 1.5px rgba(150, 172, 255, .18);
}
.ab-btn:hover { filter: brightness(1.06); }
.ab-btn:active { transform: translateY(4px) scale(.98); }
.ab-btn--primary:active { box-shadow: 0 2px 0 var(--ab-orange-lo), 0 6px 14px rgba(255, 110, 20, .3), inset 0 2px 0 rgba(255, 255, 255, .5); }
.ab-btn--ghost:active { box-shadow: 0 2px 0 #0b1132, inset 0 2px 0 rgba(255, 255, 255, .16), inset 0 0 0 1.5px rgba(150, 172, 255, .18); }

.ab-iconbtn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .2), inset 0 1px 0 rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  transition: transform .2s var(--ab-spring), background .2s;
}
.ab-iconbtn .ab-svg { width: 20px; height: 20px; }
.ab-iconbtn:hover { background: rgba(255, 255, 255, .14); }
.ab-iconbtn:active { transform: scale(.9); }

/* ======================================================================
   Title card (first `ready` of the session)
   ====================================================================== */
.ab-title {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--sat) + 9cqh);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  transition: opacity .35s ease, transform .4s var(--ab-in);
}
.ab-title__glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 150%;
  max-width: 560px;
  aspect-ratio: 1.6;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(255, 140, 40, .2), rgba(255, 120, 30, .06) 55%, transparent 75%),
    radial-gradient(closest-side, rgba(4, 7, 26, .55), transparent 80%);
  opacity: 0;
  transition: opacity .8s ease .1s;
  z-index: -1;
}
.ab-title__mark {
  width: 64px;
  height: 64px;
  margin-bottom: 2px;
  transform: scale(0) rotate(-40deg);
  transition: transform .7s var(--ab-spring-big) .05s;
}
.ab-title__apple {
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45));
  animation: ab-bob 2.8s ease-in-out 1s infinite;
}
.ab-logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--ab-display);
  font-weight: 800;
  line-height: .95;
}
.ab-logo__top {
  font-size: 23px;
  font-size: clamp(20px, 6.6cqi, 34px);
  letter-spacing: .2em;
  margin-right: -.2em;
  color: #fff;
  text-shadow: 0 3px 0 #23307a, 0 5px 0 #141c4c, 0 10px 18px rgba(0, 0, 0, .55);
  opacity: 0;
  transform: translateY(-24px);
  transition: transform .6s var(--ab-spring-big) .12s, opacity .25s ease .12s;
}
.ab-logo__ball {
  display: flex;
  margin-top: 4px;
  font-size: 64px;
  font-size: clamp(50px, 17.6cqi, 88px);
  letter-spacing: -.01em;
}
.ab-logo__ch {
  display: inline-block;
  background: linear-gradient(180deg, #ffe58f 0%, #ffbb45 34%, #ff8221 62%, #ec5408 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #9c3604) drop-shadow(0 3px 0 #5e1f00) drop-shadow(0 10px 14px rgba(0, 0, 0, .5));
  opacity: 0;
  transform: translateY(-70px) scale(.5) rotate(-12deg);
  transition: transform .75s var(--ab-spring-big), opacity .2s ease;
  transition-delay: calc(.22s + var(--i) * .07s);
}
.ab-title__best, .ab-title__tag {
  margin-top: 16px;
  opacity: 0;
  transform: translateY(12px);
  transition: transform .5s var(--ab-spring) .7s, opacity .3s ease .7s;
}
.ab-title__best {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  background: rgba(8, 13, 44, .62);
  box-shadow: inset 0 0 0 1.5px rgba(255, 201, 52, .28), 0 6px 16px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.ab-title__best .ab-svg { width: 18px; height: 18px; color: var(--ab-gold); }
.ab-title__best span { font: 800 11px/1 var(--ab-display); letter-spacing: .14em; color: var(--ab-ink-2); }
.ab-title__best b { font: 800 18px/1 var(--ab-display); color: #fff; font-variant-numeric: tabular-nums; }
.ab-title__tag {
  font: 700 12px/1 var(--ab-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ab-ink-2);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}

.ab-title.is-in .ab-title__glow { opacity: 1; }
.ab-title.is-in .ab-title__mark { transform: none; }
.ab-title.is-in .ab-logo__top { opacity: 1; transform: none; }
.ab-title.is-in .ab-logo__ch { opacity: 1; transform: none; animation: ab-wave 3.2s ease-in-out infinite; animation-delay: calc(1.4s + var(--i) * .12s); }
.ab-title.is-in .ab-title__best, .ab-title.is-in .ab-title__tag { opacity: 1; transform: none; }
/* CLASSIC / CHALLENGE (once challenge mode is open) */
.ab-mode {
  margin-top: 12px;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(8, 13, 44, .62);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .2), 0 6px 16px rgba(0, 0, 0, .3);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: transform .5s var(--ab-spring) .8s, opacity .3s ease .8s;
}
.ab-title.is-in .ab-mode { opacity: 1; transform: none; }
.ab-mode__btn {
  appearance: none;
  border: 0;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  font: 800 10.5px/1 var(--ab-display) !important;
  letter-spacing: .14em;
  color: var(--ab-ink-2) !important;
  cursor: pointer;
  pointer-events: auto;
}
.ab-mode__btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffb14d 0%, #ff8124 55%, #f2600c 100%);
  color: #fff !important;
  text-shadow: 0 1px 0 rgba(130, 40, 0, .5);
}
/* The locked CHALLENGE chip (stage 3), where the switch goes once tier 3
   opens. Tapping it shakes it and shows where it opens, under it. Also on
   the game over card (.ab-over__next). */
.ab-lock {
  appearance: none;
  border: 0;
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px 0 11px;
  border-radius: 999px;
  background: rgba(8, 13, 44, .5);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .14);
  font: 800 10.5px/1 var(--ab-display) !important;
  letter-spacing: .14em;
  color: var(--ab-muted) !important;
  cursor: pointer;
  pointer-events: auto;
}
.ab-lock .ab-svg { width: 13px; height: 13px; }
.ab-lock__k { padding: 4px 6px; border-radius: 6px; background: rgba(150, 172, 255, .12); font-size: 8.5px; letter-spacing: .12em; }
.ab-lock.is-shake { animation: ab-shake .42s ease; }
.ab-title .ab-lock { opacity: 0; transform: translateY(12px); transition: transform .5s var(--ab-spring) .8s, opacity .3s ease .8s; }
.ab-title.is-in .ab-lock { opacity: 1; transform: none; }
.ab-lock__hint, .ab-install__hint {
  margin-top: 8px;
  max-width: 260px;
  text-wrap: balance;
  font: 600 13px/1.35 var(--ab-body);
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
/* INSTALL (stage 3+, while the game can be installed and is not) and LOAD A
   SAVE (an installed app with a blank save): last on the title card and the
   quietest thing on it. On an iPhone INSTALL shows the steps under itself. */
.ab-install, .ab-load {
  appearance: none;
  border: 0;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(150, 172, 255, .2);
  font: 800 9.5px/1 var(--ab-display) !important;
  letter-spacing: .14em;
  color: var(--ab-muted) !important;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: transform .5s var(--ab-spring) .9s, opacity .3s ease .9s;
}
.ab-load { padding: 0 13px; }
.ab-install .ab-svg { width: 13px; height: 13px; }
.ab-title.is-in .ab-install, .ab-title.is-in .ab-load { opacity: 1; transform: none; }
.ab-over__mode { font: 800 10px/1 var(--ab-display); letter-spacing: .24em; color: var(--ab-orange-hi); margin-bottom: 6px; }
/* The next run's type, above AGAIN: the switch (stage 4) or the locked chip
   (stage 3). The title card only shows when the page loads. */
.ab-over__next { margin-top: 14px; display: flex; flex-direction: column; align-items: center; }
.ab-over__next .ab-mode, .ab-over__next .ab-lock { margin-top: 0; }
.ab-over__next .ab-mode { opacity: 1; transform: none; transition: none; }
.ab-over__next .ab-lock__hint { margin: 8px auto 0; color: var(--ab-ink-2); text-shadow: none; font-size: 12.5px; text-align: center; }
/* A stage's first card (menus.js): the new part glows once, after it lands. */
.ab-over .is-reveal { outline: 2px solid transparent; outline-offset: 3px; animation: ab-reveal 1.6s ease .75s both; }
@keyframes ab-reveal { 0% { outline-color: rgba(255, 201, 52, 0); } 25% { outline-color: rgba(255, 201, 52, .85); } 100% { outline-color: rgba(255, 201, 52, 0); } }
/* CHALLENGE next to tier 3 in the picker, while it is still locked */
.ab-tag { display: inline-block; flex: none; padding: 3px 5px; border-radius: 5px; font: 800 8px/1 var(--ab-display); letter-spacing: .12em; color: var(--ab-orange-hi); background: rgba(255, 140, 40, .12); box-shadow: inset 0 0 0 1px rgba(255, 140, 40, .3); }
.ab-title.is-out { opacity: 0; transform: translateY(-28px) scale(1.06); }
/* A high first hoop would sit under the logo: menus.js shrinks the title a
   little and slides it toward the open side (translate/scale compose with
   the transform above). */
.ab-title.is-dodge { transform-origin: 50% 0; translate: var(--dodge-x, 0) 0; scale: var(--dodge-s, 1); }

/* ======================================================================
   Corner buttons (Apples, Sound): ready + over only
   ====================================================================== */
.ab-corners {
  position: absolute;
  left: calc(var(--sal) + 14px);
  right: calc(var(--sar) + 14px);
  bottom: calc(var(--sab) + 14px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  transition: opacity .25s ease, transform .45s var(--ab-spring), visibility 0s linear 0s;
  z-index: 6;
}
.ab-menus[data-mode="play"] .ab-corners,
.ab-menus[data-mode="hail"] .ab-corners,
.ab-menus[data-mode="dying"] .ab-corners {
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
  transition: opacity .15s ease, transform .2s ease, visibility 0s linear .2s;
}
/* Game over: the card has its own APPLES button, so the corner one steps
   aside (Sound stays, on the right). */
.ab-menus[data-mode="over"] .ab-cbtn--apples {
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s ease, transform .2s ease, visibility 0s linear .2s;
}
.ab-cbtn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 54px;
  border-radius: 19px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(44, 58, 122, .94) 0%, rgba(22, 30, 76, .94) 100%);
  box-shadow:
    0 5px 0 rgba(5, 9, 30, .92),
    0 12px 22px rgba(0, 0, 0, .35),
    inset 0 2px 0 rgba(255, 255, 255, .16),
    inset 0 0 0 1.5px rgba(150, 172, 255, .2);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform .22s var(--ab-spring), box-shadow .2s ease, color .2s;
}
.ab-cbtn:active { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 rgba(5, 9, 30, .92), inset 0 2px 0 rgba(255, 255, 255, .16), inset 0 0 0 1.5px rgba(150, 172, 255, .2); }
.ab-cbtn--apples { gap: 11px; padding: 0 18px 0 7px; }
.ab-cbtn__badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: radial-gradient(circle at 34% 28%, #ff7a7a 0%, #ec2f38 55%, #a8131d 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .38), inset 0 -3px 0 rgba(0, 0, 0, .22), 0 2px 6px rgba(200, 20, 30, .4);
}
.ab-cbtn__badge .ab-svg { width: 24px; height: 24px; filter: drop-shadow(0 1px 0 rgba(90, 0, 0, .5)); }
.ab-cbtn__text { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.ab-cbtn__label { font: 800 13px/1 var(--ab-display); letter-spacing: .08em; }
.ab-cbtn__count { font: 700 11px/1 var(--ab-body); color: var(--ab-ink-2); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.ab-cbtn__count.is-pick { color: var(--ab-gold); font: 800 9.5px/1 var(--ab-display); letter-spacing: .1em; }
.ab-cbtn--round { width: 54px; justify-content: center; padding: 0; }
.ab-cbtn--sound { margin-left: auto; }   /* stays right while APPLES is hidden (stage 1) */
.ab-cbtn--sound .ab-svg { width: 26px; height: 26px; }
.ab-cbtn--sound .ab-off { display: none; }
.ab-cbtn--sound.is-off { color: #8f9bc8; }
.ab-cbtn--sound.is-off .ab-on { display: none; }
.ab-cbtn--sound.is-off .ab-off { display: block; }
.ab-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a6a, #ff3b2f 60%);
  border: 3px solid #121a44;
  transform: scale(0);
  transition: transform .4s var(--ab-spring-big);
}
.ab-cbtn.has-new .ab-dot { transform: scale(1); }
.ab-cbtn.has-new .ab-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #ff5a3a;
  animation: ab-ping 1.6s ease-out infinite;
}

/* ======================================================================
   Game over card
   ====================================================================== */
.ab-over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Top padding keeps the HUD's target chip (top center) visible above the card. */
  padding: calc(var(--sat) + 66px) calc(var(--sar) + 16px) calc(var(--sab) + 84px) calc(var(--sal) + 16px);
  pointer-events: none;
  z-index: 4;
}
.ab-over__card {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: 344px;
  padding: 24px 18px 18px;
  border-radius: 30px;
  text-align: center;
  isolation: isolate;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(110, 135, 255, .26), transparent 62%),
    linear-gradient(180deg, #1d2860 0%, #131b45 58%, #0f163a 100%);
  box-shadow:
    0 0 0 2px rgba(150, 172, 255, .2),
    0 8px 0 #070b24,
    0 28px 60px rgba(0, 0, 0, .55),
    inset 0 2px 0 rgba(255, 255, 255, .14),
    inset 0 0 34px rgba(120, 145, 255, .12);
  opacity: 0;
  transform: translateY(70px) scale(.82);
  transition: transform .6s var(--ab-spring-big), opacity .18s ease;
}
.ab-over.is-in .ab-over__card { opacity: 1; transform: none; }
.ab-over.is-out .ab-over__card { opacity: 0; transform: translateY(40px) scale(.9); transition: transform .25s var(--ab-in), opacity .22s ease; }
.ab-over:not(.is-armed) button { pointer-events: none; }
/* Leaving (AGAIN pressed, picker or dialog closed): taps go straight through
   to the game, so a quick tap starts the run instead of landing on a layer
   that is fading out. */
.ab-over.is-out, .ab-over.is-out *,
.ab-locker.is-out, .ab-locker.is-out *,
.ab-dialog.is-out, .ab-dialog.is-out * { pointer-events: none !important; }
.ab-over__card.is-best { padding-top: 34px; }
.ab-over__card.is-best { box-shadow: 0 0 0 2px rgba(255, 201, 52, .45), 0 8px 0 #070b24, 0 28px 60px rgba(0, 0, 0, .55), 0 0 60px rgba(255, 180, 40, .18), inset 0 2px 0 rgba(255, 255, 255, .14), inset 0 0 34px rgba(255, 190, 60, .12); }

.ab-over__label {
  font: 800 12px/1 var(--ab-display);
  letter-spacing: .3em;
  margin-right: -.3em;
  color: var(--ab-ink-2);
}
.ab-over__score {
  margin: 8px 0 6px;
  font: 800 72px/1 var(--ab-display);
  font-size: clamp(60px, 20cqi, 84px);
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 4px 0 #2a3786, 0 7px 0 #141c4c, 0 14px 26px rgba(0, 0, 0, .5);
}
.ab-over__score.is-done { animation: ab-thump .45s var(--ab-spring); }
.ab-over__card.is-best .ab-over__score {
  background: linear-gradient(180deg, #fff6c9 0%, #ffd955 40%, #ffab1f 72%, #f08400 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 4px 0 #8a4a00) drop-shadow(0 3px 0 #4a2600) drop-shadow(0 12px 18px rgba(0, 0, 0, .45));
}
.ab-over__best {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: rgba(4, 8, 30, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 201, 52, .22);
}
.ab-over__best .ab-svg { width: 16px; height: 16px; color: var(--ab-gold); }
.ab-over__best span { font: 800 10px/1 var(--ab-display); letter-spacing: .16em; color: var(--ab-ink-2); }
.ab-over__best b { font: 800 15px/1 var(--ab-display); font-variant-numeric: tabular-nums; }

.ab-over__burst {
  position: absolute;
  left: 50%;
  top: 92px;
  width: 340px;
  height: 340px;
  margin: -170px 0 0 -170px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 205, 70, .3) 0deg 9deg, rgba(255, 205, 70, 0) 9deg 22.5deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 22%, rgba(0, 0, 0, .5) 45%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 22%, rgba(0, 0, 0, .5) 45%, transparent 72%);
  opacity: 0;
  transform: scale(.3);
  transition: transform .9s var(--ab-out), opacity .4s ease;
  z-index: -1;
  pointer-events: none;
}
.ab-over__card.is-best-in .ab-over__burst { opacity: 1; transform: scale(1); animation: ab-spin 16s linear infinite; }

.ab-ribbon {
  position: absolute;
  top: -20px;
  left: 50%;
  z-index: 2;
  padding: 10px 22px 9px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffeb94 0%, #ffc12e 52%, #f59300 100%);
  box-shadow: 0 5px 0 #a35800, 0 12px 26px rgba(255, 170, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(150, 70, 0, .25);
  color: #4d2400;
  font: 800 15px/1 var(--ab-display);
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  transform: translateX(-50%) scale(0) rotate(-14deg);
  transition: transform .65s var(--ab-spring-big);
}
.ab-ribbon span { position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(255, 255, 255, .55); }
.ab-ribbon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .85) 50%, transparent 62%);
  background-size: 260% 100%;
  background-position: 130% 0;
  animation: ab-sheen 2.6s ease-in-out 1s infinite;
}
.ab-over__card.is-best-in .ab-ribbon { transform: translateX(-50%) rotate(-4deg); }

.ab-over__pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.ab-over__style {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: rgba(4, 8, 30, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 150, 60, .3);
}
.ab-over__style .ab-svg { width: 16px; height: 16px; color: var(--ab-orange-hi); }
.ab-over__style span { font: 800 10px/1 var(--ab-display); letter-spacing: .16em; color: var(--ab-ink-2); }
.ab-over__style b { font: 800 15px/1 var(--ab-display); font-variant-numeric: tabular-nums; color: #ffd08a; }
.ab-over__style.is-zero b { color: var(--ab-muted); }

/* Bars (target goal, tiers, cards) */
.ab-bar {
  position: relative;
  display: block;
  height: 8px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(2, 4, 18, .6);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .05);
}
.ab-bar__ghost, .ab-bar__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: inherit;
}
.ab-bar__ghost { background: rgba(255, 200, 120, .18); }
.ab-bar__fill {
  min-width: 3px;
  background: linear-gradient(90deg, #ff4d2e 0%, #ff8a24 55%, #ffc43d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 0 10px rgba(255, 140, 40, .45);
  transition: width .9s var(--ab-spring);
}
.ab-tline__bar .ab-bar__fill, .ab-tdiv__bar .ab-bar__fill {
  background: linear-gradient(90deg, #6c5cff 0%, #b67dff 55%, #ffcf4a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 8px rgba(170, 120, 255, .4);
}

/* Progress block on the game over card: the Chasing strip + one tier line */
.ab-over__prog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  text-align: left;
}

/* "Chasing" strip, shared by the apple picker header and the game over card */
.ab-chase {
  appearance: none;
  border: 0;
  margin: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  padding: 10px 12px 11px 10px;
  border-radius: 16px;
  background: rgba(4, 8, 30, .45);
  box-shadow: inset 0 0 0 1px rgba(150, 172, 255, .14);
  color: inherit;
  font: inherit;
  text-align: left;
}
button.ab-chase { cursor: pointer; pointer-events: auto; transition: transform .22s var(--ab-spring), background .2s; }
button.ab-chase:active { transform: scale(.98); }
.ab-chase__apple, .ab-chase__ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.ab-chase__apple { background: radial-gradient(closest-side, rgba(255, 178, 63, .2), transparent); }
.ab-chase__ico { color: var(--ab-accent); box-shadow: inset 0 0 0 1.5px rgba(255, 178, 63, .45); }
.ab-chase__ico .ab-svg { width: 20px; height: 20px; }
.ab-chase__body { display: flex; flex-direction: column; min-width: 0; }
.ab-chase__row { display: flex; align-items: center; gap: 8px; }
.ab-chase__kicker { font: 800 9px/1 var(--ab-display); letter-spacing: .18em; color: var(--ab-accent); }
.ab-chase__delta { font: 700 10.5px/1 var(--ab-body); color: var(--ab-muted); white-space: nowrap; }
.ab-chase__delta.is-up { color: #8ff0b4; }
.ab-chase__count { margin-left: auto; font: 800 13px/1 var(--ab-display); color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-chase__name { margin-top: 5px; font: 800 13px/1.15 var(--ab-display); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-chase__goal { margin-top: 3px; font: 500 12px/1.25 var(--ab-body); color: var(--ab-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-chase__bar { margin-top: 8px; height: 5px; }
.ab-chase__barrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-width: 0; }
.ab-chase__barrow .ab-chase__bar { flex: 1; margin-top: 0; min-width: 0; }
.ab-chase__barrow .ab-chase__delta { flex: none; font-variant-numeric: tabular-nums; }
.ab-chase.is-empty .ab-chase__name { margin-top: 0; }
.ab-chase.is-wait .ab-chase__ico { color: var(--ab-muted); box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .2); }
.ab-chase.is-done .ab-chase__ico { color: var(--ab-gold); box-shadow: inset 0 0 0 1.5px rgba(255, 201, 52, .5); }
.ab-chase.is-cta {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  background: rgba(255, 178, 63, .08);
  box-shadow: inset 0 0 0 1.5px rgba(255, 178, 63, .6), 0 0 18px rgba(255, 170, 50, .1);
}
.ab-chase__go { width: 20px !important; height: 20px !important; color: var(--ab-accent); }
.ab-over.is-armed .ab-chase.is-cta { animation: ab-callout 2.2s ease-in-out .3s infinite; }

/* One line about the next tier */
.ab-tline { padding: 0 4px; }
.ab-tline__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ab-tline__label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: 600 12px/1.2 var(--ab-body); color: var(--ab-ink-2); }
.ab-tline__label .ab-svg { width: 13px; height: 13px; color: var(--ab-muted); }
.ab-tline__val { font: 800 11.5px/1 var(--ab-display); color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-tline__bar { margin-top: 7px; height: 4px; }
.ab-tline.is-open .ab-tline__label { font-weight: 800; color: var(--ab-gold); }
.ab-tline.is-open .ab-tline__label .ab-svg { color: var(--ab-gold); }

.ab-over__prog > * { opacity: 0; transform: translateY(10px); transition: transform .5s var(--ab-spring), opacity .25s ease; }
.ab-over.is-in .ab-over__prog > * { opacity: 1; transform: none; transition-delay: .32s; }
.ab-over.is-in .ab-over__prog > * + * { transition-delay: .42s; }
.ab-over__prog > .is-shown { transition-delay: 0s !important; }

.ab-over__new { margin-top: 16px; }
.ab-over__newhead {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 800 10px/1 var(--ab-display);
  letter-spacing: .16em;
  color: var(--ab-gold);
}
.ab-over__newhead::before, .ab-over__newhead::after {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 201, 52, .55));
}
.ab-over__newhead::after { background: linear-gradient(270deg, transparent, rgba(255, 201, 52, .55)); }
.ab-minis {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.ab-minis.is-scroll {
  justify-content: flex-start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  touch-action: pan-x;
  margin: 10px -18px 0;
  padding: 2px 18px 8px;
  scrollbar-width: none;
}
.ab-minis.is-scroll::-webkit-scrollbar { display: none; }
.ab-minis.is-scroll .ab-mini { flex: 0 0 104px; }
/* A single unlock gets a wide row card: icon | name + tier | equip. */
.ab-minis.is-single .ab-mini {
  flex: 1 1 auto;
  max-width: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  align-items: center;
  text-align: left;
  padding: 8px 10px 8px 8px;
}
.ab-minis.is-single .ab-mini__stage { grid-row: 1 / 4; }
.ab-minis.is-single .ab-mini__no { grid-column: 2; margin: 0; }
.ab-minis.is-single .ab-mini__name { grid-column: 2; min-height: 0; margin-top: 3px; font-size: 13px; }
.ab-minis.is-single .ab-mini__tier { grid-column: 2; margin-top: 4px; }
.ab-minis.is-single .ab-mini__equip { grid-column: 3; grid-row: 1 / 4; width: auto; margin: 0; padding: 0 14px; }
.ab-mini {
  flex: 1 1 0;
  min-width: 92px;
  max-width: 120px;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 8px 9px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--tier-tint), rgba(6, 10, 34, .5));
  box-shadow: inset 0 0 0 1.5px var(--tier-ring), 0 0 18px var(--tier-glow);
  opacity: 0;
  transform: translateY(14px) scale(.8);
  transition: transform .55s var(--ab-spring-big), opacity .25s ease;
  transition-delay: calc(.5s + var(--i) * .08s);
}
.ab-over.is-in .ab-mini { opacity: 1; transform: none; }
.ab-mini__stage {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tier-glow), transparent);
}
.ab-mini__apple { animation: ab-bob 2.4s ease-in-out infinite; }
.ab-mini__no { margin-top: 2px; font: 800 8.5px/1 var(--ab-display); letter-spacing: .12em; color: var(--ab-muted); }
.ab-mini__name {
  margin-top: 4px;
  min-height: 2.3em;
  display: flex;
  align-items: center;
  font: 800 11px/1.15 var(--ab-display);
  overflow-wrap: anywhere;
}
.ab-mini__tier { margin-top: 3px; font: 800 8.5px/1 var(--ab-display); letter-spacing: .14em; text-transform: uppercase; color: var(--tier); }
.ab-mini__equip {
  pointer-events: auto;
  appearance: none;
  border: 0;
  margin-top: 8px;
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 12px;
  font: 800 11px/1 var(--ab-display) !important;
  letter-spacing: .08em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #ffad4a, #f2660f);
  box-shadow: 0 4px 0 var(--ab-orange-lo), inset 0 2px 0 rgba(255, 255, 255, .45);
  transition: transform .2s var(--ab-spring), box-shadow .2s, background .2s;
}
.ab-mini__equip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ab-orange-lo), inset 0 2px 0 rgba(255, 255, 255, .45); }
.ab-mini__check { width: 13px !important; height: 13px !important; display: none !important; }
.ab-mini__equip.is-equipped {
  cursor: default;
  background: rgba(4, 8, 30, .5);
  box-shadow: inset 0 0 0 1.5px rgba(120, 230, 160, .55);
  color: #8ff0b4;
}
.ab-mini__equip.is-equipped { font-size: 10px !important; letter-spacing: .04em; }
.ab-minis.is-single .ab-mini__equip.is-equipped .ab-mini__check { display: block !important; }

.ab-over__actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.ab-over__actions .ab-btn { padding: 0 12px; }
.ab-over__actions.is-solo { grid-template-columns: 1fr; }   /* stage 1: AGAIN only */
.ab-over__apples .ab-svg { color: #ff5a5a; }
/* Shine sweep on AGAIN once it is live (a pseudo-element, so the button
   itself never moves and stays an easy, stable target). */
.ab-over__again::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .34) 50%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
}
.ab-over.is-armed .ab-over__again::after { animation: ab-sheen 2.6s ease-in-out .2s infinite; }

/* ======================================================================
   Unlock toast
   ====================================================================== */
.ab-toasts {
  position: absolute;
  left: 0;
  right: 0;
  /* Under the canvas HUD's score + BEST line (~108 world units = 30cqi). */
  top: calc(var(--sat) + 116px);
  top: calc(var(--sat) + 30cqi);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none !important;
  z-index: 30;
}
.ab-toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 6px 20px 6px 6px;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(38, 50, 112, .96) 0%, rgba(17, 24, 64, .96) 100%);
  box-shadow:
    inset 0 0 0 2px var(--tier-ring),
    inset 0 2px 0 rgba(255, 255, 255, .14),
    0 6px 0 rgba(4, 7, 24, .8),
    0 14px 30px rgba(0, 0, 0, .45),
    0 0 30px var(--tier-glow);
  opacity: 0;
  transform: translateY(-34px) scale(.6);
}
.ab-toast.is-in { opacity: 1; transform: none; transition: transform .45s var(--ab-spring-big), opacity .18s ease; }
.ab-toast.is-out { opacity: 0; transform: translateY(-26px) scale(.86); transition: transform .3s var(--ab-in), opacity .28s ease; }
.ab-toast__icons { display: flex; flex: none; }
.ab-toast__icon {
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tier-glow), rgba(6, 10, 34, .7));
  box-shadow: inset 0 0 0 1.5px var(--tier-ring);
}
.ab-toast.is-in .ab-toast__icon { animation: ab-wiggle .7s var(--ab-spring) .25s; }
.ab-toast__icons .ab-toast__icon + .ab-toast__icon { margin-left: -14px; }
.ab-toast__text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ab-toast__kicker { font: 800 9.5px/1 var(--ab-display); letter-spacing: .18em; color: var(--tier); }
.ab-toast__name {
  font: 800 15px/1.05 var(--ab-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-toast__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .22) 50%, transparent 62%);
  background-size: 260% 100%;
  background-position: 130% 0;
}
.ab-toast.is-in .ab-toast__shine { animation: ab-sheen 1.2s ease-out .3s 1; }
.ab-toast--tier .ab-toast__icons .ab-toast__icon + .ab-toast__icon { margin-left: -9px; }
.ab-toast--tier .ab-toast__kicker { color: var(--ab-gold); }
.ab-toast--small { gap: 8px; padding: 4px 16px 4px 4px; }
.ab-toast--small .ab-toast__text { gap: 4px; }
.ab-toast--small .ab-toast__kicker { font-size: 8.5px; }
.ab-toast--small .ab-toast__name { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ab-toast--note { padding: 9px 18px; }

/* ======================================================================
   Locker: "The Orchard"
   ====================================================================== */
.ab-locker {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: auto;
  overscroll-behavior: contain;
}
.ab-locker__scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 18, .65);
  opacity: 0;
  transition: opacity .3s ease;
}
.ab-locker.is-in .ab-locker__scrim { opacity: 1; }
.ab-locker__sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(90% 40% at 50% 0%, rgba(255, 130, 40, .12), transparent 70%),
    radial-gradient(120% 60% at 50% 0%, rgba(90, 115, 255, .22), transparent 70%),
    linear-gradient(180deg, #121a44 0%, #0b1131 55%, #080c25 100%);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
  transform: translateY(104%);
  transition: transform .55s cubic-bezier(.18, 1.25, .35, 1);
  will-change: transform;
}
.ab-locker.is-in .ab-locker__sheet { transform: none; }
.ab-locker.is-out .ab-locker__sheet { transform: translateY(104%); transition: transform .3s var(--ab-in); }
.ab-locker__sheet.is-dragging { transition: none !important; }

.ab-locker__head {
  position: relative;
  flex: none;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 14px) 12px calc(var(--sal) + 16px);
  touch-action: none;
  cursor: grab;
  border-bottom: 1px solid var(--ab-line);
  background: linear-gradient(180deg, rgba(36, 49, 111, .5), rgba(18, 26, 68, 0));
}
.ab-grabber {
  position: absolute;
  top: calc(var(--sat) + 7px);
  left: 50%;
  width: 42px;
  height: 5px;
  margin-left: -21px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .22);
}
.ab-locker__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }
.ab-locker__titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ab-kicker {
  font: 800 9.5px/1 var(--ab-display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ab-orange-hi);
}
.ab-locker__title {
  margin: 0;
  font: 800 24px/1 var(--ab-display);
  color: #fff;
  text-shadow: 0 3px 0 #23307a, 0 6px 14px rgba(0, 0, 0, .4);
}
.ab-locker__count { font: 600 12.5px/1 var(--ab-body); color: var(--ab-ink-2); font-variant-numeric: tabular-nums; white-space: pre; }
.ab-locker__close { flex: none; }
.ab-locker__btns { display: flex; gap: 8px; flex: none; }
.ab-locker__stats .ab-show-stats { display: none; }
.ab-locker__sheet.is-stats .ab-locker__stats .ab-show-apples { display: none; }
.ab-locker__sheet.is-stats .ab-locker__stats .ab-show-stats { display: block; }
.ab-locker__chase { margin-top: 12px; }
/* Konami cheat on: one line under the chase strip */
.ab-locker__cheat {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  font: 600 12.5px/1.3 var(--ab-body);
  color: var(--ab-gold);
  background: rgba(255, 201, 52, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 201, 52, .35);
}

.ab-locker__scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 2px calc(var(--sar) + 12px) calc(var(--sab) + 24px) calc(var(--sal) + 12px);
}
.ab-orchard { display: flex; flex-direction: column; }

/* Scrollbars in the picker and the apple sheet: a slim pill in the line
   color on a clear track, no arrows. Phones keep their own overlay bars;
   this is what a mouse user sees instead of the gray system bar. */
.ab-locker__scroll, .ab-detail__sheet {
  scrollbar-width: thin;
  scrollbar-color: rgba(150, 172, 255, .3) transparent;
}
.ab-locker__scroll::-webkit-scrollbar, .ab-detail__sheet::-webkit-scrollbar { width: 10px; }
.ab-locker__scroll::-webkit-scrollbar-track, .ab-detail__sheet::-webkit-scrollbar-track { background: transparent; }
.ab-locker__scroll::-webkit-scrollbar-button, .ab-detail__sheet::-webkit-scrollbar-button { display: none; }
.ab-locker__scroll::-webkit-scrollbar-thumb, .ab-detail__sheet::-webkit-scrollbar-thumb {
  background: rgba(150, 172, 255, .3) padding-box;
  border: 3px solid transparent;
  border-radius: 99px;
}
.ab-locker__scroll::-webkit-scrollbar-thumb:hover, .ab-detail__sheet::-webkit-scrollbar-thumb:hover { background-color: rgba(150, 172, 255, .5); }

/* Stats (the chart button in the picker header) */
.ab-stats { display: flex; flex-direction: column; gap: 22px; padding: 14px 4px 8px; }
.ab-stats__tops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ab-stats__top {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px 12px;
  border-radius: 16px;
  background: rgba(4, 8, 30, .45);
  box-shadow: inset 0 0 0 1px rgba(150, 172, 255, .14);
  min-width: 0;
}
.ab-stats__top b { font: 800 22px/1 var(--ab-display); color: #fff; font-variant-numeric: tabular-nums; }
.ab-stats__top span { font: 600 12px/1.2 var(--ab-body); color: var(--ab-muted); }
.ab-stats__sec { display: flex; flex-direction: column; }
.ab-stats__h { margin: 0 0 4px; font: 800 10px/1 var(--ab-display); letter-spacing: .2em; text-transform: uppercase; color: var(--ab-ink-2); }
.ab-stats__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--ab-line);
  font: 500 14px/1.2 var(--ab-body);
  color: var(--ab-ink-2);
}
.ab-stats__row b { font: 700 14px/1.2 var(--ab-body); color: #fff; font-variant-numeric: tabular-nums; }
.ab-stats__note { margin: 6px 0 12px; font: 500 13px/1.4 var(--ab-body); color: var(--ab-muted); }
.ab-stats__btns, .ab-stats__confirm { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-stats__confirm { margin-top: 10px; }
.ab-stats__btn { min-height: 46px; padding: 0 16px; border-radius: 14px; font-size: 13px !important; }
.ab-stats__btn:not(.ab-btn--primary) {
  background: linear-gradient(180deg, #33438a 0%, #222e68 100%);
  box-shadow: 0 4px 0 #0b1132, inset 0 2px 0 rgba(255, 255, 255, .16), inset 0 0 0 1.5px rgba(150, 172, 255, .18);
}
.ab-stats__code {
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
  width: 100%;
  margin: 14px 0 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  resize: none;
  background: rgba(4, 8, 30, .6);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .22);
  color: #fff;
  font: 500 16px/1.35 ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
}
.ab-stats__code::placeholder { color: var(--ab-muted); font-family: var(--ab-body); }
.ab-ui .ab-stats__code:focus { outline: none; box-shadow: inset 0 0 0 2px #ffd76a; }
.ab-stats__msg { margin: 10px 0 0; min-height: 1.35em; font: 600 13px/1.35 var(--ab-body); color: #7dffa8; }
.ab-stats__msg.is-bad { color: #ffb347; }

/* Tier dividers */
.ab-tdiv { display: flex; align-items: center; gap: 10px; padding: 14px 4px 6px; }
.ab-tdiv__k { flex: none; font: 800 10px/1 var(--ab-display); letter-spacing: .2em; color: var(--ab-ink-2); }
.ab-tdiv__line { flex: 1; min-width: 10px; height: 1px; background: var(--ab-line); }
.ab-tdiv__need { flex: none; font: 600 11.5px/1 var(--ab-body); color: var(--ab-muted); white-space: nowrap; }
.ab-tdiv__bar { flex: none; width: 52px; height: 4px; }
.ab-tdiv.is-locked .ab-tdiv__k { color: var(--ab-muted); }

/* Locked tiers past the next one, folded into one row */
.ab-tsec--fold { padding: 14px 0 4px; }
.ab-tfold {
  appearance: none;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 13px;
  border: 0;
  border-radius: 16px;
  background: rgba(4, 8, 30, .35);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .14);
  color: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  transition: background .2s, transform .2s var(--ab-spring);
}
.ab-tfold:hover { background: rgba(20, 28, 70, .5); }
.ab-tfold:active { transform: scale(.985); }
.ab-tfold__head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ab-tfold .ab-tdiv__k { color: var(--ab-muted); }
.ab-tfold__txt { flex: 1; min-width: 0; font: 600 12px/1.25 var(--ab-body); color: var(--ab-muted); }
.ab-tfold__show { flex: none; font: 800 10px/1 var(--ab-display); letter-spacing: .14em; color: var(--ab-orange-hi); text-transform: uppercase; }
.ab-tfold__icons { display: flex; flex-wrap: wrap; gap: 2px; }
.ab-tfold__icon { opacity: .9; }

/* Tiles: one size, one look; state shows through the apple and one mark.
   Every tier holds four apples, so four columns (a full row per tier, never
   3 + 1). Under 360px the names no longer fit four across: two. */
.ab-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
/* Tier 0: the starter apple alone, centered, one column wide */
.ab-tiles--solo { display: flex; justify-content: center; }
.ab-tiles--solo .ab-tile { flex: 0 0 calc((100% - 12px) / 4); }
@container abui (max-width: 359px) {
  .ab-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-tiles--solo .ab-tile { flex-basis: calc((100% - 4px) / 2); }
}
.ab-tile {
  appearance: none;
  border: 0;
  margin: 0;
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 2px 6px;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
  transition: background .2s ease, transform .25s var(--ab-spring);
}
.ab-tile:active { transform: scale(.94); background: rgba(255, 255, 255, .05); }
@media (hover: hover) { .ab-tile:hover { background: rgba(255, 255, 255, .04); } }
.ab-locker.is-in .ab-tile { animation: ab-rise .45s var(--ab-spring) both; animation-delay: calc(.06s + var(--i) * .018s); }
.ab-tile__art { position: relative; display: grid; place-items: center; width: 64px; height: 64px; }
.ab-tile__ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ab-tile__track { fill: none; stroke: rgba(150, 172, 255, .14); stroke-width: 2.5; }
.ab-tile__arc { fill: none; stroke: rgba(225, 232, 255, .6); stroke-width: 2.5; stroke-linecap: round; }
.ab-tile__eq { fill: none; stroke: none; stroke-width: 1.5; }
.ab-tile.is-equipped .ab-tile__eq { stroke: rgba(255, 178, 63, .8); }
.ab-tile.is-target .ab-tile__track { stroke: rgba(255, 178, 63, .22); }
.ab-tile.is-target .ab-tile__arc { stroke: var(--ab-accent); stroke-width: 3.5; filter: drop-shadow(0 0 3px rgba(255, 178, 63, .55)); }
.ab-tile__apple { position: relative; }
.ab-tile.is-avail .ab-tile__apple { filter: saturate(.5) brightness(.68); }
.ab-tile.is-target .ab-tile__apple { filter: saturate(.8) brightness(.9); }
.ab-tile.is-locked .ab-tile__apple { opacity: .85; }
.ab-tile__dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ab-accent);
  box-shadow: 0 0 0 2.5px #0f1538, 0 0 8px rgba(255, 178, 63, .55);
}
.ab-tile__dot.is-new { background: #ff4a4a; box-shadow: 0 0 0 2.5px #0f1538, 0 0 8px rgba(255, 60, 60, .6); }
.ab-tile__name {
  max-width: 100%;
  min-height: 2.36em;
  font: 700 11.5px/1.18 var(--ab-body);
  color: #fff;
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ab-tile.is-avail .ab-tile__name { color: var(--ab-ink-2); }
.ab-tile.is-locked .ab-tile__name { color: var(--ab-muted); }
.ab-tile.is-pop { animation: ab-pop .5s var(--ab-spring) both !important; }
.ab-tile.is-nudge .ab-tile__art { animation: ab-nudge .6s var(--ab-spring) both; }

/* Detail sheet: one per apple, one button */
.ab-detail { position: absolute; inset: 0; z-index: 5; }
.ab-detail__scrim { position: absolute; inset: 0; background: rgba(3, 5, 18, .62); opacity: 0; transition: opacity .25s ease; }
.ab-detail.is-in .ab-detail__scrim { opacity: 1; }
.ab-detail.is-out .ab-detail__scrim { opacity: 0; }
.ab-detail__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100% - var(--sat) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px calc(var(--sar) + 20px) calc(var(--sab) + 16px) calc(var(--sal) + 20px);
  border-radius: 28px 28px 0 0;
  text-align: center;
  background:
    radial-gradient(90% 55% at 50% 0%, var(--tier-tint), transparent 70%),
    linear-gradient(180deg, #1c275c 0%, #121a44 100%);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5), inset 0 1.5px 0 rgba(255, 255, 255, .12);
  transform: translateY(105%);
  transition: transform .5s cubic-bezier(.18, 1.25, .35, 1);
}
.ab-detail.is-in .ab-detail__sheet { transform: none; }
.ab-detail.is-out .ab-detail__sheet { transform: translateY(105%); transition: transform .26s var(--ab-in); }
.ab-detail__sheet.is-dragging { transition: none !important; }
.ab-detail__sheet .ab-grabber { top: 8px; }
.ab-detail__close { position: absolute; top: 12px; right: calc(var(--sar) + 12px); }
.ab-detail__body { display: flex; flex-direction: column; align-items: center; }
.ab-detail__stage { position: relative; width: 128px; height: 128px; margin-top: 2px; }
.ab-detail__halo { position: absolute; inset: 10px; border-radius: 50%; background: radial-gradient(closest-side, var(--tier-glow), transparent); }
.ab-detail__sheet.is-locked .ab-detail__halo { background: radial-gradient(closest-side, rgba(0, 0, 0, .4), transparent); }
.ab-detail__canvas { position: relative; display: block; }
.ab-detail__name { margin: 2px 0 0; font: 800 21px/1.1 var(--ab-display); color: #fff; }
.ab-detail__meta {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 0;
  font: 600 11.5px/1.3 var(--ab-body);
  color: var(--ab-muted);
}
.ab-detail__meta > span + span::before { content: '\00b7'; margin: 0 8px; color: rgba(143, 155, 200, .6); }
.ab-detail__tier { margin: 5px 0 0; font: 600 11.5px/1.3 var(--ab-body); color: var(--ab-muted); }
.ab-detail__rarity { font: 800 9.5px/1.3 var(--ab-display); letter-spacing: .16em; text-transform: uppercase; color: var(--tier); }
.ab-detail__blurb { margin: 16px 0 0; max-width: 300px; font: 500 14.5px/1.45 var(--ab-body); color: var(--ab-ink-2); text-wrap: balance; }
.ab-detail__goal {
  align-self: stretch;
  margin-top: 16px;
  padding: 12px 14px 13px;
  border-radius: 16px;
  text-align: left;
  background: rgba(4, 8, 30, .45);
  box-shadow: inset 0 0 0 1px rgba(150, 172, 255, .12);
}
.ab-detail__goalrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ab-detail__goaltext { font: 700 14px/1.3 var(--ab-body); color: #fff; }
.ab-detail__count { font: 800 13px/1 var(--ab-display); color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-detail__bar { margin-top: 10px; height: 6px; }
.ab-detail__sheet.is-locked .ab-detail__goaltext, .ab-detail__sheet.is-locked .ab-detail__count { color: var(--ab-muted); }
.ab-detail__sheet.is-locked .ab-detail__bar .ab-bar__fill { background: rgba(150, 172, 255, .3); box-shadow: none; }
.ab-detail__btn { align-self: stretch; margin-top: 18px; }
.ab-detail__note { margin: 10px 0 0; font: 500 12.5px/1.35 var(--ab-body); color: var(--ab-muted); }
.ab-detail__sheet.is-shake { animation: ab-shake .42s ease both; }

/* Disabled buttons (Equipped, Chasing, Opens at ...): same shape, quiet */
.ab-btn[disabled] {
  cursor: default;
  color: var(--ab-ink-2);
  text-shadow: none;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .2);
  filter: none;
  transform: none;
}
.ab-btn[disabled] .ab-svg { filter: none; }
.ab-btn.is-pop { animation: ab-pop .45s var(--ab-spring) both; }

/* ======================================================================
   Dialog (menus.js): a card over a scrim. The save link prompt uses it.
   ====================================================================== */
.ab-dialog {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  pointer-events: auto;
}
.ab-dialog__scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 18, .74);
  opacity: 0;
  transition: opacity .3s ease;
}
.ab-dialog.is-in .ab-dialog__scrim { opacity: 1; }
.ab-dialog.is-out .ab-dialog__scrim { opacity: 0; transition-duration: .22s; }
.ab-dialog__card {
  position: relative;
  width: 100%;
  max-width: 344px;
  padding: 20px 20px 18px;
  border-radius: 28px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 170, 60, .16), transparent 62%),
    linear-gradient(180deg, #1d2860 0%, #131b45 58%, #0f163a 100%);
  box-shadow:
    0 0 0 2px rgba(255, 190, 70, .3),
    0 8px 0 #070b24,
    0 28px 60px rgba(0, 0, 0, .55),
    inset 0 2px 0 rgba(255, 255, 255, .14);
  opacity: 0;
  transform: translateY(50px) scale(.88);
  transition: transform .55s var(--ab-spring-big), opacity .18s ease;
}
.ab-dialog.is-in .ab-dialog__card { opacity: 1; transform: none; }
.ab-dialog.is-out .ab-dialog__card { opacity: 0; transform: translateY(24px) scale(.94); transition: transform .22s var(--ab-in), opacity .2s ease; }
.ab-dialog__card.is-step > * { animation: ab-fadeup .38s var(--ab-out) both; }
.ab-dialog__card.is-step > :nth-child(2) { animation-delay: .04s; }
.ab-dialog__card.is-step > :nth-child(3) { animation-delay: .08s; }
.ab-dialog__card.is-step > :nth-child(4) { animation-delay: .12s; }
.ab-dialog__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ab-dialog__title {
  margin: 12px 0 14px;
  font: 800 20px/1.15 var(--ab-display);
  color: #fff;
  text-shadow: 0 2px 0 #1a2462;
}
.ab-dialog__body { margin: 14px 0 0; font: 500 14.5px/1.45 var(--ab-body); color: var(--ab-ink-2); }
.ab-dialog__note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  font: 600 12.5px/1.4 var(--ab-body);
  color: #ffd76a;
  background: rgba(255, 201, 52, .08);
  box-shadow: inset 0 0 0 1px rgba(255, 201, 52, .25);
}
.ab-dialog__actions { display: flex; gap: 10px; margin-top: 18px; }
.ab-dialog__go { flex: 1; min-height: 52px; }
.ab-dialog__go .ab-svg { width: 18px; height: 18px; }
.ab-dialog__alt {
  appearance: none;
  border: 0;
  min-height: 52px;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1.5px rgba(150, 172, 255, .18);
  color: var(--ab-ink-2);
  font: 800 13px/1 var(--ab-display) !important;
  letter-spacing: .08em;
  cursor: pointer;
  pointer-events: auto;
}
.ab-dialog__alt:active { transform: scale(.96); }
/* Save link dialog (menus.js askLink): the two saves, one above the other */
.ab-linkcmp { margin-top: 14px; display: grid; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(4, 8, 30, .45); box-shadow: inset 0 0 0 1px rgba(150, 172, 255, .14); }
.ab-linkcmp__row { display: flex; flex-direction: column; gap: 5px; }
.ab-linkcmp__k { font: 800 10px/1 var(--ab-display); letter-spacing: .14em; color: var(--ab-muted); }
.ab-linkcmp__v { font: 700 14px/1.3 var(--ab-body); color: #fff; }
.ab-linkcmp__v span { white-space: nowrap; }

/* ======================================================================
   Short screens (e.g. 375x667): tighten vertical rhythm
   ====================================================================== */
@container abui (max-height: 700px) {
  .ab-title { top: calc(var(--sat) + 7cqh); }
  .ab-title__mark { width: 52px; height: 52px; }
  .ab-title__mark canvas { width: 52px !important; height: 52px !important; }
  .ab-title__best, .ab-title__tag { margin-top: 12px; }
  .ab-over { padding-top: calc(var(--sat) + 60px); padding-bottom: calc(var(--sab) + 78px); }
  .ab-over__card { padding: 16px 14px 14px; }
  .ab-over__score { margin: 4px 0 6px; font-size: 52px; }
  .ab-over__new { margin-top: 10px; }
  .ab-over__prog { margin-top: 10px; }
  .ab-over__actions { margin-top: 12px; }
  .ab-over__card.has-new .ab-over__score { font-size: 44px; }
  .ab-over__card.has-new .ab-over__burst { top: 70px; }
  .ab-over__card.has-new .ab-mini__no { display: none; }
  .ab-over__card.has-new .ab-chase__goal { display: none; }
  .ab-dialog__title { font-size: 18px; margin: 10px 0 12px; }
  .ab-dialog__body { font-size: 13.5px; }
}
@container abui (max-height: 600px) {
  .ab-over__card.has-new .ab-tline { display: none; }
}

/* ======================================================================
   Keyframes
   ====================================================================== */
@keyframes ab-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes ab-wave { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -7px; } 90% { translate: 0 1px; } }
@keyframes ab-ping { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(2); opacity: 0; } }
@keyframes ab-spin { to { rotate: 360deg; } }
@keyframes ab-sheen { 0% { background-position: 130% 0; } 60%, 100% { background-position: -30% 0; } }
@keyframes ab-thump { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes ab-wiggle { 0% { transform: rotate(0); } 25% { transform: rotate(-16deg) scale(1.1); } 55% { transform: rotate(10deg); } 100% { transform: rotate(0); } }
@keyframes ab-rise { from { opacity: 0; transform: translateY(26px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes ab-pop { 0% { transform: scale(1); } 30% { transform: scale(.92); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes ab-shake { 0%, 100% { translate: 0 0; } 20% { translate: -7px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 2px 0; } }
@keyframes ab-newpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes ab-callout { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.035); } 90% { transform: scale(.995); } }
@keyframes ab-nudge { 0% { transform: scale(1); } 30% { transform: scale(1.08); } 55% { transform: scale(.97); } 100% { transform: scale(1); } }
@keyframes ab-picked { 0% { transform: scale(1); } 25% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes ab-fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ======================================================================
   Reduced motion: no bounces, slides, spins or sheens. Fades stay.
   ====================================================================== */
