/* The "Simule" view (site/brasileirao/<comp>/simule/) -- scenario "e se...?"
   tool. Tokens (--surface-1,
   --text-primary/secondary/muted, --gridline, --border, --accent) come from
   style.css's :root, already the dataviz skill's validated reference
   palette (see intent/spec.md's Standards applied). */

/* Table + jogos side by side (ge.globo-style layout, on request) -- table
   gets the wider column, the paginated fixture sidebar the narrower one.
   Single column on narrower viewports, table first (more useful without
   scrolling on mobile). */
/* Jogos is a fixed, narrow column instead of the old fixed-table/1fr-jogos
   split (feedback: "deixar a coluna de jogos um pouco mais estreita para
   evitar rolagem horizontal na tabela") -- the fixture rows only need room
   for a crest + 3-letter acronym + score inputs now (Jogos always shows
   the acronym, see .scenario-fixture-row .team-name-full below), not a
   full club name. The table gets the flipped role, 1fr (whatever's left),
   so it's the one that grows on a wide viewport instead of Jogos.
   Narrowed from 19rem/2rem gap to 16rem/1rem gap (feedback: "diminuir um
   pouco o espaço entre a tabela e a coluna de jogos, visando eliminar o
   scroll horizontal") once this view moved from its own wider
   .scenario-main (1320px) to the shared main.landing (landing.css, capped
   at 1200px like every other generated view) -- the live table (up to 13
   columns, see .scenario-live-table) no longer fit its full width without
   .scenario-result-wrap's own horizontal scroll kicking in at that split. */
.scenario-layout {
  display: grid;
  grid-template-columns: 1fr 18rem;
  gap: 1rem;
  align-items: start;
  margin-top: 1.5rem;
}

/* min-width: 0 overrides grid's own default min-width: auto on a track --
   without it, a grid item never shrinks below its content's intrinsic
   width (here, the live table's un-abbreviated team names on a narrow
   viewport), so the whole .scenario-layout row -- table AND jogos, same
   grid -- gets pushed wider than the actual viewport instead of letting
   .scenario-result-wrap's own overflow-x: auto contain the scroll to just
   the table (the reported "jogos fica muito grande horizontalmente" was a
   symptom of this, not its own separate bug -- jogos was just riding
   along with the table's forced width). */
.scenario-layout-table,
.scenario-layout-fixtures {
  min-width: 0;
}

.scenario-layout-fixtures {
  border-left: 1px solid var(--border);
  padding-left: 1rem;
}

.scenario-fixtures-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.scenario-bulk {
  margin: 0 0 1rem;
}

.scenario-bulk-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.scenario-bulk-label span {
  opacity: 0.8;
}

.scenario-bulk-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.scenario-bulk-btn {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--gridline);
  background: var(--surface-1);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.4;
  cursor: pointer;
}

.scenario-bulk-btn:hover,
.scenario-bulk-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 860px) {
  .scenario-layout {
    grid-template-columns: 1fr;
  }

  .scenario-layout-fixtures {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
  }
}

.scenario-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0 0.75rem;
}

/* Arrow-only now (feedback: "os botões de anterior e próximo rodada não
   precisam de texto, apenas setas") -- a fixed square instead of the old
   text pill's auto width, so both buttons stay the same size and the
   dropdown between them (.scenario-pager-select, flex: 1) gets back the
   width the "‹ Anterior"/"Próxima ›" labels used to take. */
.scenario-pager-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;
}

.scenario-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.scenario-pager-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  text-align: center;
  text-align-last: center;
}

.scenario-pager-select option {
  text-align: center;
}

/* A rodada with some matches already played out of order or still
   postponed with no date (see isIncompleteRound) -- amber border on the
   select itself when it's the CURRENT page, amber text on the option
   whenever the browser honors <option> styling (unreliable across
   engines, hence the "⚠" text marker doing the real work in the option's
   own label -- see scenario_page.js). #fab219 is the dataviz skill's own
   warning status step, distinct from the categorical/zone colors already
   in use on this page. */
.scenario-pager-select-incomplete {
  border-color: #fab219;
}

.scenario-pager-option-incomplete {
  color: #fab219;
}

/* "A rodada atual" (see state.currentFixturePageIndex) stays bold in the
   dropdown regardless of which page the user is currently viewing --
   font-weight on <option> is honored consistently across engines, unlike
   background/foreground color. */
