/* =============================================================
   KBMB — Full CSS
   ============================================================= */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 80px;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #1e293b;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
}

img, svg { max-width: 100%; height: auto; display: block; }

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #eff6ff;
    --blue-border: #bfdbfe;
    --green: #16a34a;
    --red: #dc2626;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --gutter: 10%;
}

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-bottom: 16px; }
h3 { font-size: 1.15rem; margin-bottom: 12px; }
h4 { font-size: 1rem; margin-bottom: 8px; }
p { color: #334155; margin-bottom: 12px; }
p:last-child { margin-bottom: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
ul, ol { padding-left: 20px; color: #334155; }
li { margin-bottom: 6px; }
strong { color: var(--text); font-weight: 600; }
::selection { background: var(--blue-border); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
main { min-height: 60vh; padding-bottom: 40px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--blue); color: #fff; padding: 10px 16px; z-index: 999; border-radius: 0 0 var(--radius) 0; }
.skip-link:focus { left: 0; color: #fff; text-decoration: none; }

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

/* Header */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px var(--gutter); position: relative; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--text); flex-shrink: 0; }
.logo:hover { color: var(--blue); text-decoration: none; }
.logo svg { color: var(--blue); }
.main-nav { display: flex; gap: 4px; margin-left: 20px; }
.main-nav a { display: inline-flex; align-items: center; padding: 8px 14px; color: #475569; font-size: 0.95rem; font-weight: 500; border-radius: 8px; text-decoration: none; transition: all 0.15s; }
.main-nav a:hover { color: var(--blue); background: var(--blue-light); text-decoration: none; }
.lang-switcher { margin-left: auto; }
.lang-switcher select { appearance: none; -webkit-appearance: none; padding: 8px 32px 8px 12px; border: 1px solid var(--border); border-radius: 8px; background-color: var(--white); color: var(--text); font-size: 0.9rem; font-family: inherit; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.lang-switcher select:hover { border-color: var(--border-dark); }
.menu-toggle { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; }
.menu-toggle:hover { background: var(--bg); }

/* Breadcrumb */
.breadcrumb { padding: 20px 0 8px; font-size: 0.875rem; color: var(--text-light); }
.breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "›"; margin-right: 8px; color: var(--text-lighter); }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb li[aria-current] { color: var(--text); font-weight: 500; }

/* Hero */
.hero { padding: 32px 0 24px; }
.hero h1 { font-size: 2rem; margin-bottom: 12px; font-weight: 800; }
.hero p { font-size: 1.05rem; color: var(--text-light); max-width: 720px; line-height: 1.6; margin: 0; }
@media (min-width: 768px) { .hero h1 { font-size: 2.4rem; } }

/* Search */
.search-box { position: relative; margin: 24px 0; max-width: 640px; }
.search-box input { width: 100%; padding: 14px 16px 14px 44px; font-size: 1rem; font-family: inherit; color: var(--text); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 0.15s, box-shadow 0.15s; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); outline: none; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 320px; overflow-y: auto; z-index: 30; padding: 6px; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 10px 14px; color: var(--text); border-radius: 6px; font-size: 0.95rem; text-decoration: none; }
.search-results a:hover { background: var(--blue-light); color: var(--blue); text-decoration: none; }

/* Converter card */
.converter-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 24px; margin: 24px 0 40px; border-top: 3px solid var(--blue); }

.upload-header { margin-bottom: 16px; }
.upload-header-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.01em; }
.upload-header-title svg { color: var(--blue); flex-shrink: 0; }

.upload-dropzone { border: 2px dashed var(--border-dark); border-radius: var(--radius-lg); background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); padding: 40px 24px; text-align: center; cursor: pointer; transition: all 0.2s; color: var(--text-light); }
.upload-dropzone:hover { border-color: var(--blue); background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); color: var(--blue); }
.upload-dropzone.is-dragover { border-color: var(--blue); background: var(--blue-light); transform: scale(1.01); box-shadow: 0 0 0 4px rgba(37,99,235,0.12); }
.upload-icon { margin: 0 auto 16px; color: currentColor; opacity: 0.7; }
.upload-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.upload-hint { font-size: 0.85rem; color: var(--text-light); margin-bottom: 16px; max-width: 480px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.upload-btn { margin-top: 4px; }
.upload-privacy-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: #fef3c7; border-radius: 999px; font-size: 0.75rem; font-weight: 500; color: #92400e; margin-top: 10px; }
.upload-privacy-badge svg { color: #d97706; flex-shrink: 0; }

.section-divider { height: 1px; background: var(--border); margin: 24px -24px; }

.manual-section-title { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.manual-section-title svg { color: var(--blue); }

/* File result (upload) */
.upload-file-result { margin-top: 16px; padding: 16px 18px; background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%); border: 1.5px solid var(--blue-border); border-radius: var(--radius-lg); animation: fadeInUp 0.2s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.upload-file-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-info .result-label { margin-bottom: 4px; }
.upload-file-name { display: block; font-size: 1rem; font-weight: 600; color: var(--text); word-break: break-all; line-height: 1.4; }
.btn-remove { flex-shrink: 0; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: var(--white); border: 1px solid var(--border); border-radius: 6px; color: var(--text-light); cursor: pointer; transition: all 0.15s; }
.btn-remove:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }
.upload-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.meta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.meta-row > span { color: var(--text-light); font-weight: 500; }
.meta-row strong { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }

/* Converter inputs */
.converter-row { display: grid; grid-template-columns: 1.4fr 1fr auto 1fr; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 0.82rem; font-weight: 500; color: var(--text-light); }
.field input, .field select { width: 100%; padding: 12px 14px; font-size: 0.95rem; font-family: inherit; color: var(--text); background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); min-height: 46px; transition: all 0.15s; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; text-overflow: ellipsis; }
.field input:hover, .field select:hover { border-color: var(--border-dark); }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); outline: none; }
.field input[aria-invalid="true"] { border-color: var(--red); background: #fef2f2; }
.field .error, .error { color: var(--red); font-size: 0.8rem; font-weight: 500; min-height: 1em; }

.swap-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; background: var(--white); border: 1.5px solid var(--border); border-radius: 50%; color: var(--text-light); cursor: pointer; margin-bottom: 1px; transition: all 0.2s; }
.swap-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); transform: rotate(180deg); }
.swap-btn:active { transform: rotate(180deg) scale(0.95); }

