.imgconv-page {
    --imgconv-border: rgba(255, 255, 255, 0.11);
    --imgconv-soft: rgba(170, 220, 205, 0.1);
}

.imgconv-hero p {
    max-width: 860px;
}

.imgconv-capabilities {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
    padding: 14px 18px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-muted);
}

.imgconv-capabilities--warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}

.imgconv-capabilities__label {
    color: var(--text);
    font-weight: 800;
}

.imgconv-capabilities__items {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    text-align: right;
}

.imgconv-capability-ok {
    color: var(--accent);
    font-weight: 800;
}

.imgconv-capability-miss {
    color: #f59e0b;
    font-weight: 800;
}

.imgconv-shell {
    display: grid;
    gap: 22px;
}

.imgconv-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.imgconv-head h2,
.imgconv-section__title h3,
.imgconv-result-card h3,
.imgconv-error-card h3 {
    margin: 0;
    color: var(--text);
}

.imgconv-head p {
    margin: 8px 0 0;
    color: var(--text-muted);
}

.imgconv-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.imgconv-dropzone {
    display: grid;
    place-items: center;
    min-height: 200px;
    width: 100%;
    padding: 22px;
    border: 2px dashed rgba(170, 220, 205, 0.42);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.imgconv-dropzone--active {
    border-color: var(--accent);
    background: var(--imgconv-soft);
    transform: translateY(-1px);
}

.imgconv-dropzone__icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: 14px;
    border: 1px solid rgba(170, 220, 205, 0.4);
    border-radius: 8px;
    color: var(--accent);
    font-size: 28px;
}

.imgconv-dropzone__title {
    font-size: 1.05rem;
    font-weight: 800;
}

.imgconv-dropzone__hint {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.imgconv-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.imgconv-preview__thumb {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    flex: 0 0 120px;
    overflow: hidden;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background:
        linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.06) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.06) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.imgconv-preview__thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.imgconv-preview__thumb span {
    color: var(--text-muted);
    font-family: "JetBrains Mono", monospace;
    font-weight: 800;
}

.imgconv-preview__meta {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.imgconv-preview__meta strong {
    overflow-wrap: anywhere;
    color: var(--text);
}

.imgconv-preview__meta span {
    color: var(--text-muted);
}

.imgconv-section {
    display: grid;
    gap: 14px;
}

.imgconv-section__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.imgconv-section__title span {
    color: var(--accent);
    font-weight: 800;
}

.imgconv-format-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.imgconv-format-btn {
    min-width: 88px;
    padding: 12px 16px;
    border: 1px solid rgba(170, 220, 205, 0.36);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.imgconv-format-btn--active {
    border-color: var(--accent);
    background: var(--accent);
    color: #10231d;
}

.imgconv-format-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.imgconv-format-btn--source {
    border-style: dashed;
    color: var(--accent);
}

.imgconv-options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.imgconv-quality-wrap {
    display: grid;
    gap: 10px;
    min-width: min(320px, 100%);
    flex: 1 1 320px;
}

.imgconv-quality-wrap label,
.imgconv-resize-wrap label,
.imgconv-bgcolor-wrap label {
    color: var(--text);
    font-weight: 800;
}

.imgconv-quality-wrap input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.imgconv-quality-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.imgconv-resize-wrap {
    display: grid;
    gap: 10px;
    flex: 1 1 360px;
}

.imgconv-resize-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}

.imgconv-resize-fields input,
.imgconv-bgcolor-fields input[type="text"] {
    min-height: 44px;
    min-width: 0;
    width: 128px;
    padding: 0 12px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font: inherit;
}

.imgconv-lock-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(170, 220, 205, 0.36);
    border-radius: 8px;
    background: rgba(170, 220, 205, 0.08);
    cursor: pointer;
}

.imgconv-bgcolor-wrap {
    display: grid;
    gap: 10px;
    flex: 0 1 220px;
}

.imgconv-bgcolor-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}

.imgconv-bgcolor-fields input[type="color"] {
    width: 48px;
    height: 44px;
    padding: 3px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: transparent;
}

.imgconv-convert-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    max-width: min(100%, 320px);
    min-height: 48px;
    justify-self: center;
    padding: 0 1.5rem;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #10231d;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.imgconv-convert-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.imgconv-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(16, 35, 29, 0.35);
    border-top-color: #10231d;
    border-radius: 50%;
    animation: imgconv-spin 0.75s linear infinite;
}

.imgconv-convert-btn--loading .imgconv-spinner {
    display: inline-block;
}

.imgconv-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(16, 185, 129, 0.32);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.09);
}

.imgconv-result-card p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.imgconv-result-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.imgconv-result-stats span {
    display: grid;
    gap: 3px;
    min-width: 118px;
    padding: 10px 12px;
    border: 1px solid var(--imgconv-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
}

.imgconv-result-stats strong {
    color: var(--text);
}

.imgconv-result-stats small {
    color: var(--text-muted);
}

.imgconv-savings--positive {
    color: #86efac;
    font-weight: 900;
}

.imgconv-savings--negative {
    color: #fbbf24;
    font-weight: 900;
}

.imgconv-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    grid-column: 1 / -1;
}

.imgconv-download-btn,
.imgconv-reset-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 8px;
    font-weight: 900;
    text-decoration: none;
}

.imgconv-download-btn {
    background: var(--accent);
    color: #10231d;
}

.imgconv-reset-link {
    border: 1px solid rgba(170, 220, 205, 0.36);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.imgconv-error-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(248, 113, 113, 0.34);
    border-radius: 8px;
    background: rgba(248, 113, 113, 0.1);
}

.imgconv-error-card__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
    font-weight: 900;
}

.imgconv-error-card p {
    margin: 6px 0;
    color: var(--text);
}

.imgconv-error-card small {
    color: var(--text-muted);
}

.imgconv-error-card pre {
    max-height: 180px;
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    white-space: pre-wrap;
}

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

@media (max-width: 640px) {
    .imgconv-capabilities,
    .imgconv-preview,
    .imgconv-section__title,
    .imgconv-result-card {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    .imgconv-capabilities__items,
    .imgconv-result-stats {
        justify-content: flex-start;
        text-align: left;
    }

    .imgconv-preview__thumb {
        width: 100%;
        height: 180px;
        flex-basis: auto;
    }

    .imgconv-format-btn,
    .imgconv-resize-fields input,
    .imgconv-bgcolor-wrap,
    .imgconv-bgcolor-fields input[type="text"] {
        width: 100%;
    }

    .imgconv-resize-fields,
    .imgconv-bgcolor-fields,
    .imgconv-result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .imgconv-convert-btn {
        max-width: none;
        width: 100%;
    }
}
