/* ============================================================================
 * OVERRIDE DARK THEME FROM PARENT CONTAINERS (e.g., scoremgmt jumbotron)
 * The jumbotron in scoremgmt.html has inline styles: color: #f4dbaa; background-color: #3d3d3d;
 * This ONLY applies to supported game types: singles_standard_gameplay and teams_standard_gameplay
 * Legacy game types are NOT affected by these overrides
 * ============================================================================ */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
  background-color: transparent !important;
  color: #212529 !important;
}

/*
 * Admin scoremgmt home/away: player <select>s are disabled for review.
 * WebKit paints disabled select text with inherited -webkit-text-fill-color,
 * which comes from the jumbotron's legacy cream (#f4dbaa) and is nearly
 * invisible on the light grid. Match official / captain / player / spectator
 * ink. Bail slots keep their own red fill (injected in teams.js).
 */
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-dropdown:disabled:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:disabled:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-dropdown.csd-readonly-disabled:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown.csd-readonly-disabled:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot) {
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
  opacity: 1 !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot) option,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot) option {
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
}

/*
 * Score manager 2.0, captain, and spectator: larger player names (readability for operators).
 * Inline 13px in teams.js is overridden here; @media print rules below still apply for browser print.
 */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot) {
  font-size: 17px !important;
  line-height: 1.2 !important;
}

/* Teams + HCP column: center name when subtext is empty (redundant HCP line hidden in JS). */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell {
  min-height: 28px !important;
  justify-content: center !important;
  align-items: center !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell:has(.csd-player-subtext:not(:empty)) {
  justify-content: flex-start !important;
  align-items: flex-start !important;
  min-height: 32px !important;
}

/*
 * Points + HCP value boxes (scoremgmt jumbotron cream leak).
 * Same ink / fill / cell bg as captain scoresheet. WebKit inherits
 * -webkit-text-fill-color from jumbotron #f4dbaa unless we set it here.
 */
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-display,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-hcp-dd-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-hcp-dd-display,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-points-container),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-points-container),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-select,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-select,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-select option,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-select option {
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-points-container):not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-points-container):not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-cell:not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell:not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game) {
  background-color: #ffffff !important;
}

/* Player live scoresheet: tint matched cells; keep default grid borders; one frame around the rack */
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game {
  background-color: rgba(34, 197, 94, 0.18) !important;
  color: #0f172a !important;
  font-size: 1.12em !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid {
  position: relative;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-my-game-row-frame {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  box-sizing: border-box;
  border: 2px solid rgba(22, 163, 74, 0.95);
  border-radius: 4px;
  box-shadow: 0 0 10px 2px rgba(34, 197, 94, 0.42), 0 0 4px 0 rgba(34, 197, 94, 0.32);
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game input,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game select,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game textarea,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game .csd-points-display,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game .csd-points-dropdown {
  font-size: 1em !important;
}

/* Break badge sits above the green row frame (frame is a later sibling at z-index 6) */
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-teams-player-cell.csd-my-game,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rownum.csd-my-game {
  z-index: 8 !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game .csd-break-indicator,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game .csd-break-indicator-teams {
  z-index: 9 !important;
}

/* Shared: mismatch = yellow, our scoring error = red. Green my-game is player-only (rules above). */
#scoresheet-designer .csd-cell.csd-opp-mismatch,
#scoresheet-designer .csd-rowcell.csd-opp-mismatch {
  background-color: rgba(250, 204, 21, 0.48) !important;
  color: #422006 !important;
  position: relative !important;
  overflow: visible !important;
  z-index: 20 !important;
  box-shadow: none !important;
}

#scoresheet-designer .csd-cell.csd-opp-mismatch::after,
#scoresheet-designer .csd-rowcell.csd-opp-mismatch::after {
  content: "" !important;
  position: absolute !important;
  inset: 1px !important;
  border: 2.5px solid rgba(202, 138, 4, 0.92) !important;
  border-radius: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

#scoresheet-designer .csd-cell.csd-score-error,
#scoresheet-designer .csd-rowcell.csd-score-error,
#scoresheet-designer .csd-cell.csd-score-error.csd-opp-mismatch,
#scoresheet-designer .csd-rowcell.csd-score-error.csd-opp-mismatch {
  background-color: #fca5a5 !important;
  color: #450a0a !important;
  position: relative !important;
  overflow: visible !important;
  z-index: 22 !important;
  box-shadow: 0 0 8px 2px rgba(220, 38, 38, 0.45) !important;
}

#scoresheet-designer .csd-cell.csd-score-error::after,
#scoresheet-designer .csd-rowcell.csd-score-error::after,
#scoresheet-designer .csd-cell.csd-score-error.csd-opp-mismatch::after,
#scoresheet-designer .csd-rowcell.csd-score-error.csd-opp-mismatch::after {
  content: "" !important;
  position: absolute !important;
  inset: 1px !important;
  border: 2.5px solid rgba(185, 28, 28, 0.9) !important;
  border-radius: 6px !important;
  background: transparent !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

#scoresheet-designer .csd-alert-bang,
#scoresheet-designer .csd-opp-mismatch-bang {
  position: absolute !important;
  top: 2px !important;
  right: 2px !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at 50% 78%, #fff 0 1.5px, transparent 1.65px),
    linear-gradient(#fff, #fff) 50% 26% / 2.2px 5px no-repeat,
    #e31837 !important;
  border: 1.5px solid #fff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35) !important;
  transform: rotate(12deg) !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  z-index: 120 !important;
}

#scoresheet-designer .csd-teams-hcp-cell.csd-opp-mismatch > .csd-alert-bang,
#scoresheet-designer .csd-teams-hcp-cell.csd-opp-mismatch > .csd-opp-mismatch-bang {
  display: none !important;
}

.csd-score-alert-tooltip {
  position: fixed;
  z-index: 99999;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.csd-score-alert-tooltip-mismatch {
  background: #422006;
  border: 1px solid #facc15;
}

.csd-score-alert-tooltip-error {
  background: #450a0a;
  border: 1px solid #f87171;
}

/* Player my-game: keep green row; yellow/red cells must beat the green wash.
   Feat cells (8BB / 8RO / 8TRO) stay green — error is the ! + outline, not a red fill. */
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-opp-mismatch {
  background-color: rgba(250, 204, 21, 0.48) !important;
  color: #422006 !important;
  z-index: 20 !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-score-error:not([data-csd-field="brk"]):not([data-csd-field="ero"]):not([data-csd-field="tro"]),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-score-error.csd-opp-mismatch:not([data-csd-field="brk"]):not([data-csd-field="ero"]):not([data-csd-field="tro"]) {
  background-color: #fca5a5 !important;
  color: #450a0a !important;
  z-index: 22 !important;
}

/* Player self-score: disabled control hit-through — see override after ".csd-rowcell input[type=\"checkbox\"]" (must beat pointer-events: auto !important). */

/* -----------------------------------------------------------------------------
   /scoresheet CSD (teams): not-allowed on read-only cells; pointer on .csd-my-game
   rack cells (including points column overrides). body.csd-live-scoresheet-* from
   popscoresheet / spectator init. Watch: full grid read-only; player: highlighted rack = pointer.
   ----------------------------------------------------------------------------- */

body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-player-cell,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-hcp-cell,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-score-cell,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="points"],
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="win"],
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="brk"],
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="ero"],
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="tro"],
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-player-cell:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-hcp-cell:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-score-cell:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="points"]:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="win"]:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="brk"]:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="ero"]:not(.csd-my-game),
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="tro"]:not(.csd-my-game) {
  cursor: not-allowed !important;
}

body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-player-cell *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-hcp-cell *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-score-cell *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="points"] *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="win"] *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="brk"] *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="ero"] *,
body.csd-live-scoresheet-watch #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="tro"] *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-player-cell:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-hcp-cell:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-teams-score-cell:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="points"]:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="win"]:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="brk"]:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="ero"]:not(.csd-my-game) *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell[data-csd-field="tro"]:not(.csd-my-game) * {
  cursor: not-allowed !important;
}

/*
 * Player /scoresheet: cue-tip cursor on your rack (hotspot at the tip).
 * "Your shot" — tap to enter the game. Fallback pointer.
 */
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-points-container,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-points-container *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rownum.csd-my-game,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game *,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rownum.csd-my-game {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='21' y1='3' x2='7.2' y2='16.8' stroke='%236b3e1a' stroke-width='2.4' stroke-linecap='round'/%3E%3Cline x1='8.4' y1='15.6' x2='5.2' y2='18.8' stroke='%23e8e4dc' stroke-width='2.1' stroke-linecap='round'/%3E%3Ccircle cx='4.2' cy='19.8' r='2' fill='%23111'/%3E%3Ccircle cx='4.2' cy='19.8' r='0.85' fill='%23f3f4f6'/%3E%3C/svg%3E")
    4 20,
    pointer !important;
}

/* Points column: inner container defaults to pointer for captain; force read-only for non–my-game player rows */
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell:not(.csd-my-game) .csd-points-container,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell:not(.csd-my-game) .csd-points-container * {
  cursor: not-allowed !important;
}

body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell:not(.csd-my-game) .csd-points-container,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell:not(.csd-my-game) .csd-points-container * {
  cursor: not-allowed !important;
}

/* Sheet header - pale blue theme for all game types */

#scoresheet-designer .csd-sheet-bar {
  background: #90caf9 !important;
  border: 1px solid #42a5f5 !important;
  padding: 8px 12px !important;
  border-radius: 4px 4px 0 0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  color: #0d47a1 !important;
  font-weight: 600 !important;
}

/* Keep all content inside #scoresheet-designer - no page-level horizontal scroll; inner .csd-round-scroll handles overflow */

/* Live Preview panel: permanently hide horizontal scrollbars - clip overflow instead of scrolling */
#csd-preview-container,
#csd-preview-body,
#csd-preview-root,
#csd-preview-container .csd-round-scroll,
#csd-preview-container [id^="csd-round-"],
#csd-preview-container .csd-two,
#csd-preview-container .csd-col,
#csd-preview-container .csd-scoresheet-wrapper,
#csd-preview-body .csd-round-scroll,
#csd-preview-body [id^="csd-round-"],
#csd-preview-body .csd-two,
#csd-preview-body .csd-col,
#csd-preview-body .csd-scoresheet-wrapper,
#scoresheet-designer .csd-round-scroll,
#scoresheet-designer [id^="csd-round-"],
#scoresheet-designer .csd-two,
#scoresheet-designer .csd-round-scroll .csd-col,
#scoresheet-designer .csd-round-scroll .csd-scoresheet-wrapper {
  overflow-x: hidden !important;
}

/* Center content with max total width 1400px (team headers + round grids combination) */

#scoresheet-designer {
  width: 100% !important;
  max-width: 1400px !important;
  min-width: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  box-sizing: border-box !important;
}

/* Teams scoresheet: max 1200px and always stay inside #scoresheet-designer; scale content to fit on smaller screens */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
  max-width: 1200px !important;
  container-type: inline-size !important;
  container-name: csd-teams !important;
}

/* Teams: allow round grid and card columns to shrink so content fits inside container */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
  min-width: 0 !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-home-card"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-away-card"] {
  min-width: 0 !important;
}

/* Teams: base grid – Player column smaller but flexible (1fr); other cells max 50px. Prevents Score/overall cutoff. */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
  grid-template-columns: 40px minmax(60px, 1fr) 50px 60px 50px 50px 50px 60px !important;
  width: 100% !important;
}

/* vnea+ Customizations: hide feat columns independently (cells stay in the DOM). */
#scoresheet-designer[data-csd-hide-ebb="1"] .csd-col-bb,
#scoresheet-designer[data-csd-hide-ebb="1"] [data-csd-field="brk"] {
  display: none !important;
}

#scoresheet-designer[data-csd-hide-ero="1"] .csd-col-ro,
#scoresheet-designer[data-csd-hide-ero="1"] [data-csd-field="ero"] {
  display: none !important;
}

#scoresheet-designer[data-csd-hide-tro="1"] .csd-col-tro,
#scoresheet-designer[data-csd-hide-tro="1"] [data-csd-field="tro"] {
  display: none !important;
}

/* Teams: right-side padding so Score column and Round Totals "overall" are not cut off */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-scoresheet-wrapper {
  padding-right: 0px !important;
  box-sizing: border-box !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
  padding-right: 5px !important;
}

/* Scale round grid columns and font/padding so content fits inside #scoresheet-designer as container shrinks (others stay ≤50px) */

@container csd-teams (max-width: 1200px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 40px minmax(60px, 1fr) 50px 60px 50px 50px 50px 60px !important;
    font-size: 0.98em !important;
  }
}

@container csd-teams (max-width: 1200px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
}

@container csd-teams (max-width: 1100px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 36px minmax(60px, 1fr) 48px 56px 48px 48px 48px 56px !important;
    font-size: 0.94em !important;
  }
}

@container csd-teams (max-width: 1100px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
}

@container csd-teams (max-width: 1000px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 32px minmax(60px, 1fr) 44px 52px 44px 44px 44px 52px !important;
    font-size: 0.9em !important;
  }
}

@container csd-teams (max-width: 1000px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}

/* Large Screens: Keep standard side-by-side totals layout (perfect for desktop) */

@container csd-teams (min-width: 1251px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-totals-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 1.5rem !important;
  }
}

@container csd-teams (max-width: 900px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 28px minmax(60px, 1fr) 40px 48px 40px 40px 40px 48px !important;
    font-size: 0.85em !important;
  }
}

@container csd-teams (max-width: 800px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 24px minmax(50px, 1fr) 36px 44px 36px 36px 36px 44px !important;
    font-size: 0.8em !important;
  }
}

/* Very narrow viewports (e.g. Galaxy S21 ~360px): smaller columns + font to reduce right-edge cutoff */

@container csd-teams (max-width: 420px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: 18px minmax(36px, 1fr) 28px 32px 28px 28px 28px 32px !important;
    font-size: 0.72em !important;
  }
}

@container csd-teams (max-width: 420px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  /* Keep scr + totals breathing room (do not crush to 1px) */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-score,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-score-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
    padding-left: 4px !important;
    padding-right: 10px !important;
  }
}

@container csd-teams (max-width: 420px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text {
    gap: 0.2rem 0.1rem !important;
    font-size: 0.82em !important;
  }
}

@container csd-teams (max-width: 800px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-score,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-score-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
    padding-left: 4px !important;
    padding-right: 10px !important;
  }
}

/* Tighten spacing for totals row items on narrow screens */

@container csd-teams (max-width: 800px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text {
    gap: 0.25rem 0.15rem !important;
    font-size: 0.9em !important;
  }
}

/* Ensure preview containers have proper background - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-wrap,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-preview,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-preview-container,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-preview-body,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-preview-root,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-wrap,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview-container,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview-body,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview-root {
  background-color: transparent !important;
  color: #212529 !important;
}

/* Ensure grids have white backgrounds - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid {
  background-color: #ffffff !important;
  color: #212529 !important;
}

/* Ensure cards have white backgrounds - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-card,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-card {
  background-color: #ffffff !important;
  color: #212529 !important;
}

/* Ensure columns and wrappers have white backgrounds - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-col .csd-scoresheet-wrapper,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col .csd-scoresheet-wrapper {
  background-color: #ffffff !important;
}

/* Ensure cells have proper text color - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-header,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell {
  color: #212529 !important;
}

/* Ensure header bar has proper styling - ONLY for supported game types */

/* Match the original good styling that singles has (dark background, white text, rounded corners) */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar {
  background-color: #495057 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 0.375rem !important;
  padding: 8px 12px !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
  margin-bottom: 1rem !important;
  position: relative !important;
  z-index: 1050 !important;
  overflow: visible !important;
}

/* Ensure header bar text elements have proper color - white text on dark background */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar .csd-bar-title,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar .csd-bar-meta,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar span,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar .csd-bar-title,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar .csd-bar-meta,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar span {
  color: #ffffff !important;
}

/* Make the "Scoresheet" title bold */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar .csd-bar-title,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar .csd-bar-title {
  font-weight: bold !important;
  font-size: 1.1em !important;
  margin-bottom: 0.5rem !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-bar .csd-bar-title:empty,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bar .csd-bar-title:empty {
  display: none !important;
}

.csd-bar-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  width: 100% !important;
}

.csd-bar-meta {
  font-size: 0.9em !important;
  opacity: 0.95 !important;
}

