* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  border-top: 5px solid var(--orange); /* Weyermann crimson accent */
}

/* "Opened from calculator" banner */
.fromcalc {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin: 0 clamp(1rem, 0.5rem + 2vw, 2.4rem); margin-top: 0.6rem;
  padding: 0.55rem 0.9rem; text-decoration: none;
  background: var(--teal-tint); border: 1px solid var(--teal); border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--teal-dark);
}
.fromcalc:hover { background: #dff2f2; }
.fromcalc-back { font-weight: 700; }

/* Non-affiliation notice */
.notice {
  max-width: 1500px; margin: 0 auto 0.4rem; padding: 0.6rem 1rem;
  font-size: 0.75rem; color: var(--text-dim); line-height: 1.4;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--orange);
  border-radius: var(--radius-sm);
}
.notice { margin-left: clamp(1rem, 0.5rem + 2vw, 2.4rem); margin-right: clamp(1rem, 0.5rem + 2vw, 2.4rem); }
.notice strong { color: var(--orange); }

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 68px; }

/* Utility top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--text); color: #efe7dc; padding: 0.35rem clamp(1rem, 0.5rem + 2vw, 2.4rem);
  font-size: 0.74rem;
}
.topbar .indie { letter-spacing: 0.02em; opacity: 0.9; }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.top-link { color: #efe7dc; text-decoration: none; opacity: 0.85; }
.top-link:hover { opacity: 1; color: var(--teal); }
.lang-toggle {
  font: inherit; font-weight: 700; font-size: 0.72rem; cursor: pointer;
  background: transparent; color: #efe7dc; border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-pill); padding: 0.12rem 0.6rem; transition: all var(--dur);
}
.lang-toggle:hover { border-color: var(--teal); color: var(--teal); }

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: clamp(0.9rem, 0.6rem + 1vw, 1.4rem) clamp(1rem, 0.5rem + 2vw, 2.4rem) 0.9rem;
}
.brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; }
.seal { width: 48px; height: 48px; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(120,20,30,0.25)); }
.wordmark { display: flex; flex-direction: column; }
.wm-name {
  font-family: var(--font-display); font-weight: 900; font-size: 1.7rem; line-height: 1;
  letter-spacing: 0.01em; color: var(--orange); text-transform: uppercase;
}
.wm-tag { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.15rem; }
.head-actions { display: flex; gap: 0.5rem; }

/* Main navigation */
.mainnav {
  position: sticky; top: 0; z-index: 30;
  background: var(--orange);
  border-bottom: 3px solid var(--teal);
  box-shadow: 0 2px 10px rgba(120,20,30,0.18);
}
.mainnav ul {
  display: flex; gap: 0.3rem; list-style: none; margin: 0 auto; padding: 0 clamp(1rem, 0.5rem + 2vw, 2.4rem);
  max-width: 1500px; flex-wrap: wrap;
}
.mainnav a {
  display: block; color: #fff; text-decoration: none; font-weight: 600; font-size: 0.86rem;
  padding: 0.7rem 0.95rem; border-bottom: 3px solid transparent; margin-bottom: -3px;
  transition: background var(--dur), border-color var(--dur);
}
.mainnav a:hover { background: rgba(255,255,255,0.14); border-bottom-color: #fff; }

.btn {
  font: inherit; font-weight: 600; font-size: 0.84rem;
  padding: 0.5rem 1.05rem; border-radius: var(--radius-pill); cursor: pointer;
  border: 1px solid transparent; background: var(--orange); color: #fff;
  transition: transform var(--dur) var(--ease), filter var(--dur), background var(--dur);
  box-shadow: var(--shadow-sm);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--teal-dark); box-shadow: none; }
.btn.ghost:hover { border-color: var(--teal); background: var(--teal-tint); }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.78rem; }

