:root {
    --ink: #0f172a;
    --muted: #4b5563;
    --line: #e2e8f0;
    --soft: #f8fafc;
    --surface: #ffffff;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --accent: #eff6ff;
    --radius: 8px;
    --max-width: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--surface);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; }
.container { width: min(calc(100% - 32px), var(--max-width)); margin-inline: auto; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 10px 14px; background: var(--ink); color: white; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { color: var(--ink); font-size: 1.45rem; font-weight: 700; letter-spacing: -.04em; text-decoration: none; }
.brand::after { content: "."; color: var(--brand); }
.nav-list { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; padding: 0; list-style: none; }
.nav-list a, .nav-list span { color: var(--ink); font-size: .875rem; font-weight: 500; text-decoration: none; }
.nav-list a:hover { color: var(--brand); }

.hero { padding: 72px 0 66px; border-bottom: 1px solid var(--line); background: var(--soft); text-align: center; }
.hero-inner { max-width: 840px; }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; line-height: 1.2; letter-spacing: -.02em; }
h1 { max-width: 760px; margin-inline: auto; margin-bottom: 18px; font-size: 2.5rem; font-weight: 700; }
.hero-copy { max-width: 670px; margin: 0 auto; color: var(--muted); font-size: .9375rem; font-weight: 400; line-height: 1.5; }
.tool-search { position: relative; width: 100%; max-width: 650px; margin: 30px auto 0; text-align: left; }
.tool-search label { display: block; margin-bottom: 8px; font-size: .875rem; font-weight: 600; }
.search-field { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 0 18px; border: 1px solid #c9d2df; border-radius: var(--radius); background: white; box-shadow: 0 8px 25px rgba(28,45,78,.07); }
.search-field svg { flex: none; color: var(--muted); }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: .9375rem; }
.search-results { position: absolute; z-index: 5; top: calc(100% - 18px); width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 18px 45px rgba(25,39,70,.14); }
.search-results ul { margin: 0; padding: 0; list-style: none; }
.search-results li { display: flex; justify-content: space-between; gap: 20px; padding: 11px 12px; border-radius: 6px; font-size: .875rem; font-weight: 500; }
.search-results li + li { border-top: 1px solid var(--line); }
.search-meta { color: var(--muted); font-size: .8rem; font-weight: 500; white-space: nowrap; }
.search-empty { margin: 0; padding: 12px; color: var(--muted); }

