/* The emote hotbar (public/world/hotbar.mjs), shared by the Restaurant and the Tournament.
   Pixel art from public/assets/hotbar/ (tools/hotbar_art.mjs): every size is a whole number of art px times --s
   (2 or 3 CSS px per art px, set by hotbar.mjs from the viewport), so the panel stays crisp. Layout in art px:
   panel padding 4, strip 7, gap 3, slots 22 square with a --gap of 2 (1 on very narrow phones). */
.hotbar { --s: 2; --gap: 2; --sw: 176; display: block; width: max-content; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.hotbar[hidden] { display: none; }
.hotbar__panel { position: relative; display: grid; gap: calc(var(--s) * 3px); padding: calc(var(--s) * 4px); border: 0 solid transparent; border-image: var(--hb-panel, url(/assets/hotbar/panel.png)) 6 fill / calc(var(--s) * 6px) stretch; image-rendering: pixelated; }
.hotbar__strip { display: block; height: calc(var(--s) * 7px); }
.hotbar__bars { display: block; width: calc(var(--s) * var(--sw) * 1px); height: calc(var(--s) * 7px); image-rendering: pixelated; }
.hotbar__slots { display: flex; gap: calc(var(--s) * var(--gap) * 1px); }
.hotbar__btn { position: relative; display: grid; place-items: center; flex: none; width: calc(var(--s) * 22px); height: calc(var(--s) * 22px); margin: 0; padding: 0; background: none; color: inherit; border: 0 solid transparent; border-image: var(--hb-slot, url(/assets/hotbar/slot.png)) 3 fill / calc(var(--s) * 3px) stretch; image-rendering: pixelated; cursor: pointer; box-shadow: none; }
.hotbar__btn.is-on { border-image-source: var(--hb-slot-on, url(/assets/hotbar/slot-on.png)); }
@media (hover: hover) { .hotbar__btn:hover { filter: brightness(1.14); } }
.hotbar__btn:focus-visible { outline: calc(var(--s) * 1px) solid var(--focus, #f0d878); outline-offset: calc(var(--s) * 1px); }
.hotbar__icon { display: grid; place-items: center; width: calc(var(--s) * 18px); height: calc(var(--s) * 18px); overflow: hidden; pointer-events: none; }
.hotbar__icon canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.hotbar__btn.is-down .hotbar__icon, .hotbar__btn.is-down .hotbar__glyph { transform: translateY(calc(var(--s) * 1px)); }
/* an atlas piece: --gx/--gy/--gw/--gh in art px */
.hotbar__g { display: block; width: calc(var(--s) * var(--gw) * 1px); height: calc(var(--s) * var(--gh) * 1px); background: var(--hb-icons, url(/assets/hotbar/icons.png)) no-repeat calc(var(--s) * var(--gx) * -1px) calc(var(--s) * var(--gy) * -1px) / calc(var(--s) * 72px) calc(var(--s) * 28px); image-rendering: pixelated; pointer-events: none; }
.hotbar__key { position: absolute; right: calc(var(--s) * 2px); bottom: calc(var(--s) * 2px); }
.hotbar__lock { position: absolute; left: calc(var(--s) * 2px); top: calc(var(--s) * 2px); }
.hotbar__prog { position: absolute; left: calc(var(--s) * 2px); top: calc(var(--s) * 2px); width: 0; height: calc(var(--s) * 1px); background: var(--gold, #f6c445); pointer-events: none; }
.hotbar__plus { opacity: 0; }
.hotbar__btn.is-empty:focus-visible .hotbar__plus { opacity: 1; }
@media (hover: hover) { .hotbar__btn.is-empty:hover .hotbar__plus { opacity: 1; } }
/* while the energy refills, the emote icons are greyed; locked or unavailable slots are dimmed */
.hotbar.is-cool .hotbar__btn[data-emote] .hotbar__icon { opacity: 0.5; }
.hotbar__btn.is-locked .hotbar__icon, .hotbar.is-off .hotbar__btn[data-emote] .hotbar__icon { opacity: 0.35; filter: grayscale(1); }
.hotbar.is-off .hotbar__btn[data-emote] { cursor: not-allowed; }
/* a slot not earned yet (slots 4-6): a lock, and a tap says how to earn it */
.hotbar__btn.is-shut { cursor: help; }
.hotbar__btn.is-shut .hotbar__glyph { opacity: 0.55; }
/* a heart lost: the panel shakes in whole art px */
.hotbar__panel.is-hit { animation: hotbar-shake 0.36s steps(1, end); }
@keyframes hotbar-shake {
  0% { transform: translateX(calc(var(--s) * -2px)); } 17% { transform: translateX(calc(var(--s) * 2px)); } 33% { transform: translateX(calc(var(--s) * -1px)); }
  50% { transform: translateX(calc(var(--s) * 1px)); } 67% { transform: translateX(calc(var(--s) * -1px)); } 83%, 100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .hotbar__panel.is-hit { animation: none; } }
/* the side panel (the Tournament's cheer sign) */
.hotbar--side .hotbar__panel { gap: 0; }
.hotbar__tool .hotbar__glyph, .hotbar__edit .hotbar__glyph { margin: auto; }

/* ---------- the Restaurant: fixed, bottom centre, above the safe area ---------- */
.restaurant .hotbar { position: fixed; z-index: 10; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); }
/* neighbours sit above the panel (--hotbar-h: its height, set by hotbar.mjs) */
.restaurant .rhint { bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--hotbar-h, 80px) + 8px); }
.restaurant .rchatbtn { bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--hotbar-h, 80px) + 8px); }
.restaurant .rstatus.is-soon { bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--hotbar-h, 80px) + 12px); }

/* ---------- the Tournament: the middle of the bottom row, the cheer sign beside it ---------- */
.tour .hotbar--hearts { grid-column: 2; grid-row: 1; justify-self: center; }
.tour .hotbar--side { grid-column: 3; grid-row: 1; justify-self: start; align-self: end; }
.tour__foot { bottom: max(16px, env(safe-area-inset-bottom)); }
.tour .tour__bottom { bottom: calc(var(--hotbar-h, 80px) + 32px); }
@media (max-width: 760px) {
  /* phones: the me panel and the sign on one row, the hotbar under them (about 190 px in all) */
  .tour__foot { bottom: max(8px, env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) auto; }
  .tour .tour__bottom, .tour .tour__left { bottom: calc(var(--hotbar-h, 80px) + 116px); }
  .tour__foot > .tme { grid-column: 1; grid-row: 1; }
  .tour .hotbar--side { grid-column: 2; grid-row: 1; align-self: stretch; }
  .tour .hotbar--side .hotbar__panel { height: 100%; align-content: center; }
  .tour .hotbar--hearts { grid-column: 1 / -1; grid-row: 2; }
}
