/* ==========================================================================
   Bug Hunter mini-game
   A full-viewport easter egg that takes over the homepage. Everything lives
   in .tbg-layer, which is pointer-events:none so the site stays usable until
   the game mode starts; only the bugs and the game UI opt back in.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --tbg-red: #ff2f2f;
  --tbg-red-deep: #8f0018;
  --tbg-cyan: #29b6f6;
  --tbg-yellow: #ffd54f;
  --tbg-crosshair-color: #29b6f6;
  --tbg-pixel-font: "Press Start 2P", "Courier New", monospace;
}

/* The page fade. The game itself is painted above this. The fade is opacity
   only: filtering the whole page (especially with a blur) forces every dimmed
   subtree through a full-page filter layer each frame. */
body #navbar,
body main,
body main > section,
body #footer {
  transition: opacity 1.2s ease;
}

/* The game backdrop is a separate fixed layer, below the hero content but
   above the rest of the page. That lets the hero text and buttons sit in
   front of the dark gradient instead of being buried under it. */
body.tbg-game-mode #navbar,
body.tbg-game-mode #footer {
  opacity: 0.2;
  pointer-events: none;
}

body.tbg-game-mode main {
  position: relative;
  z-index: 2147482500;
  pointer-events: none;
}

body.tbg-game-mode main > section:not(#hero) {
  opacity: 0.16;
  pointer-events: none;
}

/* Keep the hero's decoration in the background; the game backdrop provides
   the dark space around the readable hero content. The blobs (two of them
   carry a 128px blur) and the full-height glass layer are the most expensive
   thing on the page to composite, and behind the game veil they were already
   reduced to 10% opacity. Once game mode starts they are taken out of the
   render tree; `visibility` keeps their layout boxes, so the hero action
   buttons (the two destructible site components) do not move. The base
   opacity transition still fades them back in when the game exits. */
body #hero .background-grap,
body #hero #bg_blue_stripes,
body #hero #bg_pink_stripes {
  transition: opacity 1.2s ease;
}

body.tbg-game-mode #hero .background-grap,
body.tbg-game-mode #hero #bg_blue_stripes,
body.tbg-game-mode #hero #bg_pink_stripes {
  opacity: 0.1;
  visibility: hidden;
  animation: none;
  transition: none;
}

/* The game backdrop sits behind the hero, so a live backdrop blur here would
   re-blur the drifting star field on every frame. The game already supplies
   its own dark backdrop, so the blur is not needed while playing. */
body.tbg-game-mode #hero .glass-layer {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* The game is played from the top of the page. */
html.tbg-game-mode,
body.tbg-game-mode {
  overflow: hidden;
}

/* The game is pointer driven, so a click-drag should aim, not select page
   text or start a native image, link, or SVG drag. */
body.tbg-game-mode,
body.tbg-game-mode * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* The hero furniture leaves the screen as the mode shift happens. The
   animation owns transform/opacity while it runs, so these win over the fade
   above and then stay off screen until the game is exited. */
body.tbg-game-mode #navbar {
  animation: tbg-fly-out-up 0.9s cubic-bezier(0.5, 0, 0.9, 0.4) forwards !important;
}

/* The hero cards belong to the scroll-animation system, which sets its own
   animation on them once they have landed. The game's exit animation has to
   win over that, otherwise the cards only fade with the rest of the page. */
body.tbg-game-mode #hero .hero-cards {
  animation: tbg-fly-out-up 1s 0.08s cubic-bezier(0.5, 0, 0.9, 0.4) forwards !important;
}

body.tbg-game-mode .socials {
  animation: tbg-fly-out-down 0.95s 0.05s cubic-bezier(0.5, 0, 0.9, 0.4) forwards !important;
}

/* Everything outside the game layer is inert and dimmed, but its infinite CSS
   animations (hero title swing, button shines, FAQ effects) keep the
   compositor busy every frame behind the game. Pause them for the duration;
   they pick up where they left off when the game exits. The hero action
   buttons are excluded because they are the destructible site components. */
body.tbg-game-mode #navbar *,
body.tbg-game-mode #footer *,
body.tbg-game-mode main > section:not(#hero) *,
body.tbg-game-mode #hero .hero-title .ht-letter-swing {
  animation-play-state: paused;
}

.tbg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147481000;
  overflow: hidden;
  pointer-events: none;
}

.tbg-layer {
  --tbg-shop-offset: 0px;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  pointer-events: none;
  font-family: "Poppins", "Inter", sans-serif;
  color: #ffffff;
}

.tbg-layer *,
.tbg-layer *::before,
.tbg-layer *::after {
  box-sizing: border-box;
}

.tbg-layer button {
  box-sizing: border-box;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.tbg-layer button:hover {
  transform: none;
  box-shadow: none;
}

.tbg-layer button::after {
  content: none !important;
  display: none !important;
}

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */

.tbg-veil {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 112%, rgba(0, 74, 173, 0.5) 0%, rgba(0, 0, 0, 0) 58%),
    radial-gradient(circle at 50% 42%, rgba(236, 64, 122, 0.08) 0%, rgba(0, 0, 0, 0) 62%),
    rgba(0, 0, 0, 0.78);
  transition: opacity 1.4s ease;
}

.tbg-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px
  );
}

body.tbg-game-mode .tbg-veil {
  opacity: 1;
}

/* The drift moves the layer with a transform instead of animating
   background-position. Animating background-position repaints the full
   viewport on the main thread every frame; a transform stays on the
   compositor. Only the 560px the drift travels is added above the viewport;
   the old -100% made a layer twice the screen height for no benefit. The
   layer hint is also scoped to the game so an idle page does not keep a giant
   compositor layer alive. */
.tbg-stars {
  position: absolute;
  inset: -560px 0 0 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, rgba(255, 255, 255, 0) 1.6px),
    radial-gradient(circle, rgba(41, 182, 246, 0.55) 1px, rgba(41, 182, 246, 0) 1.6px);
  background-size: 140px 140px, 230px 230px;
  background-position: 0 0, 70px 90px;
  transition: opacity 1.4s ease;
}

