/* ==========================================================================
   beermap — "brown café" theme
   Bottle-green darks, golden-ale amber, foam text.
   Bricolage Grotesque for display, Instrument Sans for everything else.
   ========================================================================== */

@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

/* ---- Tokens: dark (default) ---- */
:root,
[data-theme="dark"] {
  --bg: #1a0a0f;
  --card: #26101a;
  --card-alt: #301520;
  --input: #3a1b28;
  --border: #4a2535;
  --text: #f2ede3;
  --text-dim: #b39ba3;
  --accent: #d94a64;
  --accent-ink: #fff4f1;
  --accent-text: #d94a64;
  --accent-soft: rgba(217, 74, 100, 0.14);
  --accent-dim: #6e1f33;
  --danger: #ec5f56;
  --danger-soft: rgba(236, 95, 86, 0.14);
  --success: #52c48c;
  --success-soft: rgba(82, 196, 140, 0.14);
  --surface-1: var(--card-alt);
  --surface-2: var(--card);
  --nav-bg: rgba(38, 16, 26, 0.86);
  --glass-bg: rgba(38, 16, 26, 0.82);
  --glass-border: rgba(242, 237, 227, 0.08);
  --topbar-gradient: linear-gradient(180deg, rgba(26, 10, 15, 0.75) 0%, rgba(26, 10, 15, 0) 100%);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --pin-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --pin-ring: rgba(255, 255, 255, 0.85);
  --map-bg: #1a0a0f;
  color-scheme: dark;
}

/* ---- Tokens: light ---- */
[data-theme="light"] {
  --bg: #f6ecee;
  --card: #ffffff;
  --card-alt: #fbf4f5;
  --input: #efdfe3;
  --border: #dcc3ca;
  --text: #2a1018;
  --text-dim: #7a5a64;
  --accent: #a3203c;
  --accent-ink: #fff4f1;
  --accent-text: #8c1c33;
  --accent-soft: rgba(163, 32, 60, 0.18);
  --accent-dim: #f1c3cc;
  --danger: #c8372e;
  --danger-soft: rgba(200, 55, 46, 0.1);
  --success: #23885a;
  --success-soft: rgba(35, 136, 90, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(42, 16, 24, 0.08);
  --topbar-gradient: linear-gradient(180deg, rgba(246, 236, 238, 0.8) 0%, rgba(246, 236, 238, 0) 100%);
  --shadow: 0 10px 30px rgba(42, 16, 24, 0.12);
  --shadow-sm: 0 2px 8px rgba(42, 16, 24, 0.1);
  --pin-shadow: 0 1px 2px rgba(42, 16, 24, 0.3);
  --map-bg: #ead6db;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg: #f6ecee;
    --card: #ffffff;
    --card-alt: #fbf4f5;
    --input: #efdfe3;
    --border: #dcc3ca;
    --text: #2a1018;
    --text-dim: #7a5a64;
    --accent: #a3203c;
    --accent-text: #8c1c33;
    --accent-soft: rgba(163, 32, 60, 0.18);
    --accent-dim: #f1c3cc;
    --danger: #c8372e;
    --danger-soft: rgba(200, 55, 46, 0.1);
    --success: #23885a;
    --success-soft: rgba(35, 136, 90, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(42, 16, 24, 0.08);
    --topbar-gradient: linear-gradient(180deg, rgba(246, 236, 238, 0.8) 0%, rgba(246, 236, 238, 0) 100%);
    --shadow: 0 10px 30px rgba(42, 16, 24, 0.12);
    --shadow-sm: 0 2px 8px rgba(42, 16, 24, 0.1);
    --pin-shadow: 0 1px 2px rgba(42, 16, 24, 0.3);
    --map-bg: #ead6db;
    color-scheme: light;
  }
}

:root {
  --font-display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --nav-height: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Base ---- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 0; height: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---- Icons ---- */
.icon-svg { display: inline-flex; align-items: center; justify-content: center; line-height: 1; vertical-align: middle; }
.icon-mask { user-select: none; pointer-events: none; }

/* ==========================================================================
   Auth screen
   ========================================================================== */
#auth-screen {
  position: fixed;
  inset: 0;
  /* above the app and tab pages (≤60), below sheets (100+) and the toast */
  z-index: 90;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: calc(32px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
  background: var(--bg);
}

/* One warm disc behind the wordmark */
#auth-screen::before {
  content: "";
  position: absolute;
  top: -140px; right: -140px;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.12;
  pointer-events: none;
}

/* auto margins centre vertically but, unlike justify-content, never clip the top when content overflows */
.auth-brand { position: relative; margin: auto auto 28px; width: 100%; max-width: 400px; }

.auth-brand .logo-icon {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 5px var(--accent), inset 0 0 0 7px rgba(43, 26, 0, 0.35);
  margin-bottom: 20px;
  font-size: 30px;
}
.auth-brand .logo-icon .icon-mask { width: 30px !important; height: 30px !important; }

.auth-brand h1 {
  font-size: clamp(52px, 16vw, 72px);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.045em;
  margin: 0;
}

.auth-brand .tagline,
.auth-brand p {
  color: var(--text-dim);
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 1.45;
  max-width: 30ch;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--input);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 10px 0;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.auth-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

.auth-error, .auth-success {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.auth-error { background: var(--danger-soft); color: var(--danger); }
.auth-success { background: var(--success-soft); color: var(--success); }
.auth-error.show, .auth-success.show { display: block; }

.auth-hint { text-align: center; color: var(--text-dim); font-size: 12.5px; margin: 14px 0 0; line-height: 1.5; }
.auth-hint a { text-decoration: underline; text-underline-offset: 2px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 12.5px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { flex: 0 1 auto; text-align: center; }

#btn-forgot-password { margin-top: 6px; font-size: 13px; padding: 8px; }

/* ==========================================================================
   Form fields & buttons
   ========================================================================== */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-dim); opacity: 0.75; }
.field textarea { resize: none; min-height: 84px; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: var(--card); }
.field input[type="color"] { padding: 4px; height: 46px; }
.field-hint { font-size: 12px; line-height: 1.45; color: var(--text-dim); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--input); color: var(--text); width: 100%; }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-google { background: var(--card); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn-google:hover { border-color: var(--text-dim); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ==========================================================================
   Map
   ========================================================================== */
#map-view { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: var(--map-bg); z-index: 1; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }

/* Pin: solid disc with a white rim */
.beer-pin {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--pin-ring);
  box-shadow: var(--pin-shadow), inset 0 0 0 3px rgba(0, 0, 0, 0.08);
  position: relative;
  transition: transform 0.15s var(--ease);
}
.beer-pin span { font-size: 15px; }
.maplibregl-marker:hover .beer-pin { transform: scale(1.12); }

.user-location-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #4c8dff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(76, 141, 255, 0.22);
}

