:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #152329;
  --muted: #6b7a80;
  --border: #dce6e8;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e6f4f2;
  --danger: #b42318;
  --shadow: 0 12px 35px rgba(18, 45, 52, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 28px)); margin-inline: auto; }

.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { min-height: 68px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; }
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.brand-sub { font-size: 12px; color: var(--muted); }

.page { padding: 20px 0 55px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 8px 0 18px; }
.eyebrow, .step { color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.05; margin: 6px 0 9px; letter-spacing: -.04em; }
.intro p { max-width: 700px; margin: 0; color: var(--muted); }
.intro-note { background: var(--primary-soft); color: var(--primary-dark); padding: 12px 15px; border-radius: 12px; font-size: 13px; min-width: 170px; }

.calculator-card, .chart-card, .table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.calculator-card { padding: clamp(18px, 3vw, 30px); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-heading.compact { margin-bottom: 14px; }
h2, h3 { margin: 3px 0 0; letter-spacing: -.025em; }
h2 { font-size: clamp(21px, 3vw, 28px); }
h3 { font-size: 19px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-button { border: 0; background: transparent; color: var(--primary); font-weight: 700; padding: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); font-weight: 600; }
.field em { font-style: normal; color: var(--muted); font-size: 11px; }
.field input, .field select { width: 100%; min-height: 48px; border: 1px solid #cfdcde; border-radius: 12px; background: #fff; color: var(--text); padding: 0 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15,118,110,.10); }

.primary-button, .secondary-button { border: 0; border-radius: 12px; min-height: 48px; font-weight: 800; }
.primary-button { width: 100%; margin-top: 20px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; }
.primary-button:hover { background: var(--primary-dark); }
.arrow { font-size: 20px; }
.secondary-button { padding: 0 15px; background: var(--primary-soft); color: var(--primary-dark); }

.validation { margin-top: 15px; background: #fff0ef; color: var(--danger); border: 1px solid #f5c9c5; border-radius: 11px; padding: 11px 13px; font-size: 13px; }
.hidden { display: none !important; }

.ad-slot { min-height: 90px; border: 1px dashed #c7d3d5; background: #fff; color: #98a5a8; display: grid; place-items: center; text-align: center; margin: 18px 0; border-radius: 12px; font-size: 12px; }
.ad-slot span { font-size: 9px; letter-spacing: .15em; font-weight: 800; }
.ad-slot div { margin-top: -28px; }
.ad-top { min-height: 100px; }

.results { margin-top: 24px; }
.results-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 15px; }
.status { background: var(--primary-soft); color: #135a55; border: 1px solid #cbe6e2; padding: 13px 15px; border-radius: 12px; font-size: 13px; margin-bottom: 15px; }
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.summary-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 15px; min-width: 0; }
.summary-card span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.summary-card strong { display: block; font-size: 16px; overflow-wrap: anywhere; }

.chart-card, .table-card { margin-top: 15px; padding: 18px; }
.chart-wrap { width: 100%; overflow: hidden; border-radius: 10px; background: linear-gradient(#fbfdfd, #f5f9f9); }
#corpusChart { width: 100%; height: auto; display: block; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 11px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid #edf1f2; white-space: nowrap; }
th { background: #f7fafb; color: #53646a; font-size: 11px; position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }

.site-footer { border-top: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 11px; padding: 18px 0 25px; text-align: center; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 560px); }
  .page { padding-top: 12px; }
  .intro { display: block; }
  .intro-note { margin-top: 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .field-wide { grid-column: auto; }
  .calculator-card { border-radius: 15px; }
  .results-heading { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-card { padding: 12px; }
  .summary-card strong { font-size: 14px; }
  .chart-card, .table-card { padding: 13px; border-radius: 15px; }
  .ad-slot { min-height: 82px; }
}
@media (max-width: 390px) {
  .summary-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