.mode-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 8px; padding-top: 20px; border-top: 1px solid var(--border); }
.mode-opt { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1.5px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: #475569; background: var(--white); transition: all 0.15s; user-select: none; }
.mode-opt:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.mode-opt input { margin: 0; accent-color: var(--blue); cursor: pointer; }
.mode-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-light); color: var(--blue); font-weight: 600; }

.result-area { margin-top: 20px; padding: 20px; background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%); border: 1.5px solid var(--blue-border); border-radius: var(--radius-lg); }
.result-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.result-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.3; word-break: break-word; font-variant-numeric: tabular-nums; }
.result-details { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--blue-border); display: grid; gap: 8px; }
.detail-row { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.95rem; align-items: baseline; }
.detail-row > span:first-child { color: var(--text-light); min-width: 120px; font-weight: 500; }
.detail-row strong { color: var(--text); font-weight: 600; word-break: break-word; }

/* Quick chips */
.quick-chips-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--blue-border); }
.quick-label { font-size: 0.82rem; color: var(--text-light); font-weight: 500; flex-shrink: 0; }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-chips button { padding: 6px 12px; background: var(--white); border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; font-weight: 500; color: var(--text); font-family: inherit; cursor: pointer; transition: all 0.15s; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quick-chips button:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

/* Formula bar */
.formula-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.88rem; flex-wrap: wrap; margin-top: 16px; }
.formula-label { color: var(--text-light); font-weight: 500; }
.formula-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; }

/* Actions */
.action-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; font-size: 0.95rem; font-weight: 600; font-family: inherit; border: 1.5px solid transparent; border-radius: var(--radius); cursor: pointer; min-height: 44px; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; text-decoration: none; box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.btn-secondary { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); text-decoration: none; }
.btn.copied { background: var(--green); border-color: var(--green); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; min-height: 38px; }