/* Score Manager bar: info on one line, buttons on the next. No wrap, so the sheet does not jump as labels appear. */
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-meta,
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-actions {
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  min-width: 0 !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-meta > * {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-meta > span:first-child {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-meta .truncate {
  display: inline-block !important;
  width: auto !important;
  max-width: 100% !important;
  vertical-align: bottom !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-actions {
  gap: 0.5rem !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-bar-actions > .mx-2:first-child {
  display: none !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-action-btns {
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt .csd-action-btn,
#scoresheet-designer .csd-bar.csd-bar--scoremgmt #csd-lineup-options-dropdown {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
#scoresheet-designer .csd-bar.csd-bar--scoremgmt select#csd-homeoraway {
  width: auto !important;
  flex: 0 0 auto !important;
}

/* Tournament bracket deep link — reads as a link (soft blue + underline); override .csd-bar span { white } for label */
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  font-weight: 600 !important;
  color: #86c8ff !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 3px !important;
  text-decoration-color: rgba(134, 200, 255, 0.55) !important;
  white-space: nowrap !important;
}
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link span,
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link i {
  color: #86c8ff !important;
  font-weight: 600 !important;
}
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link i {
  text-decoration: none !important;
}
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link:hover {
  color: #b8e4ff !important;
  text-decoration-color: rgba(184, 228, 255, 0.9) !important;
}
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link:hover span,
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link:hover i {
  color: #b8e4ff !important;
}
#scoresheet-designer .csd-bar .csd-bar-meta a.csd-tournament-bracket-link .csd-tournament-bracket-link__icon {
  font-size: 0.95em !important;
  opacity: 0.95 !important;
}

.csd-bar-status {
  margin-top: 0.25rem !important;
  padding-top: 0.25rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  font-size: 0.8em !important;
  color: rgba(255, 255, 255, 0.85) !important;
  font-style: italic !important;
  min-height: 1.25rem !important;
}

.csd-bar-status:empty {
  display: none !important;
}

/* Captain tournament: stylized Flip Home vs Away button */
.csd-flip-homeaway-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: 0.35rem !important;
  cursor: pointer !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  white-space: nowrap !important;
}
.csd-flip-homeaway-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(245,158,11,0.4) !important;
}
.csd-flip-homeaway-btn i.fa-exchange {
  font-size: 0.9em !important;
}

/* Ensure borders are visible - ONLY for supported game types */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-card,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-card,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell {
  border: 1px solid #dee2e6 !important;
}

/* Ensure headers and row cells also have borders */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-header,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell {
  border: 1px solid #dee2e6 !important;
}

/* Header rows - slightly grey background to match divmgmt */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-header {
  background-color: #e9ecef !important;
}

/* Make grid headers bold and slightly smaller */

#scoresheet-designer .csd-grid .csd-header.csd-cell {
  font-weight: 700 !important;
  font-size: 0.85em !important;
  text-transform: none !important;
}

/* Totals row (Round scores/handicap/totals) - slightly grey background to match divmgmt */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-totals,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-totals {
  background-color: #e9ecef !important;
}

/* Gap between Home and Away grids - desktop view */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two {
  gap: 1rem !important;
}

/* Narrow screens: minimal gap between home/away grid cols; no margin on outer edges */
@media (max-width: 767px) {
  #scoresheet-designer .csd-round-scroll .csd-two {
    gap: 1px !important;
  }
  #scoresheet-designer .csd-round-scroll .csd-two .csd-col:first-child,
  #scoresheet-designer .csd-round-scroll .csd-two .csd-col:last-child {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Teams: also tighten gap when container is narrow (e.g. portrait mobile) */
@container csd-teams (max-width: 900px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two {
    gap: 1px !important;
  }
}

/* Match scores summary: same two-column card layout as player headers and round grids */
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-matchscores-summary {
  width: 100% !important;
}

/* Truncate content that doesn't fit - prevent overflow */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Exclude totals row from truncation - allow wrapping */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-totals,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-totals {
  white-space: normal !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

/* Captain merge "New!" on pts cell — override rowcell overflow:hidden + ellipsis (all viewports). */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell.csd-player-merge-highlight[data-csd-field="points"],
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell.csd-player-merge-highlight[data-csd-field="points"] {
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Round totals text row - single cell: "Round Totals" left, team hcp / round score / overall right, one row */

/* Fallback rule for when data-csd-game-type attribute is not set (divmgmt) */

.csd-round-totals-text {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0.3rem 0.4rem !important;
  font-family: inherit !important;
  font-size: 0.85em !important;
  white-space: nowrap !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  cursor: help !important;
  position: relative !important;
  gap: 0.4rem 0.6rem !important;
  min-width: 0 !important;
}

/* Specific rule for when data-csd-game-type attribute is set (scoremgmt) */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0.3rem 0.4rem !important;
  font-family: inherit !important;
  font-size: 0.85em !important;
  white-space: nowrap !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  cursor: help !important;
  position: relative !important;
  gap: 0.4rem 0.6rem !important;
  min-width: 0 !important;
}

/* Round Totals cell: do not clip so "overall" is always visible (override .csd-totals overflow) */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
  overflow: visible !important;
}

/* Mobile: Long press for tooltip + fluid scale for Round score summaries (HCP/SCORE/OVERALL) - no cutoff */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text {
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    font-size: clamp(9px, 2vw, 12px) !important;
    padding: 0.2rem 0.2rem !important;
    gap: 0.15rem 0.2rem !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-totals.csd-round-totals-text {
    padding-right: 10px !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .round-totals-title,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .round-totals-title {
    font-size: clamp(11px, 2.5vw, 14px) !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .totals-item,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .totals-item {
    gap: 0.08rem !important;
    min-width: 0 !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text strong,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text strong {
    font-size: clamp(11px, 2.5vw, 14px) !important;
  }
}

/* "Round Totals" title - left only; team hcp / round score / overall grouped on the right via margin-right: auto */

.csd-round-totals-text .round-totals-title {
  font-size: 1.1em !important;
  font-weight: bold !important;
  color: #212529 !important;
  margin-right: auto !important;
  flex-shrink: 0 !important;
  text-align: left !important;
}

/* "Round Totals" title - larger and left justified - Specific */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .round-totals-title,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .round-totals-title {
  font-size: 1.1em !important;
  font-weight: bold !important;
  color: #212529 !important;
  margin-right: auto !important;
  flex-shrink: 0 !important;
  text-align: left !important;
}

/* Labels (team hcp, round handicap, round score, overall) - make bold */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .label,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .label {
  font-weight: bold !important;
  color: #212529 !important;
}

/* Values - keep normal weight */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .value,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .value {
  font-weight: normal !important;
  color: #212529 !important;
}

/* Item wrapper for label+value pairs - right justified with spacing - Fallback */

.csd-round-totals-text .totals-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Item wrapper for label+value pairs - right justified with spacing - Specific */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text .totals-item,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .totals-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Legacy support for old structure */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-totals-text strong,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text strong {
  font-weight: bold !important;
  color: #212529 !important;
  font-size: 1.1em !important;
  flex-shrink: 0 !important;
}

/* Round Totals "score needed" tap pop + teammate merge "New!" detail — same dark toast */
.csd-win-status-toast,
.csd-merge-detail-toast {
  position: fixed;
  background: rgba(33, 37, 41, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  max-width: min(420px, 80vw);
  text-align: center;
  white-space: pre-line;
  line-height: 1.4;
}

/* Center-align all grid content horizontally EXCEPT Player column */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell {
  text-align: center !important;
  touch-action: manipulation !important;
}

/* Ensure checkboxes are clickable and not blocked by overlays */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell input[type="checkbox"] {
  z-index: 100 !important;
  position: relative !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  width: 24px !important;
  height: 24px !important;
  margin: 0 !important;
  touch-action: manipulation !important;
}

/*
 * Player self-score (/scoresheet role=player): modal opens on .csd-my-game click. Overlay
 * selects (HCP / points) and checkboxes must not capture hover or mousedown — native
 * dropdowns were flashing before the Your Game modal. Captain / official are not
 * body.csd-live-scoresheet-player.
 */
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game input,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game input,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game select,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game select,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game textarea,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game textarea,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-points-dropdown,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-points-dropdown,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-teams-hcp-select,
body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-rowcell.csd-my-game .csd-teams-hcp-select {
  pointer-events: none !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rowcell.csd-my-game .csd-points-display:hover,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rowcell.csd-my-game .csd-hcp-dd-container:hover .csd-hcp-dd-display,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rowcell.csd-my-game .csd-points-dropdown:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rowcell.csd-my-game .csd-dropdown-indicator {
  display: none !important;
}

body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-rownum.csd-my-game.csd-interactive-num:hover,
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-interactive-num.csd-my-game:hover {
  background-color: inherit !important;
  color: inherit !important;
  font-weight: inherit !important;
  box-shadow: none !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell.csd-my-game input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell.csd-my-game input[type="checkbox"]:disabled {
  pointer-events: none !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell.csd-my-game select:disabled,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell.csd-my-game select:disabled {
  pointer-events: none !important;
}

/* Ensure grid itself handles touches properly */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid {
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

/* Ensure the scroll container allows clicks through to children */

#scoresheet-designer .csd-round-scroll {
  touch-action: pan-x pan-y !important;
  pointer-events: auto !important;
}

/* Make the cell itself a larger touch target if possible */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell {
  position: relative !important;
}

/* Player column - keep left-aligned */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-player-header,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-header {
  text-align: left !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-teams-player-cell {
  min-height: 44px !important;
  box-sizing: border-box !important;
}

/* Points dropdown container - relative positioning for absolute children, full height and clickable */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-container,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 2rem !important;
  cursor: pointer !important;
}

/* Ensure cells containing points containers fill properly */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-points-container),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-points-container),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-hcp-dd-container),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-hcp-dd-container) {
  display: flex !important;
  align-items: stretch !important;
  padding: 0 !important;
}

/* Points display - visible by default, hidden when dropdown is shown, vertically centered */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-display,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-hcp-dd-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-hcp-dd-display {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  min-height: 2rem !important;
  cursor: pointer !important;
  padding: 0.25rem 0.5rem !important;
  position: relative !important;
  z-index: 1 !important;
  pointer-events: auto !important;
  background: transparent !important;
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
}

/* Points + hcp cells: same light box as captain scoresheet */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-points-container),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-points-container) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
}

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-cell:not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell:not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell:has(.csd-points-container):not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell:has(.csd-points-container):not(.csd-opp-mismatch):not(.csd-score-error):not(.csd-my-game) {
  background-color: #ffffff !important;
}
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-cell.csd-hcp-dd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell.csd-hcp-dd-cell {
  display: flex !important;
  align-items: stretch !important;
  padding: 0 !important;
}
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-hcp-dd-container,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-hcp-dd-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-container:hover .csd-points-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container:hover .csd-points-display,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-hcp-dd-container:hover .csd-hcp-dd-display,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-hcp-dd-container:hover .csd-hcp-dd-display {
  background: #f9fafb !important;
  border: 1px solid #d1d5db !important;
  border-radius: 4px !important;
}
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-hcp-select,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-select {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10 !important;
  opacity: 0 !important;
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  border: none !important;
  background: transparent !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
}

/* Add player modal — light/dark via --idx-* tokens and body.dark-theme */

.csd-addplayer-modal .modal-dialog {
  max-width: 420px;
}

.csd-addplayer-modal.modal {
  overflow: visible;
}

.csd-addplayer-modal .modal-content,
.csd-addplayer-modal .csd-addplayer-modal-content {
  background: var(--idx-surface, #fff);
  color: var(--idx-fg, #1d1d1f);
  border: 1px solid var(--idx-border, #d2d2d7);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.csd-addplayer-modal .modal-header,
.csd-addplayer-modal .csd-addplayer-modal-header {
  border-bottom: 1px solid var(--idx-border, #d2d2d7);
  align-items: flex-start;
}

.csd-addplayer-modal .csd-addplayer-modal-title {
  font-family: Oswald, sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--idx-fg, #1d1d1f);
}

.csd-addplayer-modal .csd-addplayer-modal-subtitle {
  font-family: Roboto, sans-serif;
  font-size: 0.85rem;
  color: var(--idx-muted, #6c757d);
  margin-top: 0.15rem;
}

.csd-addplayer-modal .csd-addplayer-modal-close,
.csd-addplayer-modal .close {
  color: var(--idx-muted, #6c757d);
  text-shadow: none;
  opacity: 1;
}

.csd-addplayer-modal .csd-addplayer-modal-close:hover,
.csd-addplayer-modal .close:hover {
  color: var(--idx-fg, #1d1d1f);
}

.csd-addplayer-modal .modal-footer,
.csd-addplayer-modal .csd-addplayer-modal-footer {
  border-top: 1px solid var(--idx-border, #d2d2d7);
}

.csd-addplayer-modal.csd-addplayer-phone label[for="csd-addplayer-player-wrap"] {
  display: none;
}

.csd-addplayer-modal .csd-addplayer-native-select,
.csd-addplayer-modal .csd-addplayer-new-name {
  width: 100%;
  font-size: 16px;
  min-height: 2.75rem;
  margin-bottom: 0.75rem;
}

.csd-addplayer-modal .csd-addplayer-phone-note {
  font-size: 0.85rem;
  color: var(--idx-muted, #6c757d);
  margin: -0.35rem 0 0.25rem;
}

.csd-addplayer-modal .csd-addplayer-label {
  display: block;
  font-family: Oswald, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--idx-muted, #6c757d);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

.csd-addplayer-modal .csd-addplayer-field .csd-addplayer-input-wrap,
.csd-addplayer-modal .csd-addplayer-field .csd-addplayer-hcp-text-wrap,
.csd-addplayer-modal .csd-addplayer-trs {
  font-size: 1rem;
  color: var(--idx-fg, #1d1d1f);
  font-weight: normal;
}

.csd-addplayer-modal .csd-addplayer-hcp-text-only {
  padding: 0.25rem 0;
}

.csd-addplayer-modal .csd-addplayer-hcp-text-wrap {
  display: inline-block;
}

.csd-addplayer-modal .csd-addplayer-label-inline {
  font-size: 1rem;
  font-weight: 500;
  color: var(--idx-fg, #1d1d1f);
  margin-right: 0.25rem;
}

.csd-addplayer-modal .csd-addplayer-hcp-value,
.csd-addplayer-modal .csd-addplayer-trs-cpr-value {
  font-weight: 500;
  color: var(--idx-fg, #1d1d1f);
}

.csd-addplayer-modal .csd-addplayer-avp-hint {
  font-family: Roboto, sans-serif;
  font-size: 0.8rem;
  color: var(--idx-muted, #6c757d);
  margin-top: 0.35rem;
}

.csd-addplayer-modal #csd-addplayer-hcp-wrap select,
.csd-addplayer-modal #csd-addplayer-hcp-select,
.csd-addplayer-modal .csd-addplayer-hcp-picker,
.csd-addplayer-modal .select2-container--default .select2-selection--single {
  background-color: var(--idx-surface, #fff);
  color: var(--idx-fg, #1d1d1f);
  border: 1px solid var(--idx-border, #d2d2d7);
  border-radius: 8px;
  min-height: 2.35rem;
}

.csd-addplayer-modal .csd-addplayer-hcp-picker,
.csd-addplayer-modal #csd-addplayer-hcp-wrap:not(.csd-addplayer-hcp-text-only) select {
  width: 100%;
  padding: 0.35rem 0.6rem;
}

.csd-addplayer-modal .select2-container {
  width: 100% !important;
}

.csd-addplayer-modal .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--idx-fg, #1d1d1f);
  line-height: 2.25rem;
  padding-left: 0.6rem;
}

.csd-addplayer-modal .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--idx-muted, #6c757d);
}

.csd-addplayer-modal .select2-dropdown {
  background: var(--idx-surface, #fff);
  color: var(--idx-fg, #1d1d1f);
  border-color: var(--idx-border, #d2d2d7);
  z-index: 1060;
}

.csd-addplayer-modal .select2-results__option {
  color: var(--idx-fg, #1d1d1f);
}

.csd-addplayer-modal .select2-results__option--highlighted[aria-selected] {
  background: #0d6efd;
  color: #fff;
}

.csd-addplayer-modal .select2-search--dropdown .select2-search__field {
  background: var(--idx-surface, #fff);
  color: var(--idx-fg, #1d1d1f);
  border-color: var(--idx-border, #d2d2d7);
}

.csd-addplayer-modal .csd-addplayer-btn-cancel {
  background: transparent;
  color: var(--idx-fg, #1d1d1f);
  border: 1px solid var(--idx-border, #d2d2d7);
}

.csd-addplayer-modal .csd-addplayer-btn-add {
  font-family: Oswald, sans-serif;
  font-weight: 500;
  letter-spacing: 0.03em;
}

body.dark-theme .csd-addplayer-modal .modal-content,
body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-content {
  background: #343a40;
  color: #f8f9fa;
  border-color: #454d55;
}

body.dark-theme .csd-addplayer-modal .modal-header,
body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-header,
body.dark-theme .csd-addplayer-modal .modal-footer,
body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-footer {
  border-color: #454d55;
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-title,
body.dark-theme .csd-addplayer-modal .csd-addplayer-hcp-value,
body.dark-theme .csd-addplayer-modal .csd-addplayer-trs-cpr-value,
body.dark-theme .csd-addplayer-modal .csd-addplayer-label-inline {
  color: #f8f9fa;
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-subtitle,
body.dark-theme .csd-addplayer-modal .csd-addplayer-label,
body.dark-theme .csd-addplayer-modal .csd-addplayer-avp-hint {
  color: #adb5bd;
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-close,
body.dark-theme .csd-addplayer-modal .close {
  color: #adb5bd;
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-modal-close:hover,
body.dark-theme .csd-addplayer-modal .close:hover {
  color: #f8f9fa;
}

body.dark-theme .csd-addplayer-modal #csd-addplayer-hcp-wrap select,
body.dark-theme .csd-addplayer-modal #csd-addplayer-hcp-select,
body.dark-theme .csd-addplayer-modal .csd-addplayer-hcp-picker,
body.dark-theme .csd-addplayer-modal .select2-container--default .select2-selection--single,
body.dark-theme .csd-addplayer-modal .select2-dropdown,
body.dark-theme .csd-addplayer-modal .select2-search--dropdown .select2-search__field {
  background-color: #212529;
  color: #f8f9fa;
  border-color: #454d55;
}

body.dark-theme .csd-addplayer-modal .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark-theme .csd-addplayer-modal .select2-results__option {
  color: #f8f9fa;
}

body.dark-theme .csd-addplayer-modal .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #adb5bd;
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: #f8f9fa;
  border-color: rgba(255, 255, 255, 0.35);
}

body.dark-theme .csd-addplayer-modal .csd-addplayer-error.alert-danger {
  background: #5c2b2b;
  border-color: #8a3b3b;
  color: #f8d7da;
}

/* score column values - vertically centered */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-teams-score-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-score-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Points dropdown select - absolutely positioned to overlay display, preventing row height increase */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-dropdown,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-dropdown {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10 !important;
}

/* Ensure sheet bar has proper styling - ONLY for supported game types */

/* White background with dark text, flexbox layout for left/right alignment */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar {
  background-color: #90caf9 !important;
  border: 1px solid #42a5f5 !important;
  color: #212529 !important;
  border-radius: 0.375rem !important;
  padding: 8px 12px !important;
  margin-bottom: 0.5rem !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* Sheet bar text elements - dark text */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar .csd-sheet-main,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar .csd-sheet-match-id,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar .csd-sheet-sub,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar .csd-sheet-main,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar .csd-sheet-match-id,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar .csd-sheet-sub {
  color: #212529 !important;
}

/* Sheet main (Sheet 1 of x) - left aligned, bold */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar .csd-sheet-main,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar .csd-sheet-main {
  text-align: left !important;
  font-weight: bold !important;
  flex-shrink: 0 !important;
}

/* Sheet sub (Match ID and Home/Away info) - right aligned, normal weight */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet-bar .csd-sheet-sub,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet-bar .csd-sheet-sub {
  text-align: right !important;
  font-weight: normal !important;
  margin-left: auto !important;
}

/* Round title - make text bold and remove excessive margin */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-title .csd-bar,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title .csd-bar {
  font-weight: bold !important;
  margin-bottom: 0 !important;
}

/* Reduce spacing between round header and grids - override mb-2 class */

#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-title.mb-2,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title.mb-2 {
  margin-bottom: 0.25rem !important;
}

/* Ensure TRS/HCP details are hidden for teams mode; preserve Games Won / Rounds Won / Match Won stats.
   Exclude .csd-pergame-hcp — that slot is reserved so award text cannot bump the sheet. */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-dyn-hcp,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-mini.text-muted:not(.csd-pergame-hcp):not(.csd-season-rp),
.csd-card .csd-mini.text-muted:not(.csd-pergame-hcp):not(.csd-season-rp) {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Reserved handicap-award line (empty or filled) — desktop. Mobile uses View Details modal. */
@media (min-width: 768px) {
  #scoresheet-designer .csd-card .csd-mini.csd-pergame-hcp {
    display: block !important;
    visibility: visible !important;
    min-height: 1.25em;
    height: 1.25em !important;
    line-height: 1.25em;
    margin: 0.25rem 0 0 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap;
  }

  #scoresheet-designer .csd-card .csd-mini.csd-pergame-hcp.csd-pergame-hcp--split,
  #scoresheet-designer .csd-card .csd-mini.csd-pergame-hcp.csd-team-strength {
    height: auto !important;
    min-height: 1.25em;
    white-space: normal;
    overflow: visible !important;
    line-height: 1.2;
  }
}

/* Season-RP sentence removed — those values live in the team-strength table */
#scoresheet-designer .csd-card .csd-mini.csd-season-rp {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

#scoresheet-designer .csd-team-strength-table,
.csd-modal-pergame-hcp .csd-team-strength-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  border: 1px solid #9aa3ad;
  background: #fff;
  font-size: 12px;
  line-height: 1.15;
  margin: 2px 0 0 0;
  color: #111827;
}

#scoresheet-designer .csd-team-strength-table th,
#scoresheet-designer .csd-team-strength-table td,
.csd-modal-pergame-hcp .csd-team-strength-table th,
.csd-modal-pergame-hcp .csd-team-strength-table td {
  padding: 2px 8px;
  border: 1px solid #c5ccd3;
}

#scoresheet-designer .csd-team-strength-table th,
.csd-modal-pergame-hcp .csd-team-strength-table th {
  font-family: Oswald, sans-serif;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  color: #374151;
  white-space: nowrap;
}

#scoresheet-designer .csd-team-strength-table td,
.csd-modal-pergame-hcp .csd-team-strength-table td {
  font-family: Roboto, sans-serif;
  font-weight: 700;
  text-align: right;
  min-width: 2.25em;
  color: #111827;
}

#scoresheet-designer .csd-team-strength-table .csd-team-strength-total th,
#scoresheet-designer .csd-team-strength-table .csd-team-strength-total td,
.csd-modal-pergame-hcp .csd-team-strength-table .csd-team-strength-total th,
.csd-modal-pergame-hcp .csd-team-strength-table .csd-team-strength-total td {
  font-weight: 700;
  background: #f3f4f6;
}

#scoresheet-designer .csd-team-strength-row,
.csd-modal-pergame-hcp .csd-team-strength-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
}

#scoresheet-designer .csd-team-strength-award,
.csd-modal-pergame-hcp .csd-team-strength-award {
  font-family: Oswald, sans-serif;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1;
  color: #16a34a;
  text-shadow: 0 0 4px rgba(34, 197, 94, 0.9), 0 0 8px rgba(34, 197, 94, 0.45);
  white-space: nowrap;
}

/* Player header cards: normalize height so both home/away match the taller side */
#scoresheet-designer .csd-sheet > .csd-two .csd-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}
#scoresheet-designer .csd-sheet > .csd-two .csd-col .csd-card {
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* Ensure player cards match singles styling EXACTLY in teams mode */

/* Apply ALL the same styling that singles cards have */

/* Card container (.csd-col) - remove any inline styles, match singles exactly */

/* Teams card cols: same width behavior as singles so headers align with round grids below; cap at half minus gap */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col[id^="csd-s"][id$="-home-card"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col[id^="csd-s"][id$="-away-card"] {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: calc(50% - 0.5rem) !important;
  box-sizing: border-box !important;
}

/* Card element (.csd-card) - match singles exactly */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-card[id^="csd-s"][id$="-home-card"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-card[id^="csd-s"][id$="-away-card"] {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
  flex-basis: 0% !important;
  flex-grow: 1 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border: 1px solid #dee2e6 !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03) !important;
}

/* Headline - ensure flex display like singles with exact properties */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-headline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

/* Player title - ensure bold (Home Team/Away Team) - match singles exactly */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-title {
  font-weight: 700 !important;
  font-size: 16px !important;
  color: rgb(17, 24, 39) !important;
}

/* Player name - ensure semibold like singles */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-name {
  font-weight: 600 !important;
}

/* Chips wrap - match singles exactly (display: block, not flex!) */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-chips-wrap {
  display: block !important;
  flex-direction: row !important;
}

/* Chips row container - ensure proper flex layout */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .mt-2.d-flex.align-items-center.justify-content-between {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* Chips - match singles exactly */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-chip {
  display: inline-flex !important;
  align-items: center !important;
  background-color: rgb(249, 250, 251) !important;
  border: 1.11111px solid rgb(229, 231, 235) !important;
  border-radius: 999px !important;
  padding: 2.4px 8px !important;
  font-size: 12.48px !important;
  color: rgb(33, 37, 41) !important;
}

/* Chip key (8W, 8BB, etc.) - ensure bold like singles */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-chip .csd-chip-k {
  font-weight: 600 !important;
}

/* Score - match singles exactly */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-score {
  font-weight: 700 !important;
  font-size: 15px !important;
  text-align: right !important;
  margin: 0 0 0 auto !important;
  flex-shrink: 0 !important;
}

/* Override mobile media queries for score font size in teams mode - fluid scale to fit portrait mobile */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-score {
    font-size: clamp(12px, 3.5vw, 15px) !important;
  }
}

/* Score value - bold like singles */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-score span {
  font-weight: 700 !important;
}

/* Mini stats - match singles exactly */

/* Mini stats - match singles exactly - DESKTOP ONLY */

@media (min-width: 768px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-mini.mt-1:not(:empty) {
    display: block !important;
    font-size: 12.8px !important;
    color: rgb(17, 24, 39) !important;
    margin-top: 4px !important;
    font-weight: 400 !important;
  }
}

/* ============================================================================
  * PHASE 1: MOBILE RESPONSIVE - CORE FUNCTIONALITY
  * Mobile-first horizontal scrolling and touch-friendly sizing
  * All mobile styles wrapped in @media (max-width: 767px) - desktop unchanged
  * ============================================================================ */

/* ----------------------------------------------------------------------------
  * 1.1 Horizontal Scrolling Container
  * ---------------------------------------------------------------------------- */

/* Mobile-first: NO horizontal scroll - scale to fit instead */

.csd-scoresheet-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  box-sizing: border-box !important;
}

/* Ensure grid scales to fit wrapper */

.csd-grid {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
}

/* Ensure round container and columns don't overflow */

.csd-round-title,
.csd-sheet-0,
.csd-sheet-1 {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* ----------------------------------------------------------------------------
  * Per-round horizontal scroll: when headers/grid don't fit, scroll per round
  * .csd-round-scroll wraps the game grid only; round title stays fixed.
  * Headers and cells do not wrap; content drives width, then scroll.
  * ---------------------------------------------------------------------------- */

/* Round block: constrain width so overflow happens inside .csd-round-scroll only.
    Exclude [id*="score"] so the round-score span (e.g. csd-round-score-0-0-away) is NOT forced to width:100%. */

#scoresheet-designer [id^="csd-round-"]:not([id*="score"]) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  box-sizing: border-box !important;
}

/* Scroll container = one per round, wraps only the game grid (.csd-two) - no horizontal scrollbars in Live Preview */

#scoresheet-designer .csd-round-scroll {
  overflow-x: hidden !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  max-width: 100% !important;
}

/* Singles small screen: gray background behind grids (round area only) */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-scroll {
    background-color: #e9ecef !important;
  }
}

/* Round grid .csd-two must match cards row width at all viewports (alignment with #csd-s*-home-card / #csd-s*-away-card) */

#scoresheet-designer .csd-round-scroll .csd-two {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  box-sizing: border-box !important;
}

/* Round cols use same flex/min-width as cards row via .csd-two .csd-col - only ensure no min-content override */

#scoresheet-designer .csd-round-scroll .csd-col {
  overflow-x: visible !important;
  overflow-y: visible !important;
  box-sizing: border-box !important;
}

#scoresheet-designer .csd-round-scroll .csd-scoresheet-wrapper {
  overflow-x: visible !important;
  overflow-y: visible !important;
  max-width: none !important;
  width: 100% !important;
}

/* Teams: grid constrained to column width (#csd-home-0-0 etc.) so Round Totals cell = column width */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-col {
  overflow-x: hidden !important;
  overflow-y: visible !important;
  min-width: 0 !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-scoresheet-wrapper {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Teams: MOBILE - no scrollbars; content must fit via narrower columns + abbreviated headers (Score→scr) */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-scoresheet-wrapper {
    overflow-x: hidden !important;
  }
}

/* Teams: "Score" on desktop; "scr" only on narrow screens (do not require data-csd-game-type). */

.csd-teams-score-header .csd-score-abbr {
  display: none !important;
}

@media (max-width: 767px) {
  .csd-teams-score-header .csd-score-full {
    display: none !important;
  }
  .csd-teams-score-header .csd-score-abbr {
    display: inline !important;
  }
}

/* Teams: on sufficiently wide viewport, no horizontal scrollbar so Round Totals row fits like the reference layout */

@media (min-width: 1280px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll {
    overflow-x: hidden !important;
  }
}

@media (min-width: 1280px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-col {
    overflow-x: hidden !important;
  }
}

@media (min-width: 1280px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-scoresheet-wrapper {
    overflow-x: hidden !important;
  }
}

#scoresheet-designer .csd-round-scroll .csd-grid {
  min-width: min-content !important;
  max-width: none !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Header row (# pts/W BB RO TRO) and totals row (Round scores hcp — 0): same grey at all widths */

#scoresheet-designer .csd-round-scroll .csd-grid .csd-header,
#scoresheet-designer .csd-round-scroll .csd-grid .csd-cell.csd-totals,
.csd-round-scroll .csd-grid .csd-header,
.csd-round-scroll .csd-grid .csd-cell.csd-totals {
  background-color: #e9ecef !important;
  background: #e9ecef !important;
}

/* Round Totals cell: allow shrinking so it doesn't force horizontal scroll */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
  min-width: 0 !important;
}

#scoresheet-designer .csd-round-scroll .csd-header,
#scoresheet-designer .csd-round-scroll .csd-cell,
#scoresheet-designer .csd-round-scroll .csd-rowcell {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Totals row label: allow "Round scores" to wrap (no truncation) in narrow format */

#scoresheet-designer .csd-round-scroll .csd-totals-label {
  white-space: normal !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  line-height: 1.25 !important;
  min-width: 0 !important;
}

/* Large screens: round grid must match team header width and align (no narrow fit-content) */

/* Desktop: round grid same width as cards row (redundant with global .csd-round-scroll .csd-two above) */

@media (min-width: 768px) {
  #scoresheet-designer .csd-round-scroll .csd-two {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* Round .csd-col: do NOT override flex/min-width so .csd-two .csd-col (same as cards) applies at all breakpoints */

/* Desktop: No horizontal scroll, auto width */

@media (min-width: 768px) {
  .csd-scoresheet-wrapper {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }
}

@media (min-width: 768px) {
  .csd-grid {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }
}

/* Desktop: Show full sheet header - show both Sheet X of Y and full sub text */

@media (min-width: 768px) {
  .csd-sheet-sub {
    display: block !important;
  }
}

@media (min-width: 768px) {
  .csd-sheet-main {
    display: block !important;
  }
}

@media (min-width: 768px) {
  .csd-sheet-match-id {
    display: none !important;
  }
}

/* Handicap label - show "handicap" on desktop, "hcp" on mobile, right-justified */

.csd-handicap-label {
  text-align: right !important;
  justify-content: flex-end !important;
}

@media (max-width: 767px) {
  .csd-handicap-text-desktop {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .csd-handicap-text-mobile {
    display: inline !important;
    font-size: .75rem !important;
  }
}

@media (min-width: 768px) {
  .csd-handicap-text-desktop {
    display: inline !important;
  }
}

@media (min-width: 768px) {
  .csd-handicap-text-mobile {
    display: none !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.2 Touch-Friendly Game Cells
  * ---------------------------------------------------------------------------- */

/* Mobile: Touch targets (iOS/Android minimum 44px) - optimized for compact layout */

@media (max-width: 767px) {
  .csd-cell {
    min-height: 44px;
  }
}

@media (max-width: 767px) {
  .csd-rowcell {
    min-height: 44px;
  }
}

/* Checkboxes - size optimized in compact layout section */

@media (max-width: 767px) {
  .csd-rowcell input[type="checkbox"] {
    cursor: pointer;
  }
}

/* Score inputs - sizing optimized in compact layout section */

@media (max-width: 767px) {

  .csd-rowcell input[type="number"],
  .csd-rowcell select {
    min-height: 44px;
  }
}

/* Headers - sizing optimized in compact layout section (same breakpoint as reduced W/BB/RO/TRO text) */

@media (max-width: 767px) {
  .csd-header {
    min-height: 44px;
  }
}

/* Round grid header row (# pts/W BB RO TRO) and Round scores totals row: same grey */

@media (max-width: 767px) {

  #scoresheet-designer .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer .csd-round-scroll .csd-grid .csd-cell.csd-totals,
  .csd-round-scroll .csd-grid .csd-header,
  .csd-round-scroll .csd-grid .csd-cell.csd-totals {
    background-color: #e9ecef !important;
    background: #e9ecef !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.3 Mobile-Optimized Compact Layout
  * Creative space-saving optimizations for narrow screens
  * Reduces cell widths while maintaining touch targets and readability
  * ---------------------------------------------------------------------------- */

/* Grid columns - use flexible units so grids match card widths exactly */

/* Row # column is fixed, feat columns expand to fill available space */

@media (max-width: 767px) {
  .csd-grid {
    grid-template-columns: 24px 1fr 1fr 1fr 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0;
    box-sizing: border-box !important;
  }
}

/* Singles only: one line per col on small screens - hide full text, show abbrev only (pts/W, BB, RO, TRO) */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:first-child {
    min-height: 2rem !important;
  }
}

/* Keep cell visible so header row background/border paints; hide only the text (::before shows W/BB/RO/TRO) */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:not(:first-child) {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    position: relative !important;
    min-height: 2rem !important;
    padding: .35rem .2rem !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* Hidden feat headers stay hidden. The flex rule above is more specific than
   the shared display:none, so a turned-off BB/RO/TRO header was forced back
   into the row and the five labels wrapped onto a 3-column track. */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"][data-csd-hide-ebb="1"] .csd-header[data-csd-field="brk"],
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"][data-csd-hide-ero="1"] .csd-header[data-csd-field="ero"],
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"][data-csd-hide-tro="1"] .csd-header[data-csd-field="tro"] {
    display: none !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    visibility: visible !important;
    font-size: clamp(9px, 2vw, 11px) !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* Column 2: "W" or "pts" (injected CSS overrides for points vs wins mode) */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before {
    content: "W" !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before {
    content: "BB" !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before {
    content: "RO" !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    content: "TRO" !important;
  }
}

/* Reduce row number column width - fluid font for narrow viewports */

@media (max-width: 767px) {

  .csd-grid>.csd-cell:first-child,
  .csd-grid>.csd-rownum {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    padding: .4rem .15rem !important;
    font-size: clamp(9px, 2vw, 12px) !important;
  }
}

/* Compact cell padding - maintain touch target but reduce horizontal space
   Fluid font: clamp scales with viewport - no cutoff on narrow portrait mobile */

@media (max-width: 767px) {
  .csd-cell {
    padding: .4rem .2rem !important;
    font-size: clamp(10px, 2.2vw, 13px) !important;
  }
}

/* Thinner borders to save space */

@media (max-width: 767px) {
  .csd-cell {
    border-width: 0.5px !important;
  }
}

/* Compact checkboxes - size handled in prettier checkmarks section below */

/* Compact inputs - full height but narrower, fluid font */

@media (max-width: 767px) {

  .csd-rowcell input[type="number"],
  .csd-rowcell select {
    padding: .35rem .2rem !important;
    font-size: clamp(10px, 2.2vw, 13px) !important;
    min-width: 0;
  }
}

/* Compact totals row - fluid font (slightly larger, less padding) */

@media (max-width: 767px) {
  .csd-totals {
    padding: .25rem .15rem !important;
    font-size: clamp(11px, 2.5vw, 14px) !important;
    position: relative !important;
    overflow: visible !important;
  }
}

/* Round scores label - allow wrapping on mobile */

@media (max-width: 767px) {
  .csd-totals-label {
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
  }
}

/* Reduce spacing in row cells - fluid font */

@media (max-width: 767px) {
  .csd-rowcell {
    padding: .35rem .2rem !important;
    font-size: clamp(10px, 2.2vw, 13px) !important;
  }
}

/* Very small screens - even more compact */

@media (max-width: 375px) {
  .csd-grid {
    grid-template-columns: 22px 1fr 1fr 1fr 1fr !important;
  }
}

@media (max-width: 375px) {

  .csd-grid>.csd-cell:first-child,
  .csd-grid>.csd-rownum {
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    padding: .35rem .1rem !important;
    font-size: clamp(8px, 1.8vw, 10px) !important;
  }
}

@media (max-width: 375px) {
  .csd-cell {
    padding: .35rem .15rem !important;
    font-size: clamp(9px, 2vw, 11px) !important;
  }
}

/* Headers on very small screens - same text replacement, no vertical rotation */

@media (max-width: 375px) {
  .csd-header:not(:first-child) {
    font-size: 0 !important;
    color: transparent !important;
    padding: .3rem .15rem !important;
  }
}

@media (max-width: 375px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before {
    content: "W" !important;
    font-size: .65rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

@media (max-width: 375px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before {
    content: "BB" !important;
    font-size: .65rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

@media (max-width: 375px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before {
    content: "RO" !important;
    font-size: .65rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

@media (max-width: 375px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    content: "TRO" !important;
    font-size: .65rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* Even smaller checkmarks on very small screens */

@media (max-width: 375px) {
  .csd-rowcell input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
  }
}

@media (max-width: 375px) {
  .csd-rowcell input[type="checkbox"]:checked::after {
    font-size: 12px !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.4 Compact Player Headers for Mobile
  * Hide most info so both home/away headers fit on narrow screens
  * ---------------------------------------------------------------------------- */

/* Player cards - remove excess space, ensure equal heights */

/* Override any min-height from injected CSS (which sets min-height: 180px) */

.csd-card {
  min-height: auto !important;
  height: auto !important;
  max-height: none !important;
}

/* Desktop: Keep original behavior - grids match card widths */

@media (min-width: 768px) {
  .csd-two .csd-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

@media (min-width: 768px) {
  .csd-two .csd-col .csd-card {
    width: 100% !important;
  }
}

@media (min-width: 768px) {
  .csd-two .csd-col>.csd-scoresheet-wrapper {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (min-width: 768px) {
  .csd-two .csd-col>.csd-scoresheet-wrapper>.csd-grid {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Mobile: Grids must match player card widths exactly */

/* Singles only: Mobile grids must match player card widths exactly */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two .csd-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two .csd-col .csd-card {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Player header cards: keep equal height on mobile (override above for .csd-sheet > .csd-two only) */
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-sheet > .csd-two .csd-col .csd-card {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two .csd-col>.csd-scoresheet-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two .csd-col>.csd-scoresheet-wrapper>.csd-grid {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Remove excess margins/padding from card children */

.csd-card>*:last-child {
  margin-bottom: 0 !important;
}

/* Remove any empty space at bottom of cards */

.csd-card::after {
  display: none !important;
}

/* Compact player cards - ensure positioning context for absolute dropdown */

@media (max-width: 767px) {
  .csd-card {
    padding: 2px 3px !important;
    padding-bottom: 3px !important;
    position: relative !important;
    overflow: visible !important;
    z-index: 1 !important;
  }
}

/* Hide or minimize player title - fluid font (slightly larger) */

@media (max-width: 767px) {
  .csd-player-title {
    font-size: clamp(10px, 2.2vw, 13px) !important;
    margin-bottom: 2px !important;
    font-weight: 600;
  }
}

/* Compact player name - ensure full names visible, fluid font (slightly larger) */

@media (max-width: 767px) {
  .csd-player-name {
    font-size: clamp(11px, 2.5vw, 14px) !important;
    line-height: 1.1 !important;
    word-break: break-word;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: 100% !important;
    margin-bottom: 0 !important;
  }
}

/* Ensure headline container allows wrapping */

@media (max-width: 767px) {
  .csd-headline {
    flex-wrap: nowrap !important;
    min-width: 0 !important;
  }
}

/* Hide chips on mobile (8BB, 8RO, etc.) */

@media (max-width: 767px) {
  .csd-chips-wrap {
    display: none !important;
  }
}

/* Compact score display */

@media (max-width: 767px) {
  .csd-score {
    font-size: .85rem !important;
    margin-top: .25rem !important;
  }
}

/* Hide mini stats (Games won, Rounds won, Match won) */

@media (max-width: 767px) {
  .csd-mini {
    display: none !important;
  }
}

/* Compact handicap controls */

@media (max-width: 767px) {
  .csd-dyn-hcp {
    font-size: .65rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

/* Make HCP control elements smaller and prevent wrapping */

@media (max-width: 767px) {

  .csd-dyn-hcp .key,
  .csd-dyn-hcp .val,
  .csd-dyn-hcp .sep {
    font-size: .65rem !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 767px) {
  .csd-dyn-hcp select.form-select-sm {
    font-size: .65rem !important;
    padding: .15rem .3rem !important;
    height: auto !important;
    min-height: 1.5rem !important;
    line-height: 1.2 !important;
    width: auto !important;
    min-width: 3rem !important;
    max-width: 4rem !important;
  }
}

.csd-dyn-hcp select.form-select-sm {
  color: #111827;
  font-weight: 400;
}

.csd-dyn-hcp select.csd-hcp-at-assigned {
  font-weight: 700;
  color: #16a34a;
  text-shadow: 0 0 4px rgba(34, 197, 94, 0.9), 0 0 10px rgba(34, 197, 94, 0.45);
}

.csd-dyn-hcp select option {
  color: #111827;
  font-weight: 400;
  text-shadow: none;
}

.csd-dyn-hcp select option.csd-hcp-assigned-option {
  font-weight: 700;
  color: #16a34a;
  text-shadow: 0 0 4px rgba(34, 197, 94, 0.9), 0 0 8px rgba(34, 197, 94, 0.45);
}

/* Sheet header - pale blue theme for all game types */

#scoresheet-designer .csd-sheet-bar {
  background: #90caf9 !important;
  border: 1px solid #42a5f5 !important;
  padding: 8px 12px !important;
  border-radius: 4px 4px 0 0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  color: #0d47a1 !important;
  font-weight: 600 !important;
}

@media (max-width: 767px) {
  .csd-sheet-bar {
    font-size: .75rem !important;
    padding: 6px 10px !important;
  }
}

/* 3-Row Mobile Totals: restricted to mobile only */

@media (max-width: 767px) {
  #scoresheet-designer .csd-totals-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    width: 100% !important;
    padding: 0.1rem 0 !important;
    min-width: 0 !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer .csd-total-item {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    align-items: baseline !important;
    width: 100% !important;
    gap: 3px !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer .csd-total-label {
    font-size: clamp(10px, 2.2vw, 13px) !important;
    font-weight: 600 !important;
    color: #6c757d !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer .csd-total-value {
    font-size: clamp(11px, 2.5vw, 14px) !important;
    font-weight: bold !important;
    color: #212529 !important;
    text-align: right !important;
  }
}

/* Teams narrow: Round scores row (HCP, SCORE, OVERALL) - same size/weight; values right */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-label {
    font-size: clamp(9px, 2.2vw, 12px) !important;
    font-weight: normal !important;
    text-align: left !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-value {
    font-size: clamp(9px, 2.2vw, 12px) !important;
    font-weight: normal !important;
    text-align: right !important;
  }
}

@container csd-teams (max-width: 900px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-label {
    font-size: clamp(9px, 2.2vw, 12px) !important;
    font-weight: normal !important;
    text-align: left !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-value {
    font-size: clamp(9px, 2.2vw, 12px) !important;
    font-weight: normal !important;
    text-align: right !important;
  }
}

/* Teams: multi-cell totals row (Round scores | hcp | values) - same size/weight/alignment */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-totals-label,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-handicap-label,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals {
    font-size: clamp(10px, 2.5vw, 13px) !important;
    font-weight: normal !important;
    text-align: left !important;
  }
}

@media (max-width: 767px) {
  .csd-sheet-sub {
    display: none !important;
  }
}

@media (max-width: 767px) {

  .csd-sheet-main,
  .csd-sheet-match-id {
    display: block !important;
    font-size: .75rem !important;
  }
}

@media (max-width: 767px) {
  .csd-sheet-match-id {
    margin-top: .25rem !important;
  }
}

/* Compact headline */

@media (max-width: 767px) {
  .csd-headline {
    margin-top: .25rem !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: .5rem !important;
  }
}

@media (max-width: 767px) {
  .csd-headline-ctl {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
}

/* Reduce spacing between elements */

@media (max-width: 767px) {
  .csd-card>* {
    margin-bottom: 1px !important;
  }
}

/* Remove bottom margin from last element to eliminate excess space */

@media (max-width: 767px) {
  .csd-card>*:last-child {
    margin-bottom: 0 !important;
  }
}

/* ----------------------------------------------------------------------------
  * Mobile Layout Optimization (New Request)
  * Hide #, BB, RO, TRO columns on small screens
  * ---------------------------------------------------------------------------- */

/* Hide specific headers and cells by child index or class if available */

/* Grid cols: # (1), Player (2), hcp (3), Score (4), BB (5), RO (6), TRO (7) */

/* Hide #, HCP, BB, RO, TRO columns on mobile using robust classes */

/* Hide #, HCP, BB, RO, TRO columns on mobile using robust classes */

/* Hide chips on mobile */

@media (max-width: 767px) {
  .csd-chips-wrap {
    display: none !important;
  }
}

/* Ensure our new action buttons ARE visible */

@media (max-width: 767px) {
  .csd-card-actions {
    display: flex !important;
    z-index: 20 !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-num,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-hcp,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-bb,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-ro,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-tro {
    display: none !important;
  }
}

/* Define 3-column grid for mobile: Player | Pts | Score
   Fluid column widths - scale to fit narrow viewports, no horizontal scroll */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: minmax(52px, 1fr) 42px 50px !important;
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* Enable scrolling */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll {
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 5px !important;
    display: block !important;
    width: 100% !important;
  }
}

/* Prevent wrapping */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell {
    white-space: nowrap !important;
    overflow: hidden !important;
  }
}

/* Player cell: allow break badge to paint (beats mobile overflow:hidden above) */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-player-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-player {
    overflow: visible !important;
  }
}

/* Round totals (HCP / SCORE / OVERALL): do not clip values on narrow halves. */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-cell.csd-totals.csd-round-totals-text {
    overflow: visible !important;
    white-space: normal !important;
    padding-left: 4px !important;
    padding-right: 10px !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-label {
    flex: 0 0 auto !important;
    padding-right: 4px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-value {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    text-align: right !important;
    white-space: normal !important;
    overflow: visible !important;
    word-break: break-word !important;
    font-size: clamp(9px, 2.2vw, 12px) !important;
    padding-right: 2px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-item {
    width: 100% !important;
    justify-content: space-between !important;
    min-width: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-totals-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-right: 2px !important;
  }
}

/* Captain merge "New!" badge: must not be clipped — beats mobile grid overflow:hidden (higher specificity). */
@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-player-merge-highlight[data-csd-field="points"],
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-player-merge-highlight[data-csd-field="points"] {
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* -----------------------------------------------------------
      HIDING COLUMNS (Mobile) - ROBUST STRATEGY (Class-Based)
      Classes injected by tagColumnCells() in JS
      ----------------------------------------------------------- */

/* Hide specific columns on mobile using robust classes */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-num,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-hcp,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-bb,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-ro,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-tro {
    display: none !important;
  }
}

/* -----------------------------------------------------------
      Visual Alignment & Scroll
      ----------------------------------------------------------- */

/* Ensure the totals label spans the correct amount */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-totals-label {
    grid-column: span 1 !important;
    width: auto !important;
  }
}

/* Ensure Totals Row is visible */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-totals {
    display: flex !important;
  }
}

/* If Totals row elements are: Label, Hcp, Pts, Score. (4 elements) */

/* We need to hide Hcp. */

/* Try to hide 2nd child of totals row? */

/* #scoresheet-designer[...] .csd-totals:nth-of-type(2) ? No, they are siblings in grid. */

/* Robust approach: just let them flow for now, user requested totals row to APPEAR. 
      If alignment is off, we can tune later. */

/* We need to identify BB, RO, TRO cells. 
      If they don't have specific classes, we might need JS to add them or use attribute selectors.
      Looking at previous `view_file`, game cells have `data-rack`.
      But specific columns?
      Ah, `createHcpCell` adds `.csd-teams-hcp-cell`.
      Maybe we can target inputs? */

/* Very small screens - even more compact */

@media (max-width: 375px) {
  .csd-card {
    padding: .4rem !important;
  }
}

@media (max-width: 375px) {
  .csd-player-title {
    font-size: clamp(10px, 2.2vw, 12px) !important;
  }
}

@media (max-width: 375px) {
  .csd-player-name {
    font-size: clamp(11px, 2.5vw, 14px) !important;
  }
}

@media (max-width: 375px) {
  .csd-score {
    font-size: .8rem !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.5 Compact Two-Column Layout for Mobile
  * Make both sides of a round fit on narrow screens side-by-side
  * ---------------------------------------------------------------------------- */

/* CRITICAL: Round-sides must NEVER wrap - always stay side-by-side */

.csd-two {
  flex-wrap: nowrap !important;
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  /* No horizontal scrollbars in Live Preview */
  overflow-y: visible !important;
}

/* ONE scrollbar per round: only .csd-round-scroll scrolls; inner .csd-two must not */

#scoresheet-designer .csd-round-scroll .csd-two {
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Slightly narrowed to 1024px: flexible columns so NO horizontal scrollbar when there is plenty of space for grid content */

@media (max-width: 1024px) {
  .csd-two {
    flex-direction: row !important;
    gap: .5rem !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }
}

@media (max-width: 1024px) {
  .csd-two .csd-col {
    flex: 1 1 calc(50% - .25rem) !important;
    min-width: 0 !important;
    max-width: calc(50% - .25rem) !important;
    width: calc(50% - .25rem) !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: relative !important;
  }
}

/* Teams: card columns must shrink like singles so content stays inside #scoresheet-designer */

@media (max-width: 1024px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-home-card"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-away-card"] {
    flex: 1 1 calc(50% - .25rem) !important;
    min-width: 0 !important;
    max-width: calc(50% - .25rem) !important;
    width: calc(50% - .25rem) !important;
    box-sizing: border-box !important;
  }
}

/* Keep side-by-side but scale to fit - NO horizontal scroll (mobile) */

@media (max-width: 767px) {
  .csd-two {
    flex-direction: row !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }
}

@media (max-width: 767px) {
  .csd-two .csd-col {
    flex: 1 1 calc(50% - 2px) !important;
    min-width: 0 !important;
    max-width: calc(50% - 2px) !important;
    width: calc(50% - 2px) !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: relative !important;
  }
}

/* Teams: card columns same as above so layout fits inside #scoresheet-designer */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-home-card"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two .csd-col[id^="csd-s"][id$="-away-card"] {
    flex: 1 1 calc(50% - 2px) !important;
    min-width: 0 !important;
    max-width: calc(50% - 2px) !important;
    width: calc(50% - 2px) !important;
    box-sizing: border-box !important;
  }
}

/* Grids must match card width exactly - no centering, full width */

@media (max-width: 767px) {
  .csd-two .csd-col>.csd-scoresheet-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 767px) {
  .csd-two .csd-col>.csd-scoresheet-wrapper>.csd-grid {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Progressive scaling: Scale down as screen gets narrower */

/* Medium-small screens (480px - 600px) */

@media (max-width: 600px) {
  .csd-grid {
    grid-template-columns: 22px 1fr 1fr 1fr 1fr !important;
  }
}

@media (max-width: 600px) {

  .csd-grid>.csd-cell:first-child,
  .csd-grid>.csd-rownum {
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    padding: .35rem .12rem !important;
    font-size: clamp(9px, 2vw, 11px) !important;
  }
}

@media (max-width: 600px) {
  .csd-cell {
    padding: .35rem .18rem !important;
    font-size: clamp(9px, 2.2vw, 12px) !important;
  }
}

@media (max-width: 600px) {
  .csd-header:not(:first-child) {
    padding: .3rem .18rem !important;
    font-size: .65rem !important;
  }
}

@media (max-width: 600px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    font-size: .65rem !important;
  }
}

/* Small screens (400px - 480px) */

@media (max-width: 480px) {
  .csd-two {
    gap: .4rem !important;
  }
}

@media (max-width: 480px) {
  .csd-two .csd-col {
    flex: 1 1 calc(50% - .2rem) !important;
    max-width: calc(50% - .2rem) !important;
    width: calc(50% - .2rem) !important;
  }
}

@media (max-width: 480px) {
  .csd-grid {
    grid-template-columns: 20px 1fr 1fr 1fr 1fr !important;
  }
}

@media (max-width: 480px) {

  .csd-grid>.csd-cell:first-child,
  .csd-grid>.csd-rownum {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: .32rem .1rem !important;
    font-size: clamp(8px, 1.9vw, 10px) !important;
  }
}

@media (max-width: 480px) {
  .csd-cell {
    padding: .32rem .16rem !important;
    font-size: clamp(9px, 2vw, 11px) !important;
  }
}

@media (max-width: 480px) {
  .csd-header:not(:first-child) {
    padding: .28rem .16rem !important;
    font-size: .63rem !important;
  }
}

@media (max-width: 480px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    font-size: .63rem !important;
  }
}

/* Singles only: Scale down grid columns proportionally on very small screens */

@media (max-width: 360px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: .3rem !important;
  }
}

@media (max-width: 360px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-two .csd-col {
    flex: 1 1 calc(50% - .15rem) !important;
    min-width: 0 !important;
    max-width: calc(50% - .15rem) !important;
    width: calc(50% - .15rem) !important;
  }
}

@media (max-width: 360px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid {
    grid-template-columns: 20px 1fr 1fr 1fr 1fr !important;
  }
}

@media (max-width: 360px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid>.csd-cell:first-child,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid>.csd-rownum {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: .3rem .1rem !important;
    font-size: .65rem !important;
  }
}

@media (max-width: 360px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell {
    padding: .3rem .15rem !important;
    font-size: .7rem !important;
  }
}

/* Keep original text hidden; only padding (do not restore font-size) */

@media (max-width: 360px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:not(:first-child) {
    padding: .3rem .15rem !important;
  }
}

@media (max-width: 360px) {

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(2)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(3)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(4)::before,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header:nth-child(5)::before {
    font-size: .65rem !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.6 Prettier Checkmarks for ALL Screens
  * Replace standard checkboxes with styled checkmarks/icons
  * ---------------------------------------------------------------------------- */

/* Center checkboxes in their cells - only apply flex to cells with checkboxes */

.csd-rowcell:has(input[type="checkbox"]) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Hide default checkbox - prettier checkmarks for all screens */

.csd-rowcell input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 22px !important;
  height: 22px !important;
  border: 2px solid #6b7280 !important;
  border-radius: 4px !important;
  background: #fff !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s ease !important;
  margin: 0 auto !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* Checked state - green with checkmark */

.csd-rowcell input[type="checkbox"]:checked {
  background: #10b981 !important;
  border-color: #10b981 !important;
}

/* Checkmark icon using CSS */

.csd-rowcell input[type="checkbox"]:checked::after {
  content: "✓" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: bold !important;
  line-height: 1 !important;
}

/* Hover state */

.csd-rowcell input[type="checkbox"]:hover:not(:checked) {
  border-color: #10b981 !important;
  background: #f0fdf4 !important;
}

/* Active/pressed state */

.csd-rowcell input[type="checkbox"]:active {
  transform: scale(0.95) !important;
}

/* Focus state for accessibility */

.csd-rowcell input[type="checkbox"]:focus {
  outline: 2px solid #10b981 !important;
  outline-offset: 2px !important;
}

/* Disabled state - scoped to CSD scoresheets only */

.csd-grid .csd-rowcell input[type="checkbox"]:disabled,
.csd-scoresheet-wrapper .csd-rowcell input[type="checkbox"]:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  background: #f3f4f6 !important;
}

/* Disabled but checked - keep green color and full opacity - scoped to CSD scoresheets only */

.csd-grid .csd-rowcell input[type="checkbox"]:disabled:checked,
.csd-scoresheet-wrapper .csd-rowcell input[type="checkbox"]:disabled:checked {
  opacity: 1 !important;
  background: #10b981 !important;
  border-color: #10b981 !important;
  cursor: not-allowed !important;
}

/* Ensure checkmark is visible on disabled checked checkboxes - scoped to CSD scoresheets only */

.csd-grid .csd-rowcell input[type="checkbox"]:disabled:checked::after,
.csd-scoresheet-wrapper .csd-rowcell input[type="checkbox"]:disabled:checked::after {
  content: "✓" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: bold !important;
  line-height: 1 !important;
}

/* Mobile: Smaller checkmarks to match compact layout */

@media (max-width: 767px) {
  .csd-rowcell input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    border: 1.5px solid #6b7280 !important;
    border-radius: 3px !important;
  }
}

@media (max-width: 767px) {
  .csd-rowcell input[type="checkbox"]:checked::after {
    font-size: 14px !important;
  }
}

/* ----------------------------------------------------------------------------
  * 1.7 Player Details Modal for Mobile
  * Show hidden feat counts and stats in a modal popup
  * ---------------------------------------------------------------------------- */

/* Desktop: Hide the modal button */

/* Mobile: Show modal trigger button */

/* Hide desktop chips and mini stats on mobile */

@media (max-width: 767px) {
  .csd-chips-wrap {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .csd-mini {
    display: none !important;
  }
}

/* Modal trigger button - very subtle and compact */

@media (max-width: 767px) {
  .csd-player-details-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: .3rem !important;
    cursor: pointer !important;
    user-select: none !important;
    padding: .15rem 0 !important;
    margin-top: .2rem !important;
    background: transparent !important;
    border: none !important;
    font-size: .65rem !important;
    font-weight: 400 !important;
    color: #9ca3af !important;
    transition: all 0.2s ease !important;
    line-height: 1.1 !important;
    width: 100% !important;
    text-align: left !important;
  }
}

/* Hover state - very subtle */

@media (max-width: 767px) {
  .csd-player-details-btn:hover {
    color: #6b7280 !important;
  }
}

@media (max-width: 767px) {
  .csd-player-details-btn:hover .csd-player-details-text {
    text-decoration: underline !important;
    text-decoration-thickness: 0.5px !important;
    text-underline-offset: 1px !important;
  }
}

/* Active/pressed state */

@media (max-width: 767px) {
  .csd-player-details-btn:active {
    opacity: 0.7 !important;
  }
}

/* Icon styling */

@media (max-width: 767px) {
  .csd-player-details-icon {
    font-size: .8rem !important;
    color: #9ca3af !important;
    flex-shrink: 0 !important;
  }
}

/* Text styling */

@media (max-width: 767px) {
  .csd-player-details-text {
    flex: 1 !important;
    text-align: left !important;
  }
}

/* Desktop: Hide modal button */

@media (min-width: 768px) {
  .csd-player-details-btn {
    display: none !important;
  }
}

/* Modal Styles */

.csd-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 10000 !important;
  pointer-events: none !important;
}

.csd-modal.csd-modal-open {
  display: block !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.csd-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.csd-modal.csd-modal-open .csd-modal-overlay {
  opacity: 1;
}

.csd-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: .5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 90vw;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.csd-modal.csd-modal-open .csd-modal-content {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.csd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.csd-modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.csd-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .25rem;
  transition: all 0.2s ease;
}

.csd-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.csd-modal-body {
  padding: 1.25rem;
}

.csd-modal-score {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #374151;
}

.csd-modal-score strong {
  color: #111827;
}

.csd-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.csd-modal-chips .csd-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: .25rem .75rem;
  font-size: .875rem;
  background: #f9fafb;
  color: #374151;
}

.csd-modal-chips .csd-chip .csd-chip-k {
  font-weight: 600;
  letter-spacing: .02em;
}

.csd-modal-stats {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  font-size: .875rem;
  color: #374151;
}

.csd-modal-stats div {
  padding: .5rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.csd-modal-stats div:last-child {
  border-bottom: none;
}

/* FIX: Explicit mobile grid override for teams — Player | pts | scr with scr breathing room */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: minmax(52px, 1fr) 42px 50px !important;
    grid-auto-rows: minmax(32px, auto) !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Away half: small inset so scr + totals are not flush to viewport edge */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two .csd-col:last-child {
    padding-right: 4px !important;
    box-sizing: border-box !important;
  }
}

/* Override global mobile min-heights (44px) for teams portrait */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-header {
    min-height: 32px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }
}

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell select,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell input {
    min-height: 30px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-subtext {
    margin-top: 2px !important;
    line-height: 1 !important;
    font-size: 0.52rem !important; /* secondary to ~17px name, still readable */
    font-weight: 400 !important;
  }

  /* 17px names (global scoremgmt rule) need a real line box; old 16px cap caused CPR overlap */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot),
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot) {
    height: 20px !important;
    max-height: 20px !important;
    line-height: 1.15 !important;
    font-size: 17px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell {
    justify-content: flex-start !important;
    align-items: flex-start !important;
    flex-direction: column !important;
    padding-top: 13px !important;
    min-height: 52px !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  /* Same height for pts/scr so a BAIL name cell cannot shrink the home/away grid. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-score {
    min-height: 52px !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-score-cell {
    font-weight: normal !important;
    font-size: 14px !important;
  }
}

/* Ensure strict hiding of columns (including row number #) */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-num,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-hcp,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-bb,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-ro,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-tro {
    display: none !important;
  }
}

/* Landscape / wider mobile halves: bring HCP back first, then feat cols. */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"] .csd-col-hcp,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-col-hcp {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"] .csd-col-hcp.csd-header,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-col-hcp.csd-header {
    font-size: 9px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"] .csd-hcp-dd-display,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-hcp-dd-display {
    font-size: 11px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]:not([data-csd-hide-ebb="1"]) .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-col-bb,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]:not([data-csd-hide-ero="1"]) .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-col-ro,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]:not([data-csd-hide-tro="1"]) .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-col-tro {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    font-size: 9px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"].csd-teams-grid {
    grid-template-columns: minmax(52px, 1fr) 34px 42px 50px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"].csd-teams-grid {
    grid-template-columns: minmax(52px, 1fr) 34px 42px 32px 32px 32px 50px !important;
  }
}

/* -----------------------------------------------------------
      MOBILE CELL DISPLAY (Clean)
      ----------------------------------------------------------- */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-player,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-score {
    display: flex !important;
    align-items: center !important;
    background: transparent !important;
  }
}

/* Player cell: Left align */

@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-player {
    justify-content: flex-start !important;
  }
}

/* Pts/Score: Center align with horizontal breathing room in scr */

@media (max-width: 767px) {

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-score {
    justify-content: center !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-score,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-score-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
    box-sizing: border-box !important;
    justify-content: center !important;
  }
}

/* -----------------------------------------------------------
      ROUND TOTALS LAYOUT (Structured)
      ----------------------------------------------------------- */

.csd-totals-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 15px;
  width: 100%;
}

/* Desktop: Add "Round Totals" label on left, push data to right */

@media (min-width: 768px) {
  .csd-totals-container::before {
    content: "Round Totals";
    font-weight: bold;
    color: #444;
    font-size: 1rem;
    margin-right: auto;
    padding-left: 10px;
  }
}

.csd-total-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}

.csd-total-label {
  font-weight: bold;
  color: #444;
}

.csd-total-value {
  font-weight: bold;
}

.csd-total-hcp-addition {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.csd-hcp-explain {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  margin: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-family: Oswald, sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
  opacity: 0.85;
}

.csd-hcp-explain:hover,
.csd-hcp-explain:focus {
  opacity: 1;
  outline: none;
}

.csd-hcp-explain--open::after,
.csd-hcp-explain:hover::after {
  content: attr(data-explain);
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  bottom: auto;
  z-index: 10060;
  width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  font-family: Roboto, sans-serif;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* Mobile: Headers above Values */

@media (max-width: 767px) {
  .csd-totals-container {
    justify-content: space-between;
    gap: 2px;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .csd-total-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: right;
    min-width: 0;
    line-height: 1.1;
  }
}

@media (max-width: 767px) {
  .csd-total-label {
    font-size: clamp(10px, 2.2vw, 13px);
    text-transform: uppercase;
    color: #888;
    margin-bottom: 1px;
  }
}

@media (max-width: 767px) {
  .csd-total-value {
    font-size: clamp(11px, 2.5vw, 14px);
  }
}

/* ============================================================================
    FONT SCALING & PADDING REFACTOR (User Request)
    ============================================================================ */

/* 1. Scale font size slightly up for all game row cells */

/* Applied to scroll container to scale children relative to base */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll {
  font-size: 1.1em !important;
}

/* 2. Reduce padding to compensate (take the diff back) */

/* Force tighter padding on all cells (2px matches tightest mobile setting) */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-header {
  padding-left: 2px !important;
  padding-right: 2px !important;
}

/* 3. Make Player Name column bold */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell select,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown {
  font-weight: normal !important;
  color: #212529 !important;
}

/* 4. Animated 8-Ball Icon for Feats (BB, RO, TRO) - NUCLEAR OPTION */

/* Card Actions container for relocated buttons */

.csd-card {
  position: relative !important;
}

.csd-card-actions {
  position: absolute !important;
  top: 0.5rem;
  right: 0.5rem;
  display: flex !important;
  gap: 0.4rem;
  z-index: 20;
}

.csd-player-title {
  font-size: 0.75rem !important;
  opacity: 0.8 !important;
  margin-bottom: 0px !important;
  line-height: 1 !important;
}

.csd-card-actions button {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.csd-card-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

@media (max-width: 767px) {
  .csd-card-actions {
    top: 0.25rem;
    right: 0.25rem;
  }
}

/* Target checkboxes inside cells identified by data-csd-field="brk", "ero", "tro" */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 1.5em !important;
  height: 1.5em !important;
  border: 1px solid #dee2e6 !important;
  border-radius: 50% !important;
  background-color: #fff !important;
  cursor: pointer !important;
  display: inline-block !important;
  vertical-align: middle !important;
  position: relative !important;
  margin: 0 !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  content: none !important;
}

/* Feat cell highlight: Light gold background and glow when checked */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="tro"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell:not(.csd-my-game)[data-csd-field="tro"]:has(input:checked) {
  background-color: #f5f7ff !important;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.04) !important;
  transition: background-color 0.3s ease, box-shadow 0.3s ease !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="tro"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-score-error:not(.csd-my-game)[data-csd-field="tro"]:has(input:checked) {
  background-color: #fca5a5 !important;
  box-shadow: 0 0 8px 2px rgba(220, 38, 38, 0.45) !important;
}

/* Player my-game: feat cells (8RO / ERO / TRO / BRK) keep the row green; ! + outline mark the error */
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game[data-csd-field="brk"]:not(.csd-opp-mismatch),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game[data-csd-field="ero"]:not(.csd-opp-mismatch),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game[data-csd-field="tro"]:not(.csd-opp-mismatch),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-score-error[data-csd-field="brk"]:not(.csd-opp-mismatch),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-score-error[data-csd-field="ero"]:not(.csd-opp-mismatch),
body.csd-live-scoresheet-player #scoresheet-designer .csd-grid .csd-my-game.csd-score-error[data-csd-field="tro"]:not(.csd-opp-mismatch) {
  background-color: rgba(34, 197, 94, 0.18) !important;
  color: #0f172a !important;
  box-shadow: none !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="tro"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="brk"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="ero"]:has(input:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-opp-mismatch:not(.csd-score-error)[data-csd-field="tro"]:has(input:checked) {
  background-color: rgba(250, 204, 21, 0.48) !important;
  box-shadow: none !important;
}

/* Hide pseudo-elements (standard checkmarks often use ::before/::after) */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]::after,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]::after,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]::after,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]::after,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]::after,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]::before,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]::after {
  content: none !important;
  display: none !important;
  background: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

/* Ensure no checks/background image when unchecked */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:not(:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:not(:checked),
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:not(:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:not(:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:not(:checked),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:not(:checked) {
  background-image: none !important;
}

/* Checked: full glossy sphere image spins as one unit */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:checked,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:checked,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-8.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
  animation: spin-in 2s cubic-bezier(0.22, 0.9, 0.3, 1) !important;
}

/* 9-Ball */
#scoresheet-designer div[data-csd-round-game-type="9b"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="9b"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="9b"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-9.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
}

/* 10-Ball */
#scoresheet-designer div[data-csd-round-game-type="10b"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="10b"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="10b"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-10.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
}

@keyframes spin-in {
  0% {
    transform: scale(0) rotate(-1440deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Disabled state */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:disabled,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:disabled {
  background-color: #e9ecef !important;
  border-color: #dee2e6 !important;
  border-radius: 50% !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  background-image: none !important;
}

/* Disabled+checked: full color (no grayscale) */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:disabled:checked,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:disabled:checked,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:disabled:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"]:disabled:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"]:disabled:checked,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"]:disabled:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  border-radius: 50% !important;
  opacity: 1 !important;
  filter: none !important;
  background-image: url("/assets/img/csd/pool-ball-8.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
}

/* Checkbox wrapper to increase touch target */

.csd-checkbox-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
}

/* Ensure input inside wrapper behaves correctly */

.csd-checkbox-wrapper input[type="checkbox"] {
  margin: 0 !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
  width: 24px;
  height: 24px;
}

/* Scenario 1: Row error styling - glowing background with normal borders */

.csd-rowcell.csd-row-error {
  background-color: #fca5a5 !important;
  box-shadow: 0 0 10px 3px rgba(220, 38, 38, 0.6) !important;
  position: relative !important;
  z-index: 5 !important;
}

/* Mobile Feats Modal Trigger (inside Score cell) */

.csd-teams-score-cell {
  position: relative !important;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.csd-score-value {
  z-index: 1;
}

.csd-mobile-feat-trigger {
  display: none;
  position: absolute !important;
  top: 1px !important;
  right: -1px !important;
  font-size: 11px !important;
  pointer-events: none !important;
  line-height: 1 !important;
  z-index: 5 !important;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
}

/* Static colors — omit when .csd-merge-player-feat-pulse so @keyframes can drive color */
.csd-mobile-feat-trigger:not(.csd-merge-player-feat-pulse) {
  color: #9ca3af !important;
}

.csd-mobile-feat-trigger.has-feats:not(.csd-merge-player-feat-pulse) {
  color: #fbbf24 !important;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(251, 191, 36, 0.4);
}

.csd-mobile-feat-trigger.csd-merge-player-feat-pulse {
  transition: none;
}

/* Teammate player POST merged feats: scr star pulses blue ↔ gold (same ~5 min window as merge highlight) */
@keyframes csd-merge-feat-star-pulse-filled {
  0%,
  100% {
    color: #fbbf24;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(251, 191, 36, 0.45);
  }

  50% {
    color: #1e88e5;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 5px rgba(30, 136, 229, 0.55);
  }
}

@keyframes csd-merge-feat-star-pulse-empty {
  0%,
  100% {
    color: #9ca3af;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
  }

  50% {
    color: #1e88e5;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 5px rgba(30, 136, 229, 0.5);
  }
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-mobile-feat-trigger.csd-merge-player-feat-pulse.has-feats,
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-mobile-feat-trigger.csd-merge-player-feat-pulse.has-feats {
  animation: csd-merge-feat-star-pulse-filled 1.35s ease-in-out infinite;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-mobile-feat-trigger.csd-merge-player-feat-pulse:not(.has-feats),
#scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-mobile-feat-trigger.csd-merge-player-feat-pulse:not(.has-feats) {
  animation: csd-merge-feat-star-pulse-empty 1.35s ease-in-out infinite;
}

@media (max-width: 767px) {
  .csd-mobile-feat-trigger {
    display: inline-block !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid[data-csd-col-density="feats"] .csd-mobile-feat-trigger {
    display: none !important;
  }
}

/* Feats modal — theme-savvy (light/dark). Beat jumbotron cream via fill-color. */

.csd-feats-modal .modal-dialog {
  max-width: 400px;
  margin: 0.75rem auto;
}

.csd-feats-modal .modal-content {
  border-radius: 12px;
  border: 1px solid var(--idx-border, #d2d2d7);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  background: var(--idx-surface, #ffffff);
  color: var(--idx-fg, #1d1d1f);
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f);
  overflow: hidden;
}

.csd-feats-modal .modal-header {
  display: flex;
  align-items: flex-start;
  border-bottom: 2px solid #e31837;
  background: var(--idx-surface-alt, #f5f5f7);
  padding: 0.85rem 1rem 0.75rem;
  border-radius: 0;
}

.csd-feats-heading {
  min-width: 0;
  flex: 1;
  padding-right: 0.5rem;
}

.csd-feats-kicker {
  margin: 0 0 0.15rem;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e31837;
  -webkit-text-fill-color: #e31837;
  line-height: 1.2;
}

.csd-feats-modal .csd-feats-modal-title,
.csd-feats-modal .modal-title {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--idx-fg, #1d1d1f);
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f);
  line-height: 1.2;
}

.csd-feats-modal-role {
  margin: 0.2rem 0 0;
  font-family: "Roboto", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--idx-muted, #6e6e73);
  -webkit-text-fill-color: var(--idx-muted, #6e6e73);
}

.csd-feats-modal .csd-feats-modal-close,
.csd-feats-modal .modal-header .close {
  color: var(--idx-muted, #6e6e73);
  -webkit-text-fill-color: var(--idx-muted, #6e6e73);
  opacity: 1;
  text-shadow: none;
  font-size: 1.6rem;
  font-weight: 400;
  padding: 0.1rem 0.35rem;
  margin: -0.2rem -0.2rem 0 auto;
}

.csd-feats-modal .csd-feats-modal-close:hover,
.csd-feats-modal .modal-header .close:hover {
  color: #e31837;
  -webkit-text-fill-color: #e31837;
  opacity: 1;
}

.csd-feats-modal-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  padding: 0.55rem 1rem;
  font-family: "Roboto", sans-serif;
  font-size: 0.82rem;
  background: var(--idx-surface, #ffffff);
  border-bottom: 1px solid var(--idx-border, #d2d2d7);
  color: var(--idx-fg, #1d1d1f);
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f);
}

.csd-feats-matchup-kicker {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--idx-muted, #6e6e73);
  -webkit-text-fill-color: var(--idx-muted, #6e6e73);
}

.csd-feats-matchup {
  font-weight: 500;
  color: var(--idx-fg, #1d1d1f);
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f);
}

.csd-feats-modal .modal-body {
  font-family: "Roboto", sans-serif;
  padding: 0.85rem 1rem 0.35rem;
  background: var(--idx-surface, #ffffff);
  color: var(--idx-fg, #1d1d1f);
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f);
}

.csd-feats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}

/* Mobile feats modal: label + fixed-width checkbox column (global wrapper is width:100% and centers input). */
.csd-feats-modal .csd-feats-list > .csd-feat-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  background: var(--idx-surface-alt, #f5f5f7) !important;
  border: 1px solid var(--idx-border, #d2d2d7) !important;
  transition: filter 0.15s ease, border-color 0.15s ease;
}

.csd-feats-modal .csd-feats-list > .csd-feat-row:active {
  filter: brightness(0.96);
}

.csd-feats-modal .csd-feats-list > .csd-feat-row .csd-feat-label {
  min-width: 0;
  margin: 0;
  font-family: "Oswald", sans-serif !important;
  font-weight: 600 !important;
  font-size: 1.15rem !important;
  letter-spacing: 0.04em;
  color: var(--idx-fg, #1d1d1f) !important;
  -webkit-text-fill-color: var(--idx-fg, #1d1d1f) !important;
}

.csd-feats-modal .csd-feats-list > .csd-feat-row .csd-feat-checkbox-wrap.csd-checkbox-wrapper {
  width: auto !important;
  height: auto !important;
  min-width: 36px;
  justify-content: center !important;
  flex-shrink: 0;
}

.csd-feats-modal .modal-footer {
  border-top: 1px solid var(--idx-border, #d2d2d7);
  background: var(--idx-surface-alt, #f5f5f7);
  padding: 0.75rem 1rem 1rem;
}

.csd-feats-modal .csd-feats-modal-done {
  width: 100%;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  background: #e31837;
  border: 1px solid #e31837;
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 8px;
}

.csd-feats-modal .csd-feats-modal-done:hover,
.csd-feats-modal .csd-feats-modal-done:focus {
  background: #c41230;
  border-color: #c41230;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.csd-feats-modal .csd-feat-checkbox:not(:checked) {
  background-color: var(--idx-surface, #ffffff) !important;
  border-color: var(--idx-border, #dee2e6) !important;
}

body.dark-theme .csd-feats-modal .modal-content {
  background: var(--idx-surface, #2b2b2b);
  color: var(--idx-fg, #f8f9fa);
  -webkit-text-fill-color: var(--idx-fg, #f8f9fa);
  border-color: var(--idx-border, #454d55);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

body.dark-theme .csd-feats-modal .modal-header {
  background: var(--idx-surface-alt, #1f1f1f);
}

body.dark-theme .csd-feats-modal .csd-feats-modal-title,
body.dark-theme .csd-feats-modal .modal-title {
  color: var(--idx-fg, #f8f9fa);
  -webkit-text-fill-color: var(--idx-fg, #f8f9fa);
}

body.dark-theme .csd-feats-modal-role,
body.dark-theme .csd-feats-matchup-kicker {
  color: var(--idx-muted, #adb5bd);
  -webkit-text-fill-color: var(--idx-muted, #adb5bd);
}

body.dark-theme .csd-feats-modal .csd-feats-modal-close,
body.dark-theme .csd-feats-modal .modal-header .close {
  color: var(--idx-muted, #adb5bd);
  -webkit-text-fill-color: var(--idx-muted, #adb5bd);
}

body.dark-theme .csd-feats-modal .csd-feats-modal-close:hover,
body.dark-theme .csd-feats-modal .modal-header .close:hover {
  color: #e31837;
  -webkit-text-fill-color: #e31837;
}

body.dark-theme .csd-feats-modal-subtitle,
body.dark-theme .csd-feats-modal .modal-body {
  background: var(--idx-surface, #2b2b2b);
  border-color: var(--idx-border, #454d55);
  color: var(--idx-fg, #f8f9fa);
  -webkit-text-fill-color: var(--idx-fg, #f8f9fa);
}

body.dark-theme .csd-feats-matchup {
  color: var(--idx-fg, #f8f9fa);
  -webkit-text-fill-color: var(--idx-fg, #f8f9fa);
}

body.dark-theme .csd-feats-modal .csd-feats-list > .csd-feat-row {
  background: var(--idx-surface-alt, #1f1f1f) !important;
  border-color: var(--idx-border, #454d55) !important;
}

body.dark-theme .csd-feats-modal .csd-feats-list > .csd-feat-row .csd-feat-label {
  color: var(--idx-fg, #f8f9fa) !important;
  -webkit-text-fill-color: var(--idx-fg, #f8f9fa) !important;
}

body.dark-theme .csd-feats-modal .modal-footer {
  background: var(--idx-surface-alt, #1f1f1f);
  border-color: var(--idx-border, #454d55);
}

body.dark-theme .csd-feats-modal .csd-feat-checkbox:not(:checked) {
  background-color: #1a1a1a !important;
  border-color: #6c757d !important;
}

.csd-feat-row {
  background: #fff;
  transition: all 0.2s ease;
  border: 1px solid #eee !important;
}

.csd-feat-row:active {
  background: #f8f9fa;
}

.csd-feat-label {
  font-weight: 700 !important;
  color: #333 !important;
  letter-spacing: 0.5px;
}

/* Modal Checkbox Styling (Targeting the actual ball animations) */

.csd-feat-checkbox {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 32px !important;
  height: 32px !important;
  border: 2px solid #dee2e6 !important;
  border-radius: 50% !important;
  background-color: #fff !important;
  cursor: pointer !important;
  position: relative !important;
  margin: 0 !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Rotation Animation Keyframes */

@keyframes csdSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.csd-feat-checkbox:checked {
  animation: spin-in 2s cubic-bezier(0.22, 0.9, 0.3, 1) !important;
}

/* Ensure consistent vertical alignment */

.csd-feat-row {
  align-items: center !important;
}

.csd-feat-label {
  line-height: 1.2;
  display: flex;
  align-items: center;
}

/* --- HIGH SPECIFICITY BALL OVERRIDES (Grid & Modal) --- */

#scoresheet-designer div[data-csd-round-game-type="8b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="8b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:disabled:checked,
.csd-feats-modal[data-csd-round-game-type="8b"] .csd-feat-checkbox:checked,
.csd-player-score-modal[data-csd-round-game-type="8b"] .csd-feat-checkbox:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-8.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
  filter: none !important;
  opacity: 1 !important;
}

#scoresheet-designer div[data-csd-round-game-type="9b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="9b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:disabled:checked,
.csd-feats-modal[data-csd-round-game-type="9b"] .csd-feat-checkbox:checked,
.csd-player-score-modal[data-csd-round-game-type="9b"] .csd-feat-checkbox:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-9.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
  filter: none !important;
  opacity: 1 !important;
}

#scoresheet-designer div[data-csd-round-game-type="10b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:checked,
#scoresheet-designer div[data-csd-round-game-type="10b"] .csd-cell[data-csd-field]:not([data-csd-field="win"]) input[type="checkbox"]:disabled:checked,
.csd-feats-modal[data-csd-round-game-type="10b"] .csd-feat-checkbox:checked,
.csd-player-score-modal[data-csd-round-game-type="10b"] .csd-feat-checkbox:checked {
  background-color: transparent !important;
  border-color: transparent !important;
  background-image: url("/assets/img/csd/pool-ball-10.svg?v=3d3") !important;
  background-size: 128% !important;
  background-position: 50% 46% !important;
  background-repeat: no-repeat !important;
  filter: none !important;
  opacity: 1 !important;
}

/* --- Player self-score modal (spectator / ESPN-style) --- */

.csd-player-score-modal .modal-dialog {
  max-width: 520px;
}

.csd-player-score-modal .modal-content {
  border-radius: 12px;
  border: 1px solid var(--idx-border, #d2d2d7);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  background: var(--idx-surface, #ffffff);
  color: var(--idx-fg, #1d1d1f);
  overflow: hidden;
}

.csd-player-score-modal .modal-header {
  border-bottom: 2px solid #e31837;
  padding: 0.85rem 1.25rem;
  background: var(--idx-surface-alt, #f5f5f7);
  align-items: center;
}

.csd-player-score-modal .csd-ps-modal-title {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #e31837;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.2;
}

.csd-player-score-modal .modal-header .close {
  color: var(--idx-muted, #6e6e73);
  opacity: 0.85;
  text-shadow: none;
  font-size: 1.5rem;
}

.csd-player-score-modal .modal-header .close:hover {
  color: #e31837;
  opacity: 1;
}

.csd-player-score-modal .modal-body {
  font-family: "Roboto", sans-serif;
  padding: 1rem 1.25rem 1.1rem;
}

.csd-player-score-modal .csd-ps-modal-context {
  font-size: 0.8rem;
  color: var(--idx-muted, #6e6e73);
  margin-bottom: 0.75rem;
}

.csd-player-score-modal .csd-ps-columns-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.csd-player-score-modal .csd-ps-top-row {
  margin-bottom: 0;
}

.csd-player-score-modal .csd-ps-feat-columns-row {
  margin-bottom: 0.35rem;
}

.csd-player-score-modal .csd-ps-player-column {
  flex: 1;
  min-width: 0;
}

.csd-player-score-modal .csd-ps-feat-column {
  min-width: 0;
}

/* Single centered heading above both feat columns */
.csd-player-score-modal .csd-ps-feat-section-heading {
  text-align: center;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e31837;
  margin: 0.55rem 0 0.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--idx-border, #d2d2d7);
  line-height: 1.3;
}

/* Mobile / narrow: stay horizontal — shrink typography & spacing (do not stack columns) */
@media (max-width: 576px) {
  .csd-player-score-modal .modal-dialog {
    max-width: calc(100vw - 12px);
    margin: 0.4rem auto;
  }

  .csd-player-score-modal .modal-header {
    padding: 0.5rem 0.55rem;
  }

  .csd-player-score-modal .csd-ps-modal-title {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    padding-right: 0.25rem;
  }

  .csd-player-score-modal .modal-header .close {
    font-size: 1.25rem;
    padding: 0.15rem;
    margin: -0.15rem -0.1rem -0.15rem auto;
  }

  .csd-player-score-modal .modal-body {
    padding: 0.45rem 0.4rem 0.55rem;
  }

  .csd-player-score-modal .csd-ps-modal-context {
    font-size: 0.65rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
  }

  .csd-player-score-modal .csd-ps-columns-row {
    gap: 6px;
  }

  .csd-player-score-modal .csd-ps-player-label {
    font-size: 0.58rem;
    margin-bottom: 0.12rem;
    letter-spacing: 0.04em;
  }

  .csd-player-score-modal .csd-ps-player-name {
    font-size: 0.78rem;
    margin-bottom: 0.22rem;
    line-height: 1.15;
  }

  .csd-player-score-modal .csd-ps-score-select {
    font-size: 0.74rem;
    padding: 0.22rem 0.28rem;
    border-radius: 6px;
  }

  .csd-player-score-modal .csd-ps-feat-section-heading {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    margin: 0.4rem 0 0.28rem;
    padding-bottom: 0.22rem;
  }

  .csd-player-score-modal .csd-ps-feats-list.csd-feats-list {
    gap: 4px;
  }

  .csd-player-score-modal .csd-ps-feat-row.csd-feat-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    column-gap: 0.2rem;
    padding: 0.22rem 0.28rem !important;
  }

  .csd-player-score-modal .csd-ps-feat-row .csd-ps-feat-check-cell.csd-feat-checkbox-wrap {
    width: 24px;
    min-width: 24px;
  }

  .csd-player-score-modal .csd-ps-feat-lbl.csd-feat-label,
  .csd-player-score-modal .csd-feat-label.csd-ps-feat-lbl {
    font-size: 0.62rem !important;
    letter-spacing: 0.02em !important;
  }

  .csd-player-score-modal .csd-feat-checkbox {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
  }

  .csd-player-score-modal .modal-footer {
    padding: 0.45rem 0.5rem;
  }

  .csd-player-score-modal .csd-ps-btn-cancel,
  .csd-player-score-modal .csd-ps-btn-save {
    font-size: 0.68rem;
    padding: 0.28rem 0.5rem;
  }
}

@media (max-width: 360px) {
  .csd-player-score-modal .csd-ps-columns-row {
    gap: 4px;
  }

  .csd-player-score-modal .modal-body {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
  }

  .csd-player-score-modal .csd-ps-player-name {
    font-size: 0.72rem;
  }

  .csd-player-score-modal .csd-ps-score-select {
    font-size: 0.7rem;
    padding: 0.18rem 0.2rem;
  }
}

.csd-player-score-modal .csd-ps-player-label {
  display: block;
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--idx-muted, #6e6e73);
  margin-bottom: 0.25rem;
}

.csd-player-score-modal .csd-ps-player-name {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--idx-fg, #1d1d1f);
  line-height: 1.25;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.csd-player-score-modal .csd-ps-score-select {
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--idx-border, #d2d2d7);
  padding: 0.35rem 0.5rem;
  background: var(--idx-surface, #fff);
  color: var(--idx-fg, #1d1d1f);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.csd-player-score-modal .csd-ps-feats-list.csd-feats-list {
  gap: 6px;
}

/* Grid: label flexes, checkbox column fixed width so 8BB/8RO/8TRO align vertically.
 * Global .csd-feat-row uses #fff — in dark theme that made feat labels (var(--idx-fg) = white) invisible. */
.csd-feat-row.csd-vnea-feat-hidden,
.csd-ps-feat-section-heading.csd-vnea-feat-hidden,
.csd-ps-feat-columns-row.csd-vnea-feat-hidden,
.csd-feats-modal .csd-feats-list > .csd-feat-row.csd-vnea-feat-hidden,
.csd-player-score-modal .csd-ps-feat-row.csd-feat-row.csd-vnea-feat-hidden {
  display: none !important;
}

.csd-player-score-modal .csd-ps-feat-row.csd-feat-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  column-gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.32rem 0.4rem !important;
  background: var(--idx-surface-alt, #f5f5f7) !important;
  border-color: var(--idx-border, #d2d2d7) !important;
  transition: filter 0.15s ease;
}

.csd-player-score-modal .csd-ps-feat-row.csd-feat-row:active {
  filter: brightness(0.94);
}

.csd-player-score-modal .csd-ps-feat-row .csd-ps-feat-check-cell.csd-feat-checkbox-wrap {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 28px;
  min-width: 28px;
  margin: 0 !important;
  padding: 0 !important;
}

/* Feat codes (8BB / 8RO / 8TRO): smaller than global .csd-feat-label h5 */
.csd-player-score-modal .csd-ps-feat-lbl.csd-feat-label,
.csd-player-score-modal .csd-feat-label.csd-ps-feat-lbl {
  font-family: "Oswald", sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.04em !important;
  margin: 0 !important;
  color: var(--idx-fg, #1d1d1f) !important;
  min-width: 0;
}

.csd-player-score-modal .csd-feat-checkbox {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
}

.csd-player-score-modal .modal-footer {
  border-top: 1px solid var(--idx-border, #d2d2d7);
  background: var(--idx-surface-alt, #f5f5f7);
  padding: 0.65rem 1rem;
}

.csd-player-score-modal .csd-ps-btn-cancel {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.csd-player-score-modal .csd-ps-btn-save {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  background: #e31837;
  border-color: #e31837;
  color: #fff;
}

.csd-player-score-modal .csd-ps-btn-save:hover,
.csd-player-score-modal .csd-ps-btn-save:focus {
  background: #c41230;
  border-color: #c41230;
  color: #fff;
}

/* Dark theme: outline Cancel is low-contrast on idx-surface-alt footer */
body.dark-theme .csd-player-score-modal .csd-ps-btn-cancel.btn-outline-secondary {
  color: var(--idx-fg, #fff);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .csd-player-score-modal .csd-ps-btn-cancel.btn-outline-secondary:hover,
body.dark-theme .csd-player-score-modal .csd-ps-btn-cancel.btn-outline-secondary:focus {
  color: var(--idx-fg, #fff);
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.12);
}

.csd-player-score-modal .csd-ps-modal-err {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* --- LOADING STATE / SPINNER (REVISED) --- */

/* Custom morphing ball loader with opaque overlay */

/* Hide legacy controls in CSD modes (Teams/Singles) */

body.is-csd-game #syncsheets_checkbox,
body.is-csd-game #syncsheets_checkbox+label,
body.is-csd-game #winnerscircles_checkbox,
body.is-csd-game #winnerscircles_checkbox+label,
body.is-csd-game #precalc_hcp_checkbox,
body.is-csd-game #precalc_hcp_checkbox+label,
body.is-csd-game #new_livescorescol,
body.is-csd-game #moreinfo_button {
  display: none !important;
}

/* Also hide the parent form-check if needed, but the IDs above should cover the essentials */

body.is-csd-game .form-check:has(#syncsheets_checkbox),
body.is-csd-game .form-check:has(#winnerscircles_checkbox),
body.is-csd-game .form-check:has(#precalc_hcp_checkbox) {
  display: none !important;
}

.csd-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  /*Optional: blur content behind;*/
}

.csd-loader-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.csd-loader-text {
  margin-top: 30px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: #333;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

/* Full-screen loader: light vs dark site theme (body.dark-theme from generalconfig.js) */
body.dark-theme .csd-loader-overlay {
  background-color: rgba(14, 16, 20, 0.94);
}

body.dark-theme .csd-loader-text {
  color: #c8cdd5;
}

body.dark-theme .csd-loader-branding {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

/* Spinner & Logo Branding Wrapper */

.csd-loader-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  background: rgba(0, 0, 0, 0.85);
  padding: 35px 50px;
  border-radius: 25px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.csd-loader-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.csd-loader-logo {
  max-width: 160px;
  max-height: 60px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Outer shell does not rotate — stationary specular highlight stays fixed while ball spins */

.csd-ball-spinner-shell {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.csd-ball-spinner-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  animation: csdSpin 2s linear infinite;
}

/* Fixed glossy blob (~2 o'clock) + faint left-edge glint; does not rotate with ball */
.csd-ball-spinner-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 44% 40% at 68% 26%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.45) 32%, rgba(255, 255, 255, 0.12) 52%, transparent 68%),
    /* Subtle limb glint: wider + squat reads as a curved catch on the sphere (weaker than main specular) */
    radial-gradient(ellipse 30% 26% at 7% 50%, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 48%, transparent 64%);
  mix-blend-mode: screen;
}

/* Single pool ball (1–15) cycled by JS while loader is visible */

.csd-ball-spinner {
  position: relative;
  width: 100%;
  height: 100%;
}

.csd-spinner-ball-single {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 50%;
}

/* =========================================================================
    Dropdown Indicators
    - Small grey down arrows for select-based fields (Points, Players)
    ========================================================================= */

.csd-dropdown-indicator {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #ccc;
  pointer-events: none;
}


/* Ensure points container has padding for the arrow */

.csd-points-container .csd-points-display,
.csd-hcp-dd-container .csd-hcp-dd-display {
  padding-right: 12px !important;
}

/* Ensure player cells have padding for the arrow */

.csd-teams-player-cell {
  position: relative !important;
}

.csd-teams-player-cell .csd-player-ranked-mark {
  position: absolute;
  top: 1px;
  right: 12px;
  font-size: 0.7rem;
  line-height: 1;
  pointer-events: auto;
  z-index: 3;
  padding: 2px 3px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.14s ease-out;
}

.csd-teams-player-cell .csd-player-ranked-mark--grow-1 {
  transform: scale(1.35);
}

.csd-teams-player-cell .csd-player-ranked-mark--grow-2 {
  transform: scale(1.75);
}

.csd-teams-player-cell .csd-dropdown-indicator {
  right: 2px;
  bottom: 2px;
  top: auto;
  border-top-color: #bbb;
}

/* Desktop points dropdown adjustments */

@media (min-width: 992px) {
  .csd-points-container .csd-dropdown-indicator,
  .csd-hcp-dd-container .csd-dropdown-indicator {
    right: 2px;
    bottom: 2px;
    top: auto;
    border-top-width: 3px;
    border-left-width: 3.5px;
    border-right-width: 3.5px;
  }
}

/* Player/Watcher role banner on scoresheet page (read-only spectator view) */

.csd-spectator-role-banner {
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 13px;
}

.csd-role-player {
  background: rgba(40, 167, 69, 0.15);
  border: 1px solid rgba(40, 167, 69, 0.6);
  color: #28a745;
  font-weight: 600;
  animation: csd-player-banner-sparkle 15s ease-in-out 1;
  animation-fill-mode: forwards;
}

@keyframes csd-player-banner-sparkle {

  0%,
  100% {
    box-shadow: none;
    border-color: rgba(40, 167, 69, 0.6);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    box-shadow: 0 0 12px rgba(40, 167, 69, 0.8), 0 0 20px rgba(40, 167, 69, 0.3);
    border-color: rgba(40, 167, 69, 1);
  }

  20%,
  40%,
  60%,
  80% {
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.5);
    border-color: rgba(40, 167, 69, 0.85);
  }
}

.csd-role-spectator {
  background: rgba(0, 123, 255, 0.15);
  border: 1px solid rgba(0, 123, 255, 0.6);
  color: #007bff;
  font-weight: 600;
}

.csd-role-official {
  background: rgba(255, 193, 7, 0.2);
  border: 1px solid rgba(255, 193, 7, 0.7);
  color: #ffc107;
  font-weight: 600;
}

.csd-official-emphasis {
  font-weight: 800;
}

/* Responsive spectator banner: left=text+timestamp, right=share */
.csd-spectator-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: clamp(12px, 2.5vw, 14px);
}
.csd-spectator-banner-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.csd-spectator-banner-inner .csd-spectator-banner-timestamp {
  font-weight: 500;
  font-size: 0.9em;
}
.csd-spectator-banner-inner .csd-spectator-share-link {
  color: #fff;
  text-decoration: underline;
  flex-shrink: 0;
}
.csd-spectator-banner-inner .csd-spectator-share-link:hover {
  color: #fff;
  opacity: 0.9;
}
@media (max-width: 480px) {
  .csd-spectator-banner-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .csd-spectator-banner-inner .csd-spectator-share-link {
    align-self: flex-end;
  }
}

/* CSD spectator live bar (inside .csd-bar, scoresheet page) */

.csd-spectator-share-wrap {
  font-size: 12px;
}

.csd-spectator-share-wrap a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.csd-spectator-share-wrap a:hover {
  text-decoration: underline;
}

/* Spectator live bar: left=Live+Home/Away+lastupdate, right=Share */
.csd-spectator-live-bar {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  /* Align to the left now */
  gap: 0.25rem !important;
  margin-left: 0 !important;
  /* Remove auto margin */
  padding-left: 0 !important;
  border-left: none !important;
  /* Remove border divider */
}

.csd-spectator-live-row {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  /* Align to the left */
  gap: 0.75rem !important;
}

.csd-spectator-share-link {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  font-size: 13px;
  font-weight: inherit;
  padding: 0.15em 0;
  min-width: 11em;
  text-align: right;
  /* Hover: visual-only so layout doesn't shift (no font-size/weight change) */
}

.csd-spectator-share-link:hover {
  color: #fff;
  text-decoration: underline;
  font-size: 13px;
  font-weight: inherit;
}

.csd-spectator-homeaway-wrap .btn-group-toggle .btn {
  font-size: 12px;
  padding: 0.25rem 0.5rem;
}

/* /scoresheet Home vs Away: .csd-bar-status forces italic on all children — reset + high-contrast selection */
#scoresheet-designer .csd-spectator-homeaway-wrap label.btn {
  font-style: normal !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 0.4rem 1rem !important;
  line-height: 1.2 !important;
  border-radius: 8px !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  background: rgba(15, 23, 42, 0.75) !important;
  color: rgba(255, 255, 255, 0.42) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

#scoresheet-designer .csd-spectator-homeaway-wrap label.btn:hover:not(.active) {
  color: rgba(255, 255, 255, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  background: rgba(30, 41, 59, 0.9) !important;
}

/* Selected side: “chip” — impossible to confuse with inactive */
#scoresheet-designer .csd-spectator-homeaway-wrap label.btn.active {
  background: #ffffff !important;
  color: #0d47a1 !important;
  border-color: #ffffff !important;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.45),
    0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

#scoresheet-designer .csd-spectator-homeaway-wrap label.btn.active:hover {
  background: #f1f5f9 !important;
  color: #082f5c !important;
}

.csd-spectator-update-wrap {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
  color: #fff;
}

.csd-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.csd-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.5);
  animation: csd-live-pulse 2s ease-in-out infinite;
}

.csd-not-live-badge {
  background: rgba(108, 117, 125, 0.2) !important;
  color: #6c757d !important;
  border: 1px solid rgba(108, 117, 125, 0.5) !important;
  animation: none !important;
}

/* Player scoresheet: polling active but no live rows yet — not "Live" until scores exist */
.csd-watching-badge {
  background: rgba(255, 193, 7, 0.2) !important;
  color: #b45309 !important;
  border: 1px solid rgba(255, 193, 7, 0.55) !important;
  animation: none !important;
}

.csd-watching-badge::before {
  background: #ffc107 !important;
  animation: none !important;
}

.csd-not-live-badge::before {
  background: #6c757d !important;
  animation: none !important;
}

@keyframes csd-live-pulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
  }

  50% {
    opacity: 0.95;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0);
  }
}

.csd-live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: csd-live-dot 1.5s ease-in-out infinite;
}

@keyframes csd-live-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(0.85);
  }
}

.csd-update-recent {
  color: #28a745 !important;
}

.csd-update-stale {
  color: #495057 !important;
}

.csd-update-inactivity {
  color: #d97706 !important;
  /* Amber 600 - legible warning yellow */
  font-weight: 500;
}

.csd-update-pending {
  color: #ffc107 !important;
}

/* ============================================================================
   STICKY BOTTOM SCORE BAR (Spectator + Captain scoresheet)
   Always visible overlay - Home vs Away summary. Mobile + large screen optimized.
   z-index: above page content; FABs (#theme-toggle / #csd-mag-toggle-btn) are
   lifted via body.csd-has-sticky-score-bar so they don't cover Live / close.
   Modals (1050) still stack above this bar.
   ============================================================================ */

/*
 * Compromise while sticky score bar is visible:
 * park mag + theme FABs just above the bar (height from --csd-sticky-bar-h).
 * When bar is dismissed, body class is removed and FABs return to bottom: 8px.
 */
body.csd-has-sticky-score-bar #theme-toggle,
body.csd-has-sticky-score-bar #theme-toggle.idx-theme-toggle,
body.csd-has-sticky-score-bar #csd-mag-toggle-btn {
  bottom: calc(var(--csd-sticky-bar-h, 64px) + 10px) !important;
  transition: bottom 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
}

/* Staging/local build bar sits under LIVE; lift LIVE so both stay readable. */
body.chalksta-git-footer-pad #csd-sticky-score-bar {
  bottom: calc(26px + env(safe-area-inset-bottom, 0px)) !important;
}

body.chalksta-git-footer-pad.csd-has-sticky-score-bar #theme-toggle,
body.chalksta-git-footer-pad.csd-has-sticky-score-bar #theme-toggle.idx-theme-toggle,
body.chalksta-git-footer-pad.csd-has-sticky-score-bar #csd-mag-toggle-btn {
  bottom: calc(var(--csd-sticky-bar-h, 64px) + 36px) !important;
}

#csd-sticky-score-bar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1038 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: 3px 28px calc(3px + env(safe-area-inset-bottom, 0px)) 40px !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.97) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3) !important;
  border-top: 1px solid rgba(148, 163, 184, 0.2) !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
  transition: transform 0.2s ease, opacity 0.2s ease !important;
  line-height: 1.15 !important;
}

/* Live / Not Live — mirrors header .csd-live-badge; compact overlay top-left */
#csd-sticky-score-bar .csd-sticky-live-wrap {
  position: absolute !important;
  top: 50% !important;
  left: 6px !important;
  transform: translateY(-50%) !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

#csd-sticky-score-bar .csd-sticky-live-badge {
  font-size: 8px !important;
  padding: 0.08rem 0.3rem !important;
  letter-spacing: 0.04em !important;
  line-height: 1.15 !important;
}

#csd-sticky-score-bar .csd-sticky-live-badge::before {
  width: 4px !important;
  height: 4px !important;
}

#csd-sticky-score-bar.csd-sticky-dismissed {
  transform: translateY(100%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#csd-sticky-score-bar .csd-sticky-close {
  position: absolute !important;
  top: 50% !important;
  right: 4px !important;
  transform: translateY(-50%) !important;
  z-index: 3 !important;
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  border: none !important;
  background: rgba(148, 163, 184, 0.2) !important;
  color: rgba(248, 250, 252, 0.8) !important;
  font-size: 14px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  border-radius: 3px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.15s, color 0.15s !important;
}

#csd-sticky-score-bar .csd-sticky-close:hover {
  background: rgba(248, 250, 252, 0.15) !important;
  color: #fff !important;
}

#csd-sticky-score-bar .csd-sticky-inner {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  gap: 0.25rem 0.85rem !important;
}

/* Overall = sum of sheet scores (home team total – away team total) */
#csd-sticky-score-bar .csd-sticky-overall {
  display: inline-flex !important;
  align-items: baseline !important;
  flex-shrink: 0 !important;
  gap: 0.3rem !important;
  padding: 0.1rem 0.45rem !important;
  border-radius: 4px !important;
  background: rgba(148, 163, 184, 0.12) !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  line-height: 1.2 !important;
}

#csd-sticky-score-bar .csd-sticky-overall-label {
  font-size: 8px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: rgba(248, 250, 252, 0.55) !important;
}

#csd-sticky-score-bar .csd-sticky-overall-home,
#csd-sticky-score-bar .csd-sticky-overall-away {
  font-size: 13px !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1.1 !important;
}

#csd-sticky-score-bar .csd-sticky-overall-sep {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: rgba(248, 250, 252, 0.4) !important;
  padding: 0 0.05rem !important;
}

#csd-sticky-score-bar .csd-sticky-table {
  margin: 0 auto !important;
  width: auto !important;
  max-width: 380px !important;
  border-collapse: collapse !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #f8fafc !important;
  line-height: 1.15 !important;
}

#csd-sticky-score-bar .csd-sticky-table th,
#csd-sticky-score-bar .csd-sticky-table td {
  padding: 1px 6px !important;
  text-align: center !important;
  white-space: nowrap !important;
}

#csd-sticky-score-bar .csd-sticky-header-row th {
  font-size: 9px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  padding: 1px 6px 2px !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25) !important;
  line-height: 1.15 !important;
}

#csd-sticky-score-bar .csd-sticky-th-home {
  color: #93c5fd !important;
}

#csd-sticky-score-bar .csd-sticky-th-away {
  color: #fcd34d !important;
}

/* Legacy subheader (if any cached HTML) — keep compact */
#csd-sticky-score-bar .csd-sticky-subheader-row th {
  font-size: 8px !important;
  font-weight: 600 !important;
  color: rgba(248, 250, 252, 0.6) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  padding: 0 6px 1px !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25) !important;
}

#csd-sticky-score-bar .csd-sticky-th-sheet {
  text-align: left !important;
  min-width: 18px !important;
  color: rgba(248, 250, 252, 0.55) !important;
}

#csd-sticky-score-bar .csd-sticky-th-rounds,
#csd-sticky-score-bar .csd-sticky-td-rounds {
  min-width: 28px !important;
}

#csd-sticky-score-bar .csd-sticky-th-score,
#csd-sticky-score-bar .csd-sticky-td-score {
  min-width: 32px !important;
}

#csd-sticky-score-bar .csd-sticky-td-sheet {
  font-size: 9px !important;
  font-weight: 600 !important;
  color: rgba(248, 250, 252, 0.6) !important;
  text-align: left !important;
  padding: 1px 6px !important;
}

#csd-sticky-score-bar .csd-sticky-row td {
  padding: 1px 6px !important;
}

/* Elegant Home/Away Separation in Sticky Bar */
#csd-sticky-score-bar .csd-sticky-header-row th.csd-sticky-th-away.csd-sticky-th-rounds,
#csd-sticky-score-bar .csd-sticky-subheader-row th:nth-child(4),
#csd-sticky-score-bar .csd-sticky-row td:nth-child(4) {
  border-left: 1px solid rgba(148, 163, 184, 0.3) !important;
}

#csd-sticky-score-bar .csd-sticky-table--norounds .csd-sticky-header-row th.csd-sticky-th-away,
#csd-sticky-score-bar .csd-sticky-table--norounds .csd-sticky-row td:nth-child(3) {
  border-left: 1px solid rgba(148, 163, 184, 0.3) !important;
}

/*
 * Team-colored cells: sheet 1 defines ref “home” (blue) vs “away” (yellow); later sheets use
 * csd-sticky-td-team-refhome / refaway by team id. Fallback: positional pos-home / pos-away.
 */
#csd-sticky-score-bar .csd-sticky-td-team-refhome,
#csd-sticky-score-bar .csd-sticky-td-pos-home {
  color: #bae6fd !important;
  font-weight: 700 !important;
}

#csd-sticky-score-bar .csd-sticky-td-team-refaway,
#csd-sticky-score-bar .csd-sticky-td-pos-away {
  color: #fde68a !important;
  font-weight: 700 !important;
}

/* Large screens: keep compact (do not grow the bar) */
@media (min-width: 992px) {
  #csd-sticky-score-bar {
    padding: 3px 32px 3px 42px !important;
  }

  #csd-sticky-score-bar .csd-sticky-inner {
    gap: 0.3rem 1rem !important;
    max-width: 720px !important;
  }

  #csd-sticky-score-bar .csd-sticky-table {
    font-size: 11px !important;
    max-width: 400px !important;
  }

  #csd-sticky-score-bar .csd-sticky-overall-home,
  #csd-sticky-score-bar .csd-sticky-overall-away {
    font-size: 14px !important;
  }
}

/* Tablet: balanced — stack overall above sheet table when narrow */
@media (max-width: 767px) {
  #csd-sticky-score-bar {
    padding: 2px 26px 2px 38px !important;
  }

  #csd-sticky-score-bar .csd-sticky-inner {
    flex-direction: column !important;
    gap: 0.2rem !important;
  }

  #csd-sticky-score-bar .csd-sticky-overall {
    order: -1 !important;
  }

  #csd-sticky-score-bar .csd-sticky-table {
    font-size: 10px !important;
    max-width: 340px !important;
  }

  #csd-sticky-score-bar .csd-sticky-table th,
  #csd-sticky-score-bar .csd-sticky-table td {
    padding: 1px 4px !important;
  }

  #csd-sticky-score-bar .csd-sticky-header-row th {
    font-size: 8px !important;
  }

  #csd-sticky-score-bar .csd-sticky-td-sheet {
    font-size: 8px !important;
  }

  #csd-sticky-score-bar .csd-sticky-th-rounds,
  #csd-sticky-score-bar .csd-sticky-td-rounds {
    min-width: 24px !important;
  }

  #csd-sticky-score-bar .csd-sticky-th-score,
  #csd-sticky-score-bar .csd-sticky-td-score {
    min-width: 28px !important;
  }
}

/* Mobile: compact */
@media (max-width: 480px) {
  #csd-sticky-score-bar {
    padding: 4px 26px 4px 40px !important;
  }

  #csd-sticky-score-bar .csd-sticky-inner {
    gap: 6px !important;
  }

  #csd-sticky-score-bar .csd-sticky-table {
    font-size: 12px !important;
    max-width: 320px !important;
  }

  #csd-sticky-score-bar .csd-sticky-table th,
  #csd-sticky-score-bar .csd-sticky-table td {
    padding: 2px 6px !important;
  }

  #csd-sticky-score-bar .csd-sticky-header-row th {
    font-size: 10px !important;
  }

  #csd-sticky-score-bar .csd-sticky-subheader-row th {
    font-size: 8px !important;
    padding: 2px 6px 4px !important;
  }

  #csd-sticky-score-bar .csd-sticky-td-sheet {
    font-size: 8px !important;
  }

  #csd-sticky-score-bar .csd-sticky-th-rounds,
  #csd-sticky-score-bar .csd-sticky-td-rounds {
    min-width: 32px !important;
  }

  #csd-sticky-score-bar .csd-sticky-th-score,
  #csd-sticky-score-bar .csd-sticky-td-score {
    min-width: 28px !important;
  }
}

/* Interactive game numbers for custom numbering */
.csd-rownum.csd-interactive-num {
  cursor: pointer !important;
  transition: background-color 0.2s, color 0.2s;
  position: relative;
  z-index: 10;
}

.csd-rownum.csd-interactive-num:hover {
  background-color: #bbdefb !important;
  color: #0d47a1 !important;
  font-weight: bold !important;
  box-shadow: inset 0 0 0 1px #42a5f5;
}

.csd-rownum.csd-interactive-num:active {
  background-color: #90caf9 !important;
}

/* Edit icon for interactive game numbers */
.csd-edit-icon {
  font-size: 0.75em !important;
  color: #42a5f5 !important;
  margin-right: 4px !important;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.csd-interactive-num:hover .csd-edit-icon {
  opacity: 1;
  color: #0d47a1 !important;
}


/* Fix for division picker dropdown getting hidden behind CSD elements with high z-index */
#divpicker_dropdown {
  position: relative;
  z-index: 10005 !important;
}

#divpicker_dropdown .dropdown-menu {
  z-index: 10005 !important;
}

/* --- MOBILE GAME NUMBER OVERLAY (User Request) --- */
/* Small light-grey number in top left of player name cell - only visible on narrow displays */
.csd-mobile-game-number {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 10px;
  color: #999;
  font-weight: 500;
  pointer-events: none;
  display: none;
  /* Hidden by default */
  user-select: none;
}


/* Only show on narrow screens where the # column is hidden */
@media (max-width: 767px) {
  .csd-mobile-game-number {
    display: block;
    top: 1px !important;
    left: 2px !important;
    font-size: 8px !important;
    line-height: 1 !important;
    z-index: 5;
  }
}

/* --- MOBILE PLAYER CELL TIGHTENING (User Request) --- */
/* Optimized spacing for Player Name + HCP/CPR subtext */

/* Mobile Screens (Narrow / Landscape) */
@media (max-width: 767px) {
  .csd-teams-player-cell {
    min-height: 40px !important;
    padding-top: 13px !important;
    justify-content: flex-start !important;
  }

  .csd-teams-player-dropdown,
  .csd-readonly-player-name {
    height: 20px !important;
    max-height: 20px !important;
    line-height: 1.15 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: 17px !important;
  }

  .csd-player-subtext {
    margin-top: 2px !important;
    font-size: 8px !important; /* between prior 9px and too-small 7px */
    font-weight: 400 !important;
    height: 10px !important;
    line-height: 1 !important;
  }

  .csd-teams-player-cell .csd-player-subtext .csd-cpr-value {
    font-size: 0.95em !important;
  }
}

/* Extra Tight for Portrait Mobile (Very Narrow, < 480px) */
@media (max-width: 480px) {
  .csd-teams-player-cell {
    padding-top: 13px !important;
  }

  .csd-teams-player-dropdown,
  .csd-readonly-player-name {
    height: 19px !important;
    max-height: 19px !important;
    font-size: 17px !important;
    line-height: 1.15 !important;
  }

  .csd-player-subtext {
    margin-top: 1px !important;
    font-size: 7.5px !important;
    height: 9px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-subtext {
    font-size: 0.5rem !important;
  }
}

/* CPR value: slightly smaller to fit in tight spaces (player subtext, add-player modal, info list) */
.csd-cpr-value {
  font-size: 0.9em !important;
}

/* CPR under player name on singles cards (when Run TRS as CPR is enabled) */
.csd-singles-cpr-subtext {
  font-size: 0.75rem !important;
  color: #6b7280 !important;
  margin-top: 0.125rem !important;
  line-height: 1.2 !important;
}

/* Break Indicator badge — upper right corner of the # cell (Singles) or player name cell (Teams) */
.csd-rownum {
  position: relative !important;
  overflow: visible !important;
}

.csd-teams-player-cell {
  position: relative !important;
  overflow: visible !important;
}

.csd-break-indicator {
  position: absolute;
  top: -2px;
  right: -6px;
  left: auto !important;
  transform: none !important;
  width: 16px;
  height: 16px;
  object-fit: contain;
  pointer-events: none;
  z-index: 50;
  background: white;
  border-radius: 50%;
  padding: 1px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
  opacity: 0.9;
}

/* Teams badge class — same positioning, just confirms upper-right */
.csd-break-indicator-teams {
  top: -2px !important;
  right: -6px !important;
  left: auto !important;
  transform: none !important;
  width: 16px !important;
  height: 16px !important;
}

/* Mobile: slightly smaller; keep badge inside player cell (not hanging into pts) */
@media (max-width: 767px) {

  .csd-break-indicator,
  .csd-break-indicator-teams {
    width: 13px !important;
    height: 13px !important;
    top: -1px !important;
    right: 2px !important;
    z-index: 50 !important;
  }

  /* Teams: higher-specificity inset so badge stays inside player cell on portrait */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-break-indicator-teams,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-player-cell .csd-break-indicator {
    right: 2px !important;
    left: auto !important;
  }
}

/* Round header break badge */
.csd-round-break-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  vertical-align: middle;
  gap: 3px;
  opacity: 0.9;
}

.csd-round-break-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: middle;
}

/* Portrait mobile: allow Round N title + "Home/Away has break" to wrap (not truncate) */
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-title .csd-bar,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title .csd-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 4px 8px !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-title .csd-bar .csd-bar-round-label,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title .csd-bar .csd-bar-round-label,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-round-title .csd-bar .csd-round-break-badge,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title .csd-bar .csd-round-break-badge {
    white-space: normal !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin-left: 0 !important;
  }
}

/* Designer control-panel actions (divmgmt) */
.csd-designer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}
.csd-designer-actions .btn {
  font-family: Oswald, Arial, sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
  border: 0;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  min-height: 2.35rem;
  flex: 1 1 calc(50% - 8px);
  max-width: calc(50% - 4px);
  color: #fff;
  box-shadow: none;
}
.csd-designer-actions .btn:hover,
.csd-designer-actions .btn:focus {
  color: #fff;
  filter: brightness(0.92);
  box-shadow: none;
}
.csd-designer-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}
.csd-designer-actions .csd-act-save { background: #2e7d32; }
.csd-designer-actions .csd-act-apply { background: #1565c0; }
.csd-designer-actions .csd-act-print { background: #e31837; }
.csd-designer-actions .csd-act-clone { background: #ef6c00; }
.csd-designer-actions .csd-act-delete { background: #6d1f2a; }
.csd-designer-actions .csd-act-delete:hover,
.csd-designer-actions .csd-act-delete:focus { background: #5a1922; }

.csd-designer-actions #csd-print-blank-sheet.csd-print-blank-btn {
  font-family: Oswald, Arial, sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem !important;
  border: 0 !important;
  border-radius: 4px;
  box-shadow: none !important;
  line-height: 1.2;
  min-height: 2.35rem;
}
.csd-designer-actions #csd-print-blank-sheet.csd-print-blank-btn::before {
  content: none;
}

/* Blank paper scoresheet trigger (outside the CSD grid) */
.csd-print-blank-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

body.csd-live-scoresheet-player .csd-print-blank-bar,
body.csd-live-scoresheet-watch .csd-print-blank-bar {
  display: none !important;
}

/* Phone layout: no paper-print chrome. Desktop captain / score manager keep the button. */
@media (max-width: 767px) {
  .csd-print-blank-bar {
    display: none !important;
  }
}

.csd-print-blank-btn {
  font-family: Oswald, Arial, sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff !important;
  background: #e31837 !important;
  border: 2px solid #9f1026 !important;
  border-radius: 4px;
  padding: 0.5rem 1rem !important;
  box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.28), 0 2px 8px rgba(0, 0, 0, 0.25);
  line-height: 1.15;
}

.csd-print-blank-btn::before {
  content: "🖨 ";
}

.csd-print-blank-btn:hover,
.csd-print-blank-btn:focus {
  color: #fff !important;
  background: #c41230 !important;
  border-color: #8a0e20 !important;
  box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.4), 0 3px 10px rgba(0, 0, 0, 0.3);
}

.csd-print-blank-btn:active {
  transform: translateY(1px);
}

/* Print mode chooser (score manager / captain) — theme-savvy Bootstrap modal */
.csd-print-mode-modal {
  --csd-print-modal-surface: #ffffff;
  --csd-print-modal-surface-alt: #f5f5f7;
  --csd-print-modal-fg: #1d1d1f;
  --csd-print-modal-muted: #6e6e73;
  --csd-print-modal-border: #d2d2d7;
}

body.dark-theme .csd-print-mode-modal {
  --csd-print-modal-surface: #2b2b2b;
  --csd-print-modal-surface-alt: #1f1f1f;
  --csd-print-modal-fg: #f8f9fa;
  --csd-print-modal-muted: #adb5bd;
  --csd-print-modal-border: #454d55;
}

.csd-print-mode-modal .csd-print-mode-modal-dialog {
  max-width: 420px;
  margin: 0.75rem auto;
  width: calc(100% - 1.5rem);
}

.csd-print-mode-modal .modal-content,
.csd-print-mode-modal .csd-print-mode-modal-content {
  border-radius: 12px;
  border: 1px solid var(--csd-print-modal-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  background-color: var(--csd-print-modal-surface);
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
  overflow: hidden;
}

.csd-print-mode-modal .modal-header,
.csd-print-mode-modal .csd-print-mode-modal-header {
  display: flex;
  align-items: flex-start;
  border-bottom: 2px solid #e31837;
  background-color: var(--csd-print-modal-surface-alt);
  padding: 0.85rem 1rem 0.75rem;
}

.csd-print-mode-modal .modal-title,
.csd-print-mode-modal .csd-print-mode-modal-title {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
  line-height: 1.2;
  flex: 1;
  padding-right: 0.5rem;
}

.csd-print-mode-modal .modal-header .close,
.csd-print-mode-modal .csd-print-mode-modal-close {
  color: var(--csd-print-modal-muted);
  -webkit-text-fill-color: var(--csd-print-modal-muted);
  opacity: 1;
  text-shadow: none;
  font-size: 1.6rem;
  font-weight: 400;
  padding: 0.1rem 0.35rem;
  margin: -0.2rem -0.2rem 0 auto;
}

.csd-print-mode-modal .csd-print-mode-modal-close:hover,
.csd-print-mode-modal .csd-print-mode-modal-close:focus {
  color: #e31837;
  -webkit-text-fill-color: #e31837;
  opacity: 1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(227, 24, 55, 0.35);
  border-radius: 4px;
}

.csd-print-mode-modal .modal-body,
.csd-print-mode-modal .csd-print-mode-modal-body {
  font-family: "Roboto", sans-serif;
  padding: 1rem 1rem 1.15rem;
  background-color: var(--csd-print-modal-surface);
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
}

.csd-print-mode-modal .csd-print-mode-modal-lead,
.csd-print-mode-modal .modal-body > p {
  font-size: 0.92rem;
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
  margin-bottom: 0.85rem !important;
}

.csd-print-mode-modal .csd-print-mode-modal-actions {
  gap: 0.65rem;
}

.csd-print-mode-modal .csd-print-mode-pick-secondary,
.csd-print-mode-modal .csd-print-mode-pick-primary {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.25;
}

.csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary {
  background-color: var(--csd-print-modal-surface);
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
  border: 1px solid var(--csd-print-modal-border);
}

.csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary:hover,
.csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary:focus {
  background-color: var(--csd-print-modal-surface-alt);
  color: var(--csd-print-modal-fg);
  -webkit-text-fill-color: var(--csd-print-modal-fg);
  border-color: var(--csd-print-modal-muted);
  box-shadow: 0 0 0 2px rgba(227, 24, 55, 0.25);
}

.csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary {
  background: #e31837 !important;
  border: 1px solid #e31837 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:hover,
.csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:focus {
  background: #c41230 !important;
  border-color: #c41230 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(227, 24, 55, 0.45);
}

/*
 * Dark admin: body.dark-theme sets light text globally; Bootstrap .modal-content
 * stays white unless we paint .modal-content / .modal-body explicitly (see chalksta-messenger.css).
 */
body.dark-theme .csd-print-mode-modal .modal-content,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-content {
  background-color: #2b2b2b !important;
  color: #f8f9fa !important;
  -webkit-text-fill-color: #f8f9fa !important;
  border-color: #454d55 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

body.dark-theme .csd-print-mode-modal .modal-header,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-header {
  background-color: #1f1f1f !important;
}

body.dark-theme .csd-print-mode-modal .modal-body,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-body {
  background-color: #2b2b2b !important;
  color: #e9ecef !important;
  -webkit-text-fill-color: #e9ecef !important;
}

body.dark-theme .csd-print-mode-modal .modal-title,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-title,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-lead,
body.dark-theme .csd-print-mode-modal .modal-body > p {
  color: #e9ecef !important;
  -webkit-text-fill-color: #e9ecef !important;
}

body.dark-theme .csd-print-mode-modal .modal-header .close,
body.dark-theme .csd-print-mode-modal .csd-print-mode-modal-close {
  color: #adb5bd !important;
  -webkit-text-fill-color: #adb5bd !important;
}

body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary {
  background-color: #343a40 !important;
  color: #f8f9fa !important;
  -webkit-text-fill-color: #f8f9fa !important;
  border-color: #6c757d !important;
}

body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary:hover,
body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-secondary.btn-outline-secondary:focus {
  background-color: #3d454d !important;
  border-color: #adb5bd !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary,
body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:hover,
body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:focus {
  background: #e31837 !important;
  border-color: #e31837 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:hover,
body.dark-theme .csd-print-mode-modal .csd-print-mode-pick-primary.btn-primary:focus {
  background: #c41230 !important;
  border-color: #c41230 !important;
}

.csd-hcp-styles-guide-link {
  display: block;
  font-family: Roboto, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #c41230;
  text-decoration: underline;
  line-height: 1.25;
  margin-top: 0.12rem;
}
.csd-hcp-styles-guide-link:hover {
  color: #e31837;
}
body.dark-theme .csd-hcp-styles-guide-link {
  color: #86c8ff;
}
body.dark-theme .csd-hcp-styles-guide-link:hover {
  color: #b7dcff;
}
.csd-hcp-style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  height: auto;
  min-height: 31px;
}
.csd-hcp-style-row > #csd-hcp-style {
  flex: 1 1 9rem;
  min-width: 9rem;
  max-width: none;
  height: 31px !important;
  min-height: 31px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}
/* Companion gear visible: stack both at full width so avg_lifetime / Customizations are not chopped. */
.csd-hcp-style-row--cpr > #csd-hcp-style,
.csd-hcp-style-row--vnea-plus > #csd-hcp-style,
.csd-hcp-style-row--hcp-lock > #csd-hcp-style,
.csd-hcp-style-row--cpr > .csd-hcp-application-widget,
.csd-hcp-style-row--vnea-plus > .csd-vnea-plus-widget,
.csd-hcp-style-row--hcp-lock > .csd-hcp-lock-widget {
  flex: 1 1 100%;
  max-width: none;
  min-width: 0;
}
.csd-hcp-lock-widget {
  display: flex;
  align-items: stretch;
  flex: 1 1 10.5rem;
  min-width: 10.5rem;
  height: 31px;
}
.csd-hcp-lock-widget.d-none {
  display: none !important;
}
.csd-hcp-lock-modal-content {
  display: flex;
  flex-direction: column;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

/*
 * Division Designer customization modals (hcp / avg / avg_lifetime lock, vnea+, CPR application).
 * Appended to <body> with a light .csd-modal-content surface. body.dark-theme sets light
 * global text; WebKit also keeps jumbotron cream in -webkit-text-fill-color on some admin pages.
 * Paint explicit theme tokens on the modal shell (same pattern as .csd-print-mode-modal).
 */
#csd-hcp-lock-modal,
#csd-vnea-plus-modal,
#csd-hcp-application-modal {
  --csd-custom-modal-surface: #ffffff;
  --csd-custom-modal-surface-alt: #f5f5f7;
  --csd-custom-modal-fg: var(--idx-fg, #1d1d1f);
  --csd-custom-modal-muted: var(--idx-muted, #6e6e73);
  --csd-custom-modal-border: var(--idx-border, #d2d2d7);
}

body.dark-theme #csd-hcp-lock-modal,
body.dark-theme #csd-vnea-plus-modal,
body.dark-theme #csd-hcp-application-modal {
  --csd-custom-modal-surface: #2b2b2b;
  --csd-custom-modal-surface-alt: #1f1f1f;
  --csd-custom-modal-fg: var(--idx-fg, #f8f9fa);
  --csd-custom-modal-muted: var(--idx-muted, #adb5bd);
  --csd-custom-modal-border: var(--idx-border, #454d55);
}

#csd-hcp-lock-modal .csd-modal-content,
#csd-vnea-plus-modal .csd-modal-content,
#csd-hcp-application-modal .csd-modal-content {
  background-color: var(--csd-custom-modal-surface) !important;
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
  border: 1px solid var(--csd-custom-modal-border);
}

#csd-hcp-lock-modal .csd-modal-header,
#csd-vnea-plus-modal .csd-modal-header,
#csd-hcp-application-modal .csd-modal-header {
  background-color: var(--csd-custom-modal-surface-alt);
  border-bottom-color: var(--csd-custom-modal-border);
}

#csd-hcp-lock-modal .csd-modal-title,
#csd-vnea-plus-modal .csd-modal-title,
#csd-hcp-application-modal .csd-modal-title {
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
}

#csd-hcp-lock-modal .csd-modal-close,
#csd-vnea-plus-modal .csd-modal-close,
#csd-hcp-application-modal .csd-modal-close {
  color: var(--csd-custom-modal-muted);
  -webkit-text-fill-color: var(--csd-custom-modal-muted);
}

#csd-hcp-lock-modal .csd-modal-close:hover,
#csd-hcp-lock-modal .csd-modal-close:focus,
#csd-vnea-plus-modal .csd-modal-close:hover,
#csd-vnea-plus-modal .csd-modal-close:focus,
#csd-hcp-application-modal .csd-modal-close:hover,
#csd-hcp-application-modal .csd-modal-close:focus {
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
  background: var(--csd-custom-modal-surface-alt);
}

#csd-hcp-lock-modal .csd-modal-body,
#csd-vnea-plus-modal .csd-modal-body,
#csd-hcp-application-modal .csd-modal-body {
  background-color: var(--csd-custom-modal-surface);
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
}

#csd-hcp-lock-modal .csd-modal-body label,
#csd-hcp-lock-modal .csd-modal-body strong,
#csd-hcp-lock-modal .csd-modal-body span,
#csd-hcp-lock-modal .csd-modal-body p,
#csd-vnea-plus-modal .csd-modal-body label,
#csd-vnea-plus-modal .csd-modal-body strong,
#csd-vnea-plus-modal .csd-modal-body span,
#csd-vnea-plus-modal .csd-modal-body p,
#csd-hcp-application-modal .csd-modal-body label,
#csd-hcp-application-modal .csd-modal-body strong,
#csd-hcp-application-modal .csd-modal-body span,
#csd-hcp-application-modal .csd-modal-body p,
#csd-hcp-application-modal .csd-hcp-application-variant-opt {
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
}

#csd-hcp-lock-modal .text-muted,
#csd-hcp-lock-modal .form-text,
#csd-hcp-lock-modal .small:not(.text-muted),
#csd-vnea-plus-modal .text-muted,
#csd-vnea-plus-modal .form-text,
#csd-vnea-plus-modal .small:not(.text-muted),
#csd-hcp-application-modal .text-muted,
#csd-hcp-application-modal .form-text,
#csd-hcp-application-modal .small:not(.text-muted) {
  color: var(--csd-custom-modal-muted) !important;
  -webkit-text-fill-color: var(--csd-custom-modal-muted) !important;
}

#csd-hcp-lock-modal .csd-hcp-application-modal-footer,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer,
#csd-hcp-application-modal .csd-hcp-application-modal-footer {
  background-color: var(--csd-custom-modal-surface);
  border-top-color: var(--csd-custom-modal-border);
}

#csd-hcp-lock-modal .form-control,
#csd-vnea-plus-modal .form-control,
#csd-hcp-application-modal .form-control,
#csd-hcp-application-modal .form-select {
  background-color: var(--csd-custom-modal-surface);
  border-color: var(--csd-custom-modal-border);
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
}

#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-outline-secondary,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-outline-secondary,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-outline-secondary {
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
  border-color: var(--csd-custom-modal-border);
  background-color: var(--csd-custom-modal-surface);
}

#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-outline-secondary:hover,
#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-outline-secondary:focus,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-outline-secondary:hover,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-outline-secondary:focus,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-outline-secondary:hover,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-outline-secondary:focus {
  color: var(--csd-custom-modal-fg);
  -webkit-text-fill-color: var(--csd-custom-modal-fg);
  border-color: var(--csd-custom-modal-muted);
  background-color: var(--csd-custom-modal-surface-alt);
}

#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-outline-secondary:disabled,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-outline-secondary:disabled,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-outline-secondary:disabled {
  color: var(--csd-custom-modal-muted);
  -webkit-text-fill-color: var(--csd-custom-modal-muted);
  border-color: var(--csd-custom-modal-border);
  background-color: var(--csd-custom-modal-surface-alt);
  opacity: 0.65;
}

#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-primary,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-primary,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-primary,
#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-primary:hover,
#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-primary:focus,
#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-primary:active,
#csd-hcp-lock-modal .csd-hcp-application-modal-footer .btn-primary:disabled,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-primary:hover,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-primary:focus,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-primary:active,
#csd-vnea-plus-modal .csd-hcp-application-modal-footer .btn-primary:disabled,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-primary:hover,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-primary:focus,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-primary:active,
#csd-hcp-application-modal .csd-hcp-application-modal-footer .btn-primary:disabled {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.csd-vnea-plus-widget {
  display: flex;
  align-items: stretch;
  flex: 1 1 10.5rem;
  min-width: 10.5rem;
  height: 31px;
}
.csd-vnea-plus-widget.d-none {
  display: none !important;
}
.csd-vnea-plus-modal-content {
  display: flex;
  flex-direction: column;
  max-width: 400px;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  position: relative;
  overflow: hidden;
}
#csd-vnea-plus-modal .csd-modal-header {
  flex: 0 0 auto;
}
#csd-vnea-plus-modal .csd-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.csd-hcp-application-widget {
  display: flex;
  align-items: stretch;
  flex: 1 1 10.5rem;
  min-width: 10.5rem;
  height: 31px;
}
.csd-hcp-application-widget.d-none {
  display: none !important;
}
.csd-hcp-application-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
  height: 31px !important;
  min-height: 31px;
  box-sizing: border-box;
  padding: 0 0.4rem 0 0.5rem;
  border: 1px solid var(--idx-border, #ced4da);
  border-radius: 0.2rem;
  background: var(--idx-surface, #fff);
  color: var(--idx-fg, inherit);
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}
.csd-hcp-application-open:hover,
.csd-hcp-application-open:focus {
  border-color: var(--idx-muted, #adb5bd);
  outline: none;
}
.csd-hcp-application-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-family: Roboto, "Segoe UI", sans-serif;
}
.csd-hcp-application-gear {
  flex: 0 0 auto;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.85;
}
.csd-hcp-application-variant-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.csd-hcp-application-variant-opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}
.csd-hcp-app-panel {
  margin-bottom: 0.75rem;
}
.csd-hcp-application-modal-content {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  position: relative;
  overflow: hidden;
}
#csd-hcp-application-modal .csd-modal-header {
  flex: 0 0 auto;
}
#csd-hcp-application-modal .csd-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.csd-hcp-application-modal-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  background: inherit;
}
.csd-hcp-app-confirm {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(20, 12, 12, 0.72);
  padding: 0;
}
.csd-hcp-app-confirm.d-none,
.csd-hcp-app-confirm[hidden] {
  display: none !important;
}
.csd-hcp-app-confirm__inner {
  margin: auto;
  width: calc(100% - 1.5rem);
  max-width: 26rem;
  background: #fff8f6;
  border: 2px solid #9b1c1c;
  border-radius: 8px;
  padding: 1rem 1.1rem 0.9rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #1b1b1b;
}
.csd-hcp-app-confirm__kicker {
  margin: 0 0 0.45rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9b1c1c;
}
.csd-hcp-app-confirm__title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: #3b0d0c;
}
.csd-hcp-app-confirm__body {
  font-size: 0.8125rem;
  line-height: 1.45;
}
.csd-hcp-app-confirm__body p {
  margin: 0 0 0.65rem;
}
.csd-hcp-app-confirm__body p:last-child {
  margin-bottom: 0;
}
.csd-hcp-app-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.csd-hcp-leave-cpr-confirm {
  position: fixed;
  inset: 0;
  z-index: 100003;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.csd-hcp-leave-cpr-confirm.d-none,
.csd-hcp-leave-cpr-confirm[hidden] {
  display: none !important;
}
.csd-hcp-leave-cpr-confirm__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 12, 0.72);
}
.csd-hcp-leave-cpr-confirm .csd-hcp-app-confirm__inner {
  position: relative;
  z-index: 1;
}
#csd-hcp-application-modal.csd-modal-open {
  display: block !important;
  z-index: 100002 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}
#csd-hcp-application-modal.csd-modal-open .csd-modal-content {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) !important;
}
.csd-hcp-app-tabs {
  display: flex;
  gap: 0;
  margin: 0.25rem 0 0;
  border-bottom: 1px solid var(--idx-border, #dee2e6);
}
.csd-hcp-app-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0.35rem 0.75rem;
  margin-bottom: -1px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--idx-muted, #6c757d);
  cursor: pointer;
  line-height: 1.2;
}
.csd-hcp-app-tab:hover,
.csd-hcp-app-tab:focus {
  color: var(--idx-fg, inherit);
  outline: none;
}
.csd-hcp-app-tab.active {
  color: var(--idx-fg, inherit);
  background: var(--idx-surface, #fff);
  border-color: var(--idx-border, #dee2e6);
  border-bottom-color: var(--idx-surface, #fff);
}
.csd-hcp-app-tab-pane {
  padding-top: 0.5rem;
}
.csd-hcp-app-tab-pane[data-tab-pane="json"] .csd-hcp-application-json {
  border-radius: 0 6px 6px 6px;
}
.csd-hcp-app-bands-wrap {
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--idx-border, #dee2e6);
  border-radius: 0 6px 6px 6px;
}
.csd-hcp-app-bands-table {
  margin: 0;
  font-size: 0.75rem;
}
.csd-hcp-app-bands-table th,
.csd-hcp-app-bands-table td {
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}
.csd-hcp-app-bands-table thead th {
  position: sticky;
  top: 0;
  background: var(--idx-surface-alt, #f4f5f7);
  z-index: 1;
}
.csd-hcp-application-json {
  margin: 0;
  padding: 0.6rem 0.75rem;
  max-height: 12rem;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.35;
  background: var(--idx-surface-alt, #f4f5f7);
  border: 1px solid var(--idx-border, #dee2e6);
  color: var(--idx-fg, inherit);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

body.dark-theme .csd-hcp-style-row > #csd-hcp-style,
body.dark-theme .csd-hcp-application-open {
  background: #343a40;
  border-color: #454d55;
  color: #f8f9fa;
}
body.dark-theme .csd-hcp-application-open:hover,
body.dark-theme .csd-hcp-application-open:focus {
  border-color: #596673;
  background: #3d444b;
}

/*
 * Division designer config panel only (#csd-controls-panel, plus the
 * GAME / GAMES controls that render beside the preview only when that
 * panel exists). Scoresheets are preview-only and have no panel, so
 * these selectors do not reach them.
 *
 * Light: .csd-hcp-application-open sets color: var(--idx-fg, inherit).
 * Div Mgmt never defines --idx-fg, so the captains box and gear inherit
 * the jumbotron cream #f4dbaa (about 1.35:1 on the white card) whenever
 * the designer root is not itself locked to #212529.
 * .csd-hcp-styles-guide-link is the legacy red #c41230; dark theme
 * swaps it to #86c8ff, which is for a dark bar, not this white card.
 *
 * Dark: body.dark-theme .form-control / .form-select (light-dark-theme.css)
 * and the handicap rule above paint #343a40 with #f8f9fa text. DID stays
 * a light box only because of its inline background. The cards stay white,
 * so the fields use the same light form tokens as .form-control
 * (background #fff, border #ced4da, text #495057, placeholder #868e96).
 * The guide link uses Bootstrap's darker link blue #165ba8 (6.8:1 on
 * white). The default link blue #2780e3 is 3.97:1 at this size.
 *
 * An extra id beats those rules, so this block does not use !important.
 */
#csd-controls-panel .form-control,
#csd-controls-panel .form-select,
#csd-controls-panel .csd-hcp-style-row > #csd-hcp-style,
#csd-controls-panel .csd-hcp-application-open,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-control,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-select {
  color-scheme: light;
  background-color: #fff;
  border-color: #ced4da;
  color: #495057;
  -webkit-text-fill-color: #495057;
}
#csd-controls-panel .form-control:focus,
#csd-controls-panel .form-select:focus,
#csd-controls-panel .csd-hcp-application-open:hover,
#csd-controls-panel .csd-hcp-application-open:focus,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-control:focus,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-select:focus {
  color-scheme: light;
  background-color: #fff;
  background: #fff;
  border-color: #98c2f2;
  color: #495057;
  -webkit-text-fill-color: #495057;
  outline: 0;
}
#csd-controls-panel .form-control:focus,
#csd-controls-panel .form-select:focus,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-control:focus,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(39, 128, 227, 0.25);
}
#csd-controls-panel .csd-hcp-application-open:hover,
#csd-controls-panel .csd-hcp-application-open:focus {
  border-color: #adb5bd;
  box-shadow: none;
}
#csd-controls-panel .form-control::placeholder,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl .form-control::placeholder {
  color: #868e96;
  -webkit-text-fill-color: #868e96;
  opacity: 1;
}
#csd-controls-panel select option,
#scoresheet-designer:has(#csd-controls-panel) .csd-round-title .csd-ctl select option {
  background-color: #fff;
  color: #495057;
}
#csd-controls-panel .csd-hcp-styles-guide-link,
#csd-controls-panel .csd-hcp-styles-guide-link:hover,
#csd-controls-panel .csd-hcp-styles-guide-link:focus {
  color: #165ba8;
  -webkit-text-fill-color: #165ba8;
}
body.dark-theme #csd-hcp-application-modal .csd-modal-content {
  background: #343a40;
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .csd-modal-title {
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .csd-modal-header {
  border-bottom-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-application-modal-footer {
  border-top-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-modal-close {
  color: #adb5bd;
}
body.dark-theme #csd-hcp-application-modal .csd-modal-close:hover {
  background: #454d55;
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .form-control,
body.dark-theme #csd-hcp-application-modal .form-select {
  background-color: #212529;
  border-color: #454d55;
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-tabs {
  border-bottom-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-tab {
  color: #adb5bd;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-tab:hover,
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-tab:focus {
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-tab.active {
  color: #f8f9fa;
  background: #343a40;
  border-color: #454d55;
  border-bottom-color: #343a40;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-bands-wrap {
  border-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-bands-table {
  color: #e9ecef;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-bands-table thead th {
  background: #212529;
  border-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-bands-table td,
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-bands-table th {
  border-color: #454d55;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-application-json {
  background: #212529;
  border-color: #454d55;
  color: #e9ecef;
}
body.dark-theme #csd-hcp-application-modal .btn-outline-secondary {
  color: #f8f9fa;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}
body.dark-theme #csd-hcp-application-modal .btn-outline-secondary:hover,
body.dark-theme #csd-hcp-application-modal .btn-outline-secondary:focus {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.12);
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-confirm {
  background: rgba(8, 4, 4, 0.82);
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-confirm__inner {
  background: #2a1212;
  border-color: #e35d5d;
  color: #f8f9fa;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-confirm__kicker {
  color: #ff8a8a;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-confirm__title {
  color: #fff;
}
body.dark-theme #csd-hcp-application-modal .csd-hcp-app-confirm__actions .btn-light {
  background: #3a3a3a;
  border-color: #555;
  color: #f8f9fa;
}
body.dark-theme .csd-hcp-leave-cpr-confirm__overlay {
  background: rgba(8, 4, 4, 0.82);
}
body.dark-theme .csd-hcp-leave-cpr-confirm .csd-hcp-app-confirm__inner {
  background: #2a1212;
  border-color: #e35d5d;
  color: #f8f9fa;
}
body.dark-theme .csd-hcp-leave-cpr-confirm .csd-hcp-app-confirm__kicker {
  color: #ff8a8a;
}
body.dark-theme .csd-hcp-leave-cpr-confirm .csd-hcp-app-confirm__title {
  color: #fff;
}
body.dark-theme .csd-hcp-leave-cpr-confirm .csd-hcp-app-confirm__actions .btn-light {
  background: #3a3a3a;
  border-color: #555;
  color: #f8f9fa;
}

#scoresheet-designer .csd-teams-hcp-cell.csd-bail-hcp-locked,
#scoresheet-designer .csd-teams-player-cell.csd-bail-player-help,
#scoresheet-designer .csd-teams-player-cell.csd-bail-slot {
  position: relative;
  overflow: visible;
}

#scoresheet-designer .csd-hcp-dd-display.csd-hcp-overridden,
#scoresheet-designer .csd-teams-hcp-cell.csd-hcp-overridden .csd-hcp-dd-display,
#scoresheet-designer .csd-teams-hcp-cell.csd-hcp-overridden {
  font-weight: 700;
  color: #2563eb !important;
  -webkit-text-fill-color: #2563eb !important;
}

/* Grid stays light; keep captain override blue (do not inherit jumbotron cream). */
body.dark-theme #scoresheet-designer .csd-hcp-dd-display.csd-hcp-overridden,
body.dark-theme #scoresheet-designer .csd-teams-hcp-cell.csd-hcp-overridden .csd-hcp-dd-display,
body.dark-theme #scoresheet-designer .csd-teams-hcp-cell.csd-hcp-overridden {
  color: #2563eb !important;
  -webkit-text-fill-color: #2563eb !important;
}

#scoresheet-designer .csd-bail-label-hit {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  max-width: none;
  min-height: 0;
  padding: 2px 0 0 0;
  margin: 0;
  border: 0;
  background: transparent;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  cursor: pointer;
  color: #dc3545;
  -webkit-text-fill-color: #dc3545;
  font-weight: normal;
  font-size: 17px;
}

#scoresheet-designer .csd-bail-label-hit[role="button"]:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

#scoresheet-designer .csd-bail-label-hit:not([role="button"]) {
  cursor: default;
}

#scoresheet-designer .csd-bail-word {
  font-weight: 400;
  font-size: inherit;
  color: #dc3545;
  -webkit-text-fill-color: #dc3545;
}

#scoresheet-designer .csd-bail-shooter-tag {
  font-size: 13px;
  font-weight: normal;
  color: #dc3545;
  -webkit-text-fill-color: #dc3545;
  margin-left: 3px;
}

#scoresheet-designer .csd-bail-assign {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #6c757d;
  -webkit-text-fill-color: #6c757d;
}

#scoresheet-designer .csd-bail-assign.is-captain {
  color: #0d6efd;
  -webkit-text-fill-color: #0d6efd;
}

body.dark-theme #scoresheet-designer .csd-bail-label-hit,
body.dark-theme #scoresheet-designer .csd-bail-word,
body.dark-theme #scoresheet-designer .csd-bail-shooter-tag {
  color: #ff6b6b;
  -webkit-text-fill-color: #ff6b6b;
}

body.dark-theme #scoresheet-designer .csd-bail-assign {
  color: #adb5bd;
  -webkit-text-fill-color: #adb5bd;
}

body.dark-theme #scoresheet-designer .csd-bail-assign.is-captain {
  color: #6ea8fe;
  -webkit-text-fill-color: #6ea8fe;
}

/* Hide native BAIL text so the overlay is the only label (avoids double "BAIL"). */
#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked,
#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked:disabled,
#scoresheet-designer .csd-readonly-player-name.csd-bail-label-masked {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
}

/* font-size:0 hides WebKit native glyphs; lock height so the row matches name+AVP rows. */
#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked,
#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked:disabled {
  font-size: 0 !important;
  line-height: 0 !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
}

#scoresheet-designer .csd-readonly-player-name.csd-bail-label-masked {
  font-size: 0 !important;
  line-height: 0 !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
}

