/* Most-worn shoes leaderboard (templates/most-worn.php). */

/* multi-check dropdown (same component as Latest PEs, own prefix) */
.cd-mw-ms { position: relative; }
.cd-mw-ms__btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 18px; background: var(--cd-chip); border: var(--cd-line) solid var(--cd-border); border-radius: 999px; color: var(--cd-text); font-size: 15px; cursor: pointer; white-space: nowrap; width: 100%; }
.cd-mw-ms__btn:hover { border-color: var(--cd-border-hover); }
.cd-mw-ms__btn.is-on { border-color: var(--cd-accent); }
.cd-mw-ms__btn[aria-expanded="true"] .cd-icon { transform: rotate(180deg); }
.cd-mw-ms__k { color: var(--cd-muted); }
.cd-mw-ms__v { font-weight: 700; }
.cd-mw-ms__panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: 360px; max-width: calc(100vw - 2 * var(--cd-gutter)); background: var(--cd-raised); border: var(--cd-line) solid var(--cd-border-strong); border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); overflow: hidden; }
.cd-mw-ms__panel[hidden] { display: none; }
.cd-mw-ms__top { display: flex; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--cd-hair); }
.cd-mw-ms__top button { background: none; border: 0; color: var(--cd-accent); font-weight: 700; font-size: 15px; min-height: 44px; padding: 0 10px; cursor: pointer; }
.cd-mw-ms__top button:hover { color: var(--cd-text); }
.cd-mw-ms__panel ul { list-style: none; margin: 0; padding: 4px 0; max-height: 320px; overflow: auto; }
.cd-mw-ms__panel li { display: flex; align-items: center; gap: 2px; padding: 0 8px 0 16px; }
.cd-mw-ms__panel li:hover { background: var(--cd-chip); }
.cd-mw-ms__panel label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; }
.cd-mw-ms__panel label span { overflow-wrap: anywhere; }
.cd-mw-ms__panel input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--cd-accent); margin: 0; }
.cd-mw-ms__panel li button { background: none; border: 0; color: var(--cd-text-2); font-size: 14px; min-height: 44px; padding: 0 8px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--cd-border-strong); text-underline-offset: 3px; }
.cd-mw-ms__panel li button:hover { color: var(--cd-accent); }
.cd-mw-ms__foot { padding: 12px 16px; border-top: 1px solid var(--cd-hair); }
.cd-mw-ms__foot .cd-btn { width: 100%; }

