#allWinsViews, #cityTeamsRawData {
  display: none;
}

#tweak {
  position: fixed;
  z-index: 11;
  display: none;
}

html.collapsed {
  /* #content {
    width: 60%;
  }

  #info_wrapper {
    width: 40%;
  } */
}

#content_header_wrapper {
  width: 100%;
  position: sticky;
  position: -webkit-sticky; /* For Safari */
  top: -1px;
  /* left: calc(50% - (70% / 2));  /* Adjust based on your width */ */
  transform: none;  /* We don't need the translateX for centering anymore */
  background-color: var(--primary-bg-color);
  z-index: 5;
  padding-top: 1rem 1rem 0rem 1rem;
  /* box-shadow: 20px 20px 20px var(--primary-bg-color); */

  #content_header {
    max-width: 1000px;
    margin: auto;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    padding: 0 2rem;
  }
}

.tool-btn {
  background: none;
  border: 2px solid #9c812f;
  border-radius: 2rem;
  padding: 0.2rem 0.9rem;
  cursor: pointer;
  color: #9c812f;
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.4px;
  transition: background 0.15s, color 0.15s;
  margin: 0 0.3rem;
  white-space: nowrap;

  &:hover {
    background: #9c812f22;
  }

  &.active {
    background: #9c812f;
    color: #fff;
  }
}

#tools {
  width: 100%;
  right: 0px;
  max-width: 1000px;
  margin: auto;
  z-index: 8;
  position: relative;
  color: #9c812f;
  border-top: 1px solid var(--colored-border-color2);
  border-bottom: 3px solid var(--colored-border-color2);
  padding: 0.2rem 0.5rem 0.4rem 0;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0;

  .tool-btn {
    border: none;
    border-bottom: 1px solid #9c812f;
    border-radius: 0;
    padding: 0;
    position: relative;
    top: 0.2rem;
    margin-bottom: 0.3rem;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
}

.normalize-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid #e4e4e4;
  margin-top: 0.5rem;
}

.rolling-mode-active #date_wrapper .arrow {
  opacity: 0.15;
  pointer-events: none;
}

.rolling-mode-badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9c812f;
  background: #f5e9c8;
  border: 1.5px solid #c5b37f;
  border-radius: 1rem;
  padding: 0.05rem 0.5rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

#date_wrapper {
  text-align: center;
  margin-bottom: .5rem;
  border-bottom: 3px solid var(--colored-border-color2);
  padding-bottom: .4rem;

  .arrow {
    display: inline-block;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    width: 1rem;
    height: 1rem;
    margin: 0rem 1rem;
    position: relative;
    top: -.04rem;
    opacity: .2;
    cursor: pointer;

    &:hover {
      opacity: .5;
    }

    &:active {
      opacity: 1;
    }

    &.left {
      background-image: url(../left.png);
    }
    
    &.right {
      background-image: url(../right.png);
    }
  }

  #date {
    display: inline-block;
    font-size: 1.5rem;
    letter-spacing: -1px;
    color: var(--text-color);
  }
}



.hint {
  color: #777;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-bottom: 2px;
}

.leagues_wrapper {
  width: 100%;
  /* border-top: 1px solid #ddd; */
}

.leagues_text {
  display: inline-block;
  width: 40%;
  padding: 1.4rem 1rem 1rem 0rem;
  box-sizing: border-box;
  text-align: left;
}

.leagues_icons {
  display: inline-block;
  width: 60%;
  vertical-align: bottom;
  padding-bottom: 1rem;
  
  .league_icon.active .icon {
    opacity: 1;
    transition: all .2s cubic-bezier(0.87, 0, 0.13, 1);;
  }

  .games {
    text-align: center;
    font-size: 1rem;
    position: relative;
    top: 2px;
    color: var(--colored-text-faint);
  }

  .toggle {
    position: absolute;
    background: white;
    width: 1.3rem;
    height: 1.3rem;
    border: 2px solid #a7a7a7;
    border-radius: 100%;
    text-align: center;
    top: 6px;
    right: 6px;
    box-sizing: border-box;
    box-shadow: 0px 2px 3px rgba(0,0,0,.5);
    background-image: url(../close.png);
    background-size: 79%;
    background-position: center;
    background-repeat: no-repeat;
  }
}

.league_icon .icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: auto;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: .3;
  transition: all .2s cubic-bezier(0.87, 0, 0.13, 1);;
}

.mlb {
  border-left: 1px dotted #dbdbdb;

  .icon {
    background-image: url(../logos/MLB.png);
  }
}

.mls .icon {
  background-image: url(../logos/MLS.png);
  background-size: 75%;
}

.nba .icon {
  background-image: url(../logos/NBA.png);
  background-size: 75%;
}

.nfl .icon {
  background-image: url(../logos/NFL.png);
  background-size: 75%;
}

.nhl .icon {
  background-image: url(../logos/NHL.png);
  background-size: 75%;
}

.nwsl .icon {
  background-image: url(../logos/NWSL.png);
  background-size: 75%;
}

.wnba .icon {
  background-image: url(../logos/WNBA.png);
}

.playoffs {
  display: none !important;
  
  .icon {
    background-image: url(../logos/Playoffs.png);
  }
}

.league_icon {
  width: 12%;
  display: inline-block;
  position: relative;
  height: 5rem;
  border-right: 1px dotted #dbdbdb;
  box-sizing: border-box;
  padding-top: 1rem;
  vertical-align: top;
}

.leagues_headline {
  font-size: 1.5rem;
}

.leagues_subhead {
  font-size: 1rem;
  padding-top: .3rem;
  color: var(--colored-text-faint);
}

.formula_headline {
  font-size: 1.5rem;
  padding-top: 1rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;

  .formula-title {
    flex-shrink: 0;
  }

  .formula-headline-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .reset_custom {
    display: inline-block;
    font-size: .8rem;
    text-decoration: underline;
    color: var(--colored-text-color);
    cursor: pointer;

    &:hover {
      text-decoration: none;
    }
  }
}

