/* Self-hosted fonts (SIL Open Font License 1.1, see /static/fonts/OFL-*.txt).
   Barlow Condensed (c) The Barlow Project Authors; Inter (c) The Inter Project Authors. */
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/barlow-condensed-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/inter-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/inter-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0d0f12;
  --surface: #161a20;
  --surface-2: #1e232b;
  --border: #2a313c;
  --text: #e8eaed;
  --text-muted: #8b939e;
  --accent: #e6392e;
  --accent-hover: #ff4d42;
  --accent-dim: rgba(230, 57, 46, 0.15);
  --success: #3dd68c;
  --radius: 10px;
  --font-display: "Barlow Condensed", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --header-height: 4.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body.filters-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

.hide-mobile {
  display: revert;
}

.hide-desktop {
  display: none !important;
}

.header {
  position: relative;
  z-index: 200;
  overflow: visible;
  isolation: isolate;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #12151a 0%, var(--bg) 100%);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.sync-pill {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#user-greeting {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.account-menu {
  display: inline-block;
  max-width: 16rem;
}

.account-menu-summary {
  list-style: none;
  cursor: pointer;
}

.account-menu-summary::-webkit-details-marker,
.account-menu-summary::marker {
  display: none;
  content: "";
}

.account-menu-caret {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}

