/* Antonin Bräu: "Taproom" design system
   Charcoal from the logo badge, beer gold as the one accent,
   the bottle labels carry every other colour.
   Type: Basecoat/Tailwind default sans stack (system fonts, no web fonts). */


:root {
  color-scheme: dark;

  --bg: #111213;
  --surface: #1a1b1d;
  --surface-2: #232528;
  --surface-sunk: #0c0d0e;
  --border: #2e3034;
  --border-strong: #46494e;

  --text: #f4f1ea;        /* foam, 16.9:1 on --bg */
  --text-muted: #aaa69d;  /* 7.6:1 on --bg */
  --text-faint: #8a867e;  /* 5.0:1 on --bg, meta only */

  --gold: #f2b632;
  --gold-hover: #ffc74d;
  --gold-soft: rgb(242 182 50 / 0.14);
  --on-gold: #1b1405;
  --malt: #d08a4a;
  --hop: #8fbf5a;
  --success: #6fcf97;
  --danger: #ff8a7a;

  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-display: var(--font-sans);
  --font-body: var(--font-sans);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --topbar-h: 4rem;
  --tabbar-h: 4.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

/* Smooth cross-document page changes (Chromium, Safari 18.2+); other browsers just navigate */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: 160ms ease both vt-fade-out; }
::view-transition-new(root) { animation: 240ms var(--ease-out) both vt-fade-in; }
::view-transition-group(topbar), ::view-transition-group(nav) { animation: none; }
::view-transition-old(nav), ::view-transition-new(nav) { animation-duration: 160ms; }

/* Label morphs from its overview card into the detail hero (and back) */
::view-transition-group(*.label) { animation-duration: 450ms; animation-timing-function: var(--ease-out); }
::view-transition-old(*.label), ::view-transition-new(*.label) { height: 100%; object-fit: cover; }

@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; translate: 0 6px; } }

html { background: var(--bg); scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 1rem); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: calc(var(--safe-top) + 0.5rem);
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- App shell ---------- */

.topbar {
  position: sticky;
  view-transition-name: topbar;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-top);
  background: rgb(17 18 19 / 0.9);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner, .app {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.topbar__inner { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand img { width: 2.25rem; height: 2.25rem; }

.app {
  display: block;
  padding-top: clamp(1.25rem, 4vw, 2.5rem);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 3rem);
}

/* Main navigation: bottom tab bar on phones, inline in the top bar from tablet up */
.nav {
  position: fixed;
  view-transition-name: nav;
  inset: auto 0 0 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0.5rem 1rem var(--safe-bottom);
  background: rgb(17 18 19 / 0.94);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--border);
}

.nav a {
  flex: 1;
  max-width: 12rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}
.nav a svg { width: 1.5rem; height: 1.5rem; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--gold); background: var(--gold-soft); }

@media (min-width: 46.5rem) {
  .nav {
    /* Overlays the right side of .topbar, aligned to the same 76rem column */
    inset: var(--safe-top) 0 auto 0;
    max-width: 76rem;
    margin-inline: auto;
    height: var(--topbar-h);
    padding: 0 clamp(1rem, 4vw, 2rem);
    justify-content: flex-end;
    pointer-events: none;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    align-items: center;
    gap: 0.25rem;
  }
  .nav a {
    pointer-events: auto;
    flex: none;
    flex-direction: row;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 1rem;
    font-size: 0.9375rem;
    letter-spacing: 0;
  }
  .nav a svg { width: 1.25rem; height: 1.25rem; }
  .app { padding-bottom: 4rem; }
}

/* ---------- Type ---------- */

.display, .page-title, .home-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 0.95;
  text-wrap: balance;
}

.page-title { font-size: clamp(2.75rem, 8vw, 4rem); }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.625rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.muted { color: var(--text-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 1.125rem; height: 1.125rem; flex: none; }

.primary-action, .btn--primary { background: var(--gold); color: var(--on-gold); }
.primary-action:hover, .btn--primary:hover { background: var(--gold-hover); }
.primary-action { width: 100%; }

.btn--ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--border-strong); background: #2a2c30; }

