/* ==========================================================
   v179.9.80 — Wrigley pitch semantics + combined third-out marker
   Scope: visual only. No scoring/stat/storage logic changes.
   ========================================================== */

:root{
  --scorebook-ball-blue:#2387e8;
  --scorebook-strike-red:#df4b45;
  --scorebook-inning-red:#df4b46;
}

/* ----------------------------------------------------------
   WRIGLEY PITCH SEMANTICS
   Older Wrigley palette rules intentionally used cream for balls.
   Ball/strike meaning now wins over theme palette with explicit,
   higher-specificity selectors.
   ---------------------------------------------------------- */

/* Ball / Strike buttons */
html body[data-theme-family="wrigley"] #playModal .v142-ball-strike button[data-v140-result="Ball"],
html body[data-theme-family="wrigley"] #playModal .v140-pitch-inputs button.v143-ball{
  border-color:var(--scorebook-ball-blue)!important;
  color:var(--scorebook-ball-blue)!important;
  -webkit-text-fill-color:var(--scorebook-ball-blue)!important;
  background:color-mix(in srgb,var(--scorebook-ball-blue) 12%,var(--wr-green-800,#0b5038))!important;
}
html body[data-theme-family="wrigley"] #playModal .v142-ball-strike button[data-v140-result="Ball"] i,
html body[data-theme-family="wrigley"] #playModal .v140-pitch-inputs button.v143-ball i{
  color:var(--scorebook-ball-blue)!important;
}
html body[data-theme-family="wrigley"] #playModal .v142-ball-strike button[data-v140-result="Called Strike"],
html body[data-theme-family="wrigley"] #playModal .v140-pitch-inputs button.v143-strike{
  border-color:var(--scorebook-strike-red)!important;
  color:var(--scorebook-strike-red)!important;
  -webkit-text-fill-color:var(--scorebook-strike-red)!important;
  background:color-mix(in srgb,var(--scorebook-strike-red) 10%,var(--wr-green-800,#0b5038))!important;
}

/* Count lights */
html body[data-theme-family="wrigley"] #playModal .v141-count-lights>span:first-child i.on{
  background:var(--scorebook-ball-blue)!important;
  border-color:var(--scorebook-ball-blue)!important;
  color:var(--scorebook-ball-blue)!important;
  box-shadow:0 0 7px color-mix(in srgb,var(--scorebook-ball-blue) 28%,transparent)!important;
}
html body[data-theme-family="wrigley"] #playModal .v141-count-lights>span:last-child i.on{
  background:var(--scorebook-strike-red)!important;
  border-color:var(--scorebook-strike-red)!important;
  color:var(--scorebook-strike-red)!important;
  box-shadow:0 0 7px color-mix(in srgb,var(--scorebook-strike-red) 28%,transparent)!important;
}

/* Recorded locations: live editor and View All map */
html body[data-theme-family="wrigley"] #playModal .v138-zone i.tone-ball,
html body[data-theme-family="wrigley"] #pitchHistoryModal .v138-zone i.tone-ball{
  background:var(--scorebook-ball-blue)!important;
  border-color:#fff!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
html body[data-theme-family="wrigley"] #playModal .v138-zone i:is(.tone-called,.tone-swing,.tone-foul),
html body[data-theme-family="wrigley"] #pitchHistoryModal .v138-zone i:is(.tone-called,.tone-swing,.tone-foul){
  background:var(--scorebook-strike-red)!important;
  border-color:#fff!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}

/* Pitch sequence: number circle and result chip */
html body[data-theme-family="wrigley"] #playModal .v141-sequence article:is(.is-ball,.tone-ball)>span{
  background:var(--scorebook-ball-blue)!important;
  border-color:var(--scorebook-ball-blue)!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
