/* ============================================================================
 * 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;
  box-sizing: border-box !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;
}