/* Layout + cards */
.layout {
  display: grid; gap: clamp(0.8rem, 0.4rem + 1vw, 1.3rem);
  grid-template-columns: minmax(230px, 0.9fr) minmax(280px, 1.05fr) minmax(360px, 1.6fr);
  padding: 1rem clamp(1rem, 0.5rem + 2vw, 2.4rem) 1.5rem;
  align-items: start; max-width: 1500px; margin: 0 auto;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space); box-shadow: var(--shadow);
}
.palette-col, .grist-col { position: sticky; top: 58px; }
.card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.card-head.sub { margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--line-soft); }
.ch-icon {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0;
  background: var(--orange-tint); color: var(--orange); border-radius: 8px; font-size: 0.85rem;
}
.card-head h2 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--orange); margin: 0; }
.ch-hint { font-size: 0.72rem; color: var(--muted); font-weight: 400; text-transform: none; }

/* Palette */
.search {
  width: 100%; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 0.85rem;
}
.search:focus { outline: none; border-color: var(--teal); background: #fff; }
.malt-list { max-height: 64vh; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 3px; }
.cat-head { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin: 0.7rem 0 0.25rem; font-weight: 700; }
.malt-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; text-align: left; cursor: pointer;
  padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--text);
  font: inherit; font-size: 0.82rem; transition: all var(--dur) var(--ease);
}
.malt-chip:hover { border-color: var(--teal); background: var(--teal-tint); transform: translateX(2px); }
.malt-chip.added { border-color: var(--orange); background: var(--orange-tint); box-shadow: inset 3px 0 0 var(--orange); }
.malt-chip.no-aroma { opacity: 0.6; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chip-meta { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }
.empty, .grist-empty { color: var(--muted); font-size: 0.85rem; padding: 1rem 0.3rem; text-align: center; }

/* Grist */
.dropzone.drag-over { outline: 2px dashed var(--orange); outline-offset: 3px; border-radius: var(--radius-sm); }
.grist-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.8rem; }
.grist-row {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto auto auto auto; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.65rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.gr-bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--orange-tint), transparent); z-index: 0; }
.grist-row.no-aroma { opacity: 0.75; }
.grist-row > :not(.gr-bar) { position: relative; z-index: 1; }
.gr-name { font-size: 0.82rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-grams { width: 64px; background: #fff; border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 0.28rem 0.35rem; font: inherit; font-size: 0.8rem; text-align: right; }
.gr-unit { font-size: 0.72rem; color: var(--muted); }
.gr-pct { font-size: 0.8rem; color: var(--orange); font-weight: 700; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.gr-x { background: none; border: none; color: var(--muted); font-size: 1.15rem; cursor: pointer; line-height: 1; padding: 0 0.2rem; }
.gr-x:hover { color: var(--red); }

.batch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding-top: 0.8rem; border-top: 1px solid var(--line-soft); }
.batch-field { display: flex; flex-direction: column; gap: 0.2rem; }
.bf-label { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.bf-wrap { display: flex; align-items: center; gap: 0.25rem; }
.bf-wrap input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 0.32rem 0.4rem; font: inherit; font-size: 0.8rem; }
.bf-unit { font-size: 0.72rem; color: var(--muted); }
.batch-total { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-dim); text-align: right; font-weight: 600; }

/* Recipes */
.rc-saverow { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.rc-name { flex: 1; min-width: 0; padding: 0.45rem 0.65rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 0.82rem; color: var(--text); }
.rc-name:focus { outline: none; border-color: var(--teal); background: #fff; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.rc-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-2); }
.rc-chip.comparing { border-color: var(--teal); background: var(--teal-tint); }
.rc-load { border: none; background: none; font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text); padding: 0.3rem 0.6rem; cursor: pointer; }
.rc-cmp { border: none; border-left: 1px solid var(--line); background: none; font: inherit; font-size: 0.68rem; font-weight: 700; color: var(--teal-dark); padding: 0 0.5rem; cursor: pointer; }
.rc-del { border: none; border-left: 1px solid var(--line); background: none; color: var(--muted); font-size: 0.95rem; padding: 0 0.5rem; cursor: pointer; }
.rc-del:hover { color: var(--red); }
.rc-hint { font-size: 0.76rem; color: var(--muted); }

/* Radar */
.radar-wrap { text-align: center; margin-bottom: 0.5rem; }
.radar { width: 100%; height: auto; max-width: 520px; overflow: visible; }
.radar-cap { font-size: 0.72rem; color: var(--muted); margin: 0.2rem 0 0.9rem; }
.grid-ring { fill: none; stroke: #e6eaee; stroke-width: 1; }
.spoke { stroke: #edf0f3; stroke-width: 1; }
.axis-label { fill: var(--text-dim); font-size: 10px; font-family: var(--font-body); font-weight: 500; }
.beer-shape { fill: rgba(232,121,43,0.20); stroke: var(--orange); stroke-width: 2.6; stroke-linejoin: round; }
.beer-dot { fill: var(--orange); stroke: #fff; stroke-width: 1; }
.hub { fill: var(--orange); }

/* Vitals strip */
.stat-strip { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: stretch; margin-bottom: 0.9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem; }
.swatch-wrap { display: flex; align-items: center; gap: 0.5rem; padding-right: 0.6rem; border-right: 1px solid var(--line); }
.swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08); box-shadow: inset 0 0 10px rgba(0,0,0,0.15); }
.swatch-cap { display: flex; flex-direction: column; line-height: 1.15; }
.swatch-cap strong { font-size: 0.92rem; color: var(--text); }
.swatch-cap span { font-size: 0.72rem; color: var(--muted); }
.stat { flex: 1; min-width: 62px; text-align: center; }
.stat-val { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--text); }
.stat-lbl { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

.cmp-strip { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; padding: 0.5rem 0.7rem; background: var(--teal-tint); border: 1px solid var(--teal); border-radius: var(--radius-sm); font-size: 0.8rem; }
.cmp-dot { width: 14px; height: 0; border-top: 2px dashed var(--teal-dark); }
.cmp-name { font-weight: 700; color: var(--teal-dark); }
.cmp-stat { color: var(--text-dim); }

/* Tasting note */
.tasting { background: var(--orange-tint); border: 1px solid #f3ddc7; border-left: 3px solid var(--orange); border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-bottom: 0.9rem; }
.tasting-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--orange); font-weight: 700; margin-bottom: 0.3rem; }
.tasting-note { margin: 0; font-family: var(--font-display); font-size: 1.02rem; line-height: 1.45; color: var(--text); }

/* Style matches */
.styles-block { margin-bottom: 0.9rem; }
.block-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin-bottom: 0.45rem; font-weight: 700; }
.style-row { display: grid; grid-template-columns: 120px 1fr 38px; align-items: center; gap: 0.5rem; padding: 0.28rem 0; font-size: 0.8rem; }
.style-row .st-gap { grid-column: 1 / -1; font-size: 0.7rem; color: var(--muted); margin: -0.15rem 0 0.2rem 0; }
.style-row.top .st-name { color: var(--text); font-weight: 700; }
.st-name { color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.st-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--orange)); border-radius: 999px; }
.st-score { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Notes */
.notes-block { margin-bottom: 0.85rem; }
.note-chips { display: flex; flex-direction: column; gap: 5px; }
.note-chip { display: grid; grid-template-columns: 98px 1fr 30px; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.nc-key { color: var(--text-body); }
.nc-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.nc-bar i { display: block; height: 100%; border-radius: 999px; }
.nc-val { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.drivers { display: flex; flex-direction: column; gap: 3px; }
.driver-row { font-size: 0.78rem; display: flex; gap: 0.4rem; }
.dr-note { color: var(--orange); font-weight: 700; min-width: 96px; }
.dr-from { color: var(--text-dim); }

.wheel-detail { margin-top: 0.6rem; border-top: 1px solid var(--line-soft); padding-top: 0.7rem; }
.wheel-detail summary { cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--teal-dark); }
.real-wheel { width: 100%; max-width: 360px; display: block; margin: 0.6rem auto 0; border-radius: 10px; }

/* About */
.about-wrap { max-width: 1500px; margin: 0 auto; padding: 0 clamp(1rem, 0.5rem + 2vw, 2.4rem) 0.5rem; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 0.5rem + 2vw, 2.4rem); }
.about h3 { font-family: var(--font-display); font-size: 1.05rem; color: var(--text); margin: 0 0 0.4rem; }
.about p { margin: 0; font-size: 0.9rem; color: var(--text-body); line-height: 1.6; }
.use-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.use-list li { font-size: 0.88rem; color: var(--text-body); line-height: 1.5; padding-left: 1.3rem; position: relative; }
.use-list li::before { content: "▹"; position: absolute; left: 0; color: var(--orange); font-weight: 700; }
.use-list strong { color: var(--text); }
.contact { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 0.88rem; color: var(--text-body); }
.contact-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none;
  padding: 0.42rem 0.9rem; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.82rem;
  border: 1px solid var(--line); color: var(--teal-dark); background: #fff; transition: all var(--dur) var(--ease);
}
.contact-btn:hover { border-color: var(--teal); background: var(--teal-tint); transform: translateY(-1px); }

