/* Chart and record pair on one line, at the 1.7fr / 1fr the old grid gave them — but ONLY while
   both are open (.cc-pair), or a narrow basis would let the chart ride up onto the chip row. */
.hq-screen.cc-pair > .hq-chart-card { flex: 1 1 460px; }
.hq-screen.cc-pair > .hq-record-card  { flex: 1 1 270px; }
/* Paired, the two match heights — the container is flex-start so chips never stretch, so the pair
   opts in per item. The chart then grows into the extra height instead of leaving a ragged edge. */
.hq-screen.cc-pair > .hq-chart-card,
.hq-screen.cc-pair > .hq-record-card { align-self: stretch; }
/* Every card's top-right also carries right-aligned content — the rating block, the chart's
   peak/last stats, the match toolbar — and the control sat ON TOP of it. Clear a lane, but only
   under .cc-host: with the preference off there is no control to clear. */
.cc-host [data-cc] > .hq-rating,
.cc-host [data-cc] .hq-head-stats { margin-right: 34px; }
/* The head row already carries its own inline padding, so widen that rather than add a margin. */
.cc-host [data-cc] .hq-match-head { padding-right: 34px; }
.laurel-text   { color: var(--laurel-2); }
.porphyry-text { color: var(--porphyry-2); }

.hq-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 24px 28px;
  box-shadow: var(--shadow-1);
}
.hq-head-id { display: flex; align-items: center; gap: 18px; min-width: 0; }
.hq-avatar {
  width: 72px; height: 72px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--bronze-deep);
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-1);
}
.hq-head-name { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hq-name-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hq-handle {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hq-clan-link { all: unset; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--bronze-2); }
.hq-clan-link:hover { text-decoration: underline; color: var(--bronze); }
.hq-clan-link:focus-visible { outline: 2px solid var(--bronze-2); outline-offset: 2px; border-radius: var(--radius-s); }
.hq-clan-role { font-size: 0.82rem; font-weight: 500; color: var(--ink-3); }
.hq-clan-none { color: var(--ink-3); font-weight: 500; }
/* Player-authored line under the name; the pencil is owner-only (this is your own HQ). */
.hq-motto {
  margin: 4px 0 0; font-family: var(--font-display); font-style: italic;
  font-size: 1.02rem; color: var(--ink-3); line-height: 1.4;
}
.hq-motto-edit {
  all: unset; cursor: pointer; margin-left: 6px;
  font-size: 0.8em; line-height: 1; color: var(--ink-4);
  padding: 2px 4px; border-radius: var(--radius-s);
}
.hq-motto-edit:hover { color: var(--bronze-2); }
.hq-motto-edit:focus-visible { outline: 2px solid var(--bronze-2); outline-offset: 1px; }
.hq-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.hq-pills .pill,
.hq-pill-title,
.hq-pill-admin,
.hq-pill-streak {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.hq-pill-title  { background: color-mix(in srgb, var(--bronze) 14%, transparent);   color: var(--bronze-2);   border: 1px solid color-mix(in srgb, var(--bronze) 35%, transparent); }
.hq-pill-admin  { background: color-mix(in srgb, var(--amethyst) 16%, transparent); color: var(--amethyst-2); border: 1px solid color-mix(in srgb, var(--amethyst) 40%, transparent); }
.hq-pill-super  { background: color-mix(in srgb, var(--amethyst) 28%, transparent); border-color: var(--amethyst); font-weight: 700; }
.hq-pill-streak { background: color-mix(in srgb, var(--laurel) 14%, transparent);   color: var(--laurel-2);   border: 1px solid color-mix(in srgb, var(--laurel) 35%, transparent); }

/* Tallest child of a center-aligned .hq-head, so it sets the card height and its first line lands
   1px off the inner top edge — this padding is what keeps "joined" clear of it. */
.hq-rating {
  text-align: right; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  padding-top: 1.5rem;
}
.hq-rating-joined { color: var(--ink-3); }
.hq-rating-value {
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  color: var(--ink);
}
.hq-rating-stars { font-size: 0.95rem; letter-spacing: 1px; color: var(--gold); white-space: nowrap; }
.hq-ladder-chips { justify-content: flex-end; margin-top: 6px; }

.hq-card {
  background: transparent;
  border-radius: var(--radius-l);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.hq-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.hq-head-stats { display: flex; gap: 16px; font-size: 0.82rem; color: var(--ink-3); }
.hq-head-stats b { font-family: var(--font-display); font-size: 1.05rem; }

.prof-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.ps-k { font-size: 0.7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.ps-v { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; color: var(--ink); margin-top: 6px; white-space: nowrap; }

.hq-chart-card { display: flex; flex-direction: column; }
/* Grows into the card's leftover height so the paired Record card's height matches instead of
   leaving a ragged edge; min-height is the floor when the card is content-sized. `position:
   relative` is load-bearing — .hq-chart-mark is absolute against this box. */
.hq-chart-plot {
  position: relative;
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 190px; margin-top: 12px;
}
/* Fills width via preserveAspectRatio="none". `height: 0` is load-bearing: with height auto the
   svg sizes off its own viewBox aspect ratio, so a full-width card gave it 431px — flex-grow
   inside .hq-chart-plot is what gives it the height instead. */
.rc {
  width: 100%; display: block;
  flex: 1 1 auto; height: 0; min-height: 0;
}
/* The rating range, marked on the high and low points; each label carries its own left/top from
   the chart's own x()/y(), so the box must cover exactly the svg. */
.hq-chart-marks {
  position: absolute; inset: 0;
  pointer-events: none;
}
.hq-chart-mark {
  position: absolute;
  padding: 1px 4px; border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--bg-1) 88%, transparent);
  font-size: 0.64rem; font-weight: 600; font-variant-numeric: tabular-nums;
  line-height: 1.2; white-space: nowrap;
}
/* Above its point, below its point: the two never trade places, so they cannot collide even when
   the high and low sit on neighbouring games. */
.hq-chart-mark.is-max { transform: translate(-50%, calc(-100% - 4px)); color: var(--bronze-2); }
.hq-chart-mark.is-min { transform: translate(-50%, 4px); color: var(--ink-3); }
.hq-chart-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; margin-top: 12px;
  color: var(--ink-3); font-size: 0.9rem; text-align: center;
}
.hq-form {
  display: flex; align-items: center; gap: 12px;
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--divider);
}
.hq-form-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); flex-shrink: 0; }
.hq-form-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.hq-fdot {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  font-size: 0.62rem; font-weight: 700; color: #fff;
}
.hq-fdot.w { background: var(--laurel); }
.hq-fdot.l { background: var(--porphyry); }
.hq-fdot.d { background: var(--ink-4); color: var(--ink-2); }

