.prediction-toolbox { display: contents; }
.prediction-toolbox__summary { display: none; }
.prediction-toolbox__body { display: grid; gap: .85rem; min-width: 0; }
.prediction-toolbox:not([open]) > .prediction-toolbox__body { display: grid; }

.prediction-save-bar {
  position: sticky;
  top: calc(var(--fp-shell-header-height, 4rem) + .75rem);
  z-index: var(--z-admin);
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 42rem);
  margin: 0 0 1rem auto;
  padding: .65rem;
  border: 1px solid var(--outline);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
}

.prediction-save-copy {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.prediction-save-copy strong { line-height: 1.15; }

.autosave-status {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

.prediction-draft-clear-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.draft-clear-dialog .dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  align-items: stretch;
}

.draft-clear-dialog .dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3rem;
  margin-top: 0;
  text-align: center;
}

.fixture-save-reminder {
  color: color-mix(in srgb, var(--fp-color-status-info) 72%, var(--text));
  font-size: .82rem;
  font-weight: 850;
  line-height: 1.35;
}

.admin-match-table-wrap {
  overflow-x: hidden;
  border: 1px solid var(--outline);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}

.prediction-workbench {
  overflow: visible;
}

.match-admin-table {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: .92rem;
}

.match-admin-table thead { display: none; }
.match-admin-table tbody { display: grid; gap: .75rem; width: 100%; max-width: 100%; }

.match-admin-table tbody tr {
  display: grid;
  gap: .9rem;
  align-items: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: .85rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--accent) 3%, transparent);
  content-visibility: auto;
  contain-intrinsic-size: auto 12rem;
}

table.admin-score-workbench[data-fp-responsive-table] tbody tr {
  grid-template-columns: minmax(16rem, 1.7fr) minmax(8rem, .6fr) minmax(7.5rem, .58fr) minmax(18rem, 1.45fr);
  /* Chrome can crash while scrolling complex score forms when content-visibility rematerializes these rows. */
  content-visibility: visible;
  contain-intrinsic-size: auto;
}
.pool-prediction-grid tbody tr { grid-template-columns: minmax(6rem, .75fr) minmax(13rem, 1.45fr) minmax(11rem, .9fr) minmax(9rem, .95fr) minmax(5rem, .55fr) minmax(10rem, 1fr); }
.dashboard-quick-grid tbody tr { grid-template-columns: minmax(4rem, .45fr) minmax(10rem, .95fr) minmax(9rem, .85fr) minmax(15rem, 1.4fr) minmax(10rem, .9fr) minmax(9rem, .85fr); }

.prediction-control-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}

.prediction-control-guide article {
  display: grid;
  gap: .3rem;
  min-width: 0;
  padding: .8rem;
  border: 1px solid color-mix(in srgb, var(--accent2) 30%, var(--outline));
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--accent2) 6%, transparent);
}

.prediction-control-guide p { margin: 0; color: var(--muted); line-height: 1.45; }

.prediction-phase-nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .5rem 0 1rem;
}

.prediction-phase-nav a {
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  min-height: 2.35rem;
  padding: .45rem .7rem;
  border: 1px solid var(--outline);
  border-radius: .35rem;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.prediction-phase-nav a span {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  min-height: 1.45rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: .76rem;
}

.prediction-phase-list { display: grid; gap: .85rem; }

.prediction-phase-section {
  min-width: 0;
  border: 1px solid var(--outline);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--panel2) 42%, transparent);
  overflow: clip;
}

.prediction-phase-section summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 3.4rem;
  padding: .85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.prediction-phase-section summary::-webkit-details-marker { display: none; }
.prediction-phase-section summary span:first-child { display: grid; gap: .18rem; min-width: 0; }
.prediction-phase-section summary small { color: var(--muted); }
.prediction-phase-section[open] summary { border-bottom: 1px solid var(--outline); }
.prediction-phase-section .match-admin-table { padding: .85rem; }
.phase-summary-action { flex: 0 0 auto; color: var(--accent); font-size: .78rem; font-weight: 950; text-transform: uppercase; letter-spacing: .06em; }
.prediction-phase-section[open] .phase-summary-action { color: var(--muted); }