.account-menu-list {
  margin-top: 0.35rem;
  min-width: 12.5rem;
  padding: 0.35rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.account-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.account-menu-item:hover,
.account-menu-item:focus {
  background: var(--surface-2);
  outline: none;
}

.hash-panel {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
}

.hash-panel:target {
  display: block;
}

.hash-panel h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

.hash-panel p {
  color: var(--text-muted);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: -0.05em;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.hero-sub {
  color: var(--text-muted);
  margin-top: 0.5rem;
  max-width: 560px;
}

.location-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-top: 1.5rem;
}

.location-input-group {
  flex: 1;
  min-width: 240px;
}

.location-input-group label,
.filter-group > label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

input[type="date"] {
  color-scheme: dark;
  min-height: 2.75rem;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  display: block;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.2em;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
  opacity: 0.85;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-icon {
  min-width: 44px;
  padding: 0.65rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.status-text.error {
  color: #f87171;
}

.filter-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
  line-height: 1.35;
}

.filter-prominent {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

.main-content {
  min-width: 0;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.filters-scroll {
  padding-right: 0.15rem;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.filters h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.filter-count {
  color: var(--accent);
  margin-left: 0.35rem;
}

.filters-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
}

.mobile-toolbar {
  margin-bottom: 1rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0));
  z-index: 80;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.45rem 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 52px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.active {
  color: var(--accent);
}



.filter-group {
  margin-bottom: 1.25rem;
}

.filter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  margin-bottom: 0.4rem;
  text-align: left;
}

.filter-toggle:hover {
  color: var(--text);
}

.filter-toggle-icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: transform 0.2s ease;
}
.filter-toggle-icon svg,
.account-menu-caret svg {
  display: block;
}

.filter-toggle[aria-expanded="false"] .filter-toggle-icon {
  transform: rotate(-90deg);
}

.filter-collapse-panel.collapsed {
  display: none;
}

.filter-collapsible .checkbox-grid-scroll {
  max-height: none;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-value {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 6.25rem;
  text-align: right;
  white-space: nowrap;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.checkbox-grid-scroll {
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.45rem 0.5rem;
}

.filter-collapsible .checkbox-grid-scroll {
  max-height: 14rem;
}

.filter-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.35rem 0.15rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.checkbox-item input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.checkbox-select-all {
  font-weight: 600;
  color: var(--text);
  padding: 0.35rem 0.15rem 0.45rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.checkbox-select-all span {
  letter-spacing: 0.01em;
}

.cost-row,
.date-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.cost-row > div,
.date-row > div {
  flex: 1;
}

.date-row input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.65rem;
  font-size: 0.9rem;
}

/* Date inputs have a wide intrinsic size: let From/To wrap onto two rows in the
   280px desktop sidebar and sit side by side in the wider phone drawer. */
.date-row {
  flex-wrap: wrap;
}

.date-row > div {
  flex: 1 1 7.75rem;
  min-width: 0;
}

.date-row .cost-sep {
  display: none;
}

.cost-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.cost-sep {
  color: var(--text-muted);
  padding-bottom: 0.7rem;
}

.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.results-header-main {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.results-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.results-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-select {
  min-width: 11.5rem;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b939e' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  transition: border-color 0.15s;
}

.event-card:hover {
  border-color: #3d4654;
}

.event-card-main h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-type {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-org {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.event-venue {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.event-date {
  font-size: 0.875rem;
  margin-top: 0.35rem;
}

.event-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.event-card-side {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 130px;
}

.event-distance {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.event-distance span {
  font-size: 0.85rem;
  font-weight: 600;
}

.event-cost {
  font-weight: 600;
  font-size: 1.1rem;
}

.event-price-tiers {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: right;
}

.price-tier {
  white-space: nowrap;
}

.price-tier-common {
  color: var(--text);
  font-weight: 600;
}

.price-tbd {
  color: var(--text-muted);
  font-style: italic;
}

.event-cost-tbd {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.price-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: normal;
  max-width: 11rem;
  margin-left: auto;
}

.event-spots {
  font-size: 0.75rem;
  color: var(--success);
}

.event-spots.low {
  color: #fbbf24;
}

.event-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
  padding: 0.45rem 0.85rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.event-link:hover {
  background: var(--accent);
  color: #fff;
}

.event-source {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.save-btn {
  margin-top: 0.25rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.save-btn.saved {
  border-color: var(--success);
  color: var(--success);
}

.save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.card-action svg {
  display: block;
  flex-shrink: 0;
  color: var(--text-muted);
}

.card-action:hover,
.card-action:focus-visible {
  border-color: var(--text-muted);
  outline: none;
}

.card-action:disabled {
  opacity: 0.55;
  cursor: progress;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 1rem);
  max-width: min(92vw, 26rem);
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 400;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.offscreen {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
}

.auth-dialog {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.5rem;
  width: min(400px, 92vw);
}

.dialog-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.dialog-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.dialog-close:hover,
.dialog-close:focus-visible {
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

.auth-form label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}

.form-error {
  color: #f87171;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.empty-state,
.loading-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: var(--text-muted);
  opacity: 0.85;
}
.empty-icon svg {
  display: block;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-links {
  margin-top: 0.4rem;
}

.footer-links a {
  color: var(--text-muted);
}

.legal-page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.legal-page h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 1rem 0 0.5rem;
}

.legal-page h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 1.5rem 0 0.5rem;
}

.legal-page p,
.legal-page li {
  color: var(--text-muted);
}

.legal-page ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.legal-page a {
  color: var(--accent);
}

@media (min-width: 861px) {
  .filters {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .filters::-webkit-scrollbar {
    width: 6px;
  }

  .filters::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
  }
}

@media (max-width: 860px) {
  .hide-mobile {
    display: none !important;
  }

  .bottom-nav.hide-desktop {
    display: flex !important;
  }

  .mobile-toolbar.hide-desktop {
    display: block !important;
  }


  #filters-close.hide-desktop {
    display: inline-flex !important;
  }

  .filters-backdrop.hide-desktop:not([hidden]) {
    display: block !important;
  }

  .header-inner {
    padding: 0.85rem 1rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0));
    align-items: flex-start;
  }

  .header-actions {
    gap: 0.35rem;
    flex: 1 1 auto;
    justify-content: flex-end;
    max-width: 100%;
  }

  .header-actions .btn-sm,
  .header-actions .account-menu-summary {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }

  /* Saved lives in the bottom nav on phones when signed in */
  #saved-btn {
    display: none !important;
  }

  .logo-text {
    font-size: 1.45rem;
  }

  .main {
    padding: 1.25rem 1rem 5.5rem;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .main-content {
    grid-row: 1;
  }

  .filters {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 92vw);
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 100;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: 0;
  }

  .filters-header {
    flex-shrink: 0;
  }

  .filters-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
  }

  .filters.open {
    transform: translateX(0);
  }

  /* Drawer + backdrop sit above the header (z-index 200) so the Filters title
     and Done button are never covered; the header is dimmed and inert while open. */
  .filters {
    z-index: 310;
  }

  .filters-backdrop {
    z-index: 300;
  }

  body.filters-open .header {
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.2s ease;
  }

  input[type="date"] {
    font-size: 16px;
  }

  .event-desc {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .event-actions {
    justify-content: flex-start;
    width: 100%;
    order: 10; /* phones: Save + View event on one row, Share / Add to Calendar below */
  }

  .filters-header {
    padding-top: 0.75rem;
  }

  .card-action {
    min-height: 44px;
  }

  .location-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-search {
    width: 100%;
  }

  .input-row {
    flex-direction: row;
  }

  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  .sort-select {
    font-size: 16px;
  }

  .sort-control {
    width: 100%;
  }

  .sort-select {
    flex: 1;
    min-width: 0;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .event-card-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    text-align: left;
    gap: 0.65rem;
  }

  .event-link,
  .save-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .auth-dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
  }
}
/* Homepage flourish - one-shot muted intro; never loop */
.flourish-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.flourish-overlay.is-done {
  display: none;
}
body.flourish-lock {
  overflow: hidden;
}
.flourish-video {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  object-fit: cover;
  background: #0a0a0a;
}
@media (min-width: 900px) {
  .flourish-video {
    object-fit: contain; /* letterbox portrait on desktop */
  }
}
.flourish-skip {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 10001;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font: 600 14px/1 Inter, system-ui, sans-serif;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.flourish-skip:hover,
.flourish-skip:focus-visible {
  background: rgba(0,0,0,0.75);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.flourish-sound {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10001;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font: 600 14px/1 Inter, system-ui, sans-serif;
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.flourish-sound:hover,
.flourish-sound:focus-visible {
  background: rgba(0,0,0,0.8);
  outline: 2px solid #fff;
  outline-offset: 2px;
}


/* iOS store shell, build 1 only (capacitor ios.contentInset "automatic"): WKWebView
   already insets the content, so zero the CSS safe-area padding to avoid a double inset.
   Build 2+ (contentInset "never") gets html.native-insets from app.js (it has the
   Capacitor Browser plugin) and is excluded here, so it keeps the env() padding. */
html.store-client:not(.native-insets) body {
  padding-bottom: 0;
}
html.store-client:not(.native-insets) .header-inner {
  padding-top: 0.85rem;
}
html.store-client:not(.native-insets) .bottom-nav {
  padding-bottom: 0.35rem;
}
html.store-client:not(.native-insets) .filters {
  padding-top: 0;
}
html.store-client:not(.native-insets) .filters-scroll {
  padding-bottom: 1.25rem;
}
html.store-client:not(.native-insets) .auth-dialog {
  padding-bottom: 1.5rem;
}
html.store-client:not(.native-insets) .flourish-overlay {
  padding: 0;
}
html.store-client:not(.native-insets) .flourish-skip {
  top: 12px;
  right: 12px;
}
html.store-client:not(.native-insets) .flourish-sound {
  bottom: 20px;
}

/* iOS store shell, build 2+ (contentInset "never"): the WebView runs edge to edge
   under the notch / status bar / home indicator, so pad with the safe-area insets.
   Browsers never get .native-insets, so their behaviour is unchanged. */
html.store-client.native-insets .header-inner {
  padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
}
html.store-client.native-insets .main,
html.store-client.native-insets .footer {
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
}
html.store-client.native-insets .bottom-nav {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
@media (max-width: 860px) {
  html.store-client.native-insets .header-inner {
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }
  html.store-client.native-insets .main {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }
  html.store-client.native-insets .filters {
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  }
}

/* Avoid nested scroll trapping inside the filter drawer in the iOS app */
html.store-client .checkbox-grid-scroll,
html.store-client .filter-collapsible .checkbox-grid-scroll {
  max-height: none;
  overflow: visible;
}

.footer-credit {
  margin-top: 0.4rem;
  font-size: 0.75rem;
}

.footer-credit a {
  color: var(--text-muted);
}

.account-menu-credit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* v43: legal pages (Terms, Privacy) */
.legal-page .legal-back { margin: 0 0 0.5rem; }
.legal-page h3 { font-size: 1.05rem; margin: 1.25rem 0 0.4rem; }
.legal-page ol { padding-left: 1.4rem; margin: 0.5rem 0 1rem; }
.legal-page li { margin: 0.25rem 0; }
.legal-page strong { color: var(--text); }
.legal-page .legal-callout {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}
.legal-page .legal-callout p { margin: 0.4rem 0; }
.legal-page .legal-table-wrap { overflow-x: auto; margin: 0.75rem 0 1.25rem; }
.legal-page table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.legal-page th, .legal-page td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
.legal-page th { color: var(--text); font-weight: 600; }
.legal-page .legal-draft-note {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
}
.legal-page .legal-footer-links { margin-top: 2.5rem; font-size: 0.9rem; }
.legal-page .legal-draft-note p { margin: 0.3rem 0; }

/* v47: organizer submission form (/submit) and admin review (/admin/review) */
.submit-page { max-width: 42rem; }
.submit-tabs { display: flex; gap: 0.5rem; margin: 1.5rem 0 1rem; flex-wrap: wrap; }
.submit-tab {
  flex: 1 1 12rem;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.submit-tab.active { border-color: var(--accent); color: var(--text); background: rgba(255, 255, 255, 0.04); }
.submit-form label { display: block; margin-bottom: 0.9rem; font-size: 0.85rem; color: var(--text-muted); }
.submit-form label > input,
.submit-form label > select { display: block; width: 100%; margin-top: 0.35rem; }
.submit-form input[type="email"],
.submit-form input[type="url"],
.submit-form select,
.admin-review input[type="password"],
.admin-review input[type="email"],
.admin-review select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 2.75rem;
}
.submit-form select:focus { outline: none; border-color: var(--accent); }
.submit-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.submit-row > label { flex: 1 1 10rem; }
.submit-hint { color: var(--text-muted); font-size: 0.75rem; }
.submit-contact { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem 0.1rem; margin: 0.5rem 0 1rem; }
.submit-contact legend { padding: 0 0.35rem; font-size: 0.85rem; color: var(--text); }
.submit-form label.submit-check { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.9rem; color: var(--text); }
.submit-check input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; flex: 0 0 auto; accent-color: var(--accent); }
.submit-ok { color: #4ade80; font-size: 0.9rem; margin-bottom: 0.75rem; }
.submit-note { font-size: 0.9rem; margin-bottom: 0.75rem; }
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.admin-review { max-width: 60rem; }
.admin-review .admin-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.75rem 0; }
.admin-review .admin-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem; margin: 0.5rem 0; font-size: 0.85rem; }
.admin-review .admin-card dt { color: var(--text-muted); }
.admin-review .admin-card dd { margin: 0; color: var(--text); word-break: break-word; }
.admin-review .admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-review .admin-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; margin: 1rem 0; }
.admin-review .admin-toolbar > * { flex: 1 1 12rem; }