#scoresheet-designer .csd-teams-player-cell.csd-bail-slot .csd-player-subtext {
  visibility: visible !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked option {
  font-size: 16px !important;
  line-height: 1.2 !important;
  color: #212529 !important;
  -webkit-text-fill-color: #212529 !important;
}

#scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked option[data-csd-bail="1"] {
  color: #dc3545 !important;
  -webkit-text-fill-color: #dc3545 !important;
}

@media (max-width: 767px) {
  #scoresheet-designer .csd-bail-label-hit {
    top: 0;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: auto;
    min-height: 0;
    padding: 0;
    font-size: 17px;
    line-height: 1.15;
    max-width: none;
    align-items: flex-start;
    padding-top: 13px;
  }

  #scoresheet-designer .csd-bail-word {
    font-size: 17px;
  }

  #scoresheet-designer .csd-bail-shooter-tag {
    font-size: 13px;
  }

  #scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked,
  #scoresheet-designer select.csd-teams-player-dropdown.csd-bail-label-masked:disabled,
  #scoresheet-designer .csd-readonly-player-name.csd-bail-label-masked {
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
  }
}

@media (max-width: 767px) and (orientation: portrait), (max-width: 480px) {
  #scoresheet-designer .csd-teams-player-cell.csd-bail-slot .csd-player-subtext {
    visibility: visible !important;
    height: auto !important;
    min-height: 0 !important;
    margin-top: 2px !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  #scoresheet-designer .csd-bail-label-hit.has-shooter {
    top: 0;
    bottom: 0;
    left: 2px;
    right: 2px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding-top: 13px;
    justify-content: flex-start;
    min-height: 0;
    height: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
  }

  #scoresheet-designer .csd-bail-label-hit.has-shooter .csd-bail-word {
    font-size: 17px;
    line-height: 1.15;
  }

  #scoresheet-designer .csd-bail-label-hit.has-shooter .csd-bail-shooter-tag {
    display: inline;
    margin-left: 3px;
    margin-top: 0;
    font-size: 13px;
    line-height: 1.15;
  }
}

