/* Market keeps discovery in the normal page flow, with the map as context. */
:root, [data-theme="light"] {
  color-scheme: only light;
  --color-bg: #f6f9f6;
  --color-surface: #ffffff;
  --color-surface-glass: #ffffff;
  --color-surface-glass-subtle: #f6f9f6;
  --color-surface-offset: #eaf2ec;
  --color-surface-offset-2: #dfefe4;
  --color-surface-dynamic: #cee2d5;
  --color-border: #dce5de;
  --color-border-subtle: #e3ebe5;
  --color-divider: #dce5de;
  --color-text: #173c32;
  --color-text-secondary: #52675e;
  --color-text-muted: #52675e;
  --color-text-faint: #52675e;
  --color-primary: #17533e;
  --color-primary-hover: #124431;
  --color-primary-active: #103d2c;
  --color-primary-tint: #dfefe4;
  --color-primary-highlight: #c4dfcf;
  --color-primary-solid: #17533e;
  --color-primary-solid-hover: #124431;
  --color-on-primary: #ffffff;
  --color-sage: #25623d;
  --color-sage-tint: #dfefe4;
  --font-sans: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Boska", Georgia, serif;
}

html, body { height: auto; min-height: 100%; overflow: visible; }
body { font-size: 16px; }
.app-shell { height: auto; min-height: 100dvh; width: 100%; overflow: visible; }
[hidden], .hidden, dialog:not([open]) { display: none !important; }
button, summary, select { touch-action: manipulation; }
button svg { flex-shrink: 0; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }

.topbar { height: 86px; background: #fff; backdrop-filter: none; z-index: 30; }
.topbar-inner { max-width: 1440px; margin: auto; padding: 0 4%; }
.topbar-actions { gap: 22px; }
.market-nav { min-height: 44px; padding: 0 8px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; }
.market-nav svg { width: 17px; height: 17px; }
.market-nav.active { border-color: var(--color-primary); color: var(--color-primary); }
.market-nav:hover { background: var(--color-bg); }
.brand-lockup[data-logo-slot="full"] { display: inline-flex; }
.brand-lockup[data-logo-slot="compact"], .brand-lockup[data-logo-slot="icon"] { display: none; }
.logo-word { font-size: 27px; }
.market-page { width: 100%; max-width: 1440px; margin: auto; padding: 0 4% 64px; }

/* Keep both ways of setting a location visible, including on narrow phones. */
.market-location { position: relative; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--color-border); }
.market-location .location-pill-wrap { min-width: 0; flex: 1; }
.location-pill-btn { border: 0; background: none; box-shadow: none; border-radius: 8px; min-height: 48px; height: auto; padding: 5px 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px; gap: 1px 8px; text-align: left; white-space: normal; }
.location-pill-btn:hover { background: transparent; box-shadow: none; }
.location-caption { grid-column: 2; color: var(--color-text-secondary); font-size: 11px; font-weight: 400; }
.location-pill-btn > svg:not(.location-pill-chevron) { grid-column: 1; grid-row: 1 / 3; width: 20px; height: 20px; }
#locationPillLabel { grid-column: 2; grid-row: 2; max-width: none; white-space: normal; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; }
.location-pill-chevron { grid-column: 3; grid-row: 1 / 3; }
.market-geolocate { min-height: 44px; padding: 10px 16px; border-radius: 8px; background: var(--color-primary-tint); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.market-geolocate svg { width: 18px; height: 18px; }
.location-popover { width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 170px); overflow-y: auto; z-index: 40; }
.location-popover-input, .location-popover-go-btn, .location-popover-geo-btn, .location-popover-preset-btn { min-height: 44px; }

