/* Shared layout for the Events / H2Hs / Stats / About pages. Uses the same
   color tokens as styles.css so everything matches the leaderboard. */

.page-header-inner {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px) 1fr;
  align-items: center;
  gap: 16px;
}
.header-left { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.back-link { color: var(--text-dim); font-size: 14px; white-space: nowrap; }
.back-link:hover { color: var(--text); }
.global-search { position: relative; width: 100%; max-width: none; }
#global-search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#global-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.page-main {
  flex: 1 1 auto;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.page-title { margin: 0 0 14px; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.page-intro { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: -4px 0 18px; }

.panel {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-hint { font-size: 12px; color: var(--text-faint); }
.panel-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

.dr-input {
  flex: 1 1 220px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.dr-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.dr-select {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}
.dr-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.dr-more {
  margin: 12px auto 0;
  display: block;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.dr-more:hover { color: var(--accent); border-color: var(--accent); }
.dr-more[hidden] { display: none; }
.dr-empty, .dr-empty-line { color: var(--text-dim); font-size: 13px; padding: 16px 4px; text-align: center; }
.dr-empty-line { padding: 10px 12px; text-align: left; }

/* Autocomplete dropdowns */
.dr-picker { position: relative; }
.dr-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 30;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.dr-results[hidden] { display: none; }
.dr-option {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}
.dr-option:hover, .dr-option.active { background: var(--bg-card-hover); }
.dr-option-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dr-option-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.dr-option-img + .dr-option-img { margin-left: -16px; }
.dr-option-name { font-weight: 700; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-option-meta { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* People, Elo bubbles, sets */
.dr-person { white-space: nowrap; }
.dr-person-name { font-weight: 700; color: var(--text); }
a.dr-person-name:hover { color: var(--accent); }
.dr-self .dr-person-name { color: var(--accent); }
.dr-rank { margin-left: 4px; font-size: 11px; font-weight: 600; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.dr-elo {
  display: inline-block;
  margin: 0 4px 0 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-variant-numeric: tabular-nums;
}
.dr-vs { color: var(--text-faint); }
.dr-set {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 13px;
}
.dr-set + .dr-set { border-top: 1px dashed var(--border); }
.dr-set-teams { min-width: 0; line-height: 2; }
.dr-result {
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.dr-result.win { color: #4caf7d; background: color-mix(in srgb, #4caf7d 15%, transparent); }
.dr-result.loss { color: #e2635b; background: color-mix(in srgb, #e2635b 15%, transparent); }
.dr-result.neutral { color: var(--text-dim); background: var(--bg-card); border: 1px solid var(--border); }

/* ---------- Events ---------- */
.upcoming-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.upcoming-card {
  display: block;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
a.upcoming-card:hover { border-color: var(--accent); }
.upcoming-date { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.upcoming-card { position: relative; }
.upcoming-site { position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 700; color: var(--text-faint); }
.upcoming-name { font-weight: 800; font-size: 14px; margin: 3px 0 2px; }
.upcoming-meta { font-size: 12px; color: var(--text-dim); }

.events-list { display: flex; flex-direction: column; gap: 6px; }
.event-item { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; }
.event-item.open { border-color: var(--accent-dim); }
.event-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
}
.event-row:hover { background: var(--bg-card-hover); }
.event-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chev { display: inline-block; width: 14px; color: var(--text-faint); transition: transform 0.12s ease; }
.event-item.open .event-chev { transform: rotate(90deg); }
.event-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-teams { font-size: 12px; color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.event-view {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.event-view:hover { color: var(--accent); border-color: var(--accent); }
.event-view.disabled { opacity: 0.4; pointer-events: none; }
.event-panel { border-top: 1px solid var(--border); padding: 10px 12px 12px; }
.event-panel[hidden] { display: none; }
.event-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.event-tab, .h2h-mode {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.event-tab[aria-selected="true"], .h2h-mode[aria-selected="true"] {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}
.standing {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}
.standing + .standing { border-top: 1px dashed var(--border); }
.standing-place { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.standing-place.gold { color: #e6b800; }
.standing-place.silver { color: #9aa2b5; }
.standing-place.bronze { color: #c98a4b; }

/* ---------- H2Hs ---------- */
.h2h-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.h2h-modes { display: flex; gap: 4px; }
.h2h-pickers { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.h2h-pick label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.h2h-vs { font-weight: 800; color: var(--text-faint); padding-bottom: 8px; }
.h2h-summary { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.h2h-side { text-align: center; min-width: 0; }
.h2h-side-imgs { display: flex; justify-content: center; margin-bottom: 6px; }
.h2h-side-imgs img { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-elevated); object-fit: cover; }
.h2h-side-imgs img + img { margin-left: -14px; }
.h2h-side-name { font-size: 16px; font-weight: 800; }
.h2h-side-meta { font-size: 12px; color: var(--text-dim); }
.h2h-score { text-align: center; }
.h2h-score-big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.h2h-score-big .lead { color: #4caf7d; }
.h2h-score-sub { font-size: 12px; color: var(--text-dim); }
.h2h-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.h2h-stat { padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; }
.h2h-stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.h2h-stat-value { font-size: 16px; font-weight: 800; margin-top: 2px; }
.h2h-stat-sub { font-size: 12px; color: var(--text-dim); }
.h2h-set-group { margin-top: 10px; }
.h2h-set-title { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 10px 0 2px; }

/* ---------- Stats ---------- */
.stats-section { margin-bottom: 22px; }
.stats-section > h2 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.stats-sub { color: var(--text-faint); font-size: 12px; margin: -6px 0 10px; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.fact-card { padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.fact-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.fact-value { font-size: 20px; font-weight: 800; margin: 3px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fact-value img { width: 28px; height: 28px; border-radius: 50%; }
.fact-detail { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.duo-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.duo-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); padding: 0 8px 6px; }
.duo-table td { padding: 7px 8px; border-top: 1px solid var(--border); }
.duo-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.duo-table th.num { text-align: right; }
.duo-cell { display: flex; align-items: center; gap: 8px; }
.duo-cell img { width: 26px; height: 26px; border-radius: 50%; }
.duo-cell img + img { margin-left: -14px; }
.pos { color: #4caf7d; font-weight: 800; }
.neg { color: #e2635b; font-weight: 800; }
.duo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.leader-list { list-style: none; margin: 6px 0 0; padding: 0; }
.leader-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 13px; }
.leader-list li + li { border-top: 1px dashed var(--border); }
.leader-list li { align-items: baseline; }
.leader-list .leader-who { display: flex; align-items: baseline; gap: 4px; min-width: 0; flex: 1 1 auto; }
.leader-list .leader-who > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-list .leader-who .dr-person { display: inline; }
.leader-list .leader-who > span.wrap { white-space: normal; display: flex; flex-direction: column; }
.leader-list .leader-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-list .leader-pos { flex: 0 0 18px; }
.leader-list .leader-value { flex: 0 0 auto; }
.leader-list .leader-value { color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.leader-list .leader-pos { color: var(--text-faint); font-weight: 700; width: 18px; display: inline-block; }

/* ---------- About ---------- */
.about h2 { font-size: 17px; margin: 22px 0 6px; }
.about p { color: var(--text-dim); line-height: 1.65; font-size: 15px; margin: 0 0 10px; }
.about strong { color: var(--text); }
.about p a:not(.support-button) { color: var(--accent); font-weight: 600; }
.support-button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}
.support-button:hover { filter: brightness(1.08); }

@media (max-width: 760px) {
  .duo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-header-inner { grid-template-columns: 1fr; gap: 10px; }
  .header-right { justify-content: stretch; }
  .header-right .site-nav { width: 100%; }
  .header-right .nav-tile { flex: 1 1 0; justify-content: center; }
  .header-right .nav-tile span { display: inline; }
  .h2h-pickers { grid-template-columns: 1fr; }
  .h2h-vs { text-align: center; padding: 0; }
  .event-row { grid-template-columns: 1fr auto; }
  .event-teams { display: none; }
}

/* ---------- Team page ---------- */
.panel-title { margin: 0; font-size: 16px; font-weight: 700; }
.panel-title + .panel-hint { margin: 2px 0 10px; }
.team-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 16px; }
.team-head-imgs { display: flex; }
.team-head-imgs img { width: 76px; height: 76px; border-radius: 50%; background: var(--bg); border: 3px solid var(--bg-card); }
.team-head-imgs img + img { margin-left: -16px; }
.team-head-name { margin: 4px 0 0; font-size: 26px; font-weight: 800; line-height: 1.2; }
.team-head-name .dr-person { white-space: normal; }
.team-head-name .dr-rank { font-size: 13px; }
.team-head-sub { color: var(--text-dim); font-size: 14px; }
.team-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.team-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; min-width: 0; }
.team-stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.team-stat-value { font-size: 24px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.team-stat-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-bw { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; }
.team-bw-badge { text-align: center; }
.team-bw-num { width: 26px; height: 26px; margin: 0 auto 2px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: color-mix(in srgb, #e6b800 18%, transparent); color: #e6b800; }
.team-bw-avg { font-size: 11px; font-weight: 700; color: var(--text-faint); }
.team-bw-who { font-weight: 700; }
.team-bw-who .dr-person { white-space: normal; }
.team-bw-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.team-bw-score { font-weight: 800; color: #4caf7d; font-variant-numeric: tabular-nums; }
.team-ev { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; overflow: hidden; }
.team-ev.open { border-color: var(--accent-dim); }
.team-ev-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.team-ev-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.team-ev-place { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.team-ev-place.gold { color: #e6b800; }
.team-ev-place.silver { color: #9aa2b5; }
.team-ev-place.bronze { color: #c98a4b; }
.team-ev-of { font-weight: 600; color: var(--text-faint); font-size: 12px; }
.team-ev-name { font-weight: 700; color: var(--text); text-decoration: none; }
.team-ev-name:hover { color: var(--accent); }
.team-ev-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.team-ev-rec { font-weight: 800; font-variant-numeric: tabular-nums; }
.team-ev-rec.win { color: #4caf7d; }
.team-ev-rec.loss { color: #e2635b; }
.team-ev-body { padding: 4px 12px 10px; border-top: 1px solid var(--border); }
.team-link { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
.team-link:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .team-stats { grid-template-columns: repeat(2, 1fr); }
  .team-head-name { font-size: 21px; }
  .team-ev-row { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; }
  .team-bw { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; }
}