body.tbg-game-mode .tbg-stars {
  opacity: 0.26;
  animation: tbg-stars-drift 60s linear infinite;
  will-change: transform;
}

/* --------------------------------------------------------------------------
   Bug layers
   -------------------------------------------------------------------------- */

.tbg-bugs,
.tbg-text-bugs,
.tbg-fx {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.tbg-text-bugs {
  z-index: 5;
}

.tbg-fx {
  z-index: 9;
  overflow: hidden;
}

/* The bugs used to carry two drop-shadow filters each. With up to a hundred
   bugs on screen that forced a filtered re-raster of every bug every frame,
   which is what made low-end GPUs crawl. A radial glow behind the sprite
   gives the same read at a fraction of the cost. */
.tbg-bug {
  position: absolute;
  top: 0;
  left: 0;

  width: var(--tbg-bug-size, 52px);
  height: var(--tbg-bug-size, 52px);

  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
}

.tbg-bug::after {
  content: "";
  position: absolute;
  inset: -18%;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.7;
  background: radial-gradient(
    circle,
    var(--tbg-glow, rgba(255, 47, 47, 0.5)) 0%,
    rgba(0, 0, 0, 0) 68%
  );
}

.tbg-bug:hover::after {
  opacity: 1;
}

.tbg-bug svg,
.tbg-text-bug svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tbg-bug.is-big {
  --tbg-glow: rgba(255, 47, 47, 0.6);
}

/* Green computer bug: a fast floating target that hurts harder and heals the
   ship when it is popped. */
.tbg-bug.is-computer {
  --tbg-glow: rgba(76, 175, 80, 0.7);
}

.tbg-bug.is-ram,
.tbg-bug.is-gpu {
  --tbg-glow: var(--ram-glow);
}

.tbg-bug-hp {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -7px;
  height: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.tbg-bug-hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--hp-color, #ff5252);
  box-shadow: 0 0 6px var(--hp-color, #ff5252);
  transition: width 0.15s ease;
}

.tbg-bug.is-diving::after {
  opacity: 1;
}

/* A dense swarm turns the wing flap off: each flap repaints its bug, and at
   a hundred bugs that is a constant stream of small rasters. The bugs still
   drift and rotate, so the swarm keeps moving. */
body.tbg-bug-rush .tbg-wing--left,
body.tbg-bug-rush .tbg-wing--right {
  animation: none;
}

.tbg-wing {
  transform-box: fill-box;
}

.tbg-wing--left {
  transform-origin: 100% 50%;
  animation: tbg-wing-left 0.16s steps(2, end) infinite alternate;
}

.tbg-wing--right {
  transform-origin: 0% 50%;
  animation: tbg-wing-right 0.16s steps(2, end) infinite alternate;
}

/* A letter of the page turned into a bug. It is anchored to the letter's
   viewport position, so it travels with the page while you scroll. */
.tbg-text-bug {
  position: absolute;
  top: 0;
  left: 0;

  width: 40px;
  height: 40px;

  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
  z-index: 2;

  background: radial-gradient(
    circle,
    rgba(255, 47, 47, 0.4) 0%,
    rgba(0, 0, 0, 0) 70%
  );

  animation: tbg-text-bug-wiggle 0.9s steps(2, end) infinite;
}

.tbg-text-bug::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(255, 213, 79, 0.6);
  border-radius: 50%;
  animation: tbg-text-bug-spin 3.4s linear infinite;
}

.tbg-letter-host {
  visibility: hidden !important;
}

/* --------------------------------------------------------------------------
   Explosion bits
   -------------------------------------------------------------------------- */

/* A soft radial fill gives the spark without a blurred box-shadow, and the
   Web Animations transform already runs on the compositor, so no layer hint
   per particle is needed. */
.tbg-particle {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(
    circle,
    var(--tbg-particle, #ff2f2f) 0%,
    rgba(0, 0, 0, 0) 70%
  );
}

.tbg-ring {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 2px solid var(--tbg-particle, #ff2f2f);
  border-radius: 50%;
  pointer-events: none;
}

.tbg-score-pop {
  position: absolute;
  pointer-events: none;
  white-space: nowrap;
  font-family: var(--tbg-pixel-font);
  font-size: 11px;
  line-height: 1;
  color: var(--tbg-particle, #ffffff);
  text-shadow: 0 2px 0 #000000, 0 0 12px currentColor;
}

/* --------------------------------------------------------------------------
   Game cards (same visual language as the hero cards)
   -------------------------------------------------------------------------- */

.tbg-card {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.15rem 1.1rem;
  border-radius: 28px 8px 28px 8px;
  color: #ffffff;
}

.tbg-card::before {
  content: "";
  position: absolute;
  top: -30%;
  left: -70%;
  width: 55%;
  height: 160%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(16deg);
  opacity: 0;
}

.tbg-card > * {
  position: relative;
  z-index: 1;
}

/* A backdrop blur under a full-screen animated background makes the
   compositor re-blur every card on every frame. A slightly denser flat fill
   reads the same over the dark backdrop for a fraction of the cost. */
.tbg-layer .tbg-card {
  background-color: rgba(0, 0, 0, 0.72);
}

/* --------------------------------------------------------------------------
   Score / high score card
   -------------------------------------------------------------------------- */

.tbg-score-panel {
  position: absolute;
  top: 50%;
  right: 1.4rem;
  z-index: 30;

  width: min(300px, calc(100vw - 2.8rem));

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(calc(100% + 4rem), -50%);

  transition:
    transform 0.85s cubic-bezier(0.2, 0.85, 0.25, 1),
    opacity 0.45s ease,
    visibility 0.45s,
    top 0.85s cubic-bezier(0.2, 0.85, 0.25, 1),
    right 0.85s cubic-bezier(0.2, 0.85, 0.25, 1);
}

.tbg-score-panel.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.tbg-score-panel.is-visible .tbg-card::before {
  animation: tbg-card-glint 1.1s 0.35s ease-out;
}

body.tbg-game-mode .tbg-score-panel {
  top: 1rem;
  right: 50%;
}

body.tbg-game-mode .tbg-score-panel.is-visible {
  transform: translate(50%, 0);
}

.tbg-panel-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.tbg-top-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 33;

  display: flex;
  align-items: center;
  gap: 0.4rem;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.tbg-game-mode .tbg-top-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tbg-eyebrow {
  font-family: var(--tbg-pixel-font);
  font-size: 8px;
  line-height: 1.6;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.62);
}

.tbg-score-main {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 0.7rem 0 0.35rem;
}

.tbg-score-value {
  font-family: var(--tbg-pixel-font);
  font-size: 30px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(41, 182, 246, 0.65);
}

.tbg-score-unit {
  font-family: var(--tbg-pixel-font);
  font-size: 8px;
  color: var(--tbg-cyan);
}

.tbg-score-mult {
  padding: 0.18rem 0.35rem;

  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.35);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);

  transition:
    color 0.3s ease,
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.tbg-score-mult.is-active {
  color: var(--tbg-yellow);
  border-color: rgba(255, 213, 79, 0.5);
  background: rgba(255, 213, 79, 0.08);
  box-shadow: 0 0 12px rgba(255, 213, 79, 0.22);
  text-shadow: 0 0 10px rgba(255, 213, 79, 0.7);
}

.tbg-run-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.2rem 0 0.55rem;

  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}

body.tbg-game-mode .tbg-run-row {
  display: flex;
}

.tbg-run-value {
  color: var(--tbg-yellow);
  font-size: 9px;
}

.tbg-progress-wrap {
  margin-top: 0.75rem;
}

.tbg-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.tbg-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #29b6f6, #ec407a);
  box-shadow: 0 0 10px rgba(41, 182, 246, 0.7);
  transition: width 0.35s ease;
}

