:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #f4f6fb;
  --muted: #a9b0c3;
  --yellow: #FFD740;
  --greybtn: #3a4258;
  --red: #ff4d4d;
  --green: #44d17a;
  --blue: #2f8cff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --tap: 52px;
  --max: 520px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 20% -10%, #28304a 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 10%, #2a3d2e 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 14px 20px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 2px 14px;
}

.title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .2px;
}

.card,
.scorerCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.row .btn {
  flex: 1;
}

.btn {
  width: 100%;
  height: var(--tap);
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform .05s ease, opacity .15s ease, background .15s ease, color .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btnPrimary {
  background: var(--yellow);
  color: #151515;
}

.btnGhost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, .12);
}

.iconSquare,
.screenSwitchBtn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}



.scorerCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 14px;
}

.gameBar {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  color: #c9cfda;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 10px;
}

.gameTitleText {
  text-align: center;
  color: var(--muted);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pillBtn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 14px;
  overflow: visible;
  margin-bottom: 22px;
}

.scoreboard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;
}

.playerScoreCard {
  position: relative;
  padding: 14px 12px;
  background: rgba(255, 255, 255, .05);
  /* neutral grey */
  color: #fff;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  transition: background .18s ease;
}

/* Active player = green */
.playerScoreCard.activePlayer {
  background: #085331;
}

/* ✅ Yellow arrow (your existing feature) */
.playerScoreCard.activePlayer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  width: 46px;
  height: 14px;
  background: var(--yellow);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 2;
}

/* Rounded edges */
.playerScoreCard:first-child {
  border-radius: 14px 0 0 14px;
}

.playerScoreCard:nth-child(2) {
  border-radius: 0 14px 14px 0;
}

.playerTop {
  display: grid;
  grid-template-columns: 10px 1fr 32px;
  gap: 8px;
  align-items: center;
}

.turnDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(104, 104, 104, 0.25);
  /* 👈 grey inactive */
}

.activePlayer .turnDot {
  background: #ffd83d;
}

.playerNameInput {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 900;
}

.playerNameInput::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.legs {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 9px;
  padding: 4px 7px;
  text-align: center;
  font-weight: 900;
}

.score {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(70px, 18vw, 110px);
  line-height: 0.95;
  margin: 18px 0 14px;
  letter-spacing: 1px;
}

.statsGrid {
  display: grid;
  gap: 5px;
  margin-top: auto;
}

.statsGrid div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
}

.statsGrid span {
  color: rgba(255, 255, 255, 0.9);
}

.statsGrid strong {
  color: #fff;
}

.turnMessage {
  width: 50%;
  color: var(--yellow);
  font-size: 16px;
  font-weight: 900;
  margin: 18px 0 12px;
  text-align: center;
  transition: margin-left .15s ease;
}

.turnMessage.playerTwoTurn {
  margin-left: 50%;
}

.scoreEntry {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
  margin-bottom: 10px;
}

.scoreEntry input {
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #090d12;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  outline: none;
  padding: 0 14px;
}

.scoreEntry input::-webkit-outer-spin-button,
.scoreEntry input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}




.scoreEntry .btnPrimary,
#newGameBtn {
  background: #ffd83d;
  color: #05070a;
  border: 0;
  font-weight: 900;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.keypad button {
  min-height: 74px;
  background: #090d12;
  color: #fff;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 42px;
  cursor: pointer;
}

.keypad button:nth-child(3n) {
  border-right: 0;
}

.keypad button:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.keypad button:active {
  background: rgba(255, 216, 61, 0.18);
}

.checkoutBox {
  display: none;
  margin: -2px auto 12px;
  /* 👈 centers it */
  padding: 8px 14px;
  border-radius: 9px;
  /* 👈 pill shape (optional but nice) */
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  text-align: center;
  letter-spacing: .4px;

  width: fit-content;
  /* 👈 KEY */
  max-width: 100%;
  /* prevents overflow */
}

.checkoutBox.show {
  display: block;
}

.checkoutOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.checkoutModal {
  width: min(520px, 100%);
  background: #17251f;
  border-radius: 28px;
  padding: 26px 22px;
  box-shadow: var(--shadow);
}

