.cmp-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -0.03em;
}
.cmp-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px 14px;
  align-items: end;
  margin-top: 18px;
}
.cmp-pick { position: relative; min-width: 0; }
.cmp-pick label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cmp-pick[data-side="a"] label { color: #8eb4ff; }
.cmp-pick[data-side="b"] label { color: #f0b56a; }
.cmp-pick input { width: 100%; }
.cmp-swap {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
}
.cmp-swap svg { display: block; }
.cmp-swap:hover { border-color: var(--accent); }
.cmp-suggest {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.cmp-suggest button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cmp-suggest button:hover,
.cmp-suggest button.active { background: var(--inset); }
.cmp-suggest small { color: var(--faint); }
.cmp-depth {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cmp-depth span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-right: 4px;
}
.cmp-depth button,
.cmp-tabs button {
  border: 1px solid var(--panel-edge);
  background: var(--inset);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}
.cmp-depth button.active,
.cmp-tabs button.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}
#cmpGo { grid-column: 1 / -1; justify-self: start; }
.cmp-status-error { color: var(--danger); }

.cmp-heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 18px;
}
.cmp-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  min-width: 0;
}
.cmp-head.is-a { box-shadow: inset 3px 0 0 #5b8def; }
.cmp-head.is-b { box-shadow: inset 3px 0 0 #e0a04a; }
.cmp-banner {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--chip);
  flex: 0 0 auto;
}
.cmp-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.cmp-change {
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  padding: 0;
}
.cmp-kvk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.cmp-kvk-table th,
.cmp-kvk-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--header-border);
  white-space: nowrap;
}
.cmp-kvk-table a { color: inherit; font-weight: 700; }
.cmp-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}
.cmp-dialog[hidden] { display: none !important; }
.cmp-dialog-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.cmp-dialog-card { position: relative; }
.cmp-dialog-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
}
.cmp-dialog-x svg { display: block; }
.cmp-dialog-card h2 { margin: 0 28px 10px 0; font-size: 1.1rem; }
.cmp-dialog-card input { width: 100%; }
.cmp-dialog-list {
  position: static;
  margin-top: 8px;
  max-height: 220px;
  box-shadow: none;
}
.cmp-dialog-card .btn-glow { margin-top: 12px; width: 100%; }
.cmp-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }
.cmp-head a { color: inherit; text-decoration: none; }
.cmp-head a:hover { color: var(--accent); }

.cmp-section { margin: 22px 0 8px; }
.cmp-section h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.cmp-section .section-sub { margin: 0 0 12px; }

.cmp-meter {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--header-border);
}
.cmp-meter b {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--muted);
}
.cmp-meter > div { display: contents; }
.cmp-track { display: none; }
.cmp-vals {
  display: contents;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
.cmp-vals span { text-align: right; min-width: 4.6rem; }
.cmp-vals .win-a { color: #9db7ee; font-weight: 750; }
.cmp-vals .win-b { color: #e2c08a; font-weight: 750; }

.cmp-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.cmp-tabs button { white-space: nowrap; flex: 0 0 auto; }
.cmp-board-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}
.cmp-edge {
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 3px;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 5px solid currentColor;
  vertical-align: 1px;
  flex: 0 0 auto;
}
.cmp-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--header-border);
}
.cmp-row .rank {
  color: var(--faint);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}