.tbg-progress-copy {
  margin-top: 0.45rem;
  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  line-height: 1.7;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
}

body.tbg-game-mode .tbg-progress-wrap {
  display: none;
}

.tbg-panel-hint {
  margin: 0.55rem 0 0;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
}

body.tbg-game-mode .tbg-panel-hint {
  display: none;
}

.tbg-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tbg-mute,
.tbg-reset,
.tbg-exit {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: row;

  flex: 0 0 auto;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;

  pointer-events: auto;
  cursor: pointer;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;

  transition:
    transform 0.35s ease,
    border-color 0.3s ease,
    background 0.3s ease,
    color 0.3s ease;
}

body.tbg-game-mode .tbg-mute,
body.tbg-game-mode .tbg-reset,
body.tbg-game-mode .tbg-exit {
  display: flex;
}

.tbg-mute svg,
.tbg-reset svg,
.tbg-exit svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.tbg-mute:hover {
  transform: scale(1.08);
  border-color: rgba(41, 182, 246, 0.75);
  background: rgba(41, 182, 246, 0.18);
}

.tbg-mute.is-muted {
  color: rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.1);
}

.tbg-mute:active {
  transform: scale(0.94);
}

.tbg-reset:hover {
  transform: rotate(-180deg) scale(1.08);
  border-color: rgba(236, 64, 122, 0.7);
  background: rgba(236, 64, 122, 0.2);
}

.tbg-reset:active {
  transform: rotate(-180deg) scale(0.94);
}

.tbg-exit:hover {
  transform: scale(1.08);
  border-color: rgba(255, 82, 82, 0.75);
  background: rgba(255, 82, 82, 0.18);
}

.tbg-exit:active {
  transform: scale(0.94);
}

/* --------------------------------------------------------------------------
   Coins and shop
   -------------------------------------------------------------------------- */

.tbg-coins {
  position: absolute;
  top: 9.7rem;
  left: 50%;
  z-index: 31;

  display: flex;
  align-items: center;
  gap: 0.55rem;

  padding: 0.55rem 0.9rem;
  border-radius: 18px 6px 18px 6px;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -0.8rem) scale(0.96);

  transition:
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.2, 0.85, 0.25, 1),
    visibility 0.4s;
}

body.tbg-shop-open .tbg-coins {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}

.tbg-coin-icon {
  display: flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.tbg-coin-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(255, 213, 79, 0.65));
}

.tbg-coins-label {
  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}

.tbg-coins-value {
  font-family: var(--tbg-pixel-font);
  font-size: 14px;
  font-weight: 400;
  color: var(--tbg-yellow);
  text-shadow: 0 0 12px rgba(255, 213, 79, 0.7);
}

.tbg-shop {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 32;

  width: min(285px, calc(100vw - 2rem));

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(1.2rem);

  transition:
    opacity 0.45s ease,
    transform 0.6s cubic-bezier(0.2, 0.85, 0.25, 1),
    visibility 0.45s;
}

body.tbg-shop-open .tbg-shop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.tbg-shop .tbg-card {
  padding: 0.9rem 0.9rem 1rem;
}

.tbg-shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.tbg-shop-balance {
  font-family: var(--tbg-pixel-font);
  font-size: 8px;
  color: var(--tbg-yellow);
  text-shadow: 0 0 10px rgba(255, 213, 79, 0.55);
}

.tbg-shop-items {
  display: flex;
  max-height: calc(100vh - 14rem);
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  padding-right: 0.15rem;
  scrollbar-width: thin;
}

.tbg-shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;

  padding: 0.55rem 0.6rem;

  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.tbg-shop-item.is-hidden {
  display: none;
}

.tbg-shop-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.3rem;
}

.tbg-shop-name {
  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.tbg-shop-sub {
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.5);
}

