/* HR Derby 2026 — season-long Home Run Derby. Builds on css/styles.css
   (vars, .btn, .card, .container). Baseball theme: navy + red-stitch accent. */
:root {
  --hrd: #1d3f6e;        /* infield navy */
  --hrd-soft: #2f6bb0;   /* brighter blue for accents */
  --hrd-tint: #eef3fa;   /* pale field tint */
  --hrd-red: #c8102e;    /* baseball-stitch red */
  --hrd-line: #d6e0ee;
}

/* ---------- header ---------- */
.hrd-header { background: linear-gradient(135deg, var(--hrd) 0%, #24507f 55%, var(--hrd-soft) 100%); color: #fff; }
.hrd-header .back-link { color: #dbe8fb; }
.hrd-header .site-title, .hrd-header .subtitle { color: #fff; }
.hrd-title { letter-spacing: .01em; }
.hrd-title .hrd-yr { color: #ffd34d; }
.hrd-main { display: grid; gap: 14px; padding-bottom: 40px; }

/* ---------- freshness pill ---------- */
.hrd-updated { width: fit-content; max-width: 100%; margin: 0 auto 2px; padding: 6px 14px;
  font-size: .82rem; font-weight: 700; color: var(--hrd); background: var(--hrd-tint);
  border: 1px solid var(--hrd-line); border-radius: 999px; text-align: center; }
.hrd-updated.is-waiting { color: var(--ink-soft); font-weight: 600; background: #f3f4f6; border-color: var(--line); }

/* ---------- add your team ---------- */
.hrd-add-card { padding: 14px 16px; display: grid; gap: 10px; }
.hrd-add-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hrd-add-head h2 { font-size: 1.05rem; color: var(--hrd); }
.hrd-add-hint { font-size: .78rem; color: var(--ink-soft); flex: 1 1 200px; text-align: right; }
.hrd-add-input { font: inherit; width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px;
  min-height: 44px; background: #fff; }
.hrd-add-input:focus { outline: 2px solid var(--hrd-soft); outline-offset: 1px; }
.hrd-add-results { display: grid; gap: 6px; }
.hrd-add-results:empty { display: none; }
.hrd-add-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  font: inherit; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; min-height: 44px;
  transition: background .12s ease, border-color .12s ease; }
.hrd-add-item:hover { background: var(--hrd-tint); }
.hrd-add-item.is-pinned { border-color: #bcd6b8; background: #f0f8ef; }
.hrd-add-name { font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hrd-add-act { flex: 0 0 auto; font-size: .78rem; font-weight: 800; color: var(--hrd-soft); white-space: nowrap; }
.hrd-add-item.is-pinned .hrd-add-act { color: var(--good); }

/* ---------- rules ---------- */
.hrd-rules { padding: 0; }
.hrd-rules > summary { cursor: pointer; font-weight: 800; padding: 14px 16px; list-style: none; color: var(--hrd); }
.hrd-rules > summary::-webkit-details-marker { display: none; }
.hrd-rules ul { margin: 0; padding: 0 18px 16px 34px; display: grid; gap: 6px; color: var(--ink-soft); font-size: .9rem; }
.hrd-rules li b { color: var(--ink); }

/* ---------- standings card + tabs ---------- */
.hrd-standings-card .card-head { padding: 14px 16px 4px; margin-bottom: 0; }
.hrd-standings-card h2 { font-size: 1.05rem; }
.hrd-tabs { display: flex; gap: 6px; padding: 6px 12px 4px; flex-wrap: wrap; }
.hrd-tab { font: inherit; font-weight: 800; color: var(--ink-soft); background: #f3f6fa; border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; min-height: 42px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s ease, color .12s ease, border-color .12s ease; }
.hrd-tab:hover { background: var(--hrd-tint); }
.hrd-tab.is-active { color: #fff; background: var(--hrd); border-color: var(--hrd); }
.hrd-tab:focus-visible { outline: 2px solid var(--hrd-soft); outline-offset: 2px; }
.hrd-tab-count { font-size: .7rem; font-weight: 900; min-width: 1.4em; text-align: center; padding: 0 5px;
  border-radius: 999px; background: rgba(0,0,0,.12); }
.hrd-tab-count:empty { display: none; }
.hrd-tab.is-active .hrd-tab-count { background: rgba(255,255,255,.25); }

.hrd-pane { padding: 4px 6px 6px; }
.hrd-pane[hidden] { display: none; }

/* ---------- per-tab search ---------- */
.hrd-search { font: inherit; width: calc(100% - 12px); padding: 10px 14px; margin: 4px 6px 8px;
  border: 1px solid var(--line); border-radius: 999px; min-height: 42px; background: #fff; }
.hrd-search:focus { outline: 2px solid var(--hrd-soft); outline-offset: 1px; }

/* ---------- month picker (Monthly tab) ---------- */
.hrd-month-select { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 6px 2px; }
.hrd-month-select:empty { display: none; }
.hrd-mo-btn { font: inherit; font-weight: 800; font-size: .82rem; color: var(--hrd); background: #fff;
  border: 1px solid var(--hrd-line); border-radius: 999px; padding: 6px 15px; min-height: 36px; cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease; }
.hrd-mo-btn:hover { background: var(--hrd-tint); border-color: var(--hrd-soft); }
.hrd-mo-btn.is-active { color: #fff; background: var(--hrd); border-color: var(--hrd); }
.hrd-mo-btn:focus-visible { outline: 2px solid var(--hrd-soft); outline-offset: 2px; }

/* ---------- info bars (pinned teams, above the list) ---------- */
.hrd-infobars { display: grid; gap: 6px; padding: 2px 6px 8px; }
.hrd-infobar { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 9px 13px;
  border-radius: var(--radius-sm); background: var(--hrd-tint); border: 1px solid var(--hrd-line);
  box-shadow: inset 4px 0 0 var(--hrd-soft); font-size: .82rem; font-variant-numeric: tabular-nums; }
.hrd-ib-team { font-weight: 900; color: var(--hrd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hrd-ib-rank { font-weight: 900; color: var(--hrd-red); }
.hrd-ib-hr { font-weight: 800; color: var(--ink); }
.hrd-ib-behind { color: var(--ink-soft); font-weight: 700; }
.hrd-ib-sep { color: var(--hrd-line); }

/* ---------- standings list ---------- */
.hrd-standings { padding: 6px; display: grid; gap: 6px; }
.hrd-rows { display: grid; gap: 6px; }
.hrd-rows-divider { margin: 8px 2px 2px; font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--hrd-soft); }
.hrd-empty { color: var(--ink-soft); text-align: center; padding: 18px; }
.hrd-more { margin: 8px 4px 2px; font-size: .78rem; color: var(--ink-soft); text-align: center; }

/* each standings entry = a wrapper holding the clickable row + an optional
   inline player breakdown that expands below it */
.hrd-rowwrap { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.hrd-rowwrap.is-leader { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.hrd-rowwrap.is-pinned { box-shadow: inset 4px 0 0 var(--hrd-soft); background: var(--hrd-tint); }
.hrd-rowwrap.is-open { border-color: var(--hrd-soft); }
.hrd-row { display: grid; grid-template-columns: 30px 46px 1fr auto 20px; align-items: center; gap: 10px;
  background: transparent; padding: 11px 12px; min-height: 48px; cursor: pointer;
  transition: background .12s ease; }
.hrd-row:hover { background: var(--hrd-tint); }
.hrd-row:focus-visible { outline: 2px solid var(--hrd-soft); outline-offset: -2px; }
.hrd-rowwrap.is-open > .hrd-row { background: var(--hrd-tint); }
.hrd-row-caret { color: var(--ink-soft); font-size: .8rem; text-align: center; line-height: 1;
  transition: transform .15s ease; }
.hrd-row[aria-expanded="true"] .hrd-row-caret { transform: rotate(180deg); color: var(--hrd-soft); }
.hrd-star { font-size: 1.15rem; line-height: 1; color: var(--ink-soft); cursor: pointer; user-select: none;
  padding: 4px; margin: -4px; border-radius: 6px; text-align: center; }
.hrd-star.is-on { color: var(--gold); }
.hrd-star:hover { color: var(--gold); }
.hrd-star:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.hrd-rank { font-weight: 800; color: var(--hrd); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hrd-rowwrap.is-leader .hrd-rank { color: #9a6b00; }
.hrd-team { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.hrd-team-txt { font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hrd-tie-badge { flex: 0 0 auto; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  color: #fff; background: var(--hrd-soft); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.hrd-total { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--hrd-red); white-space: nowrap; }
.hrd-total-u { font-size: .7rem; font-weight: 700; color: var(--ink-soft); }

/* ---------- My Teams ---------- */
.hrd-myteams { padding: 8px 6px; display: grid; gap: 10px; }
.hrd-mt-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden;
  box-shadow: inset 4px 0 0 var(--hrd-soft); }
.hrd-mt-toprow { display: grid; grid-template-columns: 1fr auto; align-items: stretch; }
.hrd-mt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  font: inherit; text-align: left; background: none; border: 0; padding: 12px 8px 12px 14px; cursor: pointer; min-height: 52px; }
.hrd-mt-head:hover { background: var(--hrd-tint); }
.hrd-mt-name-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hrd-mt-name { font-weight: 900; color: var(--hrd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrd-mt-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.hrd-mt-lbl { color: var(--ink-soft); font-weight: 800; text-transform: uppercase; font-size: .68rem; letter-spacing: .04em; }
.hrd-mt-rk { font-weight: 900; color: var(--hrd-red); }
.hrd-mt-hr { color: var(--ink); font-weight: 700; }
.hrd-mt-note { font-size: .8rem; color: var(--ink-soft); padding: 0 14px; }
.hrd-caret { color: var(--ink-soft); font-size: .82rem; padding-right: 8px; }
.hrd-mt-head[aria-expanded="true"] .hrd-caret { transform: rotate(180deg); }
.hrd-mt-remove { flex: 0 0 auto; font: inherit; font-size: 1.3rem; line-height: 1; color: var(--ink-soft);
  background: none; border: 0; border-left: 1px solid var(--line); padding: 0 16px; cursor: pointer; }
.hrd-mt-remove:hover { color: var(--hrd-red); background: #fdf0f1; }

/* per-player detail */
.hrd-detail { padding: 4px 12px 12px; background: #fbfcfe; border-top: 1px solid var(--line); }
.hrd-detail-head, .hrd-pl { display: grid; grid-template-columns: 1fr 72px 84px; align-items: center; gap: 8px; }
.hrd-detail-head { padding: 8px 6px 6px; font-size: .66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.hrd-dh-num { text-align: right; }
.hrd-pl { padding: 8px 6px; border-top: 1px solid #eef1f6; font-size: .88rem; }
.hrd-pl:first-of-type { border-top: 0; }
.hrd-pl-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hrd-pl-nm { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrd-pl-team { font-size: .7rem; color: var(--ink-soft); font-weight: 700; letter-spacing: .03em; }
.hrd-pl-s { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.hrd-pl-tag { justify-self: end; font-size: .62rem; font-weight: 900; letter-spacing: .04em; }
.hrd-pl-tag.is-kept { }
.hrd-pl.is-dropped { opacity: .62; }
.hrd-pl.is-dropped .hrd-pl-nm { text-decoration: line-through; color: var(--ink-soft); }
.hrd-pl.is-dropped .hrd-pl-tag { color: var(--hrd-red); }
.hrd-pl.is-dropped .hrd-pl-s { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 520px) {
  .hrd-row { grid-template-columns: 26px 38px 1fr auto 16px; gap: 7px; padding: 10px 9px; }
  .hrd-add-hint { display: none; }
  .hrd-tab { padding: 7px 13px; }
  .hrd-detail-head, .hrd-pl { grid-template-columns: 1fr 56px 68px; gap: 6px; }
  .hrd-mt-remove { padding: 0 13px; }
}
