:root {
  color-scheme: light;
  --ink: #071d2a;
  --muted: #506976;
  --line: #c9dde1;
  --line-strong: #9fc5cb;
  --surface: #ffffff;
  --soft: #edf7f8;
  --soft-blue: #eef4ff;
  --teal: #087f8c;
  --teal-dark: #05616b;
  --coral: #ef765f;
  --gold: #d69b20;
  --danger: #a63d36;
  --shadow: 0 16px 38px rgba(17, 58, 70, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: #f4fafb; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #f4fafb; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select, label { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal-dark); }
img { display: block; max-width: 100%; }
.page { width: min(1160px, calc(100% - 28px)); margin: 0 auto; padding: 12px 0 34px; }

.topbar { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 10px; }
.brand { display: flex; min-width: 0; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand > img { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 6px; }
.brand-text { display: grid; min-width: 0; }
.brand-name { overflow: hidden; font-size: 15px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.nav-link { display: inline-flex; min-height: 34px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.nav-link:hover { border-color: var(--teal); color: var(--teal-dark); }

.language-menu { position: relative; z-index: 20; }
.language-menu summary { display: grid; width: 36px; height: 36px; cursor: pointer; list-style: none; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; box-shadow: 0 4px 10px rgba(18, 61, 73, 0.09); }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu[open] summary { border-color: var(--teal); }
.language-menu-list { position: absolute; top: 42px; right: 0; display: grid; width: 48px; grid-template-columns: 1fr; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #081722; box-shadow: var(--shadow); }
.language-menu-list a { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 50%; }
.language-menu-list a:hover, .language-menu-list a[aria-current="true"] { border-color: #65d6dc; background: #153242; }
.flag-circle { position: relative; display: block; width: 25px; height: 25px; overflow: hidden; border: 1px solid rgba(4, 19, 29, 0.2); border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.flag-en { background-color: #194a8d; background-image: linear-gradient(27deg, transparent 43%, #fff 43%, #fff 50%, #c8102e 50%, #c8102e 55%, transparent 55%), linear-gradient(-27deg, transparent 43%, #fff 43%, #fff 50%, #c8102e 50%, #c8102e 55%, transparent 55%), linear-gradient(to right, transparent 40%, #fff 40%, #fff 60%, transparent 60%), linear-gradient(to bottom, transparent 40%, #fff 40%, #fff 60%, transparent 60%), linear-gradient(to right, transparent 46%, #c8102e 46%, #c8102e 54%, transparent 54%), linear-gradient(to bottom, transparent 46%, #c8102e 46%, #c8102e 54%, transparent 54%); }
.flag-de { background: linear-gradient(to bottom, #161616 0 33.33%, #d9222a 33.33% 66.66%, #f4c430 66.66%); }
.flag-fr { background: linear-gradient(to right, #174a9c 0 33.33%, #fff 33.33% 66.66%, #e3323b 66.66%); }
.flag-es { background: linear-gradient(to bottom, #b51f2e 0 25%, #f3c84b 25% 75%, #b51f2e 75%); }
.flag-ru { background: linear-gradient(to bottom, #fff 0 33.33%, #2458b8 33.33% 66.66%, #d72f3e 66.66%); }
.flag-bg { background: linear-gradient(to bottom, #fff 0 33.33%, #159563 33.33% 66.66%, #d43c47 66.66%); }
.flag-zh { background: #dc2838; }
.flag-zh::before { position: absolute; top: 2px; left: 4px; color: #ffdd42; content: "★"; font-size: 10px; line-height: 1; }

.tool-intro { display: grid; min-height: 250px; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.tool-intro > div { align-self: center; padding: 30px 34px; }
.tool-intro > img { width: 100%; height: 100%; min-height: 250px; object-fit: cover; object-position: center; }
.eyebrow, .section-label, .step-label { margin: 0 0 7px; color: var(--teal-dark); font-size: 11px; font-weight: 850; text-transform: uppercase; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { max-width: 720px; margin: 0; font-size: 38px; line-height: 1.06; }
.lead { max-width: 720px; margin: 14px 0 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.trust { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.trust span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); font-size: 11px; font-weight: 800; }
.privacy-callout { margin: 14px 0; padding: 12px 16px; border-left: 4px solid var(--coral); background: #fff5f2; color: #5a2a22; font-size: 14px; line-height: 1.5; }

.workspace { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.workspace-heading { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1.15fr); gap: 24px; align-items: end; padding: 22px 24px; border-bottom: 1px solid var(--line); background: var(--soft); }
.workspace-heading h2 { margin: 0; font-size: 24px; }
.workspace-heading > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr); }
.input-column, .output-column { min-width: 0; padding: 24px; }
.input-column { border-right: 1px solid var(--line); }
.input-column h3, .output-column h3 { margin: 0 0 14px; font-size: 20px; }
.dropzone { display: grid; min-height: 178px; cursor: pointer; place-items: center; align-content: center; gap: 6px; padding: 20px; border: 2px dashed var(--line-strong); border-radius: 8px; background: #f8fcfd; text-align: center; }
.dropzone:hover, .dropzone.is-over { border-color: var(--teal); background: #eefafb; }
.dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.dropzone:focus-within { outline: 3px solid rgba(8, 127, 140, 0.22); outline-offset: 2px; }
.drop-icon { display: grid; width: 56px; height: 56px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; }
.drop-icon img { width: 42px; height: 42px; }
.dropzone strong { font-size: 17px; }
.dropzone span:not(.drop-icon), .dropzone small { color: var(--muted); line-height: 1.4; }
.dropzone small { font-size: 11px; }
.selected-file { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; align-items: center; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft-blue); }
.selected-file img { width: 78px; height: 58px; border-radius: 4px; background: white; object-fit: contain; }
.selected-file div { display: grid; min-width: 0; gap: 4px; }
.selected-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file span { color: var(--muted); font-size: 12px; }
.wide { width: 100%; margin-top: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.settings-grid label { display: grid; min-width: 0; gap: 6px; }
.settings-grid label > span { color: var(--muted); font-size: 12px; font-weight: 800; }
select { width: 100%; min-height: 42px; padding: 0 34px 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; color: var(--ink); }
button { min-height: 40px; cursor: pointer; border-radius: 6px; font-weight: 800; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(8, 127, 140, 0.25); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
.primary, .secondary, .danger { padding: 0 14px; }
.primary { border: 1px solid var(--teal); background: var(--teal); color: white; }
.primary:hover:not(:disabled) { border-color: var(--teal-dark); background: var(--teal-dark); }
.secondary { border: 1px solid var(--line-strong); background: white; color: var(--ink); }
.secondary:hover:not(:disabled) { border-color: var(--teal); color: var(--teal-dark); }
.danger { border: 1px solid #d6a29e; background: #fff5f4; color: var(--danger); }
.danger:hover:not(:disabled) { border-color: var(--danger); }
.main-actions, .ai-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.main-actions .primary { flex: 1 1 170px; }
.progress-shell { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; align-items: center; margin-top: 14px; }
progress { width: 100%; height: 12px; overflow: hidden; border: 0; border-radius: 6px; background: var(--soft); }
progress::-webkit-progress-bar { background: var(--soft); }
progress::-webkit-progress-value { background: var(--teal); }
progress::-moz-progress-bar { background: var(--teal); }
.progress-shell span { text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.status { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.output-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.icon-actions { display: flex; gap: 6px; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; padding: 0; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 20px; }
.icon-button:hover:not(:disabled) { border-color: var(--teal); color: var(--teal-dark); }
textarea { display: block; width: 100%; min-height: 314px; resize: vertical; padding: 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fbfdfd; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; line-height: 1.55; }
.ai-note, .metric-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--line); }
.metrics div { display: grid; min-height: 68px; align-content: center; gap: 3px; padding: 10px; background: white; }
.metrics strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.metrics span { color: var(--muted); font-size: 11px; line-height: 1.3; }

.confirm-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: white; box-shadow: 0 24px 70px rgba(5, 24, 34, 0.28); }
.confirm-dialog::backdrop { background: rgba(5, 24, 34, 0.62); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 0 0 10px; font-size: 23px; }
.confirm-dialog p, .confirm-dialog li { color: var(--muted); line-height: 1.55; }
.confirm-dialog ul { padding-left: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.content-section { padding: 22px 0 0; }
.content-section > section { padding: 28px 8px; border-bottom: 1px solid var(--line); }
.content-section h2 { margin: 0 0 12px; font-size: 25px; line-height: 1.2; }
.content-section p, .content-section li, .content-section td, .content-section th { color: #385461; font-size: 15px; line-height: 1.7; }
.content-section p { margin: 9px 0; }
.content-section ul, .content-section ol { margin: 10px 0; padding-left: 22px; }
.content-section li + li { margin-top: 7px; }
.content-split { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr); gap: 32px; align-items: start; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--soft); color: var(--ink); font-size: 12px; }
tbody th { color: var(--ink); font-weight: 850; }
.numbered-steps ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; counter-reset: step; list-style: none; padding: 0; }
.numbered-steps li { position: relative; min-height: 56px; padding: 8px 8px 8px 46px; counter-increment: step; }
.numbered-steps li::before { position: absolute; top: 8px; left: 0; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--teal); color: white; content: counter(step); font-size: 13px; font-weight: 850; }
.worked-example { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 28px; background: var(--soft-blue); }
.example-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid #c8d5ee; border-radius: 6px; background: #c8d5ee; }
.example-metrics div { display: grid; min-height: 82px; align-content: center; gap: 4px; padding: 12px; background: white; }
.example-metrics strong { color: #194a8d; font-size: 19px; }
.example-metrics span { color: var(--muted); font-size: 12px; }
.safety-callout { padding-right: 22px !important; padding-left: 22px !important; border-left: 4px solid var(--gold); background: #fffaf0; }
.faq-list { display: grid; gap: 8px; }
.faq-list details { border: 1px solid var(--line); border-radius: 6px; background: white; }
.faq-list summary { cursor: pointer; padding: 13px 15px; font-weight: 800; }
.faq-list p { padding: 0 15px 14px; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 6px 0; color: var(--muted); font-size: 12px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.footer a, .privacy-settings { border: 0; background: none; color: var(--teal-dark); font-size: 12px; font-weight: 700; text-decoration: underline; }
.privacy-settings { min-height: 0; padding: 0; }

@media (max-width: 860px) {
  .tool-intro { grid-template-columns: 1fr; }
  .tool-intro > div { padding: 25px; }
  .tool-intro > img { height: 220px; min-height: 0; }
  h1 { font-size: 33px; }
  .workspace-heading, .workspace-grid, .content-split, .worked-example { grid-template-columns: 1fr; }
  .input-column { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .page { width: min(100% - 18px, 1160px); padding-top: 6px; }
  .topbar { align-items: flex-start; }
  .brand-sub { display: none; }
  .brand-name { max-width: 140px; }
  .nav-link { max-width: 118px; white-space: normal; text-align: center; }
  .tool-intro > div { padding: 21px 18px; }
  .tool-intro > img { height: 180px; }
  h1 { font-size: 29px; }
  .lead { font-size: 15px; }
  .workspace-heading, .input-column, .output-column { padding: 18px 14px; }
  .settings-grid, .metrics, .numbered-steps ol, .example-metrics { grid-template-columns: 1fr; }
  textarea { min-height: 260px; }
  .content-section > section { padding: 24px 2px; }
  .safety-callout { padding-right: 14px !important; padding-left: 14px !important; }
  .footer { align-items: flex-start; flex-direction: column; }
  .footer nav { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