.csd-bail-shooter-modal-content {
  max-width: 420px;
  width: calc(100% - 32px);
}

.csd-bail-shooter-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.csd-bail-shooter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.csd-bail-shooter-choice {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.csd-bail-shooter-choice:hover,
.csd-bail-shooter-choice:focus {
  border-color: #2563eb;
  outline: none;
}

.csd-bail-shooter-choice.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

body.dark-theme .csd-bail-shooter-hint {
  color: #adb5bd;
}

body.dark-theme .csd-bail-shooter-choice {
  background: #2b2b2b;
  border-color: #555;
  color: #f8f9fa;
}

body.dark-theme .csd-bail-shooter-choice.is-selected {
  background: #1e3a5f;
  border-color: #6ea8fe;
  color: #6ea8fe;
}

#scoresheet-designer .csd-bail-hcp-help {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 121;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6c757d;
  -webkit-text-fill-color: #6c757d;
  font-size: 12px;
  line-height: 14px;
  cursor: help;
  pointer-events: auto;
}

@media (min-width: 768px) {
  #scoresheet-designer .csd-teams-player-cell .csd-bail-hcp-help {
    display: none !important;
  }
}

@media (max-width: 767px) {
  #scoresheet-designer .csd-teams-hcp-cell .csd-bail-hcp-help {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-teams-player-cell.csd-bail-player-help {
    overflow: visible !important;
  }

  #scoresheet-designer .csd-teams-player-cell .csd-bail-hcp-help {
    display: block !important;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    font-size: 16px;
    line-height: 22px;
    z-index: 130 !important;
  }
}

