/* Cat Bakery — page shell and HUD. HUD is laid out in design px (390 wide) and scaled as one block. */
@font-face { font-family: 'Fredoka'; src: url('../vendor/fonts/Fredoka-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: block; }
@font-face { font-family: 'Fredoka'; src: url('../vendor/fonts/Fredoka-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: block; }
@font-face { font-family: 'Fredoka'; src: url('../vendor/fonts/Fredoka-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: block; }

/* Theme colours are overwritten from render/theme.js at boot. Every var below but --page is only ever read by
   HUD elements hud.js creates at boot, so its pre-boot default is never actually painted and is left at the
   DAY values (palette C) it has always had. --page alone paints before any JS runs (body/#app's background),
   so HANDOFF.md item D5 (Minh: back to violet, not day blue) needs it correct here too: the DEFAULT below is
   now violet's (THEMES.violet.css.page); ?theme=day swaps the whole palette, --page included, at boot. */
:root {
  --ink: #1d2f4f; --text: #fffaf0; --page: #5b4a9e;
  --bar: #8fe6cb; --bar-hi: #c9f6e8; --bar-lo: #5ccaa9; --bar-edge: #3aa487;
  --btn: #ffffff; --btn-hi: #ffffff; --btn-lo: #cfe0ea;
  --btn-locked: #c7d6e4; --btn-locked-lo: #9db2c6; --btn-locked-hi: #eaf3fa; --lock-shade: rgba(28,58,88,.22);
  --primary: #32caa0; --primary-hi: #7be6c8; --primary-lo: #1c9577;
  --pill: #ffffff; --pill-lo: #cfe0ea; --pill-border: #32caa0;
  --coin-pill: #3fbd9c; --coin-pill-lo: #278f74;
  --badge: #ffffff; --badge-text: #1d2f4f; --plus: #32caa0; --lock-tag: #27405f;
  --o2: 0 0 0 transparent; --o25: 0 0 0 transparent; --o3: 0 0 0 transparent; /* outline shadows, set by hud.js */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--page);
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; overflow: hidden; background: var(--page); }
#stage, #labels { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { pointer-events: none; }
#safe-probe {
  position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}

.hud {
  position: absolute; left: 0; top: 0; width: 390px; height: 844px; transform-origin: 0 0; pointer-events: none;
  font-family: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif; font-weight: 700; color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hud button {
  pointer-events: auto; font: inherit; color: inherit; border: 0; padding: 0; margin: 0; background: none; cursor: pointer;
  -webkit-appearance: none; appearance: none; outline: none;
}
.hud img { display: block; pointer-events: none; -webkit-user-drag: none; }

/* Display text: light fill with a dark round outline and a short drop (built from text-shadows). */
.st { white-space: nowrap; line-height: 1; letter-spacing: 0.01em; text-shadow: var(--o25); }
.st.s2 { text-shadow: var(--o2); }
.st.s3 { text-shadow: var(--o3); }

/* ── top bar ───────────────────────────────────────────────────────────── */
.hud-top { position: absolute; left: 12px; right: 12px; top: 8px; height: 50px; }
.hud .gear {
  position: absolute; left: 0; top: 1px; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(115% 115% at 32% 22%, var(--primary-hi) 0%, var(--primary) 46%, var(--primary-lo) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), inset 0 -3px 0 rgba(0,0,0,.10),
    0 4px 0 0 var(--primary-lo), 0 0 0 2.5px var(--ink), 0 4px 0 2.5px var(--ink), 0 9px 10px rgba(22,10,60,.30);
  display: grid; place-items: center;
}
.gear svg { width: 30px; height: 30px; display: block; }
.gear:active, .booster:active .disc { transform: translateY(3px); }

.level {
  position: absolute; left: 50%; top: 3px; transform: translateX(-50%); height: 42px; padding: 0 23px; border-radius: 21px;
  background: var(--pill-border);
  box-shadow: 0 4px 0 0 var(--primary-lo), 0 0 0 2.5px var(--ink), 0 4px 0 2.5px var(--ink), 0 9px 10px rgba(22,10,60,.28);
  display: grid; place-items: center; font-size: 22px;
}
.level::before {
  content: ''; position: absolute; inset: 3.5px; border-radius: 18px;
  background: linear-gradient(180deg, #fffdf6 0%, var(--pill) 48%, var(--pill-lo) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.95), inset 0 -2px 0 rgba(160,110,60,.18), 0 0 0 1.5px rgba(20,60,50,.35);
}
.level .st { position: relative; top: -0.5px; }

.coins {
  position: absolute; right: 2px; top: 6px; height: 36px; min-width: 96px; padding: 0 14px 0 42px; border-radius: 18px;
  background: linear-gradient(180deg, var(--primary-hi) 0%, var(--coin-pill) 38%, var(--coin-pill-lo) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 0 var(--primary-lo), 0 0 0 2.5px var(--ink), 0 4px 0 2.5px var(--ink), 0 9px 10px rgba(22,10,60,.28);
  display: flex; align-items: center; justify-content: flex-end; font-size: 20px;
}
.coins img { position: absolute; left: -7px; top: -5px; width: 46px; height: 46px; filter: drop-shadow(0 2px 0 rgba(35,26,69,.55)); }
.coins .st { position: relative; top: -0.5px; }

/* ── bottom bar ────────────────────────────────────────────────────────── */
.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 84px; }
.bar {
  position: absolute; left: -2000px; right: -2000px; top: 24px; bottom: -200px;
  background: linear-gradient(180deg, var(--bar-hi) 0px, var(--bar-hi) 5px, var(--bar) 6px, var(--bar) 46%, var(--bar-lo) 100%);
  box-shadow: 0 -2.5px 0 0 var(--ink), 0 -9px 14px rgba(22,10,60,.22), inset 0 6.5px 0 0 rgba(0,0,0,0), inset 0 7.5px 0 -1px rgba(20,90,70,.25);
}
/* Item H's Fix 1 (2026-10-09): five buttons at the old 66px width / 23px gap overflow the 390px HUD column
   (5*66 + 4*23 = 422, 16px past each edge with zero margin - a real regression from the four-booster bar,
   which fit with 28.5px slack each side). 60px/14px fits with room to spare (5*60 + 4*14 = 356, 17px margin
   each side, clear of the required >=8px floor - see view.js's own holdGeometry for the same convention) -
   pinned by tests/ui-booster-bar.test.mjs, which reads these two numbers back out of this file. */
.boosters { position: absolute; left: 0; right: 0; top: 4px; height: 70px; display: flex; justify-content: center; gap: 14px; }
.booster { position: relative; width: 60px; height: 70px; }
.disc {
  position: absolute; left: 0; top: 0; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(115% 115% at 34% 22%, var(--btn-hi) 0%, var(--btn) 52%, var(--btn-lo) 100%);
  box-shadow: inset 0 2.5px 0 rgba(255,255,255,.95), inset 0 -5px 7px rgba(170,120,60,.22), inset 0 0 0 3px rgba(255,255,255,.35),
    0 5px 0 0 var(--btn-lo), 0 0 0 2.5px var(--ink), 0 5px 0 2.5px var(--ink), 0 11px 10px rgba(10,70,55,.35);
  display: grid; place-items: center;
}
.disc img { width: 50px; height: 50px; margin-top: -1px; filter: drop-shadow(0 2px 1px rgba(60,30,20,.28)); }
.booster.is-locked .disc {
  background: radial-gradient(115% 115% at 34% 22%, var(--btn-locked-hi) 0%, var(--btn-locked) 55%, var(--btn-locked-lo) 100%);
  box-shadow: inset 0 2.5px 0 rgba(255,255,255,.6), inset 0 -5px 7px var(--lock-shade),
    0 5px 0 0 var(--btn-locked-lo), 0 0 0 2.5px var(--ink), 0 5px 0 2.5px var(--ink), 0 11px 10px rgba(10,70,55,.35);
}
.booster.is-locked .disc img { filter: grayscale(.82) brightness(.96) contrast(.9); opacity: .58; }

.badge {
  position: absolute; right: -6px; bottom: 1px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  background: linear-gradient(180deg, #ffffff, var(--badge));
  box-shadow: 0 2.5px 0 0 var(--btn-lo), 0 0 0 2.3px var(--ink), 0 2.5px 0 2.3px var(--ink);
  display: grid; place-items: center; font-size: 16px; line-height: 1; color: var(--badge-text);
}
.badge.plus {
  background: radial-gradient(120% 120% at 34% 22%, var(--primary-hi) 0%, var(--plus) 55%, var(--primary-lo) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 2.5px 0 0 var(--primary-lo), 0 0 0 2.3px var(--ink), 0 2.5px 0 2.3px var(--ink);
  padding: 0;
}
.badge.plus svg { width: 16px; height: 16px; display: block; }
.locktag {
  position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); height: 23px; padding: 0 8px 0 5px; border-radius: 10px;
  background: var(--lock-tag); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.16), 0 0 0 2px var(--ink), 0 2px 0 2px var(--ink);
  display: flex; align-items: center; gap: 3px; font-size: 13px; line-height: 1; color: var(--text); white-space: nowrap;
}
.locktag svg { width: 13px; height: 15px; display: block; }

/* A booster that cannot be used right now: one short shake, no state change. */
@keyframes hud-deny { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.booster.is-deny { animation: hud-deny .26s ease-in-out; }
.booster .extra { position: static; display: contents; }