/* Close button: always visible (desktop modal + mobile modal) */
.formula-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1.5px solid #c5b37f;
  background: none;
  color: #9c812f;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;

  &:hover {
    background: #9c812f15;
  }
}

/* Backdrop: shown on all screen sizes when formula open */
#formula-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  transition: opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;

  &.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Body scroll lock applies on all screen sizes */
body.formula-open {
  overflow: hidden;
}

#preferences {
  /* Desktop: centered modal dialog */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 720px;
  width: calc(100% - 2rem);
  max-height: 85vh;
  box-sizing: border-box;
  background: var(--primary-bg-color);
  border-radius: 1rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  z-index: 1001;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .preferences-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 0 1.75rem 1.75rem;
    box-sizing: border-box;

    .formula_headline {
      position: sticky;
      top: 0;
      background: var(--primary-bg-color);
      z-index: 2;
      padding-top: 1rem;
      padding-bottom: 0.5rem;
      margin-bottom: 0.4rem;
      border-bottom: 1px solid #9c812f20;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: nowrap;
      font-size: 1.3rem;

      .formula-title {
        flex: 1 1 auto;
      }

      .formula-headline-actions {
        margin-left: auto;
      }
    }
  }

  input {
    width: 2rem;
    border-radius: 1rem;
    border: 2px solid #c5b37f;
    text-align: center;
    padding: .3rem;
    margin-bottom: .3rem;
    margin-right: .5rem;
  }

  /* Chrome, Safari, Edge, Opera */
  input[type="number"]::-webkit-outer-spin-button,
  input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* Firefox */
  input[type="number"] {
    -moz-appearance: textfield;
  }

  .gameWeights, .playoffsWeights {
    display: inline-block;
    vertical-align: top;
    margin-right: 1rem;
    border-right: 1px solid #9c812f30;
    padding-right: 4rem;
    min-height: 170px;
  }

  .advanced-weights {
    min-height: unset;
  }

  .sportsWeightsWrapper {
    width: 40%;
    display: inline-block;
    vertical-align: top;
  }

  .sportsWeights {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    text-align: center;
    position: relative;
    top: -2rem;
  }
  .sportsWeights div {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .sportsWeights input {
    width: 2rem;
    text-align: center;
    margin: 0;
    margin-bottom: 5px;
  }
  .header, .row {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }
  .header div, .row div {
    flex: 1;
  }
  .stage-header, .sports-header {
    text-align: left;
    padding: 5px;
    color: #9c812f;
    font-size: .8rem;
  }

  .stage-header {
    align-items: flex-start !important;
    white-space: nowrap;
  }

  .sports-header {
    text-align: center;
  }

  .preset-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;

    .preset-label-row {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      flex-basis: 100%;
    }

    .hint {
      padding-bottom: 0;
      margin-right: 0.25rem;
    }
  }

  .preset-btn {
    background: none;
    border: 2px solid #9c812f;
    border-radius: 2rem;
    padding: 0.15rem 0.85rem;
    cursor: pointer;
    color: #9c812f;
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    transition: background 0.15s, color 0.15s;

    &:hover {
      background: #9c812f22;
    }

    &.active {
      background: #9c812f;
      color: #fff;
    }
  }

  .preset-custom-label {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #9c812f;
    background: #f5e9c8;
    border: 1.5px solid #c5b37f;
    border-radius: 1rem;
    padding: 0.1rem 0.6rem;
  }

  .diminishing-returns-wrapper {
    margin-top: 0.7rem;

    input[type="checkbox"] {
      width: 1rem;
      height: 1rem;
      margin: 0 0.35rem 0 0;
      padding: 0;
      border: none;
      border-radius: 3px;
      cursor: pointer;
      vertical-align: middle;
      position: relative;
      top: -1px;
      accent-color: #9c812f;
    }
  }

  .diminishing-label {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-color);
  }

  .dr-hint {
    margin-top: 0.2rem;
    padding-left: 1.4rem;
    font-size: 0.72rem;
  }

  .info-icon {
    display: inline-block;
    margin-left: 0.35rem;
    color: #9c812f;
    font-size: 0.85rem;
    cursor: default;
    position: relative;
    vertical-align: middle;

    &::after {
      content: attr(data-tooltip);
      display: none;
      position: absolute;
      left: 50%;
      bottom: calc(100% + 8px);
      transform: translateX(-50%);
      width: 260px;
      background: #fffdf5;
      border: 1.5px solid #c5b37f;
      border-radius: 0.5rem;
      padding: 0.55rem 0.75rem;
      font-size: 0.78rem;
      color: var(--text-color);
      line-height: 1.45;
      box-shadow: 0 3px 10px #00000018;
      z-index: 100;
      pointer-events: none;
      white-space: normal;
      text-align: left;
    }

    &:hover::after {
      display: block;
    }
  }

  /* Scoring model info button */
  .scoring-model-info-btn {
    background: none;
    border: 1.5px solid #c5b37f;
    border-radius: 50%;
    width: 1.3rem;
    height: 1.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9c812f;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;

    &:hover {
      background: #9c812f15;
    }
  }
}

/* Rolling Average section inside the formula panel */
.rolling-section {
  border-top: 1px solid #9c812f20;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;

  .rolling-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;

    .hint {
      padding-bottom: 0;
    }
  }

  .rolling-options {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding-left: 0.25rem;

    &.hidden {
      display: none;
    }

    .rolling-option-label {
      font-size: 0.78rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #9c812f;
    }

    .win-btn {
      background: none;
      border: 1.5px solid #c5b37f;
      border-radius: 1.5rem;
      padding: 0.1rem 0.6rem;
      cursor: pointer;
      color: #9c812f;
      font-family: inherit;
      font-size: 0.78rem;
      transition: background 0.15s, color 0.15s;

      &:hover {
        background: #9c812f22;
      }

      &.active {
        background: #9c812f;
        color: #fff;
        border-color: #9c812f;
      }
    }

    #decay_slider {
      width: 90px;
      accent-color: #9c812f;
      cursor: pointer;
      vertical-align: middle;
    }
  }

  .rolling-btn {
    background: none;
    border: 2px solid #9c812f;
    border-radius: 2rem;
    padding: 0.2rem 0.9rem;
    cursor: pointer;
    color: #9c812f;
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.4px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;

    &:hover {
      background: #9c812f22;
    }

    &.active {
      background: #9c812f;
      color: #fff;
    }
  }
}