.btn--sm { min-height: 44px; padding: 0.5rem 1rem; font-size: 1rem; }

.btn:disabled, .btn:disabled:hover {
  cursor: not-allowed;
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-faint);
  transform: none;
}

.btn__spinner {
  display: none;
  width: 1.125rem; height: 1.125rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.htmx-request .btn__spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
  margin: -0.5rem 0 1rem;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms ease;
}
.back-link svg { width: 1.25rem; height: 1.25rem; transition: transform 160ms var(--ease-out); }
.back-link:hover { color: var(--text); }
.back-link:hover svg { transform: translateX(-3px); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgb(242 182 50 / 0.55);
  text-underline-offset: 4px;
}
.text-link:hover { text-decoration-color: var(--gold); }
.text-link svg { width: 1rem; height: 1rem; }

/* ---------- Stars (fractional fill) ---------- */

.stars { position: relative; display: inline-block; line-height: 0; flex: none; }
.stars__row { display: flex; gap: 0.125em; }
.stars__row svg { width: 1em; height: 1em; flex: none; }
.stars__row--base { color: #3c3e43; }
.stars__row--fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--gold); width: var(--pct, 0%); }
.stars--sm { font-size: 0.9375rem; }
.stars--md { font-size: 1.25rem; }
.stars--lg { font-size: 1.625rem; }

/* ---------- Home ---------- */

.home-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.875rem;
  padding: clamp(0.5rem, 4vw, 2.5rem) 0 clamp(2rem, 6vw, 3.5rem);
}
.home-hero__logo { width: clamp(7rem, 22vw, 10.5rem); height: auto; aspect-ratio: 1; }
.home-hero h1 { font-size: clamp(3rem, 11vw, 6rem); }
.home-hero__stats {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  color: var(--text-muted);
}
.home-hero__stats strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.beer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
}

.beer-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 12px 32px -20px rgb(0 0 0 / 0.9);
  transition: border-color 200ms ease, transform 250ms var(--ease-out);
  /* Staggered fade-in; uses `translate` so it never fights the hover `transform` */
  animation: card-in 600ms var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 12) * 70ms + 80ms);
}
@keyframes card-in { from { opacity: 0; translate: 0 14px; } }
.beer-card__media { view-transition-class: label; aspect-ratio: 1722 / 945; background: var(--surface-sunk); overflow: hidden; border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; }
.beer-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease-out); }
.beer-card__body { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; padding: 1rem 1.25rem 1.125rem; }
.beer-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.beer-card__meta { color: var(--text-muted); font-size: 0.9375rem; }
.beer-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}
.beer-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.beer-card__cta svg { width: 1.25rem; height: 1.25rem; transition: transform 200ms var(--ease-out); }
.beer-card:hover { border-color: rgb(242 182 50 / 0.45); transform: translateY(-3px); }
.beer-card:hover .beer-card__media img { transform: scale(1.03); }
.beer-card:hover .beer-card__cta svg { transform: translateX(3px); }
.beer-card:focus-visible { outline-offset: 4px; border-radius: var(--radius-lg); }

.rating-inline { display: inline-flex; align-items: center; gap: 0.5rem; font-variant-numeric: tabular-nums; }
.rating-inline__value { font-weight: 600; }
.rating-inline__count { color: var(--text-muted); font-size: 0.9375rem; }
.unrated { color: var(--text-muted); font-size: 0.9375rem; }

