:root {
  --lager: #F4D77B;
  --pilsner: #E9AD36;
  --amber: #C87932;
  --copper: #A34E24;
  --brown: #643B27;
  --stout: #251A17;
  --page: #fff;
  --surface: #faf8f2;
  --text: #222824;
  --muted: #665A50;
  --border: #E7D9C5;
  --primary: var(--brown);
  --selected: var(--pilsner);
  --focus: var(--copper);
  --header-bg: #000;
  --header-ink: #fff;
  --header-gold: #f4c430;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.55 var(--font-ui); }
a { color: inherit; }
button, select, input, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Match the production masthead and keep both controls together. */
.site-header {
  display: flex; align-items: center; position: relative; z-index: 3;
  min-height: 65px; padding: 0 max(18px, calc((100vw - 1180px) / 2));
  background: var(--header-bg); color: var(--header-ink);
}
.menu-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.collection { margin-top: 22px; scroll-margin-top: 12px; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; margin-bottom: 18px; }
@media (min-width: 600px) {
  .section-heading h2 { grid-column: 1 / -1; }
  .section-heading .place-filters { grid-area: 2 / 1; }
  .section-heading .place-options { grid-area: 2 / 2; }
}
.section-heading h2 { margin: 0; }
.place-options { position: relative; }
.place-options summary { display: inline-flex; align-items: center; min-height: 44px; list-style: none; }
.place-options summary::-webkit-details-marker { display: none; }
.place-options summary { gap: 6px; padding: 0 5px; color: var(--primary); font-size: 13px; font-weight: 800; }
.options-panel { position: absolute; z-index: 2; top: 100%; right: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); width: min(280px, 85vw); display: grid; gap: 10px; }
.options-panel label { display: grid; min-width: 0; gap: 3px; font-weight: 700; }
select, input, textarea { min-width: 0; width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.place-filters { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.button, .region-clear {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--primary); font-size: 13px; font-weight: 800;
}
.place-filters button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px;
  padding: 5px 9px; border: 2px solid #171717; border-radius: 999px;
  background: #fff; color: #171717; font-size: 13px; font-weight: 800; white-space: nowrap;
}
.place-filters button[aria-pressed="true"] {
  color: #fff; background: #171717; box-shadow: 0 2px 7px rgba(23,23,23,.12);
}
.place-filters button[aria-pressed="true"] .filter-count { color: #d6d9d7; }
.filter-count { font-variant-numeric: tabular-nums; }
.region-clear { margin: 0 0 8px; }
.catalog-status { color: var(--muted); font-size: 14px; }
.catalog-status:empty { display: none; }
.catalog-status:not(:empty) { margin: 8px 0; }
.record-editor { display: grid; gap: 9px; }
.record-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.record-editor-close {
  display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 0;
  border: 1px solid #e4ded3; border-radius: 50%; color: #68716d; background: #fff;
}
.record-editor-close .bk-icon { width: 17px; height: 17px; }
.primary-button { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--primary); font-size: 14px; font-weight: 800; }
.empty { padding: 10px 0 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.button:disabled { opacity: .55; cursor: default; }
.feedback {
  position: fixed; z-index: 4; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 24px);
  padding: 5px 6px 5px 12px; border: 1px solid var(--brown); border-radius: 10px;
  background: var(--stout); color: var(--surface); font-size: 14px;
}
.feedback span { overflow-wrap: anywhere; }
.feedback .button { border-color: transparent; background: transparent; color: var(--lager); }
.feedback :focus-visible { outline-color: var(--lager); }
@media (hover: hover) and (pointer: fine) {
  .button:not(:disabled):hover { background: var(--lager); color: var(--text); }
  .place-filters button:not([aria-pressed="true"]):hover { background: #f0efed; }
  .place-filters button[aria-pressed="true"]:hover { background: #303030; border-color: #303030; }
  .map-link:hover, .text-link:hover { text-decoration-color: currentColor; }
}

@media (max-width: 480px) {
  main { padding: 14px 14px 76px; }
}

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-block: 24px clamp(64px, 12vw, 170px); }
.hero-content { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.hero-content h1 { overflow-wrap: anywhere; }
.hero-content > div { min-width: 0; }
.backup-action { display: grid; justify-items: start; gap: 6px; max-width: 16rem; }
.hero-content .backup-notice { margin: 0; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.4; }
.backup-trigger { gap: 8px; padding-inline: 18px; border-radius: 999px; color: #171717; }
.backup-trigger .bk-icon { width: 17px; height: 17px; }
.collection { margin-top: clamp(45px, 7.2vw, 86.4px); }
#places-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
#places-list .empty { grid-column: 1 / -1; }
@media (min-width: 600px) { #places-list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; } }
@media (min-width: 960px) { #places-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.place-row { display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid #e4ded3; border-radius: 16px; background: var(--page); overflow-wrap: anywhere; }
.row-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.row-heading-actions { display: flex; align-items: flex-start; gap: 8px; }
.row-heading h3 { margin-bottom: 5px; color: #171717; font: 600 16px/1.25 var(--font-display); letter-spacing: -.01em; }
.row-heading .place-type-icon { width: 14px; height: 14px; margin-inline-end: 3px; color: #68716d; }
.place-logo img { display: block; width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.place-city, .place-address { color: #68716d; font-size: 14px; }
.place-address { margin-top: 6px; line-height: 1.35; }
.place-visit-date { margin-top: 8px; color: #687468; font-size: 14px; }
.row-meta, .personal-beer { font-size: 13px; line-height: 1.45; color: var(--muted); }
.personal-beer .bk-icon { width: 14px; height: 14px; }
.place-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.status-badge, .rating-stars {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px;
  padding: 3px 8px; border-radius: 999px; background: #f3eee4; color: #171717;
  font-size: 14px; font-weight: 700;
}
.status-badge.favorite { justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; }
.status-badge.favorite[aria-pressed="true"] { background: #fff0d8; }
.status-badge.visited { background: #e6efeb; }
.status-badge.visited .bk-icon { color: #2f7d4a; }
.place-status .bk-icon, .row-heading-actions .favorite .bk-icon { width: 16px; height: 16px; }
.place-row .beer-list { margin-top: 11px; }
.beer-list { margin-top: 15px; }
.beer-list { margin-bottom: 11px; }
.beer-list > p { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.beer-list ul { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.beer-list li { padding: 4px 8px; border-radius: 7px; background: #efeadf; font-size: 13px; }
.personal-beer { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.note-area { display: flex; align-items: flex-start; gap: 6px; margin-top: auto; border: 1px dashed var(--border); border-radius: 13px; }
.place-status:has(+ .note-area) { margin-bottom: 9px; }
.note-area.has-note { padding: 7px 9px 7px 12px; border-color: transparent; background: #f9efd6; }
.note-area.has-note { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.note-area .button { flex: none; border: 0; background: transparent; }
.note-area:not(.has-note) .button { flex: 1; justify-content: flex-start; }
.note-preview { padding-block: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: italic 700 16px/1.35 var(--font-display); }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.row-actions { justify-content: space-between; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.row-actions .button { border-color: transparent; background: var(--surface); }
.map-link { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; text-decoration: none; font-size: 14px; font-weight: 800; }
.icon-button { width: 44px; padding: 0; }
.mybk-footer { padding-block: 24px; background: #000; color: #fff; font-size: 13px; }
.mybk-footer > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
#backup-panel, #record-editor-dialog { width: min(570px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 20px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); }
#backup-panel { background: var(--surface); }
#record-editor-dialog .rating-label { margin-top: 0; }
#record-editor-dialog :is(input, textarea) { font-size: 16px; }
#backup-panel::backdrop, #record-editor-dialog::backdrop { background: #17171799; }
#backup-panel p { margin-block: 10px; }
.backup-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.backup-heading h2 { font: 700 24px/1.1 var(--font-display); }
@media (max-width: 599px) {
  main { padding-top: 14px; }
  .place-options { margin-inline-start: auto; }
  .place-filters {
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 5px;
    margin: -5px;
  }
  .place-filters button { flex: none; }
  .place-row { padding: 16px; gap: 5px; }
}

@media (max-width: 720px) {
  body { padding-bottom: var(--bk-bottom-nav-height); }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    height: var(--bk-bottom-nav-height);
  }
  .feedback { bottom: calc(var(--bk-bottom-nav-height) + 12px); }
}