.cmp-cell {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.cmp-cell a { color: inherit; text-decoration: none; font-weight: 650; }
.cmp-cell a:hover { color: var(--accent); }
.cmp-cell .who {
  display: flex;
  gap: 4px;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 650;
}
.cmp-cell .who a {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cmp-cell .sub {
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 650;
}
.cmp-cell .score {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.cmp-cell.lead-a .score { color: #9db7ee; font-weight: 750; }
.cmp-cell.lead-b .score { color: #e2c08a; font-weight: 750; }
.cmp-empty { color: var(--faint); }

.cmp-kvk {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cmp-card {
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel);
  padding: 14px;
  min-width: 0;
}
.cmp-card h3 { margin: 0 0 8px; font-size: 1rem; }
.cmp-card ul { margin: 0; padding: 0; list-style: none; }
.cmp-card li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--header-border);
  font-size: 0.86rem;
}
.cmp-card li span:last-child { color: var(--muted); text-align: right; }
.cmp-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

@media (max-width: 720px) {
  .cmp-hero h1 { font-size: 1.45rem; }
  .cmp-form { grid-template-columns: 1fr auto 1fr; }
  .cmp-swap { align-self: end; }
  .cmp-heads,
  .cmp-kvk { grid-template-columns: 1fr; }
  .cmp-meter {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px 8px;
  }
  .cmp-vals span { min-width: 3.6rem; font-size: 0.82rem; }
  .cmp-row {
    grid-template-columns: 1.85rem minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }
  .cmp-row .rank { font-size: 0.68rem; }
  .cmp-cell .who { font-size: 0.68rem; }
  .cmp-cell .sub { display: none; }
  .cmp-cell .score { font-size: 0.68rem; }
}
/* Compare toolbar: sits above the results and pins to the top of the
   screen while they scroll (the bottom edge belongs to Playwire's rail).
   z-index stays under the picker suggestions (5) that can overlap it. */
.cmp-float {
  position: sticky;
  z-index: 4;
  top: max(8px, env(safe-area-inset-top));
  margin: 0 auto 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(520px, calc(100% - 20px));
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--panel-edge);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.cmp-float[hidden] { display: none !important; }
.cmp-float-side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 42%;
  border: 0;
  border-radius: 12px;
  padding: 6px 10px;
  background: var(--inset);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  cursor: pointer;
}
.cmp-float-side img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}
.cmp-float-side.is-a { box-shadow: inset 3px 0 0 #7ea2e8; }
.cmp-float-side.is-b { box-shadow: inset 3px 0 0 #d7b48a; }
.cmp-float .cmp-swap { width: 36px; height: 36px; flex: 0 0 auto; }
.cmp-float-depth {
  display: flex;
  gap: 4px;
  flex: 1 0 100%;
  justify-content: center;
}
.cmp-float-depth button {
  border: 1px solid var(--panel-edge);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 9px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}
.cmp-float-depth button.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}
.cmp-float-spin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}
.cmp-float-spin[hidden] { display: none !important; }
#cmpBody.cmp-busy { opacity: 0.45; }

/* —— Player comparison (/compare/players) —— */
#playerComparePanel { --pc-a: #6f9cf3; --pc-b: #e0a04a; }
[data-theme="light"] #playerComparePanel { --pc-a: #2f62c9; --pc-b: #b06d12; }
.pc-suggest-empty { padding: 10px 12px; color: var(--muted); font-size: 0.85rem; }
#pcGo { grid-column: 1 / -1; justify-self: start; }
.pc-intro { margin-top: 12px; }
.pc-head { align-items: center; }
.pc-head.is-a { box-shadow: inset 3px 0 0 var(--pc-a); }
.pc-head.is-b { box-shadow: inset 3px 0 0 var(--pc-b); }
.pc-avatar { flex: 0 0 auto; width: 54px; height: 54px; }
.pc-avatar img, .pc-avatar .avatar, .pc-avatar > * {
  width: 54px; height: 54px; border-radius: 12px; object-fit: cover;
}
.pc-head-copy { min-width: 0; }
.pc-head-copy h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-lead {
  margin: 0 0 6px;
  text-align: center;
  font-size: 0.98rem;
  color: var(--muted);
}
.pc-lead b.is-a { color: var(--pc-a); }
.pc-lead b.is-b { color: var(--pc-b); }
.pc-section { margin: 22px 0 8px; }
.pc-section h2 { margin: 0 0 6px; font-size: 1.05rem; }
.pc-section .section-sub { margin: 0 0 10px; }
.pc-rows {
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.pc-rows:empty { display: none; }
.pc-row,
.pc-gear-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--header-border);
}
.pc-rows > .pc-row:last-child,
.pc-gear > .pc-gear-row:last-child { border-bottom: 0; }
.pc-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}
.pc-val {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.pc-val.is-a { align-items: flex-end; text-align: right; }
.pc-val.is-b { align-items: flex-start; text-align: left; }
.pc-num { font-size: 0.95rem; font-weight: 650; overflow-wrap: anywhere; }
.pc-num a { color: inherit; }
.pc-val.is-win.is-a .pc-num { color: var(--pc-a); font-weight: 800; }
.pc-val.is-win.is-b .pc-num { color: var(--pc-b); font-weight: 800; }
.pc-val.is-win.is-a .pc-num::after { content: " ▲"; font-size: 0.7em; }
.pc-val.is-win.is-b .pc-num::before { content: "▲ "; font-size: 0.7em; }
.pc-delta { font-size: 0.72rem; font-weight: 700; opacity: 0.85; }
.pc-val.is-a .pc-delta { color: var(--pc-a); }
.pc-val.is-b .pc-delta { color: var(--pc-b); }
.pc-rank { font-size: 0.72rem; color: var(--faint); }
.pc-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.pc-two:has(> div:empty + div:empty) { display: none; }
.pc-side-note { margin: 0; font-size: 0.85rem; }
.pc-hero-pair {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel2, var(--panel));
}
.pc-hero-title { margin: 0 0 8px; font-size: 0.95rem; text-align: center; }
.pc-hero-pair:not(.is-same) .pc-hero-title { color: var(--muted); font-weight: 650; }
.pc-hero-mini { margin-bottom: 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--panel-edge); }
.pc-hero-mini .pc-row { padding: 6px 10px; }
.pc-hero-mini .pc-row:last-child { border-bottom: 0; }
.pc-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.pc-hero-side { min-width: 0; border-radius: 14px; }
.pc-hero-side.is-a { box-shadow: 0 -3px 0 var(--pc-a); }
.pc-hero-side.is-b { box-shadow: 0 -3px 0 var(--pc-b); }
.pc-hero-side .hero-card { height: 100%; margin: 0; }
.pc-hero-side.is-empty { display: grid; place-items: center; min-height: 80px; }
.pc-gear {
  margin-top: 10px;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.pc-gear-cell { display: flex; justify-content: center; min-width: 0; padding: 4px; border-radius: 12px; }
.pc-gear-cell .lord-gear-tile { border-radius: 12px; padding: 4px 2px; }
.pc-gear-cell.is-win.is-a .lord-gear-tile { box-shadow: 0 0 0 2px var(--pc-a); }
.pc-gear-cell.is-win.is-b .lord-gear-tile { box-shadow: 0 0 0 2px var(--pc-b); }
.pc-gear-cell .lord-gear-tile { width: 100%; max-width: 140px; }
.pc-gear-none { color: var(--faint); padding: 18px 0; }
.pc-foot { margin-top: 18px; text-align: center; }
.gov-hero-strip .btn-compare .btn-refresh-icon svg { display: block; }

@media (max-width: 640px) {
  .pc-row, .pc-gear-row { grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr); gap: 6px; padding: 8px 10px; }
  .pc-label { font-size: 0.72rem; }
  .pc-num { font-size: 0.88rem; }
  .pc-heads { gap: 8px; }
  .pc-head { padding: 10px; gap: 8px; }
  .pc-avatar, .pc-avatar img, .pc-avatar .avatar, .pc-avatar > * { width: 40px; height: 40px; }
  .pc-head-copy h2 { font-size: 0.98rem; }
  .pc-head-copy p { font-size: 0.75rem; }
  /* Hero cards are too wide for two columns on a phone: stack them. */
  .pc-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pc-hero-pair { padding: 10px; }
  .pc-gear-cell .lord-gear-tile { max-width: 110px; }
}

