:root {
  --ink: #19221e;
  --muted: #65716b;
  --line: #dce3df;
  --paper: #ffffff;
  --canvas: #f2f5f2;
  --green: #176b4b;
  --green-dark: #0d5037;
  --green-soft: #e4f2eb;
  --lime: #c8ef69;
  --shadow: 0 22px 60px rgba(25, 50, 38, 0.1);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 2%, rgba(200, 239, 105, 0.22), transparent 27rem),
    radial-gradient(circle at 92% 14%, rgba(23, 107, 75, 0.09), transparent 30rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-shell {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 32px;
}

.hero { max-width: 760px; margin-bottom: 38px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(200, 239, 105, 0.2);
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.6rem, 7vw, 5.3rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
  font-weight: 760;
}

.hero > p {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.calculator-card {
  padding: clamp(24px, 5vw, 46px);
  border: 1px solid rgba(220, 227, 223, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  margin-bottom: 7px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.text-button {
  flex: 0 0 auto;
  padding: 8px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
}

.text-button:hover { color: var(--green); }

.dimension-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  padding: 36px 0 30px;
}

.dimension-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-width: 0;
  padding: 0;
  border: 0;
}

.dimension-group legend {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 750;
}

.equals {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 1.35rem;
  font-weight: 800;
}

.input-wrap { display: block; min-width: 0; }

.input-wrap > span:first-child {
  display: block;
  margin: 0 0 8px 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.input-control {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafcfb;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-control:focus-within {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(23, 107, 75, 0.1);
}

.is-driver .input-control { border-color: #a8cbbb; }

.input-control input {
  width: 100%;
  min-width: 0;
  padding: 14px 5px 14px 14px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.input-control em {
  padding-right: 12px;
  color: #8b9691;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.presets {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.presets > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.preset-list { display: flex; flex-wrap: wrap; gap: 8px; }

.preset-list button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4d5a54;
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  transition: transform 150ms ease, color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.preset-list button:hover { transform: translateY(-1px); border-color: #9db7aa; }
.preset-list button.active { border-color: var(--green); color: #fff; background: var(--green); }

.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 26px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #45524c;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 650;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.action-buttons { display: flex; gap: 10px; }

.primary-button, .secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(23, 107, 75, 0.18);
}

.primary-button:hover { transform: translateY(-1px); background: var(--green-dark); }

.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.secondary-button:hover { transform: translateY(-1px); border-color: #9db7aa; }
.secondary-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.status {
  min-height: 20px;
  margin: 13px 0 -7px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: right;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.result-card, .preview-card {
  min-height: 164px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
}

.result-card { display: flex; flex-direction: column; justify-content: space-between; }
.result-card p, .preview-copy p { margin-bottom: 15px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.result-card strong { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.result-card span, .preview-copy span { color: var(--muted); font-size: 0.72rem; line-height: 1.45; }

.result-primary { border-color: var(--green); color: #fff; background: var(--green); }
.result-primary p, .result-primary span { color: rgba(255, 255, 255, 0.72); }

.preview-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 24px;
  min-height: 180px;
}

.preview-stage {
  display: grid;
  place-items: center;
  height: 128px;
  padding: 12px;
  overflow: hidden;
  border-radius: 15px;
  background-color: #edf2ef;
  background-image: linear-gradient(45deg, rgba(23, 107, 75, 0.05) 25%, transparent 25%), linear-gradient(-45deg, rgba(23, 107, 75, 0.05) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(23, 107, 75, 0.05) 75%), linear-gradient(-45deg, transparent 75%, rgba(23, 107, 75, 0.05) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.preview-shape {
  max-width: 100%;
  width: min(390px, 80%);
  max-height: 104px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(200, 239, 105, 0.62), rgba(23, 107, 75, 0.16));
  box-shadow: 0 10px 30px rgba(23, 107, 75, 0.16);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4px 0;
  color: #7b8680;
  font-size: 0.72rem;
}

footer p { margin: 0; }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(23, 107, 75, 0.28); outline-offset: 3px; }
.input-control input:focus-visible { outline: 0; }

@media (max-width: 760px) {
  .site-shell { width: min(100% - 24px, 620px); padding-top: 44px; }
  .hero { margin-bottom: 28px; }
  .dimension-equation { grid-template-columns: 1fr; gap: 18px; }
  .equals { width: 36px; height: 36px; margin: -1px auto; transform: rotate(90deg); }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-primary { grid-column: 1 / -1; }
  .preview-card { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 520px) {
  .site-shell { padding-top: 32px; }
  h1 { letter-spacing: -0.055em; }
  .calculator-card { border-radius: 22px; }
  .card-heading { align-items: center; }
  .dimension-group { grid-template-columns: 1fr; }
  .presets { align-items: flex-start; flex-direction: column; gap: 10px; }
  .actions-row { align-items: stretch; flex-direction: column; }
  .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .status { text-align: left; }
  .result-grid { grid-template-columns: 1fr; }
  .result-primary { grid-column: auto; }
  .preview-card { grid-column: auto; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
