/* Neuriosity — shared game kit (styles)
   ------------------------------------------------------------------
   Everything every game has in common: the play surface, HUD, results
   screen, buttons and the email capture block.

   All sizing derives from --gu (game unit), which the kit sets via
   ResizeObserver to min(width, height) / 100 of the play area. That is why
   a game looks identical on a phone, a tablet and in a desktop preview.

   Per-game styles live in assets/games/<slug>/<slug>.css and should only
   describe that game's own playfield. */

.bp-game {
  --gu: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gu) * 3);
  width: 100%;
  height: 100%;
  padding: calc(var(--gu) * 3.5);
  padding-bottom: calc(var(--gu) * 3.5 + env(safe-area-inset-bottom, 0px));
  color: var(--navy, #062b63);
  font-family: inherit;
  text-align: center;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

.bp-game *,
.bp-game *::before,
.bp-game *::after { box-sizing: border-box; }

/* ---------- HUD ---------- */

.bp-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gu) * 4);
  flex: 0 0 auto;
  width: 100%;
  max-width: calc(var(--gu) * 86);
}

.bp-hud__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.bp-hud__item span {
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 2.5);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bp-hud__item strong {
  font-size: calc(var(--gu) * 5.4);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Lives: filled pips that grey out as they are spent. */
.bp-lives { display: flex; gap: calc(var(--gu) * 1.2); }

.bp-lives i {
  width: calc(var(--gu) * 2.6);
  height: calc(var(--gu) * 2.6);
  background: var(--coral, #f15f6d);
  border-radius: 50%;
  transition: background 200ms ease, transform 200ms ease;
}

.bp-lives i.is-lost {
  background: rgba(6, 43, 99, 0.14);
  transform: scale(0.72);
}

/* Progress dots: empty pips that fill as rounds complete. */
.bp-dots { display: flex; gap: calc(var(--gu) * 1.2); }

.bp-dots i {
  width: calc(var(--gu) * 2.6);
  height: calc(var(--gu) * 2.6);
  background: rgba(6, 43, 99, 0.14);
  border-radius: 50%;
  transition: background 200ms ease, transform 200ms ease;
}

.bp-dots i.is-done {
  background: var(--bp-accent, var(--blue, #0878e8));
  transform: scale(1.05);
}

/* ---------- Status line ---------- */

.bp-status {
  flex: 0 0 auto;
  min-height: calc(var(--gu) * 5);
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 3.1);
  font-weight: 600;
}

.bp-status strong { color: var(--navy, #062b63); font-weight: 800; }

/* ---------- Chips (per-attempt readouts) ---------- */

.bp-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--gu) * 1.2);
  flex: 0 0 auto;
  min-height: calc(var(--gu) * 5);
}

.bp-chip {
  padding: calc(var(--gu) * 0.7) calc(var(--gu) * 1.8);
  color: var(--navy, #062b63);
  font-size: calc(var(--gu) * 2.4);
  font-weight: 800;
  background: #fff;
  border: calc(var(--gu) * 0.24) solid rgba(8, 120, 232, 0.24);
  border-radius: 999px;
}

.bp-chip--muted { color: var(--ink-soft, #526b8e); opacity: 0.65; }

/* ---------- Results ----------
   The one block that can be taller than a small phone, because it carries
   the score, the rating and the capture form. It gets its own scroll so
   the game area itself never scrolls during play. */

.bp-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, calc(var(--gu) * 82));
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: bp-fade 320ms ease;
}

@keyframes bp-fade {
  from { opacity: 0; transform: translateY(calc(var(--gu) * 2)); }
  to { opacity: 1; transform: none; }
}

/* The mascot's pose reflects the score. Sized in --gu so it scales with the
   play area, and dropped entirely on a short screen (landscape) where the
   vertical room is better spent on the score and the capture form. */
.bp-mascot {
  flex: 0 0 auto;
  width: calc(var(--gu) * 22);
  height: auto;
  margin-bottom: calc(var(--gu) * 1.2);
}

@media (max-height: 480px) {
  .bp-mascot { display: none; }
}

.bp-results__kicker {
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 2.6);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bp-results__score {
  margin: calc(var(--gu) * 0.6) 0 0;
  color: var(--bp-accent, var(--blue, #0878e8));
  font-size: calc(var(--gu) * 13);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.bp-results__score small {
  font-size: calc(var(--gu) * 4.2);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bp-results__label {
  margin: calc(var(--gu) * 0.4) 0 0;
  font-size: calc(var(--gu) * 4);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bp-results__meta {
  margin: calc(var(--gu) * 1.2) 0 0;
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 2.8);
}

.bp-results__meta b { color: var(--navy, #062b63); }

.bp-best-flag {
  display: inline-block;
  flex: 0 0 auto;
  margin-top: calc(var(--gu) * 1.2);
  padding: calc(var(--gu) * 0.7) calc(var(--gu) * 2);
  color: #8a5b00;
  font-size: calc(var(--gu) * 2.5);
  font-weight: 800;
  background: var(--yellow, #ffc835);
  border-radius: 999px;
}

/* ---------- Buttons ---------- */

.bp-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--gu) * 1.6);
  flex: 0 0 auto;
  margin-top: calc(var(--gu) * 2.6);
}

.bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gu) * 1);
  min-height: max(44px, calc(var(--gu) * 8));
  padding: 0 calc(var(--gu) * 3.4);
  color: #fff;
  font: inherit;
  font-size: calc(var(--gu) * 2.9);
  font-weight: 800;
  text-decoration: none;
  background: var(--bp-accent, var(--blue, #0878e8));
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.bp-btn:active { transform: scale(0.975); background: var(--navy, #062b63); }

.bp-btn--ghost {
  color: var(--navy, #062b63);
  background: transparent;
  border: calc(var(--gu) * 0.28) solid rgba(6, 43, 99, 0.22);
}

.bp-btn--ghost:active { color: #fff; background: var(--navy, #062b63); }

/* ---------- Email capture ----------
   The single conversion surface shared by every game. Editing it here
   changes it across the whole app. */

.bp-capture {
  flex: 0 0 auto;
  width: 100%;
  margin-top: calc(var(--gu) * 3);
  padding: calc(var(--gu) * 2.6);
  background: rgba(255, 255, 255, 0.86);
  border: calc(var(--gu) * 0.26) solid rgba(8, 120, 232, 0.2);
  border-radius: calc(var(--gu) * 3);
}

.bp-capture__title {
  margin: 0;
  font-size: calc(var(--gu) * 3.1);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bp-capture__sub {
  margin: calc(var(--gu) * 0.6) 0 calc(var(--gu) * 1.8);
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 2.5);
  line-height: 1.4;
}

.bp-capture__row { display: flex; flex-direction: column; gap: calc(var(--gu) * 1.2); }

.bp-capture input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  height: max(44px, calc(var(--gu) * 8));
  padding: 0 calc(var(--gu) * 2.4);
  color: var(--navy, #062b63);
  font: inherit;
  font-size: max(16px, calc(var(--gu) * 2.8));
  text-align: center;
  background: #fff;
  border: calc(var(--gu) * 0.26) solid rgba(6, 43, 99, 0.18);
  border-radius: 999px;
}

.bp-capture input[type="email"]:focus {
  outline: none;
  border-color: var(--blue-bright, #19a4f3);
  box-shadow: 0 0 0 calc(var(--gu) * 0.6) rgba(25, 164, 243, 0.2);
}

.bp-capture__note {
  margin: calc(var(--gu) * 1.2) 0 0;
  color: var(--ink-soft, #526b8e);
  font-size: calc(var(--gu) * 2.2);
}

.bp-capture[data-done="true"] .bp-capture__row { display: none; }

/* ---------- Utilities ---------- */

.bp-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .bp-game *, .bp-game *::before, .bp-game *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