#scoresheet-designer .csd-bail-hcp-help .fa {
  display: block;
  line-height: 14px;
}

#scoresheet-designer .csd-bail-hcp-help:hover,
#scoresheet-designer .csd-bail-hcp-help:focus {
  color: #e31837;
  -webkit-text-fill-color: #e31837;
  outline: none;
}

body.dark-theme #scoresheet-designer .csd-bail-hcp-help {
  color: #adb5bd;
  -webkit-text-fill-color: #adb5bd;
}

.csd-vnea-no-avp-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #f0c400;
  background: #fff3a3;
  color: #3d3200;
  font-family: Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 0 0 1px rgba(255, 224, 50, 0.55), 0 0 14px 3px rgba(255, 214, 0, 0.55);
}
.csd-teams-player-cell[data-csd-bail-shooter-cell="1"] {
  touch-action: manipulation;
}
.csd-vnea-no-avp-banner-bail {
  margin-left: auto;
}
.csd-vnea-no-avp-banner--bail-only .csd-vnea-no-avp-banner-bail {
  margin-left: 0;
}
.csd-bail-how-link {
  appearance: none;
  border: 1px solid #b02a37;
  background: #fff;
  color: #b02a37;
  font-family: Oswald, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.csd-bail-how-link:hover,
.csd-bail-how-link:focus {
  background: #b02a37;
  color: #fff;
  outline: none;
}
.csd-bail-how-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.csd-bail-how-list li {
  margin-bottom: 0.65rem;
}
.csd-bail-how-list li:last-child {
  margin-bottom: 0;
}
#csd-bail-how-modal.csd-modal {
  z-index: 100050 !important;
}
#csd-bail-how-modal.csd-modal .csd-modal-content {
  max-width: min(480px, 92vw);
  width: 100%;
}
#csd-bail-how-modal.csd-modal-open .csd-modal-content {
  transform: translate(-50%, -50%) scale(1) !important;
  opacity: 1 !important;
}
#csd-bail-how-modal .csd-modal-header {
  border-bottom: 1px solid #fee2e2;
  background: linear-gradient(180deg, #fff8f8 0%, #fff 100%);
}
#csd-bail-how-modal .csd-modal-title {
  color: #b02a37;
}
body.dark-theme .csd-bail-how-link {
  background: #2a2118;
  border-color: #ff8a8a;
  color: #ff8a8a;
}
body.dark-theme .csd-bail-how-link:hover,
body.dark-theme .csd-bail-how-link:focus {
  background: #b02a37;
  color: #fff;
}
body.dark-theme #csd-bail-how-modal .csd-modal-content {
  background: #1e1e1e;
  color: #e8e8e8;
}
body.dark-theme #csd-bail-how-modal .csd-modal-header {
  background: #2a1f1f;
  border-bottom-color: #444;
}
body.dark-theme #csd-bail-how-modal .csd-modal-title {
  color: #ff8a8a;
}
.csd-vnea-no-avp-banner[hidden] {
  display: none !important;
}
.csd-vnea-no-avp-banner-label {
  display: inline-block;
  margin-right: 0.45rem;
  font-family: Oswald, sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c4a00;
}
body.dark-theme .csd-vnea-no-avp-banner {
  border-color: #e6c200;
  background: #c9a800;
  color: #1a1400;
  box-shadow: 0 0 0 1px rgba(255, 224, 50, 0.45), 0 0 16px 4px rgba(255, 214, 0, 0.4);
}
body.dark-theme .csd-vnea-no-avp-banner-label {
  color: #2a2100;
}