.tbg-buy {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;

  min-width: 76px;
  height: auto;
  padding: 0.5rem 0.55rem;

  pointer-events: auto;
  cursor: pointer;

  border: 1px solid rgba(255, 213, 79, 0.5);
  border-radius: 6px;
  background: rgba(255, 213, 79, 0.12);
  color: var(--tbg-yellow);

  font-family: var(--tbg-pixel-font);
  font-size: 6px;
  line-height: 1.4;
  letter-spacing: 0.02em;

  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.tbg-buy:hover {
  background: rgba(255, 213, 79, 0.26);
  border-color: rgba(255, 213, 79, 0.85);
  transform: translateY(-1px);
}

.tbg-buy:active {
  transform: translateY(1px);
}

.tbg-buy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.tbg-shop-count {
  border-color: rgba(41, 182, 246, 0.28);
  background: rgba(41, 182, 246, 0.05);
}

.tbg-shop-win {
  border-color: rgba(76, 175, 80, 0.45);
  background: rgba(76, 175, 80, 0.08);
}

.tbg-shop-win .tbg-shop-name {
  font-size: 6px;
  line-height: 1.7;
  color: #a5d6a7;
}

.tbg-win-btn {
  border-color: rgba(76, 175, 80, 0.65);
  background: rgba(76, 175, 80, 0.16);
  color: #a5d6a7;
}

.tbg-win-btn:hover {
  background: rgba(76, 175, 80, 0.3);
  border-color: rgba(76, 175, 80, 0.95);
}

/* --------------------------------------------------------------------------
   Health card
   -------------------------------------------------------------------------- */

.tbg-health {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 30;

  width: min(255px, calc(100vw - 2rem));

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(-100% - 2rem));

  transition:
    transform 0.8s cubic-bezier(0.2, 0.85, 0.25, 1),
    opacity 0.5s ease,
    visibility 0.5s;
}

body.tbg-game-mode .tbg-health {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tbg-health .tbg-card {
  padding: 0.85rem 0.95rem 0.8rem;
}

.tbg-health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;

  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  line-height: 1.7;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
}

.tbg-health-num {
  color: #dff9ff;
  font-size: 7px;
  white-space: nowrap;
}

.tbg-health-track {
  margin-top: 0.55rem;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.65);
}

.tbg-health-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #29b6f6);
  box-shadow: 0 0 12px rgba(41, 182, 246, 0.55);
  transition: width 0.35s ease, background 0.35s ease;
}

.tbg-health.is-low .tbg-health-fill {
  background: linear-gradient(90deg, #ff7043, #ff2f2f);
  animation: tbg-low-health 0.7s ease-in-out infinite alternate;
}

.tbg-health.is-healing .tbg-health-fill {
  animation: tbg-health-heal 0.5s ease-out;
}

.tbg-shop-stat {
  display: none;
}

body.tbg-shop-open .tbg-shop-stat {
  display: block;
}

.tbg-shield-stat .tbg-health-head {
  margin-top: 0.6rem;
}

.tbg-shield-stat .tbg-health-head > span:first-child,
.tbg-shield-num {
  font-size: 6px;
}

.tbg-shield-num {
  white-space: nowrap;
}

.tbg-shield-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #29b6f6, #4caf50);
  box-shadow: 0 0 10px rgba(41, 182, 246, 0.6);
  transition: width 0.35s ease;
}

.tbg-health.is-shielding .tbg-shield-fill {
  animation: tbg-shield-hit 0.5s ease-out;
}

.tbg-turret-stat {
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.6rem;

  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}

body.tbg-shop-open .tbg-turret-stat {
  display: flex;
}

.tbg-turret-speed-num {
  color: var(--tbg-cyan);
  font-size: 7px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Spaceship
   -------------------------------------------------------------------------- */

.tbg-ship {
  position: absolute;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;

  width: clamp(92px, 9vw, 134px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translate(-50%, 180%);
  transition:
    transform 1s cubic-bezier(0.2, 0.85, 0.25, 1),
    bottom 0.65s cubic-bezier(0.2, 0.85, 0.25, 1),
    opacity 0.7s ease,
    visibility 0.7s;
}

body.tbg-game-mode .tbg-ship {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

body.tbg-shop-open .tbg-ship {
  bottom: calc(1rem + var(--tbg-shop-offset));
}

.tbg-ship-body {
  position: relative;
  width: 100%;
  transform-origin: 50% 50%;
  animation: tbg-ship-hover 3.2s ease-in-out infinite;
}

/* A radial glow replaces the two drop-shadow filters. A filter on an element
   that moves every frame forces the whole sprite to be re-rasterized every
   frame; a static gradient behind it is painted once. */
.tbg-ship-body::before {
  content: "";
  position: absolute;
  inset: -28%;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(41, 182, 246, 0.4) 0%,
    rgba(0, 0, 0, 0) 70%
  );
}

.tbg-ship svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.tbg-ship.is-hit .tbg-ship-body {
  animation: tbg-ship-hit 0.38s steps(2, end);
}

.tbg-ship.is-healing .tbg-ship-body {
  animation: tbg-ship-heal 0.5s ease-out;
}

body.tbg-game-mode .tbg-ship.is-dead {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 40%) scale(0.6);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
}

.tbg-turret {
  position: absolute;
  left: calc(50% + 82px);
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;
  width: 74px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(80%);
  transition:
    opacity 0.5s ease,
    transform 0.7s cubic-bezier(0.2, 0.85, 0.25, 1),
    bottom 0.65s cubic-bezier(0.2, 0.85, 0.25, 1),
    visibility 0.5s;
}

body.tbg-shop-open .tbg-turret {
  bottom: calc(1rem + var(--tbg-shop-offset));
}

body.tbg-turret-owned .tbg-turret {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tbg-turret-aim {
  position: relative;
  width: 100%;
  transform-origin: 50% 92%;
  transform: rotate(var(--turret-angle, 0deg));
  transition: transform 0.14s ease-out;
}

.tbg-turret-body {
  position: relative;
  width: 100%;
  transform-origin: 50% 100%;
  animation: tbg-turret-idle 2.4s ease-in-out infinite;
}

.tbg-turret-body::before {
  content: "";
  position: absolute;
  inset: -26%;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(41, 182, 246, 0.45) 0%,
    rgba(0, 0, 0, 0) 70%
  );
}

.tbg-turret svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.tbg-turret-flash {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0;
  background: #ffd54f;
  box-shadow: 0 0 18px #ffd54f;
  transform: translateX(-50%);
  pointer-events: none;
}

.tbg-turret.is-firing .tbg-turret-body {
  animation: tbg-turret-kick 0.12s steps(2, end);
}

.tbg-turret.is-firing .tbg-turret-flash {
  animation: tbg-turret-flash 0.12s steps(2, end);
}

.tbg-bullet {
  position: absolute;
  z-index: 12;
  width: 4px;
  height: 4px;
  background: #ffd54f;
  box-shadow: 0 0 8px #ffd54f;
  pointer-events: none;
}

.tbg-thruster {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  animation: tbg-thruster 0.13s steps(2, end) infinite alternate;
}

/* --------------------------------------------------------------------------
   Cursor crosshair
   -------------------------------------------------------------------------- */

.tbg-crosshair {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 999;

  width: 36px;
  height: 36px;

  pointer-events: none;
  opacity: 0;
  color: var(--tbg-crosshair-color);

  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%);
  transition: opacity 0.25s ease;
  will-change: transform;
}

