/*
 * Public templates gallery: preview-stage cards (desktop window + phone) and the Quick look viewer.
 * Markup is built by assets/js/public-website/templates-gallery.js.
 */
:root {
    --tpl-indigo-50: #eef2ff;
    --tpl-indigo-100: #e0e7ff;
    --tpl-indigo-500: #6366f1;
    --tpl-indigo-600: #4f46e5;
    --tpl-indigo-700: #4338ca;
    --tpl-slate-50: #f8fafc;
    --tpl-slate-100: #f1f5f9;
    --tpl-slate-200: #e2e8f0;
    --tpl-slate-300: #cbd5e1;
    --tpl-slate-400: #94a3b8;
    --tpl-slate-500: #64748b;
    --tpl-slate-600: #475569;
    --tpl-slate-700: #334155;
    --tpl-slate-900: #0f172a;
    --tpl-emerald-50: #ecfdf5;
    --tpl-emerald-500: #10b981;
    --tpl-emerald-600: #059669;
    --tpl-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tpl-icon {
    display: block;
    flex: none;
    width: 16px;
    height: 16px;
}

/* ------------------------------------------------------------------ */
/* Card                                                                */
/* ------------------------------------------------------------------ */
.tpl-card {
    position: relative;
    min-width: 0;
}

.tpl-stage {
    position: relative;
    display: block;
    aspect-ratio: 272 / 218;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(180deg, #f3f5f9, #e9edf3);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    cursor: pointer;
    outline: none;
    transition: box-shadow 0.3s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.tpl-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(160deg, var(--tpl-indigo-100), var(--tpl-indigo-50) 55%, #f5f3ff);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

/* Desktop window: a small browser bar above the gallery screenshot. */
.tpl-win {
    position: absolute;
    left: 5.9%;
    top: 7.3%;
    width: 77.9%;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.tpl-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 3px;
    aspect-ratio: 212 / 12;
    min-height: 10px;
    padding-left: 6px;
    background: #fff;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.06);
}

.tpl-bar i {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--tpl-slate-300);
}

.tpl-url {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 30%;
    height: 6px;
    border-radius: 3px;
    background: var(--tpl-slate-100);
    transform: translate(-50%, -50%);
}

.tpl-win img {
    display: block;
    width: 100%;
    aspect-ratio: 212 / 150;
    object-fit: cover;
    object-position: top;
    background: var(--tpl-slate-100);
}

/* Without a phone screenshot the window takes the centre of the stage. */
.tpl-stage--solo .tpl-win {
    left: 8%;
    width: 84%;
}

/* Phone: 3px bezel, concentric screen radius and an island. */
.tpl-ph {
    position: absolute;
    right: 5.1%;
    bottom: 5.5%;
    width: 24.3%;
    aspect-ratio: 66 / 143;
    overflow: hidden;
    border: 3px solid var(--tpl-slate-900);
    border-radius: 14px;
    background: var(--tpl-slate-900);
    box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.16), 0 8px 10px -6px rgba(15, 23, 42, 0.12);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.tpl-ph img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 11px;
    background: #fff;
}

.tpl-ph::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 3px;
    width: 28%;
    height: 5px;
    border-radius: 3px;
    background: var(--tpl-slate-900);
    transform: translateX(-50%);
}

/* "Quick look · Space" pill (hover / keyboard focus only). */
.tpl-ql {
    position: absolute;
    left: 5.9%;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 5px 0 10px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 10px 15px -3px rgba(49, 46, 129, 0.14), 0 4px 6px -4px rgba(49, 46, 129, 0.1);
    color: var(--tpl-slate-900);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease-out, transform 0.3s ease-out;
}

.tpl-ql .tpl-icon {
    width: 14px;
    height: 14px;
    color: var(--tpl-indigo-600);
}

.tpl-kbd {
    display: inline-flex;
    align-items: center;
    height: 20px;
    margin-left: 2px;
    padding: 0 6px;
    border-radius: 6px;
    background: linear-gradient(#fff, var(--tpl-slate-50));
    box-shadow: inset 0 0 0 1px var(--tpl-slate-200), 0 1px 0 var(--tpl-slate-200);
    color: var(--tpl-slate-600);
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    line-height: 12px;
}

/* Caption: name + subtype, "Use →" on hover / focus. */
.tpl-cap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    min-height: 20px;
    margin-top: 12px;
}

.tpl-nm {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 70%;
    overflow: hidden;
    color: var(--tpl-slate-900);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 20px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease-out;
}

.tpl-sub {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    color: var(--tpl-slate-500);
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-go {
    display: none;
    flex: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    border-radius: 6px;
    color: var(--tpl-indigo-600);
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}

.tpl-go .tpl-icon {
    width: 14px;
    height: 14px;
    align-self: center;
    transition: transform 0.2s ease-out;
}

.tpl-go:hover {
    color: var(--tpl-indigo-700);
}

.tpl-go:hover .tpl-icon {
    transform: translateX(2px);
}

.tpl-go:focus-visible,
.tpl-nm:focus-visible {
    outline: 2px solid var(--tpl-indigo-500);
    outline-offset: 2px;
}

/* Hover (real pointers only, so taps don't leave a stuck state) and keyboard focus. */
@media (hover: hover) {
    .tpl-card:hover .tpl-stage {
        box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14), 0 14px 28px -18px rgba(79, 70, 229, 0.45);
    }

    .tpl-card:hover .tpl-stage::before {
        opacity: 1;
    }

    .tpl-card:hover .tpl-win {
        transform: translateY(-8px);
        box-shadow: 0 0 0 1px rgba(49, 46, 129, 0.08), 0 18px 28px -10px rgba(49, 46, 129, 0.26), 0 6px 10px -6px rgba(49, 46, 129, 0.14);
    }

    .tpl-card:hover .tpl-ph {
        transform: translateY(-12px);
        box-shadow: 0 24px 30px -10px rgba(49, 46, 129, 0.34), 0 8px 12px -8px rgba(49, 46, 129, 0.22);
    }

    .tpl-card:hover .tpl-ql {
        opacity: 1;
        transform: none;
    }

    .tpl-card:hover .tpl-nm {
        color: var(--tpl-indigo-600);
    }

    .tpl-card:hover .tpl-go {
        display: inline-flex;
    }
}

.tpl-card:focus-within .tpl-stage {
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14), 0 14px 28px -18px rgba(79, 70, 229, 0.45);
}