/* ---------- Shared blocks ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3.5vw, 1.75rem);
  min-width: 0;
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 1.25rem; }
.panel__sub { color: var(--text-muted); font-size: 0.9375rem; margin-top: 0.25rem; }

.empty { display: grid; justify-items: center; gap: 0.75rem; text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty h2, .empty h3 { color: var(--text); font-size: 1.125rem; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
}
.chip--sm { padding: 0.25rem 0.625rem; font-size: 0.875rem; }
.chip__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.chip__dot--malt { background: var(--malt); }
.chip__dot--hop { background: var(--hop); }

/* ---------- Beer detail ---------- */

.beer-hero { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
@media (min-width: 64rem) { .beer-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }

.label-frame {
  view-transition-class: label;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-sunk);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.9);
}
.label-frame img { width: 100%; height: auto; aspect-ratio: 1722 / 945; object-fit: cover; }

.beer-hero__info { display: grid; gap: 1.25rem; justify-items: start; }
.beer-hero__info h1 { font-size: clamp(2.75rem, 7vw, 4.25rem); }

.rating-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rating-summary__value { font-family: var(--font-display); font-weight: 700; font-size: 3.25rem; line-height: 1; font-variant-numeric: tabular-nums; }
.rating-summary__detail { display: grid; gap: 0.125rem; justify-items: start; }
.rating-summary .text-link { min-height: 36px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (min-width: 46.5rem) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: var(--surface); padding: 1rem 1.25rem; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 0.125rem; }
.fact dt { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.fact dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.fact dd small { font-family: var(--font-body); font-weight: 500; font-size: 0.9375rem; color: var(--text-muted); margin-left: 0.125rem; }
.ebc-dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.25); }

.detail-grid { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); margin-top: clamp(1rem, 2.5vw, 1.5rem); }
@media (min-width: 64rem) { .detail-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; } }
.detail-col { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); min-width: 0; }
@media (min-width: 64rem) and (min-height: 46rem) {
  /* Facts come first in the DOM (and on phones); on desktop they sit in a sticky side column */
  .detail-aside { position: sticky; top: calc(var(--topbar-h) + var(--safe-top) + 1.5rem); }
}
@media (min-width: 64rem) {
  .detail-main { grid-column: 1; grid-row: 1; }
  .detail-aside { grid-column: 2; grid-row: 1; }
}
.panel .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1rem; background: none; border: 0; border-radius: 0; }
.panel .fact { padding: 0; background: none; }