.tbg-crosshair::before,
.tbg-crosshair::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.tbg-crosshair::before {
  top: 50%;
  left: -12px;
  right: -12px;
  height: 2px;
  transform: translateY(-50%);
}

.tbg-crosshair::after {
  top: -12px;
  bottom: -12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
}

.tbg-crosshair {
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 0 10px currentColor,
    inset 0 0 8px currentColor;
}

.tbg-crosshair.is-firing {
  animation: tbg-crosshair-fire 0.2s ease-out;
}

@media (hover: hover) and (pointer: fine) {
  body.tbg-game-mode,
  body.tbg-game-mode * {
    cursor: none !important;
  }

  body.tbg-game-mode .tbg-crosshair.is-live {
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   Alerts / damage flash / game over
   -------------------------------------------------------------------------- */

.tbg-alert {
  position: absolute;
  top: 34%;
  left: 50%;
  z-index: 60;

  max-width: calc(100vw - 2.5rem);
  padding: 0.95rem 1.25rem;

  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.86);

  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.76);
  box-shadow: 0 0 30px rgba(41, 182, 246, 0.18);

  font-family: var(--tbg-pixel-font);
  font-size: 10px;
  line-height: 1.8;
  letter-spacing: 0.08em;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 0 14px var(--tbg-cyan);
  white-space: nowrap;
}

.tbg-alert.is-major {
  top: 42%;
  padding: 1.35rem 1.75rem;
  border-color: rgba(41, 182, 246, 0.45);
  font-size: 17px;
  line-height: 1.9;
  color: #dff9ff;
}

.tbg-alert.is-showing {
  animation: tbg-alert-pop 2.8s ease forwards;
}

.tbg-damage {
  position: absolute;
  inset: 0;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255, 24, 24, 0.5) 0%, rgba(255, 24, 24, 0) 58%),
    linear-gradient(rgba(255, 0, 0, 0.12), rgba(255, 0, 0, 0.12));
}

.tbg-damage.is-flashing {
  animation: tbg-damage-flash 0.45s ease-out;
}

.tbg-gameover {
  position: absolute;
  inset: 0;
  z-index: 90;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.72);

  transition: opacity 0.6s ease, visibility 0.6s;
}

body.tbg-game-over .tbg-gameover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tbg-win {
  position: absolute;
  inset: 0;
  z-index: 96;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(76, 175, 80, 0.18), transparent 60%),
    rgba(0, 0, 0, 0.78);

  transition: opacity 0.6s ease, visibility 0.6s;
}

body.tbg-won .tbg-win {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tbg-win-card {
  width: min(560px, 100%);
  padding: 2.4rem 1.8rem 2rem;
  text-align: center;
  border-color: rgba(76, 175, 80, 0.5);
  box-shadow:
    0 0 40px rgba(76, 175, 80, 0.25),
    inset 0 0 30px rgba(76, 175, 80, 0.06);
}

.tbg-win-title {
  margin: 0;
  font-family: var(--tbg-pixel-font);
  font-size: clamp(14px, 2.4vw, 22px);
  line-height: 1.8;
  color: #a5d6a7;
  text-shadow:
    0 0 18px rgba(76, 175, 80, 0.9),
    0 0 42px rgba(76, 175, 80, 0.4);
}

.tbg-win-copy {
  margin: 1rem 0 1.3rem;
  font-family: var(--tbg-pixel-font);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--tbg-yellow);
}

.tbg-win-rebuild {
  font-family: var(--tbg-pixel-font);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  animation: tbg-win-blink 1s steps(2, end) infinite;
}

.tbg-gameover-card {
  width: min(430px, 100%);
  padding: 2rem 1.5rem 1.7rem;
  text-align: center;
}

.tbg-gameover-title {
  margin: 0;
  font-family: var(--tbg-pixel-font);
  font-size: 20px;
  line-height: 1.6;
  color: #ff5252;
  text-shadow: 0 0 20px rgba(255, 47, 47, 0.8);
}

.tbg-gameover-copy {
  margin: 0.9rem 0 1.4rem;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
}

.tbg-gameover-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-bottom: 1.6rem;
}

.tbg-gameover-stats div {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tbg-gameover-stats span {
  font-family: var(--tbg-pixel-font);
  font-size: 7px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}

.tbg-gameover-stats strong {
  font-family: var(--tbg-pixel-font);
  font-size: 22px;
  font-weight: 400;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(41, 182, 246, 0.65);
}

.tbg-gameover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.tbg-reboot,
.tbg-quit {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: auto;
  min-width: 0;
  padding: 0.95rem 1.4rem;

  cursor: pointer;
  border: 1px solid rgba(41, 182, 246, 0.55);
  border-radius: 8px;
  background: rgba(41, 182, 246, 0.14);
  color: #dff9ff;

  font-family: var(--tbg-pixel-font);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.08em;

  transition: background 0.25s ease, transform 0.25s ease;
}

.tbg-reboot:hover {
  background: rgba(41, 182, 246, 0.26);
  transform: translateY(-1px);
}

.tbg-reboot:active {
  transform: translateY(1px);
}

.tbg-quit {
  border-color: rgba(236, 64, 122, 0.55);
  background: rgba(236, 64, 122, 0.13);
  color: #ffe1ef;
}

.tbg-quit:hover {
  background: rgba(236, 64, 122, 0.26);
  transform: translateY(-1px);
}

.tbg-quit:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */

@keyframes tbg-fly-out-up {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(-12vw, -135vh, 0) rotate(-9deg);
  }
}