.drop-pin-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -100%);
  z-index: 40;
  pointer-events: none;
  font-size: 34px;
  color: var(--accent);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  display: none;
}
.drop-pin-hint.show { display: block; }

/* ---- Floating top bar ---- */
#top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 60;
  padding: calc(12px + var(--safe-top)) 12px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  background: var(--topbar-gradient);
}
#top-bar > * { pointer-events: auto; }

.icon-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 19px;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.12s var(--ease);
}
.icon-btn:active { transform: scale(0.92); }

.search-pill {
  flex: 1;
  min-width: 0;
  height: 46px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--text-dim);
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.search-pill .icon-mask { opacity: 0.7; }

.badge-dot {
  position: absolute;
  top: 9px; right: 10px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--card);
  display: none;
}
.badge-dot.show { display: block; }


#offline-banner {
  display: none;
  position: absolute;
  top: calc(70px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 58;
  max-width: calc(100% - 32px);
  background: var(--danger);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
#offline-banner.show { display: block; }

/* ---- Banners under the top bar ---- */
.verify-email-banner,
.guest-account-banner {
  position: absolute;
  top: calc(70px + var(--safe-top));
  left: 12px; right: 12px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 10px 10px 14px;
  box-shadow: var(--shadow);
  animation: bannerIn 0.35s var(--ease);
}
@keyframes bannerIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.verify-email-banner-text,
.guest-account-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.35;
  overflow-wrap: break-word;
}
.verify-email-banner-text strong,
.guest-account-banner-text strong { font-size: 13.5px; color: var(--text); font-weight: 650; }
.verify-email-banner .btn,
.guest-account-banner .btn { flex-shrink: 0; width: auto; white-space: nowrap; }

/* ==========================================================================
   Bottom bar: tab pill on the left, round "log a beer" button on the right.
   Inactive tabs are icons only; the active tab grows to show its label.
   ========================================================================== */
#bottom-nav {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 60;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
#bottom-nav > * { pointer-events: auto; }

.nav-tabs {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.nav-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 650;
  transition: flex-grow 0.3s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-btn .nav-icon { display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.nav-btn > span:not(.nav-icon):not(.offline-pin-badge) { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-btn:hover { color: var(--text); }
/* The active tab sizes to its label (never truncated); the icon-only tabs share the rest */
.nav-btn.active { flex: 0 0 auto; background: var(--text); color: var(--bg); }
.nav-btn.active > span:not(.nav-icon):not(.offline-pin-badge) { display: inline; }

.nav-btn-add {
  width: var(--nav-height);
  height: var(--nav-height);
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 10px 24px rgba(217, 74, 100, 0.4);
  transition: transform 0.18s var(--ease);
}
.nav-btn-add:active { transform: scale(0.92) rotate(90deg); }
/* Narrow phones: give the active tab enough room for its full label */
@media (max-width: 379px) {
  .nav-btn { padding: 0 8px; }

  .nav-btn-add { width: 56px; height: 56px; }
}

/* Floating Done/Cancel while moving a pin under the centre crosshair */
.move-pin-bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-height) + 28px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 61;
  display: flex;
  gap: 10px;
}
.move-pin-bar .btn { width: auto; box-shadow: var(--shadow); }

.offline-pin-badge {
  position: absolute;
  top: 2px; right: 4px;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  display: none;
}
.offline-pin-badge.show { display: block; }

/* ---- Map controls: right-edge stack ---- */
#map-controls {
  position: absolute;
  right: 12px;
  bottom: calc(var(--nav-height) + 28px + var(--safe-bottom));
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
#map-controls .icon-btn { border-radius: 0; box-shadow: none; border: none; width: 48px; height: 50px; }
#map-controls .locate-btn { position: static; }

/* ==========================================================================
   Tab pages: Friends, Trophies, Profile, Admin, Games are full screens that
   sit under the bottom bar, not pop-up sheets.
   ========================================================================== */
#sheet-friends, #sheet-achievements, #sheet-profile, #sheet-admin, #sheet-drinking-games {
  top: 0;
  height: 100%;
  max-height: none;
  z-index: 58;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
  /* leaving: drift opposite to the direction of travel (--tab-dir is set by the tab bar) */
  transform: translateX(calc(var(--tab-dir, 1) * -72px));
  opacity: 0;
  visibility: hidden;
  padding-top: var(--safe-top);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 1, 1), transform 0.3s var(--ease), visibility 0s linear 0.3s;
}
#sheet-friends.show, #sheet-achievements.show, #sheet-profile.show, #sheet-admin.show, #sheet-drinking-games.show {
  opacity: 1;
  visibility: visible;
  box-shadow: none;
  transform: none;
  z-index: 59;
  transition: opacity 0.3s var(--ease), transform 0.36s var(--ease), visibility 0s;
}
/* Start position for a page that is about to slide in (set for one frame by openSheet) */
.sheet.tab-enter { opacity: 0 !important; transform: translateX(calc(var(--tab-dir, 1) * 64px)) !important; transition: none !important; }
/* The page being left stays put under the incoming one, so the map never shows through */
.sheet.tab-hold { opacity: 1 !important; transform: none !important; visibility: visible !important; transition: none !important; }
.tab-loading { display: flex; justify-content: center; padding: 64px 0; }
[data-backdrop-for="sheet-friends"], [data-backdrop-for="sheet-achievements"], [data-backdrop-for="sheet-profile"],
[data-backdrop-for="sheet-admin"], [data-backdrop-for="sheet-drinking-games"] { display: none; }

