:root {
    --bg: #0f1117;
    --surface: #171a22;
    --surface-2: #1f2330;
    --border: #2a2f3d;
    --text: #eceef4;
    --muted: #969db1;
    --accent: #7c9cff;
    --accent-2: #c084fc;
    --ok: #4ade80;
    --err: #f87171;
    --radius: 16px;
    --max: 920px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
    background:
        radial-gradient(900px 500px at 50% -10%, rgba(124, 156, 255, .12), transparent 70%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

/* ---------- Header ---------- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 650;
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -.01em;
}

.brand svg {
    color: var(--accent);
    flex: none;
}

.brand-logo {
    width: 26px;
    height: 26px;
    flex: none;
    object-fit: contain;
    display: block;
}

/* Hamburger toggle — only visible on mobile */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 10px;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s, opacity .2s;
}

.site-header nav {
    display: flex;
    gap: 8px;
}

.site-header nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: .92rem;
    padding: 8px 14px;
    border-radius: 10px;
    transition: color .15s, background .15s;
}

.site-header nav a:hover {
    color: var(--text);
    background: var(--surface);
}

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    padding: 40px 20px 30px;
    max-width: 720px;
    margin: 0 auto;
}

.hero h1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 5vw, 2.9rem);
    line-height: 1.1;
    letter-spacing: -.02em;
}

.tagline {
    color: var(--muted);
    margin: 0 auto;
    font-size: 1.08rem;
    max-width: 600px;
}

/* ---------- Main ---------- */
main {
    flex: 1;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 20px 72px;
}

/* ---------- Drop zone ---------- */
#drop-zone {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 52px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
    color: var(--muted);
}

#drop-zone:hover,
#drop-zone:focus-visible,
#drop-zone.dragover {
    border-color: var(--accent);
    background: var(--surface-2);
    outline: none;
}

#drop-zone.dragover {
    transform: scale(1.01);
}

.drop-inner svg {
    color: var(--accent);
    margin-bottom: 10px;
    opacity: .9;
}

.drop-inner p {
    margin: 4px 0;
}

.drop-inner strong {
    color: var(--text);
    font-weight: 600;
}

.hint {
    font-size: .88rem;
    max-width: 420px;
    margin-inline: auto;
    text-align: center;
    text-wrap: balance;
}

.drop-inner p {
    text-wrap: balance;
}

@media (max-width: 480px) {
    #drop-zone {
        padding: 40px 16px;
    }

    .hint {
        max-width: 100%;
    }
}

/* ---------- Batch bar ---------- */
.batch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.batch-bar[hidden] {
    display: none;
}

.batch-count {
    color: var(--muted);
    font-size: .92rem;
}

.batch-bar .btn {
    padding: 9px 18px;
}

/* ---------- Result cards ---------- */
#results {
    margin-top: 24px;
    display: grid;
    gap: 22px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.card-status {
    font-size: .92rem;
    margin-bottom: 14px;
    color: var(--muted);
}

.card-status.ok {
    color: var(--ok);
}

.card-status.err {
    color: var(--err);
}

.img-single {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

.img-single[hidden] {
    display: none;
}

.ba-slider[hidden] {
    display: none;
}

/* ---------- Before / after slider ---------- */
.ba-slider {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
    line-height: 0;
}

.ba-slider img {
    width: 100%;
    height: auto;
    display: block;
}

.ba-after-wrap {
    position: absolute;
    inset: 0;
    clip-path: inset(0 0 0 50%);
}

.ba-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: rgba(255, 255, 255, .9);
    transform: translateX(-50%);
    pointer-events: none;
}

.ba-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.ba-range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    margin: 0;
}

.ba-label {
    position: absolute;
    top: 12px;
    padding: 4px 11px;
    border-radius: 7px;
    background: rgba(10, 12, 18, .6);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: .74rem;
    line-height: 1.5;
    pointer-events: none;
}

.ba-label-before {
    left: 12px;
}

.ba-label-after {
    right: 12px;
}

/* ---------- Output size control ---------- */
.resize-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: .9rem;
    color: var(--muted);
}

.resize-row[hidden] {
    display: none;
}

.resize-label {
    font-weight: 500;
}

.resize-input {
    width: 96px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font: inherit;
}

.resize-input:focus-visible {
    outline: none;
    border-color: var(--accent);
}

.resize-unit {
    margin-left: -4px;
}

.resize-dims {
    margin-left: 4px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.card-actions {
    margin-top: 16px;
    text-align: right;
}

.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 11px;
    background: var(--accent);
    color: #0d1018;
    font-weight: 600;
    text-decoration: none;
    transition: filter .15s, transform .1s;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn:active {
    transform: translateY(1px);
}

.btn[hidden] {
    display: none;
}

/* ---------- Sections ---------- */
section h2 {
    margin: 0 0 22px;
    font-size: 1.55rem;
    letter-spacing: -.01em;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 64px;
}

.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.feature h3 {
    margin: auto 0 8px;
    font-size: 1.02rem;
    font-weight: 600;
}

.feature p {
    margin: auto;
    color: var(--muted);
    font-size: .92rem;
}

.how {
    margin-top: 72px;
}

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
    display: grid;
    gap: 16px;
}

.steps li {
    position: relative;
    padding: 18px 20px 18px 60px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--muted);
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 18px;
    top: 18px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(124, 156, 255, .14);
    color: var(--accent);
    font-weight: 600;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.steps strong {
    color: var(--text);
    font-weight: 600;
}