/* Floating bar, score, share bars, folded hero pairs (round 2) */
#pcBody { transition: opacity 0.15s; }
#pcBody.cmp-busy { opacity: 0.45; pointer-events: none; }
.pc-float .cmp-float-side { max-width: 40%; }
.pc-float .cmp-float-side.is-a { box-shadow: inset 3px 0 0 var(--pc-a); }
.pc-float .cmp-float-side.is-b { box-shadow: inset 3px 0 0 var(--pc-b); }
.pc-float-av { flex: 0 0 auto; width: 24px; height: 24px; display: inline-grid; }
.pc-float-av > *, .pc-float-av img, .pc-float-av .avatar {
  width: 24px !important; height: 24px !important; border-radius: 7px; object-fit: cover; font-size: 0.7rem;
}
.pc-float-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pc-float-jump[hidden] { display: none !important; }
.pc-section { scroll-margin-top: 108px; } /* clear the pinned compare bar */

.pc-sync {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px !important; font-size: 0.75rem !important; color: var(--accent) !important; font-weight: 700;
}
.pc-sync[hidden] { display: none; }
.pc-sync .spinner { width: 12px; height: 12px; border-width: 2px; }

.pc-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 4px 0 8px;
  padding: 12px 16px;
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  background: var(--panel);
}
.pc-score-n {
  font-size: 2rem; font-weight: 850; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.pc-score-n.is-a { text-align: right; }
.pc-score-n.is-b { text-align: left; }
.pc-score-n.is-a.is-win { color: var(--pc-a); }
.pc-score-n.is-b.is-win { color: var(--pc-b); }
.pc-score-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.pc-score-mid strong { font-size: 0.95rem; }
.pc-score-mid b.is-a { color: var(--pc-a); }
.pc-score-mid b.is-b { color: var(--pc-b); }
.pc-score-mid small { color: var(--faint); font-size: 0.74rem; }

.pc-row.has-bar { position: relative; padding-bottom: 12px; }
.pc-bar {
  position: absolute; left: 14px; right: 14px; bottom: 4px; height: 3px;
  border-radius: 99px; background: color-mix(in srgb, var(--pc-b) 55%, transparent); overflow: hidden;
}
.pc-bar::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pa);
  background: var(--pc-a); border-right: 2px solid var(--panel);
}
.pc-rank {
  display: inline-block; margin-top: 2px; padding: 0 6px; border-radius: 99px;
  background: var(--inset); color: var(--faint); font-size: 0.68rem; font-weight: 700;
}