/* ------------------------------------------------------------ head */
.cd-mw-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: end; padding-top: 64px; }
.cd-mw-head__main { grid-column: span 8; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.cd-mw-head__stats { grid-column: span 4; display: flex; justify-content: flex-end; gap: 40px; text-align: right; }
.cd-mw-head__stats .cd-num { font-size: 72px; line-height: 0.9; color: var(--cd-accent); }
.cd-mw-head__stats p:not(.cd-num) { font-size: 14px; color: var(--cd-muted); margin-top: 4px; }

/* ------------------------------------------------------------ brand share */
.cd-mw-brands { padding-top: 48px; display: flex; flex-direction: column; gap: 16px; }
.cd-mw-brands__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.cd-mw-brand { display: flex; flex-direction: column; gap: 10px; text-align: left; background: var(--cd-raised); border: var(--cd-line) solid var(--cd-border); border-radius: 16px; padding: 18px; color: var(--cd-text); cursor: pointer; min-width: 0; }
.cd-mw-brand[hidden] { display: none; }
.cd-mw-brand:hover { border-color: var(--cd-border-hover); }
.cd-mw-brand[aria-pressed="true"] { border-color: var(--cd-accent); box-shadow: inset 0 0 0 1px var(--cd-accent); }
.cd-mw-brand__pct { font-family: var(--cd-display); font-size: 44px; line-height: 1; }
.cd-mw-brand__label { font-size: 15px; font-weight: 700; line-height: 1.3; }
.cd-mw-brand__bar { display: block; width: 100%; height: 6px; border-radius: 999px; background: var(--cd-chip); overflow: hidden; }
.cd-mw-brand__bar span { display: block; height: 100%; background: var(--cd-accent); min-width: 3px; }

/* ------------------------------------------------------------ controls */
.cd-mw-controls { padding-top: 40px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cd-mw-seg { display: flex; gap: 4px; padding: 4px; background: var(--cd-raised); border: var(--cd-line) solid var(--cd-border); border-radius: 999px; }
.cd-mw-seg button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--cd-text-2); font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.cd-mw-seg button[aria-pressed="true"] { background: var(--cd-text); color: var(--cd-ground); }
.cd-mw-dropdowns { display: flex; gap: 12px; flex-wrap: wrap; }
.cd-mw-search { order: 3; margin-left: auto; width: 340px; padding: 4px 8px 4px 20px; background: var(--cd-raised); }
.cd-mw-search input { min-height: 44px; font-size: 16px; }

/* ------------------------------------------------------------ board */
.cd-mw-board { padding-top: 36px; }
.cd-mw-summary { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 12px; }
.cd-mw-summary p:first-child { font-size: 17px; color: var(--cd-text-2); }
.cd-mw-summary b { color: var(--cd-text); }
.cd-mw-summary__note { font-size: 14px; color: var(--cd-muted); text-align: right; }
.cd-mw-list { list-style: none; padding: 0; margin: 0; }
.cd-mw-row { border-top: 1px solid var(--cd-hair); padding: 20px 0; }
.cd-mw-row__main { display: grid; grid-template-columns: 88px 168px minmax(0, 1fr) 132px 312px; column-gap: 24px; align-items: center; }
.cd-mw-rank { font-family: var(--cd-display); font-size: 40px; line-height: 1; color: var(--cd-text); }
.cd-mw-img { display: flex; align-items: center; justify-content: center; height: 104px; background: #FFFFFF; border-radius: 12px; overflow: hidden; }
.cd-mw-img img { width: 90%; height: 100%; object-fit: contain; }
.cd-mw-img.is-missing { background: var(--cd-raised); border: 1px dashed var(--cd-border-strong); color: var(--cd-muted); }
.cd-mw-img__none { display: flex; }
.cd-mw-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cd .cd-mw-name { font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--cd-text); overflow-wrap: break-word; }
.cd .cd-mw-name:hover { color: var(--cd-accent); }
.cd-mw-brandname { font-size: 14px; color: var(--cd-muted); }
.cd-mw-barline { display: flex; align-items: center; gap: 10px; }
.cd-mw-bar { flex-grow: 1; height: 10px; border-radius: 999px; background: var(--cd-chip); overflow: hidden; }
.cd-mw-bar span { display: block; height: 100%; min-width: 6px; border-radius: 999px; background: var(--cd-accent); }
.cd-mw-count-inline { display: none; flex-shrink: 0; font-size: 14px; color: var(--cd-text-2); }
.cd-mw-count-inline b { color: var(--cd-text); }
.cd-mw-count { display: flex; flex-direction: column; align-items: flex-end; }
.cd-mw-count b { font-family: var(--cd-display); font-weight: 400; font-size: 44px; line-height: 1; }
.cd-mw-count span { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cd-muted); }
.cd-mw-actions { display: flex; gap: 10px; justify-content: flex-end; }
.cd-mw-toggle, .cd-mw-whoall, .cd-mw-more { min-height: 46px; padding: 0 18px; background: transparent; border: var(--cd-line) solid var(--cd-border-strong); border-radius: 999px; color: var(--cd-text); font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.cd-mw-toggle:hover, .cd-mw-whoall:hover, .cd-mw-more:hover { border-color: var(--cd-text-2); }
.cd .cd-mw-buy { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border-radius: 999px; background: var(--cd-accent); color: var(--cd-on-accent); font-size: 15px; font-weight: 700; white-space: nowrap; }
.cd .cd-mw-buy:hover { background: var(--cd-accent-hover); color: var(--cd-on-accent); }
.cd-mw-who { margin: 18px 0 0 112px; background: var(--cd-raised); border: var(--cd-line) solid var(--cd-border); border-radius: 16px; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.cd-mw-who[hidden] { display: none; }
.cd-mw-who ul { list-style: none; padding: 0; margin: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.cd .cd-mw-who a { display: flex; flex-direction: column; padding: 8px 0; color: var(--cd-text); min-height: 44px; }
.cd .cd-mw-who a:hover span { color: var(--cd-accent); }
.cd-mw-who a span { font-size: 16px; font-weight: 700; line-height: 1.3; }
.cd-mw-who small { font-size: 13px; color: var(--cd-muted); }
.cd-mw-whoall { min-height: 44px; }
.cd-mw-more { display: block; width: 100%; margin-top: 20px; min-height: 56px; font-size: 16px; }
.cd-mw-more[hidden] { display: none; }
.cd-mw-more span { color: var(--cd-muted); font-weight: 500; }
.cd-mw-empty { list-style: none; background: var(--cd-raised); border: var(--cd-line) solid var(--cd-border); border-radius: var(--cd-radius); padding: 56px 48px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.cd-mw-empty .cd-empty__title { font-size: 36px; line-height: 1; }

/* ------------------------------------------------------------ tablet */
@media (max-width: 1099px) {
  .cd-mw-head { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; padding-top: 48px; }
  .cd-mw-head__stats { justify-content: flex-start; text-align: left; }
  .cd-mw-head__stats .cd-num { font-size: 56px; }
  .cd-mw-brands__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cd-mw-search { order: 0; margin-left: 0; flex: 1 1 280px; }
  .cd-mw-dropdowns { flex-basis: 100%; }
  .cd-mw-row__main { grid-template-columns: 56px 136px minmax(0, 1fr) 96px; row-gap: 14px; column-gap: 20px; }
  .cd-mw-rank { font-size: 34px; }
  .cd-mw-img { height: 86px; }
  .cd-mw-actions { grid-column: 3 / -1; justify-content: flex-start; }
  .cd-mw-who { margin-left: 76px; }
  .cd-mw-who ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cd-mw-summary { flex-direction: column; gap: 4px; }
  .cd-mw-summary__note { text-align: left; }
}

/* ------------------------------------------------------------ phone */
@media (max-width: 767px) {
  .cd-mw-head { padding-top: 32px; gap: 20px; }
  .cd-mw-head__main { gap: 16px; }
  .cd-mw-head__stats { gap: 28px; }
  .cd-mw-head__stats .cd-num { font-size: 40px; }
  .cd-mw-brands { padding-top: 28px; gap: 4px; }
  .cd-mw-brands__tap { display: none; }
  .cd-mw-brands h2 { padding-bottom: 6px; }
  .cd-mw-brands__grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cd-mw-brand { display: grid; grid-template-columns: 120px minmax(0, 1fr) 48px; grid-template-areas: "label bar pct"; align-items: center; gap: 12px; min-height: 44px; padding: 0; background: transparent; border: 0; border-top: 1px solid var(--cd-hair); border-radius: 0; }
  .cd-mw-brand[aria-pressed="true"] { box-shadow: none; color: var(--cd-accent); }
  .cd-mw-brand__label { grid-area: label; }
  .cd-mw-brand__bar { grid-area: bar; height: 8px; }
  .cd-mw-brand__pct { grid-area: pct; font-family: var(--cd-body); font-size: 15px; font-weight: 700; text-align: right; }
  .cd-mw-controls { padding-top: 28px; gap: 10px; flex-direction: column; align-items: stretch; }
  .cd-mw-seg button { flex: 1 1 0; padding: 0 12px; }
  .cd-mw-search { flex: none; width: 100%; }
  .cd-mw-dropdowns { gap: 10px; }
  .cd-mw-dropdowns > * { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .cd-mw-dropdowns > :last-child { flex-basis: 100%; }
  .cd-mw-ms__btn { padding: 0 14px; }
  .cd-mw-ms__btn > span { overflow: hidden; text-overflow: ellipsis; }
  .cd-mw-ms__panel { width: calc(100vw - 2 * var(--cd-gutter)); }
  .cd-mw-dropdowns > :nth-child(2) .cd-mw-ms__panel { left: auto; right: 0; }
  .cd-mw-board { padding-top: 24px; }
  .cd-mw-summary p:first-child { font-size: 15px; }
  .cd-mw-row { padding: 16px 0; }
  .cd-mw-row__main { grid-template-columns: 40px 96px minmax(0, 1fr); column-gap: 12px; row-gap: 12px; }
  .cd-mw-rank { font-size: 26px; }
  .cd-mw-img { height: 60px; border-radius: 10px; }
  .cd-mw-info { gap: 6px; }
  .cd .cd-mw-name { font-size: 16px; line-height: 1.3; }
  .cd-mw-brandname, .cd-mw-count { display: none; }
  .cd-mw-count-inline { display: inline; }
  .cd-mw-bar { height: 8px; }
  .cd-mw-bar span { min-width: 5px; }
  .cd-mw-actions { grid-column: 1 / -1; padding-left: 52px; }
  .cd-mw-actions > * { flex: 1 1 0; font-size: 14px; min-height: 44px; padding: 0 12px; }
  .cd-mw-who { margin: 12px 0 0 52px; padding: 16px; gap: 8px; border-radius: 14px; align-items: stretch; }
  .cd-mw-who ul { grid-template-columns: minmax(0, 1fr); }
  .cd .cd-mw-who a { flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--cd-hair); }
  .cd-mw-who a span { font-size: 15px; }
  .cd-mw-who small { text-align: right; }
  .cd-mw-whoall { font-size: 14px; }
  .cd-mw-more { min-height: 52px; margin-top: 16px; }
  .cd-mw-empty { padding: 24px; }
  .cd-mw-empty .cd-empty__title { font-size: 26px; }
}

/* Panels (design B2, Zack 2026-10-18; shared rules in base.css). The brand shares and the leaderboard are panels; the
   "latest tracked game" note that sat top right of the board was dropped with the corner text. */
.cd .cd-panel.cd-mw-board .cd-mw-summary { padding-bottom: 12px; }
@media (max-width: 767px) {
  /* inside the panel the row actions and the wearer list use the full row, or the two buttons run past the panel edge */
  .cd .cd-panel .cd-mw-actions { padding-left: 0; }
  .cd .cd-panel .cd-mw-who { margin-left: 0; }
}