.scenario-pager-option-current {
  font-weight: 700;
}

/* One column in the narrow "Jogos" sidebar (see .scenario-layout) -- the
   auto-fill minmax still lets this same list re-flow into 2-3 columns if
   ever rendered somewhere wider than the sidebar. */
/* One match per row, always -- never 2-3 across even on a wide viewport
   (feedback: "quero no máximo um jogo por linha"). */
.scenario-fixture-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* Fixed height, not just padding -- with a full round (10 matches, 20
   teams) on one date, the stack of 10 rows (+ 9 x 0.5rem gaps, see
   .scenario-fixture-list) lines up with the live table's own total height
   (~780px for its header + 20 team rows) -- 10 x 4.4rem + 9 x 0.5rem ≈
   785px, measured against the real rendered table (campo-aberto/cenarios_178
   session). A date with fewer matches is shorter, on purpose -- only a full
   10-match date is guaranteed to match. */
.scenario-fixture-card {
  display: flex;
  flex-direction: column;
}

/* The date/time line lives inside .scenario-fixture-row itself now (the
   clickable element that expands/collapses the sticker), above the grid
   of crests/names/scores -- feedback: "gostaria da data dentro do
   elemento clicável que expande/retrai a figurinha". */
.scenario-fixture-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  padding-top: 0.3rem;
}

.scenario-fixture-row {
  display: flex;
  flex-direction: column;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-1);
}

.scenario-fixture-grid {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto auto auto 1fr 1.75rem;
  align-items: center;
  gap: 0.35rem;
  /* Shorter than the old 3.4rem: the quick-result buttons below take the
     difference, so a card keeps its old total height and the Jogos column
     still lines up with the table. */
  height: 2.4rem;
}

/* The whole row is the click/tap target (feedback: "a figurinha abrir ao
   clicar na linha do jogo ao invés do uso do botão"); no separate glyph
   marks the expand/collapse state anymore (feedback: "remova a seta que
   mostra se expande ou não"). */
.scenario-fixture-row {
  cursor: pointer;
}

.scenario-fixture-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The expanded sticker (MatchesShared.renderStickerCard) brings its own
   full styling from matches.css -- this only spaces it under the row. */
.scenario-fixture-sticker-panel {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 0.25rem;
}

/* `display: flex` above has equal specificity to the UA stylesheet's own
   `[hidden] { display: none }` -- but author rules beat UA rules on a tie
   regardless of order, so without this override the panel never actually
   collapsed even though the `hidden` attribute/JS state toggled correctly
   (the reported "botão de recolher não funciona"). */
.scenario-fixture-sticker-panel[hidden] {
  display: none;
}

.scenario-heatmap-cell-clickable {
  cursor: pointer;
}