/* Footer */
.site-foot { background: var(--text); color: #cfc4b6; margin-top: 1.5rem; border-top: 5px solid var(--orange); }
.foot-cols {
  max-width: 1500px; margin: 0 auto; padding: 2rem clamp(1rem, 0.5rem + 2vw, 2.4rem) 1.4rem;
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: clamp(1.2rem, 0.5rem + 2vw, 2.6rem);
}
.foot-mark { display: flex; align-items: center; gap: 0.6rem; }
.foot-name { font-family: var(--font-display); font-weight: 900; font-size: 1.15rem; color: #f4ece0; text-transform: uppercase; letter-spacing: 0.02em; }
.foot-blurb { font-size: 0.8rem; line-height: 1.55; color: #b6ab9c; margin: 0.7rem 0 0; max-width: 34ch; }
.foot-col h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal); margin: 0 0 0.7rem; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.foot-col a { color: #d8cec1; text-decoration: none; font-size: 0.84rem; }
.foot-col a:hover { color: #fff; text-decoration: underline; }
.contact-col p { font-size: 0.84rem; line-height: 1.5; margin: 0 0 0.7rem; color: #d8cec1; }
.contact-btn.dark { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0 0.4rem 0.4rem 0; padding: 0.4rem 0.8rem; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; text-decoration: none; color: #f4ece0; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.04); transition: all var(--dur); }
.contact-btn.dark:hover { border-color: var(--teal); background: rgba(26,157,157,0.15); color: #fff; }
.foot-legal { max-width: 1500px; margin: 0 auto; padding: 1rem clamp(1rem, 0.5rem + 2vw, 2.4rem); border-top: 1px solid rgba(255,255,255,0.12); }
.foot-legal p { margin: 0; font-size: 0.7rem; line-height: 1.5; color: #9c9284; }
.foot-legal strong { color: #c9beae; }
.foot-legal a { color: var(--teal); }
.foot-bottom { max-width: 1500px; margin: 0 auto; padding: 0.9rem clamp(1rem, 0.5rem + 2vw, 2.4rem) 1.6rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.72rem; color: #8a8073; flex-wrap: wrap; }
.to-top { color: var(--teal); text-decoration: none; font-weight: 600; }
.to-top:hover { color: #fff; }

@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; gap: 1.2rem; } }

/* Responsive */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .result-col { grid-column: 1 / -1; order: -1; }
  .palette-col, .grist-col { position: static; }
}
@media (max-width: 860px) {
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .foot-cols { grid-template-columns: 1fr; }
  .foot-bottom { justify-content: center; }
  .malt-list { max-height: 42vh; }
}
