/* Shared finishing layer: backgrounds, control rhythm and responsive alignment. */

body:not(.legacy-home):not(.auth-page):not(.broadcast-page) {
  background-color: #040b13;
  background-image:
    linear-gradient(180deg, rgba(3, 11, 19, .64), rgba(3, 10, 17, .86)),
    url("images/background-public-v1.a3c7c18ffb1c.png");
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body:not(.legacy-home):not(.auth-page):not(.broadcast-page):is(
  .settings-page,
  .player-data-page,
  .player-datasets-page,
  .account-settings-page,
  .export-settings-page,
  .crest-assets-page,
  .tournament-setup-page
) {
  background-image:
    linear-gradient(180deg, rgba(3, 11, 19, .68), rgba(3, 10, 17, .9)),
    url("images/background-settings-v1.c2a36c72eb7e.png");
}

body:not(.legacy-home):not(.auth-page):not(.broadcast-page):is(
  .auction-control-page,
  .team-auction-center-page,
  .team-workbench-page
) {
  background-image:
    linear-gradient(180deg, rgba(3, 10, 18, .58), rgba(3, 9, 16, .88)),
    url("images/background-auction-v1.63d87b1e6431.png");
}

body:not(.legacy-home):not(.auth-page):not(.broadcast-page) .site-main {
  isolation: isolate;
}

.site-header {
  box-shadow: 0 10px 32px rgba(0, 0, 0, .2);
}

:is(
  button.primary,
  button.secondary,
  button.danger,
  button.ghost,
  button.button-link,
  a.button-link
) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  max-width: 100%;
  padding: 0 15px;
  border-radius: 5px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}

:is(
  button.primary,
  button.secondary,
  button.danger,
  button.ghost,
  button.button-link,
  a.button-link
):not(:disabled) {
  transition:
    transform .14s ease,
    border-color .14s ease,
    background-color .14s ease,
    color .14s ease,
    box-shadow .14s ease;
}

:is(
  button.primary,
  button.secondary,
  button.danger,
  button.ghost,
  button.button-link,
  a.button-link
):not(:disabled):hover {
  transform: translateY(-1px);
}

button:disabled {
  transform: none !important;
}

select,
option {
  color-scheme: dark;
}

select {
  text-overflow: ellipsis;
}

dialog {
  border-radius: 8px;
}

.settings-content,
.settings-sidebar,
.global-dataset-card,
.player-browser,
.player-editor-panel,
.roster-control,
.card {
  backdrop-filter: blur(12px);
}

/* Player database toolbar: one stable action row. */
.settings-player-page .player-browser-head {
  align-items: center;
}

