:root {
    --ink: #0d2b59;
    --blue: #1683df;
    --blue-dark: #1467bd;
    --blue-light: #e9f7ff;
    --line: #bfe7fb;
    --muted: #62758e;
    --green: #159c70;
    --white: #fff;
    --shadow: 0 22px 65px rgba(35, 118, 177, .12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 8% 16%, rgba(102, 200, 247, .2), transparent 27rem),
        radial-gradient(circle at 92% 6%, rgba(66, 158, 236, .16), transparent 24rem),
        linear-gradient(180deg, #f5fbff 0, #fff 44rem);
}

button,
input {
    font: inherit;
}

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

.shell {
    width: min(1160px, calc(100% - 40px));
    margin: auto;
}

.site-header {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -.04em;
}

.logo-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 13px;
    color: var(--white);
    background: linear-gradient(145deg, #2aaaf0, var(--blue-dark));
    box-shadow: 0 9px 20px rgba(24, 132, 214, .26);
}

.logo-mark svg {
    width: 23px;
    fill: currentColor;
}

.logo-mark rect {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.header-note {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.header-note::before {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 9px;
    border-radius: 50%;
    background: #43c698;
    box-shadow: 0 0 0 5px rgba(67, 198, 152, .13);
    content: "";
}

.hero {
    padding: 68px 0 34px;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--blue-dark);
    background: rgba(255, 255, 255, .75);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

h1 {
    max-width: 870px;
    margin: auto;
    font-size: clamp(38px, 6vw, 67px);
    line-height: 1.04;
    letter-spacing: -.055em;
}

h1 span {
    color: var(--blue);
}

.hero p {
    max-width: 670px;
    margin: 22px auto 0;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.7;
}

.error-box {
    margin-bottom: 18px;
    padding: 17px 20px;
    border: 1px solid #ffd0d5;
    border-radius: 16px;
    color: #9d2937;
    background: #fff5f6;
    font-size: 14px;
}

.error-box ul {
    margin: 7px 0 0;
    padding-left: 21px;
}

.app-card {
    margin: 28px auto 42px;
    padding: 14px;
    border: 1px solid rgba(145, 210, 245, .65);
    border-radius: 32px;
    background: rgba(255, 255, 255, .75);
    box-shadow: var(--shadow);
}

.dropzone {
    display: flex;
    min-height: 330px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 35px;
    border: 2px dashed #9edcf8;
    border-radius: 23px;
    background:
        linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .86)),
        repeating-linear-gradient(135deg, #f7fcff, #f7fcff 10px, #eaf7ff 10px, #eaf7ff 20px);
    cursor: pointer;
    text-align: center;
    transition: .2s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
    border-color: var(--blue);
    background: #f7fcff;
    transform: translateY(-1px);
}

.upload-icon {
    display: grid;
    width: 84px;
    height: 84px;
    margin-bottom: 21px;
    place-items: center;
    border-radius: 27px;
    color: var(--blue);
    background: var(--blue-light);
}

.upload-icon svg {
    width: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dropzone > strong {
    font-size: 23px;
    letter-spacing: -.025em;
}

.drop-copy {
    margin: 8px 0 19px;
    color: var(--muted);
    font-size: 15px;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    border: 0;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 850;
    transition: .2s ease;
}

.primary-button {
    color: var(--white);
    background: linear-gradient(135deg, #28a8ee, var(--blue-dark));
    box-shadow: 0 12px 24px rgba(19, 127, 207, .24);
}

.primary-button:hover {
    box-shadow: 0 14px 28px rgba(19, 127, 207, .31);
    transform: translateY(-2px);
}

.secondary-button {
    border: 1px solid var(--line);
    color: var(--blue-dark);
    background: var(--white);
}

.file-meta {
    margin-top: 20px;
    color: #8d9eb2;
    font-size: 13px;
    font-weight: 650;
}

.chosen-files,
.compression-settings,
.submit-button {
    display: none;
}

.chosen-files.is-visible,
.compression-settings.is-visible {
    display: block;
}

.chosen-files {
    max-width: 660px;
    margin: 18px auto 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.chosen-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 0 2px 11px;
    border-bottom: 1px solid var(--blue-light);
    font-size: 13px;
}

.chosen-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.chosen-list {
    max-height: 185px;
    overflow-y: auto;
}

.chosen-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--blue-light);
}

.chosen-row:last-child {
    padding-bottom: 0;
    border: 0;
}

.chosen-icon {
    display: grid;
    flex: 0 0 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    color: var(--blue-dark);
    background: var(--blue-light);
    font-weight: 850;
}

.chosen-text {
    min-width: 0;
}

.chosen-text strong,
.chosen-text small {
    display: block;
}

.chosen-text strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chosen-text small {
    margin-top: 2px;
    color: var(--muted);
}

.compression-settings {
    max-width: 660px;
    margin: 18px auto 0;
    padding: 0;
    border: 0;
}

.compression-settings legend {
    width: 100%;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 850;
    text-align: center;
}

.compression-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.compression-option {
    cursor: pointer;
}

.compression-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.compression-option > span {
    display: block;
    height: 100%;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--white);
    transition: .2s ease;
}

.compression-option input:checked + span {
    border-color: var(--blue);
    background: #f7fcff;
    box-shadow: 0 0 0 3px rgba(22, 131, 223, .11);
}

.compression-option strong,
.compression-option small {
    display: block;
}

.compression-option strong {
    font-size: 13px;
}

.compression-option small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.submit-button.is-visible {
    display: flex;
    margin: 16px auto 4px;
}

.result-section {
    padding: 43px 0 72px;
    scroll-margin-top: 20px;
}

.section-heading {
    margin-bottom: 25px;
    text-align: center;
}

.success-label {
    margin-bottom: 9px;
    color: var(--green);
    font-size: 14px;
    font-weight: 850;
}

h2 {
    margin: 0;
    font-size: clamp(29px, 4vw, 42px);
    letter-spacing: -.04em;
}

.batch-summary,
.stats {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--line);
}

