/* Extra controls used by multi-option tools inside .ts-tool */

.ts-tool__field {
    margin-bottom: 0.9rem;
}

.ts-tool__select,
.ts-tool__range,
.ts-tool__number {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1.5px solid rgba(15, 118, 110, 0.22);
    background: #fff;
    font-family: var(--ts-sans);
    font-size: 0.95rem;
    color: var(--ts-ink);
}

.ts-tool__color {
    width: 3.25rem;
    height: 2.5rem;
    max-width: 3.25rem;
    padding: 0.2rem;
    border-radius: 10px;
    border: 1.5px solid rgba(15, 118, 110, 0.22);
    background: #fff;
    cursor: pointer;
}

.ts-tool__select:focus,
.ts-tool__range:focus,
.ts-tool__number:focus,
.ts-tool__color:focus {
    border-color: var(--ts-accent);
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.ts-tool__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.ts-tool__actions:empty,
.ts-tool__actions:not(:has(> :not([hidden]))) {
    display: none;
}

.ts-tool__btn--ghost {
    background: #fff;
    color: var(--ts-accent);
    border: 1.5px solid rgba(15, 118, 110, 0.28);
    box-shadow: none;
}

.ts-tool__btn--ghost:hover {
    filter: none;
    background: var(--ts-accent-soft);
}

.ts-tool__btn:disabled,
.ts-tool__download:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.ts-tool__preview canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.ts-tool progress {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    accent-color: var(--ts-accent);
}

.ts-tool__options {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 14px;
    background: linear-gradient(160deg, #f0fdfa, #fff);
    border: 1px solid rgba(15, 118, 110, 0.14);
}

.ts-tool__options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: end;
}

.ts-tool__check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--ts-sans);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ts-ink);
    cursor: pointer;
}

.ts-tool__screenshot-wrap {
    margin-top: 1.1rem;
    padding: 0.85rem;
    border-radius: var(--ts-radius-sm);
    background: linear-gradient(160deg, #f0fdfa, #fff);
    border: 1px dashed rgba(15, 118, 110, 0.22);
    overflow: auto;
    max-height: min(72vh, 720px);
    -webkit-overflow-scrolling: touch;
}

.ts-tool__screenshot-wrap canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
}

@media (max-width: 640px) {
    .ts-tool__options-row {
        grid-template-columns: 1fr;
    }

    .ts-tool__options .ts-tool__input,
    .ts-tool__options .ts-tool__range,
    .ts-tool__options .ts-tool__select,
    .ts-tool__options .ts-tool__number {
        font-size: 16px; /* prevent iOS zoom */
    }
}

@media (max-width: 400px) {
    .ts-tool__field > .ts-tool__input,
    .ts-tool__field > .ts-tool__select,
    .ts-tool__options .ts-tool__input,
    .ts-tool__options .ts-tool__select,
    .ts-tool__options .ts-tool__range,
    .ts-tool__options .ts-tool__number {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        padding: 0.8rem 0.9rem;
    }

    .ts-tool__row {
        flex-direction: column;
    }

    .ts-tool__row .ts-tool__input {
        width: 100%;
    }

    .ts-tool__row .ts-tool__btn,
    .ts-tool__actions .ts-tool__btn,
    .ts-tool__actions .ts-tool__download {
        width: 100%;
    }

    .ts-tool__options {
        padding: 0.85rem;
    }

    .ts-tool__options-row {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .ts-tool__range {
        width: 100%;
        min-height: 2.25rem;
    }

    .ts-tool__color {
        width: 100%;
        max-width: none;
        height: 2.75rem;
    }
}
