/* Best IT Free Tools — mobile-first, logical properties for LTR/RTL */

body:has(.tools-page) .header .logo img {
    height: 40px !important;
}

.tools-page {
    padding-bottom: 4.5rem;
    background: #f8fafc;
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
}

.tools-page--tool {
    padding-bottom: 5rem;
}

.tools-page .container {
    max-width: 100%;
}

.tools-hero {
    padding: 5rem 0 1.75rem;
    background: linear-gradient(160deg, #2e1065 0%, #552a86 48%, #7c3aed 120%);
    color: #fff;
    overflow-x: hidden;
    overflow-x: clip;
}

.tools-hero--slim {
    padding: 4.35rem 0 0.65rem;
}

.tools-hero--compact {
    padding-bottom: 1.25rem;
}

.tools-hero__title {
    margin: 0;
    font-size: clamp(1.05rem, 4.2vw, 1.65rem);
    font-weight: 800;
    line-height: 1.35;
    color: #fff !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.tools-hero--slim .tools-hero__title {
    font-size: clamp(1.05rem, 4vw, 1.45rem);
}

.tools-hero__sub,
.tools-hero__promise {
    margin: 0 0 1rem;
    max-width: 40rem;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.tools-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.tools-breadcrumb a {
    color: #e9d5ff;
    text-decoration: none;
}

.tools-breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
}

.tools-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tools-trust--inline {
    gap: 0.35rem;
    margin-bottom: 0.65rem;
    max-width: 100%;
}

.tools-trust__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.8rem;
    color: #fff;
}

.tools-trust__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: #f3e8ff;
    color: #552a86;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 100%;
}

.tools-body {
    margin-top: -0.35rem;
    min-width: 0;
}

.tools-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.85rem;
    box-shadow: 0 8px 24px rgba(85, 42, 134, 0.07);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

.tools-workspace {
    display: grid;
    gap: 0.85rem;
}

@media (min-width: 768px) {
    .tools-workspace {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        align-items: start;
    }
}

.tools-workspace__output {
    min-height: 140px;
    border: 1px dashed #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tools-output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: #94a3b8;
    font-size: 0.875rem;
    text-align: center;
}

.tools-output-placeholder .bi {
    font-size: 1.5rem;
}

.tools-toolbar {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.tools-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

.tools-actions-bar .tools-btn {
    flex: 1 1 calc(50% - 0.45rem);
    min-width: 0;
    min-height: 42px;
    width: auto;
}

.tools-actions-bar .tools-btn--quiet {
    flex: 1 1 100%;
    min-width: 0;
    width: auto;
}

@media (max-width: 379.98px) {
    .tools-actions-bar .tools-btn {
        flex: 1 1 100%;
    }
}

@media (min-width: 576px) {
    .tools-actions-bar .tools-btn {
        flex: 0 1 auto;
        min-width: 7rem;
    }
    .tools-actions-bar .tools-btn--quiet {
        flex: 0 0 auto;
    }
}

.tools-widget-run[hidden] {
    display: none !important;
}

.tools-dropzone {
    min-height: 100px;
    padding: 1rem 0.75rem;
}

.tools-options {
    margin-top: 0.65rem;
    gap: 0.55rem;
}

.tools-seg__btn {
    min-height: 34px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
}

.tools-result {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    width: 100%;
}

.tools-result__preview {
    margin-bottom: 0.5rem;
}

.tools-result__preview img,
.tools-result__preview canvas,
.tools-result__preview video {
    max-height: 220px;
}

.tools-result__stats {
    justify-content: center;
    font-size: 0.8rem;
}

.tools-download-modal__note {
    margin-bottom: 0.75rem;
    color: #334155;
}

.tools-download-modal__countdown {
    font-weight: 700;
    color: #552a86;
    margin-bottom: 0.75rem;
}

.tools-download-modal__trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
}

.tools-download-modal__trust span {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
}

.tools-ad--modal {
    min-height: 120px;
    margin: 0.5rem 0;
}

.tools-ad-placeholder__box {
    display: grid;
    place-items: center;
    min-height: 100px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 0.85rem;
}

.tools-section-title {
    margin: 1.25rem 0 0.65rem;
    font-size: 1.05rem;
}

.tools-how {
    margin-top: 0.5rem;
}

.tools-sidebar__box {
    top: 4.75rem;
    padding: 0.75rem;
}

.tools-sidebar__list a {
    min-height: 38px;
    font-size: 0.9rem;
}

.tools-search {
    position: relative;
    margin: 1rem 0;
    max-width: 28rem;
}