/* Scoring Model Info Modal */
.scoring-model-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;

  &.active {
    opacity: 1;
    pointer-events: auto;
  }
}

.scoring-model-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 2001;
  background: var(--primary-bg-color);
  border-radius: 1rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  max-width: 680px;
  width: calc(100% - 2rem);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;

  &.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .scoring-model-modal-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 1.5rem 1.5rem;
    box-sizing: border-box;
  }

  .scoring-model-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
    flex-shrink: 0;

    .scoring-model-modal-title {
      font-size: 1.2rem;
      color: var(--text-color);
      letter-spacing: -0.3px;
    }
  }

  .scoring-model-close-btn {
    background: none;
    border: 1.5px solid #c5b37f;
    border-radius: 50%;
    width: 1.9rem;
    height: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9c812f;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;

    &:hover {
      background: #9c812f15;
    }
  }

  .scoring-model-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;

    @media (max-width: 560px) {
      grid-template-columns: repeat(2, 1fr);
    }

    @media (max-width: 380px) {
      grid-template-columns: 1fr;
    }
  }

  .sm-card {
    border: 1.5px solid #c5b37f55;
    border-radius: 0.75rem;
    padding: 0.85rem 0.9rem;
    background: #fffdf5;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;

    .sm-card-name {
      font-size: 0.95rem;
      font-weight: 700;
      color: #9c812f;
      letter-spacing: 0.2px;
    }

    .sm-card-tagline {
      font-size: 0.75rem;
      color: #888;
      line-height: 1.4;
      min-height: 2.1em;
    }

    .sm-split-bar {
      display: flex;
      height: 1.25rem;
      border-radius: 0.5rem;
      overflow: hidden;
      margin-top: 0.15rem;

      .sm-season-bar {
        background: #9c812f;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        color: #fff;
        font-weight: 700;
        letter-spacing: 0.3px;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
      }

      .sm-playoff-bar {
        background: #c5b37f;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        color: #fff;
        font-weight: 700;
        letter-spacing: 0.3px;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
      }
    }

    .sm-split-labels {
      display: flex;
      justify-content: space-between;
      font-size: 0.65rem;
      color: #aaa;
      text-transform: uppercase;
      letter-spacing: 0.8px;
    }

    .sm-attrs {
      display: flex;
      flex-direction: column;
      gap: 0.28rem;
      margin-top: 0.3rem;
    }

    .sm-attr {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .sm-attr-label {
      font-size: 0.6rem;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: #bbb;
      width: 5.5rem;
      flex-shrink: 0;
    }

    .sm-attr-bar {
      flex: 1;
      height: 0.3rem;
      background: #ede8d8;
      border-radius: 0.25rem;
      overflow: hidden;
    }

    .sm-attr-fill {
      height: 100%;
      background: #9c812f;
      border-radius: 0.25rem;
      transition: width 0.3s ease;
    }

    .sm-attr-fill.dim {
      background: #d8d0bb;
    }
  }
}

.listLocation {
  height: 13rem;
  max-width: 1000px;
  margin: auto;
  color: var(--colored-text-color);
  background-color: var(--colored-bg-color);
  border: 2px solid var(--colored-border-color);
  border-radius: 1.75rem;
  font-size: 2rem;
  box-sizing: border-box;
  box-shadow: 4px 4px 7px var(--colored-shadow-color);
  margin-bottom: 1.7rem;
  position: relative;
  overflow: hidden;
  left: 0px;
  top: 0px;
  transition: all .6s cubic-bezier(0.16, 1, 0.3, 1);

  .trophies {

    position: absolute;
    pointer-events: none;
    top: 0;
    height: 100%;
    right: 60%;
    width: 140px;
    padding-right: 0.5rem;
    box-sizing: border-box;
    border-right: 1px solid #eae0c3;
    
    .trophy {
      width: 3rem;
      height: 3rem;
      margin: 0.1rem 0.12rem;
      top: .8rem;
      z-index: 1;
      float: right;
      background-position: center;
      background-size: cover;
      /* background-color: #e9e4d2; */
      border-radius: 10px;
      /* border: 1px solid #eae0c3; */
      box-sizing: border-box;

      &.MLB { background-image: url(../trophyGold_MLB.png); }
      &.MLS { background-image: url(../trophyGold_MLS.png); }
      &.NBA { background-image: url(../trophyGold_NBA.png); }
      &.NFL { background-image: url(../trophyGold_NFL.png); }
      &.NHL { background-image: url(../trophyGold_NHL.png); }
      &.NWSL { background-image: url(../trophyGold_NWSL.png); }
      &.WNBA { background-image: url(../trophyGold_WNBA.png); }
    }
  }

  .points {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
  }
  
  .totalPoints, .averagePoints {
    font-size: .8rem;
    top: 0px;
    width: 45%;
    right: 0;
    position: absolute;
    text-align: right;
    padding-right: .7rem;
    box-sizing: border-box;
  }

  &:hover {
    border: 2px solid #000000;  
    color: #000000;
    cursor: pointer;
    /* box-shadow: 8px 8px 0px #a5864229; */
    /* left: -4px; */
    /* top: -4px; */

    .sectionPercent {
      /* background-color: #000000; */
      color: #000000;
    }

    .ranking {
      color: #000000;
    }

    .sectionHeader {
      border-bottom: 2px solid #000000 !important;
    }
  }
}

