/* What every game shares: where things sit on top of it, the house button, and the pause screen. Each game sets the --jyp
   colours to match itself. */

/* The counters, the boss's health and the big messages. Each game colours its own. They stay clear of each other, of the
   buttons, and of a phone's notch. --hud-lines is how many lines the game's counters take. */
:root { --notch: max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); --top: env(safe-area-inset-top, 0px); }
#hud { position: fixed; top: calc(14px + var(--top)); left: max(16px, env(safe-area-inset-left)); font-size: 22px; line-height: 1.4; pointer-events: none; }
#boss {
  position: fixed; top: calc(14px + var(--top)); left: 50%; transform: translateX(-50%); width: min(440px, 100vw - 440px - 2 * var(--notch));
  font-size: 22px; font-weight: 800; text-align: center; pointer-events: none;
}
#boss.hidden { display: none; }
#bossBar { height: 18px; margin-top: 4px; border: 3px solid #fff; border-radius: 12px; overflow: hidden; }
#bossFill { width: 100%; height: 100%; transition: width .3s; }
#msg {
  position: fixed; top: 28%; left: 50%; transform: translate(-50%, -50%); width: max-content; max-width: calc(100vw - 32px);
  font-size: clamp(28px, 6vw, 56px); font-weight: 900; line-height: 1.15; text-align: center; text-wrap: balance;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
@media (max-width: 700px), (max-height: 500px) {
  #hud { top: calc(10px + var(--top)); left: max(12px, env(safe-area-inset-left)); font-size: 16px; }
  #boss { top: calc(10px + var(--top)); width: min(440px, 100vw - 330px - 2 * var(--notch)); font-size: 16px; }
  #bossBar { height: 12px; }
}
/* No room beside the counters on an upright phone, so the boss goes under them */
@media (max-width: 620px) {
  #boss { top: calc(20px + var(--hud-lines, 4) * 22.4px + var(--top)); left: 12px; right: 12px; width: auto; transform: none; }
  #msg { top: max(24%, calc(76px + var(--hud-lines, 4) * 22.4px + var(--top))); transform: translateX(-50%); }
}
/* A phone on its side: messages go between the counters and the buttons */
@media (max-height: 500px) and (min-width: 560px) {
  #msg { top: max(18%, calc(64px + var(--top))); max-width: calc(100vw - 330px - 2 * var(--notch)); font-size: 30px; transform: translateX(-50%); }
}

#homeBtn {
  position: fixed; top: calc(12px + var(--top)); right: max(12px, env(safe-area-inset-right)); z-index: 10; width: 44px; height: 44px; padding: 0; border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, .8); background: var(--jyp-glass); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
#homeBtn:focus-visible { outline: 3px solid var(--jyp-focus); }
/* Phones and tablets have a fullscreen button in that corner already, so this one sits under it */
#fsBtn:not(.hidden) ~ #homeBtn { top: calc(66px + var(--top)); }
body:has(#start:not(.hidden)) #homeBtn, body:has(#win:not(.hidden)) #homeBtn { display: none; }

#pause {
  box-sizing: border-box; width: min(440px, calc(100vw - 32px)); padding: 26px 28px 30px; border: 0; border-radius: 22px; text-align: center;
  background: var(--jyp-card); color: var(--jyp-ink); font: inherit; box-shadow: 0 14px 44px rgba(0, 0, 0, .35); overflow: auto;
}
#pause::backdrop { background: var(--jyp-shade); }
#pause h2 { margin: 0; font-size: 32px; font-weight: 800; }
#pause p { margin: 6px 0 20px; font-size: 17px; }
.pauseRow { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
#pause button {
  flex: 1 1 150px; padding: 14px 20px; border: 0; border-radius: var(--jyp-radius); background: var(--jyp-main); color: var(--jyp-main-ink);
  font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
#pause #leaveBtn { background: var(--jyp-alt); color: var(--jyp-alt-ink); }
#pause button:focus { outline: 4px solid var(--jyp-focus); outline-offset: 3px; }
@media (max-height: 480px) {
  #pause { padding: 16px 20px 20px; }
  #pause h2 { font-size: 24px; }
  #pause p { margin: 2px 0 12px; font-size: 15px; }
  #pause button { padding: 10px 16px; font-size: 18px; }
}