.match-admin-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.match-admin-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.match-admin-table td, .match-admin-table th { vertical-align: middle; }
.match-admin-table td { display: grid; gap: .42rem; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
.match-admin-table td::before { content: attr(data-label); color: var(--accent2); font-size: .7rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.admin-score-workbench td[data-label="Score"],
.admin-score-workbench td[data-label="Result"] { grid-column: auto; }
.match-admin-table td[colspan] { display: block; grid-column: 1 / -1; }
.match-admin-table td[colspan]::before { content: none; }

.workbench-stack { display: grid; gap: .24rem; min-width: 0; }
.workbench-stack small, .workbench-muted { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.match-detail-stack { margin-bottom: .35rem; }
.match-admin-table .match-line { display: flex; gap: .45rem; align-items: center; min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; }
.match-admin-table .match-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.match-admin-table .match-versus { flex: 0 0 auto; color: var(--muted); }
.match-admin-table .score-pair { display: inline-grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: .45rem; align-items: center; justify-content: start; min-width: 0; max-width: 100%; white-space: nowrap; }
.match-admin-table .winner-cell { min-width: 0; }
.match-admin-table .winner-cell > .workbench-stack { width: 100%; max-width: 100%; }
.match-admin-table .score-pair.wrap {
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: auto;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  white-space: normal;
}
.match-admin-table .penalty-score-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem;
  align-items: end;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.match-admin-table .penalty-score-field {
  display: grid;
  gap: .15rem;
  min-width: 0;
}
.match-admin-table .penalty-score-field span {
  max-width: 7.5rem;
  overflow: hidden;
  color: var(--muted);
  font-size: .66rem;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.match-admin-table .penalty-score-field input.score {
  width: 100%;
  max-width: none;
}
.match-admin-table .penalty-hint {
  max-width: 24rem;
  white-space: normal;
}
.match-admin-table .penalty-error {
  min-height: 1rem;
  color: var(--danger);
  font-size: .78rem;
  font-weight: 900;
  line-height: 1.35;
  white-space: normal;
}
.match-admin-table tr.has-penalty-error {
  outline: 1px solid color-mix(in srgb, var(--danger) 70%, transparent);
  outline-offset: .15rem;
}
.match-admin-table td input.score,
.admin-grid.match-admin-table td input.score { width: 4.5rem; max-width: 4.5rem; margin-bottom: 0; text-align: center; }
.match-admin-table td select,
.admin-grid.match-admin-table td select { width: 100%; min-width: 0; margin-bottom: 0; }
.match-admin-table .winner-preview { display: block; min-width: 0; line-height: 1.35; }
.admin-live-groups { margin-top: 1rem; }
.admin-live-group-card {
  display: grid;
  gap: .65rem;
  padding: 1rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
}
.admin-live-group-card header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: start;
}
.admin-live-group-card h2 { margin: 0; font-size: 1rem; }
.admin-live-group-card .standings-summary {
  display: grid;
  gap: .5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.admin-live-group-card .standings-summary li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .2rem .55rem;
  align-items: center;
  min-width: 0;
  padding: .55rem;
  border-radius: .35rem;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.admin-live-group-card .standings-summary li small {
  grid-column: 1 / -1;
  color: var(--muted);
}
.admin-live-group-card .standings-team {
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  min-width: 0;
  font-weight: 900;
}
.admin-live-group-card .standings-team img {
  width: 1.35rem;
  height: .9rem;
  object-fit: cover;
  border-radius: .2rem;
  box-shadow: 0 0 0 1px var(--outline);
  flex: 0 0 auto;
}
.admin-live-group-card .standings-team [data-name] {
  min-width: 0;
  overflow-wrap: anywhere;
}
.admin-live-group-card .qualified .standings-team-line::after,
.admin-live-group-card .third-place .standings-team-line::after {
  display: inline-flex;
  margin-left: .4rem;
  padding: .14rem .42rem;
  border-radius: .25rem;
  background: color-mix(in srgb, var(--accent2) 18%, transparent);
  color: var(--accent2);
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.admin-live-group-card .qualified .standings-team-line::after { content: "Advancing"; }
.admin-live-group-card .third-place .standings-team-line::after { content: "Third"; color: var(--warning); }
.multiplier-toggle-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  max-width: 100%;
  padding: .35rem;
  cursor: pointer;
}
.multiplier-toggle-row input {
  margin: 0;
}
.multiplier-toggle-row:has(input:disabled) {
  cursor: not-allowed;
  opacity: .72;
}
.reset-workbench {
  display: grid;
  gap: 1rem;
}
.reset-status-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.reset-status-grid article {
  display: grid;
  gap: .25rem;
  min-width: 0;
  padding: .85rem;
  border: 1px solid var(--outline);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
}
.reset-status-grid strong {
  color: var(--accent2);
  font-size: 1.35rem;
}
.reset-status-grid span {
  color: var(--muted);
}
.reset-workbench__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: stretch;
}
.reset-workbench__actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
}
.reset-waiting-panel {
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .prediction-save-bar { top: calc(var(--fp-shell-header-height, 4rem) + .5rem); width: auto; margin-inline: 0; }
  .prediction-save-bar .primary { flex: 1 1 auto; margin-top: 0; }
  .prediction-toolbox {
    display: grid;
    gap: .55rem;
    min-width: 0;
  }
  .prediction-toolbox__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 2.75rem;
    padding: .65rem .75rem;
    border: 1px solid var(--outline);
    border-radius: .65rem;
    background: color-mix(in srgb, var(--panel2) 78%, transparent);
    color: var(--muted);
    cursor: pointer;
    list-style: none;
  }
  .prediction-toolbox__summary::-webkit-details-marker { display: none; }
  .prediction-toolbox__summary::after { content: "+"; color: var(--accent2); font-weight: 950; }
  .prediction-toolbox[open] > .prediction-toolbox__summary::after { content: "-"; }
  .prediction-toolbox__summary span {
    color: var(--accent2);
    font-size: .72rem;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .prediction-toolbox__summary strong {
    color: var(--text);
    overflow-wrap: anywhere;
    text-align: right;
  }
  .prediction-toolbox:not([open]) > .prediction-toolbox__body {
    display: none;
  }
  .prediction-toolbox__body {
    display: grid;
    gap: .75rem;
  }
  .prediction-control-guide { grid-template-columns: 1fr; }
  .match-admin-table tbody tr,
  .admin-score-workbench tbody tr,
  .pool-prediction-grid tbody tr,
  .dashboard-quick-grid tbody tr { grid-template-columns: 1fr; padding: .75rem; }
  .admin-score-workbench td[data-label="Score"],
  .admin-score-workbench td[data-label="Result"] { grid-column: auto; }
  .match-admin-table .match-line { flex-wrap: wrap; white-space: normal; }
}

@media (max-width: 520px), (max-height: 520px) {
  .prediction-save-bar {
    align-items: stretch;
    flex-direction: column;
    top: calc(var(--fp-shell-header-height, 4rem) + .35rem);
    width: 100%;
    margin: 0 0 .75rem;
    padding: .55rem;
  }
  .prediction-save-copy { gap: .1rem; }
  .prediction-save-copy strong { font-size: .92rem; }
  .autosave-status { font-size: .76rem; line-height: 1.25; }
  .prediction-save-bar .primary { width: 100%; min-height: 2.75rem; }
  .prediction-phase-section summary { align-items: flex-start; flex-direction: column; }
  .phase-summary-action { align-self: flex-start; }
  .match-admin-table .penalty-score-fields { grid-template-columns: 1fr; }
  .reset-status-grid { grid-template-columns: 1fr; }
  .reset-workbench__actions { flex-direction: column; }
  .reset-workbench__actions .button { width: 100%; }
}