/* Ad slots */
.ad-slot { margin: 32px auto; width: 100%; max-width: 100%; text-align: center; min-height: 120px; display: block; position: relative; padding: 8px 0; overflow: hidden; clear: both; }
.ad-slot[data-label]::before { content: attr(data-label); display: block; font-size: 0.68rem; color: var(--text-lighter); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 8px; text-align: center; }
.ad-slot ins.adsbygoogle { display: block !important; width: 100% !important; max-width: 100% !important; min-height: 100px !important; margin: 0 auto !important; text-align: center; }
.ad-slot iframe { max-width: 100% !important; display: block !important; margin: 0 auto !important; border: 0; }
iframe[id^="aswift"], iframe[name^="aswift"] { max-width: 100% !important; }

@media (max-width: 768px) {
    .ad-slot { margin: 20px auto; min-height: 100px; }
    .ad-slot ins.adsbygoogle { min-height: 90px !important; }
}
@media (max-width: 520px) {
    .ad-slot { margin-left: -12px; margin-right: -12px; width: calc(100% + 24px); }
}

/* Content sections */
.content-section { margin: 40px 0; }
.content-section h2 { font-size: 1.5rem; margin-bottom: 16px; scroll-margin-top: 80px; }
.content-section h3 { font-size: 1.1rem; margin-top: 24px; margin-bottom: 10px; scroll-margin-top: 80px; }
.content-section p, .content-section li { color: #334155; line-height: 1.7; }

.formula-box { background: #f1f5f9; border-left: 4px solid var(--blue); padding: 16px 20px; border-radius: var(--radius); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9rem; margin: 16px 0; overflow-x: auto; color: var(--text); }

/* Tables */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); -webkit-overflow-scrolling: touch; scrollbar-width: thin; position: relative; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: #f1f5f9; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }

table.conv-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.conv-table th, table.conv-table td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.conv-table th { background: #f8fafc; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); position: sticky; top: 0; }
table.conv-table tr:last-child td { border-bottom: 0; }
table.conv-table tr:hover td { background: #f8fafc; }
table.conv-table td:last-child { text-align: right; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

@media (max-width: 768px) {
    table.conv-table { font-size: 0.9rem; }
    table.conv-table th, table.conv-table td { padding: 10px 14px; }
}
@media (max-width: 520px) {
    .table-wrap { margin-left: calc(-1 * (var(--gutter) - 12px)); margin-right: calc(-1 * (var(--gutter) - 12px)); }
    table.conv-table { font-size: 0.85rem; }
    table.conv-table th, table.conv-table td { padding: 10px 12px; }
    table.conv-table th { font-size: 0.7rem; }
}

/* FAQ */
.faq-list { display: grid; gap: 8px; }
.faq-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s; }
.faq-item:hover { border-color: var(--border-dark); }
.faq-item[open] { border-color: var(--blue-border); }
.faq-item summary { padding: 16px 20px; cursor: pointer; font-weight: 600; font-size: 1rem; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; user-select: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex-shrink: 0; font-size: 1.4rem; font-weight: 400; color: var(--blue); line-height: 1; transition: transform 0.2s; }
.faq-item[open] summary::after { content: "−"; }
.faq-item:hover summary { color: var(--blue); }
.faq-item .faq-answer { padding: 0 20px 18px; color: #334155; font-size: 0.95rem; line-height: 1.7; }

/* Tool grid */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tool-card { display: block; padding: 16px 18px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: all 0.15s; text-align: center; }
.tool-card:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.category-block { margin-bottom: 32px; scroll-margin-top: 80px; }
.category-block h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light); margin-bottom: 12px; font-weight: 700; }

/* Related tools */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.related-grid a { display: block; padding: 12px 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 500; font-size: 0.9rem; text-align: center; text-decoration: none; transition: all 0.15s; }
.related-grid a:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); text-decoration: none; }

