/* Mobile-first stylesheet. Base layout is a single column that fits a
   390px-wide phone; wider screens only add breathing room. No fixed
   widths anywhere that could force horizontal scrolling. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: #1a2b23;
  background: #f7f8f5;
}
a { color: #1f5c43; }
a:visited { color: #1f5c43; }
.wrap { width: min(720px, 100% - 32px); margin-inline: auto; }
header.site {
  background: #1f5c43;
  color: #fff;
  padding: 20px 0 16px;
}
header.site a.brand {
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
header.site p.tag { margin: 6px 0 0; color: #cfe3d8; font-size: 14px; }
main { padding: 24px 0 40px; }
h1 {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: 0 0 12px;
  overflow-wrap: break-word;
}
h2 { font-size: 22px; line-height: 1.3; margin: 32px 0 10px; }
h3 { font-size: 18px; margin: 24px 0 8px; }
p { margin: 0 0 14px; }
.lede { color: #44584d; font-size: 18px; }
.calculator {
  background: #fff;
  border: 1px solid #d8ded1;
  border-radius: 12px;
  padding: 20px 16px;
  margin: 20px 0;
}
.mode-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.mode-tabs button {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #b7c4b8;
  border-radius: 8px;
  background: #f2f5f0;
  color: #1f5c43;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.mode-tabs button[aria-selected="true"] {
  background: #1f5c43;
  border-color: #1f5c43;
  color: #fff;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #b7c4b8;
  border-radius: 8px;
  font: inherit;
  font-size: 17px;
  background: #fff;
}
.field .hint { color: #626b62; font-size: 14px; margin-top: 6px; }
button.calculate, button.copy-btn {
  width: 100%;
  min-height: 52px;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #1f5c43;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
button.copy-btn {
  background: #fff;
  border-color: #b7c4b8;
  color: #1f5c43;
  margin-top: 12px;
}
.result {
  background: #eef4ee;
  border: 1px solid #c3d6c7;
  border-radius: 10px;
  padding: 16px;
  margin-top: 18px;
}
.result[hidden] { display: none; }
.result .big { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.result dl { margin: 0; }
.result dt { float: left; color: #44584d; }
.result dd { margin: 0 0 6px 140px; font-weight: 600; text-align: right; }
.error { color: #9b2c1f; font-weight: 600; }
.note {
  background: #fdf6e3;
  border-left: 4px solid #c9a227;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin: 18px 0;
}
.note p { margin: 0; }
.example {
  background: #fff;
  border: 1px solid #d8ded1;
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}
table.rates { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rates th, table.rates td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #e2e6dc;
}
table.rates td:last-child, table.rates th:last-child { text-align: right; }
footer.site {
  border-top: 1px solid #d8ded1;
  padding: 20px 0 32px;
  color: #626b62;
  font-size: 14px;
}
footer.site a { color: #1f5c43; }
details { margin: 16px 0; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; }

/* Narrow-phone fine tuning: keep everything inside 390px. */
@media (max-width: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 28px; }
  .wrap { width: min(720px, 100% - 24px); }
  .calculator { padding: 16px 12px; }
  .result dd { margin-left: 110px; }
  .mode-tabs button { font-size: 14px; padding: 10px 8px; }
}

/* Wider screens: roomier container, example cards side by side. */
@media (min-width: 720px) {
  main { padding: 32px 0 48px; }
  h1 { font-size: 40px; }
  .calculator { padding: 24px; }
  .example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .example-grid .example { margin: 0; }
}