@keyframes tbg-fly-out-down {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(14vw, 135vh, 0) rotate(10deg);
  }
}

@keyframes tbg-wing-left {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0.42);
  }
}

@keyframes tbg-wing-right {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0.42);
  }
}

@keyframes tbg-text-bug-wiggle {
  0%,
  100% {
    transform: translate(0, 0) rotate(-4deg);
  }
  50% {
    transform: translate(2px, -3px) rotate(5deg);
  }
}

@keyframes tbg-text-bug-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tbg-stars-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, 560px, 0);
  }
}

@keyframes tbg-card-glint {
  0% {
    left: -70%;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    left: 120%;
    opacity: 0;
  }
}

@keyframes tbg-low-health {
  from {
    opacity: 0.65;
  }
  to {
    opacity: 1;
  }
}

@keyframes tbg-health-heal {
  0% {
    filter: brightness(2.2);
    box-shadow: 0 0 24px rgba(76, 175, 80, 0.95);
  }
  100% {
    filter: none;
  }
}

@keyframes tbg-shield-hit {
  0% {
    filter: brightness(2.4);
    box-shadow: 0 0 24px rgba(41, 182, 246, 0.95);
  }
  100% {
    filter: none;
  }
}

@keyframes tbg-turret-idle {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-3px) rotate(1deg);
  }
}

@keyframes tbg-turret-kick {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes tbg-turret-flash {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.4);
  }
  40% {
    opacity: 1;
    transform: translateX(-50%) scale(1.4);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.6);
  }
}

@keyframes tbg-ship-heal {
  0% {
    transform: scale(1);
    filter:
      drop-shadow(0 0 18px rgba(41, 182, 246, 0.45))
      drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  }
  45% {
    transform: scale(1.08);
    filter:
      drop-shadow(0 0 30px rgba(76, 175, 80, 0.95))
      drop-shadow(0 0 14px rgba(102, 187, 106, 0.8));
  }
  100% {
    transform: scale(1);
    filter:
      drop-shadow(0 0 18px rgba(41, 182, 246, 0.45))
      drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  }
}

@keyframes tbg-ship-hover {
  0%,
  100% {
    transform: translateY(0) rotate(-0.6deg);
  }
  50% {
    transform: translateY(-7px) rotate(0.6deg);
  }
}

@keyframes tbg-ship-hit {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px) translateY(2px);
  }
  40% {
    transform: translateX(6px) translateY(-1px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes tbg-thruster {
  from {
    transform: scaleY(1);
    opacity: 1;
  }
  to {
    transform: scaleY(0.55);
    opacity: 0.55;
  }
}

@keyframes tbg-crosshair-fire {
  0% {
    box-shadow:
      0 0 10px currentColor,
      inset 0 0 8px currentColor;
  }
  100% {
    box-shadow:
      0 0 26px currentColor,
      inset 0 0 18px currentColor;
  }
}

@keyframes tbg-alert-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
  }
  12%,
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes tbg-win-blink {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.22;
  }
}

@keyframes tbg-damage-flash {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Responsive & motion preferences
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  body.tbg-game-mode .tbg-score-panel {
    top: 5.4rem;
  }

  .tbg-coins {
    top: 13.9rem;
  }

  body.tbg-game-mode.tbg-shop-open .tbg-score-panel {
    top: 8.8rem;
  }

  body.tbg-game-mode.tbg-shop-open .tbg-coins {
    top: 17.4rem;
  }
}

@media (max-width: 720px) {
  .tbg-score-panel {
    top: auto;
    right: auto;
    left: 50%;
    bottom: max(1.1rem, env(safe-area-inset-bottom));

    width: min(300px, calc(100vw - 2rem));
    transform: translate(-50%, calc(100% + 2rem));

    transition:
      transform 0.85s cubic-bezier(0.2, 0.85, 0.25, 1),
      opacity 0.45s ease,
      visibility 0.45s;
  }

  .tbg-score-panel.is-visible {
    transform: translate(-50%, 0);
  }

  body.tbg-game-mode .tbg-score-panel {
    top: 3.9rem;
    right: 0.7rem;
    left: auto;
    bottom: auto;

    width: calc(50vw - 1.2rem);
    text-align: right;
    transform: translateY(-0.7rem);
  }

  body.tbg-game-mode .tbg-score-panel.is-visible {
    transform: translateY(0);
  }

  body.tbg-game-mode.tbg-shop-open .tbg-score-panel {
    top: 3.9rem;
  }

  body.tbg-game-mode .tbg-score-panel .tbg-card {
    padding: 0.55rem 0.7rem 0.6rem;
    border-radius: 18px 6px 18px 6px;
  }

  body.tbg-game-mode .tbg-panel-head,
  body.tbg-game-mode .tbg-score-main,
  body.tbg-game-mode .tbg-run-row {
    justify-content: flex-end;
  }

  body.tbg-game-mode .tbg-eyebrow {
    font-size: 6px;
    line-height: 1.4;
  }

  body.tbg-game-mode .tbg-score-main {
    gap: 0.35rem;
    margin: 0.35rem 0 0.15rem;
  }

  body.tbg-game-mode .tbg-score-value {
    font-size: 18px;
  }

  body.tbg-game-mode .tbg-score-unit {
    font-size: 6px;
  }

  body.tbg-game-mode .tbg-score-mult {
    padding: 0.1rem 0.25rem;
    font-size: 5.5px;
  }

  body.tbg-game-mode .tbg-run-row {
    gap: 0.4rem;
    margin: 0.15rem 0 0;
    font-size: 6px;
  }

  body.tbg-game-mode .tbg-run-value {
    font-size: 7px;
  }

  .tbg-health {
    top: 0.7rem;
    left: 0.7rem;
    width: calc(50vw - 1.2rem);
  }

  .tbg-health .tbg-card {
    padding: 0.6rem 0.55rem 0.55rem;
  }

  .tbg-health-head,
  .tbg-health-num {
    gap: 0.3rem;
    font-size: 6px;
  }

  .tbg-health-track {
    height: 8px;
    margin-top: 0.35rem;
  }

  .tbg-shield-stat .tbg-health-head {
    margin-top: 0.4rem;
  }

  .tbg-coins {
    top: 8.6rem;
    right: 0.7rem;
    left: auto;

    padding: 0.4rem 0.65rem;
    transform: translateY(-0.6rem) scale(0.96);
  }

  body.tbg-shop-open .tbg-coins {
    transform: translateY(0) scale(1);
  }

  body.tbg-game-mode.tbg-shop-open .tbg-coins {
    top: 8.6rem;
  }

  .tbg-ship {
    width: 92px;
  }

  .tbg-turret {
    left: calc(50% + 60px);
    width: 58px;
  }

  .tbg-shop {
    right: 0.5rem;
    bottom: max(0.45rem, env(safe-area-inset-bottom));
    left: 0.5rem;
    width: auto;
  }

  .tbg-shop .tbg-card {
    padding: 0.55rem 0.6rem 0.6rem;
    border-radius: 18px 6px 18px 6px;
  }

  .tbg-shop-head {
    margin-bottom: 0.4rem;
  }

  .tbg-shop-items {
    max-height: none;
    flex-direction: row;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 0;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
  }

  .tbg-shop-item {
    flex: 0 0 88px;
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.28rem;
    padding: 0.4rem 0.42rem;
  }

  .tbg-shop-info {
    gap: 0.18rem;
  }

  .tbg-shop-name {
    font-size: 6px;
    line-height: 1.45;
  }

  .tbg-shop-sub {
    font-size: 8px;
    line-height: 1.25;
  }

  .tbg-shop-win .tbg-shop-name {
    font-size: 6px;
    line-height: 1.45;
  }

  .tbg-buy {
    width: 100%;
    min-width: 0;
    padding: 0.32rem 0.22rem;
    font-size: 5.5px;
  }

  .tbg-turret-stat,
  .tbg-turret-speed-num {
    font-size: 6px;
  }

  .tbg-top-actions {
    top: 0.7rem;
    right: 0.7rem;
  }

  .tbg-alert {
    font-size: 9px;
  }

  .tbg-alert.is-major {
    font-size: 12px;
  }
}