.csd-bail-hcp-tooltip {
  position: fixed;
  z-index: 99999;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1a1a1a;
  border: 1px solid #555;
  color: #fff;
  font-family: Roboto, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Phase 6 — short landscape handheld: 90% scale on CSD root only (not viewport) */
/* JS: csd-landscape-fit.js sets html.csd-landscape-fit via visualViewport.     */
/* -------------------------------------------------------------------------- */

@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  html:not(.csd-landscape-fit-off) #scoresheet-designer {
    zoom: 0.9;
  }
}

html.csd-landscape-fit #scoresheet-designer {
  zoom: var(--csd-landscape-scale, 0.9);
}

html.csd-landscape-fit--transform #scoresheet-designer {
  zoom: unset;
  transform: scale(var(--csd-landscape-scale, 0.9));
  transform-origin: top center;
  width: calc(100% / var(--csd-landscape-scale, 0.9));
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

html.csd-landscape-fit #captain_scoresheet_div_new,
html.csd-landscape-fit #player_scoresheet_div_new,
html.csd-landscape-fit .chalksta-cs-tabs-wrap .tab-content {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* csd-teams-feat-circles
   Landscape and large screens: 8BB/8RO/8TRO (and 9-/10-ball) toggles are circles.
   Fixed 15px box — do not size these with width/height 100%. Teams sheets only. */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] .csd-checkbox-wrapper,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] .csd-checkbox-wrapper,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] .csd-checkbox-wrapper {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  flex: 0 0 15px !important;
  flex-shrink: 0 !important;
  aspect-ratio: 1 / 1 !important;
  align-self: center !important;
  box-sizing: border-box !important;
}

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="brk"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="ero"] input[type="checkbox"],
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-cell[data-csd-field="tro"] input[type="checkbox"] {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  flex: 0 0 15px !important;
  flex-shrink: 0 !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
}
/* end csd-teams-feat-circles */