.sectionHeader {
  width: 100%;
  height: 3rem;
  border-right: 1px solid #e4e4e4;
  border-bottom: 1px dashed #c5b37f;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding-bottom: 2rem;
  position: relative;
  pointer-events: none;
}

.sectionContent {
  pointer-events: none;
  width: 60%;
  display: inline-block;
  vertical-align: top;
  box-sizing: border-box;
  padding-top: 3rem;
  float: right;
}

.sectionTitle {
  flex: 1;
  font-size: 1.5rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.sectionStatsToggle {    
  width: 1.5rem;
  height: 2rem;
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  opacity: 1;
  z-index: 1;
  pointer-events: none;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url(../showDetails.png);
  display: none;
}

.sectionPercent {
  font-size: 1.8rem;
  display: inline;
  float: right;
  text-align: right;
  /* padding-right: 1rem; */
  position: absolute;
  box-sizing: border-box;
  top: 0rem;
  height: 100%;
  width: 120px;
  line-height: 100%;
  right: 1rem;
  color: #9d7e3b;
  /* background-color: var(--primary-bg-color); */
  /* margin-right: 1rem; */
  padding: 0.2rem 1rem 0.4rem 0.75rem;
  padding-top: .6rem;
  /* border-radius: 0rem 0rem 0rem 1rem; */
  /* border: 2px solid #5ba29a; */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE10+/Edge */
  user-select: none; /* Standard syntax */

}

html.collapsed .listLocation.minimized {
  height: 3.2rem;
}

html.collapsed .listLocation.minimized .sectionColumn .champion {
  display: none;
}

html.collapsed .listLocation.minimized .backgroundLayer {
  height: 100% !important;
  bottom: 104px !important;
  background-size: 60px;
  transition: all .6s cubic-bezier(0.16, 1, 0.3, 1);
}

html.collapsed .listLocation.minimized .backgroundLayer.tint::before {
  display: none;
}

html.collapsed .sectionStatsToggle {
  top: 0.4rem;
}

.disabled .champion {
  opacity: .3;
}

.sectionColumn {
  display: inline-block;
  width: 12%;
  height: 7rem;
  vertical-align: top;
  box-sizing: border-box;
  border-right: 1px solid #e4e4e4;
  border-top: 1px solid #e4e4e4;
  /* background-color: #f4f4f4; */
  background-position: center;
  background-size: cover;
  position: relative;
  z-index: 1;
  background-image: url(../track10.png);
  background-size: cover;

  .champion {    
    width: 1.5rem;
    height: 1.5rem;
    position: absolute;
    top: -2rem;
    z-index: 1;
    left: 50%;
    margin-left: -0.75rem;
    background-position: center;
    background-size: cover;
    background-image: url(../trophyGold.png);
    pointer-events: none;
  }

  &.minimized {
    
  }

  &.active {
    /* border-right: 0px; */
    background-color: none;
    height: auto;
    top: -100px;
    background-size: 60px;
  }

  &.Playoffs {
    border-right: 1px solid #e4e4e4;
    display: none;
  }

  &.MLB {
    /* border-left: 1px solid #e4e4e4; */
  }

  &.disabled .backgroundLayer {
    /* filter: grayscale(1); */
    border-color: #BBB !important;
    transition: all .2s cubic-bezier(0.87, 0, 0.13, 1);

    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255, 255, 255, 0.7); /* White tint */
      pointer-events: none; /* Allows clicks to pass through */
    }
  }
}

.sectionColumn::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--zero-line, 0%);
  height: 2px;
  background: #000;
  pointer-events: none;
  z-index: 3;
}

.sectionColumn.no-team {
  background-color: rgba(0, 0, 0, 0.05);
}

.sectionColumn .backgroundLayer {
  pointer-events: all;
  background-size: cover;
  position: absolute;
  bottom: 0px;
  display: inline-block;
  width: 80%;
  z-index: -1;
  transition: all .6s cubic-bezier(0.16, 1, 0.3, 1);
  /* background-color: #ffffff; */
  background-position: center;
  background-repeat: no-repeat;
  left: 50%;
  margin-left: -40%;
  image-rendering: smooth;
  /* border-top: 3px solid; */
  /* background-size: 60px; */
  /* border-radius: 8px 8px 0px 0px; */
  /* border-right: 4px solid #c6c6c6; */

  /* opacity: .2; */
  /* border-right: 4px solid #c6c6c6; */
  /* filter: saturate(0%) brightness(100%) contrast(0.2); */

  &.selected {
    opacity: 1;
    /* filter: none; */
  }
}

.tint {
  position: relative;
  float: left;
  cursor: pointer;
}

.tint:before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff9e9d9;
  filter: saturate(50%);
}

.tint.selected:before {
  display: none;
}

.tint:hover:before {
  background: none;
}

.sectionColumn.teams2 .backgroundLayer {
  width: 40%;
}
.sectionColumn.teams3 .backgroundLayer {
  width: 25%;
}

.sectionColumn.teams2 > .backgroundLayer:nth-of-type(1) {
  left: 6%;
  margin-left: 0px;
}
.sectionColumn.teams2 > .backgroundLayer:nth-of-type(2) {
  left: 52%;
  margin-left: 0px;
}

.sectionColumn.teams3 > .backgroundLayer:nth-of-type(1) {
  left: 6%;
  margin-left: 0px;
}
.sectionColumn.teams3 > .backgroundLayer:nth-of-type(2) {
  left: 37%;
  margin-left: 0px;
}
.sectionColumn.teams3 > .backgroundLayer:nth-of-type(3) {
  left: 67%;
  margin-left: 0px;
}

.listItem {
  display: inline-block;
  font-size: .6rem;
  box-sizing: border-box;
  vertical-align: top;
  display: none;
}

#list {
  padding-top: 2rem;
  max-width: 1000px;
  margin: auto;
  padding: 2rem 2rem;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.25s ease;

  &.loading {
    opacity: 0;
    transition: opacity 0.15s ease;
  }
}

