:root {
  color-scheme: light;
  --bg: #f2f7f6;
  --surface: #ffffff;
  --surface-soft: #edf7f5;
  --ink: #152e36;
  --muted: #5d7077;
  --line: #cadbd9;
  --teal: #0f8f85;
  --teal-dark: #09655f;
  --coral: #e46659;
  --gold: #f2b84b;
  --blue: #2563a7;
  --danger: #b42318;
  --shadow: 0 14px 35px rgba(33, 73, 79, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37, 99, 167, .28);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 36px; }
.topbar { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand > img { width: 42px; height: 42px; padding: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 7px 18px rgba(33, 73, 79, .1); }
.brand-text { min-width: 0; }
.brand-name { display: block; font-size: 15px; font-weight: 850; line-height: 1.15; }
.brand-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.nav-link { min-height: 38px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: #31505a; font-size: 13px; font-weight: 750; text-decoration: none; }

.language-menu { position: relative; z-index: 30; }
.language-menu summary {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(33, 73, 79, .12);
  cursor: pointer;
  list-style: none;
}
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  width: 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  transform: translateX(-50%);
  padding: 7px;
  border: 1px solid #354750;
  border-radius: 8px;
  background: #17262d;
  box-shadow: 0 14px 28px rgba(15, 32, 39, .25);
}
.language-menu:not([open]) .language-menu-list { display: none; }
.language-menu-list a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.language-menu-list a:hover, .language-menu-list a[aria-current="true"] { background: rgba(255,255,255,.16); }
.flag-circle { width: 25px; height: 25px; display: block; overflow: hidden; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.28); }
.flag-en { background: linear-gradient(33deg, transparent 41%, #fff 41% 47%, #c8102e 47% 53%, #fff 53% 59%, transparent 59%), linear-gradient(-33deg, transparent 41%, #fff 41% 47%, #c8102e 47% 53%, #fff 53% 59%, transparent 59%), linear-gradient(90deg, transparent 40%, #fff 40% 46%, #c8102e 46% 54%, #fff 54% 60%, transparent 60%), linear-gradient(transparent 40%, #fff 40% 46%, #c8102e 46% 54%, #fff 54% 60%, transparent 60%), #21468b; }
.flag-de { background: linear-gradient(#151515 0 33.333%, #d31f2f 33.333% 66.666%, #f3c548 66.666%); }
.flag-fr { background: linear-gradient(90deg, #244aa5 0 33.333%, #fff 33.333% 66.666%, #ed2939 66.666%); }
.flag-es { background: linear-gradient(#c9272c 0 25%, #f4c542 25% 75%, #c9272c 75%); }
.flag-zh { background: radial-gradient(circle at 35% 34%, #ffdf45 0 9%, transparent 10%), #de2910; }
.flag-ru { background: linear-gradient(#fff 0 33.333%, #2453a6 33.333% 66.666%, #d52b3e 66.666%); }
.flag-bg { background: linear-gradient(#fff 0 33.333%, #15966a 33.333% 66.666%, #d6263b 66.666%); }

.tool-intro { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 28px; align-items: center; padding: 20px 0 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tool-intro > img { width: 100%; height: auto; aspect-ratio: 16 / 9; display: block; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; }
.eyebrow, .section-label, .step-label { margin: 0; color: var(--teal-dark); font-size: 11px; font-weight: 850; text-transform: uppercase; }
h1 { max-width: 760px; margin: 8px 0 9px; font-size: 34px; line-height: 1.12; letter-spacing: 0; }
.lead { max-width: 780px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.trust { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.trust span { min-height: 30px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: #3c5961; font-size: 12px; font-weight: 750; }
.trust span:nth-child(2) { border-color: #e6c77f; background: #fff8e8; }
.trust span:nth-child(3) { border-color: #c7d7ec; background: #f1f6fc; }
.privacy-callout { margin: 12px 0; padding: 10px 13px; border-left: 4px solid var(--teal); background: var(--surface-soft); color: #2e5557; font-size: 13px; line-height: 1.45; }

.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.workspace-heading { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: end; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.workspace-heading h2 { margin: 5px 0 0; font-size: 21px; line-height: 1.25; }
.workspace-heading > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.upload-column, .settings-column { min-width: 0; padding: 20px; }
.settings-column { border-left: 1px solid var(--line); }
.upload-column h3, .settings-column h3, .progress-panel h3, .results-heading h3 { margin: 5px 0 12px; font-size: 16px; }
.dropzone { min-height: 210px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 20px; border: 2px dashed #9ecac5; border-radius: 8px; background: #f8fcfb; text-align: center; transition: border-color .15s ease, background .15s ease; }
.dropzone.is-over { border-color: var(--teal); background: #e7f6f3; }
.dropzone > img { width: 52px; height: 52px; padding: 9px; border: 1px solid #cce0dd; border-radius: 8px; background: #fff; }
.dropzone strong { font-size: 16px; }
.dropzone > span { color: var(--muted); font-size: 13px; }
.drop-actions, .main-actions, .result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drop-actions { justify-content: center; margin-top: 7px; }
button { min-height: 40px; border: 0; border-radius: 7px; padding: 0 15px; font-weight: 800; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { background: var(--teal); color: #fff; }
.primary:hover:not(:disabled) { background: var(--teal-dark); }
.secondary { background: #e4efee; color: #173a42; }
.secondary:hover:not(:disabled) { background: #d4e6e3; }
.limits, .settings-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.source-preview { min-height: 84px; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 11px; align-items: center; margin-top: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.source-preview .checkerboard { width: 76px; height: 76px; }
.source-preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
.source-preview strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.source-preview span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.checkerboard { background-color: #fff; background-image: linear-gradient(45deg, #dbe7e5 25%, transparent 25%), linear-gradient(-45deg, #dbe7e5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dbe7e5 75%), linear-gradient(-45deg, transparent 75%, #dbe7e5 75%); background-position: 0 0, 0 6px, 6px -6px, -6px 0; background-size: 12px 12px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.field.full { grid-column: 1 / -1; }
.field > span { color: #3f5961; font-size: 12px; font-weight: 800; }
.field input[type="text"] { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfb; color: var(--ink); }
.field input[type="color"] { width: 52px; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; }
.range-field { grid-template-columns: minmax(0, 1fr) 48px; }
.range-field > span { grid-column: 1 / -1; }
.range-field input { width: 100%; accent-color: var(--teal); }
.range-field output { color: var(--teal-dark); font-size: 13px; font-weight: 850; text-align: right; }
.check-field { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfb; color: #3f5961; font-size: 12px; font-weight: 750; }
.check-field input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--teal); }
.settings-note { min-height: 54px; padding: 9px 10px; border-left: 3px solid var(--gold); background: #fff8e8; color: #6a572f; }
.main-actions { margin-top: 12px; }
.main-actions button { flex: 1 1 160px; }

.progress-panel { padding: 14px 20px; border-top: 1px solid var(--line); background: #f8fbfb; }
.progress-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.progress-panel h3 { margin: 0; }
.progress-panel progress { width: 100%; height: 12px; margin: 10px 0 7px; accent-color: var(--teal); }
.progress-panel span { color: var(--muted); font-size: 12px; }
.status { min-height: 44px; margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f4f8f8; color: #405b63; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.status[data-type="success"] { background: #eaf7ee; color: #256339; }
.status[data-type="error"] { background: #fff0ee; color: var(--danger); }

.results-panel { padding: 20px; }
.results-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.results-heading h3 { margin-bottom: 0; }
.result-actions { align-items: center; justify-content: flex-end; }
.result-actions > span { color: var(--muted); font-size: 12px; }
.verification { min-height: 42px; margin: 14px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfb; color: var(--muted); font-size: 12px; line-height: 1.5; }
.verification[data-type="success"] { border-color: #abd4b6; background: #ecf8ef; color: #246237; }
.verification[data-type="error"] { border-color: #e5b5ae; background: #fff1ef; color: var(--danger); }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.file-card { min-width: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr) 36px; gap: 9px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.file-preview { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border: 1px solid #d7e3e1; border-radius: 6px; }
.file-preview img { width: 46px; height: 46px; display: block; object-fit: contain; }
.file-copy { min-width: 0; }
.file-copy strong, .file-copy span, .file-copy small { display: block; overflow-wrap: anywhere; }
.file-copy strong { font-size: 11px; }
.file-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.file-copy small { margin-top: 2px; color: var(--blue); font-size: 10px; font-weight: 750; }
.icon-button { width: 36px; height: 36px; min-height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #eef5f4; color: #21434c; font-size: 18px; }
.code-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.code-grid > section { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #101d24; }
.code-heading { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px 7px 12px; border-bottom: 1px solid #34454d; color: #eef8f6; }
.code-heading h4 { margin: 0; font-size: 12px; }
.code-heading .icon-button { border-color: #506169; background: #273940; color: #fff; }
pre { min-height: 220px; max-height: 320px; margin: 0; overflow: auto; padding: 12px; color: #dff5ef; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }

.content-section { margin-top: 28px; }
.content-section > section { padding: 25px 0; border-top: 1px solid var(--line); }
.content-section h2, .related-tools h2 { margin: 0 0 11px; font-size: 22px; line-height: 1.25; }
.content-section p, .content-section li, .related-tools span { color: var(--muted); font-size: 14px; line-height: 1.68; }
.content-section p { margin: 0 0 12px; }
.content-section ul, .content-section ol { margin: 12px 0 0; padding-left: 22px; }
.content-section li + li { margin-top: 7px; }
.content-split { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 34px; align-items: start; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 12px; }
th, td { padding: 9px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
thead th { background: #e8f2f0; color: #294850; }
tbody th { width: 210px; color: var(--blue); font-weight: 750; }
td { color: var(--muted); }
.numbered-steps ol { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 28px; counter-reset: steps; list-style: none; padding: 0; }
.numbered-steps li { position: relative; min-height: 54px; padding-left: 42px; counter-increment: steps; }
.numbered-steps li::before { content: counter(steps); position: absolute; left: 0; top: 1px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: 12px; font-weight: 850; }
.worked-example { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding-left: 18px !important; border-left: 4px solid var(--gold); background: #fffaf0; }
.example-metrics { display: grid; align-content: center; gap: 8px; }
.example-metrics div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid #e4d6b6; border-radius: 7px; background: #fff; }
.example-metrics strong { color: var(--coral); font-size: 15px; }
.example-metrics span { color: var(--muted); font-size: 12px; }
.method-section { border-left: 4px solid var(--blue); padding-left: 18px !important; }
.safety-callout { border-left: 4px solid var(--teal); padding-left: 18px !important; background: #edf8f5; }
.faq-list { display: grid; gap: 7px; }
.faq-list details { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.faq-list summary { padding: 12px 14px; cursor: pointer; color: #24434b; font-size: 13px; font-weight: 800; }
.faq-list p { padding: 0 14px 13px; }

.related-tools { padding: 24px 0; border-top: 1px solid var(--line); }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.related-grid a { min-height: 110px; display: grid; align-content: start; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.related-grid a:hover { border-color: var(--teal); }
.related-grid strong { color: #25454d; font-size: 14px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.footer a, .footer button { min-height: 24px; padding: 0; border: 0; background: transparent; color: #31545c; font-size: 12px; text-decoration: none; }
.footer a:hover, .footer button:hover { text-decoration: underline; }

@media (max-width: 980px) {
  .tool-intro { grid-template-columns: minmax(0, 1fr) 250px; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-split, .worked-example { grid-template-columns: 1fr; }
  .example-metrics { grid-template-columns: repeat(3, 1fr); }
  .example-metrics div { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .page { width: min(100% - 18px, 1180px); padding-top: 9px; }
  .topbar { margin-bottom: 8px; }
  .brand-sub, .nav-link { display: none; }
  .tool-intro { grid-template-columns: 1fr; gap: 14px; padding: 16px 0; }
  .tool-intro > img { order: -1; max-height: 210px; }
  h1 { font-size: 27px; }
  .workspace-heading { grid-template-columns: 1fr; gap: 8px; padding: 15px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .upload-column, .settings-column, .results-panel { padding: 15px; }
  .settings-column { border-top: 1px solid var(--line); border-left: 0; }
  .numbered-steps ol { grid-template-columns: 1fr; }
  .code-grid, .related-grid { grid-template-columns: 1fr; }
  .example-metrics { grid-template-columns: 1fr; }
  .footer { display: grid; }
  .footer nav { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .brand > img { width: 38px; height: 38px; }
  .brand-name { font-size: 13px; }
  .language-menu summary { width: 36px; height: 36px; }
  h1 { font-size: 24px; }
  .lead { font-size: 14px; }
  .trust { display: grid; grid-template-columns: 1fr; }
  .dropzone { min-height: 190px; padding: 14px; }
  .drop-actions, .main-actions, .result-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .drop-actions button, .main-actions button, .result-actions button { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .result-grid { grid-template-columns: 1fr; }
  .results-heading { display: grid; }
  .result-actions { justify-content: stretch; }
  .file-card { grid-template-columns: 58px minmax(0, 1fr) 36px; }
  .content-section h2, .related-tools h2 { font-size: 19px; }
  tbody th { width: 160px; }
  pre { min-height: 180px; font-size: 11px; }
}