/* TOC */
.toc { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 24px 0; font-size: 0.95rem; }
.toc-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin-bottom: 10px; cursor: pointer; user-select: none; padding: 0; background: none; border: 0; width: 100%; text-align: left; font-family: inherit; }
.toc-title::after { content: ""; flex-shrink: 0; width: 16px; height: 16px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; transition: transform 0.2s; margin-left: auto; }
.toc[data-open="true"] .toc-title::after { transform: rotate(180deg); }
.toc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.toc-list li { margin: 0; }
.toc-list a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text-light); text-decoration: none; font-size: 0.9rem; line-height: 1.4; border-left: 2px solid transparent; transition: all 0.15s; }
.toc-list a:hover { color: var(--blue); background: var(--blue-light); border-left-color: var(--blue); text-decoration: none; }
.toc-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.toc[data-open="true"] .toc-body { max-height: 800px; transition: max-height 0.35s ease; }

@media (min-width: 900px) {
    .toc-title { cursor: default; }
    .toc-title::after { display: none; }
    .toc-body { max-height: none !important; overflow: visible !important; }
}

/* Tool layout with sidebar */
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: start; }
@media (min-width: 1100px) {
    .tool-layout { grid-template-columns: minmax(0, 1fr) 240px; }
    .tool-sidebar { position: sticky; top: 88px; align-self: start; }
    .tool-sidebar .toc { margin: 0; }
}
@media (max-width: 1099px) {
    .tool-sidebar { order: -1; }
    .tool-sidebar .toc { margin: 16px 0; }
}

/* Upload bar */
.upload-bar { background: var(--white); border-bottom: 1px solid var(--border); position: relative; z-index: 40; }
.upload-bar .container { padding-top: 0; padding-bottom: 0; }
.upload-bar-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 0; background: none; border: 0; cursor: pointer; color: var(--text); font-family: inherit; font-size: 0.92rem; font-weight: 600; text-align: left; transition: color 0.15s; }
.upload-bar-toggle:hover { color: var(--blue); }
.upload-bar-icon { flex-shrink: 0; color: var(--green); }
.upload-bar-label { flex: 1; min-width: 0; }
.upload-bar-chevron { flex-shrink: 0; width: 16px; height: 16px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; transition: transform 0.2s; }
.upload-bar[data-open="true"] .upload-bar-chevron { transform: rotate(180deg); }
.upload-bar-panel { padding: 4px 0 20px; }
.upload-bar-dropzone { border: 2px dashed var(--border-dark); border-radius: var(--radius); background: #f8fafc; padding: 20px; text-align: center; cursor: pointer; transition: all 0.15s; }
.upload-bar-dropzone:hover { border-color: var(--blue); background: var(--blue-light); }
.upload-bar-dropzone.is-dragover { border-color: var(--blue); background: var(--blue-light); box-shadow: 0 0 0 4px rgba(37,99,235,0.12); }
.upload-bar-dropzone-inner { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.upload-bar-text { margin: 0; color: var(--text-light); font-size: 0.9rem; }
.upload-bar-result { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%); border: 1.5px solid var(--blue-border); border-radius: var(--radius); flex-wrap: wrap; }
.upload-bar-result-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 180px; }
.upload-bar-file { font-size: 0.9rem; font-weight: 600; color: var(--text); word-break: break-all; }
.upload-bar-size { font-size: 1.1rem; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.upload-bar-units { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.78rem; }
.upload-bar-units span { padding: 4px 8px; background: var(--white); border: 1px solid var(--blue-border); border-radius: 6px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Footer */
.site-footer { margin-top: 64px; padding: 48px 0 24px; background: var(--white); border-top: 1px solid var(--border); color: var(--text-light); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand .logo { margin-bottom: 12px; }
.footer-brand p { font-size: 0.9rem; color: var(--text-light); max-width: 320px; line-height: 1.6; }
.footer-col h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin-bottom: 14px; font-weight: 700; }
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.footer-col li { margin: 0; }
.footer-col a { color: var(--text-light); font-size: 0.9rem; text-decoration: none; }
.footer-col a:hover { color: var(--blue); }
.lang-list { grid-template-columns: repeat(2, 1fr) !important; gap: 8px 16px !important; }
.footer-bottom { padding-top: 24px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-lighter); text-align: center; }

/* 404 */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 5rem; color: var(--blue); margin-bottom: 12px; line-height: 1; font-weight: 800; }
.error-page p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 24px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 1280px) { :root { --gutter: 6%; } }
@media (max-width: 1024px) { :root { --gutter: 5%; } }
@media (max-width: 768px)  { :root { --gutter: 20px; } }