.ranking {
  font-size: 2rem;
  color: var(--colored-border-color);
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
  padding-left: 0.9rem;
  padding-right: 0.3rem;
  line-height: 1;
}

.team-divider {
  border-top: 1px solid #ccc;
  width: 100%;
  max-width: 1000px;
  margin: 2rem auto;
  padding-top: 1rem;
  text-align: center;

  .subhead {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    padding-top: 1.5rem;
  }

  .body {
    width: 60%;
    margin: auto;
    color: #999;
  }
}

/* HOVER TOOLTIP */

/* ---- Desktop tooltip ---- */
.tooltip {
  position: absolute;
  display: none;
  z-index: 1000;
  pointer-events: none;
  transition: all 0s;
  width: 320px;
  margin-left: -160px;
  margin-top: 15px;
}

/* ---- Mobile tooltip ---- */
.tooltipMobile {
  position: fixed;
  display: block;
  z-index: 1000;
  pointer-events: none;
  bottom: 3rem;
  width: 92%;
  left: 4%;
  margin: 0px;
  transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.tooltipMobile.hidden {
  bottom: -20rem;
}

.tooltipMobile .close {
  width: 2rem;
  height: 2rem;
  background-color: var(--colored-hover-color);
  color: #FFFFFF;
  position: absolute;
  top: -1rem;
  right: 0.75rem;
  border-radius: 100%;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.95rem;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
  z-index: 1001;
  pointer-events: all;
  cursor: pointer;
  border: 2px solid #FFFFFF;
}

/* Compact left-aligned layout for mobile */
.tooltipMobile .tooltip-content {
  padding: 0.85rem 1rem;
  text-align: left;
}

.tooltipMobile .tooltip-header {
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
}

.tooltipMobile .icon {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
}

.tooltipMobile .team-name {
  font-size: 1rem;
}

.tooltipMobile .primary-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "record  points"
    "breakdown points"
    "winpct  points";
  column-gap: 0.75rem;
  row-gap: 0.05rem;
  align-items: center;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
}

.tooltipMobile .win-loss {
  grid-area: record;
  font-size: 0.95rem;
  margin-bottom: 0;
}

.tooltipMobile .season-breakdown {
  grid-area: breakdown;
  margin-top: 0;
}

.tooltipMobile .win-percentage {
  grid-area: winpct;
  margin-bottom: 0;
}

.tooltipMobile .team-points {
  grid-area: points;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  align-self: center;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.tooltipMobile .secondary-stats {
  gap: 0.15rem;
}

.tooltipMobile .playoff-progress {
  font-size: 0.85rem;
}

.tooltipMobile .playoff-win-loss {
  font-size: 0.8rem;
}

.tooltipMobile .season-link-row {
  margin-top: 0.85rem;
  text-align: center;
}

.tooltipMobile .season-link-btn {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  border: 1.5px solid #b8a06a;
  border-radius: 2rem;
  color: #b8a06a;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  background: transparent;
  transition: background 0.15s, color 0.15s;
  pointer-events: all;
}

.tooltipMobile .season-link-btn:hover {
  background: #b8a06a;
  color: #fff;
}

/* ---- Shared Tooltip Content ---- */
.tooltip-content {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem;
  text-align: center;
  font-family: inherit;
  background-color: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.15), 0px 2px 10px rgba(0, 0, 0, 0.05);
  border: 3px solid var(--colored-hover-color);
  color: #333;
}

.tooltip-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.tooltip-content .icon {
  width: 4rem;
  height: 4rem;
  border-radius: 100%;
  background-size: 85%;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #FFFFFF;
  border: 2px solid var(--colored-hover-color);
  box-shadow: 0px 4px 12px rgba(0,0,0,0.08);
}

.tooltip-content .team-name {
  text-transform: uppercase;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  line-height: 1.2;
  color: #111;
  margin: 0;
}

/* ---- Primary Stats ---- */
.primary-stats {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #EEE;
  margin-bottom: 1.2rem;
}

.tooltip-content .win-loss {
  font-weight: 700;
  font-size: 1.1rem;
  color: #222;
  margin-bottom: 0.2rem;
}

.tooltip-content .win-percentage {
  font-size: 0.85rem;
  color: #777;
  text-transform: capitalize;
  margin-bottom: 0.8rem;
}

.tooltip-content .team-points {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--colored-hover-color);
  background: #f9f9f9;
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 8px;
}

/* ---- Secondary Stats (Playoffs & Breakdown) ---- */
.secondary-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tooltip-content .playoff-progress {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--colored-hover-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tooltip-content .playoff-win-loss {
  font-size: 0.85rem;
  color: #555;
  text-transform: capitalize;
}

.tooltip-content .season-breakdown {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.2rem;
}


html.collapsed {
  .listLocation {
    /* width: 70%; */
    /* height: 3rem; */
    
    .ranking {
      width: 1.5rem;
      text-align: right;
    }

    .sectionHeader {
      padding: 0 0 2rem 0;
      width: 100%;
      border-right: 0px;
      border-bottom: 2px solid #eae0c3;
      pointer-events: all;
    }

    .sectionTitle {
      text-align: left;
      pointer-events: none;
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
    }

    .sectionColumn {
      .backgroundLayer {
        /* border-right: 0px; */
      }
    }

    .sectionColumn.Playoffs {
      /* border-right: 0px; */
    }

    .sectionContent {
      /* padding-top: 0rem; */
    }

    
  }
}

/* Desktop layout for Customize Formula (inside modal) */
@media (min-width: 941px) {
  #preferences .preferences-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    column-gap: 1.5rem;
    row-gap: 0;

    .formula_headline,
    .preset-buttons,
    .rolling-section {
      flex: 0 0 100%;
    }

    .gameWeights {
      flex: 0 0 auto;
      min-height: unset;
      height: auto;
      border-right: 1px solid #9c812f30;
      padding-right: 1.5rem;
    }

    .playoffsWeights {
      flex: 0 0 auto;
      min-height: unset;
      height: auto;
      border-right: 1px solid #9c812f30;
      padding-right: 1.5rem;
    }

    .advanced-weights {
      flex: 0 0 auto;
      min-height: unset;
      height: auto;
      border-right: 1px solid #9c812f30;
      padding-right: 1.5rem;
    }

    .sportsWeightsWrapper {
      flex: 1 1 auto;
      width: auto;
      display: block;
      padding-top: 0;
    }

    .sportsWeights {
      top: 0;
    }
  }
}

