.mini-game-stage {
  /* A sideways drag stays with the game: in the app a held ◀/▶ that drifted
     sideways used to start paging the tab track — Chromium then fires
     `pointercancel` and the player stops dead mid-run (#622). A vertical one
     scrolls the page, though: on a phone the pitch fills nearly the whole
     screen, and with `none` there was hardly a spot left to scroll from
     (#754). The pitch takes no touch input of its own — the buttons below it
     do, and they keep `none`. */
  touch-action: pan-y;
  /* A double tap is how a browser is told "select this word", and the mini game
     is played by tapping fast. Without these the pitch and its buttons end up
     highlighted mid-run, and iOS adds a long-press callout on top (#644).
     Unprefixed `user-select` is not enough on WebKit. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  background: var(--app-pitch-green);
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(var(--app-black-rgb), 0.3);
}

.mini-game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--app-pitch-green);
}

.mini-game-hud {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  color: var(--app-ink-on-accent);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(var(--app-black-rgb), 0.6);
  pointer-events: none;
  font-size: 0.9rem;
}

.mini-game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(var(--app-black-rgb), 0.7);
  color: var(--app-ink-on-accent);
  padding: 16px;
  gap: 12px;
}

.mini-game-overlay h4 {
  margin: 0;
}

.mini-game-overlay p {
  margin: 0;
  max-width: 480px;
}

.mini-game-reward {
  width: 100%;
  max-width: 480px;
}

.mini-game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  /* Same reasoning as the stage: the arrows and the ball are tapped over and
     over, and the glyphs inside the buttons are the text that gets selected. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.mini-game-controls .btn {
  min-width: 64px;
  font-size: 1.5rem;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.mini-game-leaderboard {
  margin-bottom: 0;
}

.mini-game-leaderboard .mini-game-rank {
  width: 32px;
}

.mini-game-row-mine td {
  font-weight: 700;
  background: rgba(var(--app-minigame-mine-rgb), 0.12);
}

@media (max-width: 768px) {
  /* The dashboard .container has 2rem of horizontal padding. On small screens
     we want the stage to span edge to edge, so we pull it out with negative
     margins and widen it by the same amount. */
  .mini-game-stage {
    margin-left: -2rem;
    margin-right: -2rem;
    width: calc(100% + 4rem);
    max-width: none;
    border-radius: 0;
  }

  .mini-game-controls .btn {
    min-width: 88px;
    font-size: 1.85rem;
    padding: 0.6rem 1rem;
  }
}

/* Reward tiers (#562): what the goals in a run are worth, shown before it
   rather than only in the game-over card. Die Zeile selbst ist
   `d-flex align-items-center gap-2 py-1`. */
.mini-game-tier-goals {
    flex: 0 0 auto;
    min-width: 5.5rem;
}

.mini-game-tier-cards {
    font-size: 0.9rem;
}

/* ─── Penalty shootout (#684) ───────────────────────────────────────────── */