#sheet-friends .sheet-handle, #sheet-achievements .sheet-handle, #sheet-profile .sheet-handle,
#sheet-admin .sheet-handle, #sheet-drinking-games .sheet-handle { display: none; }

#sheet-friends .sheet-header, #sheet-achievements .sheet-header, #sheet-profile .sheet-header,
#sheet-admin .sheet-header, #sheet-drinking-games .sheet-header { padding: 18px 20px 8px; }

#sheet-friends .sheet-header h2, #sheet-achievements .sheet-header h2, #sheet-profile .sheet-header h2,
#sheet-admin .sheet-header h2, #sheet-drinking-games .sheet-header h2 { font-size: 34px; letter-spacing: -0.03em; }

#sheet-friends .sheet-body, #sheet-achievements .sheet-body, #sheet-profile .sheet-body,
#sheet-admin .sheet-body, #sheet-drinking-games .sheet-body {
  flex: 1;
  padding-bottom: calc(var(--nav-height) + 40px + var(--safe-bottom));
}

/* Tablets and desktop: pages become a panel on the left, map stays visible */
@media (min-width: 900px) {
  #sheet-friends, #sheet-achievements, #sheet-profile, #sheet-admin, #sheet-drinking-games {
    top: 12px; bottom: 12px; left: 12px; right: auto;
    width: 440px; height: auto;
    margin: 0;
    max-width: none;
    border-radius: var(--radius-xl);
    background: var(--card);
    box-shadow: var(--shadow);
  }
  #bottom-nav { left: 50%; right: auto; width: 460px; transform: translateX(-50%); }
}

/* ==========================================================================
   Sheets
   ========================================================================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 10, 8, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 101;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.38s var(--ease), visibility 0s linear 0.38s;
}
/* Shadow only on open sheets: closed ones sit just below the screen and would bleed through */
.sheet.show { transform: translateY(0); visibility: visible; transition: transform 0.38s var(--ease), visibility 0s; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3); }
.sheet.sheet-full { max-height: 94vh; max-height: 94dvh; }