.market-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin: 36px 0 20px; }
.market-intro > div { min-width: 0; }
.market-intro h1 { font-family: var(--font-display); font-size: clamp(40px, 4.5vw, 64px); line-height: 1.05; font-weight: 600; letter-spacing: -.035em; }
.market-intro p { margin-top: 12px; color: var(--color-text-secondary); font-size: 15px; line-height: 1.5; }
.topbar-search-form { display: flex; flex: 0 1 430px; min-width: 280px; height: 56px; padding: 5px 6px 5px 16px; border-radius: 10px; box-shadow: none; }
.topbar-search-input { height: 44px; }
.search-submit-btn { height: 44px; border-radius: 7px; }
.market-filterbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; position: relative; z-index: 20; padding: 14px 0 24px; }
.filter-glass-pill, .filters-summary { min-height: 44px; height: auto; padding: 10px 15px; box-shadow: none; backdrop-filter: none; }
.filter-glass-pill > svg { width: 16px; height: 16px; }
.filters-disclosure { margin: 0; }
.filters-disclosure[open] > .filter-controls { width: 360px; max-width: calc(100vw - 32px); max-height: min(440px, 65dvh); overflow-y: auto; }
.filter-controls .filter-bar-group { gap: 8px; }
.segmented-chip-btn { min-height: 44px; min-width: 44px; }
#activeFilterChips { flex-wrap: wrap; }
.filter-chip-remove { min-height: 24px; min-width: 24px; }