details.pc-hero-pair { padding: 0; }
details.pc-hero-pair > summary { list-style: none; cursor: pointer; padding: 12px; }
details.pc-hero-pair > summary::-webkit-details-marker { display: none; }
details.pc-hero-pair[open] > summary { padding-bottom: 6px; }
details.pc-hero-pair > .pc-hero-grid { padding: 0 12px 12px; }
.pc-hero-title {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  position: relative; margin: 0 0 8px; font-size: 0.95rem; font-weight: 750;
}
.pc-hero-pair:not(.is-same) .pc-hero-title { margin: 0; }
.pc-face { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pc-face img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: var(--chip); }
.pc-face.is-empty { color: var(--faint); }
.pc-hero-vs { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pc-hero-vs em { font-style: normal; color: var(--faint); font-size: 0.78rem; font-weight: 700; }
.pc-more {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 0.72rem; font-weight: 750; color: var(--accent);
}
.pc-more::after { content: " ▾"; }
details[open] .pc-more::after { content: " ▴"; }
.pc-hero-mini { margin-bottom: 0; }

@media (max-width: 640px) {
  .pc-score { padding: 10px 12px; gap: 8px; }
  .pc-score-n { font-size: 1.5rem; }
  .pc-bar { left: 10px; right: 10px; }
  .pc-more { position: static; transform: none; }
  .pc-hero-title { flex-wrap: wrap; }
  .pc-float .cmp-float-side { font-size: 0.8rem; padding: 6px 8px; }
}

/* Kingdom scope in the compare pickers (round 3) */
#pcScope { grid-column: 1 / -1; margin-top: 0; }
.pc-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#pcDialogScope.pc-scope { margin-top: 10px; }
.pc-scope .search-scope-fields input { width: 110px; }
.cmp-suggest .pc-deep {
  border-top: 1px solid var(--header-border);
  color: var(--accent);
  font-weight: 750;
}
.cmp-suggest .pc-deep small { color: var(--muted); font-weight: 600; }
.pc-suggest-empty .spinner { width: 12px; height: 12px; border-width: 2px; vertical-align: -2px; }

/* Profile header buttons: Compare + Refresh */
.gov-strip-actions { display: flex; gap: 8px; flex: 0 0 auto; }
@media (max-width: 640px) {
  .gov-hero-strip { flex-wrap: wrap !important; }
  .gov-hero-strip > .gov-alliance-card { flex: 1 1 100%; }
  .gov-strip-actions { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .gov-strip-actions .btn-refresh {
    width: 100% !important;
    min-width: 0 !important;
    height: 40px !important;
    flex-direction: row !important;
    gap: 6px !important;
    padding: 0 10px !important;
  }
  .gov-strip-actions .btn-refresh-icon { font-size: 1rem; }
  .gov-strip-actions .btn-refresh-label {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pc-scope .search-scope-fields input { width: 96px; }
}
#pcForm .cmp-suggest { overflow-x: hidden; }
#playerComparePanel .cmp-suggest button span,
#pcDialog .cmp-suggest button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playerComparePanel .cmp-suggest button small,
#pcDialog .cmp-suggest button small { flex: 0 0 auto; white-space: nowrap; }
#playerComparePanel .cmp-suggest .pc-deep span { overflow: visible; }
@media (max-width: 640px) {
  /* Names need the width: stack A over B, swap button on the right. */
  #pcForm { grid-template-columns: minmax(0, 1fr) auto; }
  #pcForm .cmp-pick[data-side="a"] { grid-column: 1; grid-row: 1; }
  #pcForm .cmp-pick[data-side="b"] { grid-column: 1; grid-row: 2; }
  #pcForm #pcSwap { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  #pcScope, #pcGo { grid-column: 1 / -1; }
}

/* Round 4: card results, player slots, back-to-top, folded heroes, hidden gear */
.cmp-suggest .pc-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  justify-content: stretch;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--bg0);
}
.cmp-suggest .pc-card:hover { border-color: var(--accent-dim); background: var(--bg0); }
.cmp-suggest .pc-card .card-avatar { width: 44px; height: 44px; }
.pc-card-copy { min-width: 0; }
.pc-card-copy h3 { margin: 0 0 3px; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-card-copy .meta { font-size: 0.78rem; }
.pc-card-copy .badge { margin: 0 3px 2px 0; }
.pc-card-al { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pcDialog .cmp-dialog-card { width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
#pcDialog .cmp-dialog-list {
  max-height: none;
  flex: 1 1 auto;
  min-height: 80px;
  overflow: auto;
  border: 0;
  background: transparent;
  padding: 2px;
}
#pcDialog .cmp-dialog-list:empty { display: none; }

.pc-slots {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.pc-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pc-slot:hover { border-color: var(--accent); }
.pc-slot.is-a { box-shadow: inset 3px 0 0 var(--pc-a); }
.pc-slot.is-b { box-shadow: inset 3px 0 0 var(--pc-b); }
.pc-slot.is-empty { border-style: dashed; }
.pc-slot-av { flex: 0 0 auto; width: 44px !important; height: 44px !important; }
.pc-slot-plus { font-size: 1.4rem; color: var(--muted); }
.pc-slot-copy { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.pc-slot-copy small { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.pc-slot.is-a .pc-slot-copy small { color: var(--pc-a); }
.pc-slot.is-b .pc-slot-copy small { color: var(--pc-b); }
.pc-slot-copy b, .pc-slot-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-slot-copy span { color: var(--muted); font-size: 0.78rem; }
.pc-slot-edit { flex: 0 0 auto; color: var(--accent); font-size: 0.75rem; font-weight: 750; }

/* Compare toolbar, phone size: same layout, tighter. */
@media (max-width: 640px) {
  .cmp-float {
    gap: 6px;
    width: calc(100% - 8px);
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 10px;
  }
  .cmp-float-side,
  .pc-float .cmp-float-side { font-size: 0.78rem; padding: 5px 8px; border-radius: 10px; gap: 5px; }
  .cmp-float-side img { width: 18px; height: 18px; border-radius: 5px; }
  .cmp-float .cmp-swap { width: 30px; height: 30px; }
  .cmp-float .cmp-swap svg { width: 15px; height: 15px; }
  .cmp-float-depth { gap: 3px; }
  .cmp-float-depth button { padding: 3px 8px; font-size: 0.7rem; }
  .pc-float-av,
  .pc-float-av > *, .pc-float-av img, .pc-float-av .avatar { width: 20px !important; height: 20px !important; }
  .pc-float-av { border-radius: 6px; }
}

.pc-hero-body { padding: 0 12px 12px; }
.pc-hero-body .pc-hero-mini { margin-bottom: 10px; }
details.pc-hero-pair > .pc-hero-body > .pc-hero-grid { padding: 0; }
details.pc-hero-pair > summary { padding: 10px 12px; }
details.pc-hero-pair .pc-hero-title { margin: 0; }

.pc-gear-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--muted);
}
.pc-gear-note.is-a { box-shadow: inset 3px 0 0 var(--pc-a); }
.pc-gear-note.is-b { box-shadow: inset 3px 0 0 var(--pc-b); }
.pc-gear-note.is-a b { color: var(--pc-a); }
.pc-gear-note.is-b b { color: var(--pc-b); }
.pc-gear-note .pc-side-note { padding: 0; border: 0; background: none; }
.pc-gear-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 140px;
  min-height: 96px;
  border-radius: 12px;
  border: 1px dashed var(--panel-edge);
  background: var(--inset);
  color: var(--faint);
  font-size: 1.2rem;
}
.pc-gear-lock small { font-size: 0.7rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.pc-gear-cell.is-a .pc-gear-lock { border-color: color-mix(in srgb, var(--pc-a) 45%, transparent); }
.pc-gear-cell.is-b .pc-gear-lock { border-color: color-mix(in srgb, var(--pc-b) 45%, transparent); }

@media (max-width: 640px) {
  .pc-slots { grid-template-columns: minmax(0, 1fr) auto; }
  .pc-slot.is-a { grid-column: 1; grid-row: 1; }
  .pc-slot.is-b { grid-column: 1; grid-row: 2; }
  .pc-slots #pcSwap { grid-column: 2; grid-row: 1 / span 2; }
  .pc-slot { padding: 10px 12px; }
  .pc-gear-lock { max-width: 110px; min-height: 84px; }
}

/* Round 5: segmented kingdom scope inside the search dialog */
#pcDialogScope.pc-scope { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.pc-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  gap: 3px;
  border-radius: 12px;
  background: var(--inset);
  border: 1px solid var(--panel-edge);
}
.pc-seg button {
  border: 0;
  border-radius: 9px;
  padding: 7px 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-seg button:hover { color: var(--text); }
.pc-seg button.is-on {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--panel-edge);
}
.pc-scope-fields { display: grid; grid-template-columns: 1fr; gap: 8px; }
.pc-scope-fields.is-range { grid-template-columns: 1fr 1fr; }
.pc-scope-fields[hidden] { display: none !important; }
.pc-scope-fields label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: var(--bg0);
}
.pc-scope-fields label:focus-within { border-color: var(--accent); }
.pc-scope-fields label span { color: var(--muted); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.pc-scope-fields input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
  font: inherit;
  color: var(--text);
  outline: none;
}
#pcDialogQ { margin-bottom: 0; }

/* Round 6: one set of player cards; swap sits between them on phones */
.pc-slot-copy .pc-slot-age { font-size: 0.74rem; color: var(--faint); }
.pc-slot-copy .pc-sync { margin-top: 2px; }
@media (max-width: 640px) {
  .pc-slots { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pc-slot.is-a, .pc-slot.is-b { grid-column: 1; }
  .pc-slot.is-a { grid-row: 1; }
  .pc-slots #pcSwap {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    width: 40px;
    height: 40px;
    margin: -10px 0;
    position: relative;
    z-index: 1;
    background: var(--panel2, var(--panel));
  }
  .pc-slot.is-b { grid-row: 3; }
}

/* Troop levels: same type side by side (infantry vs infantry, ...). */
.pc-troop-cell { display: flex; justify-content: center; min-width: 0; padding: 8px 4px; border-radius: 14px; }
.pc-troop-cell .troop-card { width: 108px; max-width: 100%; }
.pc-troop-cell.is-win.is-a .troop-portrait { box-shadow: 0 0 0 3px var(--pc-a), inset 0 0 0 2px rgba(8, 14, 28, 0.45); }
.pc-troop-cell.is-win.is-b .troop-portrait { box-shadow: 0 0 0 3px var(--pc-b), inset 0 0 0 2px rgba(8, 14, 28, 0.45); }
.pc-troop-cell.is-win.is-a .troop-tier { color: var(--pc-a); }
.pc-troop-cell.is-win.is-b .troop-tier { color: var(--pc-b); }
@media (max-width: 640px) {
  .pc-troop-cell .troop-card { width: 88px; }
  .pc-troop-cell .troop-portrait { width: 78px; height: 78px; }
  .pc-troop-cell .troop-name { font-size: 12px; }
}
