:root {
  --page-background: #f4f4f1;
  --surface: #ffffff;
  --surface-muted: #f0f0ed;
  --border: #c9c9c3;
  --border-dark: #8d8d86;
  --text: #242421;
  --text-muted: #5d5d57;
  --accent: #2f4b35;
  --accent-hover: #223a28;
  --result-background: #eef3ed;
  --warning-background: #f3f0e5;
  --max-width: 760px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

.tool-page {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 36px 0 60px 32px;
}

.tool-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
}

h2 {
  margin: 0 0 16px;
  font-size: 1.25rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.intro {
  max-width: 680px;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.calculator {
  overflow: hidden;
  border: 1px solid var(--border-dark);
  background: var(--surface);
}

.input-section {
  padding: 22px;
  border-bottom: 1px solid var(--border);
}

.input-section:nth-child(even) {
  background: #fafaf8;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.additional-fields {
  margin-top: 18px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--border-dark);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
}

select {
  cursor: pointer;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(47, 75, 53, 0.2);
  outline-offset: 1px;
}

.input-with-prefix,
.input-with-unit {
  display: flex;
  align-items: stretch;
}

.input-with-prefix span,
.input-with-unit span {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-dark);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.input-with-prefix span {
  width: 40px;
  border-right: 0;
}

.input-with-prefix input {
  min-width: 0;
}

.input-with-unit input {
  min-width: 0;
  border-right: 0;
}

.input-with-unit span {
  min-width: 68px;
  padding: 0 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding: 20px 22px;
}

button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button:focus-visible {
  outline: 3px solid rgba(47, 75, 53, 0.3);
  outline-offset: 2px;
}

.secondary-button {
  border-color: var(--border-dark);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-muted);
}

.results {
  margin-top: 24px;
  padding: 22px;
  border-left: 5px solid var(--accent);
  background: var(--result-background);
}

.primary-result {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--border-dark);
  background: var(--surface);
}

.primary-result span {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.primary-result strong {
  margin-top: 4px;
  font-size: 2rem;
  line-height: 1.2;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.result-card p {
  margin: 7px 0 0;
  color: var(--text-muted);
}

.result-value {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
}

.summary-box {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.summary-box p {
  margin: 8px 0 0;
}

.content-section {
  margin-top: 30px;
}

.content-section p {
  margin: 0 0 12px;
}

.content-section ul {
  margin: 0;
  padding-left: 22px;
}

.content-section li {
  margin-bottom: 7px;
}

.formula-box {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.formula-box p {
  margin: 0;
}

.disclaimer {
  margin-top: 30px;
  padding: 18px;
  border-left: 4px solid #81713d;
  background: var(--warning-background);
  color: #4d493b;
  font-size: 0.92rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  .tool-page {
    width: min(100% - 24px, var(--max-width));
    margin: 20px auto 40px;
  }

  .field-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .input-section,
  .results {
    padding: 18px;
  }

  .form-actions {
    flex-direction: column;
    padding: 18px;
  }

  .form-actions button {
    width: 100%;
  }

  .primary-result strong {
    font-size: 1.7rem;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 15px;
  }

  .tool-page {
    width: calc(100% - 16px);
    margin-top: 12px;
  }

  .input-section,
  .results,
  .result-card,
  .summary-box,
  .primary-result {
    padding: 15px;
  }
}