/* Board game score sheets (Catan, Carcassonne): player cards, steppers, award toggles and ranking. */
.bgs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (min-width: 1000px) {
  .bgs-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}
/* "Restore your previous game" notice after a link replaced an autosaved game. */
.bgs-restore {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 16px 14px 20px;
  border-radius: 18px;
  background: #fff4d6;
  box-shadow: 0 0 0 1px rgba(139, 94, 60, 0.18);
}
.bgs-restore-text {
  flex: 1 1 240px;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #3b302b;
}
.bgs-restore-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bgs-restore-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #ffb900;
  color: #2e2018;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.bgs-restore-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7a6a5c;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.bgs-restore-btn:focus-visible,
.bgs-restore-close:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.bgs-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bgs-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 16px;
}
.bgs-player {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px 18px 16px;
  background: #fffdf9;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
  border-top: 6px solid var(--bgs-color, #ede5d8);
  transition: box-shadow 0.2s ease;
}
.bgs-player[data-leading] {
  box-shadow:
    0 0 0 2px #ffb900,
    0 16px 34px rgba(59, 48, 43, 0.1);
}
.bgs-player-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bgs-name {
  height: 44px;
  font-weight: 700;
  font-size: 18px;
}
.nk-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.nk-icon-btn:disabled:hover {
  background: transparent;
  color: #9a8570;
}

.bgs-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bgs-section {
  margin: 6px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e5ddd2;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.bgs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bgs-row label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.bgs-row-label {
  font-size: 15px;
  font-weight: 600;
  color: #3b302b;
  line-height: 1.3;
}
.bgs-row-hint {
  font-size: 13px;
  color: #7a6a5c;
  line-height: 1.35;
}

.bgs-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.bgs-step {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: #f2ebe0;
  color: #3b302b;
  font-family: inherit;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  touch-action: manipulation;
}
.bgs-step:hover {
  background: #ede5d8;
}
.bgs-step:active {
  background: #e5ddd2;
}
.bgs-step:focus-visible,
.bgs-award:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.bgs-num {
  box-sizing: border-box;
  width: 54px;
  height: 44px;
  padding: 0 4px;
  border: 1.5px solid #ddd5c8;
  border-radius: 12px;
  background: #fffdf9;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #2e2018;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.bgs-num::-webkit-outer-spin-button,
.bgs-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bgs-num:focus {
  outline: none;
  border-color: #8b5e3c;
  box-shadow: 0 0 0 3px rgba(255, 185, 0, 0.35);
}
.bgs-num--wide {
  width: 72px;
}

.bgs-awards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bgs-award {
  flex: 1 1 130px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid #ddd5c8;
  border-radius: 999px;
  background: #fffdf9;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #7a6a5c;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.bgs-award span {
  color: #9a8570;
  font-weight: 500;
}
.bgs-award[aria-pressed='true'] {
  background: #ffb900;
  border-color: #ffb900;
  color: #2e2018;
}
.bgs-award[aria-pressed='true'] span {
  color: #2e2018;
}

.bgs-warn {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fbf3df;
  font-size: 13px;
  line-height: 1.45;
  color: #6e5a48;
}
.bgs-player-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e5ddd2;
}
.bgs-total-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.bgs-player-total strong {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}
.bgs-total-of {
  font-size: 15px;
  color: #9a8570;
}
.bgs-badge {
  margin-right: auto;
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e5e6dc;
  font-size: 12px;
  font-weight: 600;
  color: #4f6847;
}
.bgs-badge[hidden] {
  display: none;
}

.bgs-ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bgs-rank {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f7f1e8;
}
.bgs-rank[data-leading] {
  background: #fbf3df;
  box-shadow: inset 0 0 0 1.5px #ffb900;
}
.bgs-rank-pos {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: #fffdf9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #8b5e3c;
}
.bgs-rank[data-leading] .bgs-rank-pos {
  background: #ffb900;
  color: #2e2018;
}
.bgs-rank-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.bgs-rank-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #2e2018;
  overflow-wrap: anywhere;
}
.bgs-rank-name em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: #4f6847;
  background: #e5e6dc;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.bgs-rank-detail {
  font-size: 13px;
  line-height: 1.4;
  color: #7a6a5c;
}
.bgs-rank-total {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}

/* Carcassonne "points for a finished feature" helper: a collapsed <details> above the players. */
.bgs-helper {
  background: #fffdf9;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
  min-width: 0;
}
.bgs-helper-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 14px 18px 14px 20px;
  border-radius: 22px;
  cursor: pointer;
  list-style: none;
}
.bgs-helper-summary::-webkit-details-marker {
  display: none;
}
.bgs-helper-summary:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.bgs-helper-head {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bgs-helper-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: #2e2018;
}
.bgs-helper-text {
  font-size: 13px;
  line-height: 1.45;
  color: #7a6a5c;
}
/* Round +/× toggle on the right of the summary. */
.bgs-helper-chev {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f2ebe0;
  position: relative;
  transition: transform 0.2s ease;
}
.bgs-helper-chev::before,
.bgs-helper-chev::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  margin: -1px 0 0 -7px;
  border-radius: 2px;
  background: #8b5e3c;
}
.bgs-helper-chev::after {
  transform: rotate(90deg);
}
.bgs-helper[open] .bgs-helper-chev {
  transform: rotate(45deg);
}
.bgs-helper-body {
  margin: 0;
  border: 0;
  border-top: 1px solid #e5ddd2;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.bgs-helper-out {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.bgs-helper-out strong {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}
.bgs-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #8b5e3c 50%),
    linear-gradient(135deg, #8b5e3c 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

@media (max-width: 380px) {
  .bgs-step {
    width: 40px;
    height: 40px;
  }
  .bgs-num {
    width: 48px;
  }
  .bgs-num--wide {
    width: 62px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bgs-player,
  .bgs-step,
  .bgs-award,
  .bgs-helper-chev {
    transition: none;
  }
}
[data-scores] [hidden] { display: none !important; }
.bgs-table-tight th, .bgs-table-tight td { padding-left: 8px; padding-right: 8px; }
.bgs-table-tight th:first-child, .bgs-table-tight td:first-child { padding-left: 0; }
.bgs-table-tight th:last-child, .bgs-table-tight td:last-child { padding-right: 0; }