.checkoutPromptLabel {
  text-align: center;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 32px;
  margin-bottom: 18px;
}

.checkoutPromptBlock {
  margin-bottom: 24px;
}

.checkoutPromptOptions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.checkoutPromptOptions button {
  height: 76px;
  min-width: 90px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 18px;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 42px;
  cursor: pointer;
}

.checkoutPromptOptions button.selected {
  background: #3d36ff;
}

#confirmCheckoutPromptBtn {
  margin-top: 8px;
}



.impossibleModal {
  background: linear-gradient(135deg, #1e2f27, #0f1a16);
  border-radius: 24px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: popIn .2s ease;
}

.impossibleIcon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid #ff3b3b;
  color: #ff3b3b;
  font-size: 40px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}


@media (max-width: 520px) {
  .wrap {
    padding: 14px;
  }

  .scorerCard {
    padding: 12px;
  }

  .scoreboard {
    border-radius: 12px;
  }

  .playerScoreCard {
    padding: 12px 9px;
    min-height: 255px;
  }

  .score {
    font-size: clamp(58px, 20vw, 88px);
  }

  .statsGrid div {
    font-size: 12px;
  }

  .scoreEntry {
    grid-template-columns: 1fr 110px;
  }

  .keypad button {
    min-height: 66px;
    font-size: 38px;
  }
}

.fireworkParticle {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  animation: fireworkBurst 900ms ease-out forwards;
}

@keyframes fireworkBurst {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0);
    opacity: 0;
  }
}



.scorerSetupCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.setupGrid {
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: var(--tap);
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  outline: none;
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.setupRow {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
  align-items: stretch;
}

.homeAwayToggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 52px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;

}

.toggleSlider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 11px;
  background: rgba(255, 255, 255, .14);
  transition: transform .22s ease;
}

.homeAwayToggle.away .toggleSlider {
  transform: translateX(100%);
}

.toggleBtn {
  position: relative;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #aaa;
  font-weight: 900;
  cursor: pointer;
}

.toggleBtn.active {
  color: #111;
}



.optionGrid {
  display: grid;
  gap: 10px;
}

.optionGrid.three {
  grid-template-columns: repeat(3, 1fr);
}

.optionGrid.two {
  grid-template-columns: repeat(2, 1fr);
}

.setupOption {
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.setupOption.active {
  background: var(--yellow);
  color: #111;
  border-color: var(--yellow);
}

.setupOption {
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.setupOption.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
}

.optionGrid.four {
  grid-template-columns: repeat(4, 1fr);
}

.legCounter {
  height: 52px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .10);
}

.legCounter button,
.legCounter strong {
  display: grid;
  place-items: center;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 900;
}

.legCounter button {
  border: 0;
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  /* lighter font */
  color: rgba(255, 255, 255, .65);
}

.legCounter button:hover {
  color: rgba(255, 255, 255, .9);
}

.legCounter button:active {
  background: rgba(255, 255, 255, .10);
  color: #fff;
}

.legCounter strong {
  font-size: 18px;
}

.legCounter button:active {
  background: rgba(255, 255, 255, .10);
}