/* Under-name handicap mirror. Hidden except teams portrait (see media below). */
.csd-portrait-hcp {
  display: none;
}

/* csd-teams-pts-light-theme
   The sheet is always light. Pts selects still follow the site theme and the
   OS color-scheme (body.dark-theme .form-select is navy), so a dark site
   theme paints them as navy pills. Force the closed control, the portrait
   pill, and the option list onto light ink in both site themes. */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown,
body.dark-theme #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown,
body.dark-theme #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown:focus,
body.dark-theme #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown:hover,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown option,
body.dark-theme #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown option {
  color-scheme: light !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-color: #f3f4f6 !important;
  background-image: none !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  border-color: #dde0e5 !important;
}
/* end csd-teams-pts-light-theme */

/* csd-teams-portrait-option-b
   Phone portrait only. Landscape and large screens keep their columns. */
@media (max-width: 767px) and (orientation: portrait) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: minmax(0, 1fr) 40px 54px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell {
    min-width: 0 !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  /* The name control stays a select. Its corner mark sat under CPR once the cell grew. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell > .csd-dropdown-indicator {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot) {
    font-size: clamp(11px, 3.2vw, 13px) !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    line-height: 1.15 !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot) {
    font-size: clamp(11px, 3.2vw, 13px) !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    line-height: 1.15 !important;
    width: 100% !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    word-break: break-word !important;
  }

  body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-my-game .csd-teams-player-dropdown:not(.csd-bail-slot),
  body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-my-game .csd-readonly-player-name:not(.csd-bail-slot) {
    font-size: clamp(11px, 3.2vw, 13px) !important;
  }

  /* Handicap lives on the AVP line. Keep a stale mirror from taking a second line. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-portrait-hcp {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-subtext {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-score {
    align-items: flex-start !important;
    padding-top: 12px !important;
    overflow: visible !important;
    min-width: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin-top: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-display {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f3f4f6 !important;
    border: 1px solid #dde0e5 !important;
    border-radius: 6px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    min-width: 34px !important;
    width: auto !important;
    padding: 0 12px 0 4px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    position: relative !important;
    /* Cover a native select the phone still paints dark. Clicks pass through. */
    z-index: 11 !important;
    pointer-events: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-display::after {
    content: "";
    position: absolute;
    right: 4px;
    top: 50%;
    margin-top: -2px;
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 4px solid #8b939e;
    pointer-events: none;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-dropdown-indicator {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-dropdown {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: none !important;
    opacity: 0 !important;
    z-index: 10 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-display.csd-readonly-points {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    font-size: 13px !important;
    box-shadow: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-display.csd-readonly-points::after {
    content: none !important;
    display: none !important;
  }

  body.dark-theme #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-display:not(.csd-readonly-points) {
    background: #f3f4f6 !important;
    border-color: #dde0e5 !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
  }

  body.csd-live-scoresheet-player #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-grid .csd-my-game .csd-points-container .csd-points-display {
    font-size: 12.5px !important;
  }

  /* Star stays the original absolute mark inside the scr cell (base .csd-mobile-feat-trigger).
     Do not pull it into its own flex track or header. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-score-cell .csd-mobile-feat-trigger {
    position: absolute !important;
    top: 1px !important;
    right: 1px !important;
    width: auto !important;
    flex: none !important;
    order: 0 !important;
    font-size: 11px !important;
    pointer-events: auto !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-score-value {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    font-size: 13px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text {
    overflow: visible !important;
    white-space: normal !important;
    height: auto !important;
    max-height: none !important;
    align-items: stretch !important;
    flex-wrap: wrap !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-totals-container {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    gap: 2px !important;
    min-width: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-item {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    width: 100% !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-label {
    flex: 0 0 auto !important;
    font-size: 9.5px !important;
    letter-spacing: 0.03em !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-totals-text .csd-total-value {
    font-size: 13px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    text-align: right !important;
  }

  /* BAIL / is-match names stay red, at the same size as the other names, so the row
     is not taller than the opposite side and the round footers line up. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-label-hit,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-label-hit.has-shooter,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-word,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-label-hit.has-shooter .csd-bail-word,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-shooter-tag,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-bail-label-hit.has-shooter .csd-bail-shooter-tag {
    font-size: clamp(11px, 3.2vw, 13px) !important;
    line-height: 1.15 !important;
    font-weight: 400 !important;
  }

  /* font-size stays 0 (native BAIL glyph stays hidden). Reserve the same line box
     other portrait names use, about 1.46 × that font, so the row is not shorter. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-teams-player-dropdown.csd-bail-label-masked,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-teams-player-dropdown.csd-bail-label-masked:disabled,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name.csd-bail-label-masked {
    height: calc(clamp(11px, 3.2vw, 13px) * 1.46) !important;
    min-height: calc(clamp(11px, 3.2vw, 13px) * 1.46) !important;
    max-height: calc(clamp(11px, 3.2vw, 13px) * 1.46) !important;
    line-height: 1.15 !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell.csd-bail-slot .csd-player-subtext {
    visibility: visible !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-top: 2px !important;
  }

  body.csd-has-sticky-score-bar #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    padding-bottom: calc(var(--csd-sticky-bar-h, 96px) + 20px) !important;
  }

  body.chalksta-git-footer-pad.csd-has-sticky-score-bar #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    padding-bottom: calc(var(--csd-sticky-bar-h, 96px) + 46px) !important;
  }
}
/* end csd-teams-portrait-option-b */

/* csd-teams-hcp-name-line
   The hcp number uses the same top inset as the player name. BAIL rows
   share that inset, so the value is not centered in a taller cell. */
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-teams-hcp-cell,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-hcp-cell.csd-bail-hcp-slot,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-hcp-cell.csd-bail-hcp-locked {
  align-items: flex-start !important;
  justify-content: center !important;
  padding-top: 4px !important;
}
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell .csd-hcp-dd-container,
#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-hcp-cell .csd-hcp-dd-display {
  align-items: flex-start !important;
  justify-content: center !important;
  height: auto !important;
  min-height: 0 !important;
}
@media (max-width: 767px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-hcp-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="hcp"] .csd-teams-hcp-cell,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid[data-csd-col-density="feats"] .csd-teams-hcp-cell {
    padding-top: 13px !important;
  }
}
/* end csd-teams-hcp-name-line */

/* csd-teams-portrait-edge
   Portrait phones and portrait tablets only. Landscape and desktop are untouched.
   Side padding is a 2px hairline so the round bar and both grids sit on the
   screen edge. Width that padding used to take goes to the Player column.
   The Player column still stops near 160px. pts and scr tracks stay put.
   The pts drop-down fills its existing cell. */
@media (orientation: portrait) and (max-width: 900px) {
  body.chalksta-app .idx-content-wrap:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .chalksta-cs-main:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]),
  .chalksta-ssv-main:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.chalksta-app .container-fluid:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:not(.chalksta-app) .container-fluid:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  #main_scores_area:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-left-width: 0 !important;
    border-right-width: 0 !important;
    border-radius: 0 !important;
  }

  .chalksta-cs-tabs-wrap:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]),
  .tab-content:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]),
  .tab-pane:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]),
  #captain_scoresheet_div_new:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]),
  #player_scoresheet_div_new:has(#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"]) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #scoresheet-designer.container[data-csd-game-type="teams_standard_gameplay"] {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* The live sheet is container-fluid, not .container. Zero its 15px side
     padding without overriding the 560px cap used once Player hits ~160px. */
  #scoresheet-designer.container-fluid[data-csd-game-type="teams_standard_gameplay"],
  #scoresheet-designer.csd-wrap[data-csd-game-type="teams_standard_gameplay"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Bootstrap .row is -15px and .container-fluid is +15px. Drop both so the
     sheet does not depend on that cancellation, which clips on the real page. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] > .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Injected .csd-preview.col-lg-11 { max-width: 91.666667% } is not in a
     media query. It caps the preview on phones when that class is present. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview.col-12,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview.col-lg-8,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview.col-lg-11,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] #csd-preview-container,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] #csd-preview-body,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] #csd-preview-root {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-card {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-scoresheet-wrapper,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-preview-body,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Team name cards only. The round bar and score grids stay on the screen edge. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-sheet > .csd-two {
    padding-left: clamp(6px, 2vw, 8px) !important;
    padding-right: clamp(6px, 2vw, 8px) !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two {
    gap: 2px !important;
    justify-content: center !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-home-card"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-away-card"] {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col + .csd-col {
    box-shadow: -1px 0 0 #dee2e6;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title.mb-2 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] [id^="csd-round-"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-title > .csd-bar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    border-radius: 0.375rem 0.375rem 0 0 !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    border-radius: 0 0 0.375rem 0.375rem !important;
    overflow: hidden !important;
  }

  body.csd-has-sticky-score-bar #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    padding-bottom: calc(var(--csd-sticky-bar-h, 96px) + 20px) !important;
  }

  body.chalksta-git-footer-pad.csd-has-sticky-score-bar #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    padding-bottom: calc(var(--csd-sticky-bar-h, 96px) + 46px) !important;
  }
}

