/* Shared delayed title compaction for first-party game surfaces. */

/* The NASA iframe owns the full viewport. Keep the app-wide garden launcher
   from covering its last row of rocket-system cards. */
body:has(.rocket-launch-level) #data-garden-button {
  display: none !important;
}

body:has(.comet-blaster-level) #data-garden-button {
  display: none !important;
}

.app.game-ui-auto-compact-ready [data-game-ui-compact-title],
.app.game-ui-auto-compact-ready [data-game-ui-compact-copy],
.app.game-ui-auto-compact-ready [data-game-ui-compact-cluster],
.app.game-ui-auto-compact-ready [data-game-ui-compact-secondary] {
  transition:
    font-size 260ms ease,
    line-height 260ms ease,
    margin 260ms ease,
    padding 260ms ease,
    opacity 220ms ease,
    max-block-size 260ms ease,
    background-color 220ms ease,
    border-color 220ms ease;
}

.app.game-ui-is-compact [data-game-ui-compact-title] {
  margin-block: 0 !important;
  font-size: clamp(1rem, 2.1vw, 1.4rem) !important;
  line-height: 1.08 !important;
  text-wrap: balance;
}

.app.game-ui-is-compact [data-game-ui-compact-copy] {
  display: -webkit-box;
  max-block-size: 2.45em;
  margin-block: 0.18rem 0 !important;
  overflow: hidden;
  font-size: clamp(0.74rem, 1.2vw, 0.86rem) !important;
  line-height: 1.2 !important;
  opacity: 0.72 !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app.game-ui-is-compact [data-game-ui-compact-cluster] {
  gap: 0.22rem !important;
  padding-block: clamp(0.2rem, 0.7vw, 0.5rem) !important;
}

/* Unusual text-only title surfaces that do not use heading elements. */
.app.game-ui-is-compact .treasure-title,
.app.game-ui-is-compact .bh-title,
.app.game-ui-is-compact .moon-race-title > strong,
.app.game-ui-is-compact .pet-feeder-title {
  font-size: clamp(1rem, 2.1vw, 1.4rem) !important;
  line-height: 1.08 !important;
}

.app.game-ui-is-compact .pet-feeder-title {
  top: 72px !important;
}

.app.game-ui-is-compact .pet-feeder-subtitle {
  top: 100px !important;
}

/* Comet Blaster keeps its score, fire control, aim cue, and live message text. */
.app[data-active-game="cometBlaster"].game-ui-is-compact
  .comet-blaster-header
  > div:first-child {
  padding: 5px 9px 6px !important;
  border-radius: 12px !important;
  background: rgba(3, 6, 21, 0.56) !important;
}

.app[data-active-game="cometBlaster"].game-ui-is-compact
  .comet-blaster-kicker {
  max-block-size: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
}

.app[data-active-game="cometBlaster"].game-ui-is-compact
  [data-game-ui-compact-secondary] {
  align-self: end;
  min-height: 0 !important;
  padding: 0.42rem 0.5rem !important;
  gap: 0.1rem !important;
  border-color: rgba(150, 215, 255, 0.12) !important;
  background: rgba(2, 6, 23, 0.42) !important;
}

.app[data-active-game="cometBlaster"].game-ui-is-compact
  [data-game-ui-compact-secondary]
  > span {
  display: none;
}

@media (max-width: 720px) {
  .app.game-ui-is-compact [data-game-ui-compact-title] {
    font-size: clamp(0.98rem, 5vw, 1.22rem) !important;
  }

  .app.game-ui-is-compact [data-game-ui-compact-copy] {
    max-block-size: 1.3em;
    font-size: 0.74rem !important;
    -webkit-line-clamp: 1;
  }

  /* The existing phone layer starts with this hidden. Restore it briefly so
     the normal instructions are available before delayed compaction. */
  .app[data-active-game="cometBlaster"].game-ui-auto-compact-ready:not(.game-ui-is-compact)
    .comet-blaster-header
    p[data-game-ui-compact-copy] {
    display: block;
    max-width: min(58vw, 220px);
    font-size: 0.7rem;
    line-height: 1.16;
  }

  .app[data-active-game="cometBlaster"].game-ui-auto-compact-ready:not(.game-ui-is-compact)
    .comet-blaster-top-hud {
    top: 204px;
  }

  .app[data-active-game="cometBlaster"].game-ui-auto-compact-ready:not(.game-ui-is-compact)
    .comet-blaster-aim-cue {
    top: 232px;
  }

  .app[data-active-game="cometBlaster"].game-ui-is-compact
    .comet-blaster-header
    > div:first-child {
    padding: 4px 7px 5px !important;
    background: rgba(3, 6, 21, 0.48) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app.game-ui-auto-compact-ready [data-game-ui-compact-title],
  .app.game-ui-auto-compact-ready [data-game-ui-compact-copy],
  .app.game-ui-auto-compact-ready [data-game-ui-compact-cluster],
  .app.game-ui-auto-compact-ready [data-game-ui-compact-secondary] {
    transition: none !important;
  }
}

/* Sprite atlas source-overflow corrections.
   These two authored frames cross their nominal 512px source cells. Reframe
   only the affected poses so the full silhouette stays visible without
   sampling either neighboring frame. */
.pip-patch-guide.frame-2 .minigame-revival-atlas {
  /* Virtual source window: x=965..1552, y=0..512. The final 16px are
     transparent space beyond the sheet edge, restoring a safe right gutter. */
  width: 261.669506%;
  height: 174.446337%;
  left: -164.39523%;
  top: 6.388416%;
}

.orbit-wrench-guide.frame-5 .minigame-revival-atlas {
  /* Recenter the measured frame in x=977..1489, y=478..990. */
  width: 300%;
  height: 200%;
  left: -190.820313%;
  top: -93.359375%;
}
