/* ============================================================================
 * 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
 * ============================================================================ */

/* Override dark theme inheritance from parent containers - ONLY for supported game types */

#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;
}

/* 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;
}

/* 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;
}

/* 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;
}

/* 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;
}

/* 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: visible !important;
}

/* Round totals text row - single cell spanning all columns with formatted text */

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

.csd-round-totals-text {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.5rem 1rem !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  overflow-x: auto !important;
  cursor: help !important;
  position: relative !important;
  gap: 1.5rem !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;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.5rem 1rem !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  overflow-x: auto !important;
  cursor: help !important;
  position: relative !important;
  gap: 1.5rem !important;
}

/* Mobile: Long press for tooltip */

@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;
  }
}

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

.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;
}

/* 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;
}

/* 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;
}

/* 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) {
  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 {
  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;
}

/* hcp column values - vertically centered */

#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 {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 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: #ffffff !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 is hidden for teams mode - additional CSS override */

#scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-dyn-hcp {
  display: none !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 */

#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;
  width: auto !important;
  max-width: none !important;
  min-width: auto !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;
  width: auto !important;
  max-width: none !important;
  min-width: auto !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 {
  display: block !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  text-align: left !important;
  margin: 0px !important;
}

/* Override mobile media queries for score font size in teams mode */

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

@media (max-width: 375px) {
  #scoresheet-designer[data-csd-game-type="teams_standard_gameplay"] .csd-score {
    font-size: 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 */

#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-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;
}

/* 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-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 */

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

/* ----------------------------------------------------------------------------
 * 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;
  }
}

/* Replace header text: remove numeric prefixes and change "win" to "W" */

/* Headers are now shorter, so no vertical rotation needed */

/* Hide original text for feat headers (not #) */

@media (max-width: 767px) {
  .csd-header:not(:first-child) {
    font-size: 0 !important;
    color: transparent !important;
    overflow: hidden !important;
    position: relative !important;
    min-height: 44px !important;
    padding: .35rem .2rem !important;
  }
}

/* Win/Points header - replace with "W" (normal orientation) */

@media (max-width: 767px) {
  .csd-header:nth-child(2)::before {
    content: "W" !important;
    font-size: .7rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* 8BB/9BB/10BB header - remove numeric prefix, show "BB" (normal orientation) */

@media (max-width: 767px) {
  .csd-header:nth-child(3)::before {
    content: "BB" !important;
    font-size: .7rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* 8RO/9RO/10RO header - remove numeric prefix, show "RO" (normal orientation) */

@media (max-width: 767px) {
  .csd-header:nth-child(4)::before {
    content: "RO" !important;
    font-size: .7rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* 8TRO/9TRO/10TRO header - remove numeric prefix, show "TRO" (normal orientation) */

@media (max-width: 767px) {
  .csd-header:nth-child(5)::before {
    content: "TRO" !important;
    font-size: .7rem !important;
    color: #374151 !important;
    font-weight: 600 !important;
    display: block !important;
    text-align: center !important;
  }
}

/* Reduce row number column width */

@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: .75rem !important;
  }
}

/* Compact cell padding - maintain touch target but reduce horizontal space */

@media (max-width: 767px) {
  .csd-cell {
    padding: .4rem .2rem !important;
    font-size: .8rem !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 */

@media (max-width: 767px) {
  .csd-rowcell input[type="number"], .csd-rowcell select {
    padding: .35rem .2rem !important;
    font-size: .8rem !important;
    min-width: 0;
  }
}

/* Compact totals row */

@media (max-width: 767px) {
  .csd-totals {
    padding: .35rem .2rem !important;
    font-size: .75rem !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 */

@media (max-width: 767px) {
  .csd-rowcell {
    padding: .35rem .2rem !important;
    font-size: .8rem !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: .7rem !important;
  }
}

@media (max-width: 375px) {
  .csd-cell {
    padding: .35rem .15rem !important;
    font-size: .75rem !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) {
  .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) {
  .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) {
  .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) {
  .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 */

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

@media (max-width: 767px) {
  .csd-two .csd-col .csd-card {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Grids must match card width exactly */

@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;
  }
}

/* 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: .5rem !important;
    padding-bottom: .5rem !important;
    position: relative !important;
    overflow: visible !important;
    z-index: 1 !important;
  }
}

/* Hide or minimize player title */

@media (max-width: 767px) {
  .csd-player-title {
    font-size: .75rem !important;
    margin-bottom: .25rem !important;
    font-weight: 600;
  }
}

/* Compact player name - ensure full names visible */

@media (max-width: 767px) {
  .csd-player-name {
    font-size: .75rem !important;
    line-height: 1.2;
    word-break: break-word;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: 100% !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;
  }
}

/* Sheet header - mobile: show only Sheet X of Y and Match ID */

@media (max-width: 767px) {
  .csd-sheet-bar {
    font-size: .75rem !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: .25rem !important;
  }
}

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

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

/* Very small screens - even more compact */

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

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

@media (max-width: 375px) {
  .csd-player-name {
    font-size: .8rem !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: auto !important;
  overflow-y: visible !important;
}

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

@media (max-width: 767px) {
  .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: 767px) {
  .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;
  }
}

/* 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: .7rem !important;
  }
}

@media (max-width: 600px) {
  .csd-cell {
    padding: .35rem .18rem !important;
    font-size: .75rem !important;
  }
}

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

@media (max-width: 600px) {
  .csd-header:nth-child(2)::before, .csd-header:nth-child(3)::before, .csd-header:nth-child(4)::before, .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: .68rem !important;
  }
}

@media (max-width: 480px) {
  .csd-cell {
    padding: .32rem .16rem !important;
    font-size: .72rem !important;
  }
}

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

@media (max-width: 480px) {
  .csd-header:nth-child(2)::before, .csd-header:nth-child(3)::before, .csd-header:nth-child(4)::before, .csd-header:nth-child(5)::before {
    font-size: .63rem !important;
  }
}

/* Scale down grid columns proportionally on very small screens */

@media (max-width: 360px) {
  .csd-two {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: .3rem !important;
  }
}

@media (max-width: 360px) {
  .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;
  }
}

/* Scale down grid columns even more - use flexible units to fill space */

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

@media (max-width: 360px) {
  .csd-grid > .csd-cell:first-child, .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) {
  .csd-cell {
    padding: .3rem .15rem !important;
    font-size: .7rem !important;
  }
}

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

@media (max-width: 360px) {
  .csd-header:nth-child(2)::before, .csd-header:nth-child(3)::before, .csd-header:nth-child(4)::before, .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;
}

