.state-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.map-panel, .state-detail { min-width: 0; }
.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
}
.map-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend-a { background: var(--a); }
.legend-b { background: var(--b); }
.map-wrap { position: relative; max-width: 560px; margin: 12px auto 0; }
#state-map { display: block; width: 100%; aspect-ratio: 560 / 550; overflow: visible; shape-rendering: geometricPrecision; }
.map-state { fill: #2b3651; stroke: var(--bg); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s, filter .2s; }
.map-state.leading-a { fill: #7299f2; }
.map-state.leading-b { fill: #ef7f6c; }
.map-state:hover, .map-state:focus-visible { filter: brightness(1.2); outline: none; }
.map-selection { fill: none; stroke: rgba(255, 255, 255, .88); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-hover { position: absolute; z-index: 4; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(13, 19, 33, .94); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; }
.state-detail { scroll-margin-top: 16px; }
.map-toggle, .map-close { display: none; }

@media (max-width: 1100px) {
  .state-layout { display: block; }
  .states-page .map-toggle, .map-close { display: inline-flex; flex: none; align-items: center; justify-content: center; min-height: 31px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .05); color: #bdc9dd; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
  .map-toggle span { margin-left: 5px; }
  .map-panel { position: fixed; z-index: 20; inset: 0; display: flex; flex-direction: column; overflow: hidden; padding: calc(18px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); background: var(--bg); visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .2s, visibility .2s; }
  .map-open .map-panel { visibility: visible; opacity: 1; pointer-events: auto; }
  .map-head { flex: none; justify-content: flex-start; }
  .map-legend { margin-left: auto; }
  .map-close { width: 31px; padding: 0; font-size: 15px; }
  .map-wrap { display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; width: 100%; max-width: none; margin: 0; }
  #state-map { flex: none; width: min(100%, 700px); max-height: 100%; aspect-ratio: 560 / 550; }
}
@media (max-width: 700px) {
  .state-layout { display: flex; flex: 1; align-items: stretch; min-height: 0; gap: 0; }
  .state-detail { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  #state-map { flex: none; width: calc(100% + 70px); max-height: 100%; aspect-ratio: 560 / 550; transform: translateX(13px); }
}