@media (max-width: 860px) {
    .menu-toggle { display: inline-flex; order: 3; }
    .lang-switcher { margin-left: auto; order: 2; }
    .main-nav { position: absolute; top: 100%; left: 0; right: 0; margin-left: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 12px var(--gutter); background: var(--white); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); display: none; }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 14px; font-size: 1rem; border-radius: var(--radius); }
}

@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    h1, .hero h1 { font-size: 1.6rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.05rem; }
    .hero { padding: 24px 0 16px; }
    .hero p { font-size: 0.95rem; }
    .converter-card { padding: 18px; }
    .converter-row { grid-template-columns: 1fr; gap: 12px; }
    .swap-btn { justify-self: center; width: 100%; height: 44px; border-radius: var(--radius); margin: 0; }
    .swap-btn svg { transform: rotate(90deg); }
    .swap-btn:hover { transform: none; }
    .mode-opt { flex: 1 1 auto; justify-content: center; padding: 10px 12px; font-size: 0.85rem; }
    .result-value { font-size: 1.2rem; }
    .detail-row { flex-direction: column; gap: 2px; }
    .detail-row > span:first-child { min-width: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
    .action-row .btn { flex: 1 1 0; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .footer-brand { grid-column: 1 / -1; }
    .lang-list { grid-template-columns: repeat(2, 1fr) !important; }
    .section-divider { margin-left: -18px; margin-right: -18px; }
    .upload-dropzone { padding: 28px 16px; }
    .upload-title { font-size: 0.95rem; }
    .upload-hint { font-size: 0.8rem; }
    .upload-file-header { padding: 12px 14px; }
    .upload-file-name { font-size: 0.9rem; }
    .meta-row { padding: 8px 12px; font-size: 0.85rem; }
    .upload-privacy-badge { font-size: 0.7rem; padding: 4px 10px; }
    .quick-chips-wrap { gap: 8px; }
    .formula-bar { padding: 12px 14px; font-size: 0.82rem; }
}

@media (max-width: 520px) {
    .logo { font-size: 1rem; }
    .lang-switcher select { padding: 7px 26px 7px 10px; font-size: 0.85rem; }
    .tool-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .tool-card { padding: 12px 10px; font-size: 0.85rem; }
    .related-grid { grid-template-columns: 1fr 1fr; }
    .related-grid a { padding: 10px 12px; font-size: 0.85rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
    .lang-list { grid-template-columns: repeat(3, 1fr) !important; }
    .breadcrumb { font-size: 0.8rem; }
    .error-page h1 { font-size: 4rem; }
    .upload-bar-toggle { padding: 10px 0; font-size: 0.85rem; }
    .upload-bar-panel { padding: 2px 0 16px; }
    .upload-bar-dropzone { padding: 16px 12px; }
    .upload-bar-dropzone-inner { flex-direction: column; gap: 10px; }
    .upload-bar-result { padding: 12px 14px; }
    .upload-bar-file { font-size: 0.8rem; }
    .upload-bar-size { font-size: 0.95rem; }
}

@media (max-width: 380px) {
    .tool-grid { grid-template-columns: 1fr; }
    .action-row { flex-direction: column; }
    .action-row .btn { width: 100%; }
}

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

@media print {
    .site-header, .site-footer, .ad-slot, .action-row, .swap-btn, .search-box, .lang-switcher, .menu-toggle { display: none !important; }
    body { background: #fff; color: #000; font-size: 12pt; }
    .container { padding: 0; }
    .converter-card, .result-area { box-shadow: none; border: 1px solid #ccc; }
}