.cz-test-popup-area {
    position: fixed;
    inset: 0;
    z-index: 100000;
    font-family: inherit;
    --sanbo-popup-paper: #fff;
    --sanbo-popup-ink: #333;
    --sanbo-popup-rule: #ddd;
    --sanbo-popup-active: #ee9200;
    --sanbo-popup-footer: #555;
    --sanbo-popup-close: #000;
}

.cz-test-popup-area[hidden],
.cz-test-popup-area [hidden] {
    display: none !important;
}

.cz-test-popup-area *,
.cz-test-popup-area *::before,
.cz-test-popup-area *::after {
    box-sizing: border-box;
}

.cz-test-popup-area button {
    font-family: inherit;
    border-radius: 0;
    letter-spacing: normal;
    text-transform: none;
}

.cz-test-popup-area :focus-visible {
    outline: 3px solid var(--sanbo-popup-active);
    outline-offset: -3px;
}

.cz-test-popup-area:focus {
    outline: none;
}

.cz-test-popup-area button:hover {
    filter: brightness(.94);
}

.cz-test-popup-area button:active {
    filter: brightness(.88);
}

.cz-test-popup.is-closing {
    pointer-events: none;
}

.cz-test-popup-area h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cz-test-popup-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.cz-test-popup-list {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: flex-start;
    justify-content: center;
    gap: 64px;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 40px 4vw;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    box-sizing: border-box;
}

.cz-test-popup {
    flex: 0 1 500px;
    width: 500px;
    min-width: 0;
    max-width: 100%;
    background: var(--sanbo-popup-paper);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.cz-test-popup-wide {
    flex-basis: 700px;
    width: 700px;
}

.cz-test-popup-content {
    overflow: hidden;
    background: var(--sanbo-popup-paper);
}

.cz-test-popup-content p {
    margin: 0;
    padding: 0;
}

.cz-test-popup-content img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    object-fit: contain;
    background: var(--sanbo-popup-paper);
}

.cz-test-body {
    display: none;
    height: 700px;
    overflow: hidden;
    background: var(--sanbo-popup-paper);
}

.cz-test-body.is-active {
    display: block;
}

.cz-test-tabs {
    display: flex;
    flex-wrap: wrap;
    background: var(--sanbo-popup-paper);
}

.cz-test-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 58px;
    padding: 0 10px;
    border: 0;
    border-right: 1px solid var(--sanbo-popup-rule);
    background: var(--sanbo-popup-paper);
    color: var(--sanbo-popup-ink);
    overflow-wrap: anywhere;
    word-break: keep-all;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.cz-test-tab.is-active {
    background: var(--sanbo-popup-active);
    color: var(--sanbo-popup-paper);
}

.cz-test-tabs-many .cz-test-tab {
    flex-basis: 130px;
}

.cz-test-side-layout {
    display: flex;
    align-items: stretch;
}

.cz-test-side-image {
    flex: 1 1 500px;
    width: 500px;
    min-width: 0;
}

.cz-test-side-menu {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: 700px;
    overflow-y: auto;
    background: var(--sanbo-popup-paper);
}

.cz-test-side-tab {
    flex: 1 1 0;
    min-height: 70px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--sanbo-popup-rule);
    background: var(--sanbo-popup-paper);
    color: var(--sanbo-popup-ink);
    overflow-wrap: anywhere;
    word-break: keep-all;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
}

.cz-test-side-tab.is-active {
    background: var(--sanbo-popup-active);
    color: var(--sanbo-popup-paper);
}

.cz-test-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 0;
    background: var(--sanbo-popup-footer);
    box-sizing: border-box;
}

.cz-test-popup-footer button {
    min-height: 54px;
    padding: 10px 18px;
    border: 0;
    background: transparent;
    color: var(--sanbo-popup-paper);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
}

.cz-test-popup-reject {
    text-align: left;
}

.cz-test-popup-check {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid var(--sanbo-popup-paper);
    background: var(--sanbo-popup-paper);
    vertical-align: -2px;
    box-sizing: border-box;
}

.cz-test-popup-close {
    align-self: stretch;
    min-width: 96px;
    background: var(--sanbo-popup-close) !important;
}

.sanbo-popup-preview-label {
    flex: 0 0 100%;
    margin: 0;
    padding: 10px;
    background: var(--sanbo-popup-paper);
    color: var(--sanbo-popup-ink);
    text-align: center;
}

@media (max-width: 768px) {
    .cz-test-popup-list {
        display: block;
        padding: 20px 10px;
    }

    .cz-test-popup,
    .cz-test-popup-wide {
        width: 100%;
        max-width: 500px;
        margin: 0 auto 14px;
    }

    .cz-test-body {
        height: 130vw;
    }

    .cz-test-side-layout {
        display: block;
    }

    .cz-test-side-image {
        width: 100%;
    }

    .cz-test-side-menu {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        max-width: 100%;
        overscroll-behavior-x: contain;
    }

    .cz-test-side-tab {
        flex: 0 0 auto;
        min-width: 130px;
        max-width: 200px;
        min-height: 48px;
        font-size: 12px;
    }

    .cz-test-popup-footer {
        min-height: 44px;
    }

    .cz-test-popup-footer button {
        font-size: 12px;
        min-height: 44px;
        padding: 8px 10px;
    }

    .sanbo-popup-preview-label {
        margin-bottom: 14px;
    }
}

/* These mirror the JS media query; viewport selection is cache-safe. */
.cz-test-popup-area:not([data-preview="1"]) [data-device="mobile"] {
    display: none;
}
@media (max-width: 768px) {
    .cz-test-popup-area:not([data-preview="1"]) [data-device="mobile"] { display: block; }
    .cz-test-popup-area:not([data-preview="1"]) [data-device="desktop"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cz-test-popup-area * { scroll-behavior: auto !important; }
}