.batch-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-bottom: 26px;
    border-radius: 20px;
}

.batch-summary > div,
.stats > div {
    min-width: 0;
    padding: 18px 20px;
    background: var(--white);
}

.batch-summary > div {
    text-align: center;
}

.batch-summary span,
.stats span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.batch-summary strong {
    font-size: 21px;
}

.archive-download {
    margin: -4px 0 32px;
    text-align: center;
}

.archive-button {
    gap: 12px;
    min-height: 60px;
    padding: 8px 25px;
    text-align: left;
}

.archive-button svg {
    width: 24px;
    flex: 0 0 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.archive-button span,
.archive-button small {
    display: block;
}

.archive-button small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .78);
    font-size: 11px;
    font-weight: 700;
}

.archive-download p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.positive {
    color: var(--green);
}

.result-item {
    margin-top: 28px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(248, 253, 255, .85);
    box-shadow: 0 16px 45px rgba(33, 105, 158, .08);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 17px;
}

.result-file {
    min-width: 0;
}

.result-file span {
    display: block;
    margin-bottom: 4px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.result-file strong {
    display: block;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saving-badge {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 10px;
    color: var(--green);
    background: rgba(36, 165, 122, .1);
    font-size: 13px;
    font-weight: 850;
}

.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--white);
}

.image-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 19px;
    border-bottom: 1px solid var(--blue-light);
    font-size: 15px;
}

.image-card-head span {
    padding: 5px 9px;
    border-radius: 8px;
    color: var(--blue-dark);
    background: var(--blue-light);
    font-size: 12px;
    font-weight: 850;
}