.section { padding: 82px 0; }
.section-muted { background: var(--soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.section-heading h2, .faq-layout h2 { margin-bottom: 0; font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
.section-heading-compact { margin-bottom: 26px; }
.tool-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tool-card { display: flex; align-items: center; min-height: 72px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: white; transition: border-color .16s ease, box-shadow .16s ease; }
.tool-card h3 { margin: 0; font-size: .875rem; font-weight: 500; }
.tool-card-link { text-decoration: none; }

.category-stack { border-top: 1px solid var(--line); }
.category-row { padding: 36px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.category-intro { margin-bottom: 20px; }
.category-intro h3 { margin-bottom: 8px; font-size: 1.125rem; font-weight: 600; line-height: 1.2; }
.category-intro p, .empty-category { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.category-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.category-tools li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: #1e293b; font-size: .875rem; font-weight: 500; transition: border-color .16s ease, box-shadow .16s ease; }
.category-tools a { width: 100%; text-decoration: none; }

@media (hover: hover) {
    .tool-card:hover, .category-tools li:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(15,23,42,.06); }
}

.value-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; }
.value-grid article { padding-top: 20px; border-top: 3px solid var(--brand); }
.value-grid h3 { margin-bottom: 8px; font-size: 1.125rem; font-weight: 600; }
.value-grid p { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.faq-section { border-top: 1px solid var(--line); }
.faq-layout { display: block; }
.faq-layout h2 { margin-bottom: 30px; }
.faq-list { max-width: 920px; border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { display: flex; align-items: center; gap: 10px; padding: 20px 4px; cursor: pointer; font-size: .9375rem; font-weight: 600; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-right: 1.5px solid var(--brand); border-bottom: 1.5px solid var(--brand); transform: rotate(-45deg); transition: transform .16s ease; }
.faq-list details[open] summary::before { transform: rotate(45deg); }
.faq-list details p { margin: -6px 0 20px; color: var(--muted); font-size: .875rem; line-height: 1.5; }

.site-footer { padding: 40px 0; border-top: 1px solid var(--line); background: #0f172a; color: #dce3ed; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.brand-footer { color: white; }
.footer-grid h2 { margin-bottom: 10px; color: white; font-size: .95rem; letter-spacing: 0; }
.footer-grid p { max-width: 260px; margin: 8px 0 0; color: #9faabd; font-size: .88rem; }
.footer-grid ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; margin: 0; padding: 0; list-style: none; }
.footer-grid li + li { margin-top: 0; }
.footer-grid a:not(.brand), .footer-grid li span { color: #bdc7d5; font-size: .9rem; text-decoration: none; }
.footer-grid a:hover { color: white; }
.footer-bottom { margin-top: 24px; padding-top: 14px; border-top: 1px solid #2b3545; color: #8e9aab; font-size: .82rem; }
.error-page { min-height: 62vh; display: grid; align-items: center; padding: 90px 0; text-align: center; }
.error-page h1 { margin-bottom: 12px; }
.error-page p:not(.eyebrow) { color: var(--muted); }
.button { display: inline-block; margin-top: 16px; padding: 11px 18px; border-radius: 8px; background: var(--brand); color: white; font-weight: 750; text-decoration: none; }
.button:hover { background: var(--brand-dark); }

.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; }
.tool-page { padding: 30px 0 82px; background: var(--soft); }
.tool-page-container { max-width: 980px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; padding: 0; color: var(--muted); font-size: .84rem; list-style: none; }
.breadcrumb li + li::before { content: ">"; margin-right: 8px; color: #94a3b8; }
.breadcrumb a { color: var(--brand); text-decoration: none; }
.tool-page-header { margin-bottom: 28px; text-align: center; }
.tool-page-header h1 { margin-bottom: 12px; }
.tool-page-header p { max-width: 680px; margin: 0 auto; color: var(--muted); font-size: .95rem; }
.converter { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 25px rgba(28,45,78,.07); }
.upload-zone { padding: 52px 24px; border: 2px dashed #b9c5d5; border-radius: var(--radius); background: var(--soft); text-align: center; transition: border-color .16s ease, background .16s ease; }
.upload-zone.is-dragging { border-color: var(--brand); background: var(--accent); }
.upload-zone:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.upload-zone-compact { padding: 24px; }
.upload-title { margin: 0; color: var(--ink); font-size: 1.1rem; font-weight: 650; }
.upload-or { margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
.upload-button { margin-top: 12px; cursor: pointer; }
.upload-help { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.local-processing-note { display: grid; gap: 3px; margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--brand); background: var(--accent); font-size: .87rem; }
.local-processing-note span { color: var(--muted); }
.converter-workspace { margin-top: 28px; }
.selected-files-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.selected-files-heading h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--brand); font: inherit; font-size: .875rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.text-button:hover { color: var(--brand-dark); text-decoration: underline; }
.text-button:disabled { color: #94a3b8; cursor: not-allowed; text-decoration: none; }
.file-list { display: grid; gap: 10px; }
.selected-file { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.file-preview { display: grid; place-items: center; width: 64px; height: 54px; overflow: hidden; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: .72rem; font-weight: 700; }
.file-preview img { width: 100%; height: 100%; object-fit: contain; }
.file-details { min-width: 0; }
.file-details h3 { margin: 0 0 3px; overflow-wrap: anywhere; font-size: .9rem; font-weight: 600; }
.file-meta, .file-status, .file-result { margin: 0; color: var(--muted); font-size: .79rem; }
.selected-file[data-state="error"] .file-status { color: #b42318; }
.selected-file[data-state="success"] .file-status { color: #167543; }
.file-result { margin-top: 3px; color: var(--ink); }
.file-actions { display: flex; align-items: center; gap: 12px; }
.file-download { margin: 0; padding: 9px 13px; font-size: .8rem; }
.file-remove { color: #64748b; }
.converter-controls { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 28px; margin-top: 24px; padding: 20px; border-radius: var(--radius); background: var(--soft); }
.converter-controls label, .control-label-row { font-size: .875rem; font-weight: 600; }
.control-label-row { display: flex; justify-content: space-between; gap: 20px; }
.control-label-row output { color: var(--brand); }
.quality-control input { width: 100%; margin: 14px 0 0; accent-color: var(--brand); }
.background-control > label { display: block; margin-bottom: 10px; }
.color-control { display: flex; align-items: center; gap: 10px; }
.color-control input { width: 44px; height: 34px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 6px; background: white; }
.color-control output { color: var(--muted); font-size: .84rem; }
.converter-actions { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.converter-button { margin: 0; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.converter-button:disabled { background: #94a3b8; cursor: not-allowed; }
.batch-status { min-height: 1.3em; margin: 12px 0 0; color: var(--muted); font-size: .84rem; }
.tool-content-section { padding: 64px 0 0; }
.tool-content-section > h2, .tool-information h2 { margin-bottom: 22px; font-size: 1.5rem; font-weight: 600; }
.how-to-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; counter-reset: steps; list-style: none; }
.how-to-list li { position: relative; min-height: 100px; padding: 20px 18px 18px 56px; border: 1px solid var(--line); border-radius: var(--radius); background: white; font-size: .9rem; }
.how-to-list li::before { content: counter(steps); position: absolute; top: 18px; left: 18px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--brand); font-size: .8rem; font-weight: 700; counter-increment: steps; }
.tool-information { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; padding: 64px 0 0; }
.tool-information article { padding-top: 20px; border-top: 3px solid var(--brand); }
.tool-information h2 { margin-bottom: 10px; font-size: 1.125rem; }
.tool-information p { margin: 0; color: var(--muted); font-size: .9rem; }
.tool-faq .faq-list { max-width: none; }
.related-tools-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.related-tool-card { display: flex; align-items: center; min-height: 56px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: .875rem; font-weight: 600; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease; }

@media (hover: hover) {
    .related-tool-card:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(15,23,42,.06); }
}

@media (max-width: 900px) {
    .header-inner { align-items: flex-start; flex-direction: column; gap: 12px; padding-block: 16px; }
    .site-header nav { width: 100%; min-width: 0; }
    .nav-list { gap: 8px 18px; }
    .hero { padding: 72px 0 68px; }
    .tool-grid, .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .container { width: auto; margin-inline: 12px; }
    .nav-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 15px; }
    .nav-list a, .nav-list span { font-size: .84rem; }
    .hero { padding: 56px 0; }
    h1 { max-width: 100%; font-size: 2rem; overflow-wrap: normal; }
    .hero-inner { min-width: 0; }
    .search-field { min-height: 56px; }
    .section { padding: 60px 0; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .tool-grid, .category-tools, .value-grid, .footer-grid { grid-template-columns: 1fr; }
    .tool-card { min-height: 72px; }
    .footer-grid { gap: 28px; }
    .category-row { padding: 28px 0; }
    .category-intro { margin-bottom: 18px; }
    .search-results li { align-items: flex-start; flex-direction: column; gap: 2px; }
    .tool-page { padding: 22px 0 60px; }
    .breadcrumb ol { margin-bottom: 24px; }
    .converter { padding: 16px; }
    .upload-zone { padding: 38px 16px; }
    .upload-zone-compact { padding: 20px 14px; }
    .selected-file { grid-template-columns: 52px minmax(0, 1fr); align-items: start; }
    .file-preview { width: 52px; height: 48px; }
    .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .converter-controls, .how-to-list, .tool-information { grid-template-columns: 1fr; }
    .converter-controls { gap: 20px; padding: 16px; }
    .converter-actions { align-items: flex-start; flex-direction: column; }
    .tool-content-section, .tool-information { padding-top: 52px; }
    .tool-information { gap: 26px; }
    .related-tools-grid { grid-template-columns: 1fr; }
    .related-tool-card { width: 100%; min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