.tools-search > .bi-search {
    position: absolute;
    inset-inline-start: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}

.tools-search__input {
    width: 100%;
    min-height: 48px;
    padding: 0.65rem 1rem;
    padding-inline-start: 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
    color: #0f172a;
}

.tools-search__input:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 1px;
    border-color: #7c3aed;
}

.tools-cat-chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tools-cat-chips::-webkit-scrollbar {
    display: none;
}

.tools-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.tools-chip.is-active,
.tools-chip:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: #fff;
}

.tools-body {
    margin-top: -0.75rem;
}

.tools-section-title {
    margin: 1.75rem 0 0.85rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: #552a86 !important;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 576px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tools-card-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 8px 24px rgba(85, 42, 134, 0.06);
    transition: border-color 150ms ease, box-shadow 150ms ease;
    cursor: pointer;
    min-height: 88px;
}

.tools-card-link:hover,
.tools-card-link:focus-visible {
    border-color: #c4b5fd;
    box-shadow: 0 10px 28px rgba(85, 42, 134, 0.12);
    color: inherit;
}

.tools-card-link__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #f3e8ff;
    color: #552a86;
    font-size: 1.25rem;
}

.tools-card-link__body {
    flex: 1 1 auto;
    min-width: 0;
}

.tools-card-link__name {
    display: block;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.2rem;
}

.tools-card-link__desc {
    display: block;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.4;
}

.tools-card-link__arrow {
    color: #94a3b8;
}

.tools-layout {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 1200px) {
    .tools-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
        align-items: start;
    }
}

.tools-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(85, 42, 134, 0.08);
}

.tools-sidebar__box {
    position: sticky;
    top: 5.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.tools-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tools-sidebar__list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.35rem 0.25rem;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.tools-sidebar__list a:hover {
    color: #552a86;
}

.tools-btn {
    min-height: 48px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tools-btn--lg {
    width: 100%;
}

.tools-btn--primary-block {
    width: 100%;
    min-height: 52px;
}

.tools-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.5rem 1rem;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
    min-height: 140px;
}

.tools-dropzone.is-dragover {
    border-color: #7c3aed;
    background: #f3e8ff;
}

.tools-dropzone__title {
    margin: 0;
    font-weight: 700;
    color: #0f172a;
}

.tools-dropzone__hint {
    margin: 0;
    font-size: 0.875rem;
    color: #475569;
}

.tools-file-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tools-file-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.tools-file-item__thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f5f9;
}

.tools-file-item__meta {
    flex: 1 1 auto;
    min-width: 0;
}

.tools-file-item__name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tools-file-item__size {
    font-size: 0.8rem;
    color: #64748b;
}

.tools-file-item__actions {
    display: flex;
    gap: 0.25rem;
}

.tools-file-item__actions button {
    min-width: 40px;
    min-height: 40px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    color: #334155;
    cursor: pointer;
}

.tools-file-item__actions button:hover {
    background: #e2e8f0;
}

.tools-options {
    margin-top: 1rem;
    display: grid;
    gap: 0.75rem;
}

.tools-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f172a;
}

.tools-field input,
.tools-field select,
.tools-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
    color: #0f172a;
}

.tools-field textarea {
    min-height: 120px;
    resize: vertical;
}