.tpl-card:focus-within .tpl-stage::before {
    opacity: 1;
}

.tpl-card:focus-within .tpl-win {
    transform: translateY(-8px);
    box-shadow: 0 0 0 1px rgba(49, 46, 129, 0.08), 0 18px 28px -10px rgba(49, 46, 129, 0.26), 0 6px 10px -6px rgba(49, 46, 129, 0.14);
}

.tpl-card:focus-within .tpl-ph {
    transform: translateY(-12px);
    box-shadow: 0 24px 30px -10px rgba(49, 46, 129, 0.34), 0 8px 12px -8px rgba(49, 46, 129, 0.22);
}

.tpl-card:focus-within .tpl-ql {
    opacity: 1;
    transform: none;
}

.tpl-card:focus-within .tpl-nm {
    color: var(--tpl-indigo-600);
}

.tpl-card:focus-within .tpl-go {
    display: inline-flex;
}

.tpl-stage:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tpl-indigo-500);
}

/* Touch screens have no hover, so the pill would never be seen; keep the caption quiet too. */
@media (hover: none) {
    .tpl-ql {
        display: none;
    }
}

/* ------------------------------------------------------------------ */
/* Quick look                                                          */
/* ------------------------------------------------------------------ */
html.tql-locked {
    overflow: hidden;
}

html.tql-locked body {
    padding-right: var(--tql-scrollbar, 0px);
}

.tql {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: inherit;
}

.tql[hidden] {
    display: none;
}

.tql-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.22s ease-out;
}

.tql.is-open .tql-backdrop {
    opacity: 1;
}

.tql-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
        "stage head"
        "stage chip"
        "stage ticks"
        "stage ."
        "stage cta"
        "stage nav";
    width: min(1120px, 100%);
    height: min(720px, 100%);
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 32px 64px -16px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.06);
    color: var(--tpl-slate-900);
    outline: none;
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    transition: opacity 0.22s ease-out, transform 0.28s var(--tpl-ease);
}

