:root {
  --bg: #f5efe6;
  --panel: #fffaf3;
  --ink: #1e1f22;
  --muted: #636466;
  --brand: #0f766e;
  --brand-2: #d97706;
  --line: #ded3c4;
  --ok: #0f5132;
  --error: #7f1d1d;
  --shadow: 0 18px 40px rgba(15, 20, 25, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(15, 118, 110, 0.18), transparent 60%),
    radial-gradient(1000px 400px at 100% -10%, rgba(217, 119, 6, 0.16), transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 42px 20px 20px;
}

.hero__label {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(15, 118, 110, 0.12);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 48px);
  margin: 14px 0 8px;
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
}

.hero__meta {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero__meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.6);
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  animation: panel-in 420ms ease both;
}

.panel--full {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.helper {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.helper--state {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.helper--state.is-ok {
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--ok);
}

.helper--state.is-error {
  border-color: rgba(127, 29, 29, 0.18);
  background: rgba(255, 245, 245, 0.9);
  color: var(--error);
}

.heater-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.heater-card {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.heater-card img {
  width: 46px;
  height: 66px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f8f8;
}

.heater-card span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.heater-card:hover {
  border-color: rgba(15, 118, 110, 0.45);
}

.heater-card.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
  transform: translateY(-1px);
}

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

.calc-form.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.calc-form input,
.calc-form select,
.calc-form button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
}

.calc-form input,
.calc-form select {
  background: #fff;
}

.calc-form button {
  background: linear-gradient(120deg, var(--brand), #0d9488);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease;
}

.calc-form button:hover {
  filter: brightness(1.05);
}

.calc-form button:active {
  transform: translateY(1px);
}

.calc-form button[type='button'] {
  background: linear-gradient(120deg, var(--brand-2), #f59e0b);
}

.form-details {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.64);
}

.form-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.form-details p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.details-span-2 {
  grid-column: 1 / -1;
}

.details-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.details-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.result {
  margin: 12px 0 0;
  min-height: 84px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: #fff;
  padding: 12px;
  white-space: pre-wrap;
  font-family: 'IBM Plex Mono', Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
}

.result.result--rich {
  white-space: normal;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}

.result-card {
  display: grid;
  gap: 10px;
}

.result-section {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 10px;
}

.result-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #0f766e;
}

.result-grid {
  display: grid;
  gap: 6px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  padding-bottom: 4px;
}

.result-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-key {
  color: var(--muted);
  font-weight: 500;
}

.result-value {
  text-align: right;
  color: var(--ink);
  font-family: 'IBM Plex Mono', Consolas, monospace;
}

.result-value small {
  color: var(--muted);
  font-size: 11px;
}

.result-subsection {
  margin-top: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.8);
}

.result-subsection summary {
  cursor: pointer;
  font-weight: 600;
  color: #24534f;
}

.result-list,
.result-alerts {
  margin: 6px 0 0;
  padding-left: 18px;
}

.result-alerts li {
  color: #7f1d1d;
}

.result-empty {
  margin: 0;
  color: var(--muted);
}

.result.compact {
  min-height: 64px;
}

.result--ok {
  border-color: rgba(15, 81, 50, 0.3);
  color: var(--ok);
}

.result--error {
  border-color: rgba(127, 29, 29, 0.36);
  color: var(--error);
}

.mt {
  margin-top: 10px;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.help-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.help-box summary {
  cursor: pointer;
  font-weight: 600;
}

.help-box p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.foot.foot--quiet {
  padding-top: 0;
  padding-bottom: 12px;
  min-height: 0;
}

.runtime-status {
  display: none;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .calc-form.grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .calc-form {
    grid-template-columns: 1fr;
  }

  .heater-grid {
    grid-template-columns: 1fr;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .foot {
    flex-direction: column;
  }

  .result-row {
    flex-direction: column;
    gap: 2px;
  }

  .result-value {
    text-align: left;
  }
}
