:root {
    --primary: #5DADE2;
    --primary-dark: #2E86AB;
    --primary-light: #AED6F1;
    --white: #ffffff;
    --light-bg: #f8fafc;
    --text-dark: #1a1a2e;
    --text-gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --focus-ring: 0 0 0 3px rgba(93, 173, 226, 0.4);
    --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--light-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.hidden {
    display: none !important;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 200;
    background: var(--primary);
    color: var(--white);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---------- Header & Navigation ---------- */

header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 20px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-dark);
    transition: color 0.3s;
    border-radius: 6px;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
}

.nav-item {
    position: relative;
}

.dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: var(--white);
    box-shadow: var(--shadow-hover);
    border-radius: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 50;
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li {
    padding: 12px 20px;
    border-bottom: 1px solid var(--light-bg);
}

.dropdown li:last-child {
    border-bottom: none;
}

.dropdown a {
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown a:hover {
    color: var(--primary);
}

.dropdown .badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ---------- Tool page header ---------- */

.tool-header {
    padding: 40px 0 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--white) 100%);
}

.tool-header h1 {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
    line-height: 1.2;
}

.tool-header .subtitle {
    color: var(--text-gray);
    font-size: clamp(15px, 2.4vw, 18px);
    max-width: 620px;
    margin: 0 auto;
}

.privacy-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 18px;
    background: var(--white);
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
    box-shadow: var(--shadow);
}

.privacy-note svg {
    flex-shrink: 0;
    color: var(--primary);
}

/* ---------- Tool card ---------- */

.tool-main {
    max-width: 660px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.dropzone {
    border: 2px dashed var(--primary-light);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--light-bg);
    transition: border-color 0.2s, background-color 0.2s;
    touch-action: manipulation;
}

.dropzone:hover,
.dropzone:focus-visible {
    border-color: var(--primary);
    background: var(--white);
}

.dropzone.dragover {
    border-color: var(--primary);
    background: var(--white);
}

.dropzone__icon {
    color: var(--primary);
    margin-bottom: 10px;
}

.dropzone__title {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--text-dark);
}

.dropzone__hint {
    margin: 0;
    font-size: 14px;
    color: var(--text-gray);
}

/* ---------- File summary ---------- */

.file-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--light-bg);
    border: 1px solid var(--border);
}

.file-summary__icon {
    color: var(--primary);
    flex-shrink: 0;
}

.file-summary__meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-summary__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-summary__detail {
    font-size: 13px;
    color: var(--text-gray);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.icon-button:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* ---------- Target pills ---------- */

.targets {
    border: none;
    padding: 0;
    margin: 24px 0 0;
}

.targets__legend {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    padding: 0;
    margin-bottom: 10px;
}

.targets__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.target-pill input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.target-pill span {
    display: inline-block;
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.target-pill span:hover {
    border-color: var(--primary);
}

.target-pill input:checked + span {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.target-pill input:focus-visible + span {
    box-shadow: var(--focus-ring);
}

.targets__custom {
    margin-top: 14px;
}

.targets__custom-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.targets__custom-input {
    display: inline-flex;
    align-items: stretch;
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--white);
    transition: border-color 0.2s;
}

.targets__custom-input:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.targets__custom-input input {
    width: 120px;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--text-dark);
}

.targets__custom-input select {
    border: none;
    border-left: 2px solid var(--border);
    outline: none;
    background: var(--light-bg);
    padding: 0 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    cursor: pointer;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-dark);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.actions .btn {
    flex: 1;
}

/* ---------- Progress ---------- */

.progress {
    margin-top: 20px;
}

.progress__bar {
    height: 10px;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: width 0.2s ease;
}

.progress__label {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--text-gray);
}

/* ---------- Error ---------- */

.error {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--light-bg);
    border: 1px solid var(--primary);
    color: var(--primary-dark);
    font-weight: 500;
}

/* ---------- Results ---------- */

