:root {
  color-scheme: light;
  --ink: #12242b;
  --muted: #52666d;
  --paper: #ffffff;
  --canvas: #edf4f2;
  --line: #c9d9d5;
  --deep: #102b35;
  --teal: #008f83;
  --teal-soft: #dff4ef;
  --coral: #e55d49;
  --coral-soft: #fff0ec;
  --gold: #b87906;
  --gold-soft: #fff5d7;
  --green: #117a4b;
  --red: #b52e35;
  --shadow: 0 18px 50px rgba(16, 43, 53, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(0, 143, 131, .3); outline-offset: 2px; }

.page { width: min(1240px, 100%); margin: 0 auto; padding: 12px; }
.topbar {
  position: relative;
  z-index: 20;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid #31505a;
  border-radius: 8px;
  color: #f7fbfa;
  background: var(--deep);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; }
.brand img { flex: 0 0 auto; width: 42px; height: 42px; }
.brand-text { display: grid; gap: 1px; min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: 0; white-space: nowrap; }
.brand-sub { color: #bad0d5; font-size: 12px; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.nav-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid #55717a;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { background: #1c3c47; }

.language-menu { position: relative; }
.language-menu summary {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #55717a;
  border-radius: 50%;
  background: #173742;
  list-style: none;
  cursor: pointer;
}
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu-list {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 48px;
  display: grid;
  grid-template-columns: 40px;
  justify-content: center;
  gap: 5px;
  padding: 5px 4px;
  border: 1px solid #31505a;
  border-radius: 8px;
  background: var(--deep);
  box-shadow: var(--shadow);
}
.language-menu-list a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; text-decoration: none; }
.language-menu-list a:hover, .language-menu-list a[aria-current="true"] { background: #31505a; }
.flag-circle { position: relative; width: 28px; height: 28px; display: inline-grid; place-items: center; overflow: hidden; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px rgba(0,0,0,.25); background: #fff; }
.flag-circle::after { font-size: 15px; line-height: 1; }
.flag-en::after { content: "GB"; color: #183b6b; font-weight: 900; font-size: 10px; }
.flag-de { background: linear-gradient(to bottom, #171717 0 33.33%, #d22730 33.33% 66.66%, #f2c400 66.66%); }
.flag-fr { background: linear-gradient(to right, #1f4aa8 0 33.33%, #fff 33.33% 66.66%, #e33d45 66.66%); }
.flag-es { background: linear-gradient(to bottom, #ba1f2d 0 25%, #f4c542 25% 75%, #ba1f2d 75%); }
.flag-zh { background: #df2d2d; }
.flag-zh::after { content: "★"; color: #ffdf4d; font-size: 13px; }
.flag-ru { background: linear-gradient(to bottom, #fff 0 33.33%, #2455b2 33.33% 66.66%, #d9363e 66.66%); }
.flag-bg { background: linear-gradient(to bottom, #fff 0 33.33%, #2b9b58 33.33% 66.66%, #d93745 66.66%); }

.tool-intro {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 8px;
  background: #172d37;
}
.tool-intro picture, .tool-intro picture img { position: absolute; inset: 0; width: 100%; height: 100%; }
.tool-intro img { object-fit: cover; object-position: center 55%; }
.tool-intro::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5, 18, 24, .96) 0%, rgba(5, 18, 24, .78) 47%, rgba(5, 18, 24, .18) 78%, rgba(5, 18, 24, .08) 100%); }
.hero-copy { position: relative; z-index: 1; width: min(690px, 75%); padding: 28px; color: #fff; }
.eyebrow, .section-label { margin: 0 0 7px; color: var(--coral); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0; }
h1, h2, h3, h4 { letter-spacing: 0; }
h1 { margin: 0; max-width: 18ch; font-size: 44px; line-height: 1.05; }
.lead { max-width: 65ch; margin: 12px 0 0; color: #e2eded; font-size: 17px; line-height: 1.55; }
.trust { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.trust span { padding: 6px 8px; border: 1px solid rgba(255,255,255,.34); border-radius: 6px; background: rgba(7,25,32,.7); font-size: 12px; font-weight: 800; }

.workspace { margin-top: 12px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); }
.workspace-heading { display: grid; grid-template-columns: minmax(0, .9fr) minmax(300px, 1.1fr); gap: 24px; align-items: end; }
.workspace-heading h2, .content-section h2 { margin: 0; font-size: 28px; line-height: 1.2; }
.workspace-heading > p { margin: 0; color: var(--muted); line-height: 1.6; }
.preset-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0; }
.preset-row button, .secondary {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #90aaa5;
  border-radius: 8px;
  color: var(--deep);
  background: #f7fbfa;
  font-weight: 800;
}
.preset-row button:hover, .secondary:hover { border-color: var(--teal); background: var(--teal-soft); }
.calculator-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr); gap: 28px; align-items: start; }
.control-form { display: grid; gap: 18px; min-width: 0; }
fieldset { min-width: 0; margin: 0; padding: 16px 0 0; border: 0; border-top: 2px solid var(--line); }
legend { padding: 0 10px 0 0; color: var(--deep); font-size: 16px; font-weight: 900; }
.field-grid { display: grid; gap: 10px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; margin-top: 10px; }
.field > span { color: #2b464f; font-size: 13px; font-weight: 800; }
.field small { min-height: 34px; color: var(--muted); font-size: 12px; line-height: 1.4; }
input, select, output {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #9fb7b2;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}
input:disabled { color: #65777d; background: #eaf0ee; }
output { display: flex; align-items: center; background: #eef7f4; line-height: 1.35; }
.action-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.action-row span { color: var(--green); font-size: 13px; }

.results-panel { position: sticky; top: 12px; min-width: 0; padding-left: 24px; border-left: 2px solid var(--line); }
.results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.results-heading h3 { margin: 0; font-size: 24px; }
.status-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0; border-block: 1px solid var(--line); }
.status-strip div { min-width: 0; display: grid; gap: 5px; padding: 11px 9px; }
.status-strip div + div { border-left: 1px solid var(--line); }
.status-strip span { color: var(--muted); font-size: 12px; }
.status-value { overflow-wrap: anywhere; font-size: 14px; }
.status-value.good { color: var(--green); }
.status-value.warn { color: var(--gold); }
.status-value.bad { color: var(--red); }
.status-value.neutral { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.metric-grid > div { min-width: 0; min-height: 118px; display: grid; align-content: center; gap: 6px; padding: 13px; background: #f8fbfa; }
.metric-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
.metric-grid > div:nth-child(n+3) { border-top: 1px solid var(--line); }
.metric-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.metric-grid strong { font-size: 28px; line-height: 1.05; overflow-wrap: anywhere; }
.metric-grid small { color: #60747a; line-height: 1.35; }
.energy-balance { margin-top: 15px; padding: 14px; border-left: 4px solid var(--teal); background: var(--teal-soft); }
.energy-balance h4 { margin: 0 0 10px; }
.energy-balance > div { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-top: 1px solid rgba(0,143,131,.2); }
.energy-balance span { color: var(--muted); }
.positive { color: var(--green); }
.negative { color: var(--red); }
.calculation-note { margin: 13px 0; padding: 11px 12px; border: 1px solid #dfbd65; border-radius: 7px; color: #6b4c0c; background: var(--gold-soft); line-height: 1.5; }
.calculation-note.warning { border-color: #e48d7e; color: #862e25; background: var(--coral-soft); }
.math-details { border-top: 1px solid var(--line); padding-top: 12px; }
.math-details summary { color: var(--teal); font-weight: 900; cursor: pointer; }
.math-details pre { max-width: 100%; overflow: auto; margin: 10px 0 0; padding: 12px; border-radius: 7px; color: #e8f2f1; background: var(--deep); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

.content-section { display: grid; gap: 0; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); }
.content-section > section { min-width: 0; padding: 26px; }
.content-section > section + section { border-top: 1px solid var(--line); }
.content-section p, .content-section li { color: #3d555d; line-height: 1.72; }
.content-section ul, .content-section ol { padding-left: 21px; }
.content-section li + li { margin-top: 7px; }
.numbered-steps ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; counter-reset: steps; padding: 0; list-style: none; }
.numbered-steps li { position: relative; min-height: 46px; padding-left: 46px; counter-increment: steps; }
.numbered-steps li::before { content: counter(steps); position: absolute; left: 0; top: 2px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--teal); font-weight: 900; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; margin-top: 15px; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
thead th { color: #fff; background: var(--deep); }
tbody th { color: var(--deep); background: #f1f7f5; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.worked-example { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 30px; background: #fff8ed; }
.worked-example ol { margin: 0; }
.content-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
.content-split > div + div { padding-left: 36px; border-left: 1px solid var(--line); }
.safety-callout { border-left: 6px solid var(--coral); background: var(--coral-soft); }
.privacy-callout { border-left: 6px solid var(--teal); background: var(--teal-soft); }
.limitations-section { border-left: 6px solid var(--gold); background: var(--gold-soft); }
.sources-section ul { display: grid; gap: 10px; padding: 0; list-style: none; }
.sources-section li { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfa; }
.sources-section a { color: var(--teal); font-weight: 900; }
.sources-section span { color: var(--muted); font-size: 13px; }
.faq-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.faq-list details { border: 1px solid var(--line); border-radius: 7px; padding: 13px; background: #f8fbfa; }
.faq-list summary { color: var(--deep); font-weight: 900; cursor: pointer; }
.faq-list p { margin-bottom: 0; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 4px 8px; 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 { color: var(--teal); }
.privacy-settings { padding: 0; border: 0; color: var(--teal); background: transparent; text-decoration: underline; }

@media (max-width: 960px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; padding: 20px 0 0; border-left: 0; border-top: 2px solid var(--line); }
  .workspace-heading { grid-template-columns: 1fr; gap: 8px; }
  .worked-example, .content-split { grid-template-columns: 1fr; }
  .content-split > div + div { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .page { padding: 7px; }
  .topbar { align-items: center; }
  .brand-sub { display: none; }
  .nav-link { max-width: 150px; white-space: normal; text-align: center; line-height: 1.2; }
  .tool-intro { min-height: 360px; align-items: flex-end; }
  .tool-intro::after { background: linear-gradient(0deg, rgba(5,18,24,.96) 0%, rgba(5,18,24,.76) 62%, rgba(5,18,24,.2) 100%); }
  .hero-copy { width: 100%; padding: 18px; }
  h1 { font-size: 34px; }
  .lead { font-size: 15px; }
  .workspace { padding: 15px; }
  .preset-row, .field-grid.two, .field-grid.three, .status-strip, .metric-grid, .numbered-steps ol, .faq-list { grid-template-columns: 1fr; }
  .status-strip div + div { border-left: 0; border-top: 1px solid var(--line); }
  .metric-grid > div:nth-child(odd) { border-right: 0; }
  .metric-grid > div:nth-child(n+2) { border-top: 1px solid var(--line); }
  .metric-grid > div { min-height: 96px; }
  .results-heading { align-items: center; }
  .content-section > section { padding: 19px 16px; }
  .footer { align-items: flex-start; flex-direction: column; }
  .footer nav { justify-content: flex-start; }
}

@media (max-width: 390px) {
  .brand-name { font-size: 14px; }
  .brand img { width: 36px; height: 36px; }
  .nav-link { max-width: 116px; font-size: 12px; }
  .workspace-heading h2, .content-section h2 { font-size: 24px; }
  .results-heading { align-items: flex-start; flex-direction: column; }
}