/* Desktop: Customize Formula as right-side sidebar */
@media (min-width: 941px) {
  :root {
    --formula-sidebar-width: 500px;
  }

  #preferences {
    top: 0;
    left: auto;
    right: 0;
    bottom: 0;
    transform: translateX(100%);
    width: var(--formula-sidebar-width);
    max-width: var(--formula-sidebar-width);
    max-height: 100vh;
    height: 100vh;
    border-radius: 1rem 0 0 1rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  }

  body.formula-sidebar-open #preferences {
    transform: translateX(0);
  }

  body {
    transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
  }

  body.formula-sidebar-open {
    padding-right: var(--formula-sidebar-width);
  }

  #formula-backdrop {
    display: none !important;
  }

  /* Inside the sidebar: let weight groups share the top row equally,
     then give the playoff league grid its own full-width row */
  #preferences .gameWeights,
  #preferences .playoffsWeights,
  #preferences .advanced-weights {
    flex: 1 1 0;
    border-right: none;
    padding-right: 0;
  }

  #preferences .sportsWeightsWrapper {
    flex: 0 0 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 0.5rem;
  }

  #preferences .sportsWeights {
    min-width: 420px;
  }
}

/* Styles for tablets */
@media (max-width: 940px) {
    /* Styles for tablets and smaller devices */
  #preferences {

    .gameWeights, .playoffsWeights {
      height: 90px;
      box-sizing: border-box;
      width: 45%;
      padding-right: 0;
    }

    .advanced-weights {
      display: inline-block;
      height: auto;
      width: 45%;
      padding-right: 0;
      border-right: none;
    }
    
    .sportsWeightsWrapper {
      width: 100%;
      padding-top: 3rem;
    }
  }
}

/* Mobile: formula panel becomes a slide-up modal */
@media (max-width: 767px) {
  /* Outer shell: handles ONLY position + animation. No overflow here (iOS issue). */
  #preferences {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 1001;
    background: var(--primary-bg-color);
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.22);
    padding: 0;
    box-sizing: border-box;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: none;
    will-change: transform;

    &.displayed {
      transform: translate3d(0, 0, 0);
    }
  }

  /* Inner scroll container: isolated from the transform layer for iOS Safari */
  #preferences .preferences-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0 1.25rem calc(2.5rem + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }

  /* Pill drag handle at the top of the modal */
  #preferences::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 4px;
    border-radius: 2px;
    background: #c5b37f80;
    margin: 0.6rem auto 0.5rem;
  }

  /* Headline: sticky inside the mobile modal */
  #preferences .formula_headline {
    padding-top: 0.5rem;
    font-size: 1.2rem;
  }

  /* Preset buttons: label on its own row, buttons all on one scrollable row */
  #preferences .preset-buttons {
    flex-wrap: wrap;
    padding-bottom: 6px;
    margin-bottom: 0.5rem;
    gap: 0.4rem;

    .preset-label-row {
      flex-basis: 100%;
    }
    .preset-btn { flex-shrink: 0; }
  }

  /* Weight sections: 2-column grid */
  #preferences .gameWeights,
  #preferences .playoffsWeights,
  #preferences .advanced-weights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    width: 100%;
    height: auto;
    min-height: unset;
    border-right: none;
    border-bottom: 1px solid #9c812f25;
    padding-right: 0;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    margin-right: 0;

    div {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin-bottom: 0;
    }

    label {
      white-space: nowrap;
      font-size: 0.83rem;
    }
  }

  /* Diminishing-returns spans both columns */
  #preferences .diminishing-returns-wrapper {
    grid-column: 1 / -1;
    margin-top: 0.1rem;
  }

  /* Playoff grid: horizontal scroll */
  #preferences .sportsWeightsWrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 0;
  }

  #preferences .sportsWeights {
    min-width: 360px;
    top: 0;
    gap: 2px;
  }

  #preferences .sportsWeights input {
    width: 2.2rem;
    font-size: 0.8rem;
    padding: 0.2rem;
  }

  #preferences .stage-header {
    font-size: 0.7rem;
    padding: 3px 2px;
  }

  #preferences .sports-header {
    font-size: 0.7rem;
    padding: 3px 2px;
  }
}

  html {
    #info_wrapper{
     width: 100%; 
    }

    #logo {
      width: 10rem;
      height: 4rem;
      margin: auto;
    }

    #content {
      width: 100%;
      padding-top: 15rem;
    }

    .sectionHeader {
      height: 5rem;
    }

    #content_header {
      padding: 0 1rem;
    }
  }

  .league_icon .icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  #headerBanner, #midBanner {
    width: 100%;
    display: none;
  }
  
  html.collapsed {
    /* #content_header_wrapper
    #content_header {
      padding: 0;
    } */
    
    #list {
      padding: 2rem 1.2rem;
    }
    
    #info_wrapper{
     width: 100%; 
    }

    #menu_wrapper {
      #menu {
        text-align: center;
      }
    }

    #logo {
      width: 10rem;
      height: 4rem;
      margin: auto;
    }

    #content {
      width: 100%;
      padding-top: 1rem;
      margin: auto;
    }

    

    .listLocation {
      height: 15rem;
      width: 100%;
      box-shadow: 7px 7px 7px var(--colored-shadow-color);
      /* border-radius: 3rem; */

      &.minimized .averagePoints {
        top: 0px;
      }
      
      .averagePoints {
        top: 50px;
      }

      


      .sectionPercent {
        border-width: 1px;
        margin-right: 0rem;
        top: 45px;
        height: 2rem;
        position: absolute;
        width: 100%;
        left: 0;
        padding: 0.3rem 0.45rem;
        font-size: 1.4rem;
        pointer-events: none;
      }

      .sectionStatsToggle {
        right: .8rem;
      }

      .sectionContent {
        padding-top: 2.7rem;
      }

      &.minimized .sectionContent {
        padding-top: 4.7rem;
      }
    }

    .sectionTitle {
      font-size: 1.6rem;
      letter-spacing: 0px;
    }

    .ranking {
      font-size: 1.3rem;
    }

    .listLocation
    .trophies { 
      top: -1px;
      height: 100%;
      right: 0%;
      width: 100px;
      z-index: 4;
    } 
  }

  .tooltip {
    left: 0px !important;
    top: auto !important;
    bottom: 0rem;
    width: 100%;
    margin-left: 0px;
    margin-top: 0px;
    box-sizing: border-box;
    position: fixed;
  }

  .tooltip .tooltip-content {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    font-size: 1.3rem;
    line-height: 1.3;
    border-radius: 20px 20px 0 0;
    box-shadow: 0px -7px 50px #635630a8;
  }

  .tooltip .tooltip-header {
    margin-bottom: 0.6rem;
  }

  .tooltip .icon {
    width: 3.5rem;
    height: 3.5rem;
  }

  .tooltip .team-name {
    margin-bottom: 0;
  }

  html {
    font-size: 15px;
  }

  .ranking {
    z-index: 4;
  }

  html.collapsed {

    

    .listLocation {
      .sectionColumn {
        
      }

      .sectionTitle {
        font-size: 1.8rem;
        pointer-events: none;
      }

      .backgroundLayer {
        bottom: 0rem;
      }
    }
    
    .listLocation.minimized {
      height: 8rem;
      
      .backgroundLayer {
        height: 100% !important;
        bottom: 104px !important;
      }
    }

  }


  #content_header {
    /* width: 90% !important; */
  }

  #list {
    background-color: var(--primary-bg-color);

    .trophies {
      border-right: none;
    }
  }

  .leagues_text {
    width: 100%;
    padding: .5rem .5rem .5rem 0rem;
  }

  .leagues_icons {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
  }

  .league_icon {
    flex: 0 0 calc(100% / 7);
    width: auto;
    box-sizing: border-box;
  }

  .listLocation {
    border-width: 2px;
    width: 90%;
    border-radius: 1.75rem;
    transition: all .6s cubic-bezier(0.16, 1, 0.3, 1);


    .sectionHeader {
      background: var(--colored-bg-color);
      z-index: 3;
      position: relative;
    }

    .sectionContent {
      width: 100%;

      .sectionColumn {
        width: calc(100% / 7);
      }
    }  
  }

  .team-divider {
    width: 90%;
  }

  .team-divider
  .body  {
    width: 100%;
  }

  .sectionTitle {
    font-size: 1rem;
  }

  .ranking {
    font-size: 1rem;
  }
}