.sheet-handle {
  width: 40px; height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px 12px;
  flex-shrink: 0;
}
.sheet-header h2 {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sheet-header h2 .icon-mask { color: var(--accent); width: 0.85em !important; height: 0.85em !important; }

.sheet-close {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--input);
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-close:hover { color: var(--text); }

.sheet-body {
  overflow-y: auto;
  padding: 6px 20px calc(24px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.sheet-footer {
  padding: 12px 20px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card);
}
.sheet-footer.row { display: flex; gap: 10px; }

.sheet-description { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0 0 16px; }

@media (min-width: 640px) {
  .sheet { max-width: 520px; margin: 0 auto; }
}

/* ==========================================================================
   Content primitives
   ========================================================================== */
.section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 22px 0 10px;
}

.card {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 13px; color: var(--text-dim); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row > .btn, .list-row > button { flex-shrink: 0; white-space: nowrap; width: auto; }

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar.lg { width: 76px; height: 76px; font-size: 30px; box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--accent); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state .icon-mask { width: 34px !important; height: 34px !important; color: var(--accent); opacity: 0.8; margin-bottom: 10px; }
.empty-state .emoji { font-size: 40px; display: block; margin-bottom: 10px; }
.empty-state p { margin: 4px auto 0; font-size: 14px; max-width: 32ch; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.muted { color: var(--text-dim); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.field.mb-0:has(+ .beer-suggestions:not(.show)) { margin-bottom: 14px !important; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}
.badge-info { background: #3b82f6; color: #fff; }
.pin-tags { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-bottom: 14px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Segmented control & chips ---- */
.segmented {
  display: flex;
  gap: 2px;
  background: var(--input);
  border-radius: 999px;
  padding: 4px;
}
.segmented button {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 9px 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button .icon-mask { flex: 0 0 auto; width: 15px !important; height: 15px !important; }
[data-friends-tab] { font-size: 12px !important; padding-left: 2px !important; padding-right: 2px !important; gap: 4px !important; }
[data-friends-tab] .icon-mask { width: 13px !important; height: 13px !important; }

.chip-row, .admin-tab-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---- Pin colours ---- */
.color-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.color-swatch {
  width: 38px; height: 38px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.color-swatch.active { transform: scale(1.08); box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); }
.color-swatch.color-any {
  background: var(--input);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Toggle ---- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: none; }
.switch-row-label { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.switch-row-label .icon-mask { color: var(--text-dim); }
.switch-row-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; line-height: 1.4; }

.toggle {
  width: 50px; height: 30px;
  flex-shrink: 0;
  position: relative;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s var(--ease);
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(20px); }

/* ---- Stars ---- */
.star-rating { display: flex; gap: 8px; margin: 8px 0; }
.star-rating .star {
  font-size: 30px;
  color: var(--input);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  transition: color 0.15s var(--ease), transform 0.12s var(--ease);
}
.star-rating .star.active { color: var(--accent); }
.star-rating .star:active { transform: scale(1.2); }

/* ---- Spinners ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid var(--input);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.center-spinner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* ==========================================================================
   Add pin
   ========================================================================== */
.media-upload-row { display: flex; gap: 10px; margin-bottom: 14px; }
.media-upload-row .photo-upload { margin-bottom: 0; }

.photo-upload {
  flex: 1;
  width: 100%;
  height: 128px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
  background: var(--card-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.photo-upload:hover { border-color: var(--accent); color: var(--text); }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-upload .icon { font-size: 26px; color: var(--accent); }
#btn-open-camera { background: var(--accent-soft); border-color: transparent; color: var(--text); }

#media-preview-wrap {
  position: relative;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--input);
}
#media-preview-img, #media-preview-video { width: 100%; max-height: 280px; object-fit: cover; display: block; }
#btn-media-remove {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.beer-suggestions {
  display: none;
  max-height: 180px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin: 6px 0 14px;
}
.beer-suggestions.show { display: block; }
.beer-suggestion-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.beer-suggestion-item:last-child { border-bottom: none; }
.beer-suggestion-item:hover, .beer-suggestion-item:active { background: var(--card-alt); }

.label-scan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin: 0 0 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--text);
}
.label-scan-status.hidden { display: none; }
.label-scan-spinner {
  width: 16px; height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.label-scan-status .label-scan-check { color: var(--accent-text); font-weight: 600; }

/* block, not flex: these mix text nodes with an inline button, which flex would split into columns */
.nominate-locked-hint,
.guest-lock-hint {
  display: block;
  padding: 11px 13px;
  margin: 8px 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
}
.guest-lock-hint .icon-mask, .nominate-locked-hint .icon-mask { margin: -2px 4px 0 0; }
.link-btn,
.guest-lock-hint .link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-text);
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.nomination-reply-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  font-size: 13.5px;
}
.nomination-reply-banner .emoji { font-size: 22px; }

/* ==========================================================================
   Pin popup & detail
   ========================================================================== */
.maplibregl-popup-content {
  background: var(--card) !important;
  color: var(--text);
  border-radius: var(--radius-md) !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}
.maplibregl-popup-tip { border-top-color: var(--card) !important; border-bottom-color: var(--card) !important; }

.pin-popup-photo { width: 100%; height: 120px; object-fit: cover; background: var(--input); }
.pin-popup-body { padding: 12px 14px; }
.pin-popup-beer { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.pin-popup-meta { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.pin-popup-user { color: var(--accent-text); font-weight: 600; font-size: 13px; margin-top: 6px; }
.pin-popup-stats { display: flex; gap: 12px; margin-top: 8px; font-size: 12.5px; color: var(--text-dim); }
.pin-popup-open {
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 9px 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 13px;
}

.pin-detail-photo {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--input);
  margin-bottom: 16px;
  cursor: zoom-in;
}
.pin-detail-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 12px; }
.pin-detail-name {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.pin-detail-abv {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.pin-detail-desc { color: var(--text); opacity: 0.85; font-size: 15px; margin-bottom: 16px; line-height: 1.55; }

.visibility-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.visibility-badge.public { background: var(--success-soft); color: var(--success); }
.visibility-badge.friends { background: var(--accent-soft); color: var(--accent-text); }
.visibility-badge.private { background: var(--danger-soft); color: var(--danger); }

.dual-media { position: relative; }
.dual-media .dual-main { width: 100%; height: 100%; object-fit: cover; display: block; }
.dual-media .dual-pip,
.dual-pip {
  position: absolute;
  left: 4%;
  bottom: 4%;
  width: 32%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 2;
  overflow: hidden;
}
.dual-pip img, .dual-pip video { width: 100%; height: 100%; object-fit: cover; }

.pin-actions { display: flex; gap: 10px; margin-bottom: 18px; }
.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.action-btn:hover { background: var(--card-alt); }
.action-btn.liked { color: var(--danger); border-color: transparent; background: var(--danger-soft); }

.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-item .avatar { width: 34px; height: 34px; font-size: 14px; }
.comment-bubble { flex: 1; min-width: 0; }
.comment-user { font-weight: 650; font-size: 13.5px; }
.comment-text { font-size: 14.5px; margin-top: 2px; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
.comment-time { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.comment-delete { background: none; border: none; color: var(--text-dim); font-size: 12.5px; align-self: flex-start; }
.comment-delete:hover { color: var(--danger); }

.comment-input-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.comment-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--input);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.comment-input-row input:focus { border-color: var(--accent); }
.comment-send {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  display: grid;
  place-items: center;
}

/* ==========================================================================
   Profile & stats
   ========================================================================== */
.profile-header { display: flex; align-items: center; gap: 16px; margin: 6px 0 22px; }
.profile-header > div[style*="flex:1"] { min-width: 0; }
.profile-header > .btn, .profile-header > .icon-btn { flex-shrink: 0; }
.profile-header > .btn-primary, .profile-header > .btn-secondary { width: auto; white-space: nowrap; }
.profile-header .icon-btn { box-shadow: none; background: var(--input); border-color: transparent; }
.profile-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-sub { color: var(--text-dim); font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.stat-clickable { cursor: pointer; transition: transform 0.12s var(--ease), border-color 0.2s var(--ease); }
.stat-clickable:hover { border-color: var(--accent); }
.stat-clickable:active { transform: scale(0.97); }
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
/* First stat is the headline number */
.stats-grid > .stat-card:first-child { background: var(--accent); border-color: var(--accent); }
.stats-grid > .stat-card:first-child .stat-value,
.stats-grid > .stat-card:first-child .stat-label { color: var(--accent-ink); }

.pin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--radius-md); overflow: hidden; }
.pin-grid-item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--card-alt);
  position: relative;
  cursor: pointer;
  border-radius: 8px;
}
.pin-grid-item img, .pin-grid-item video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s var(--ease); }
.pin-grid-item:hover img { transform: scale(1.04); }
.pin-grid-item .no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--accent); }
.pin-grid-video-badge {
  position: absolute; right: 6px; bottom: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

.drinking-graph-wrap { margin-bottom: 20px; }
.drinking-graph-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 96px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px 8px;
}
.drinking-graph-bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.drinking-graph-bar { width: 100%; max-width: 14px; min-height: 3px; border-radius: 999px; background: var(--border); }
.drinking-graph-bar.has-chug { background: var(--accent); }
.drinking-graph-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 6px; padding: 0 2px; }

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
}
.streak-badge.sober { background: var(--success-soft); color: var(--success); }