@media (orientation: portrait) and (max-width: 767px) {
  /* Name takes the leftover up to ~160px. After that, pts and scr share it. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
    grid-template-columns: minmax(0, 160px) minmax(38px, 1fr) minmax(36px, 1fr) !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-home-card"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-away-card"] {
    max-width: 276px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-pts {
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-score,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-score-cell {
    padding-left: 1px !important;
    padding-right: 1px !important;
    box-sizing: border-box !important;
  }

  /* Fill the existing pts cell. Do not widen the track. The arrow sits in the padding. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-col-pts .csd-points-container,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-rowcell.csd-col-pts .csd-points-container {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: stretch !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-display:not(.csd-readonly-points) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    padding: 0 3px !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-points-container .csd-points-display:not(.csd-readonly-points)::after {
    right: 2px !important;
    margin-top: -1.5px !important;
    border-left-width: 2px !important;
    border-right-width: 2px !important;
    border-top-width: 3px !important;
  }

  /* Trim the spare under the name and AVP line. Home and away share the same floor. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-player-cell {
    padding-top: clamp(11px, 2.8vw, 12px) !important;
    padding-bottom: 1px !important;
    min-height: clamp(44px, 12vw, 46px) !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-score {
    min-height: clamp(44px, 12vw, 46px) !important;
    padding-bottom: 1px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-mobile-game-number {
    top: 3px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-break-indicator-teams,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-player-cell .csd-break-indicator {
    top: 1px !important;
  }

  /* The round bar is 100% of the round. Home and away must share that width.
     flex-basis 0 beats calc(50% - gap), which left the away grid short of the bar. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col {
    flex: 1 1 0% !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* The phone rule pads only the away column by 4px, so its grid stops short of the bar. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col:last-child {
    padding-right: 0 !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col .csd-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (orientation: portrait) and (min-width: 560px) and (max-width: 767px) {
  /* Columns have hit the name cap. Keep the round bar the same width and center the sheet. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    width: 560px !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@media (orientation: portrait) and (min-width: 768px) and (max-width: 900px) {
  /* "scr" fits the narrow score track. Feat and hcp tracks stay at their current sizes. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-score-header .csd-score-full {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-score-header .csd-score-abbr {
    display: inline !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two {
    gap: 8px !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-home-card"],
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-two > .csd-col[id^="csd-s"][id$="-away-card"] {
    max-width: 428px !important;
  }

  @container csd-teams (max-width: 800px) {
    #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
      grid-template-columns: 24px minmax(0, 160px) 36px minmax(40px, 1fr) 36px 36px 36px minmax(38px, 1fr) !important;
    }
  }

  @container csd-teams (min-width: 801px) {
    #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid.csd-teams-grid {
      grid-template-columns: 28px minmax(0, 160px) 40px minmax(42px, 1fr) 40px 40px 40px minmax(40px, 1fr) !important;
    }
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-rowcell.csd-col-pts,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-col-score,
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-grid .csd-teams-score-cell {
    padding-left: 1px !important;
    padding-right: 1px !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col {
    flex: 1 1 0% !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-round-scroll .csd-two > .csd-col .csd-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (orientation: portrait) and (min-width: 860px) and (max-width: 900px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] {
    width: 864px !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
/* end csd-teams-portrait-edge */

/* csd-singles-portrait-fit
   Singles phone portrait only. Teams, landscape, and desktop are unchanged. */
@media (max-width: 767px) and (orientation: portrait) {
  /* One fluid size for every number in the score grid, at the pts size.
     The word Totals stays 1.2× that and bolder. */
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] {
    --csd-singles-portrait-num: clamp(9px, 2.6vw, 13px);
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid > .csd-rownum,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-display,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] select.csd-points-dropdown,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-totals,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-totals .csd-handicap-text-mobile,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-totals .csd-handicap-text-desktop {
    font-size: var(--csd-singles-portrait-num) !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums;
    line-height: 1 !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-totals.csd-totals-label {
    font-size: calc(var(--csd-singles-portrait-num) * 1.2) !important;
    font-weight: 700 !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-cell.csd-totals {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    word-break: normal !important;
    padding: 2px 1px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-totals-label {
    justify-content: flex-start !important;
    padding-left: 4px !important;
  }

  /* One # width for every portrait phone. The track and the cells match,
     so the older 20px and 22px locks cannot leave a strip before pts. */
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid {
    grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid > .csd-cell:first-child,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid > .csd-rownum {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rowcell,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-header,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-container,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-display,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] select.csd-points-dropdown {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-points-display {
    padding: 0 !important;
  }

  /* The 8-ball stays at the top of the # cell. The game number is centred
     under it, at the shared number size, in the row that is already there. */
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-grid > .csd-rownum {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 13px 0 2px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] .csd-rownum .csd-break-indicator {
    position: absolute !important;
    top: 1px !important;
    left: 50% !important;
    right: auto !important;
    width: 11px !important;
    height: 11px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateX(-50%) !important;
    box-sizing: border-box !important;
  }
}

/* A focused select under 16px zooms iOS. The pill shows the shared size. */
@media (max-width: 767px) and (orientation: portrait) and (pointer: coarse),
       (max-width: 767px) and (orientation: portrait) and (hover: none) {
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] select.csd-points-dropdown {
    font-size: 16px !important;
  }
}
/* end csd-singles-portrait-fit */

/* csd-designer-singles-preview
   Division designer only. A loaded singles division did not stamp
   data-csd-game-type, so this grid had no columns and stacked.
   Real sheets have no .csd-controls-container. Teams grids keep their class. */
@media (min-width: 768px) {
  #scoresheet-designer.csd-wrap:has(.csd-controls-container) .csd-round-scroll .csd-grid:not(.csd-teams-grid) {
    display: grid !important;
    grid-template-columns: 40px 1fr 1fr 1fr 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #scoresheet-designer.csd-wrap:has(.csd-controls-container) .csd-round-scroll .csd-grid:not(.csd-teams-grid) .csd-rownum .csd-break-indicator {
    top: 1px !important;
    right: 1px !important;
    left: auto !important;
  }
}
/* end csd-designer-singles-preview */

/* csd-teams-score-picker
   Touch score picker. Open on phones and tablets, portrait and landscape.
   A mouse on a desktop keeps the native select. The sheet is created only
   while the picker is open, so the scoresheet grid itself does not change. */
.csd-score-picker {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}
/* Left in place for ~400ms after the sheet closes so the synthesized click
   hits this shield instead of the pts cell or feat underneath. */
#csd-score-picker-ghost,
.csd-score-picker-ghost {
  position: fixed;
  inset: 0;
  z-index: 2000;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: manipulation;
}
.csd-score-picker-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 32, 0.45);
  cursor: pointer;
  touch-action: manipulation;
}
.csd-score-picker-sheet {
  position: relative;
  width: min(100%, 480px);
  max-height: min(78svh, 560px);
  max-height: min(78dvh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #212529;
  border-radius: 0.75rem 0.75rem 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  touch-action: manipulation;
}
.csd-score-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.csd-score-picker-title {
  margin: 0;
  font-family: Oswald, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.csd-score-picker-cancel,
.csd-score-picker-option {
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.csd-score-picker-cancel {
  border: 0;
  background: transparent;
  color: #495057;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 0.375rem;
}
.csd-score-picker-cancel:focus-visible,
.csd-score-picker-option:focus-visible {
  outline: 2px solid #e31837;
  outline-offset: 2px;
}
.csd-score-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.csd-score-picker-option {
  min-height: 52px;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  background: #f8f9fa;
  color: #212529;
  font-size: max(16px, 1.25rem);
  font-weight: 600;
  padding: 8px;
}
/* Short landscape: more columns, still at least 16px so iOS does not zoom. */
@media (orientation: landscape) and (max-height: 500px) {
  .csd-score-picker-sheet {
    padding-top: 6px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .csd-score-picker-head {
    margin-bottom: 4px;
  }
  .csd-score-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
  }
  .csd-score-picker-option {
    min-height: 40px;
    font-size: 16px;
    padding: 4px;
  }
}
@media (pointer: coarse), (hover: none) {
  #scoresheet-designer select.csd-points-dropdown,
  #scoresheet-designer .csd-points-container {
    touch-action: manipulation;
  }
  /* The hidden select must not take the touch, or iOS opens its own picker.
     The container is the hit target. touch-action stays manipulation so a drag can scroll. */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] select.csd-points-dropdown,
  #scoresheet-designer[data-csd-game-type="singles_standard_gameplay"] select.csd-points-dropdown {
    pointer-events: none !important;
  }
  /* 16px stops iOS zoom. The visible pill keeps its own !important size. */
  #scoresheet-designer select.csd-points-dropdown {
    font-size: 16px;
  }
}
.csd-score-picker-option.is-current {
  background: #495057;
  border-color: #495057;
  color: #fff;
}
.csd-score-picker-option.is-clear {
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.dark-theme .csd-score-picker-sheet {
  background: #343a40;
  color: #f8f9fa;
}
body.dark-theme .csd-score-picker-cancel {
  color: #f8f9fa;
}
body.dark-theme .csd-score-picker-option {
  background: #212529;
  border-color: #6c757d;
  color: #f8f9fa;
}
body.dark-theme .csd-score-picker-option.is-current {
  background: #e9ecef;
  border-color: #e9ecef;
  color: #212529;
}
/* end csd-teams-score-picker */

@media print {
  html.csd-landscape-fit #scoresheet-designer,
  html.csd-landscape-fit--transform #scoresheet-designer {
    zoom: 1 !important;
    transform: none !important;
    width: 100% !important;
  }

  /*
   * Filled teams_standard_gameplay sheet (browser print / Save as PDF):
   * names only in Player column; handicap stays in hcp column.
   */
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-player-subtext {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-direction: column !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: auto !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-readonly-player-name:not(.csd-bail-slot),
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-dropdown:not(.csd-bail-slot) {
    font-size: 17px !important;
    font-weight: bold !important;
    line-height: 1.15 !important;
    height: auto !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    white-space: nowrap !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-teams-player-cell .csd-dropdown-indicator {
    display: none !important;
  }

  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-portrait-hcp {
    display: none !important;
  }
}