.wm {
    --wm-map: min(760px, max(320px, calc((100vh - 455px) * var(--wm-ratio, 1))));
    width: 95%;
    max-width: max(820px, calc(var(--wm-map) + 214px));
    margin: 0 auto 1.5rem;
    background: #fff;
    color: var(--navy-900);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    font: 14px/1.4 var(--font-body);
}

.wm *, .wm *::before, .wm *::after {
    box-sizing: border-box;
}

.wm-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    background: var(--navy-800);
}

.wm-top h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
}

.wm-top h2 span {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.wm-run, .wm-speed {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-poppins);
    font-weight: 600;
    font-size: 13px;
}

.wm-run {
    color: rgba(255, 255, 255, 0.85);
}

.wm-speed {
    color: var(--ink-muted);
}

.wm select {
    background: #fff;
    color: var(--navy-900);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    font: inherit;
}

.wm-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
}

.wm-products {
    padding: 12px 10px;
    border-right: 1px solid var(--border);
    background: var(--sky-50);
}

.wm-products h3 {
    margin: 14px 8px 6px;
    font-family: var(--font-poppins);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--label-blue);
}

.wm-products h3:first-child {
    margin-top: 0;
}

.wm-products a {
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--navy-900);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.wm-products a:hover {
    background: var(--border);
}

.wm-products a.active {
    background: var(--sky-blue);
    color: #fff;
    font-weight: 600;
}

.wm-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 12px;
    min-width: 0;
}

.wm-stage {
    position: relative;
    width: 100%;
    /* max-width: var(--wm-map); */
    aspect-ratio: 1000 / 985;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.wm-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wm-loading {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    transition: opacity 0.4s;
}

.wm-loading span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--sky-blue);
    transition: width 0.2s;
}

.wm-loading.done {
    opacity: 0;
}

.wm-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    background: var(--sky-50);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.wm-controls button {
    min-width: 30px;
    height: 28px;
    padding: 0 6px;
    background: #fff;
    color: var(--navy-800);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.wm-controls button:hover {
    border-color: var(--sky-blue);
}

.wm-controls .play {
    min-width: 38px;
    background: var(--sky-blue);
    border-color: var(--sky-blue);
    color: #fff;
}

.wm #slider {
    flex: 1 1 80px;
    min-width: 60px;
    accent-color: var(--sky-blue);
}

.wm-label {
    flex: 0 0 186px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--navy-900);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.wm-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ink-muted);
}

@media (max-width: 760px) {
    .wm-layout {
        grid-template-columns: 1fr;
    }

    .wm-products {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .wm-products h3 {
        display: none;
    }

    .wm-viewer {
        padding: 10px;
    }

    .wm-stage {
        max-width: none;
    }

    .wm-controls {
        flex-wrap: wrap;
    }
}

.wm-regions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto 12px;
}

.wm-regions a {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--navy-800);
    font-family: var(--font-poppins);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.wm-regions a.active {
    background: var(--navy-800);
    border-color: var(--navy-800);
    color: #fff;
}

.wm-speed span {
    display: none;
}

.wm-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.wm-top > :last-child {
    justify-self: end;
    min-width: 0;
    max-width: 100%;
}

.wm-top > :last-child select {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 760px) {
    .wm-top {
        display: flex;
    }
}

.wm-speed select {
    padding: 3px 6px;
    font-size: 12px;
}