.scenario-fixture-row.is-fixed {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Already played -- still clickable to expand its sticker (now showing
   the real result), but muted so it reads at a glance as history rather
   than something to act on, same as the upcoming rows right above/below
   it in the same Jogos list. */
.scenario-fixture-row.is-played {
  opacity: 0.75;
}

.scenario-crest {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

/* Same 28px the real standings table uses for its own crest (style.css's
   tbody td.team-cell img, width/height="28") -- was 1.25rem/20px here,
   shrunk for a table that's now visually matching the real one. */
.scenario-crest-small {
  width: 1.75rem;
  height: 1.75rem;
  margin-right: 0.6rem;
}

.scenario-team-name {
  font-size: 0.9rem;
}

/* Always the 3-letter acronym in the Jogos sidebar, not just below 640px
   (feedback: "a aba de jogos deve usar a sigla dos times") -- there's
   room for the full name here (.scenario-layout's own comment above), but
   the acronym reads faster in a dense list of one-line-per-match cards.
   The live standings table (.scenario-live-table) keeps the desktop full
   name (see compactTeamName in scenario_page.js for its own separate
   shortening) -- this only touches the fixture rows. min-width: 0
   overrides grid's own default min-width: auto on a 1fr track, letting
   the ellipsis safety-net actually engage for any acronym-less fallback. */
.scenario-fixture-row .team-name-full {
  display: none;
}

.scenario-fixture-row .team-name-abbr {
  display: inline;
}

.scenario-fixture-row .scenario-team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-fixture-row .scenario-team-name:first-of-type {
  text-align: right;
}

/* Single-digit validated text field (replaces an earlier -/+ stepper --
   feedback: "tem como o input do placar ser um campo que recebe texto?").
   Validation itself lives in scoreInput's own JS (SCORE_DIGIT regex);
   this only sizes/centers it. */
.scenario-score-input {
  width: 1.4rem;
  height: 1.6rem;
  padding: 0;
  text-align: center;
  border-radius: 0.3rem;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  /* Explicit text cursor -- .scenario-fixture-row (the click target for
     the sticker toggle now) sets cursor: pointer, which would otherwise
     inherit into this field and hide the normal "you can type here" text
     cursor. */
  cursor: text;
}

.scenario-score-input::placeholder {
  color: var(--text-muted);
}

.scenario-score-sep {
  color: var(--text-muted);
}

/* Read-only final score for an already played match (renderPlayedFixtureRow)
   -- same box footprint as .scenario-score-input (the editable field it
   replaces), so a played row's crest/name/score columns line up with an
   upcoming row's in the same list. */
.scenario-score-final {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.6rem;
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Title on the left, the reset button on the right -- "acima de Sula e Z4"
   (the table's own rightmost columns), i.e. top-right of this same card,
   not a separate full-width action row below the table anymore (that was
   #scenario-run-btn's spot, removed along with the "Simular cenário" step
   itself -- probabilities now recompute automatically, see
   scenario_page.js's scheduleRecompute). The subtitle stays its own
   full-width paragraph below this row (not a flex child here) so a long
   translation never pushes the button down onto its own line. */
.scenario-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.scenario-live-title {
  margin: 0;
  font-size: 1.1rem;
}

.scenario-live-subtitle {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.scenario-clear-btn {
  flex: none;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--gridline);
  background: var(--surface-1);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.scenario-clear-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.scenario-clear-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  /* Without this, :hover's accent border/text still applies on hover even
     while disabled in some browsers (disabled only blocks the click, not
     hover matching) -- a disabled button that changes color on hover reads
     as clickable when it isn't. */
  pointer-events: none;
}

/* Still width: 100% (fills the 2fr column, lines the table's right edge up
   with the fixture sidebar) -- but every numeric column now gets a narrow
   FIXED width so only .scenario-team-col (no explicit width -- table-layout:
   auto gives an unconstrained column whatever's left) absorbs the slack.
   Previously every column shared the stretch evenly, which is what produced
   the reported "muito espaço vazio" between values. */
.scenario-live-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

/* Padding/font-sizes below match the real standings table's own thead
   th/tbody td (style.css) as closely as this narrower layout allows
   (feedback: "deixar essa tabela o mais parecida possível" with
   site/brasileirao/serie-a/) -- the one deliberate difference kept is the
   header LABELS themselves (Grupos/Pré/Sula/Z4 instead of "Fase de
   grupos"/"Pré-fase"/"Sul-Americana"/"Rebaixamento"), since this table
   still competes for width against the Jogos sidebar. No fixed per-column
   `width` anymore either (removed) -- like the real table, columns just
   size to their own content. */
.scenario-live-table th,
.scenario-live-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--gridline);
  text-align: right;
  white-space: nowrap;
}

.scenario-live-table th {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  /* Headers centered (feedback: "alinhe os títulos das colunas para
     ficarem centralizados"), same as the real standings table's own
     thead th (style.css) -- only the generic th/td rule above needs
     right-align, for the numeric td values themselves. */
  text-align: center;
}

/* Two-row grouped header (Título/Libertadores.../Sul-Americana/Rebaixamento
   etc., read from data/<slug>/2026.json's own `columns` -- see
   renderLiveStandings) -- same group-header/sub-header-row vocabulary as
   the real standings table (style.css's #table-head-row, ID-scoped there
   since that table is sticky/full-width; re-scoped to the class here since
   this one is neither). */
.scenario-live-table thead tr:first-child th {
  border-bottom: 2px solid var(--baseline);
}

.scenario-live-table th.group-header {
  border-bottom: 1px solid var(--gridline);
}

.scenario-live-table .sub-header-row th {
  border-bottom: 2px solid var(--baseline);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.scenario-live-table td.prob-cell {
  font-size: 0.82rem;
}

/* "is-computing" toggles on #scenario-live-table itself (never replaced by
   renderLiveStandings' own container.replaceChildren -- that only swaps the
   <table> inside it, see scenario_page.js's triggerRecompute) while a
   recompute is in flight -- a quiet dimmed/grayscale "película" over just
   the probability-derived cells (PE + every prob-cell), not the whole
   table, since Classificação/gols are still the real, unaffected direct
   sum the whole time. Replaces an earlier text status line the user found
   noisier than useful. */
#scenario-live-table.is-computing .prob-cell,
#scenario-live-table.is-computing .expected-points-cell {
  opacity: 0.35;
  filter: grayscale(0.7);
  transition: opacity 0.15s ease;
}

.scenario-team-col {
  text-align: left !important;
  /* Transparent by default (every row reserves the same 4px so crests/rank
     numbers stay aligned whether or not a row has a zone), overridden below
     by a tr.zone-* class -- same left-border-strip mechanism as the real
     standings table (style.css's .team-cell), reimplemented against
     .scenario-team-col instead of .team-cell (which is `display: flex`
     directly on its own <td> -- the exact bug this session already fixed
     once, see the comment just below). */
  border-left: 4px solid transparent;
}

.scenario-live-table tbody tr.zone-libertadores-grupos .scenario-team-col {
  border-left-color: var(--zone-libertadores-grupos);
}

.scenario-live-table tbody tr.zone-libertadores-pre .scenario-team-col {
  border-left-color: var(--zone-libertadores-pre);
}

.scenario-live-table tbody tr.zone-sulamericana .scenario-team-col {
  border-left-color: var(--zone-sulamericana);
}

.scenario-live-table tbody tr.zone-direct-promotion .scenario-team-col {
  border-left-color: var(--zone-direct-promotion);
}

.scenario-live-table tbody tr.zone-playoff-promotion .scenario-team-col {
  border-left-color: var(--zone-playoff-promotion);
}

.scenario-live-table tbody tr.zone-rebaixamento .scenario-team-col {
  border-left-color: var(--zone-rebaixamento);
}

/* `display: flex` directly on a <th>/<td> opts that cell out of the table's
   own column-width algorithm in some browsers, desyncing it from the
   numeric columns below -- the actual cause of the "desalinhado" report
   (campo-aberto/cenarios_178 session). The crest+name pairing instead gets
   its own inline wrapper (.scenario-team-cell), so the <td> itself stays a
   normal table cell. */
.scenario-team-cell {
  display: inline-flex;
  align-items: center;
}

.scenario-team-cell .rank-number {
  margin-right: 0.5rem;
}

.scenario-num {
  color: var(--text-secondary);
}

.scenario-footnote {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.scenario-result-wrap {
  overflow-x: auto;
}

@media (max-width: 640px) {
  .scenario-fixture-grid {
    grid-template-columns: 1.2rem 1fr auto auto auto 1fr 1.2rem;
    font-size: 0.85rem;
  }

  /* Acronym on a narrow viewport -- same breakpoint/behavior as the real
     standings table (style.css's own team-cell rule under this same
     640px query). The fixture rows already show the acronym
     unconditionally now (see .scenario-fixture-row .team-name-full
     above, outside any media query) -- only the live classification
     table still needs this swap gated to narrow viewports. */
  .scenario-live-table .team-name-full {
    display: none;
  }

  .scenario-live-table .team-name-abbr {
    display: inline;
  }

  /* The acronym swap above used to be paired with a table-layout: fixed +
     narrow-fixed-width squeeze that fit the WHOLE table (team + 6 numeric
     columns) into the viewport with no horizontal scroll. That stopped
     working once this table grew the Título/Libertadores/Sul-Americana/
     Rebaixamento probability columns (up to 13 columns total, same set as
     the real standings table) -- squeezing them all into ~2rem each
     overlapped the text illegibly. Falling back to the real standings
     table's own answer to the same problem (style.css's .table-scroll):
     let the team column keep natural width and let
     .scenario-result-wrap's existing overflow-x: auto (already declared
     above, unconditionally) handle the rest via horizontal scroll -- the
     generic `table { min-width: 480px }` from style.css already applies
     here since nothing overrides it anymore. */
  .scenario-live-table .scenario-team-col {
    width: 6rem;
  }

  .scenario-live-table th:not(.scenario-team-col),
  .scenario-live-table td:not(.scenario-team-col) {
    padding: 0.3rem 0.35rem;
  }
}

.scenario-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  padding-bottom: 0.4rem;
}

.scenario-quick-btn {
  min-width: 0;
  padding: 0.1rem 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--gridline);
  background: var(--surface-1);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.scenario-quick-btn:hover,
.scenario-quick-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}