/* --------------------------------------------------------------------------
   Hero buttons as destructible site components
   The health bar sits inside the bottom edge of the control itself.
   -------------------------------------------------------------------------- */

body.tbg-game-mode .tbg-site-component {
  overflow: visible;
  pointer-events: auto;
  cursor: crosshair;
  touch-action: manipulation;
}

body.tbg-game-mode .tbg-site-component:active {
  transform: scale(0.97);
}

.tbg-site-hp {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 3px;
  z-index: 5;
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.tbg-site-hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #29b6f6, #66bb6a);
  transition: width 0.18s linear, background 0.2s ease;
}

.tbg-site-component.is-site-turret > span:not(.tbg-site-hp):not(.tbg-site-turret),
.tbg-site-component.is-site-turret > img {
  opacity: 0;
}

.tbg-site-component.is-site-turret::before {
  display: none;
}

.tbg-site-component.is-site-turret .tbg-site-hp-fill {
  background: linear-gradient(90deg, #ffb300, #ffd54f);
}

.tbg-site-component.is-site-shield-on .tbg-site-hp-fill {
  background: linear-gradient(90deg, #29b6f6, #80cbc4);
}

.tbg-site-component.is-site-destroyed > span:not(.tbg-site-hp):not(.tbg-site-turret),
.tbg-site-component.is-site-destroyed > img {
  opacity: 0.32;
}

.tbg-site-component.is-site-destroyed .tbg-site-hp {
  box-shadow: 0 0 0 1px rgba(128, 203, 196, 0.45);
}

.tbg-site-component.is-site-hit {
  animation: tbg-site-hit 0.24s steps(2, end);
}

.tbg-site-turret {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.tbg-site-turret svg {
  display: block;
  width: 30px;
  height: 30px;
  animation: tbg-site-turret-spin 2.6s linear infinite;
  filter:
    drop-shadow(0 0 8px rgba(41, 182, 246, 0.65))
    drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}

.tbg-site-turret.is-firing svg {
  animation: tbg-site-turret-kick 0.12s steps(2, end);
}

.tbg-bullet--site {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #80cbc4;
  box-shadow: 0 0 9px #80cbc4;
}

.tbg-say-shield {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1 / 1;
  z-index: 3;
  border-radius: 50%;
  border: 2px solid rgba(128, 203, 196, 0.9);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.72);
  transition: opacity 0.28s ease, transform 0.34s ease;
  box-shadow:
    inset 0 0 26px rgba(41, 182, 246, 0.42),
    0 0 22px rgba(41, 182, 246, 0.55);
}

.tbg-say-shield::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px dashed rgba(223, 249, 255, 0.7);
}

.tbg-say-shield.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: tbg-say-shield-pulse 2.4s ease-in-out infinite;
}

@keyframes tbg-site-hit {
  0% {
    filter: brightness(2.4) saturate(0.4);
  }
  100% {
    filter: none;
  }
}