.tools-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tools-seg__btn {
    min-height: 40px;
    padding: 0.35rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.tools-seg__btn.is-active {
    background: #552a86;
    border-color: #552a86;
    color: #fff;
}

.tools-result {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.tools-result__preview {
    display: flex;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.tools-result__preview img,
.tools-result__preview canvas,
.tools-result__preview video,
.tools-result__preview audio {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.tools-result__preview video {
    max-height: 280px;
    background: #0f172a;
}
.tools-result__preview audio {
    width: 100%;
    border: none;
    background: transparent;
}

.tools-result__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    font-size: 0.875rem;
    color: #475569;
}

.tools-result__actions {
    display: grid;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .tools-result__actions {
        grid-template-columns: 1fr 1fr;
    }

    .tools-result__actions [data-action="download"] {
        grid-column: 1 / -1;
    }
}

.tools-progress {
    margin-top: 0.85rem;
}

.tools-progress__bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.tools-progress__fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #552a86, #7c3aed);
    transition: width 200ms ease;
}

.tools-progress__label {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: #475569;
}

.tools-toast {
    margin-top: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: #ecfdf5;
    color: #065f46;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.tools-toast[hidden] {
    display: none !important;
}
.tools-toast .bi {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}
.tools-toast.is-success {
    background: #ecfdf5;
    color: #065f46;
}
.tools-toast.is-success .bi {
    color: #16a34a;
}
.tools-toast.is-error {
    background: #fef2f2;
    color: #991b1b;
}
.tools-toast.is-error .bi {
    color: #dc2626;
}

.tools-file-item.is-ready {
    border-color: #86efac;
    background: #f0fdf4;
}
.tools-file-item__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #16a34a;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.tools-file-item__thumb--video,
.tools-file-item__thumb--audio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #552a86;
    font-size: 1.25rem;
}
.tools-dropzone.is-ready {
    border-color: #86efac;
    background: #f0fdf4;
}
.tools-dropzone.is-ready .bi-check-circle-fill {
    color: #16a34a;
}

.tools-how__list {
    margin: 0;
    padding-inline-start: 1.25rem;
    color: #334155;
    line-height: 1.7;
}

.tools-next__grid {
    display: grid;
    gap: 0.65rem;
}

@media (min-width: 576px) {
    .tools-next__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tools-next__card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 52px;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.tools-next__card:hover {
    border-color: #c4b5fd;
    color: #552a86;
}

.tools-related__all {
    margin-top: 1rem;
    text-align: center;
}

.tools-ad {
    margin: 1.5rem 0;
    min-height: 100px;
}

.tools-ad--sidebar {
    min-height: 250px;
}

.tools-sticky-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1040;
    padding: 0.65rem 0;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}

.tools-sticky-bar__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.tools-empty {
    text-align: center;
    color: #64748b;
    margin: 2rem 0;
}

.tools-guide {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.tools-faq {
    margin-top: 1.5rem;
}

.tools-faq .accordion-button:not(.collapsed) {
    background: #f3e8ff;
    color: #552a86;
}

.tools-faq .accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a.lang-switcher__option {
    text-decoration: none;
    color: #243047 !important;
}
a.lang-switcher__option:hover,
a.lang-switcher__option:focus-visible {
    color: #3d4d6a !important;
}
a.lang-switcher__option.is-active {
    color: #552a86 !important;
}

.tools-word-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
}

@media (min-width: 576px) {
    .tools-word-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tools-stat {
    padding: 0.75rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.tools-stat__value {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: #552a86;
}

.tools-stat__label {
    font-size: 0.8rem;
    color: #64748b;
}

.tools-page-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.85rem;
}

@media (min-width: 576px) {
    .tools-page-thumbs {
        grid-template-columns: repeat(4, 1fr);
    }
}

.tools-page-thumb {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 3 / 4;
    background: #f1f5f9;
}

.tools-page-thumb.is-selected {
    border-color: #552a86;
}

.tools-page-thumb img,
.tools-page-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tools-page-thumb__num {
    position: absolute;
    inset-inline-start: 0.25rem;
    bottom: 0.25rem;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
    .tools-card-link,
    .tools-chip,
    .tools-progress__fill,
    .tools-dropzone {
        transition: none !important;
    }
}

/* ---- compact tool layout overrides (win over earlier rules) ---- */
.tools-page--tool .tools-card {
    padding: 0.85rem;
}
.tools-page--tool .tools-dropzone {
    min-height: 100px;
    padding: 1rem 0.75rem;
}
.tools-page--tool .tools-result {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.tools-page--tool .tools-result__actions {
    display: none;
}
.tools-workspace--single {
    grid-template-columns: 1fr !important;
}
.tools-sticky-bar__inner {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}
.tools-btn--primary-block {
    width: auto;
}

@media (min-width: 768px) {
    .tools-sticky-bar {
        display: none !important;
    }
}

.tools-sticky-bar .tools-btn {
    min-height: 42px;
    font-size: 0.9rem;
}

/* ---- inline labels + QR accordion styles ---- */
.tools-field--row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 8.5rem) minmax(0, 1fr);
    gap: 0.45rem 0.65rem;
    align-items: center;
    margin-bottom: 0.55rem;
}
.tools-field--row > label {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.2;
}
.tools-field--row input,
.tools-field--row select,
.tools-field--row textarea {
    width: 100%;
    min-height: 38px;
    margin: 0;
}
.tools-field--row textarea {
    min-height: 64px;
    align-self: start;
}
.tools-field--row > label[for="qr-content"],
.tools-field--row:has(textarea) > label {
    align-self: start;
    padding-top: 0.45rem;
}
.tools-field--stack {
    display: grid;
    gap: 0;
}
@media (max-width: 420px) {
    .tools-field--row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    .tools-field--row:has(textarea) > label {
        padding-top: 0;
    }
}

.tools-seg--scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    width: 100%;
    padding-bottom: 0.25rem;
    margin-bottom: 0.65rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.tools-seg--scroll::-webkit-scrollbar { height: 4px; }
.tools-seg--scroll .tools-seg__btn {
    flex: 0 0 auto;
}

.tools-acc {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 0.45rem;
    overflow: hidden;
}
.tools-acc__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: #0f172a;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.tools-acc__summary::-webkit-details-marker { display: none; }
.tools-acc__summary .bi { color: #552a86; }
.tools-acc__body {
    padding: 0.15rem 0.75rem 0.75rem;
    border-top: 1px solid #f1f5f9;
}
.tools-inline-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.tools-inline-colors input[type="color"] {
    width: 42px;
    min-height: 38px;
    padding: 0.15rem;
}
.tools-inline-colors select {
    min-width: 6.5rem;
    flex: 1 1 auto;
}
.tools-range-wrap {
    display: grid;
    gap: 0.2rem;
}
.tools-range-wrap span {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
}
.tools-shape-group {
    border: 0;
    margin: 0 0 0.75rem;
    padding: 0;
}
.tools-shape-group legend {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.35rem;
}
.tools-shape-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.tools-shape {
    width: 40px;
    height: 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}
.tools-shape.is-active,
.tools-shape:hover {
    border-color: #552a86;
    background: #f3e8ff;
}
.tools-shape__sq,
.tools-shape__rounded,
.tools-shape__extra,
.tools-shape__classy,
.tools-shape__classy-r {
    width: 14px;
    height: 14px;
    background: #0f172a;
}
.tools-shape__rounded { border-radius: 3px; }
.tools-shape__extra { border-radius: 6px; }
.tools-shape__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0f172a;
}
.tools-shape__classy {
    clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%);
}
.tools-shape__classy-r {
    border-radius: 4px 4px 0 4px;
}
/* Eye frame = hollow versions of the same body shapes */
.tools-shape__frame {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2.5px solid #0f172a;
    background: transparent;
}
.tools-shape__frame--sq { border-radius: 0; }
.tools-shape__frame--rounded { border-radius: 3px; }
.tools-shape__frame--dot { border-radius: 50%; }
.tools-shape__frame--classy {
    border: none;
    background:
        linear-gradient(#0f172a, #0f172a) top / 100% 2.5px no-repeat,
        linear-gradient(#0f172a, #0f172a) right / 2.5px 100% no-repeat,
        linear-gradient(#0f172a, #0f172a) bottom / 80% 2.5px no-repeat,
        linear-gradient(#0f172a, #0f172a) left / 2.5px 80% no-repeat;
    clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%);
}
.tools-shape__frame--classy-r { border-radius: 5px 5px 1px 5px; }
.tools-shape__frame--extra { border-radius: 7px; }

/* Default tool fields also prefer row layout on wider screens */
@media (min-width: 576px) {
    .tools-widget .tools-field:not(.tools-field--row):not(.tools-field--stack) {
        display: grid;
        grid-template-columns: minmax(5.5rem, 8.5rem) minmax(0, 1fr);
        gap: 0.45rem 0.65rem;
        align-items: center;
    }
    .tools-widget .tools-field:not(.tools-field--row):not(.tools-field--stack) > label {
        margin: 0;
    }
}

/* ---- split card: actions under result (desktop: under preview column) ---- */
.tools-card--split {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "controls"
        "output"
        "toolbar";
}
.tools-card--split .tools-workspace__controls,
.tools-card--split .tools-workspace__output,
.tools-card--split .tools-toolbar {
    min-width: 0;
    max-width: 100%;
}
.tools-card--split .tools-workspace__controls { grid-area: controls; }
.tools-card--split .tools-workspace__output { grid-area: output; }
.tools-card--split .tools-toolbar {
    grid-area: toolbar;
    margin-top: 0;
    padding-top: 0.65rem;
    border-top: 1px solid #e2e8f0;
}
.tools-widget {
    min-width: 0;
    max-width: 100%;
}
@media (min-width: 768px) {
    .tools-card--split {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        grid-template-areas:
            "controls output"
            "controls toolbar";
        align-items: start;
    }
    .tools-card--split .tools-toolbar {
        border-top: 1px solid #e2e8f0;
        padding-top: 0.65rem;
        margin-top: 0.15rem;
    }
    .tools-card--split .tools-workspace__output {
        min-height: 180px;
    }
    .tools-card--split .tools-actions-bar {
        flex-wrap: wrap;
    }
    .tools-card--split .tools-actions-bar .tools-btn {
        flex: 1 1 calc(50% - 0.45rem);
        min-width: 0;
    }
}
.tools-workspace--single {
    display: contents;
}