.info-list { margin: 0; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.info-row:first-child { padding-top: 0; }
.info-row dt { color: var(--text-muted); }
.info-row dd { margin: 0; font-weight: 600; text-align: right; }
.ingredients { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.ingredients h3 { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.625rem; }

.copy { color: #d9d5cc; font-size: 1.0625rem; line-height: 1.75; max-width: 68ch; overflow-wrap: break-word; }
.copy p { margin: 0 0 1em; }
.copy p:last-child { margin-bottom: 0; }
.copy strong { color: var(--text); font-weight: 600; }
.copy a { color: var(--gold); }

.radar-card { position: relative; height: 20rem; }
@media (min-width: 46.5rem) { .radar-card { height: 23rem; } }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 160ms ease, border-color 160ms ease;
}
.legend__item:hover { border-color: var(--border-strong); }
.legend__item[aria-pressed="false"] { opacity: 0.5; text-decoration: line-through; }
.legend__swatch { width: 0.75rem; height: 0.75rem; border-radius: 3px; }

.reviews { display: grid; }
.review {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.875rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}
.review:first-child { border-top: 0; padding-top: 0.25rem; }
.review:last-child { padding-bottom: 0; }
.avatar {
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold);
  text-transform: uppercase;
}
.review__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; }
.review__name { font-weight: 600; overflow-wrap: anywhere; }
.review__date { color: var(--text-faint); font-size: 0.875rem; }
.review__score { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.review__text { margin-top: 0.5rem; color: #d9d5cc; overflow-wrap: anywhere; white-space: pre-line; }
.review .chips { margin-top: 0.75rem; }

/* ---------- Rate ---------- */

.rate-page { max-width: 44rem; margin-inline: auto; }
.rate-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1.25rem, 4vw, 2rem);
}
.rate-head h1 { font-size: clamp(2.25rem, 8vw, 3.5rem); margin-top: 0.25rem; }
.rate-head__style { color: var(--text-muted); margin-top: 0.375rem; }
.rate-head__thumb { width: clamp(6.5rem, 26vw, 10rem); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.rate-head__thumb img { width: 100%; height: auto; aspect-ratio: 1722 / 945; object-fit: cover; }

.rate-form { display: grid; gap: clamp(1rem, 3vw, 1.25rem); }
.rate-field .field-title { display: block; }
.panel__head--tight { margin-bottom: 0; }
.rate-field h2, .rate-field .field-title { font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.2; }
.hint { color: var(--text-muted); font-size: 0.9375rem; margin-top: 0.25rem; }

.score { display: grid; justify-items: center; gap: 0.5rem; margin: 1.25rem 0 1rem; text-align: center; }
.score__value { font-family: var(--font-display); font-weight: 700; font-size: 4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score__value small { font-family: var(--font-body); font-weight: 500; font-size: 1.125rem; color: var(--text-muted); margin-left: 0.25rem; }
.score__word { color: var(--gold); font-weight: 600; min-height: 1.6em; }
.score__value.is-empty { color: var(--text-faint); font-family: var(--font-body); font-weight: 400; }

.rating-slider {
  --pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.rating-slider:focus-visible { outline: none; }
.rating-slider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(to right, var(--gold) var(--pct), var(--surface-2) var(--pct));
}
.rating-slider::-moz-range-track { height: 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.rating-slider::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--gold); }
.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 30px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--gold);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px var(--gold), 0 4px 12px rgb(0 0 0 / 0.5);
  transition: transform 120ms var(--ease-out);
}
.rating-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px var(--gold), 0 4px 12px rgb(0 0 0 / 0.5);
}
.rating-slider.is-untouched::-webkit-slider-thumb { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong), 0 4px 12px rgb(0 0 0 / 0.5); }
.rating-slider.is-untouched::-moz-range-thumb { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong), 0 4px 12px rgb(0 0 0 / 0.5); }
.rating-slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.rating-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--gold), 0 0 0 6px rgb(242 182 50 / 0.35); }
.rating-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--gold), 0 0 0 6px rgb(242 182 50 / 0.35); }

