:root {
  --bmc-bg: #f7f5f0;
  --bmc-surface: #ffffff;
  --bmc-surface-2: #f3f7f5;
  --bmc-ink: #20201d;
  --bmc-muted: #666a61;
  --bmc-line: #d8d5cc;
  --bmc-accent: #2f6f5e;
  --bmc-accent-2: #a85032;
  --bmc-focus: #3c78d8;
  --bmc-good: #1d6b45;
  --bmc-warn: #9a4f12;
  --bmc-shadow: 0 18px 40px rgba(45, 39, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bmc-bg);
  color: var(--bmc-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.demo-page {
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto;
}

.bmc-app {
  background: var(--bmc-surface);
  border: 1px solid var(--bmc-line);
  border-radius: 8px;
  box-shadow: var(--bmc-shadow);
  overflow: hidden;
}

.bmc-header {
  display: grid;
  gap: 8px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--bmc-line);
  background: linear-gradient(90deg, #fff 0%, #f4f8f6 100%);
}

.bmc-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.bmc-subtitle {
  margin: 0;
  max-width: 850px;
  color: var(--bmc-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.bmc-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 12px 0;
  background: #fbfaf7;
  border-bottom: 1px solid var(--bmc-line);
}

.bmc-tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--bmc-muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bmc-tab:hover {
  background: #f0eee7;
  color: var(--bmc-ink);
}

.bmc-tab:focus-visible,
.bmc-field input:focus,
.bmc-field select:focus,
.bmc-mini-button:focus-visible,
.bmc-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--bmc-focus), transparent 65%);
  outline-offset: 2px;
}

.bmc-tab[aria-selected="true"] {
  background: var(--bmc-surface);
  border-color: var(--bmc-line);
  color: var(--bmc-accent);
}

.bmc-panel {
  display: none;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
  padding: 22px 24px 26px;
}

.bmc-panel.bmc-active {
  display: grid;
}

.bmc-section-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.bmc-form {
  display: grid;
  gap: 14px;
}

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

.bmc-field {
  display: grid;
  gap: 6px;
}

.bmc-field span,
.bmc-table-label {
  color: var(--bmc-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.bmc-field input,
.bmc-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--bmc-line);
  border-radius: 6px;
  background: #fff;
  color: var(--bmc-ink);
  font: inherit;
  padding: 9px 10px;
}

.bmc-unit-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, 96px);
  gap: 8px;
}

.bmc-unit-field select {
  padding-left: 8px;
  padding-right: 8px;
}

.bmc-field input[type="number"] {
  appearance: textfield;
}

.bmc-table {
  display: grid;
  gap: 8px;
}

.bmc-ingredient-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(170px, 190px) 36px;
  gap: 8px;
  align-items: end;
}

.bmc-ingredient-row input {
  min-height: 40px;
}

.bmc-mini-button,
.bmc-action {
  border: 1px solid var(--bmc-line);
  border-radius: 6px;
  background: #fff;
  color: var(--bmc-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.bmc-mini-button {
  width: 36px;
  height: 40px;
}

.bmc-action {
  width: fit-content;
  min-height: 40px;
  padding: 0 13px;
  background: var(--bmc-accent);
  border-color: var(--bmc-accent);
  color: #fff;
}

.bmc-mini-button:hover,
.bmc-action:hover {
  filter: brightness(0.96);
}

.bmc-output {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  background: var(--bmc-surface-2);
  border: 1px solid var(--bmc-line);
  border-radius: 8px;
  min-height: 260px;
}

.bmc-result-main {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.bmc-result-main strong {
  color: var(--bmc-accent);
}

.bmc-result-note {
  margin: 0;
  color: var(--bmc-muted);
  line-height: 1.5;
}

.bmc-result-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bmc-result-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--bmc-line), transparent 35%);
}

.bmc-result-list span:last-child {
  text-align: right;
  font-weight: 850;
}

.bmc-kicker {
  margin: 0;
  color: var(--bmc-accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bmc-warning {
  color: var(--bmc-warn);
  font-weight: 750;
}

.bmc-muted {
  color: var(--bmc-muted);
}

@media (max-width: 820px) {
  .demo-page {
    width: min(100% - 14px, 1180px);
    margin: 7px auto;
  }

  .bmc-header {
    padding: 18px 16px 14px;
  }

  .bmc-panel {
    grid-template-columns: 1fr;
    padding: 18px 16px 22px;
  }

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

@media (max-width: 480px) {
  .bmc-ingredient-row {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .bmc-ingredient-row .bmc-field:first-child {
    grid-column: 1 / -1;
  }

  .bmc-tab {
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.9rem;
  }

  .bmc-result-list li {
    display: grid;
    gap: 3px;
  }

  .bmc-result-list span:last-child {
    text-align: left;
  }
}