.faq {
    margin-top: 72px;
}

.faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 20px;
    margin-bottom: 10px;
}

.faq summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    padding: 14px 28px 14px 0;
}

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

.faq summary::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-65%) rotate(45deg);
    transition: transform .2s;
}

.faq details[open] summary::after {
    transform: translateY(-35%) rotate(225deg);
}

.faq details p {
    color: var(--muted);
    margin: 0 0 16px;
}

/* ---------- Doc pages (privacy / terms) ---------- */
.doc {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.doc h1 {
    font-size: 2rem;
    margin: 0 0 6px;
    letter-spacing: -.02em;
}

.doc-updated {
    color: var(--muted);
    font-size: .85rem;
    margin: 0 0 28px;
}

.doc h2 {
    font-size: 1.2rem;
    margin: 32px 0 10px;
}

.doc p {
    color: #c4c9d6;
    margin: 0 0 14px;
}

.doc a {
    color: var(--accent);
}

.doc-back {
    margin-top: 36px;
}

/* ---------- Article pages (guide, synthid) ---------- */
.article {
    max-width: 740px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

.breadcrumb {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--text);
}

.article h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.2;
    letter-spacing: -.02em;
    margin: 0 0 16px;
}

.article .lede {
    font-size: 1.1rem;
    color: #c4c9d6;
    margin: 0 0 8px;
}

.article .doc-updated {
    margin-bottom: 36px;
}

.article section {
    margin-top: 36px;
}

.article h2 {
    font-size: 1.35rem;
    letter-spacing: -.01em;
    margin: 0 0 14px;
}

.article h3 {
    font-size: 1.05rem;
    margin: 22px 0 8px;
    color: var(--text);
}

.article p {
    color: #c4c9d6;
    margin: 0 0 14px;
}

.article ul,
.article ol {
    color: #c4c9d6;
    padding-left: 22px;
    margin: 0 0 14px;
}

.article ul li,
.article ol li {
    margin-bottom: 8px;
}

.article strong {
    color: var(--text);
}

.article a {
    color: var(--accent);
}

.article .steps {
    padding-left: 0;
}

.article .cta {
    display: inline-block;
    margin-top: 6px;
    padding: 11px 22px;
    border-radius: 11px;
    background: var(--accent);
    color: #0d1018;
    font-weight: 600;
    text-decoration: none;
    transition: filter .15s, transform .1s;
}

.article .cta:hover {
    filter: brightness(1.08);
}

.article .cta:active {
    transform: translateY(1px);
}

.compare {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 14px;
    font-size: .92rem;
}

.compare th,
.compare td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: #c4c9d6;
}

.compare th {
    color: var(--text);
    font-weight: 600;
    background: var(--surface);
}

.compare tbody tr:hover td {
    background: rgba(124, 156, 255, .04);
}

.how-more {
    margin-top: 18px;
    color: var(--muted);
    font-size: .95rem;
}

.how-more a {
    color: var(--accent);
}

@media (max-width: 560px) {

    .compare th,
    .compare td {
        padding: 8px 10px;
        font-size: .88rem;
    }
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(13, 15, 21, .5);
    margin-top: auto;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 24px 20px;
    display: flex;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.footer-brand {
    max-width: 360px;
}

.footer-brand .brand {
    margin-bottom: 10px;
}

.footer-brand p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: .92rem;
}

.footer-nav a:hover {
    color: var(--text);
}

.footer-note {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 28px;
    color: #6e7488;
    font-size: .82rem;
}

@media (max-width: 640px) {
    .site-header {
        position: relative;
        padding: 14px 18px;
    }

    .nav-toggle {
        display: flex;
    }

    /* Nav becomes a full-width dropdown panel under the header */
    .site-header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 2px;
        padding: 8px 12px 12px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 12px 24px rgba(0, 0, 0, .35);
        z-index: 200;
    }

    .site-header.nav-open nav {
        display: flex;
    }

    .site-header nav a {
        padding: 12px 12px;
        border-radius: 9px;
        font-size: 1rem;
    }

    /* Hamburger morphs into an X when open */
    .site-header.nav-open .nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .site-header.nav-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-header.nav-open .nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

@media (max-width: 560px) {
    .hero {
        padding-top: 24px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 24px;
    }
}

/* ---------- Tool pages (compress / convert) ---------- */
.tool-intro {
    text-align: center;
    max-width: 640px;
    margin: 8px auto 28px;
    color: var(--muted);
}

.tool-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.tool-controls[hidden] {
    display: none;
}

.control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .92rem;
    color: var(--muted);
}

.control label {
    font-weight: 500;
    white-space: nowrap;
}

.control select {
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.control input[type="range"] {
    accent-color: var(--accent);
    cursor: pointer;
}

.control output {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    min-width: 38px;
}

/* ---------- More tools section ---------- */
.more-tools {
    margin-top: 72px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.tool-link {
    display: block;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, transform .15s;
}

.tool-link:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tool-link h3 {
    margin: 0 0 6px;
    font-size: 1.02rem;
}

.tool-link p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

/* size comparison badge in result cards */
.size-info {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: .92rem;
    color: var(--muted);
}

.size-info .saved {
    color: var(--ok);
    font-weight: 600;
}

.size-info .grew {
    color: var(--err);
    font-weight: 600;
}