/* Gameficate cartridge — Top bar (HUD) and footer. */
/* ---------- Top HUD (1920x110) ---------- */
#hud {
  flex: 0 0 var(--hud-h, 110px);
  height: var(--hud-h, 110px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: linear-gradient(180deg, var(--hud-1), var(--hud-2));
  color: var(--hud-fg);
  font-family: var(--font);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 3;
}
.brand {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.company-logo {
  height: 64px;
  max-width: 260px;
  object-fit: contain;
  flex: 0 0 auto;
}
.hud-sep {
  width: 2px;
  height: 56px;
  background: color-mix(in srgb, var(--hud-fg) 18%, transparent);
  border-radius: calc(2px * var(--rs, 1));
  flex: 0 0 auto;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.hud-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 640px;
}
.brand-sub {
  font-size: 17px;
  font-weight: 700;
  opacity: 0.8;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 640px;
}
/* ---------- Right side: score, power-ups, timer and buttons ---------- */
.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 72px;
  min-width: 128px;
  padding: 0 16px;
  border-radius: calc(18px * var(--rs, 1));
  background: color-mix(in srgb, var(--hud-fg) 10%, transparent);
  border: 2px solid color-mix(in srgb, var(--hud-fg) 14%, transparent);
}
.hud-stat .label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.8;
  white-space: nowrap;
}
.hud-stat .value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.05;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hud-stat.score {
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 78%, #fff), var(--gold));
  color: var(--score-fg);
  border-color: rgba(255, 255, 255, 0.4);
  min-width: 160px;
}
.hud-stat.power {
  background: linear-gradient(180deg, color-mix(in srgb, var(--violet) 78%, #fff), var(--violet));
  border-color: rgba(255, 255, 255, 0.35);
  min-width: 156px;
  color: #fff;
}
.hud-stat.power .label span {
  margin-inline-start: 6px;
}
/* The power-up counter is a button (it solves the current question): the label and bar are spans inside it. */
.hud-stat.power .label {
  display: block;
}
.hud-stat.power {
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.hud-stat.power:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}
.hud-stat.power:active {
  transform: translateY(1px) scale(0.98);
}
.hud-stat.power:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}
.pu-bar {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: calc(99px * var(--rs, 1));
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  margin-top: 2px;
}
.pu-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: inherit;
  transition: width 0.45s ease;
}
.pulse {
  animation: pulse 1.1s ease;
}
@keyframes pulse {
  25% {
    transform: scale(1.14);
    box-shadow: 0 0 0 10px rgba(255, 200, 61, 0.35);
  }
  60% {
    transform: scale(0.97);
  }
}
.hud-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--hud-fg) 14%, transparent);
  border: 2px solid color-mix(in srgb, var(--hud-fg) 20%, transparent);
  color: var(--hud-fg);
  transition:
    transform 0.12s,
    background 0.15s,
    opacity 0.15s;
  flex: 0 0 auto;
}
.hud-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--hud-fg) 24%, transparent);
}
.hud-btn:active:not(:disabled) {
  transform: scale(0.93);
}
.hud-btn:disabled {
  opacity: 0.35;
}
.hud-stat.timer {
  min-width: 112px;
  font-variant-numeric: tabular-nums;
}
.hud-stat.timer.low {
  color: #fff;
  background: var(--red);
  border-color: rgba(255, 255, 255, 0.4);
  animation: pulse 1s ease infinite;
}
.hud-stat.timer.up {
  background: color-mix(in srgb, var(--red) 55%, #000);
  color: #fff;
}
.hud-btn.help {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.hud-btn.exit {
  background: var(--red);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  margin-inline-start: 6px;
}
.hud-divider {
  width: 2px;
  height: 56px;
  background: color-mix(in srgb, var(--hud-fg) 15%, transparent);
  margin: 0 2px;
  border-radius: calc(2px * var(--rs, 1));
}

/* ---------- Footer ---------- */
#footer {
  flex: 0 0 var(--foot-h, 40px);
  height: var(--foot-h, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 32px;
  background: var(--foot-bg);
  color: var(--foot-fg);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 3;
  white-space: nowrap;
}
#footText {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* Credits (config/credits.js): the CC BY credits stay visible; "Credits" opens the full list. */
.foot-credits {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}
#footCredit {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#creditsBtn {
  flex: 0 0 auto;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--foot-fg) 45%, transparent);
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
#creditsBtn:hover,
#creditsBtn:focus-visible {
  background: color-mix(in srgb, var(--foot-fg) 18%, transparent);
  outline: none;
}

/* ---------- Power-up guide (js/ui/PowerUpGuide.js) ---------- */
/* First game only: the ⚡ button glows and wiggles to show it can be tapped. */
.hud-stat.power.pu-intro {
  animation: pu-intro 1.6s ease-in-out infinite;
}
@keyframes pu-intro {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 200, 61, 0.75),
      0 0 18px 2px rgba(255, 200, 61, 0.55);
    transform: scale(1);
  }
  45% {
    box-shadow:
      0 0 0 14px rgba(255, 200, 61, 0),
      0 0 34px 8px rgba(255, 200, 61, 0.8);
    transform: scale(1.08) rotate(-2deg);
  }
  60% {
    transform: scale(1.08) rotate(2deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hud-stat.power.pu-intro {
    animation: none;
    box-shadow: 0 0 0 5px var(--gold);
  }
}
/* Speech bubble under the ⚡ button; --arrow-x (set in JS) puts the arrow under the button's centre. */
.pu-tip {
  position: absolute;
  z-index: 60;
  width: max-content;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px 14px 18px;
  border-radius: calc(18px * var(--rs, 1));
  background: var(--violet);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  box-shadow: 0 14px 34px rgba(10, 25, 40, 0.3);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
}
.pu-tip.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.pu-tip.intro {
  border: 3px solid var(--gold);
}
.pu-tip-arrow {
  position: absolute;
  top: -9px;
  left: calc(var(--arrow-x, 50%) - 10px);
  width: 20px;
  height: 20px;
  background: inherit;
  border-radius: 3px;
  transform: rotate(45deg);
}
.pu-tip.intro .pu-tip-arrow {
  border-top: 3px solid var(--gold);
  border-left: 3px solid var(--gold);
  top: -12px;
}
.pu-tip-text {
  position: relative;
}
.pu-tip-x {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  margin: -4px -2px 0 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.18);
}
.pu-tip-x:hover {
  background: rgba(255, 255, 255, 0.32);
}