.hq-record-card { display: flex; flex-direction: column; align-items: center; }
.hq-record-card .hq-eyebrow { align-self: stretch; }
.hq-record-body {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; margin: auto 0; width: 100%;
}
.hq-donut { width: 240px; max-width: 100%; display: block; flex: 0 0 auto; }
.hq-donut-pct { font-family: var(--font-display); font-size: 17px; fill: var(--ink); }
.hq-donut-lbl { font-size: 7px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--ink-3); }
.hq-record-legend {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 20px; font-size: 0.9rem; color: var(--ink-2);
}
.hq-record-legend span { display: inline-flex; align-items: center; gap: 8px; }
.hq-record-legend b { color: var(--ink); font-family: var(--font-display); }
.hq-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hq-sw.w { background: var(--laurel-2); }
.hq-sw.l { background: var(--porphyry-2); }
.hq-sw.d { background: var(--bronze-2); }

.hq-recent-card { padding: 0; overflow: hidden; }
/* Two rows: the title alone, then its tallies beneath with the tools opposite them. `flex: 1 1
   100%` on the title is what forces the break — a full-width basis cannot share a line. */
.hq-match-head {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px 18px;
}
.hq-match-head .hq-eyebrow { flex: 1 1 100%; }
.hq-match-head .hq-match-tools { margin-left: auto; }
.hq-match-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* The search is THE shared .nl-search-mini — a bare input, not a wrapper + icon span. A wrapper
   cannot read its input's state without `:has()`, which is above the support floor, so a typed
   query could not hold the field open. */
/* Ancestor selector (0,2,0) beats .bf-table's min-width:640px (0,1,0). */
.hq-screen .hq-battles { min-width: 640px; }
/* Double-classed to out-rank battlefield.css. */
.hq-battles.is-compact .hq-col-opt { display: none; }
.hq-match-foot { padding: 12px 18px; }