.customScoreModal {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  background: #17251f;
  border-radius: 28px 28px 0 0;
  padding: 14px 20px 24px;
  box-shadow: 0 -16px 50px rgba(0, 0, 0, .55);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.customScoreHandle {
  width: 88px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
  margin: 0 auto 18px;
}

.customScoreHeader {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 28px;
}

.customScoreHeader button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.customScoreHeader div {
  font: inherit;
  font-size: 18px;
  font-weight: 900;
}

.customScoreModal label {
  display: block;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 10px;
}

.customScoreModal label span {
  color: #ff4d36;
}

.customScoreModal input {
  width: 100%;
  height: var(--tap);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  outline: none;
  padding: 0 14px;
}

.customConfirmBtn {
  width: 100%;
  height: var(--tap);
  margin-top: 24px;
  border: 0;
  border-radius: 12px;
  background: var(--yellow);
  color: #111;
  font-size: 16px;
  font-weight: 900;
}

.customScoreModal input::-webkit-outer-spin-button,
.customScoreModal input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.setupSectionTitle {
  margin-top: 6px;
}

.optionToggle {
  align-self: auto;
  height: 52px;
}

.fourOptionToggle {
  grid-template-columns: repeat(4, 1fr);
}

.fourOptionToggle .toggleSlider {
  width: calc(25% - 4px);
}

.fourOptionToggle.pos-0 .toggleSlider {
  transform: translateX(0%);
}

.fourOptionToggle.pos-1 .toggleSlider {
  transform: translateX(100%);
}

.fourOptionToggle.pos-2 .toggleSlider {
  transform: translateX(200%);
}

.fourOptionToggle.pos-3 .toggleSlider {
  transform: translateX(300%);
}

.twoOptionToggle {
  grid-template-columns: repeat(2, 1fr);
}

.twoOptionToggle .toggleSlider {
  width: calc(50% - 4px);
}

.twoOptionToggle.pos-0 .toggleSlider {
  transform: translateX(0%);
}

.twoOptionToggle.pos-1 .toggleSlider {
  transform: translateX(100%);
}

/* FINAL SETUP TOGGLE OVERRIDES */

.homeAwayToggle {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  height: 52px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}

.fourOptionToggle {
  grid-template-columns: repeat(4, 1fr);
}

.twoOptionToggle {
  grid-template-columns: repeat(2, 1fr);
}

.homeAwayToggle .toggleSlider {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: 11px;
  background: rgba(255, 255, 255, .16);
  transition: transform .22s ease, width .22s ease;
  z-index: 1;
}

.homeAwayToggle .toggleBtn {
  position: relative;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #aaa;
  font-weight: 900;
  cursor: pointer;
}

.homeAwayToggle .toggleBtn.active {
  color: #fff;
}

.customScoreToggle {
  display: grid;
  place-items: center;
  line-height: 1.05;
}

.customScoreToggle span {
  display: block;
  font: inherit;
  font-weight: 900;
}

.customScoreToggle strong {
  display: block;
  font: inherit;
  font-weight: 900;
}

/* Modal */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 9999;
}

.modalCard {
  width: min(520px, 100%);
  background: rgba(20, 22, 28, .98);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;

  /* ✅ ADD THESE */
  display: flex;
  flex-direction: column;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex: 0 0 auto;
}

.modalTitle {
  font-weight: 900;
  font-size: 15px;
}

.modalClose {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

.modalBody {
  padding: 10px 12px 14px;
  overflow: auto;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.modalBody input {
  width: 100%;
  height: 72px;
  border: 0;
  border-radius: 18px;
  background: rgba(0, 0, 0, .30);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  outline: none;
  padding: 0 18px;
}

/* remove number arrows */
.modalBody input::-webkit-outer-spin-button,
.modalBody input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gameBar {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.gameBarActions {
  display: flex;
  gap: 6px;
}

.gameTitleText {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statsModalCard {
  max-height: 90vh;
}

.statsMatchTitle {
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  margin-top: 4px;
}

.statsMatchDate {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 4px 0 16px;
}



.statsLegScore {
  display: flex;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  font-weight: 900;
}

.statsLegScore span {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .28);
}

.statsLegScore span:nth-child(2) {
  min-width: 20px;
  color: var(--muted);
}

.statsWinnerRow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 14px;
}

.statsWinnerRow>div {
  display: flex;
  justify-content: center;
}


#statsOverlay .modalTitle {
  text-align: left;
  width: auto;
}

.statsScoreRow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  margin-bottom: 8px;
}

.statsPlayerBlock {
  display: grid;
  grid-template-rows: 34px 28px;
  justify-items: center;
  align-items: center;
  gap: 6px;
}

.statsPlayerName {
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 900;
  text-align: center;
  font-size: 14px;
}

.wonPill {
  justify-self: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--yellow);
  color: #111;
  font-size: 11px;
  font-weight: 900;
}

.statsLegScore {
  align-self: start;
}