.tql.is-open .tql-dialog {
    opacity: 1;
    transform: none;
}

.tql-grab {
    display: none;
}

.tql-head {
    grid-area: head;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 28px 24px 0 28px;
}

.tql-head-text {
    flex: 1;
    min-width: 0;
}

.tql-title {
    margin: 0;
    color: var(--tpl-slate-900);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 30px;
    overflow-wrap: anywhere;
}

.tql-sub {
    margin: 2px 0 0;
    color: var(--tpl-slate-500);
    font-size: 15px;
    font-weight: 500;
    line-height: 22px;
}

.tql-close {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -4px -4px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tpl-slate-100);
    color: var(--tpl-slate-600);
    cursor: pointer;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.tql-close:hover {
    background: var(--tpl-slate-200);
    color: var(--tpl-slate-900);
}

.tql-chip {
    grid-area: chip;
    justify-self: start;
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    max-width: calc(100% - 52px);
    margin: 14px 24px 0 28px;
    padding: 5px 10px;
    border-radius: 12px;
    background: var(--tpl-slate-100);
    color: var(--tpl-slate-600);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}

.tql-chip[hidden],
.tql-sub[hidden] {
    display: none;
}

.tql-chip .tpl-icon {
    width: 12px;
    height: 12px;
    margin-top: 2px;
    color: var(--tpl-slate-500);
}

.tql-ticks {
    grid-area: ticks;
    display: grid;
    gap: 12px;
    margin: 24px 24px 0 28px;
    padding: 20px 0 0;
    border-top: 1px solid var(--tpl-slate-100);
    list-style: none;
}

.tql-ticks li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--tpl-slate-700);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.tql-ticks .tpl-icon {
    box-sizing: content-box;
    width: 12px;
    height: 12px;
    padding: 4px;
    border-radius: 50%;
    background: var(--tpl-emerald-50);
    color: var(--tpl-emerald-600);
    stroke-width: 3;
}

.tql-cta {
    grid-area: cta;
    display: grid;
    gap: 10px;
    padding: 0 24px 0 28px;
}

.tql-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease-out, color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.tql-btn[hidden] {
    display: none;
}

.tql-btn-primary {
    background: var(--tpl-indigo-600);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.25), 0 4px 6px -4px rgba(79, 70, 229, 0.25);
    color: #fff;
}

.tql-btn-primary:hover {
    background: var(--tpl-indigo-700);
    color: #fff;
}

.tql-btn-primary .tpl-icon {
    transition: transform 0.2s ease-out;
}

.tql-btn-primary:hover .tpl-icon {
    transform: translateX(2px);
}

.tql-use-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tql-btn-secondary {
    height: 44px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--tpl-slate-200), 0 1px 2px rgba(15, 23, 42, 0.05);
    color: var(--tpl-slate-700);
}

.tql-btn-secondary:hover {
    background: var(--tpl-slate-50);
    color: var(--tpl-slate-900);
}

.tql-nav {
    grid-area: nav;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 18px 24px 20px 28px;
    padding-top: 16px;
    border-top: 1px solid var(--tpl-slate-100);
}

.tql--single .tql-nav {
    visibility: hidden;
}

.tql-nav-btn {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--tpl-slate-200);
    color: var(--tpl-slate-700);
    cursor: pointer;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.tql-nav-btn:hover {
    background: var(--tpl-slate-50);
    color: var(--tpl-indigo-600);
}

.tql-count {
    margin: 0;
    color: var(--tpl-slate-500);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    line-height: 18px;
    text-align: center;
}

.tql-count b {
    color: var(--tpl-slate-700);
    font-weight: 700;
}

.tql-swipe {
    display: none;
}

.tql-swipe-sep {
    margin: 0 4px;
    color: var(--tpl-slate-300);
}

.tql-close:focus-visible,
.tql-nav-btn:focus-visible,
.tql-btn:focus-visible,
.tql-live:focus-visible,
.tql-device-btn:focus-visible {
    outline: 2px solid var(--tpl-indigo-500);
    outline-offset: 2px;
}