html body[data-theme-family="wrigley"] #playModal .v141-sequence article:is(.is-ball,.tone-ball)>em{
  border-color:var(--scorebook-ball-blue)!important;
  color:var(--scorebook-ball-blue)!important;
  -webkit-text-fill-color:var(--scorebook-ball-blue)!important;
}
html body[data-theme-family="wrigley"] #playModal .v141-sequence article:is(.is-strike,.tone-called,.tone-swing,.tone-foul)>span{
  background:var(--scorebook-strike-red)!important;
  border-color:var(--scorebook-strike-red)!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
html body[data-theme-family="wrigley"] #playModal .v141-sequence article:is(.is-strike,.tone-called,.tone-swing,.tone-foul)>em{
  border-color:var(--scorebook-strike-red)!important;
  color:var(--scorebook-strike-red)!important;
  -webkit-text-fill-color:var(--scorebook-strike-red)!important;
}

/* Pitch history rows and legend */
html body[data-theme-family="wrigley"] #pitchHistoryModal .pitch-history-row:is(.is-ball,.tone-ball) .pitch-history-no{
  background:var(--scorebook-ball-blue)!important;
  border-color:var(--scorebook-ball-blue)!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
html body[data-theme-family="wrigley"] #pitchHistoryModal .pitch-history-row:is(.is-strike,.tone-called,.tone-swing,.tone-foul) .pitch-history-no{
  background:var(--scorebook-strike-red)!important;
  border-color:var(--scorebook-strike-red)!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
html body[data-theme-family="wrigley"] #pitchHistoryModal .v179921-map-key .tone-ball{
  color:var(--scorebook-ball-blue)!important;
}
html body[data-theme-family="wrigley"] #pitchHistoryModal .v179921-map-key .tone-called{
  color:var(--scorebook-strike-red)!important;
}

/* ----------------------------------------------------------
   THIRD OUT + AT-BAT CHANGE
   Two full-width rules stacked together looked like a rendering bug.
   Keep the inning-ending RED rule full-width and convert the personnel
   change into a compact black label centered immediately above it.
   Ordinary (non-third-out) PH/PC markers remain unchanged.
   ---------------------------------------------------------- */

.unified-score-table .play-cell.third-out::after,
.scoring-only-table .play-cell.third-out::after{
  height:3px!important;
  background:var(--scorebook-inning-red)!important;
  z-index:12!important;
}

body .play-cell.third-out .event-marker.v1563-change-marker,
body .play-cell.third-out .v137-grid-marker.v1563-change-marker{
  left:50%!important;
  right:auto!important;
  bottom:4px!important;
  transform:translateX(-50%)!important;
  width:24px!important;
  min-width:24px!important;
  max-width:24px!important;
  height:7px!important;
  min-height:7px!important;
  max-height:7px!important;
  background:#111!important;
  border-radius:3px 3px 0 0!important;
  overflow:visible!important;
  z-index:14!important;
}
body .play-cell.third-out .v1563-change-marker[data-label="PC/PH"]{
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
}
body .play-cell.third-out .v1563-change-marker::after{
  left:0!important;
  right:0!important;
  bottom:0!important;
  transform:none!important;
  width:100%!important;
  min-width:100%!important;
  max-width:100%!important;
  height:7px!important;
  min-height:7px!important;
  max-height:7px!important;
  padding:0 2px!important;
  border-radius:3px 3px 0 0!important;
  background:#111!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  font-size:4px!important;
  line-height:7px!important;
  font-weight:950!important;
  letter-spacing:.035em!important;
}
/* Keep this combined marker black/white even in dark themes: it is a
   scorekeeping symbol, while the red line retains inning-end meaning. */
body.dark-mode .play-cell.third-out .event-marker.v1563-change-marker,
body.dark-mode .play-cell.third-out .v137-grid-marker.v1563-change-marker,
body.dark-mode .play-cell.third-out .v1563-change-marker::after{
  background:#111!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
body .play-cell.third-out .play-entry:has(.v1563-change-marker) .play-code{
  bottom:12px!important;
}