.streak-detail-grid { display: flex; flex-direction: column; gap: 12px; }
.streak-detail-card { background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.streak-detail-value { font-family: var(--font-display); font-size: 40px; font-weight: 750; line-height: 1; letter-spacing: -0.03em; color: var(--accent-text); }
.streak-detail-label { font-size: 15px; font-weight: 650; margin-top: 6px; }
.streak-detail-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }

/* ---- Badges ---- */
.badge-chip { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.badge-chip .icon-mask, .badge-chip [class*="icon"] { font-size: 20px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.badge-chip-tiled { width: 46px; height: 46px; background: var(--card-alt); border: 2px solid currentColor; }

.profile-display-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: var(--card-alt);
  font-size: 12px;
  vertical-align: middle;
}
.profile-display-badge .icon-mask { width: 1em; height: 1em; }
.profile-badges-card { margin: 12px 0 16px; }

.display-badge-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--card-alt);
  border: 1px solid var(--border);
}
.display-badge-preview .badge-chip.circle { width: 44px; height: 44px; border: 2px solid currentColor; background: var(--card); }
.display-badge-preview .badge-chip.circle .icon-mask { font-size: 23px; }
.display-badge-avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border); background: var(--card); }

.badge-picker { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border-radius: var(--radius-md); background: var(--card-alt); border: 1px solid var(--border); }
.badge-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--badge-color, var(--accent));
  font-size: 20px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.badge-option:hover { border-color: var(--text-dim); }
.badge-option.selected { border-color: var(--badge-color, var(--accent)); box-shadow: 0 0 0 2px var(--card-alt), 0 0 0 4px var(--badge-color, var(--accent)); }
.badge-option .icon-mask { width: 1em; height: 1em; }
.badge-option--none { color: var(--text-dim); font-size: 11px; font-weight: 600; }
.badge-option--none.selected { border-color: var(--text-dim); box-shadow: 0 0 0 2px var(--card-alt), 0 0 0 4px var(--text-dim); }
.badge-user-select {
  max-width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
}

/* ==========================================================================
   Friends, leaderboard, notifications
   ========================================================================== */
.friend-req-actions { display: flex; gap: 8px; }
.friend-req-actions button { width: 38px; height: 38px; border-radius: 50%; border: none; font-size: 14px; display: grid; place-items: center; }
.friend-req-accept { background: var(--success-soft); color: var(--success); }
.friend-req-decline { background: var(--danger-soft); color: var(--danger); }

.leaderboard-row.is-me { background: var(--accent-soft); margin: 0 -12px; padding: 12px; border-radius: var(--radius-sm); border-bottom-color: transparent; }
.leaderboard-rank {
  width: 32px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 750;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.leaderboard-row:nth-child(1) .leaderboard-rank { color: var(--accent-text); }

.notif-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); position: relative; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-soft); margin: 0 -20px; padding: 13px 20px; border-bottom-color: transparent; }
.notif-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--input);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.notif-text { font-size: 14px; line-height: 1.4; }
.notif-time { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ==========================================================================
   Achievements
   ========================================================================== */
.achievements-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.achievement-badge { background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 8px; text-align: center; }
.achievement-badge.locked { opacity: 0.45; filter: grayscale(0.7); }
.achievement-badge.unlocked { border-color: var(--accent); background: var(--accent-soft); }
.achievement-emoji { font-size: 26px; margin-bottom: 4px; }
.achievement-name { font-size: 11px; font-weight: 650; line-height: 1.25; }
.achievement-progress { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; }

.achievements-list { display: flex; flex-direction: column; gap: 10px; }
.achievement-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.achievement-row.locked .achievement-row-icon { background: var(--input); color: var(--text-dim); }
.achievement-row.locked .achievement-row-name { color: var(--text-dim); }
.achievement-row.unlocked { border-color: transparent; background: var(--accent-soft); }
.achievement-row-icon {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  position: relative;
}
.achievement-row-icon .icon-mask { width: 22px !important; height: 22px !important; }
.achievement-row-main { flex: 1; min-width: 0; }
.achievement-row-name { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.achievement-row-desc { font-size: 13px; color: var(--text-dim); margin-top: 2px; line-height: 1.4; }
.achievement-row-progress { font-size: 12px; color: var(--text-dim); margin-top: 8px; font-variant-numeric: tabular-nums; }
.achievement-row-bar { height: 6px; border-radius: 999px; background: var(--input); margin-top: 5px; overflow: hidden; }
.achievement-row-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.achievement-row-check { font-size: 18px; flex-shrink: 0; color: var(--accent-text); }

.game-card-active { border-color: var(--accent) !important; background: var(--accent-soft) !important; }
#game-active-card-value { font-family: var(--font-display); }

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.settings-account-label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; overflow: hidden; cursor: pointer; }
.settings-account-label .icon-mask { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-dim); }
.settings-account-label svg { width: 20px; height: 20px; flex-shrink: 0; }
.settings-account-title { font-weight: 600; font-size: 14.5px; }
.settings-account-sub { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-account-sub.expanded { white-space: normal; word-break: break-all; overflow: visible; text-overflow: unset; }
.settings-account-row .btn { flex-shrink: 0; margin-left: 8px; width: auto; }

.settings-email-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
}
.settings-email-banner .icon-mask { width: 22px; height: 22px; flex-shrink: 0; color: var(--accent-text); }
.settings-email-banner > div { flex: 1 1 180px; min-width: 0; }
.settings-email-banner .btn { flex: 1 1 100%; }