.range-scale { display: flex; justify-content: space-between; padding-inline: 10px; color: var(--text-faint); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.range-scale span { width: 1ch; display: flex; justify-content: center; }

.flavor-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.flavor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.flavor-chip svg { width: 1rem; height: 1rem; display: none; }
.flavor-chip:hover { border-color: var(--border-strong); }
.flavor-chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 600; }
.flavor-chip[aria-pressed="true"] svg { display: block; }
.flavor-count { color: var(--text-muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

.field-block { display: grid; gap: 0.5rem; }
.field-block + .field-block { margin-top: 1.25rem; }
.field-label { font-weight: 600; }
.field-label span { font-weight: 400; color: var(--text-muted); }

.input, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.875rem;
  background: var(--surface-sunk);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem; /* >= 16px keeps iOS from zooming into the field */
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.textarea { min-height: 8rem; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgb(242 182 50 / 0.25); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { display: flex; align-items: center; gap: 0.375rem; color: var(--danger); font-size: 0.9375rem; font-weight: 500; }
.field-error svg { width: 1rem; height: 1rem; flex: none; }
#ratingError:not(:empty) { margin-top: 0.75rem; }

.rate-submit-bar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 40;
  margin-inline: calc(clamp(1rem, 4vw, 2rem) * -1);
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: rgb(17 18 19 / 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.rate-submit-bar__hint { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-top: 0.5rem; }
@media (min-width: 46.5rem) {
  .rate-submit-bar { position: static; margin: 0; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; }
}

.rating-success-screen { display: grid; place-items: center; min-height: 60dvh; }
.rating-success-card {
  width: 100%;
  max-width: 32rem;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: clamp(1.75rem, 5vw, 2.5rem);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.rating-success-icon { width: 3.5rem; height: 3.5rem; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--on-gold); }
.rating-success-icon svg { width: 1.75rem; height: 1.75rem; }
.rating-success-card h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 7vw, 2.75rem); line-height: 1; text-transform: uppercase; }
.rating-success-card p { color: var(--text-muted); max-width: 26rem; }
.rating-success-actions { display: grid; gap: 0.75rem; width: 100%; margin-top: 0.75rem; }

/* ---------- Statistics ---------- */

.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: clamp(1.25rem, 4vw, 2rem); }
.stats-head img { width: 3.5rem; height: 3.5rem; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(0.75rem, 2vw, 1.25rem); margin-bottom: clamp(1rem, 2.5vw, 1.5rem); }
@media (min-width: 46.5rem) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 0.25rem; }
.kpi:last-child { grid-column: 1 / -1; }
@media (min-width: 46.5rem) { .kpi:last-child { grid-column: auto; } }
.kpi__value { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.5rem, 7vw, 3.25rem); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__value span { font-family: var(--font-body); font-weight: 500; font-size: 1rem; color: var(--text-muted); }
.kpi small { order: -1; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.kpi__note { font-size: 0.875rem; color: var(--text-faint); }

.stats-grid { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); align-items: start; }
@media (min-width: 64rem) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats-col { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); min-width: 0; }

.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rank-list li { border-top: 1px solid var(--border); }
.rank-list li:first-child { border-top: 0; }
.rank {
  display: grid;
  grid-template-columns: 1.75rem 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.5rem;
  margin-inline: -0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 140ms ease;
}
.rank:hover { background: var(--surface-2); }
.rank::before { counter-increment: rank; content: counter(rank); font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--text-faint); text-align: center; }
.rank img { width: 4.5rem; aspect-ratio: 1722 / 945; object-fit: cover; border-radius: 6px; }
.rank__text { min-width: 0; }
.rank__name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.rank__meta { display: block; font-size: 0.875rem; color: var(--text-muted); }
.rank__score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rank__score small { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--text-muted); }
@media (max-width: 30rem) { .rank { grid-template-columns: 1.5rem minmax(0, 1fr) auto; } .rank img { display: none; } }

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.bar-list__row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: 0.9375rem; }
.bar-list__row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-list__row strong span { font-weight: 400; font-size: 0.8125rem; color: var(--text-muted); }
.bar { height: 8px; margin-top: 0.375rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--gold); }

/* ---------- Detail page entrance ---------- */
/* Staggered fade-up while the label morphs in. Uses `translate` so hover transforms stay intact. */
@keyframes rise-in { from { opacity: 0; translate: 0 12px; } }

.beer-detail .beer-hero__info > *,
.beer-detail .detail-col > .panel {
  animation: rise-in 560ms var(--ease-out) backwards;
  animation-delay: calc(var(--d, 0) * 1ms);
}
.beer-hero__info > :nth-child(1) { --d: 120; }
.beer-hero__info > :nth-child(2) { --d: 180; }
.beer-hero__info > :nth-child(3) { --d: 240; }
.beer-hero__info > :nth-child(4) { --d: 300; }
.detail-aside > .panel:nth-child(1) { --d: 340; }
.detail-aside > .panel:nth-child(2) { --d: 420; }
.detail-main > .panel:nth-child(1) { --d: 400; }
.detail-main > .panel:nth-child(n+2) { --d: 480; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .beer-card:hover, .beer-card:hover .beer-card__media img { transform: none; }
  .beer-card, .beer-detail .beer-hero__info > *, .beer-detail .detail-col > .panel { animation: none; }
  @view-transition { navigation: none; }
}
