.tzl-app {
    --tzl-border: #e5e7eb;
    --tzl-muted: #6b7280;
    --tzl-bg: #ffffff;
    --tzl-soft: #f9fafb;
    --tzl-text: #111827;
    --tzl-primary: #2563eb;
    --tzl-primary-dark: #1d4ed8;
    width: 100%;
    max-width: 1320px;
    margin-inline: auto;
    font-family: inherit;
}

.tzl-app,
.tzl-app * {
    box-sizing: border-box;
}

.tzl-object-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.tzl-object {
    min-width: 0;
    border: 1px solid var(--tzl-border);
    border-radius: 18px;
    padding: clamp(14px, 3vw, 22px);
    background: var(--tzl-bg);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.tzl-object-header h3 {
    margin: 0 0 8px;
    color: var(--tzl-text);
    line-height: 1.25;
}

.tzl-object-header p {
    margin: 0 0 16px;
    color: var(--tzl-muted);
}

.tzl-viewer {
    min-width: 0;
}

.tzl-stage {
    background: var(--tzl-soft);
    border: 1px solid var(--tzl-border);
    border-radius: 16px;
    min-height: 260px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.tzl-step {
    display: none;
    margin: 0;
    padding: clamp(10px, 3vw, 18px);
    width: 100%;
    text-align: center;
}

.tzl-step.is-active {
    display: block;
}

.tzl-step img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    cursor: zoom-in;
}

.tzl-step figcaption {
    margin-top: 10px;
    color: var(--tzl-muted);
    font-size: 0.95rem;
}

.tzl-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "primary"
        "dots"
        "secondary";
    gap: 12px;
    margin-top: 16px;
    width: 100%;
    min-width: 0;
}

.tzl-primary-controls {
    grid-area: primary;
}

.tzl-dots {
    grid-area: dots;
}

.tzl-secondary-controls {
    grid-area: secondary;
}

.tzl-primary-controls,
.tzl-secondary-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.tzl-primary-controls {
    justify-content: space-between;
}

.tzl-secondary-controls {
    justify-content: center;
}

.tzl-controls button {
    width: auto;
    max-width: 100%;
    min-width: 0;
    min-height: 36px;
    border: 1px solid var(--tzl-border);
    border-radius: 999px;
    padding: 7px 12px;
    background: #fff;
    color: var(--tzl-text);
    cursor: pointer;
    line-height: 1.2;
    font: inherit;
    font-size: 0.95em;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tzl-controls button:hover:not(:disabled) {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.tzl-controls button:active:not(:disabled) {
    transform: translateY(1px);
}

.tzl-controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tzl-prev,
.tzl-next {
    flex: 1 1 120px;
    min-width: 0;
}

.tzl-next {
    border-color: var(--tzl-primary) !important;
    background: var(--tzl-primary) !important;
    color: #fff !important;
}

.tzl-next:hover:not(:disabled) {
    background: var(--tzl-primary-dark) !important;
}

.tzl-fullscreen {
    flex: 0 1 auto;
    white-space: nowrap;
}

.tzl-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 4px 0;
}

.tzl-dot {
    flex: 0 0 auto;
    min-width: 32px;
    min-height: 32px !important;
    padding: 5px 9px !important;
}

.tzl-dot.is-active {
    border-color: var(--tzl-primary);
    background: var(--tzl-primary);
    color: #fff;
    font-weight: 700;
}

body.tzl-lightbox-open {
    overflow: hidden;
}

.tzl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 20px 24px;
    background: rgba(0, 0, 0, 0.88);
}

.tzl-lightbox img {
    max-width: 96vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.tzl-lightbox-close {
    position: fixed;
    top: 16px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
}

.tzl-lightbox-close:focus-visible,
.tzl-controls button:focus-visible,
.tzl-step img:focus-visible {
    outline: 3px solid var(--tzl-primary);
    outline-offset: 3px;
}

@media (min-width: 700px) {
    .tzl-controls {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "primary"
            "secondary"
            "dots";
        align-items: stretch;
        gap: 12px;
    }

    .tzl-primary-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        justify-content: stretch;
        gap: 8px;
    }

    .tzl-prev,
    .tzl-next {
        flex: initial;
        width: 100%;
        min-width: 0;
        padding-inline: 10px;
        white-space: nowrap;
    }

    .tzl-secondary-controls {
        justify-content: center;
        width: 100%;
    }

    .tzl-fullscreen {
        flex: 0 1 220px;
        min-width: 0;
        width: min(100%, 220px);
    }
}

@media (min-width: 900px) {
    .tzl-object-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
    }

    .tzl-app[data-columns="1"] .tzl-object-grid { grid-template-columns: 1fr; }
    .tzl-app[data-columns="2"] .tzl-object-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
    .tzl-app[data-columns="3"] .tzl-object-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
    .tzl-app[data-columns="4"] .tzl-object-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
}

@media (min-width: 1180px) {
    .tzl-app[data-columns="2"] .tzl-object-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1680px) {
    .tzl-app[data-columns="3"] .tzl-object-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 2240px) {
    .tzl-app[data-columns="4"] .tzl-object-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .tzl-stage {
        min-height: 210px;
    }

    .tzl-primary-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .tzl-fullscreen,
    .tzl-primary-controls button {
        width: 100%;
        white-space: normal;
    }
}