.theme-select-row { margin-bottom: 18px; }

/* ==========================================================================
   Guest flow
   ========================================================================== */
.account-gate, .guest-locked-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  margin-bottom: 14px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.account-gate-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.account-gate h3 { font-size: 20px; line-height: 1.2; margin: 4px 0 0; }
.account-gate > p, .account-gate-sub { font-size: 14px; line-height: 1.5; color: var(--text-dim); margin: 0; }
.account-gate-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; }
.account-gate-losses { display: flex; flex-direction: column; gap: 0; margin-bottom: 4px; }
.account-gate .btn-block + .btn-block { margin-top: 0; }

.guest-welcome { display: flex; align-items: center; gap: 14px; padding: 4px 0 14px; }
.guest-welcome-avatar {
  width: 52px; height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 750;
}
.guest-welcome-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guest-welcome-name { font-family: var(--font-display); font-size: 19px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-welcome-sub { font-size: 13px; color: var(--text-dim); line-height: 1.45; }

.guest-loss-list { display: flex; flex-direction: column; gap: 0; margin: 0 0 12px; }
.guest-loss-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.guest-loss-item:last-child { border-bottom: none; }
.guest-loss-item-content { display: flex; flex-direction: column; gap: 1px; }
.guest-loss-group { padding: 12px 0; border-top: 1px solid var(--border); }
.guest-loss-group:first-child { border-top: none; padding-top: 4px; }
.guest-loss-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.guest-loss-title .icon-mask { color: var(--danger); }
.guest-loss-desc { font-size: 13px; color: var(--text-dim); line-height: 1.45; }
.guest-loss-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.guest-loss-items li { position: relative; padding-left: 14px; font-size: 13px; line-height: 1.45; color: var(--text-dim); }
.guest-loss-items li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.guest-loss-footnote { margin: 10px 0 2px; color: var(--text-dim); font-size: 13px; line-height: 1.5; text-align: center; }

.guest-locked-head { display: flex; align-items: flex-start; gap: 10px; }
.guest-locked-title { font-size: 15px; font-weight: 650; }
.guest-locked-sub { font-size: 13px; color: var(--text-dim); line-height: 1.45; margin-top: 2px; }

.guest-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  background: var(--accent-soft);
  color: var(--accent-text);
  vertical-align: middle;
}

/* ==========================================================================
   QR
   ========================================================================== */
#qr-show-canvas { border-radius: var(--radius-lg) !important; box-shadow: var(--shadow); }
#qr-show-canvas canvas { display: block; border-radius: 12px; }
#qr-scan-frame { border-radius: 18px; box-shadow: 0 0 0 3px var(--accent); margin: 28px; opacity: 0.9; }
#qr-scan-video { transform: scaleX(-1); }
#sheet-qr-scan { background: #000; }
#sheet-qr-scan .sheet-handle { background: rgba(255, 255, 255, 0.3); }

/* ==========================================================================
   Camera
   ========================================================================== */
.sheet-camera { background: #000; border: none; border-radius: 0; z-index: 200; }
.sheet.sheet-camera { max-height: 100vh; max-height: 100dvh; height: 100dvh; }
@media (min-width: 640px) { .sheet.sheet-camera { max-width: none; } }

#camera-stage { position: relative; width: 100%; height: 100vh; height: 100dvh; background: #000; overflow: hidden; }
#camera-video, #camera-preview-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; pointer-events: none; }
#camera-video.mirrored, #camera-pip-img.mirrored { transform: scaleX(-1); }
#camera-video.fit-contain { object-fit: contain; }
#camera-canvas { display: none; }
#camera-review-pip { bottom: 140px; z-index: 8; }

#camera-pip-wrap {
  position: absolute;
  left: 14px;
  top: calc(84px + var(--safe-top));
  width: 96px; height: 128px;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 5;
}
#camera-pip-img { position: static; width: 100%; height: 100%; object-fit: cover; }