.penalty-shootout {
  /* In the app the shootout sits inside the horizontal tab-pager track, so a
     tap that drifts sideways must not page it (TA-MG-23, TA-MG-24). Unlike
     Strike & Score nothing here is held, though, and on a phone the pitch and
     the buttons fill most of the screen: `none` left no spot to start a
     vertical scroll from, and the page could not be scrolled back up. */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.penalty-status {
  margin: 12px 0;
  text-align: center;
  font-weight: 600;
}

/* The two steps of a submission, and what happens after it. It stays on the
   screen for the whole of the picking: the order — five shots, then five
   saves, then a possible wait — is what a first-time player loses track of
   halfway through (#684). Seit #706 ein `Alert` in der Info-Rolle; hier steht
   nur noch, dass er mittig unter der Statuszeile sitzt. */
.penalty-briefing {
  margin: 0 auto 12px;
  max-width: 620px;
  text-align: center;
}

.penalty-briefing-step {
  font-weight: 600;
}

/* `touch-action` is the intersection along the ancestors, so the stage's and
   the buttons' own `none` would win over the shootout's `pan-y`. */
.penalty-shootout .mini-game-stage,
.penalty-shootout .mini-game-controls .btn {
  touch-action: pan-y;
}

.penalty-controls {
  /* Left, middle, right — the row is the mapping to the goal, so it never
     breaks into two lines. A long label wraps inside its button instead. */
  flex-wrap: nowrap;
}

.penalty-controls .btn {
  flex: 1 1 0;
  /* Three equal thirds of whatever is there, but a single one must not
     stretch across the whole pitch on a desktop. The labels are words rather
     than arrows, so they read at text size. */
  min-width: 0;
  max-width: 220px;
  font-size: 1rem;
  padding: 14px 8px;
  /* A third of 390px is under 100px, and some languages label a dive with a
     single word wider than that. */
  overflow-wrap: anywhere;
}

/* ─── The shootout played out (#684 follow-up) ──────────────────────────── */

.penalty-replay-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(var(--app-ground-rgb), 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}

.penalty-replay-box {
  width: 100%;
  max-width: 800px;
  padding: 16px;
  border-radius: var(--bs-border-radius-xl);
  /* A panel of its own, so the title and the score sit on something rather
     than floating over whatever the page happens to show behind them. Sie ist
     in beiden Modi dasselbe Dunkelgrau und sagt das im Markup
     (`data-bs-theme="dark"`), statt ihre Tinte selbst zu setzen (#706). */
  background: var(--app-replay-bg);
  box-shadow: 0 8px 32px rgba(var(--app-black-rgb), 0.5);
  text-align: center;
}

.penalty-replay-title {
  margin-bottom: 4px;
}

.penalty-replay-opponent {
  margin-bottom: 12px;
  opacity: 0.8;
}

.penalty-replay-close {
  margin-top: 16px;
  min-width: 160px;
}

/* Below 768px the stage pulls itself out of the page container by 2rem on each
   side, so the pitch runs edge to edge on the dashboard. Inside this overlay
   there is no container to escape from: the pitch overflowed the box by 32px
   a side and cut the HUD off at both ends. */
.penalty-replay-overlay .mini-game-stage {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  border-radius: var(--bs-border-radius-lg);
}

/* ─── The overview: one card per game ──────────────────────────────────── */

/* The play button is a `stretched-link`, so the whole card takes the click;
   it lifts on hover like the other pickable cards. */
.mini-game-card {
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.mini-game-card:hover,
.mini-game-card:has(.mini-game-card__play:focus-visible) {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(var(--app-black-rgb), 0.2);
}

.mini-game-card__shot {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 0.75rem;
    border-radius: var(--bs-border-radius-lg);
    transition: filter 0.15s ease-out;
}

.mini-game-card:hover .mini-game-card__shot {
    filter: brightness(1.1);
}

/* The button sits under the card's hover as well as its own. */
.mini-game-card:hover .mini-game-card__play {
    filter: brightness(0.9);
}

/* ─── A game in its overlay (#741) ─────────────────────────────────────── */

/* Below 768px the stage pulls itself out of the page container by 2rem a side.
   The overlay body has 1.5rem, so that pull cut the pitch off at both edges —
   it reaches out by exactly the overlay's padding instead and runs edge to
   edge of the sheet. */
@media (max-width: 768px) {
  .mini-game-sheet .mini-game-stage {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    width: calc(100% + 3rem);
  }
}

/* On a wide but short screen the 4:3 pitch at its full 800px would push the
   controls below the fold. Its width follows the height that is left once the
   overlay header, the intro line and the control strip have theirs. */
@media (min-width: 769px) {
  .mini-game-sheet .mini-game-stage {
    max-width: min(800px, calc((100vh - 18rem) * 4 / 3));
    max-width: min(800px, calc((100dvh - 18rem) * 4 / 3));
  }
}

/* The shootout table (#755): the own club's row below the ten, when it is not
   among them, is set apart by a gap line — its place is not the 11th. */
.penalty-board .penalty-board__outside > td {
    border-top: var(--bs-border-width) dashed var(--app-table-border);
}