/* Stage: live preview with the device toggle. */
.tql-stage {
    grid-area: stage;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(224, 231, 255, 0.55), rgba(241, 245, 249, 0) 60%),
        var(--tpl-slate-100);
    box-shadow: inset -1px 0 0 var(--tpl-slate-200);
}

.tql-toolbar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 60px;
    padding: 0 20px;
}

.tql-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--tpl-slate-200), 0 1px 2px rgba(15, 23, 42, 0.05);
    color: var(--tpl-slate-700);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.tql-live[hidden] {
    display: none;
}

.tql-live:hover {
    color: var(--tpl-indigo-600);
    box-shadow: inset 0 0 0 1px var(--tpl-indigo-100), 0 1px 2px rgba(15, 23, 42, 0.05);
}

.tql-live .tpl-icon {
    width: 13px;
    height: 13px;
    color: var(--tpl-slate-400);
}

.tql-live-dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tpl-emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.tql-devices {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    padding: 3px;
    border-radius: 10px;
    background: rgba(226, 232, 240, 0.9);
}

.tql--static .tql-devices {
    display: none;
}

.tql-device-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tpl-slate-500);
    cursor: pointer;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.tql-device-btn:hover {
    color: var(--tpl-slate-900);
}

.tql-device-btn[aria-pressed="true"] {
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
    color: var(--tpl-indigo-600);
}

.tql-viewport {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    padding: 0 20px 20px;
}

.tql-device {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 22px 40px -16px rgba(15, 23, 42, 0.3);
}

.tql-device-bar {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    background: #fff;
    box-shadow: inset 0 -1px 0 var(--tpl-slate-100);
}

.tql-device-bar i {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tpl-slate-200);
}

.tql-device-url {
    position: absolute;
    left: 50%;
    max-width: 55%;
    height: 18px;
    overflow: hidden;
    padding: 0 10px;
    border-radius: 6px;
    background: var(--tpl-slate-100);
    color: var(--tpl-slate-500);
    font-size: 11px;
    font-weight: 500;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateX(-50%);
}

.tql-device-url:empty {
    display: none;
}

.tql-screen {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--tpl-slate-50);
}

.tql-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.tql-poster[hidden] {
    display: none;
}

/* Desktop screenshots fit the width and crop at the bottom, like the live page scaled into the frame. */
.tql-screen[data-poster="desktop"] .tql-poster {
    bottom: auto;
    height: auto;
    object-fit: fill;
}

.tql-frame {
    position: absolute;
    left: 0;
    top: 0;
    border: 0;
    background: #fff;
    transform-origin: 0 0;
    transition: opacity 0.25s ease-out;
}

.tql-screen.is-loading .tql-frame {
    opacity: 0;
}

.tql-loading {
    position: absolute;
    left: 50%;
    bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 14px 0 12px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    transform: translateX(-50%);
}

.tql-screen.is-loading .tql-loading {
    display: inline-flex;
}

.tql-spinner .tpl-icon {
    width: 14px;
    height: 14px;
    animation: tql-spin 0.9s linear infinite;
}

@keyframes tql-spin {
    to {
        transform: rotate(360deg);
    }
}

.tql-device[data-device="tablet"],
.tql-device[data-device="mobile"] {
    padding: 10px;
    border-radius: 30px;
    background: var(--tpl-slate-900);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2), 0 24px 44px -16px rgba(15, 23, 42, 0.45);
}

.tql-device[data-device="mobile"] {
    padding: 9px;
    border-radius: 40px;
}

.tql-device[data-device="tablet"] .tql-device-bar,
.tql-device[data-device="mobile"] .tql-device-bar {
    display: none;
}

.tql-device[data-device="tablet"] .tql-screen {
    border-radius: 20px;
}

.tql-device[data-device="mobile"] .tql-screen {
    border-radius: 31px;
}