@media (max-width: 500px) {
  .league_icon .icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  html.collapsed #logo {
    width: 9rem;
    height: 4.5rem;
    margin: auto;
  }
}

/* ── Desktop: restore inline city-name + team-squares layout ── */
@media (min-width: 768px) {

  /* Restore full-width cards on desktop (global rule shrinks them to 90% for mobile).
     This is required for the league icon columns to align with the team columns below. */
  .listLocation {
    width: 100%;
  }

  /* Expanded cards: restore base height (global rule sets 15rem for mobile) */
  html.collapsed .listLocation {
    height: 13rem;
  }

  /* Let expanded cards grow beyond 13rem if needed (e.g. for content overflow) */
  html.collapsed .listLocation:not(.minimized) {
    height: auto;
    min-height: 13rem;
  }

  /* City name: left 40% only, not full width */
  html.collapsed .listLocation .sectionTitle {
    font-size: 1.5rem;
    letter-spacing: 1px;
    padding-right: 8.5rem;
  }

  /* Minimized cards: compact single-row height, fully pill-shaped sides.
     border-radius must be >= half the card height (3.5rem / 2 = 1.75rem) for a true pill. */
  html.collapsed .listLocation.minimized {
    height: 3.5rem;
    border-radius: 1.75rem;
  }

  /* sectionHeader on desktop should be transparent (no background, no z-index)
     so the team squares in the right 60% are not covered */
  html.collapsed .listLocation .sectionHeader {
    background: transparent;
    z-index: auto;
  }

  /* Team squares: reserve the right 120px for the score widget in BOTH expanded
     and minimized states so league columns stay at identical x-positions. */
  html.collapsed .listLocation .sectionContent {
    width: calc(60% - 120px);
    float: right;
    margin-right: 120px;
  }

  /* Minimized card: no top padding so bars sit flush to bottom */
  html.collapsed .listLocation.minimized .sectionContent {
    padding-top: 0;
  }

  /* Desktop: bar fills exactly the pill (-56px to +56px card-relative, bottom:104px).
     background-position-y:54px shifts logo top to 54px from bar-top → logo center at
     -56+54+30=28px from card-top = perfect centre of 3.5rem pill. */
  /* html.collapsed .listLocation.minimized .backgroundLayer {
    background-position-y: 54px !important;
  } */

  /* Score widget: restore desktop position (inset 1rem from right, top-aligned) */
  html.collapsed .listLocation .sectionPercent {
    top: 0;
    right: 1rem;
    left: auto;
    width: 120px;
    height: 100%;
    font-size: 1.8rem;
    padding-top: 0.6rem;
  }

  /* Leagues header: 40% label + columns matching the minimized card column area.
     calc(60% - 120px) mirrors the sectionContent spanning from 40% to (100% - 120px).
     inline-flex keeps label and icons on one row; the remaining 120px aligns with scores. */
  .leagues_text {
    width: 40%;
  }

  .leagues_icons {
    width: calc(60% - 120px);
    display: inline-flex;
    flex-wrap: nowrap;
    vertical-align: bottom;
  }

  /* Desktop tooltip: restore floating cursor-following card.
     @media (max-width: 940px) forces position:fixed + left/top !important, turning it
     into a mobile bottom-sheet. Override all those properties back to the base values.
     JS uses setProperty(..., 'important') to beat the mobile left/top !important. */
  .tooltip {
    position: absolute !important;
    bottom: auto !important;
    width: 320px !important;
    margin-left: -160px !important;
    margin-top: 15px !important;
    box-sizing: content-box !important;
  }

  .tooltip .tooltip-content {
    width: auto !important;
    border-radius: 1.5rem !important;
    box-shadow: 0px 4px 20px rgba(0,0,0,0.18) !important;
    padding: 1.2rem !important;
    font-size: 1rem !important;
  }

  .tooltip .tooltip-header {
    margin-bottom: 0.5rem !important;
  }

  .tooltip .icon {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }

  .tooltip .team-name {
    font-size: 1.1rem !important;
  }

  /* Championship trophies: right-aligned within city name area, right edge at the
     left boundary of the MLB column (40% mark). z-index keeps them above sectionHeader. */
  html.collapsed .listLocation .trophies {
    right: 60%;
    width: 110px;
    z-index: 5;
    border-right: 1px solid #eae0c3;
  }

  /* Minimized row: trophy icon size within the 3.5rem card height */
  html.collapsed .listLocation.minimized .trophies .trophy {
    width: 3rem;
    height: 3rem;
    margin: 0.1rem 0.12rem;
  }
}