.res-badge {
  display: inline-block; min-width: 52px; text-align: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600;
}
.res-badge.w { background: color-mix(in srgb, var(--laurel) 20%, transparent);   color: var(--laurel-2); }
.res-badge.l { background: color-mix(in srgb, var(--porphyry) 20%, transparent); color: var(--porphyry-2); }
.res-badge.d { background: var(--bg-3); color: var(--ink-2); }
:root[data-theme="light"] .res-badge.d { background: var(--bg-hover); }
.hq-td-opp { font-weight: 600; }
.hq-oppo-link { all: unset; cursor: pointer; font-weight: 600; color: var(--ink); }
.hq-oppo-link:hover { color: var(--bronze-2); text-decoration: underline; }
.hq-oppo-link:focus-visible { outline: 2px solid var(--bronze-2); outline-offset: 2px; border-radius: var(--radius-s); }
.hq-stakes { font-size: 0.78rem; color: var(--ink-3); }
.hq-stakes.rated { color: var(--bronze-2); font-weight: 600; }
.hq-delta.up   { color: var(--laurel-2); }
.hq-delta.down { color: var(--porphyry-2); }
.hq-row-meta { color: var(--ink-3); font-size: 0.86rem; }
@media (max-width: 1024px) {
  .prof-stats { grid-template-columns: repeat(3, 1fr); }
  /* No responsive force-hide here: .is-compact is the ONLY thing that drops .hq-col-opt, or the
     Compact toggle is inert below 1024. DataCard.defaultCompact() starts narrow viewports compact. */
}
@media (max-width: 768px) {
  /* No room to pair: every expanded section takes its own line. */
  .hq-chart-card, .hq-record-card { flex: 1 1 100%; }
  .hq-head { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px; }
  /* Rating, stars and ladder chips share one line once the header stacks. */
  .hq-rating {
    text-align: left; flex-direction: row; flex-wrap: wrap;
    align-items: baseline; gap: 4px 12px; width: 100%;
  }
  .hq-rating-joined { flex: 1 1 100%; }
  /* A small basis keeps the chips BESIDE the stars and wraps them internally; at auto basis the
     whole block drops to its own line (flex wraps before it shrinks). Below ~96px free it wraps. */
  .hq-ladder-chips { justify-content: flex-start; margin-top: 0; flex: 1 1 96px; min-width: 0; }
}
@media (max-width: 640px) {
  .hq-avatar { width: 56px; height: 56px; font-size: 1.5rem; }
  /* Phone: elo + stars read as one unit on their line, chips take their own full-width line.
     At 375px the 96px-basis row above squeezes both ladder chips into a 3-line stack. */
  .hq-rating { padding-top: 0; gap: 6px 10px; }
  .hq-rating-value { flex: 0 0 auto; }
  .hq-rating-stars { flex: 1 1 auto; }
  .hq-ladder-chips { flex: 1 1 100%; }
  .prof-stats { grid-template-columns: repeat(2, 1fr); }
}

.hq-row-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.hq-save-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-size: 1.05rem; line-height: 1; color: var(--ink-3);
  transition: color 0.12s ease, transform 0.08s ease;
}
.hq-save-btn:hover { color: var(--bronze-2); transform: scale(1.12); }
.hq-save-btn.is-on { color: var(--gold); }
.hq-feature-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-size: 0.95rem; line-height: 1; filter: grayscale(1) opacity(0.5);
  transition: filter 0.12s ease, transform 0.08s ease;
}
.hq-feature-btn:hover { filter: grayscale(0.3) opacity(0.9); transform: scale(1.12); }
.hq-feature-btn.is-on { filter: none; }

.pf-best {
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 55%),
    var(--bg-1);
  border-color: color-mix(in srgb, var(--gold) 28%, var(--border));
}
.pf-best-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-best-sub { color: var(--ink-3); }
.pf-best-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.pf-best-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-m);
  border-left: 3px solid var(--bronze);
  transition: border-color 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}
.pf-best-card:hover {
  border-color: var(--bronze); transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}
.pf-best-card.outcome-w { border-left-color: var(--laurel-2); }
.pf-best-card.outcome-l { border-left-color: var(--porphyry-2); }
.pf-best-card.outcome-d { border-left-color: var(--bronze-2); }
.pf-best-medal { font-size: 1.6rem; flex: none; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.pf-best-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.pf-best-top { display: flex; align-items: center; gap: 8px; }
.pf-best-vs { font-family: var(--font-display); font-size: 1.02rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-best-elo { color: var(--ink-3); font-size: 0.82rem; }
.pf-best-meta { font-size: 0.8rem; color: var(--ink-3); }
.pf-best-review { flex: none; font-size: 0.82rem; font-weight: 600; color: var(--bronze-2); white-space: nowrap; }
@media (max-width: 480px) {
  .pf-best-grid { grid-template-columns: 1fr; }
  .pf-best-review { display: none; }
}
/* The public profile's standalone capped note; HQ's tallies live on the head line instead. */
.hq-match-notes {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  margin: 10px 0 12px; padding: 0 18px; font-size: 0.82rem;
}
.hq-match-tallies {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  min-width: 0; font-size: 0.82rem;
}
.hq-saved-note { color: var(--ink-3); }
/* Emoji carry their own colour, so the off state is a filter, not a colour — same idiom as
   .hq-feature-btn above. Lit only once something is actually stored. */
.hq-note-ico { filter: grayscale(1) opacity(0.5); }
.hq-note-ico.is-on { filter: none; }
.hq-capped-note { color: var(--ink-3); }
.hq-upgrade-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--bronze-2); font: inherit; text-decoration: underline;
}
.hq-upgrade-link:hover { color: var(--bronze); }