.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 32px; overflow: visible; align-items: start; }
.sidebar { position: static; inset: auto; height: auto; min-width: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; z-index: auto; }
.sidebar-list-view { height: auto; display: block; }
.sidebar-header { padding: 0 0 24px; border: none; background: none; backdrop-filter: none; }
.sidebar-title { font-size: 24px; line-height: 1.2; }
.sidebar-title-group { align-items: center; }
.sidebar-header-top { align-items: center; flex-wrap: wrap; gap: 8px; }
.sidebar-subtitle { display: block; margin: 4px 0 16px; }
.sidebar-count-badge { font-size: 12px; padding: 4px 9px; }
.moment-chevron-btn { width: 44px; height: 44px; }
.moment-menu { z-index: 25; }
.moment-menu-item { min-height: 44px; }
.sidebar-controls-row { gap: 10px; flex-wrap: wrap; }
.sidebar-sort-select, .sidebar-filter-input { height: 44px; min-width: 0; }
.sidebar-sort-select { flex: 0 1 180px; }
.sidebar-filter-input { flex: 1 1 150px; }
.sidebar-filter-slot:empty { display: none; }
.filter-bar-note { padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; min-height: 0; }
.sidebar-list { padding: 0; overflow: visible; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 28px 22px; }
.sidebar-list > :not(.card) { grid-column: 1 / -1; }
.card { display: flex; flex-direction: column; gap: 0; min-width: 0; padding: 0; border: none; border-radius: 14px; background: none; box-shadow: none; }
.card:hover { box-shadow: none; transform: translateY(-3px); }
.card.card-highlighted { box-shadow: 0 0 0 3px var(--color-primary-highlight); background: #fff; }
.card-thumb-slot { width: 100%; height: auto; aspect-ratio: 1.32; border-radius: 14px; display: block; overflow: hidden; isolation: isolate; }
.card-thumb-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-thumb-fallback { background: #dfefe4; }
.card-thumb-fallback svg { width: 42px; height: 42px; }
.card-content { padding: 14px 0 3px; gap: 8px; }
.card-name { font-size: 19px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card-price { flex-shrink: 0; font-size: 13px; padding-top: 2px; }
.card-meta-line { gap: 5px; font-size: 13px; line-height: 1.6; }
.card-cuisine { overflow-wrap: anywhere; }
.card-fit-summary { font-size: 13px; line-height: 1.5; margin-top: 0; }
.card-tags-row { margin-top: 2px; gap: 5px; }
.vibe-tag { border-radius: 5px; padding: 4px 7px; }
.card-bookmark-btn { top: 10px; right: 10px; width: 44px; height: 44px; color: var(--color-primary); background: #fff; box-shadow: 0 2px 8px #173c321a; z-index: 3; }
.card-bookmark-btn::before { inset: 0; }
.card-bookmark-btn svg { width: 19px; height: 19px; }
.card-bookmark-btn.bookmarked { background: var(--color-primary); color: white; }
.card-bookmark-btn.bookmarked svg { fill: currentColor; }
.tiktok-hint { font-size: 13px; line-height: 1.5; color: var(--color-text-secondary); margin: 6px 0; }
.tiktok-links .detail-action-btn { min-height: 44px; height: auto; padding: 10px; overflow-wrap: anywhere; text-align: center; }
.tiktok-links > :only-child { grid-column: 1 / -1; }
.tiktok-search-text { display: block; width: 100%; min-width: 0; min-height: 44px; margin: 6px 0 10px; padding: 10px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 16px; }
.tiktok-copy-status:empty { margin: 0; }
.tiktok-video { min-width: 0; }
.tiktok-video .tiktok-card { display: block; width: 100%; }
.tiktok-open-video { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 2px; text-align: center; color: var(--color-text); font-size: 12px; overflow-wrap: anywhere; }

/* Photos keep author credits on a solid surface, clear of the image. */
.place-photo { position: relative; width: 100%; min-width: 0; }
.card-thumb-slot.place-photo { aspect-ratio: auto; }
.place-photo > img { display: block; width: 100%; height: auto; aspect-ratio: 1.32; object-fit: cover; }
.photo-placeholder { width: 100%; min-height: 150px; aspect-ratio: 1.32; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #dfefe4; color: var(--color-primary); text-align: center; }
.photo-placeholder svg { width: 36px; height: 36px; }
.photo-placeholder .photo-ornament svg { width: 52px; height: 52px; }
.photo-placeholder span { color: var(--color-text-secondary); font-size: 12px; }
.photo-load { min-height: 44px; padding: 8px 14px; border: 1px solid #aac7b7; border-radius: 8px; background: #fff; color: var(--color-primary); font-size: 13px; font-weight: 600; }
.photo-credit { display: block; padding: 6px 8px; background: #fff; color: #52675e; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.photo-credit a { text-decoration: underline; text-underline-offset: 2px; }
.photo-credit > :not(:last-child)::after { content: " · "; white-space: pre; }

.market-rail { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.spin-card { padding: 25px; background: var(--color-primary-tint); border-radius: 16px; overflow: hidden; position: relative; }
.spin-mini { width: 54px; height: 54px; margin-bottom: 17px; border: 5px solid white; border-radius: 50%; display: grid; place-items: center; color: var(--color-primary); background: conic-gradient(#b7dac4 0 90deg, #fff2c6 90deg 180deg, #c7decf 180deg 270deg, #eff8ed 270deg); transform: rotate(-12deg); box-shadow: 0 3px 8px #17533e12; }
.spin-mini span { font-size: 29px; }
.spin-mini svg { width: 25px; height: 25px; }
.spin-card h2 { font: 600 38px/1.05 var(--font-display); letter-spacing: -.02em; }
.spin-card p { font-size: 17px; margin: 8px 0 20px; }
.market-primary { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 17px; background: var(--color-primary-solid); color: white; font-size: 14px; font-weight: 600; border-radius: 9px; }
.market-primary:hover { background: var(--color-primary-solid-hover); }
.market-primary svg { width: 18px; height: 18px; }
.spin-card .market-primary { width: 100%; }
.spin-card small { display: block; margin-top: 13px; color: var(--color-text-secondary); font-size: 11px; line-height: 1.5; }
.market-helper { padding: 22px; border: 1px solid var(--color-border); border-radius: 14px; background: #fff; }
.market-helper h2 { font-size: 19px; }
.market-helper p { font-size: 13px; color: var(--color-text-secondary); margin: 8px 0 16px; }
.market-helper .discover-nav-btn { display: inline-flex; width: 100%; min-height: 44px; height: auto; justify-content: center; padding: 10px; border-radius: 8px; font-size: 12px; box-shadow: none; }
.market-map-shell { overflow: hidden; border: 1px solid var(--color-border); border-radius: 14px; background: #fff; }
.market-map-heading { min-height: 60px; padding: 8px 12px 8px 18px; display: flex; align-items: center; gap: 8px; }
.market-map-heading h2 { margin-right: auto; font-size: 15px; }
.market-map-heading button { width: 44px; height: 44px; display: grid; place-items: center; }
.market-map-heading svg { width: 18px; height: 18px; }
.map-pane { height: 280px; background: #eaf0ec; isolation: isolate; }
.map-controls-group { bottom: 30px; left: 12px; gap: 5px; }
:root:has(#filtersDisclosure[open]) .map-controls-group { display: flex; }
.map-control-btn { width: 44px; height: 44px; box-shadow: var(--shadow-xs); }
.leaflet-bottom.leaflet-right { bottom: 0; }
.leaflet-control-attribution { font-size: 10px; }
.marker { box-shadow: 0 3px 9px #17533e33; }
.status-banner { position: sticky; top: 8px; left: auto; transform: none; margin: 8px auto; max-width: calc(100% - 32px); border-radius: 10px; z-index: 35; animation: none; }
.market-page.is-map-view .main-layout { grid-template-columns: minmax(0, 1fr); }
.market-page.is-map-view .sidebar, .market-page.is-map-view .spin-card, .market-page.is-map-view .market-helper { display: none; }
.market-page.is-map-view .map-pane { height: min(640px, 65dvh); min-height: 260px; }

/* Native dialogs live in the top layer, beyond Leaflet's internal panes. */
dialog { position: fixed; inset: 0; margin: auto; padding: 24px; width: min(620px, calc(100vw - 32px)); max-width: none; height: auto; max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--color-border); border-radius: 20px; color: var(--color-text); background: #fff; box-shadow: var(--shadow-xl); overscroll-behavior: contain; }
dialog::backdrop { background: #173c3266; backdrop-filter: blur(4px); }
.sidebar-detail-view[open] { display: block; height: auto; padding: 0; }
.detail-nav-bar { padding: 10px 18px; background: #fff; }
.detail-nav-bar .card-bookmark-btn { position: relative; top: auto; right: auto; flex-shrink: 0; }
.back-btn { min-height: 44px; }
.detail-title { font-family: var(--font-display); font-size: 36px; }
.detail-section { overflow-wrap: anywhere; }
.detail-action-btn { min-height: 44px; }
#detailContent > .place-photo { width: calc(100% - 36px); margin: 18px; overflow: hidden; border-radius: 12px; }
#detailContent > .place-photo > img, #detailContent > .place-photo .photo-placeholder { aspect-ratio: 1.8; }
.discovery-overlay[open] { display: flex; width: min(560px, calc(100vw - 24px)); padding: 0; background: white; opacity: 1; visibility: visible; backdrop-filter: none; }
.discovery-card { max-width: none; max-height: calc(100dvh - 34px); border: 0; box-shadow: none; padding: 28px 24px 0; gap: 20px; border-radius: inherit; }
.discovery-card-header { padding: 0 26px; }
.discovery-close-btn { width: 44px; height: 44px; top: 12px; right: 12px; z-index: 2; }
.discovery-title { font-family: var(--font-display); font-size: 31px; }
.discovery-card-footer { padding: 16px 0; gap: 12px; border-top: 1px solid var(--color-border); }
.discovery-helper-note { font-size: 12px; }
.wheel-picker-group > div { min-width: 0; }
.wheel-fade-top { background: linear-gradient(to bottom, white 10%, #fff0 100%); }
.wheel-fade-bottom { background: linear-gradient(to top, white 10%, #fff0 100%); }
.spin-dialog { width: min(500px, calc(100vw - 28px)); text-align: center; padding: 24px; }
.spin-dialog-heading { display: flex; align-items: flex-start; gap: 12px; text-align: left; }
.spin-dialog-heading h2 { flex: 1; font: 600 31px/1.12 var(--font-display); }
.spin-dialog-heading button { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--color-bg); }
.spin-dialog-heading svg { width: 20px; height: 20px; }
.spin-explanation { color: var(--color-text-secondary); font-size: 13px; line-height: 1.5; margin: 12px 0 20px; text-align: left; }
.spin-stage { position: relative; width: min(250px, 100%); aspect-ratio: 1; margin: 8px auto 22px; }
.spin-wheel { position: absolute; inset: 0; border: 8px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #c4dfcf, 0 8px 20px #17533e14; background: conic-gradient(#dfefe4 0 90deg, #fff2c6 90deg 180deg, #c2ddcd 180deg 270deg, #edf5e8 270deg); }
.spin-pointer { position: absolute; z-index: 2; top: -8px; left: calc(50% - 12px); width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 26px solid var(--color-primary); }
.spin-utensil { position: absolute; inset: 38%; display: grid; place-items: center; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px #17533e22; }
.spin-utensil svg { width: 26px; height: 26px; }
.spin-slice { position: absolute; font-size: 13px; font-weight: 600; }
.spin-slice.s1 { left: 56%; top: 24%; transform: rotate(45deg); }
.spin-slice.s2 { left: 66%; top: 65%; transform: rotate(135deg); }
.spin-slice.s3 { left: 12%; top: 67%; transform: rotate(225deg); }
.spin-slice.s4 { left: 12%; top: 26%; transform: rotate(-45deg); }
.spin-result { margin: 14px 0; font-size: 15px; line-height: 1.5; }
.spin-result:empty { display: none; }
.spin-result h3, .spin-result strong { color: var(--color-primary); }
.spin-dialog > .market-primary { width: 100%; margin-top: 8px; }
.spin-footnote { color: var(--color-text-secondary); font-size: 11px; line-height: 1.5; margin-top: 14px; }

@media (max-width: 1200px) {
  .sidebar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-layout { gap: 24px; }
  .market-intro h1 { font-size: 48px; }
  .topbar-search-form { flex-basis: 370px; }
}

/* A short landscape viewport needs the same flowing layout as a phone. */
@media (max-width: 900px), (max-height: 560px) {
  .topbar { height: 72px; }
  .topbar-inner, .market-page { padding-left: 20px; padding-right: 20px; }
  .market-intro { display: block; margin-top: 25px; }
  .market-intro h1 { font-size: 44px; }
  .topbar-search-form { width: 100%; min-width: 0; margin-top: 20px; }
  .main-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .market-rail { display: contents; }
  .spin-card { order: -1; padding: 18px 22px; display: flex; align-items: center; gap: 20px; }
  .spin-mini { flex-shrink: 0; width: 66px; height: 66px; margin: 0; }
  .spin-card-copy { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 18px; align-items: center; }
  .spin-card h2 { font-size: 31px; }
  .spin-card p { grid-column: 1; margin: 0; font-size: 15px; }
  .spin-card .market-primary { grid-column: 2; grid-row: 1 / 3; }
  .spin-card small { grid-column: 1 / -1; margin-top: 5px; }
  .sidebar { order: 0; }
  .market-helper { order: 1; }
  .market-map-shell { order: 2; }
  .market-helper { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 20px; }
  .market-helper p { margin: 0; flex: 1; }
  .market-helper .discover-nav-btn { width: auto; }
  .sidebar-header { padding: 0 0 20px; }
  .filters-disclosure[open] > .filter-controls { position: absolute; left: auto; right: 0; top: calc(100% + 8px); width: 360px; background: white; border: 1px solid var(--color-border); border-radius: 14px; box-shadow: var(--shadow-xl); padding: 16px; flex-direction: column; align-items: stretch; gap: 12px; max-height: 55dvh; }
  .filters-disclosure > .filter-controls .filter-bar-group { justify-content: space-between; width: 100%; }
  #sidebarFilterSlot .filters-disclosure { margin-top: 10px; }
  .market-page.is-map-view .market-rail { display: block; }
  .discovery-card { padding: 24px 16px 0; }
  .discovery-card-header { padding: 0 30px; }
  .discovery-title { font-size: 27px; }
  .discovery-card-scroll { padding-bottom: 0; }
}

@media (max-width: 600px) {
  .topbar { height: 68px; }
  .topbar-inner, .market-page { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { gap: 14px; }
  .topbar-actions { gap: 3px; }
  .market-nav { padding: 0 7px; font-size: 12px; }
  .market-nav svg { display: none; }
  .brand-lockup[data-logo-slot="full"], .brand-lockup[data-logo-slot="compact"] { display: none; }
  .brand-lockup[data-logo-slot="icon"] { display: inline-flex; }
  .market-location { flex-wrap: wrap; gap: 8px; padding: 10px 0 14px; }
  .market-location .location-pill-wrap { flex-basis: 100%; }
  .location-pill-btn { width: 100%; }
  .market-geolocate { padding: 8px 12px; font-size: 13px; }
  .location-popover { position: fixed; top: 124px; left: 16px; right: 16px; width: auto; max-height: calc(100dvh - 140px); }
  .market-intro { margin: 23px 0 8px; }
  .market-intro h1 { font-size: 42px; }
  .market-intro p { font-size: 14px; margin-top: 10px; }
  .topbar-search-form { margin-top: 18px; padding-left: 12px; }
  .topbar-search-input { font-size: 13px; }
  .search-submit-btn { font-size: 13px; padding: 0 12px; }
  .market-filterbar { gap: 7px; padding: 14px 0 20px; }
  .filter-glass-pill, .filters-summary { font-size: 12px; padding: 10px 11px; }
  .market-filterbar .filters-disclosure { position: static; }
  .filters-disclosure[open] > .filter-controls { left: 0; right: 0; top: calc(100% - 12px); width: 100%; max-width: none; }
  .sidebar-title { font-size: 23px; }
  .sidebar-controls-row { gap: 8px; }
  .sidebar-sort-select, .sidebar-filter-input { flex: 1 1 135px; font-size: 12px; }
  .spin-card { gap: 14px; padding: 18px; }
  .spin-mini { width: 48px; height: 48px; align-self: flex-start; }
  .spin-card-copy { display: block; }
  .spin-card h2 { font-size: 31px; }
  .spin-card p { margin: 3px 0 12px; }
  .spin-card .market-primary { padding: 10px 12px; font-size: 13px; }
  .spin-card small { margin-top: 9px; }
  .sidebar-list { gap: 28px 16px; }
  .market-helper { display: block; }
  .market-helper p { margin: 8px 0 14px; }
  .market-helper .discover-nav-btn { width: 100%; }
  .map-pane { height: 280px; }
  .discovery-card { gap: 14px; padding-top: 24px; }
  .discovery-title { font-size: 26px; }
  .discovery-subtitle { font-size: 12px; }
  .discovery-sparkle-badge { margin-bottom: 8px; }
  .discovery-actions { gap: 8px; }
  .discovery-primary-btn, .discovery-surprise-btn { font-size: 13px; padding-left: 8px; padding-right: 8px; }
  .spin-dialog { padding: 18px; }
  .spin-dialog-heading h2 { font-size: 28px; }
  .detail-hero-section, .detail-section { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 500px) {
  .sidebar-list { grid-template-columns: minmax(0, 1fr); }
  .card-thumb-slot, .place-photo > img, .photo-placeholder { aspect-ratio: 1.55; }
  .card-name { font-size: 21px; }
}

@media (max-height: 560px) {
  .market-intro { display: flex; align-items: center; margin: 18px 0 8px; }
  .market-intro h1 { font-size: 35px; }
  .market-intro p { display: none; }
  .topbar-search-form { flex: 0 1 45%; margin: 0; }
  .discovery-card { padding: 14px 16px 0; gap: 8px; }
  .discovery-card-header { padding: 0 42px; }
  .discovery-title { font-size: 25px; }
  .discovery-card-footer { padding: 10px 0; gap: 0; }
  .spin-dialog { width: min(560px, calc(100vw - 28px)); }
  .spin-stage { width: 150px; }
  .spin-slice { font-size: 10px; }
  .spin-utensil svg { width: 18px; height: 18px; }
}

/* Dialogs size to content; inset plus auto height would stretch the scrim box. */
dialog, .sidebar-detail-view[open], .discovery-overlay[open] { height: fit-content; }
.discovery-overlay[open] { position: fixed; align-items: stretch; }
body:has(dialog[open]) { overflow: hidden; }
.spin-button-short { display: none; }
.photo-credit a { display: inline-block; padding: 3px 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 600px) {
  .market-location { display: grid; grid-template-columns: minmax(0, 1fr) 105px; padding: 10px 0; }
  .market-geolocate { width: 105px; padding: 8px; gap: 5px; font-size: 12px; }
  #locationPillLabel { font-size: 13px; }
  .location-pill-btn { gap: 1px 4px; grid-template-columns: 20px minmax(0, 1fr) 12px; }
  .market-intro { margin-top: 20px; }
  .market-intro h1 { font-size: clamp(30px, 9.4vw, 38px); }
  .market-intro p { display: none; }
  .topbar-search-form { margin-top: 16px; }
  .spin-card { padding: 14px; gap: 10px; }
  .spin-mini { width: 36px; height: 36px; border-width: 3px; }
  .spin-mini svg { width: 19px; height: 19px; }
  .spin-card-copy { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 3px 8px; }
  .spin-card h2 { font-size: 28px; }
  .spin-card p { font-size: 13px; margin: 0; }
  .spin-card .market-primary { grid-column: 2; grid-row: 1 / 3; padding: 8px; gap: 5px; }
  .spin-card small { margin-top: 5px; font-size: 10px; }
  .spin-button-long { display: none; }
  .spin-button-short { display: inline; }
  .sidebar-header { padding-bottom: 16px; }
  .sidebar-title { font-size: 21px; }
  .sidebar-subtitle { font-size: 12px; margin-bottom: 12px; }
  .sidebar-count-badge { font-size: 11px; padding: 4px 7px; }
  .sidebar-controls-row { flex-wrap: nowrap; }
  .sidebar-sort-select, .sidebar-filter-input { flex: 1 1 0; width: 0; }
  .spin-stage { width: 205px; }
  .spin-dialog-heading h2 { font-size: 26px; }
}

.phone-label-short, .phone-filter-done { display: none; }
/* Phone browsing prioritizes two places together. Wide Fold and laptop layouts
   retain their original composition; short landscape phones use this compact UI. */
@media (max-width: 600px), (max-width: 900px) and (max-height: 560px) {
  .topbar { height: 64px; }
  .topbar-inner, .market-page { padding-left: 12px; padding-right: 12px; }
  .topbar-inner { gap: 8px; }
  .brand-lockup[data-logo-slot="full"] { display: inline-flex; }
  .brand-lockup[data-logo-slot="compact"], .brand-lockup[data-logo-slot="icon"] { display: none; }
  .brand .logo { gap: 5px; }
  .brand .logo-icon { width: 30px; height: 30px; }
  .brand .logo-word { font-family: var(--font-sans); font-size: 19px; font-weight: 700; letter-spacing: -.035em; }
  .topbar-actions { gap: 0; }
  .market-nav { min-width: 44px; padding: 0 5px; font-size: 12px; }
  .market-nav svg, #exploreBtn { display: none; }
  .market-location { display: block; padding: 2px 0; border-bottom: 0; }
  .location-caption, #marketGeoBtn { display: none; }
  .location-pill-btn { display: flex; align-items: center; gap: 6px; width: auto; max-width: 100%; min-height: 44px; padding: 4px 0; }
  .location-pill-btn > svg:not(.location-pill-chevron) { width: 16px; height: 16px; }
  #locationPillLabel { font-size: 12px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
  .location-pill-chevron { width: 12px; height: 12px; }
  .location-popover { position: fixed; top: 110px; left: 12px; right: 12px; width: auto; max-width: 420px; max-height: calc(100dvh - 130px); }
  .market-intro { display: block; margin: 6px 0 0; }
  .market-intro h1 { font-size: clamp(28px, 8.3vw, 34px); line-height: 1.12; letter-spacing: -.035em; }
  .market-intro p { display: none; }
  .topbar-search-form { width: 100%; height: 50px; min-width: 0; margin: 14px 0 0; padding: 2px 3px 2px 10px; border-radius: 9px; }
  .topbar-search-input { min-width: 0; font-size: 16px; }
  .search-submit-btn { padding: 0 12px; font-size: 13px; }
  .market-filterbar { flex-wrap: nowrap; gap: 6px; padding: 12px 0 16px; }
  .filter-glass-pill, .filters-summary { min-height: 44px; font-size: 12px; padding: 9px 11px; gap: 5px; }
  .phone-label-wide { display: none; }
  .phone-label-short { display: inline; }
  .market-filterbar .filters-disclosure { position: static; }
  .filters-disclosure[open] > .filter-controls { position: fixed; inset: auto 12px 12px; width: auto; max-width: none; max-height: calc(100dvh - 96px); padding: 16px; overflow-y: auto; background: white; }
  .phone-filter-done { display: flex; width: 100%; }
  #filterControls .sidebar-controls-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 4px 0; }
  #filterControls .sidebar-sort-select, #filterControls .sidebar-filter-input { width: 100%; min-width: 0; font-size: 16px; }
  .main-layout { gap: 0; }
  .spin-card, .market-helper { display: none; }
  .market-map-shell { margin-top: 24px; }
  .market-page.is-map-view .market-map-shell { margin-top: 0; }
  .sidebar-header { padding: 0 0 14px; }
  .sidebar-header-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 6px; align-items: center; }
  .sidebar-title-group { min-width: 0; grid-column: 1; grid-row: 1; }
  .sidebar-title { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
  #momentChevronBtn, .sidebar-subtitle { display: none; }
  .sidebar-count-badge { grid-column: 1 / -1; grid-row: 2; justify-self: start; padding: 0; background: none; font-size: 11px; font-weight: 400; color: var(--color-text-secondary); }
  .sidebar-header-top > #spinBtn { grid-column: 2; grid-row: 1; min-height: 44px; width: auto; margin: 0; padding: 7px 2px; gap: 4px; background: transparent; color: var(--color-primary); font-size: 12px; }
  .sidebar-header-top > #spinBtn:hover { text-decoration: underline; }
  .sidebar-header-top > #spinBtn svg { width: 15px; height: 15px; }
  .spin-button-long { display: none; }
  .spin-button-short { display: inline; }
  .sidebar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .card { border-radius: 10px; }
  .card-thumb-slot { border-radius: 10px; }
  .card .place-photo > img, .card .photo-placeholder { aspect-ratio: 1.15; }
  .card .photo-placeholder { height: auto; min-height: 0; padding: 12px 6px; gap: 6px; }
  .card .photo-placeholder > span:not(.photo-ornament) { display: none; }
  .card .photo-placeholder:not(:has(button)) > span:not(.photo-ornament) { display: block; }
  .card .photo-placeholder .photo-ornament svg { width: 32px; height: 32px; }
  .card .photo-load { padding: 6px 9px; font-size: 12px; min-height: 44px; }
  .card .photo-credit { padding: 4px 6px; font-size: 10px; }
  .card-content { padding: 10px 0 0; gap: 5px; }
  .card-name-row { gap: 4px; }
  .card-name { font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .card-price { font-size: 11px; }
  .card-meta-line { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.4; font-size: 12px; }
  .card-cuisine { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-meta-line > .dot, .card-fit-summary, .card-tags-row { display: none; }
  .card-rating-badge, .card-walk-badge { font-size: 12px; }
  .card .card-bookmark-btn { top: 4px; right: 4px; width: 44px; height: 44px; }
}
@media (min-width: 601px) and (max-width: 900px) and (max-height: 560px) {
  .market-intro { display: flex; align-items: center; gap: 20px; }
  .market-intro h1 { font-size: 30px; }
  .topbar-search-form { flex: 0 1 48%; margin: 0; }
}
