:root {
  color-scheme: light;
  --ink: #102a34;
  --muted: #536b73;
  --line: #c8dadd;
  --surface: #ffffff;
  --soft: #eef6f6;
  --teal: #087b82;
  --teal-dark: #07565d;
  --coral: #cf5c48;
  --green: #277a58;
  --amber: #9b6516;
  --shadow: 0 14px 34px rgba(18, 55, 63, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #eef5f5; }
body { margin: 0; color: var(--ink); background: #f4f8f8; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, select, .file-button { min-height: 42px; }
a { color: var(--teal-dark); }
img { display: block; max-width: 100%; }

.page { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; margin-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 42px; height: 42px; }
.brand-text { display: grid; gap: 1px; }
.brand-name { font-size: 15px; font-weight: 850; }
.brand-sub { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.nav-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 750; text-decoration: none; }
.nav-link:hover { border-color: var(--teal); color: var(--teal-dark); }

.language-menu { position: relative; z-index: 20; }
.language-menu summary { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); box-shadow: 0 5px 14px rgba(15, 55, 63, 0.1); cursor: pointer; list-style: none; }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu-list { position: absolute; top: 48px; right: 0; display: grid; grid-template-columns: 40px; gap: 4px; width: 52px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.language-menu-list a { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; text-decoration: none; }
.language-menu-list a:hover, .language-menu-list a[aria-current="true"] { background: #dff1f1; outline: 2px solid rgba(8, 123, 130, 0.18); }
.flag-circle { display: grid; width: 28px; height: 28px; place-items: center; overflow: hidden; border: 1px solid rgba(16, 42, 52, 0.2); border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07); }
.flag-circle::before { content: none; }
.flag-en {
  background:
    linear-gradient(33deg, transparent 0 42%, #fff 42% 47%, #c8102e 47% 53%, #fff 53% 58%, transparent 58%),
    linear-gradient(-33deg, transparent 0 42%, #fff 42% 47%, #c8102e 47% 53%, #fff 53% 58%, transparent 58%),
    linear-gradient(90deg, transparent 0 42%, #fff 42% 46%, #c8102e 46% 54%, #fff 54% 58%, transparent 58%),
    linear-gradient(0deg, transparent 0 38%, #fff 38% 44%, #c8102e 44% 56%, #fff 56% 62%, transparent 62%),
    #012169;
}
.flag-de { background: linear-gradient(#000 0 33.33%, #dd0000 33.33% 66.66%, #ffce00 66.66%); }
.flag-fr { background: linear-gradient(90deg, #0055a4 0 33.33%, #fff 33.33% 66.66%, #ef4135 66.66%); }
.flag-es { background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%); }
.flag-zh { background: radial-gradient(circle at 35% 35%, #ffde00 0 3px, transparent 3.5px), #de2910; }
.flag-ru { background: linear-gradient(#fff 0 33.33%, #0039a6 33.33% 66.66%, #d52b1e 66.66%); }
.flag-bg { background: linear-gradient(#fff 0 33.33%, #00966e 33.33% 66.66%, #d62612 66.66%); }

.tool-intro { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr); gap: 24px; align-items: center; padding: 24px 0 18px; }
.tool-intro h1 { margin: 5px 0 10px; max-width: 760px; font-size: 42px; line-height: 1.05; letter-spacing: 0; }
.eyebrow, .section-label { margin: 0; color: var(--teal-dark); font-size: 12px; font-weight: 850; letter-spacing: 0; text-transform: uppercase; }
.lead { max-width: 720px; margin: 0; color: #405b64; font-size: 18px; line-height: 1.55; }
.trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.trust span { padding: 7px 9px; border: 1px solid #b9d4d6; border-radius: 6px; background: #eff9f8; color: #18545a; font-size: 12px; font-weight: 800; }
.tool-intro picture { overflow: hidden; border: 1px solid #b8ced1; border-radius: 8px; background: #101a21; box-shadow: var(--shadow); aspect-ratio: 16 / 9; }
.tool-intro picture img { width: 100%; height: 100%; object-fit: cover; }
.decision-warning { margin: 0 0 18px; padding: 12px 14px; border-left: 4px solid var(--coral); background: #fff2ef; color: #6f2f25; font-size: 14px; line-height: 1.5; }

.workspace { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.96); box-shadow: var(--shadow); }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.workspace-heading h2 { margin: 3px 0 0; font-size: 26px; line-height: 1.15; }
.workspace-heading > p { max-width: 560px; margin: 0; color: var(--muted); line-height: 1.5; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr); gap: 16px; align-items: start; }
.input-panel, .result-panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.input-panel { padding: 16px; }
.input-panel label[for="sourceText"] { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 850; }
textarea { width: 100%; min-height: 330px; resize: vertical; padding: 13px; border: 1px solid #afc8cc; border-radius: 6px; color: var(--ink); background: #fbfdfd; line-height: 1.55; }
textarea:focus, select:focus, button:focus-visible, .file-button:focus-within { outline: 3px solid rgba(8, 123, 130, 0.2); outline-offset: 2px; border-color: var(--teal); }
.input-tools { display: grid; grid-template-columns: minmax(145px, 1fr) auto auto; gap: 8px; margin-top: 10px; }
select { width: 100%; padding: 0 34px 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
button, .file-button { display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: #f5f9f9; color: var(--ink); font-weight: 800; cursor: pointer; }
button:hover, .file-button:hover { border-color: var(--teal); background: #e8f5f4; }
button.primary { border-color: var(--teal); background: var(--teal); color: #fff; }
button.primary:hover { background: var(--teal-dark); }
button:disabled { cursor: not-allowed; opacity: 0.5; }
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.text-stats div { min-width: 0; padding: 9px; border: 1px solid #d5e2e3; border-radius: 6px; background: var(--soft); }
.text-stats span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.text-stats strong { display: block; margin-top: 2px; font-size: 18px; }
.runtime-status { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.runtime-status[data-tone="success"] { color: var(--green); }
.runtime-status[data-tone="warning"] { color: var(--amber); }
.runtime-status[data-tone="error"] { color: #a33b2d; }
.runtime-status[data-tone="working"] { color: var(--teal-dark); }

.result-panel { padding: 16px; }
.result-summary { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 15px; align-items: center; }
.score-ring { --score: 0; display: grid; width: 132px; height: 132px; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--score) * 1%), #d9e5e6 0); }
.score-ring::before { grid-area: 1 / 1; width: 104px; height: 104px; border-radius: 50%; background: var(--surface); content: ""; }
.score-value { z-index: 1; grid-area: 1 / 1; text-align: center; }
.score-value strong { display: block; font-size: 34px; line-height: 1; }
.score-value span { display: block; max-width: 88px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.2; }
.result-copy h3 { margin: 0 0 6px; font-size: 22px; line-height: 1.15; }
.result-copy p { margin: 0; color: var(--muted); line-height: 1.48; }
.result-panel[data-verdict="high"] .score-ring, .result-panel[data-verdict="elevated"] .score-ring { background: conic-gradient(var(--coral) calc(var(--score) * 1%), #e8dcda 0); }
.result-panel[data-verdict="low"] .score-ring { background: conic-gradient(var(--green) calc(var(--score) * 1%), #d8e8df 0); }
.result-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.result-facts div { padding: 9px; border: 1px solid #d5e2e3; border-radius: 6px; background: var(--soft); }
.result-facts span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.result-facts strong { display: block; margin-top: 2px; font-size: 14px; }
.signal-section { margin-top: 16px; }
.signal-section h4 { margin: 0 0 8px; font-size: 15px; }
.signal-list, .recommend-list { margin: 0; padding: 0; list-style: none; }
.signal-list { display: grid; gap: 7px; }
.signal-item { padding: 9px 10px; border-left: 4px solid #8aa3a8; background: #f5f8f8; }
.signal-item[data-direction="ai"] { border-left-color: var(--coral); background: #fff4f1; }
.signal-item[data-direction="human"] { border-left-color: var(--green); background: #eff8f3; }
.signal-item > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.signal-item strong { font-size: 13px; }
.signal-item span { font-size: 12px; font-weight: 850; }
.signal-item p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.metrics-grid div { min-width: 0; padding: 8px; border: 1px solid #dbe6e7; border-radius: 6px; }
.metrics-grid span { display: block; color: var(--muted); font-size: 11px; }
.metrics-grid strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 14px; }
.recommend-list { display: grid; gap: 5px; }
.recommend-list li { position: relative; padding-left: 17px; color: #405b64; font-size: 13px; line-height: 1.45; }
.recommend-list li::before { position: absolute; left: 0; color: var(--teal); content: "✓"; font-weight: 900; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.content-section { display: grid; gap: 0; margin-top: 24px; border-top: 1px solid var(--line); background: var(--surface); }
.content-section > section { padding: 28px 4px; border-bottom: 1px solid var(--line); }
.content-section h2 { margin: 0 0 11px; font-size: 26px; line-height: 1.15; }
.content-section h3 { margin: 18px 0 7px; font-size: 18px; }
.content-section p, .content-section li { color: #3e5962; line-height: 1.65; }
.content-section p { margin: 9px 0; }
.content-section ul, .content-section ol { margin: 12px 0 0; padding-left: 22px; }
.content-section li + li { margin-top: 6px; }
.content-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.numbered-steps ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.worked-example { background: #f1f8f7; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; margin-top: 14px; border-collapse: collapse; min-width: 620px; }
th, td { padding: 10px; border: 1px solid #cbdcde; text-align: left; vertical-align: top; line-height: 1.45; }
thead th { background: #e2f0ef; color: #174a50; font-size: 12px; }
tbody th { width: 22%; background: #f7faf9; }
.safety-section { border-left: 4px solid var(--coral); padding-left: 18px !important; background: #fff8f6; }
.privacy-section { border-left: 4px solid var(--green); padding-left: 18px !important; background: #f5fbf7; }
.limitations-section { background: #fbf7ef; }
.sources-section ul { display: grid; gap: 9px; padding: 0; list-style: none; }
.sources-section li { padding: 10px; border: 1px solid #d4e1e2; border-radius: 6px; }
.sources-section a { display: block; font-weight: 850; }
.sources-section span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.faq-list { display: grid; gap: 8px; }
.faq-list details { border: 1px solid #cfdee0; border-radius: 6px; background: #fbfdfd; }
.faq-list summary { padding: 12px 14px; cursor: pointer; font-weight: 800; }
.faq-list details p { padding: 0 14px 12px; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 4px; color: var(--muted); font-size: 13px; }
.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.footer a, .privacy-settings { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--teal-dark); font-size: 13px; font-weight: 700; text-decoration: underline; }

@media (max-width: 860px) {
  .tool-intro, .workspace-grid { grid-template-columns: 1fr; }
  .tool-intro picture { width: 100%; max-width: 620px; }
  .workspace-heading { align-items: start; flex-direction: column; }
  .content-split { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 620px) {
  .page { width: min(100% - 18px, 1120px); padding-top: 10px; }
  .topbar { align-items: flex-start; }
  .brand-sub { display: none; }
  .nav-link { max-width: 128px; padding: 0 9px; text-align: center; }
  .tool-intro { gap: 16px; padding-top: 12px; }
  .tool-intro h1 { font-size: 34px; }
  .lead { font-size: 16px; }
  .workspace { padding: 12px; }
  .input-tools { grid-template-columns: 1fr 1fr; }
  .input-tools select { grid-column: 1 / -1; }
  textarea { min-height: 280px; }
  .result-summary { grid-template-columns: 106px minmax(0, 1fr); }
  .score-ring { width: 106px; height: 106px; }
  .score-ring::before { width: 82px; height: 82px; }
  .score-value strong { font-size: 28px; }
  .result-copy h3 { font-size: 19px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .numbered-steps ol { grid-template-columns: 1fr; }
  .content-section h2 { font-size: 23px; }
  .footer { align-items: flex-start; flex-direction: column; }
  .footer nav { justify-content: flex-start; }
}

@media (max-width: 390px) {
  .top-actions { gap: 6px; }
  .nav-link { max-width: 104px; font-size: 11px; }
  .text-stats { grid-template-columns: 1fr; }
  .result-facts, .metrics-grid { grid-template-columns: 1fr; }
  .input-tools { grid-template-columns: 1fr; }
  .input-tools select { grid-column: auto; }
}
