/* philKit.topbar: one top bar for every game.
   A frosted strip across the top of the screen. A plain back arrow on the left, an optional title in the middle
   and one plain icon on the right. No chips and no circles: the bar is the surface, the icons are just ink.
   The game's art scrolls (or sits) underneath and shows through the frost.

   SKIN TOKENS (set on the bar's root or on :root)
   --kit-bar-tint   the glass colour, translucent (dark worlds: the page's deepest colour at ~55%; light worlds: paper at ~60%)
   --kit-bar-ink    arrow, icon and title colour (near-black on light worlds, ivory on dark ones)
   --kit-bar-line   the hairline under the bar
   --kit-bar-font   the title's font shorthand
   --kit-bar-h      bar height below the status bar (52px; 64px with data-kids for the youngest)
   --kit-bar-z      stacking order */

.pk-bar {
  --kit-bar-tint: rgba(10, 14, 22, .55); --kit-bar-ink: #f6f1e6; --kit-bar-line: rgba(255, 255, 255, .12);
  --kit-bar-font: 700 17px/1 system-ui, sans-serif; --kit-bar-h: 52px;
  position: absolute; inset: 0 0 auto; z-index: var(--kit-bar-z, 20); box-sizing: content-box; height: var(--kit-bar-h);
  /* Inside Lil' Phil the frame runs under the phone's status bar and the app says how far (--kids-inset-top); installed on a phone, the browser does (env). */
  padding: max(env(safe-area-inset-top, 0px), var(--kids-inset-top, 0px)) max(4px, var(--kids-inset-right, 0px)) 0 max(4px, var(--kids-inset-left, 0px));
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px;
  color: var(--kit-bar-ink); background: var(--kit-bar-tint); border-bottom: 1px solid var(--kit-bar-line);
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  user-select: none; -webkit-user-select: none;
}
.pk-bar[hidden] { display: none; }
.pk-bar[data-light] { --kit-bar-tint: rgba(255, 250, 240, .62); --kit-bar-ink: #16181d; --kit-bar-line: rgba(0, 0, 0, .1); }
.pk-bar[data-kids] { --kit-bar-h: 64px; grid-template-columns: 64px minmax(0, 1fr) 64px; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pk-bar { background: color-mix(in srgb, var(--kit-bar-tint) 40%, #0a0e16 60%); }
  .pk-bar[data-light] { background: color-mix(in srgb, var(--kit-bar-tint) 40%, #fffaf0 60%); }
}
/* Clear glass, for a level whose picture must stay whole: no surface, just the two icons, each with a soft shadow so it reads on any art. */
.pk-bar[data-clear] { background: none; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.pk-bar[data-clear] .pk-bar-btn { pointer-events: auto; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)) drop-shadow(0 0 9px rgba(0, 0, 0, .4)); }
.pk-bar[data-clear][data-light] .pk-bar-btn { filter: drop-shadow(0 1px 2px rgba(255, 255, 255, .8)) drop-shadow(0 0 9px rgba(255, 255, 255, .6)); }
.pk-bar-title { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font: var(--kit-bar-font); color: inherit; }

/* A bar button is its glyph and nothing else; the 44px box is only the place a thumb lands. Usable outside the bar too (a HUD). */
.pk-bar-btn, .pk-bar-btn:hover {
  display: grid; place-items: center; box-sizing: border-box; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0;
  border: 0; border-radius: 12px; background: none; box-shadow: none; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity .12s ease-out, transform .12s ease-out;
}
.pk-bar[data-kids] .pk-bar-btn { width: 64px; height: 64px; }
.pk-bar-btn[hidden] { display: none; }
.pk-bar-btn:active { opacity: .55; transform: scale(.92); }
.pk-bar-btn:focus-visible { outline: 2px solid currentColor; outline-offset: -5px; }
.pk-bar-btn svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pk-bar[data-kids] .pk-bar-btn svg { width: 30px; height: 30px; }
.pk-bar-more { grid-column: 3; }
@media (prefers-reduced-motion: reduce) { .pk-bar-btn { transition: none; } .pk-bar-btn:active { transform: none; } }