@keyframes tbg-site-turret-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tbg-site-turret-kick {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(0deg) scale(1.28);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes tbg-say-shield-pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tbg-site-turret svg,
  .tbg-say-shield.is-active,
  .tbg-site-component.is-site-hit {
    animation: none !important;
  }

  .tbg-wing--left,
  .tbg-wing--right,
  .tbg-text-bug,
  .tbg-text-bug::before,
  .tbg-thruster,
  .tbg-ship-body,
  .tbg-ship.is-healing .tbg-ship-body,
  .tbg-health.is-low .tbg-health-fill,
  .tbg-health.is-healing .tbg-health-fill,
  .tbg-health.is-shielding .tbg-shield-fill,
  .tbg-turret-body,
  .tbg-turret.is-firing .tbg-turret-body,
  .tbg-turret.is-firing .tbg-turret-flash,
  .tbg-win-rebuild,
  body.tbg-game-mode .tbg-stars {
    animation: none !important;
  }

  .tbg-card::before,
  .tbg-alert.is-showing,
  .tbg-damage.is-flashing,
  body.tbg-game-mode #navbar,
  body.tbg-game-mode .hero-cards,
  body.tbg-game-mode .socials {
    animation-duration: 0.01s !important;
  }

  .tbg-turret-aim {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Alien boss and fever mode
   -------------------------------------------------------------------------- */

.tbg-bug.is-boss {
  --tbg-glow: rgba(124, 242, 155, 0.75);
}

.tbg-bug.is-boss::after {
  inset: -35%;
}

.tbg-boss-shot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;

  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  border-radius: 50%;

  background:
    radial-gradient(circle, #d7ffe5 0%, #7cf29b 38%, #1d7a3a 72%, rgba(16, 61, 31, 0) 100%);
  box-shadow:
    0 0 10px rgba(124, 242, 155, 0.95),
    0 0 24px rgba(57, 209, 107, 0.65);
  will-change: transform;
}

.tbg-boss-shot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(215, 255, 229, 0.75);
}

.tbg-boss-bar {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 64;

  display: flex;
  flex-direction: column;
  gap: 0.35rem;

  width: min(390px, calc(100vw - 2rem));
  padding: 0.5rem 0.65rem 0.55rem;
  transform: translate(-50%, -8px);

  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;

  border: 2px solid rgba(124, 242, 155, 0.55);
  border-radius: 6px;
  background: rgba(3, 14, 7, 0.82);
  box-shadow:
    0 0 24px rgba(57, 209, 107, 0.35),
    inset 0 0 18px rgba(57, 209, 107, 0.12);
}

.tbg-boss-bar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.tbg-boss-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;

  font-family: var(--tbg-pixel-font);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: #d7ffe5;
  text-shadow: 0 0 10px rgba(124, 242, 155, 0.9);
}

.tbg-boss-hp {
  color: #7cf29b;
  white-space: nowrap;
}

.tbg-boss-track {
  height: 13px;
  overflow: hidden;

  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.78);
}

.tbg-boss-fill {
  display: block;
  width: 100%;
  height: 100%;

  background: linear-gradient(90deg, #1d7a3a, #39d16b 55%, #d7ffe5);
  box-shadow: 0 0 16px rgba(124, 242, 155, 0.9);
  transition: width 0.15s ease;
}

.tbg-boss-banner {
  position: absolute;
  inset: 0;
  z-index: 88;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;

  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(57, 209, 107, 0.2), transparent 62%),
    rgba(0, 0, 0, 0.62);
  transition: opacity 0.22s ease, visibility 0.22s;
}

.tbg-boss-banner.is-visible {
  opacity: 1;
  visibility: visible;
  animation: tbg-boss-banner-in 0.32s ease-out;
}

.tbg-boss-banner-text {
  display: block;
  max-width: min(720px, 100%);
  padding: 1.2rem 1.5rem;

  font-family: var(--tbg-pixel-font);
  font-size: clamp(11px, 2.1vw, 20px);
  line-height: 2;
  text-align: center;
  letter-spacing: 0.04em;

  border: 2px solid rgba(124, 242, 155, 0.55);
  border-radius: 6px;
  background: rgba(2, 12, 6, 0.88);
  color: #d7ffe5;
  text-shadow:
    0 0 16px rgba(124, 242, 155, 0.9),
    0 0 42px rgba(57, 209, 107, 0.5);
  box-shadow:
    0 0 34px rgba(57, 209, 107, 0.4),
    inset 0 0 24px rgba(57, 209, 107, 0.12);
}

.tbg-fever {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 64;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transform: translateX(-50%);

  pointer-events: none;
  opacity: 0;
  visibility: hidden;

  font-family: var(--tbg-pixel-font);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #fff59d;
  text-shadow:
    0 0 14px rgba(255, 213, 79, 0.95),
    0 0 34px rgba(255, 112, 67, 0.8);
}

.tbg-fever small {
  font-size: 8px;
  letter-spacing: 0.24em;
  color: #ffd54f;
}

.tbg-fever.is-visible {
  opacity: 1;
  visibility: visible;
  animation: tbg-fever-pulse 0.62s steps(2, end) infinite alternate;
}

body.tbg-fever-mode .tbg-veil {
  background:
    radial-gradient(ellipse at 50% 112%, rgba(255, 112, 67, 0.4) 0%, rgba(0, 0, 0, 0) 60%),
    radial-gradient(circle at 50% 40%, rgba(255, 213, 79, 0.14) 0%, rgba(0, 0, 0, 0) 62%),
    rgba(12, 0, 0, 0.82);
}

body.tbg-fever-mode .tbg-stars {
  opacity: 0.36;
  animation-duration: 24s;
}

@keyframes tbg-boss-banner-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tbg-fever-pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.55);
  }
}

@media (max-width: 720px) {
  .tbg-boss-bar {
    top: 5.9rem;
    width: calc(100vw - 1.4rem);
  }

  .tbg-fever {
    top: 5.9rem;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tbg-bug.is-boss,
  .tbg-boss-shot,
  .tbg-boss-fill,
  .tbg-boss-banner,
  .tbg-boss-banner-text,
  .tbg-fever,
  body.tbg-fever-mode .tbg-stars {
    animation: none !important;
    transition: none !important;
  }
}

.tbg-turret.is-down {
  opacity: 0.32;
  filter: grayscale(1) brightness(0.7);
}

.tbg-site-component.is-site-offline {
  pointer-events: none;
  cursor: default;
  filter: grayscale(1) brightness(0.6);
  opacity: 0.45;
}

.tbg-site-component.is-site-offline .tbg-site-turret {
  opacity: 0.35;
}

.tbg-boss-shot-hp {
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -6px;

  height: 3px;
  overflow: hidden;

  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.8);
}

.tbg-boss-shot-hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #7cf29b;
  box-shadow: 0 0 6px rgba(124, 242, 155, 0.9);
  transition: width 0.1s linear;
}