#camera-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
}
#camera-top-bar .icon-btn { background: rgba(20, 20, 20, 0.55); border-color: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: none; }
.camera-mode-segmented { flex: 0 0 auto; background: rgba(20, 20, 20, 0.55); backdrop-filter: blur(8px); }
.camera-mode-segmented button { padding: 8px 18px; font-size: 14px; min-width: 76px; color: rgba(255, 255, 255, 0.7); }
.camera-mode-segmented button.active { background: #fff; color: #111; }

#camera-dual-row { position: absolute; left: 16px; right: 16px; bottom: 136px; z-index: 6; }
#camera-dual-row.hidden { display: none; }
#camera-dual-row .camera-dual-toggle-row {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
}
#camera-dual-row .switch-row-sub { color: rgba(255, 255, 255, 0.65); }

#camera-status {
  position: absolute;
  top: calc(72px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(236, 95, 86, 0.92);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
#camera-status .rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: recPulse 1s infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

#camera-bottom-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  padding: 20px 24px calc(28px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
#btn-camera-shutter {
  position: relative;
  z-index: 7;
  width: 78px; height: 78px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}
#camera-shutter-inner { width: 60px; height: 60px; border-radius: 50%; background: #fff; transition: all 0.15s var(--ease); }
#btn-camera-shutter.is-recording { border-color: var(--danger); background: rgba(236, 95, 86, 0.2); }
#btn-camera-shutter.is-recording #camera-shutter-inner { width: 30px; height: 30px; border-radius: 6px; background: var(--danger); }
#camera-bottom-bar .btn { flex-shrink: 0; z-index: 7; }
#btn-camera-retake, #btn-camera-use { position: static; z-index: 7; flex: 1; max-width: 130px; }
#btn-camera-retake { margin-left: auto; }
#btn-camera-use { margin-right: auto; }

/* ==========================================================================
   Photo viewer
   ========================================================================== */
.photo-viewer-backdrop { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.95); }
.photo-viewer-backdrop.active { display: block; }
.photo-viewer-modal { display: none; position: fixed; inset: 0; z-index: 1001; background: #000; justify-content: center; align-items: center; flex-direction: column; }
.photo-viewer-modal.active { display: flex; }
.photo-viewer-container { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#photo-viewer-media { max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; }
#photo-viewer-media img, #photo-viewer-media video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.photo-viewer-close {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 16px;
  z-index: 1002;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-viewer-close:active { background: rgba(255, 255, 255, 0.35); }

/* ==========================================================================
   Toast
   ========================================================================== */
#toast {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 50%;
  z-index: 300;
  width: max-content;
  max-width: min(88vw, 420px);
  transform: translateX(-50%) translateY(-16px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Cookie consent
   ========================================================================== */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 900;
  padding: 0 12px calc(12px + var(--safe-bottom));
  animation: cookieUp 0.4s var(--ease);
}
@keyframes cookieUp { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.cookie-banner-inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.cookie-banner-text { margin: 0 0 14px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.cookie-banner-actions { display: flex; gap: 8px; }
.cookie-banner-actions .btn { flex: 1; font-size: 13px; padding: 10px 0; }

.cookie-modal { position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; padding: 20px; }
.cookie-modal-backdrop { position: absolute; inset: 0; background: rgba(6, 10, 8, 0.6); backdrop-filter: blur(6px); }
.cookie-modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: cookieIn 0.28s var(--ease);
}
@keyframes cookieIn { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
.cookie-modal-card h3 { margin: 0 0 6px; font-size: 22px; font-weight: 750; }
.cookie-modal-desc { margin: 0 0 14px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.cookie-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cookie-option:last-of-type { border-bottom: none; }
.cookie-option-title { font-size: 14.5px; font-weight: 600; }
.cookie-option-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.cookie-modal-actions { margin-top: 18px; }

/* ==========================================================================
   Profile page: centred identity, one row of numbers, then streaks
   ========================================================================== */
#profile-sheet-body { position: relative; }
#profile-sheet-body .profile-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin: 4px 0 22px;
}
#profile-sheet-body .profile-header > div[style*="flex:1"] { width: 100%; }
#profile-sheet-body .profile-name { justify-content: center; font-size: 28px; flex-wrap: wrap; gap: 6px; white-space: normal; }
#profile-sheet-body .profile-sub { white-space: normal; }
#profile-sheet-body .avatar.lg { width: 96px; height: 96px; font-size: 36px; box-shadow: none; background: var(--accent); color: var(--accent-ink); }
#profile-sheet-body .profile-header { position: relative; }
#profile-sheet-body #btn-open-settings { position: absolute; top: 0; right: 0; }
#profile-sheet-body .profile-header > .btn { min-width: 160px; }

#profile-sheet-body .stats-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
#profile-sheet-body .stat-card,
#profile-sheet-body .stats-grid > .stat-card:first-child {
  background: none;
  border: none;
  border-radius: 0;
  padding: 16px 4px 14px;
  text-align: center;
}
#profile-sheet-body .stat-card + .stat-card { border-left: 1px solid var(--border); }
#profile-sheet-body .stat-value,
#profile-sheet-body .stats-grid > .stat-card:first-child .stat-value { font-size: 24px; color: var(--text); }
#profile-sheet-body .stats-grid > .stat-card:first-child .stat-label { color: var(--text-dim); }
#profile-sheet-body .stat-label { font-size: 11.5px; line-height: 1.25; }
#profile-sheet-body .stat-clickable:hover { background: var(--card-alt); }
/* Second row (streaks) reads as the amber row */
#profile-sheet-body .stats-grid + .stats-grid { background: var(--accent-soft); border-color: transparent; margin-bottom: 20px; }
#profile-sheet-body .stats-grid + .stats-grid .stat-card + .stat-card { border-left-color: rgba(217, 74, 100, 0.25); }
#profile-sheet-body .stats-grid + .stats-grid .stat-value { color: var(--accent-text); }
#profile-sheet-body > .card { background: var(--card); border-radius: var(--radius-lg); }

/* ==========================================================================
   Settings: grouped lists
   ========================================================================== */
.search-pill-text { overflow: hidden; text-overflow: ellipsis; }

.set-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-dim);
  margin: 24px 4px 8px;
}
.set-group {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.set-group-pad { padding: 14px; }
.set-group-end { margin-top: 28px; }

.set-row,
.set-group .settings-account-row,
.set-group .switch-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 0;
  padding: 12px 14px;
  background: none;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}
.set-group > .set-row:last-child,
.set-group > .settings-account-row:last-child,
.set-group > .switch-row:last-child { border-bottom: none; }
button.set-row:hover, a.set-row:hover { background: var(--input); }
.set-row-text { flex: 1; min-width: 0; }
.set-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 15px;
}
.set-chevron { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }
.set-row-danger { justify-content: center; color: var(--danger); font-weight: 600; }
.set-group .settings-account-label .icon-mask { color: var(--text); opacity: 1; width: auto; height: auto; }
.set-group .display-badge-preview,
.set-group .badge-picker { border: none; background: var(--card); }
.set-group .badge-picker { margin-bottom: 0; }
#settings-guest-block .guest-loss-list { margin-bottom: 14px; }