.settings-player-page .browser-head-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.settings-player-page :is(.browser-selection-tools, .browser-record-tools) {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.settings-player-page .browser-record-tools form {
  display: flex;
  margin: 0;
}

.settings-player-page :is(
  .browser-selection-count,
  .browser-select-all-button,
  .browser-invert-button,
  .browser-clear-button,
  .browser-copy-button,
  .bulk-delete-button,
  .new-player-button
) {
  min-height: 36px;
  height: 36px;
  margin: 0;
  padding: 0 11px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
}

.settings-player-page .browser-selection-count {
  display: inline-flex;
  min-width: 66px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.settings-player-page .browser-copy-button {
  min-width: 74px;
}

.settings-player-page .bulk-delete-button {
  min-width: 52px;
}

.settings-player-page .new-player-button {
  min-width: 64px;
}

.settings-player-page .browser-head-actions:has(
  .browser-clear-button:not([hidden])
) .browser-select-all-button {
  display: none;
}

.settings-player-page .player-data-actions {
  align-items: flex-end;
}

.settings-player-page .player-data-actions :is(
  form,
  a.button-link,
  button.button-link
) {
  flex: 0 0 auto;
  margin: 0;
}

.settings-player-page .player-data-actions :is(
  a.button-link,
  button.button-link,
  .event-dataset-switch .button-link
) {
  min-height: 42px;
  height: 42px;
}

.settings-player-page .catalog-scope-switcher select {
  width: clamp(230px, 17vw, 320px);
  min-height: 42px;
}

.dataset-source-line {
  color: #87a9ba !important;
  font-size: 12px !important;
}

.dataset-overview-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.global-dataset-card {
  border-top-color: var(--lime);
}

/* Tournament database-copy choice. */
.launch-dataset-field {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.launch-dataset-field > label:first-child {
  display: grid;
  gap: 7px;
}

.launch-dataset-copy {
  display: grid !important;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px !important;
  padding: 10px 12px;
  border: 1px solid rgba(184, 248, 61, .24);
  border-radius: 5px;
  background: rgba(184, 248, 61, .06);
  cursor: pointer;
}

.launch-dataset-copy input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--lime);
}

.launch-dataset-copy span,
.launch-dataset-copy b,
.launch-dataset-copy small {
  display: block;
}

.launch-dataset-copy b {
  color: #e9f6f8;
  font-size: 14px;
}

.launch-dataset-copy small {
  margin-top: 4px;
  color: #94aab7;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.launch-dataset-copy:has(input:checked) {
  border-color: rgba(184, 248, 61, .48);
  background: rgba(184, 248, 61, .1);
}

.launch-dataset-copy:has(input:disabled) {
  cursor: default;
  opacity: .9;
}

@media (max-width: 1500px) {
  .settings-player-page .player-browser-head {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-player-page .browser-head-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .settings-player-page :is(.browser-selection-tools, .browser-record-tools) {
    justify-content: flex-start;
  }
}

/* Flags may crop to their rectangular frame; club crests must always be
   displayed in full and must not inherit the flag/legend badge treatment. */
:is(.catalog-card-origins, .editor-card-origins) i.club {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:is(.catalog-card-origins, .editor-card-origins) i.club img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
}

:is(.catalog-card-origins, .editor-card-origins) i.club.fallback {
  overflow: hidden;
  border: 1px solid rgba(111, 78, 19, .42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, .78), rgba(225, 193, 113, .34));
  color: #6f531b;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .38),
    0 2px 5px rgba(74, 47, 6, .14);
}

:is(.catalog-card-origins, .editor-card-origins) i.nation img {
  object-fit: cover;
}

.player-showcase .card-origins .origin-club {
  overflow: visible;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

.player-showcase .card-origins .origin-club > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (min-width: 1181px) and (max-width: 1500px) {
  .settings-player-page .player-data-hero {
    display: grid;
    grid-template-columns: minmax(350px, .72fr) minmax(0, 1.28fr);
  }

  .settings-player-page .player-data-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .settings-player-page .catalog-scope-switcher select {
    width: 205px;
    min-width: 205px;
  }

  .settings-player-page .player-data-actions :is(
    a.button-link,
    button.button-link,
    .event-dataset-switch .button-link
  ) {
    padding-inline: 9px;
    font-size: 12px;
  }
}

@media (max-width: 900px) {
  body:not(.legacy-home):not(.auth-page):not(.broadcast-page) {
    background-attachment: scroll;
    background-position: center top;
  }

  .settings-player-page .player-data-actions {
    align-items: stretch;
  }

  .settings-player-page .player-data-actions > * {
    flex: 1 1 160px;
  }

  .settings-player-page .catalog-scope-switcher select {
    width: 100%;
    min-width: 0;
  }

  .dataset-overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 2400px) {
  :is(
    button.primary,
    button.secondary,
    button.danger,
    button.ghost,
    button.button-link,
    a.button-link
  ) {
    border-radius: 7px;
  }

  .settings-player-page :is(
    .browser-selection-count,
    .browser-select-all-button,
    .browser-invert-button,
    .browser-clear-button,
    .browser-copy-button,
    .bulk-delete-button,
    .new-player-button
  ) {
    min-height: 46px;
    height: 46px;
    padding-inline: 15px;
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    button.primary,
    button.secondary,
    button.danger,
    button.ghost,
    button.button-link,
    a.button-link
  ) {
    transform: none !important;
  }
}