.statRow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.statValue {
  font-weight: 900;
  font-size: 20px;
  text-align: center;
}

.statLabel {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.statsHero {
  background: #085331;
  border-radius: 14px;
  padding: 12px 12px;
  margin-bottom: 14px;
}

.statsHero .statsMatchTitle,
.statsHero .statsMatchDate,
.statsHero .statsPlayerName {
  color: #fff;
}

#statsOverlay .modalTitle {
  text-align: left;
  width: 100%;
}

/* tighten spacing only when NOT match complete */
#statsOverlay:not(.matchComplete) .statsScoreRow {
  margin-bottom: 4px;
}

#statsOverlay:not(.matchComplete) .statsPlayerBlock {
  grid-template-rows: 28px 0px;
  gap: 0;
}

#statsOverlay:not(.matchComplete) .wonPill {
  display: none;
}


@media (max-width: 430px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

#customTeamWrap {
  display: grid;
  gap: 6px;
}

.btnspinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btnSpinner {
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 2px solid rgba(0, 0, 0, .25);
  border-top-color: #111;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.linkPlayerList {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.linkPlayerBtn {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font-weight: 900;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
}

.linkPlayerBtn:active {
  transform: translateY(1px);
}

.selectWrap {
  position: relative;
}

.selectWrap select {
  padding-right: 42px;
}

.selectArrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 900;
  pointer-events: none;
}


.playerPickList {
  display: grid;
  gap: 10px;
  margin: 10px 0 18px;
}

.playerPickBtn,
.playerRow {
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .22);
  color: #fff;
  font-weight: 900;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.playerPickBtn {
  grid-template-columns: 1fr;
  text-align: left;
}

.playerRow img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.playerRow .inviteBtn {
  border: 0;
  border-radius: 999px;
  background: var(--yellow);
  color: #111;
  padding: 8px 12px;
  font-weight: 900;
}

.playerTick {
  color: var(--green);
  font-weight: 900;
}

.statRow {
  display: grid;
  grid-template-columns: 1fr 110px 1fr;
  align-items: center;
  gap: 10px;
}

.statLabelWrap {
  min-width: 110px;
  display: flex;
  justify-content: center;
}

.statLabel {
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  white-space: nowrap;
}

.statsModeText {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  margin-top: -6px;
}

.resultSubmittedSuccess {
  margin-top: 16px;
  text-align: center;
}

#gameTitleText {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.setupPlayersPanel {
  min-height: 190px;
  border-radius: 20px;
  background: rgba(15, 34, 25, .72);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 22px;
  gap: 20px;
}

.setupPlayerTile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.setupPlayerAvatarWrap {
  position: relative;
  width: 82px;
  height: 82px;
}

.setupPlayerAvatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.setupPlayerName {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-align: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.removeSetupPlayerBtn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.addOpponentBtn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .18);
  color: #fff;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.addOpponentBtn span {
  transform: translateY(-2px);
}


html,
body {
  touch-action: manipulation;
}

button,
.keypad,
.keypad button {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.scorer-fullscreen {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #0f1115;
}

body.scorer-fullscreen .site-header,
body.scorer-fullscreen #appHeader {
  display: none !important;
}

body.scorer-fullscreen .wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

body.scorer-fullscreen .scorerCard {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  padding: 6px;
  overflow: hidden;
  display: grid;
  grid-template-rows:
    42px 240px 32px 52px 1fr !important;
  gap: 8px;
}

body.scorer-fullscreen .scoreEntry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

body.scorer-fullscreen .scoreEntry input {
  min-width: 0;
  width: 100%;
  pointer-events: none;
}

body.scorer-fullscreen .scoreEntry button {
  width: 104px;
  min-width: 0;
}

body.scorer-fullscreen .scoreboard,
body.scorer-fullscreen .keypad {
  width: 100%;
  min-width: 0;
}

html:has(body.scorer-fullscreen),
body.scorer-fullscreen {
  overflow: hidden !important;
  height: 100dvh !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

body.scorer-fullscreen .scorerCard,
body.scorer-fullscreen .keypad,
body.scorer-fullscreen button {
  touch-action: manipulation;
}