:root {
  --bg: #fbfaf7; --fg: #1f1c18; --muted: #6b645a; --line: #e4dfd6; --card: #ffffff;
  --accent: #b5651d; --accent-fg: #ffffff;
  --hit: #fde68a; --hit-fg: #1f1c18; --ok: #1a7f37; --ok-bg: #dcfce7; --bad: #b42318; --bad-bg: #fee4e2; --warn: #92400e; --warn-bg: #fef3c7;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161412; --fg: #ece7df; --muted: #a59d91; --line: #34302b; --card: #1f1c19; --accent: #e09a52; --accent-fg: #161412;
    --hit: #6b5310; --hit-fg: #fff7e0; --ok: #6ee7a0; --ok-bg: #12351f; --bad: #fca5a5; --bad-bg: #3d1513; --warn: #fcd34d; --warn-bg: #3b2a0a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
footer { max-width: 1100px; margin: 32px auto; padding: 0 16px; color: var(--muted); font-size: 13px; }
h1 { font-size: 1.6rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; margin-top: 2rem; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--fg); }
.top nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.markets a { margin-left: 6px; text-decoration: none; }
.markets a[aria-current] { font-weight: 700; text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
button.link { background: none; border: none; color: var(--accent); padding: 0 4px; text-decoration: underline; }
button[disabled] { opacity: .5; cursor: default; }
input, select { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); max-width: 100%; }
/* Native option lists take their colours from the select; a transparent select falls back to a white list. */
option { background: var(--card); color: var(--fg); }
input[type=number] { width: 5.5em; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
form.stack { display: grid; gap: 12px; max-width: 420px; }
form.stack label { display: grid; gap: 4px; }
/* Search, then a row of chips that each open a popover (a bottom sheet on phones). */
.filters { display: grid; gap: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.filters .search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.filters .search:focus-within { border-color: var(--accent); }
.filters .search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.filters .search input { flex: 1; min-width: 0; border: 0; padding: 10px 0; font-size: 17px; background: none; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; white-space: nowrap; cursor: pointer; list-style: none; user-select: none; }
.chip::-webkit-details-marker { display: none; }
.chip::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); opacity: .6; }
.chip:hover, .pop[open] > .chip { border-color: var(--accent); }
.chip:has(.set) { background: color-mix(in srgb, var(--accent) 12%, var(--card)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); font-weight: 600; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pop { position: relative; }
.pop-body { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; width: max-content; min-width: 220px; max-width: min(320px, 90vw); max-height: 60vh; overflow: auto; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .16); }
.pop-body p { margin: 6px 4px 0; }
.options { border: 0; margin: 0; padding: 0; display: grid; }
.opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.opt:hover { background: var(--bg); }
.opt span { flex: 1; }
.opt small { color: var(--muted); font-variant-numeric: tabular-nums; }
.opt input[type=radio] { accent-color: var(--accent); margin: 0; }
.opt:has(input[type=radio]:checked) { font-weight: 600; }
.pop:not(:has(input[value=custom]:checked)) .since-date { display: none; }
.pop .range { display: flex; align-items: center; gap: 8px; padding: 4px; font-size: 14px; color: var(--muted); }
.pop .range label { display: grid; gap: 2px; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 8px 4px 0; border-top: 1px solid var(--line); }
.sort { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.sort select { border: 0; padding: 4px 2px; background: var(--card); color: var(--fg); font-weight: 600; font-size: 14px; cursor: pointer; }
@media (max-width: 600px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .pop[open]::before { content: ""; position: fixed; inset: 0; z-index: 4; background: rgb(0 0 0 / .35); }
  .pop-body { position: fixed; inset: auto 0 0 0; top: auto; width: auto; max-width: none; min-width: 0; max-height: 70vh; border-radius: 16px 16px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 32px rgb(0 0 0 / .22); }
  .opt { padding: 10px 8px; font-size: 16px; }
}
.rating { white-space: nowrap; }
.rating.top10 { color: var(--accent); font-weight: 600; }
.rating.top5 { color: var(--accent-fg); background: var(--accent); border-radius: 4px; padding: 0 4px; font-weight: 600; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { display: flex; justify-content: space-between; gap: 10px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card .beer { display: flex; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.card .art { display: grid; justify-items: center; align-content: start; gap: 4px; flex: none; font-size: 13px; color: var(--muted); }
.card img, .nolabel { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex: none; background: var(--line); }
.names { display: grid; min-width: 0; }
.names strong { overflow-wrap: anywhere; }
.price { display: grid; text-align: right; align-content: start; white-space: nowrap; }
.pager { display: flex; gap: 16px; justify-content: center; margin: 16px 0; }
.beer-head { display: flex; gap: 16px; align-items: flex-start; }
.beer-head img { border-radius: 8px; flex: none; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.offers { display: block; overflow-x: auto; }
.history, .subs { padding-left: 18px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .beer-head img { width: 64px; height: 64px; }
  .review td { display: block; border: none; padding: 4px 0; }
  .review tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .review thead { display: none; }
}

/* Admin review */
.page-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin-right: auto; }
.page-nav h1 { font-size: 1rem; margin: 0; }
.tabs { display: flex; gap: 16px; }
.tabs a { padding: 2px 0; text-decoration: none; color: var(--muted); }
.tabs a[aria-current="page"] { color: inherit; border-bottom: 2px solid var(--accent); font-weight: 600; }
.small a[aria-current="page"] { font-weight: 600; color: inherit; text-decoration: none; }
.error { color: #b42318; background: color-mix(in srgb, #b42318 10%, transparent); padding: 8px 12px; border-radius: 6px; }
.review button { white-space: nowrap; }
button.ghost { background: none; color: var(--accent); }
kbd { font: 600 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); background: var(--card); }
mark { background: var(--hit); color: var(--hit-fg); border-radius: 3px; padding: 0 2px; }
/* Matches most beers share: noted, but not to compete with the words that pick one out. */
mark.weak { background: none; color: inherit; padding: 0; text-decoration: underline 2px var(--hit); text-underline-offset: 3px; }
.abv.ok { color: var(--ok); background: var(--ok-bg); border-radius: 4px; padding: 0 5px; font-weight: 600; }
.abv.near { color: var(--warn); background: var(--warn-bg); border-radius: 4px; padding: 0 5px; }
.abv.bad { color: var(--bad); background: var(--bad-bg); border-radius: 4px; padding: 0 5px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.review-one { max-width: 760px; }
.review-head { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 8px 0 2px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.review-head p { margin: 2px 0 6px; }
.review-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.review-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.review-bar .progress { width: 64px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.review-bar .progress i { display: block; height: 100%; background: var(--accent); }
.review-title { font-size: 1.2rem; margin: 0; }
.review-title a { color: inherit; }
.beer-cards { display: grid; gap: 8px; }
.beer-card { display: grid; grid-template-columns: 22px 44px 1fr auto; gap: 10px; align-items: center; margin: 0; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
/* The suggestion: an accent stripe and number, so its text lines up with the rest. */
.beer-card.suggested { box-shadow: inset 4px 0 0 var(--accent); }
.beer-card.suggested .key { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.beer-card.focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.beer-card.rejected { cursor: default; opacity: .55; }
.beer-card.rejected strong { text-decoration: line-through; }
.beer-card img, .beer-card .nolabel { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.beer-card .key { font: 600 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; text-align: center; padding: 1px 0; }
.beer-card .key:empty { visibility: hidden; }
.beer-card .who { min-width: 0; overflow-wrap: anywhere; }
.beer-card .meta { font-size: 13px; color: var(--muted); }
.beer-card button { font-size: 14px; padding: 4px 10px; }
.divider { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 0; display: flex; gap: 8px; align-items: center; }
.divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#review-results { display: contents; }
.review-search { display: flex; gap: 8px; margin-top: 12px; }
.review-search input { flex: 1; }
.review-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.review-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
@media (max-width: 520px) {
  .beer-card { grid-template-columns: 44px 1fr auto; }
  .beer-card .key { display: none; }
  .review-keys { display: none; }
}
