:root {
  color-scheme: light;
  --canvas: #f5f5ec;
  --surface: #fffef9;
  --ink: #1d2c23;
  --muted: #516456;
  --line: #dce1d7;
  --accent: #427350;
  --focus: #26724b;
  --result: #142e24;
  --result-text: #f5fbf4;
  --result-muted: #b7cfc0;
  --shot: #c3ec9e;
  --base: #649c81;
  --aroma: #f2c986;
  --radius: 22px;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.wrap { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.masthead { padding-block: 27px 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--result); border-radius: 11px; }
.brand-mark i { width: 13px; height: 13px; background: var(--shot); border-radius: 0 70% 70% 70%; transform: translateY(1px) rotate(45deg); }
.intro { padding-block: 54px 34px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 6vw, 4.65rem); line-height: 1.02; letter-spacing: -.055em; font-weight: 700; }
h1 span { color: var(--accent); }
.intro p { margin-top: 17px; max-width: 62ch; font-size: 1.0625rem; line-height: 1.55; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 22px; padding-bottom: 40px; }
.panel { padding: clamp(20px, 3vw, 36px); border-radius: var(--radius); min-width: 0; }
.form-panel { background: var(--surface); border: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); letter-spacing: -.045em; line-height: 1.2; }
.reset { font: inherit; font-size: .875rem; font-weight: 650; color: var(--accent); background: transparent; padding: 8px 0 8px 8px; border: 0; min-height: 44px; cursor: pointer; }
.reset:hover { text-decoration: underline; }
.reset:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
fieldset { margin: 24px 0 0; padding: 0; border: 0; min-width: 0; }
legend { width: 100%; padding: 0 0 8px; border-bottom: 1px solid var(--line); font-size: .9375rem; font-weight: 750; }
.optional { margin-left: 4px; font-weight: 500; color: var(--muted); }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 13px; }
label { display: flex; flex-direction: column; justify-content: space-between; gap: 7px; color: var(--muted); font-size: .875rem; font-weight: 600; }
.input-shell { display: flex; align-items: center; min-height: 49px; background: var(--canvas); border: 1px solid var(--line); border-radius: 9px; }
.input-shell:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.input-shell:has([aria-invalid="true"]) { border-color: #9c3d2c; }
input { font: inherit; font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; background: transparent; color: var(--ink); width: 100%; min-width: 0; padding: 10px 0 10px 12px; border: 0; outline: none; }
input::placeholder { color: var(--muted); opacity: 1; }
.input-shell > span { flex: 0 0 auto; padding: 0 11px 0 5px; font-weight: 650; }
.field-note { align-self: end; padding-bottom: 2px; font-size: .875rem; color: var(--muted); line-height: 1.45; }
.results { background: var(--result); color: var(--result-text); }
.total-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; column-gap: 16px; row-gap: 10px; margin-top: 24px; }
.total { font-size: clamp(2.75rem, 6.2vw, 4.45rem); line-height: .96; letter-spacing: -.055em; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.total small { font-size: .42em; letter-spacing: -.045em; color: var(--result-muted); }
.total-label { display: block; margin-top: 10px; color: var(--result-muted); font-weight: 550; font-size: .9375rem; letter-spacing: 0; line-height: 1.3; }
.strength { max-width: 100%; border: 1px solid #65917b; border-radius: 30px; padding: 7px 12px; font-size: .875rem; color: var(--shot); font-weight: 650; overflow-wrap: anywhere; }
.composition { display: flex; height: 17px; border-radius: 6px; overflow: hidden; margin-top: 24px; }
.composition span { flex: 0 0 auto; }
#bar-shot, .swatch.shot { background: var(--shot); }
#bar-base, .swatch.base { background: var(--base); }
#bar-aroma, .swatch.aroma { background: var(--aroma); }
.ingredients { margin: 15px 0 0; }
.ingredients > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-block: 15px; border-bottom: 1px solid #426052; }
.ingredients dt { display: flex; min-width: 0; gap: 11px; align-items: baseline; font-weight: 620; }
.ingredients dd { margin: 0; font-size: 1.125rem; text-align: right; font-weight: 700; color: var(--result-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ingredients small { display: block; margin-top: 2px; color: var(--result-muted); font-size: .875rem; font-weight: 500; }
.swatch { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }
.precision { margin-top: 13px; color: var(--result-muted); font-size: .875rem; }
.error { margin-top: 22px; padding: 14px 16px; color: #ffdfaf; border: 1px solid #a48b67; border-radius: 9px; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .wrap { width: min(540px, calc(100% - 36px)); }
  .intro { padding-top: 34px; padding-bottom: 24px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .panel { border-radius: 17px; }
}
@media (max-width: 370px) {
  .wrap { width: calc(100% - 24px); }
  .panel { padding: 16px; }
  .input-grid { gap: 9px; }
}
