:root {
    --bg: #0f1220;
    --surface: #ffffff;
    --surface-2: #f4f6fb;
    --text: #1a1d29;
    --muted: #6b7280;
    --border: #e3e7ef;
    --primary: #5b5bff;
    --primary-dark: #4646e0;
    --accent: #00c2a8;
    --danger: #e5484d;
    --shadow: 0 8px 30px rgba(20, 22, 40, 0.08);
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--surface-2);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; }

/* ---------- Site chrome ---------- */
.site { display: flex; flex-direction: column; min-height: 100vh; }

.site__header {
    background: var(--bg);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}
.site__bar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand__mark { font-size: 1.4rem; }
.brand__name { font-size: 1.15rem; font-weight: 500; }
.brand__name strong { color: #8e8eff; }
.site__nav a { color: #c9cce0; margin-left: 1.4rem; font-size: 0.95rem; }
.site__nav a:hover { color: #fff; text-decoration: none; }

.site__main { flex: 1; width: 100%; }

.site__footer {
    background: var(--bg);
    color: #aeb2c8;
    margin-top: 3rem;
    font-size: 0.88rem;
}
.site__foot-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
}
.site__foot-inner nav a { color: #aeb2c8; margin-right: 1rem; }
.site__muted { color: #6b7090; margin-left: auto; }

/* ---------- Converter ---------- */
.converter {
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
}
.converter__hero { text-align: center; margin: 1rem 0 1.75rem; }
.converter__hero h1 { font-size: 2.2rem; margin: 0 0 0.5rem; }
.converter__hero p { color: var(--muted); font-size: 1.05rem; margin: 0 auto; max-width: 620px; }

.dropzone {
    display: block;
    position: relative;
    border: 2px dashed #c3c9da;
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone--active { border-color: var(--primary); background: #f7f7ff; }
.dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 2.5rem 1rem;
    text-align: center;
    pointer-events: none;
}
.dropzone__icon { font-size: 2rem; }
.dropzone__hint { color: var(--muted); font-size: 0.9rem; }

/* Options */
.options {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-top: 1.25rem;
}
.options__row { margin-bottom: 1rem; }
.options__row--inline { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.options__label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.options__value { color: var(--primary); }
.options__muted { color: var(--muted); font-size: 0.85rem; }
.options__check { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }

.format-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.format-chip {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all .12s;
}
.format-chip:hover { border-color: var(--primary); }
.format-chip--active { background: var(--primary); color: #fff; border-color: var(--primary); }

.slider { width: 100%; accent-color: var(--primary); }
.num {
    width: 90px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.num:disabled { background: #f0f0f4; color: #aaa; }

.options__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }

.btn {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all .12s;
}
.btn:hover:not(:disabled) { border-color: var(--primary); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

/* Results */
.results { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.result {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
}
.result--error { border-color: #f3c6c8; background: #fff7f7; }
.result__thumb {
    width: 56px; height: 56px;
    flex: 0 0 56px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
}
.result__thumb img { width: 100%; height: 100%; object-fit: cover; }
.result__placeholder { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.result__info { flex: 1; min-width: 0; }
.result__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result__meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }
.result__error { color: var(--danger); }
.result__actions { display: flex; gap: 0.35rem; }

.badge { display: inline-block; padding: 0.05rem 0.4rem; border-radius: 6px; font-size: 0.75rem; margin-left: 0.35rem; font-weight: 600; }
.badge--save { background: #e3f9f3; color: #00876c; }
.badge--grow { background: #fdecec; color: var(--danger); }

/* SEO content */
.seo {
    margin-top: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.seo h2 { font-size: 1.2rem; margin-top: 1.25rem; }
.seo h2:first-child { margin-top: 0; }
.seo li { margin: 0.3rem 0; }

/* ---------- Ad slots ---------- */
.ad {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 1.25rem auto;
    background: repeating-linear-gradient(45deg, #f3f4f9, #f3f4f9 10px, #eef0f7 10px, #eef0f7 20px);
    border: 1px dashed #d2d6e4;
    border-radius: 10px;
    color: #9aa0b4;
}
.ad__label { font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; }
.ad--leaderboard { width: 100%; max-width: 728px; height: 90px; }
.ad--rectangle { width: 100%; max-width: 336px; height: 280px; }

@media (max-width: 600px) {
    .converter__hero h1 { font-size: 1.7rem; }
    .ad--leaderboard { height: 60px; }
}

/* Video converter extras */
.format-group { margin-bottom: 0.75rem; }
.format-group__title { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.35rem; }
.options__field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.95rem;
    color: var(--text);
}
.result__thumb--media { font-size: 1.6rem; }
.progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.25rem 0;
    width: 100%;
    max-width: 320px;
}
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width .25s ease;
}
.progress__bar--indeterminate {
    width: 40% !important;
    animation: indeterminate 1.1s infinite ease-in-out;
}
@keyframes indeterminate {
    0% { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* OCR (image to text) */
.ocr-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.7rem;
}
.ocr-card__head { display: flex; align-items: center; gap: 0.8rem; }
.ocr-card__thumb {
    width: 48px; height: 48px; flex: 0 0 48px;
    border-radius: 8px; overflow: hidden; background: var(--surface-2);
}
.ocr-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ocr-card__info { flex: 1; min-width: 0; }
.ocr-card__text {
    width: 100%;
    margin-top: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    background: var(--surface-2);
    color: var(--text);
}

/* QR / barcode */
.qr-result {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
}
.qr-result__img { background: #fff; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border); }
.qr-result__img img { display: block; max-width: 100%; height: auto; }
.qr-result__img--square img { width: 280px; max-width: 70vw; }

.scan-result {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border);
}
.scan-result__text {
    flex: 1; min-width: 0; word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem;
}

/* Landing pages */
.converter--embedded { padding: 0; max-width: none; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 0.25rem 0 0.75rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.converter__hero--landing { margin-top: 0.5rem; }
.converter__hero--landing h1 { font-size: 1.9rem; }

.faq__item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
    background: var(--surface-2);
}
.faq__item summary { cursor: pointer; font-weight: 600; }
.faq__item p { margin: 0.5rem 0 0; color: var(--muted); }

.related { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.related__chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    background: var(--surface-2);
}
.related__chip:hover { border-color: var(--primary); text-decoration: none; }

/* simple static page */
.page-doc { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
.page-doc h1 { font-size: 1.9rem; }
.error-boundary { padding: 2rem 1.25rem; max-width: 760px; margin: 0 auto; }