/* ---- Equipped badge under the name, and tap-to-equip badges ---- */
.profile-equipped {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}
.profile-equipped-ring {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.profile-equipped-name { color: var(--text); font-size: 13.5px; font-weight: 650; }

.badge-equip {
  border: 2px solid transparent;
  background: var(--card-alt);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.12s var(--ease);
}
.badge-equip:active { transform: scale(0.92); }
.badge-equip.equipped { border-color: currentColor; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px currentColor; }
.badge-chip { border-radius: 50%; }
.badge-row .badge-chip { width: 46px; height: 46px; border: 2px solid currentColor; background: var(--card-alt); }
.badge-row .badge-equip:not(.equipped) { border-color: var(--border); }

/* Lens switch on the camera (phones with several back lenses) */
.camera-lens-btn {
  position: absolute;
  top: calc(76px + var(--safe-top));
  right: 16px;
  z-index: 7;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}

/* ==========================================================================
   Age / terms confirmation
   ========================================================================== */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-dim);
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}
.check-row strong { color: var(--text); }

/* ==========================================================================
   Full-screen notices: terms gate, ban, downtime
   ========================================================================== */
.full-notice {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  overflow-y: auto;
  background: var(--bg);
}
#maintenance-overlay { z-index: 1250; }
#ban-screen { z-index: 1300; }
.full-notice-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 22px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.full-notice-card h2 { font-size: 26px; line-height: 1.15; margin: 0 0 12px; }
.full-notice-card p { margin: 0 0 12px; color: var(--text-dim); line-height: 1.5; }
.full-notice-card blockquote {
  margin: 0 0 12px;
  padding: 10px 14px;
  text-align: left;
  color: var(--text);
  background: var(--card-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow-wrap: anywhere;
}
.full-notice-card .check-row { text-align: left; }
.full-notice-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 24px;
}
.badge-bad { background: var(--danger-soft); color: var(--danger); }

/* ==========================================================================
   Drunk mode (more than 10 beers today): soft focus and a slow sway of the map view.
   Slow and small on purpose (nothing flashes), static with reduced motion, and the
   forms and camera stay sharp so nothing becomes hard to use.
   ========================================================================== */
html[data-drunk] body, html[data-hang] body { filter: var(--fx-warp, blur(0px)) blur(var(--drunk-blur, 0px)) hue-rotate(var(--drunk-hue, 0deg)); }
/* Hangover: brightness and contrast pulse like slow breathing; --hang (0-1) sets how hard */
html[data-hang]:not([data-nobreathe]) body { animation: hang-breathe var(--hang-speed, 5s) ease-in-out infinite; }
@keyframes hang-breathe {
  0%, 100% { filter: var(--fx-warp, blur(0px)) blur(var(--drunk-blur, 0px)) hue-rotate(var(--drunk-hue, 0deg)) brightness(calc(1 + var(--hang, 0) * 0.12)) contrast(calc(1 - var(--hang, 0) * 0.3)); }
  50% { filter: var(--fx-warp, blur(0px)) blur(var(--drunk-blur, 0px)) hue-rotate(var(--drunk-hue, 0deg)) brightness(calc(1 - var(--hang, 0) * 0.35)) contrast(calc(1 + var(--hang, 0) * 0.3)); }
}
#app.hang-jitter { animation: hang-jitter 0.4s steps(1, end) 1; }
@keyframes hang-jitter {
  0% { transform: translate(calc(var(--hang, 0) * 6px), calc(var(--hang, 0) * -3px)); }
  25% { transform: translate(calc(var(--hang, 0) * -8px), calc(var(--hang, 0) * 2px)); }
  50% { transform: translate(calc(var(--hang, 0) * 5px), calc(var(--hang, 0) * 5px)); }
  75% { transform: translate(calc(var(--hang, 0) * -3px), calc(var(--hang, 0) * -4px)); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-hang] body { animation: none; }
  #app.hang-jitter { animation: none; }
}
#dbg-readout { font: 12px/1.5 ui-monospace, monospace; white-space: pre-wrap; background: var(--surface-2, rgba(128,128,128,.12)); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
#debug-fx-panel .dbg-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
#debug-fx-panel .dbg-row input[type=range] { flex: 1; }
#debug-fx-panel .dbg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