/* ---- Score Breakdown Panel ---- */
.listLocation:not(.minimized) {
  height: auto;
  min-height: 13rem;
}

/* Override all collapsed-mode fixed heights (both mobile and desktop) when a card is expanded */
html.collapsed .listLocation:not(.minimized) {
  height: auto;
  min-height: 13rem;
}

.score-breakdown {
  display: none;
  clear: both;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.5rem 0.6rem;
  border-top: 1px dashed #c5b37f;
  box-sizing: border-box;
  width: 100%;
  pointer-events: none;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: opacity 0.4s ease;
}

.listLocation:not(.minimized) .score-breakdown {
  display: flex;
}

.sb-teams {
  flex: 1 1 200px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0;
  min-width: 180px;
}

.sb-team {
  flex: 1 1 140px;
  min-width: 120px;
  border: 1px solid #e0d4b0;
  border-radius: 0.4rem;
  padding: 0.35rem 0.45rem;
  background: rgba(255,253,240,0.7);
}

.sb-team-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid #e0d4b0;
  padding-bottom: 0.2rem;
}

.sb-team-name {
  font-weight: 700;
  font-size: 0.68rem;
  color: #3a2e0e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.sb-league-badge {
  font-size: 0.55rem;
  color: #9d7e3b;
  background: #f5e9c8;
  border-radius: 3px;
  padding: 0 3px;
  white-space: nowrap;
}

.sb-rows {
  margin-bottom: 0.2rem;
}

.sb-row,
.sb-total-row,
.sb-city-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  line-height: 1.5;
}

.sb-row[data-tooltip] {
  cursor: default;
  border-radius: 3px;
  transition: background 0.1s;
  pointer-events: auto;
}

.sb-row[data-tooltip]:hover {
  background: #f0e8cc;
  margin: 0 -0.3rem;
  padding: 0 0.3rem;
}

/* JS-driven floating tooltip (bypasses overflow:hidden on .listLocation) */
#sb-tooltip {
  position: fixed;
  background: #2d2310;
  color: #f5f0e0;
  font-size: 0.72rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  display: none;
}

.sb-label {
  color: #9d8c5e;
  font-size: 0.62rem;
}

.sb-value {
  font-weight: 700;
  font-size: 0.68rem;
  color: #3a2e0e;
  text-align: right;
}

.sb-pos { color: #2a7a3b; }
.sb-neg { color: #a03020; }
.sb-zero { color: #aaa; }

.sb-total-row {
  border-top: 1px solid #d4c698;
  margin-top: 0.2rem;
  padding-top: 0.15rem;
}

.sb-total {
  color: #6b4e10;
}

.sb-city {
  order: -1;
  flex: 0 0 auto;
  min-width: 140px;
  max-width: 220px;
  border-right: 1px dashed #c5b37f;
  padding-left: 1rem;
  padding-right: 0.5rem;
}

.sb-city-header {
  font-weight: 700;
  font-size: 0.68rem;
  color: #9d7e3b;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sb-included-teams {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.sb-included-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.sb-included-team {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.6rem;
  color: #3a2e0e;
  font-weight: 600;
}

.sb-dr-rows {
  padding-left: 0.5rem;
  margin-bottom: 0.1rem;
}

.sb-dr-row {
  font-size: 0.6rem;
  color: #9d8c5e;
  line-height: 1.4;
}

/* ── Score breakdown: desktop two-column alignment ── */
@media (min-width: 768px) {
  html.collapsed .score-breakdown {
    flex-wrap: nowrap;
  }

  html.collapsed .sb-city {
    flex: 0 0 36%;
    max-width: 240px;
  }

  html.collapsed .sb-teams {
    margin-right: 120px;
  }
}

/* ── Score breakdown: mobile stacks vertically ── */
@media (max-width: 767px) {
  .score-breakdown {
    flex-direction: column;
  }

  .sb-city {
    order: 2;
    border-right: none;
    border-top: 1px dashed #c5b37f;
    padding-right: 0;
    padding-top: 0.35rem;
    margin-top: 0.3rem;
    max-width: none;
    width: 100%;
  }

  .sb-teams {
    flex: none;
    width: 100%;
  }
}