.image-preview {
    display: grid;
    height: 280px;
    place-items: center;
    padding: 20px;
    background:
        linear-gradient(45deg, #eef5f9 25%, transparent 25%),
        linear-gradient(-45deg, #eef5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef5f9 75%),
        linear-gradient(-45deg, transparent 75%, #eef5f9 75%);
    background-color: #f8fcfe;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 13px rgba(20, 66, 101, .12));
}

.stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin-top: 20px;
    border-radius: 22px;
}

.stats strong {
    display: block;
    overflow: hidden;
    font-size: clamp(18px, 2.5vw, 24px);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.batch-actions {
    display: flex;
    justify-content: center;
    margin-top: 27px;
}

.algorithms {
    padding: 65px 0 35px;
}

.algorithms-heading {
    max-width: 790px;
    margin: 0 auto 30px;
    text-align: center;
}

.algorithms-heading > span {
    color: var(--blue);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.algorithms-heading h2 {
    margin-top: 9px;
}

.algorithms-heading p {
    margin: 15px auto 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: stretch;
}

.algorithm-card {
    position: relative;
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 12px 34px rgba(33, 105, 158, .06);
}

.algorithm-card.featured {
    border-color: #80cef5;
    background: linear-gradient(180deg, #f3fbff, #fff);
    box-shadow: 0 18px 44px rgba(26, 126, 197, .12);
}

.algorithm-card.featured::before {
    position: absolute;
    top: 0;
    right: 24px;
    width: 58px;
    height: 4px;
    border-radius: 0 0 5px 5px;
    background: linear-gradient(90deg, #2bb0f1, var(--blue-dark));
    content: "";
}

.algorithm-top {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 17px;
}

.algorithm-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 14px;
    color: var(--blue-dark);
    background: var(--blue-light);
}

.algorithm-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.algorithm-number {
    display: block;
    margin-bottom: 3px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.algorithm-card h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.02em;
}

.algorithm-card > p {
    margin: 0 0 17px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.algorithm-card ul {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--blue-light);
    list-style: none;
}

.algorithm-card li {
    position: relative;
    padding-left: 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.algorithm-card li::before {
    position: absolute;
    top: .55em;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5cc1ef;
    content: "";
}

.algorithm-card li strong {
    color: var(--ink);
}

.algorithm-note {
    display: flex;
    max-width: 920px;
    align-items: flex-start;
    gap: 12px;
    margin: 20px auto 0;
    padding: 15px 17px;
    border: 1px solid var(--blue-light);
    border-radius: 15px;
    color: var(--muted);
    background: #f8fcff;
}

.algorithm-note svg {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    fill: none;
    stroke: var(--blue);
    stroke-width: 1.7;
    stroke-linecap: round;
}

.algorithm-note p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

.benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 45px 0 76px;
}

.benefits article {
    padding: 25px;
    border: 1px solid var(--blue-light);
    border-radius: 20px;
    background: rgba(255, 255, 255, .75);
}

.benefits article > span {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 15px;
    place-items: center;
    border-radius: 13px;
    color: var(--blue-dark);
    background: var(--blue-light);
}

.benefits article > span svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.benefits h3 {
    margin: 0 0 7px;
    font-size: 17px;
}

.benefits p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

footer {
    padding: 24px 0 31px;
    border-top: 1px solid var(--blue-light);
    color: var(--muted);
    font-size: 13px;
}

.loading {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(238, 249, 255, .88);
    backdrop-filter: blur(8px);
}

.loading.is-visible {
    display: flex;
}

.loading > div {
    width: min(360px, 100%);
    padding: 35px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--white);
    box-shadow: var(--shadow);
    text-align: center;
}

.loading span {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 17px;
    border: 5px solid var(--blue-light);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.loading strong,
.loading small {
    display: block;
}

.loading small {
    margin-top: 8px;
    color: var(--muted);
}

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

@media (max-width: 760px) {
    .shell {
        width: min(100% - 24px, 1160px);
    }

    .site-header {
        min-height: 68px;
    }

    .header-note {
        display: none;
    }

    .hero {
        padding-top: 42px;
    }

    .app-card {
        padding: 8px;
        border-radius: 24px;
    }

    .dropzone {
        min-height: 310px;
        padding: 27px 15px;
        border-radius: 18px;
    }

    .compression-options,
    .batch-summary,
    .comparison,
    .algorithm-grid,
    .benefits {
        grid-template-columns: 1fr;
    }

    .algorithms {
        padding-top: 48px;
    }

    .algorithm-card {
        padding: 21px;
    }

    .result-item {
        padding: 14px;
        border-radius: 22px;
    }

    .result-header {
        align-items: flex-start;
    }

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

    .result-actions .primary-button,
    .batch-actions .secondary-button {
        width: 100%;
    }
}

@media (max-width: 430px) {
    h1 {
        font-size: 39px;
    }

    .chosen-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats > div {
        padding: 16px;
    }

    .stats strong {
        font-size: 18px;
    }
}
