.sr-app {
  --sr-ink: #20353d;
  --sr-muted: #586b70;
  --sr-border: #d8e2df;
  --sr-paper: #fbfcfa;
  --sr-accent: #206c66;
  color: var(--sr-ink);
  margin: 1.25rem 0 2rem;
}

.sr-app * { box-sizing: border-box; }
.sr-intro { width: 100%; max-width: none; font-size: 1.08rem; line-height: 1.65; }
.sr-app h2 { margin: .1rem 0 .3rem; color: #193138; }
.sr-app p { line-height: 1.55; }
.sr-app button, .sr-app input, .sr-app select { font: inherit; }
.sr-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.sr-controls, .sr-card {
  border: 1px solid var(--sr-border);
  border-radius: 15px;
  background: var(--sr-paper);
  box-shadow: 0 4px 24px rgba(20, 47, 49, .055);
}

.sr-controls { margin: 1.5rem 0; padding: 1.25rem; }
.sr-controls-heading, .sr-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}
.sr-controls-heading p, .sr-card-heading p { margin: .15rem 0 0; color: var(--sr-muted); }
.sr-reset {
  white-space: nowrap;
  padding: .45rem .75rem;
  border: 1px solid #a9bfba;
  border-radius: 8px;
  background: white;
  color: #205d59;
  cursor: pointer;
}
.sr-reset:hover, .sr-reset:focus-visible { background: #e9f4f0; }
.sr-control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem 1rem; margin-top: 1.1rem; }
.sr-control-grid > label, .sr-age-control, .sr-focus-control { display: flex; flex-direction: column; gap: .32rem; color: #355057; font-weight: 600; font-size: .88rem; }
.sr-control-grid select, .sr-age-control input, .sr-focus-control select {
  width: 100%;
  min-height: 2.35rem;
  padding: .38rem .55rem;
  color: var(--sr-ink);
  background: white;
  border: 1px solid #bacbc8;
  border-radius: 7px;
}
.sr-age-control > div { display: flex; gap: .4rem; align-items: center; }
.sr-age-control label { flex: 1; min-width: 0; }
.sr-age-control input { min-width: 0; }
.sr-filter-note { margin: .8rem 0 0; font-size: .83rem; color: var(--sr-muted); }

.sr-status {
  min-height: 2.2rem;
  margin: .85rem 0;
  padding: .5rem .75rem;
  border-radius: 8px;
  background: #eaf4f0;
  color: #22554e;
  font-size: .91rem;
}
.sr-status[data-kind="warning"] { background: #fff2df; color: #81520d; }
.sr-status[data-kind="error"] { background: #fcebea; color: #973c3c; }
.sr-notice { padding: .8rem; background: #fff2df; border-radius: 8px; }

.sr-card { margin: 1.15rem 0; padding: 1.25rem; }
.sr-main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: .85rem; align-items: stretch; margin-top: 1rem; }
.sr-affinity-grid { grid-template-columns: minmax(0, 1fr) 250px; }
.sr-main-map { min-width: 0; }
.sr-main-map .sr-map-wrap { margin-top: 0; }
.sr-ranking { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-left: .85rem; border-left: 1px solid var(--sr-border); }
.sr-ranking h3 { margin: 0 0 .2rem; color: #193138; font-size: 1.05rem; }
.sr-ranking p { margin: 0 0 .7rem; color: var(--sr-muted); font-size: .82rem; }
.sr-eyebrow { margin: 0 0 .2rem !important; text-transform: uppercase; letter-spacing: .11em; font-size: .7rem; font-weight: 750; color: var(--sr-accent) !important; }
.sr-card-heading > div:first-child { max-width: 42rem; }
.sr-card-heading p { font-size: .91rem; }
.sr-sample {
  min-width: 11rem;
  padding: .55rem .7rem;
  text-align: right;
  border-radius: 8px;
  background: #e9f3f0;
  color: #225750;
  font-size: .83rem;
  font-weight: 600;
}
.sr-focus-control { min-width: 12rem; max-width: 15rem; }

.sr-map-wrap {
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid #d7e4e3;
  border-radius: 10px;
  background: linear-gradient(160deg, #f2f8f7, #e8f1ef);
}
.sr-map { display: block; width: 100%; height: auto; aspect-ratio: 920 / 520; }
.sr-state { stroke: none; transition: fill .18s, opacity .18s; cursor: pointer; }
.sr-state:hover { opacity: .82; }
.sr-state:focus-visible { stroke: #24645f; stroke-width: 1.3; stroke-linejoin: round; vector-effect: non-scaling-stroke; outline: none; }
.sr-map-borders { fill: none; stroke: #fffdfa; stroke-width: 1.05; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.sr-dc-dot { stroke: #fffdfa; stroke-width: 1.2; }
.sr-dc-dot.is-selected { stroke: #000; stroke-width: 1.8; }
.sr-selection-outline { fill: none; stroke: #000; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.sr-map-inset-label { fill: #607b7e; font-size: 13px; font-weight: 700; letter-spacing: .08em; pointer-events: none; }
.sr-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 15rem;
  padding: .55rem .7rem;
  border-radius: 8px;
  background: #193940;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .18);
  color: white;
  font-size: .84rem;
  line-height: 1.35;
  pointer-events: none;
}
.sr-tooltip strong { display: block; margin-bottom: .1rem; }
.sr-tooltip[hidden] { display: none; }
.sr-legend { display: flex; flex-direction: column; gap: .25rem; margin: .7rem auto 0; max-width: 36rem; font-size: .78rem; color: var(--sr-muted); }
.sr-legend-bar { display: block; width: 100%; height: .75rem; border: 1px solid #d1d6d0; border-radius: 999px; background: linear-gradient(90deg, #b34655, #f6f2e9 50%, #24756a); }
.sr-legend-ticks { display: flex; justify-content: space-between; position: relative; }
.sr-legend-ticks span:nth-child(2) { position: absolute; left: 50%; transform: translateX(-50%); }
.sr-affinity-legend { display: flex; flex-direction: column; gap: .3rem; margin: .7rem auto 0; max-width: 36rem; color: var(--sr-muted); font-size: .78rem; }
.sr-affinity-legend[hidden] { display: none; }
.sr-affinity-legend-title { font-weight: 700; color: #355057; }
.sr-affinity-legend-bar { display: block; height: .75rem; border: 1px solid #d1d6d0; border-radius: 999px; background: linear-gradient(90deg, #e2edf7, #a9cce3 33.33%, #205986); }
.sr-affinity-legend-ticks { display: flex; justify-content: space-between; position: relative; }
.sr-affinity-legend-ticks span:nth-child(2) { position: absolute; left: 33.33%; transform: translateX(-50%); }
.sr-affinity-legend-caption { font-size: .73rem; }
.sr-highlights { min-height: 7.25rem; margin-top: .85rem; padding: .6rem .8rem; border: 1px solid var(--sr-border); border-radius: 9px; background: #f0f5f1; }
.sr-highlights.is-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: .6rem 0; }
.sr-highlights[hidden] { display: none; }
.sr-extreme { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: .1rem .85rem; }
.sr-extreme + .sr-extreme { border-left: 1px solid var(--sr-border); }
.sr-extreme span { display: block; color: var(--sr-muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; }
.sr-extreme strong, .sr-extreme b { display: block; font-size: .95rem; line-height: 1.25; }
.sr-extreme b { font-weight: 400; }
.sr-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.sr-detail-metrics span { display: block; color: var(--sr-muted); font-size: .71rem; text-transform: uppercase; letter-spacing: .05em; }
.sr-detail-heading h3 { margin: 0; font-size: 1.05rem; line-height: 1.15; }
.sr-detail-heading > strong { flex: none; padding: .25rem .45rem; border-radius: 5px; background: #dcebe6; color: #245e57; font-size: .78rem; }
.sr-detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: .45rem; padding-top: .45rem; border-top: 1px solid var(--sr-border); }
.sr-detail-metrics > div + div { padding-left: .65rem; border-left: 1px solid var(--sr-border); }
.sr-detail-metrics strong { display: block; margin: .05rem 0; font-size: 1rem; line-height: 1.15; }
.sr-detail-metrics small { display: block; color: var(--sr-muted); font-size: .7rem; line-height: 1.2; }
.sr-ranking-list { display: grid; grid-template-columns: 1fr; gap: .3rem; flex: 1 1 0; min-height: 0; overflow: auto; padding-right: .2rem; }
.sr-affinity-list { margin: 0; padding-left: 0; list-style: none; }
.sr-affinity-list li { min-width: 0; margin: 0; }
.sr-affinity-list li + li { margin-top: 0; }
.sr-affinity-row { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) 3.55rem; gap: .25rem; align-items: center; width: 100%; min-width: 0; padding: .35rem .3rem; border: 1px solid transparent; border-radius: 6px; color: var(--sr-ink); font-size: .79rem; text-align: left; }
.sr-affinity-ranking .sr-affinity-row { font-size: .79rem; line-height: 1.25; padding: .32rem .25rem; }
button.sr-affinity-row { background: transparent; cursor: pointer; }
button.sr-affinity-row:hover, button.sr-affinity-row:focus-visible { border-color: #a8cbc3; background: #eaf4f0; outline: none; }
.sr-affinity-row .sr-rank-score { white-space: nowrap; }
.sr-rank-button { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 4rem; gap: .35rem; align-items: center; width: 100%; padding: .37rem .45rem; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; color: var(--sr-ink); cursor: pointer; font-size: .82rem; }
.sr-ranking .sr-rank-button { grid-template-columns: 1.4rem minmax(0, 1fr) 3.55rem; gap: .25rem; padding: .35rem .3rem; font-size: .79rem; }
.sr-rank-button:hover, .sr-rank-button:focus-visible, .sr-rank-button.is-selected { border-color: #a8cbc3; background: #eaf4f0; outline: none; }
.sr-rank-number { color: #6e8587; font-size: .74rem; }
.sr-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-rank-score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #235e57; }

@media (max-width: 960px) {
  .sr-main-grid, .sr-affinity-grid { grid-template-columns: 1fr; }
  .sr-ranking { padding: 1rem 0 0; border-left: 0; border-top: 1px solid var(--sr-border); }
  .sr-ranking-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem 1.1rem; flex: none; max-height: 32rem; }
}
@media (max-width: 720px) {
  .sr-control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sr-card-heading { flex-direction: column; }
  .sr-sample { text-align: left; }
  .sr-focus-control { max-width: none; }
}
@media (max-width: 530px) {
  .sr-controls, .sr-card { padding: .9rem; }
  .sr-controls-heading { flex-direction: column; gap: .5rem; }
  .sr-control-grid, .sr-ranking-list { grid-template-columns: 1fr; }
  .sr-detail-metrics { grid-template-columns: 1fr; gap: .45rem; }
  .sr-detail-metrics > div + div { padding: .45rem 0 0; border-left: 0; border-top: 1px solid var(--sr-border); }
  .sr-highlights { min-height: 15rem; }
  .sr-highlights.is-overview { grid-template-columns: 1fr; }
  .sr-extreme + .sr-extreme { margin-top: .4rem; padding-top: .4rem; border-left: 0; border-top: 1px solid var(--sr-border); }
  .sr-tooltip { font-size: .74rem; }
}

.sr-methodology {
  margin: 1.4rem 0 2rem;
  border: 1px solid #d8e2df;
  border-radius: 14px;
  background: #fbfcfa;
  box-shadow: 0 4px 24px rgba(20, 47, 49, .055);
  overflow: visible;
}
.sr-methodology summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  list-style: none;
  cursor: pointer;
  background: #f0f6f3;
  border-radius: 13px;
}
.sr-methodology summary::-webkit-details-marker { display: none; }
.sr-methodology summary:hover { background: #e8f2ed; }
.sr-methodology summary:focus-visible { outline: 2px solid #206c66; outline-offset: -3px; }
.sr-methodology summary h2 { margin: 0 !important; padding: 0; border: 0; color: #193138; font-size: 1.35rem; line-height: 1.25; }
.sr-methodology summary::after {
  content: "+";
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #dbece5;
  color: #206c66;
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1;
}
.sr-methodology[open] summary { border-bottom: 1px solid #d8e2df; border-radius: 13px 13px 0 0; }
.sr-methodology[open] summary::after { content: "−"; }
.sr-methodology > :not(summary) { margin-right: 1.25rem; margin-left: 1.25rem; }
.sr-methodology[open] > summary + * { margin-top: 1.5rem; }
.sr-methodology[open] > :last-child { margin-bottom: 1.25rem; }
