/* Confrontos: score-probability "sticker" cards, one per match. Adapted from
   the heatmap/sticker component of the WorldCup2026 project's previsoes page,
   restyled to reuse this site's design tokens. */

:root {
  --sticker-w: 264px;
  --sticker-h: 407px;
}

.model-note {
  max-width: 900px;
  margin: 0 auto 1rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
}

.round-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Round select flanked by prev/next arrows (matches_all.js stepRound) --
   sits on the left of the bar, search stays on the right. */
.round-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.round-nav-btn {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.round-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.round-phase-filter {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}

.search-wrap {
  position: relative;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.7;
}

.team-filter {
  width: 100%;
  font: inherit;
  padding: 0.4rem 0.75rem 0.4rem 1.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}

/* ── GRID (the "Jogos" view, site.build_landing_pages._view_jogos) ── */

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--sticker-w), 1fr));
  gap: 24px;
  justify-items: center;
  padding: 30px 12px;
  width: 100%;
}

/* One section per round (round-robin) or per real knockout phase
   (group+knockout) -- see matches_all.js's groupByRound/groupByPhaseDesc. */
.matches-groups {
  width: 100%;
}

.match-group + .match-group {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.match-group-heading {
  margin: 1.5rem 0 0;
  padding: 0 12px;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Five cards per row on wide screens (round-robin leagues only; knockout
   competitions keep the auto-fill grid, four per row): the 264px card is shrunk to 80% (zoom
   scales the card's internals together) so five fit the 1200px page column. */
@media (min-width: 1000px) {
  .matches-groups[data-round-robin="true"] .matches-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    justify-items: center;
  }

  .matches-groups[data-round-robin="true"] .sticker-wrapper {
    zoom: 0.8;
  }
}

/* ── STICKER CARD ── */

.sticker-wrapper {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sticker-wrapper:hover {
  transform: scale(1.06) translateY(-8px);
  z-index: 5;
}

/* A no-model placeholder card (see .sticker-container.no-model below) isn't
   clickable -- matches_played.js's click handler skips it, so its own
   hover/cursor affordance shouldn't imply otherwise. */
.sticker-wrapper:has(.no-model) {
  cursor: default;
}

.sticker-wrapper:has(.no-model):hover {
  transform: none;
}

.sticker-container {
  width: var(--sticker-w);
  height: var(--sticker-h);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
  background: #111;
  border: 3px solid rgba(255, 255, 255, 0.4);
  /* A full round renders every card up front (createMatchGrid, no
     pagination) and each card is expensive -- a 25-cell heatmap, a
     backdrop-blur layer, two gradient borders. content-visibility lets the
     browser skip layout+paint for the cards still off-screen. Set on the
     container (already fixed-size + overflow:hidden, so the paint
     containment it implies changes nothing) rather than .sticker-wrapper,
     whose :hover scale/translate must stay free to overflow. The
     intrinsic-size hint matches the fixed box; `auto` lets the real
     measured size take over once a card has rendered. */
  content-visibility: auto;
  contain-intrinsic-size: auto var(--sticker-w) auto var(--sticker-h);
}

/* Rarity border tiers, restyled to evoke FIFA Ultimate Team's Icon-card
   tiers (see the "Rarity restyle" section of plans/confrontos_rework.md).
   The underlying tier LOGIC (each club is gold / silver / bronze by its
   rank within its own country -- top 3 / next 6 / rest -- and the pair of
   tiers picks the border: see computeStrengthTiers/strengthTierClass in
   matches_shared.js) is independent of the styling here.
   Progression, least to most premium: Base (silver+bronze / bronze+bronze,
   most common) -> Mid (gold+bronze or silver+silver) -> Prime
   (gold+silver) -> Prime Icon Moments (gold+gold, rarest of all four). */

/* Base: early-career/breakout-phase Icon card -- clean, understated,
   white/silver blended with a hint of pale gold. Subtlest glow of the
   four tiers. */
.sticker-container.border-base {
  border-color: #d9cda3;
  background-image: linear-gradient(#111, #111),
    linear-gradient(135deg, #f5f0e1 0%, #d9d9d9 45%, #e8d9a0 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 0 10px rgba(232, 217, 160, 0.35),
    inset 0 0 5px rgba(255, 255, 255, 0.18);
}

/* Mid: the player's consolidated peak -- a warm bronze/copper card, clearly
   a step up from Base's pale gold but deliberately NOT as bright as
   Prime's own gold below -- a darker/more muted color read as "less
   premium than Prime" here on purpose (bright gold reads as more valuable
   than dark bronze/copper at a glance, so the brighter tone belongs on the
   HIGHER tier, Prime, not this one -- an earlier version had these two
   swapped and it read backwards). */
.sticker-container.border-mid {
  border-color: #b8732e;
  box-shadow:
    0 0 18px rgba(184, 115, 46, 0.55),
    inset 0 0 9px rgba(184, 115, 46, 0.3);
}

/* Prime: the single best season -- dark, rich card face with a BRIGHT,
   saturated metallic gold border/gradient -- the most premium-looking of
   the non-Icon tiers. Bright gold (not bronze) so it unambiguously reads
   as a step above Mid's darker bronze/copper, while the near-black
   background + gradient + strongest non-Icon glow still keep it distinct
   from Mid rather than just "the same gold, thicker-looking". */
.sticker-container.border-prime {
  border-color: #ffcc33;
  background-image: linear-gradient(#0a0a0a, #0a0a0a),
    linear-gradient(135deg, #6b4a0a 0%, #d4a017 35%, #ffcc33 50%, #d4a017 65%, #6b4a0a 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 0 24px rgba(255, 204, 51, 0.6),
    inset 0 0 12px rgba(212, 160, 23, 0.45);
}

/* Prime Icon Moments: a specific, historic match/moment -- the rarest and
   most exclusive tier of all (both clubs gold, i.e. top 3 in their own
   country). Deliberately a DISTINCT hue family from Mid/Prime's
   yellow-gold tones (pink/magenta-plus-gold, evoking FIFA's real Icon
   Moments cards) rather than just "brighter Prime", plus the most
   visually "loud" treatment: an animated gradient border and the
   brightest glow of the four tiers. */
.sticker-container.border-icon-moments {
  border-color: #ff2d78;
  background-image: linear-gradient(#111, #111),
    linear-gradient(120deg, #ffd60a, #ff2d78, #d946ef, #ffd60a);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-size:
    100% 100%,
    300% 300%;
  animation: icon-moments-shimmer 5s ease infinite;
  box-shadow:
    0 0 30px rgba(255, 45, 120, 0.65),
    inset 0 0 15px rgba(217, 70, 239, 0.4);
}

@keyframes icon-moments-shimmer {
  0% {
    background-position:
      0% 0%,
      0% 50%;
  }
  50% {
    background-position:
      0% 0%,
      100% 50%;
  }
  100% {
    background-position:
      0% 0%,
      0% 50%;
  }
}

/* Color wash driven by each team's real accent color (--home-color /
   --away-color, set inline per card) -- blurring the crest artwork itself
   barely tints the card, since most crests are a small emblem on a
   transparent field, so the wash is what actually carries each team's
   color. Home color owns the left half, away color the right half, blending
   directly into each other at the vertical center seam -- no transparent
   stop, so the container's own dark background never shows through. */
.sticker-bg-blur {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, var(--home-color, #234) 0%, var(--away-color, #432) 100%);
  filter: saturate(135%);
}

.sticker-glass {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.12) 0%, rgba(8, 8, 12, 0.58) 100%);
}

.sticker-top-info {
  width: 100%;
  text-align: center;
  padding: 12px 10px 0;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.sticker-top-info .info-round {
  color: rgba(255, 255, 255, 0.85);
}

.sticker-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 10px 15px;
  align-items: center;
}

.sticker-header .team {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px;
}

.sticker-header .team-name {
  font-size: 9px;
  letter-spacing: 0.3px;
  margin-top: 6px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  /* Fixed to exactly 2 lines' worth of height (9px * 1.2 line-height) --
     -webkit-line-clamp alone only caps the MAXIMUM at 2 lines, it doesn't
     reserve that space for a shorter one-line name (e.g. "Remo"). Without
     this, a one-line name's header is visibly shorter than a two-line one's
     (e.g. "Red Bull Bragantino"), and since .sticker-container has a fixed
     height, that difference pushes the heatmap below it up or down
     depending on which team is in the card. */
  height: 21.6px;
}

.sticker-crest {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.sticker-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.score-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.score-center .most-likely {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.score-center .most-likely-prob {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
  font-weight: 500;
}

/* The literal final score, shown only on matches/played.html cards
   (renderStickerCard's optional match.final_score) alongside the
   most-likely-scoreline prediction above it. */
.score-center .real-score {
  font-size: 12px;
  font-weight: 700;
  color: #ffd60a;
  margin-top: 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* The model's probability for the real final score, shown right below
   .real-score -- same color and weight as .real-score so the pair reads as
   one unit, just no text-shadow to stay visually secondary to it. */
.score-center .real-score-prob {
  font-size: 12px;
  font-weight: 700;
  color: #ffd60a;
  margin-top: 2px;
}

/* A played match with no prior model snapshot (has_model: false, see
   src.site.export_matches_data._played_cards) -- same footprint as a real
   sticker so the grid doesn't jump between card types, but visually
   muted/placeholder-styled instead of showing a probability grid. */
.sticker-container.no-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 20px;
  background: linear-gradient(160deg, #1c1c1c, #0a0a0a);
  border-color: rgba(255, 255, 255, 0.15);
  filter: grayscale(0.5);
  cursor: default;
}

.sticker-container.no-model .sticker-header {
  width: 100%;
  padding: 0;
}

.sticker-container.no-model .real-score {
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
}

.no-model-message {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.heatmap-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10px 0;
}

.heatmap-grid {
  display: grid;
  /* minmax(0, 1fr) rather than a bare 1fr: without the explicit 0 minimum,
     a grid track's automatic minimum size is based on its content's
     min-content size, which can let a cell's content push the whole grid
     wider/narrower than its declared 160x160px box (a well-known CSS Grid
     "blowout" footgun) and give .heatmap-cell's own children inconsistent
     inline space to lay out in across browsers/zoom levels -- part of the
     wrapped-scoreline-label fix below. */
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 4px;
  width: 160px;
  height: 160px;
  transform: rotate(-45deg);
}

.heatmap-cell {
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.heatmap-cell:hover {
  transform: rotate(45deg) scale(1.4);
  z-index: 10;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.heatmap-cell.best {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.heatmap-cell.best .prob {
  color: #111;
}

.heatmap-cell.best .score {
  color: rgba(0, 0, 0, 0.6);
}

/* Marks the real final score's cell on a matches/played.html card (see
   renderHeatmap's `actual` param) -- an inset ring so it combines visually
   with .best's own (outer) glow instead of one silently overriding the
   other, whether or not the real result also happens to be the
   single most-likely scoreline. */
.heatmap-cell.actual {
  box-shadow:
    inset 0 0 0 2px #ffd60a,
    0 0 10px rgba(255, 214, 10, 0.5);
}

.heatmap-cell.actual.best {
  box-shadow:
    inset 0 0 0 2px #ffd60a,
    0 0 15px rgba(255, 255, 255, 0.6);
}

.heatmap-cell .prob {
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.heatmap-cell .score {
  font-size: 6px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sticker-footer {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bar-container {
  display: flex;
  height: 4px;
  width: 100%;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.f-bar {
  height: 100%;
}

.f-bar.home {
  background: #32ade6;
}
.f-bar.draw {
  background: #8e8e93;
}
.f-bar.away {
  background: #ff2d55;
}

.footer-stats-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.f-stat {
  font-size: 12px;
  font-weight: 800;
}

.f-stat.home {
  color: #32ade6;
}
.f-stat.draw {
  color: #8e8e93;
}
.f-stat.away {
  color: #ff2d55;
}

/* ── MODAL ── */

.sticker-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  justify-content: center;
  /* "safe center": centers when the (scaled) card fits the viewport, but
     falls back to start-alignment instead of centering off-screen when it
     doesn't -- without this, a card taller than the viewport (common with
     the 1.5x zoom below on shorter windows) centers around its midpoint and
     crops its top/bottom with no way to reach the cropped part, since a
     position:fixed ancestor isn't scrollable by itself. */
  align-items: safe center;
  overflow-y: auto;
  padding: 24px 0;
}

.sticker-modal.active {
  display: flex;
}

.sticker-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.sticker-modal-inner {
  position: relative;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  /* --modal-scale is computed in JS (updateModalScale in matches_shared.js)
     to fit the viewport -- transform doesn't grow a scroll ancestor's
     scrollable area, so an unconditional scale(1.5) could paint the card
     partly outside the viewport with no way to reach the cropped part on
     shorter windows. The 1.5 fallback only applies before JS runs. */
  transform: scale(var(--modal-scale, 1.5));
}

.sticker-modal-toolbar {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(20, 20, 24, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.modal-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

/* Close button: a plain X in a circle, centered below the download/share
   row -- a deliberately quieter, secondary-looking affordance (vs. the
   labeled pill buttons above it) since the overlay click and Escape key
   already close the modal; this is just a visible "you can leave" cue. */
.modal-btn-close-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(20, 20, 24, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.modal-btn-close-circle:hover {
  background: #ff2d55;
  transform: translateY(-1px);
}

/* ── FREE-PICK BUILDER ── */

.confronto-builder {
  max-width: 900px;
  margin: 1.25rem auto 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
}

.builder-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-align: center;
}

.builder-subtitle {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
}

.builder-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
}

/* One merged card per side: the matchup panel (flag/crest/name/stats/
   competition) and its três pick-step selectors below all live inside the
   SAME bordered surface now, instead of the panel being its own separate
   box floating above a bare row of steppers. */
.builder-side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
}

/* Thin rule between the panel and the first selector, so the merged card
   still reads as two sections (current selection vs. how to change it)
   rather than one undifferentiated block. `.pick-panel` (not a .pick-step)
   is the actual first <div> child, so `:first-of-type` -- scoped by tag,
   not class -- would match nothing here; `.pick-panel + .pick-step`
   targets the specific pick-step that immediately follows it instead. */
.pick-panel + .pick-step {
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

/* Swaps the two sides' full selection (competition, season, team) in place
   -- see matches_simulate.js's swapSides(). Sits between the two
   .builder-side columns in the grid (and, on the stacked mobile layout,
   between them as a row) purely by DOM order, no extra grid-area needed. */
.builder-swap-btn {
  flex-shrink: 0;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.builder-swap-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.08) rotate(180deg);
}

/* ── Matchup panel ──
   A themed surface (follows the site's normal light/dark surface/border
   tokens, like any other card) showing the CURRENT selection made via the
   three .pick-step panels beneath it: crest in the middle, attack/defense
   stat chips below -- país/campeonato aren't repeated here since they're
   already shown one row down by the país/campeonato selectors themselves
   (this card and those selectors now share one merged .builder-side box).
   See matches_simulate.js's renderPickPanel(). */
.pick-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary);
  min-height: 110px;
}

.pick-panel-crest {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pick-panel-crest img {
  height: 100%;
  max-width: 110px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.pick-panel-team {
  font-weight: 800;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.2;
}

.pick-panel-stats {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pick-panel-stat {
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: var(--page-plane, rgba(0, 0, 0, 0.06));
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.pick-panel-stat b {
  color: var(--accent-strong, var(--accent));
  font-weight: 800;
}

/* ── Step-by-step picker (país -> campeonato -> clube) ──
   Each step is an arrow-cycled stepper -- a single current-value display
   flanked by prev/next buttons, same "OPÇÕES DE VANTAGEM"-style toggle
   pattern this page used before the option-chip-list picker replaced it
   (see matches_simulate.js's cycleCountry/cycleCompetition/cycleTeam).
   Every step is scoped to whatever was picked in the one before it, and
   always lands on a real value -- never a blank state. */
.pick-step {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pick-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.carousel-arrow {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.carousel-arrow:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.08);
}

/* Wraps the trigger button + its dropdown menu -- flex:1 lives here now
   (not on the button) so the absolutely positioned menu below has a stable
   anchor regardless of the button's own box model. */
.pick-select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* The step's current value AND the thing you click to open a dropdown of
   every option -- same "one element, two ways to change it" pattern this
   site already uses for the team pill on the old free-pick builder (see
   .team-select-trigger's own history) and for .competition-picker-toggle,
   just generalized here to all three steps (país/campeonato/clube). The
   flanking .carousel-arrow buttons still cycle by +-1 independently. */
.pick-stepper-value {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  text-align: left;
  cursor: pointer;
}

.pick-stepper-value:hover {
  border-color: var(--accent);
}

/* Marks the pill as a dropdown trigger, not just a display -- pinned to the
   right edge (margin-left: auto) rather than this site's usual centered
   caret (.nav-dropdown-trigger::after/.competition-picker-toggle::after),
   per explicit request: it needs to read unambiguously as "opens a menu"
   the way a native <select>'s caret always sits at the far right. Same
   glyph/sizing convention as those, just not flex-centered with the label.
*/
.pick-stepper-value::after {
  content: "\25BE";
  flex-shrink: 0;
  margin-left: auto;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-secondary);
}

/* :not(.flag-icon) matters here: the CONMEBOL globe icon is a plain
   <span class="flag-icon"> (unlike every real country's <svg class="flag-
   icon">), so a bare `span` selector would ALSO match it and give it
   `flex: 1` -- competing with the actual label for space and blowing its
   box up to ~half the pill's width instead of the fixed 20px every other
   icon gets from .flag-icon's own width/height rule. */
.pick-stepper-value span:not(.flag-icon) {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-stepper-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  min-width: 180px;
  max-width: 260px;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem;
  margin-top: 0.35rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.pick-select-wrap.is-open .pick-stepper-menu {
  display: flex;
}

.pick-stepper-menu button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.pick-stepper-menu button:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--page-plane, rgba(0, 0, 0, 0.06));
}

.pick-stepper-menu button[aria-current="true"] {
  color: var(--accent-strong);
  font-weight: 700;
}

/* The team already selected on the OTHER side -- picking it here would
   create a team-vs-itself matchup, same invariant the arrows already
   enforce, so it's shown but not selectable rather than silently missing.
*/
.pick-stepper-menu button:disabled {
  color: var(--text-secondary);
  opacity: 0.4;
  cursor: not-allowed;
}

.pick-stepper-empty {
  color: var(--text-secondary);
  font-weight: 600;
}

.pick-stepper-crest {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.builder-result {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.builder-result:empty {
  margin-top: 0;
}

@media (max-width: 640px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .pick-panel {
    min-height: 0;
  }

  .builder-side {
    padding: 0.7rem 0.6rem 0.85rem;
  }

  .carousel-arrow {
    width: 30px;
    height: 30px;
  }

  .pick-stepper-value {
    font-size: 0.78rem;
  }
}
