.usim-map-wrap {
    position: relative;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

.usim-svg-map {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.15));
}

.usim-state-path {
    cursor: pointer;
    transition: fill 0.2s ease, filter 0.2s ease;
}
.usim-state-path:hover {
    filter: brightness(1.05);
}

/* Tooltip */
.usim-tooltip {
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    pointer-events: none;
    max-width: 280px;
    min-width: 140px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: opacity 0.15s ease;
}
.usim-tooltip-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    color: #1d2327;
}
.usim-tooltip-info {
    color: #50575e;
}
.usim-tooltip-info:empty {
    display: none;
}
.usim-tooltip-link-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #2271b1;
    font-style: italic;
}

/* Legend overlay */
.usim-legend {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 6px;
    padding: 10px 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    z-index: 10;
    pointer-events: none;
}
.usim-legend-bottom-right {
    bottom: 12px;
    right: 12px;
}
.usim-legend-bottom-left {
    bottom: 12px;
    left: 12px;
}
.usim-legend-top-right {
    top: 12px;
    right: 12px;
}
.usim-legend-top-left {
    top: 12px;
    left: 12px;
}
.usim-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    white-space: nowrap;
}
.usim-legend-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.usim-legend-label {
    font-family: inherit;
    font-size: 13px;
    color: #333;
    line-height: 1.3;
}

/* Block (tile) map — plain map mode */
.usim-tile-map { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 6px; width: 100%; max-width: 640px; }
.usim-tile { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; font: 700 .78rem/1 inherit; font-family: inherit; border: 0; border-radius: 6px; padding: 0; margin: 0; background: var(--usim-tile-color, #b0cde1); color: var(--usim-tile-label, #3d5a80); cursor: pointer; transition: background .15s ease; text-decoration: none; }
.usim-tile.is-inactive { background: var(--usim-tile-inactive, #e0e0e0); color: var(--usim-tile-label-inactive, #9ca3af); cursor: default; }
.usim-tile.is-active:hover { background: var(--usim-tile-hover, #2a7ab5); color: var(--usim-tile-label-hover, #fff); }
.usim-map-wrap:has(.usim-tile-map) .usim-svg-map { filter: none; }

/* Dot view: same layout as blocks, rendered as circles */
.usim-tile-map--dots { gap: 8px; }
.usim-tile-map--dots .usim-tile { border-radius: 50%; font-size: .7rem; }
.usim-tile-map--dots .usim-tile.is-selected { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--usim-tile-hover, #2a7ab5); }
@media (max-width: 640px) { .usim-tile-map--dots { gap: 5px; } .usim-tile-map--dots .usim-tile { font-size: .58rem; } }

.usim-map-wrap, .usim-map-wrap button, .usim-tile { font-family: inherit; }
/* SVG state labels use the page font too */
.usim-svg-map text { font-family: inherit; }

/* Legend below the map (not overlaid) */
.usim-legend--below {
    position: static; display: flex; flex-wrap: wrap; gap: 6px 22px;
    margin-top: 14px; padding: 0; background: transparent; box-shadow: none; border-radius: 0;
    pointer-events: auto;
}
.usim-legend-below-center { justify-content: center; }
.usim-legend-below-right  { justify-content: flex-end; }
.usim-legend--below .usim-legend-item { padding: 0; }

.usim-tile-map--no-labels .usim-tile { color: transparent !important; }
