[hidden] { display: none !important; }
button:disabled { cursor: default; }
input[type=search], select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white); min-width: 0; }

#status { color: var(--muted); padding: 32px 20px; margin: 0; }
#status.error { color: var(--error); }

/* Setup help (shown when Supabase is unreachable) */
#setup-help { max-width: 760px; margin: 20px auto; border: 1px solid #e6b800; background: #fffbea; border-radius: 8px; padding: 14px 16px; }
#setup-help h2 { font-size: 1.1rem; margin: 0 0 6px; }
#setup-help ol { margin: 8px 0; padding-left: 20px; }
#setup-help code { background: #f3f3f3; padding: 1px 4px; border-radius: 4px; font-size: 0.9em; }
#setup-help .detail { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; word-break: break-word; }

/* Shared pieces */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.meta { color: var(--muted); font-size: 13px; margin: 2px 0 0; overflow-wrap: anywhere; }
.chk { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.chk input { margin: 4px 0 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; display: inline-flex; gap: 6px; align-items: center; }
.pill[aria-pressed=true] { border-color: var(--primary-blue); background: var(--accent-soft); color: var(--primary-blue); }
.pill:disabled { opacity: .4; }
.pill .count { margin-left: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--primary-blue); color: #fff; }
.plain { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; }

/* Location box */
.place { position: relative; display: flex; gap: 6px; }
.place input { flex: 1; }
.place .me { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0 12px; font-size: 18px; }
.sugg { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; list-style: none; margin: 2px 0 0; padding: 4px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.sugg li { padding: 7px 10px; cursor: pointer; }
.sugg li:hover, .sugg li[aria-selected=true] { background: var(--accent-soft); color: var(--primary-blue); }
.place-note { min-height: 1.2em; }

/* Question steps */
.wrap { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
.progress { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin: 0; font-weight: 600; }
.wrap h1 { font-family: var(--font-display); font-size: 26px; line-height: 1.2; margin: 6px 0 4px; color: var(--primary-blue); letter-spacing: -0.02em; }
.wrap h2 { font-size: 15px; margin: 22px 0 8px; color: var(--primary-blue); }
.sub { color: var(--muted); margin: 0 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.tile { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; display: flex; gap: 8px; align-items: center; }
.tile[aria-pressed=true] { border-color: var(--primary-blue); background: var(--accent-soft); }
.tile:disabled { opacity: .4; }
.tile .count-open { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pick-map { height: 300px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 28px; }
.nav button { padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid var(--line); background: #fff; }
.nav .go { background: var(--gradient-primary); color: #fff; border-color: transparent; font-weight: 600; box-shadow: var(--shadow-md); }

/* Results */
.res-head { padding: 14px 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.res-top { display: flex; gap: 12px; align-items: flex-start; }
.res-top .plain { white-space: nowrap; }
.sentence { font-size: 20px; margin: 0; line-height: 1.35; flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--primary-blue); }
.link { border: 0; background: none; padding: 0; color: var(--primary-blue); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 4px; text-align: left; }
.res-tools { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.res-where { display: flex; gap: 6px; flex: 1 1 340px; max-width: 480px; min-width: 0; }
.res-where > div { flex: 1; min-width: 0; }
.res-where select { align-self: flex-start; }
.res-tools > input[type=search] { flex: 1 1 200px; max-width: 300px; }
.res-list { padding: 12px 16px 48px; }
.res-list section { max-width: 820px; margin: 0 auto; }
.res-list h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 8px; }
.res-map { height: 70vh; min-height: 360px; }
.empty { color: var(--muted); }
.more { margin: 4px 0 8px; }
.map-missing { padding: 20px; color: var(--muted); }

/* Cards */
.cards { list-style: none; margin: 0; padding: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--primary-blue); }
.card-head { display: flex; gap: 8px; align-items: baseline; }
.card-head strong { flex: 1; overflow-wrap: anywhere; }
.dist { color: var(--primary-blue); font-size: 13px; white-space: nowrap; font-weight: 600; }
.dist.remote { color: var(--primary-orange); }
.desc { margin: 6px 0 0; font-size: 14px; }
.tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.tags:empty { display: none; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #f0efed; display: inline-flex; gap: 5px; align-items: center; }
.tag .dot { width: 8px; height: 8px; }
.tag.who { background: var(--who); }
.tag.who.made-for { font-weight: 600; box-shadow: inset 0 0 0 1px currentColor; }
.tag.who.open { background: #f0efed; }
.preview-note { margin: 8px auto; max-width: 900px; padding: 6px 12px; border-radius: var(--radius-md); background: #fff4d6; color: #5c4300; font-size: 13px; }
.tag.lang { background: var(--lang); }
.on-map { color: var(--primary-blue); font-size: 13px; margin-top: 6px; }
.maplibregl-popup-content { padding: 10px 12px; max-height: min(320px, 50vh); overflow: auto; font: 14px/1.4 var(--font-primary); }
.maplibregl-popup-content > .card-head { padding-right: 16px; }
.popup-head { font-weight: 600; margin-bottom: 4px; padding-right: 14px; }
.popup-item { border-top: 1px solid var(--line); padding: 8px 0; }

/* Desktop: the results header stays put and the list or map fills the rest of the window. */
@media (min-width: 760px) {
  body:has(.res) { height: 100vh; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
  body:has(.res) #app { flex: 1; min-height: 0; }
  .res { height: 100%; display: flex; flex-direction: column; }
  .res-body { flex: 1; min-height: 0; position: relative; }
  .res-list { position: absolute; inset: 0; overflow-y: auto; }
  .res-map { position: absolute; inset: 0; height: auto; }
}
@media (max-width: 759px) {
  .wrap h1 { font-size: 22px; }
  .sentence { font-size: 17px; }
  .res-where { flex-basis: 100%; max-width: none; }
  .res-tools > input[type=search] { max-width: none; flex-basis: 150px; }
  .res-head { padding: 12px 12px 10px; }
}