/* Narrow desktop (tablets in landscape/portrait): slimmer rail. */
@media (max-width: 1023px) {
    .tql {
        padding: 16px;
    }

    .tql-dialog {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    .tql-head {
        padding: 24px 20px 0 22px;
    }

    .tql-chip {
        margin: 12px 20px 0 22px;
    }

    .tql-ticks {
        margin: 20px 20px 0 22px;
    }

    .tql-cta {
        padding: 0 20px 0 22px;
    }

    .tql-nav {
        margin: 16px 20px 18px 22px;
    }

    .tql-viewport {
        padding: 0 14px 14px;
    }

    .tql-toolbar {
        padding: 0 14px;
    }
}

/* Phones: bottom sheet with a swipeable screenshot. */
@media (max-width: 767px) {
    .tql {
        align-items: flex-end;
        padding: 0;
    }

    .tql-backdrop {
        background: rgba(15, 23, 42, 0.5);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .tql-dialog {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        top: max(56px, 11vh);
        display: flex;
        flex-direction: column;
        width: auto;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.18);
        opacity: 1;
        transform: translateY(100%);
        transition: transform 0.34s var(--tpl-ease);
        touch-action: pan-y;
    }

    .tql.is-open .tql-dialog {
        transform: none;
    }

    .tql-dialog.is-dragging,
    .tql-dialog.is-dragging .tql-stage {
        transition: none;
    }

    .tql-grab {
        display: block;
        flex: none;
        width: 36px;
        height: 4px;
        margin: 0 auto 12px;
        border-radius: 2px;
        background: var(--tpl-slate-300);
    }

    .tql-head {
        flex: none;
        padding: 0;
    }

    .tql-title {
        font-size: 20px;
        line-height: 26px;
    }

    .tql-sub {
        margin: 0;
        font-size: 14px;
        line-height: 20px;
    }

    .tql-close {
        width: 32px;
        height: 32px;
        margin: 0;
    }

    .tql-chip {
        flex: none;
        align-self: flex-start;
        max-width: 100%;
        margin: 10px 0 0;
    }

    .tql-stage {
        flex: 1 1 auto;
        min-height: 240px;
        margin-top: 12px;
        overflow: hidden;
        border-radius: 16px;
        background: var(--tpl-slate-100);
        box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
        transition: transform 0.25s var(--tpl-ease), opacity 0.25s ease-out;
    }

    .tql-toolbar {
        height: 32px;
        padding: 0 12px;
        background: var(--tpl-slate-50);
        box-shadow: inset 0 -1px 0 var(--tpl-slate-200);
    }

    .tql-live {
        flex: 1;
        height: 32px;
        padding: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .tql-live:hover {
        box-shadow: none;
    }

    .tql-live .tpl-icon {
        margin-left: auto;
        width: 14px;
        height: 14px;
    }

    .tql-devices {
        display: none;
    }

    .tql--no-live .tql-toolbar {
        display: none;
    }

    .tql-viewport {
        align-items: stretch;
        padding: 0;
    }

    .tql-device,
    .tql-device[data-device="sheet"] {
        flex: 1;
        width: auto;
        height: auto;
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .tql-device-bar {
        display: none;
    }

    .tql-screen {
        border-radius: 0;
        background: #fff;
    }

    .tql-ticks {
        display: none;
    }

    .tql-cta {
        display: flex;
        flex: none;
        gap: 8px;
        margin-top: 14px;
        padding: 0;
    }

    .tql-btn-primary {
        flex: 1 1 auto;
        padding: 0 14px;
    }

    .tql-btn-secondary {
        flex: 0 0 auto;
        height: 48px;
        padding: 0 16px;
    }

    .tql-nav {
        flex: none;
        margin: 8px 0 0;
        padding: 0;
        border: 0;
    }

    .tql-nav-btn {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        background: transparent;
        box-shadow: none;
        color: var(--tpl-slate-400);
    }

    .tql-count {
        font-size: 12px;
        line-height: 16px;
    }

    .tql-swipe {
        display: inline;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tpl-stage,
    .tpl-stage::before,
    .tpl-win,
    .tpl-ph,
    .tpl-ql,
    .tql-backdrop,
    .tql-dialog,
    .tql-stage,
    .tql-frame {
        transition: none !important;
    }

    .tql-spinner .tpl-icon {
        animation-duration: 2s;
    }
}