.results {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

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

.results__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.results__message {
    margin: 8px 0 16px;
    color: var(--text-gray);
    font-size: 15px;
}

.badge {
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge--success {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge--muted {
    background: var(--light-bg);
    color: var(--text-gray);
    border: 1px solid var(--border);
}

/* ---------- Compare ---------- */

.results__compare {
    margin-bottom: 20px;
}

.compare {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 280px;
    max-height: 460px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--light-bg);
    user-select: none;
    touch-action: pan-y;
}

.compare__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.compare__img--after {
    display: block;
}

.compare__img--before {
    display: block;
    clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
}

.compare__label {
    position: absolute;
    top: 10px;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(26, 26, 46, 0.65);
    color: var(--white);
    pointer-events: none;
}

.compare__label--before {
    left: 10px;
}

.compare__label--after {
    right: 10px;
}

.compare__divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos, 50%);
    width: 2px;
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-1px);
    pointer-events: none;
}

.compare__handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--white);
    background: var(--primary);
    color: var(--white);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.compare__handle::before {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(-45deg) translate(1px, 1px);
}

.compare__handle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg) translate(-1px, 1px);
}

/* ---------- Info grid ---------- */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0 0 20px;
}

.info-card {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--light-bg);
}

.info-card__title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.info-card__row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 5px 0;
    font-size: 14px;
    border-bottom: 1px dashed var(--border);
}

.info-card__row:last-child {
    border-bottom: none;
}

.info-card__row span {
    color: var(--text-gray);
}

.info-card__row b {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.results__actions {
    display: flex;
    justify-content: center;
}

#download-link {
    width: 100%;
}

/* ---------- SEO content ---------- */

.seo-section {
    padding: 60px 0;
}

.seo-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.seo-content h2 {
    font-size: 24px;
    color: var(--primary-dark);
    margin: 0 0 15px;
}

.seo-content h2:not(:first-child) {
    margin-top: 40px;
}

.seo-content h3 {
    font-size: 18px;
    color: var(--text-dark);
    margin: 25px 0 12px;
}

.seo-content p {
    color: var(--text-gray);
    font-size: 15px;
    margin-bottom: 15px;
}

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.steps li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.steps__num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
    margin-top: 2px;
}

.steps h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.steps p {
    margin: 0;
}

/* ---------- FAQ ---------- */

.faq {
    display: grid;
    gap: 0;
}

.faq__item {
    border-bottom: 1px solid var(--border);
}

.faq__item:first-child {
    border-top: 1px solid var(--border);
}

.faq__item summary {
    padding: 14px 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--text-dark);
}

.faq__item summary::-webkit-details-marker {
    display: none;
}

.faq__item summary::after {
    content: "";
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg) translateY(-3px);
    transition: transform 0.15s ease;
}

.faq__item[open] summary::after {
    transform: rotate(225deg) translateY(-1px);
}

.faq__item summary:focus-visible {
    box-shadow: var(--focus-ring);
    border-radius: 6px;
}

.faq__item p {
    margin: 0;
    padding: 0 0 16px;
    color: var(--text-gray);
}

/* ---------- Footer ---------- */

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-gray);
    font-size: 14px;
}

footer p {
    margin: 0 0 4px;
}

footer a {
    color: var(--primary-dark);
    font-weight: 500;
}

footer a:hover {
    color: var(--primary);
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 20px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }

    .tool-header {
        padding: 32px 0 16px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .seo-content {
        padding: 28px 20px;
    }

    .card {
        padding: 20px;
    }

    .target-pill span {
        padding: 10px 14px;
    }
}

/* ---------- Mobile navigation ---------- */

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 110;
    touch-action: manipulation;
}

.menu-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.4);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--primary-dark);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 10px 20px 20px;
        background: var(--white);
        box-shadow: var(--shadow-hover);
        border-top: 1px solid var(--border);
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        text-align: left;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        z-index: 105;
    }

    .nav-menu.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-menu > li {
        width: 100%;
        padding: 0;
        border-bottom: 1px solid var(--light-bg);
    }

    .nav-menu > li > a {
        display: block;
        padding: 14px 0;
        font-size: 16px;
    }

    .nav-item > a {
        cursor: default;
    }

    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        min-width: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 12px 18px;
        transition: none;
    }

    .dropdown li {
        padding: 0;
        border-bottom: none;
    }

    .dropdown a {
        display: block;
        justify-content: flex-start;
        padding: 10px 0;
        font-size: 15px;
    }
}
