/* ══════════════════════════════════════════════════════════════════
   FREEDOM OS — MOBILE (Premium Redesign)
   Dark luxury · gold accents · cinematic photography · glass surfaces
   Ref: Airbnb, Linear, Apple, Arc, Notion — minimal chrome, image-first.
   ══════════════════════════════════════════════════════════════════ */

#fos-mobile { display: none; }

@media (max-width: 768px) {

  /* ─── Reset desktop chrome ─── */
  html, body { overflow: auto !important; height: auto !important; overscroll-behavior: none; }
  body { background: #050508 !important; }
  #left-sidebar, gmp-map-3d, .hwc-modal, .hwc-backdrop, #loading-screen,
  .fos-topbar, .fos-footer, .cookie-banner, #cookieBanner,
  .ls-root, .ls-shell, #cesiumContainer, [data-desktop-only],
  /* Neutralize leftover fixed/full-screen desktop layers that would sit
     invisibly over the mobile shell and intercept every tap. */
  #mapbox-container, #gmp-globe, #intro, #mobile-drawer-overlay,
  #hwcOverlay, #profileModalBackdrop, #authModalBackdrop,
  #hamburger-btn { display: none !important; }

  /* ─── ZERO tap delay ───
     Removes the browser's ~300ms double-tap-to-zoom wait so every tap fires
     instantly. Applied to the shell + all interactive controls. Also kills the
     grey tap-highlight flash for a native-app feel. */
  #fos-mobile, #fos-mobile * { -webkit-tap-highlight-color: transparent; }
  #fos-mobile,
  .fm-chip, .fm-card, .fm-card-wrap, .fm-heart, .fm-icon-btn,
  .fm-tab, .fm-btn-gold, .fm-btn-ghost, .fm-bn-item,
  .fm-d-close, .fm-d-heart, .fm-d-cta, [data-fm-detail], [data-fm-tab],
  [data-fm-chip], [data-fm-nav], [data-fm-heart], [data-fm-action] {
    touch-action: manipulation;
  }

  /* Mobile shell owns its own high stacking context so nothing overlays it */
  #fos-mobile { position: relative; z-index: 1; }

  :root {
    --fm-bg:      #050508;
    --fm-surface: rgba(255,255,255,0.045);
    --fm-line:    rgba(255,255,255,0.08);
    --fm-line-2:  rgba(255,255,255,0.14);
    --fm-text:    #ffffff;
    --fm-text-2:  rgba(255,255,255,0.68);
    --fm-text-3:  rgba(255,255,255,0.45);
    --fm-gold:    #C9A84C;
    --fm-gold-2:  #D4B558;
    --fm-glass:   rgba(10,10,14,0.55);
  }

  #fos-mobile {
    display: block;
    min-height: 100vh;
    background: var(--fm-bg);
    color: var(--fm-text);
    font-family: 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 108px; /* space for bottom nav */
  }

  /* ═════════════════════════════ TOP BAR ═════════════════════════════ */
  .fm-topbar {
    position: sticky; top: 0; z-index: 40;
    display: grid; grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 14px 16px;
    /* Lighter blur on the sticky bar: at blur(18px) iOS Safari re-blurs the
       entire scrolling page every frame. blur(8px) + a more opaque fill keeps
       the glass look with far less per-frame GPU work. */
    background: rgba(5,5,8,0.88);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .fm-icon-btn {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 12px;
    color: rgba(255,255,255,0.85);
    background: transparent; border: 0;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background .18s ease;
  }
  .fm-icon-btn:active { background: rgba(255,255,255,0.06); }

  .fm-brand {
    display: inline-flex; align-items: center; gap: 8px;
    justify-self: center;
    text-decoration: none; color: var(--fm-gold);
  }
  .fm-brand-mark { color: var(--fm-gold); flex-shrink: 0; }
  .fm-brand-text { display: flex; flex-direction: column; align-items: center; line-height: 1; }
  .fm-brand-name {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600; font-size: 14.5px; letter-spacing: 0.16em;
    color: var(--fm-gold);
  }
  .fm-brand-tag {
    font-family: 'DM Sans', sans-serif;
    font-size: 8px; letter-spacing: 0.22em; text-transform: uppercase;
    color: rgba(201,168,76,0.55); margin-top: 3px;
  }

  /* ═════════════════════════════ HERO ═════════════════════════════ */
  /* Slightly more breathable vertical rhythm (+~15%) without added density. */
  .fm-hero {
    padding: 38px 22px 24px;
  }
  .fm-hero-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(38px, 10.5vw, 46px);
    line-height: 1.02;
    letter-spacing: -0.015em;
    color: var(--fm-text);
    margin: 0 0 16px 0;
  }
  .fm-hero-accent { color: var(--fm-gold); font-style: normal; }
  .fm-hero-sub {
    font-size: 15px; line-height: 1.5;
    color: var(--fm-text-2);
    margin: 0;
    max-width: 32ch;
  }

  /* ═════════════════════════════ SEARCH ═════════════════════════════ */
  .fm-search-wrap { padding: 26px 22px 4px; }
  .fm-search {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--fm-line);
    color: var(--fm-text-3);
    transition: border-color .2s ease, background .2s ease;
  }
  .fm-search:focus-within {
    border-color: rgba(201,168,76,0.5);
    background: rgba(255,255,255,0.05);
    color: var(--fm-text);
  }
  .fm-search svg { flex-shrink: 0; color: var(--fm-text-3); }
  .fm-search input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: 0;
    color: var(--fm-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    padding: 0;
  }
  .fm-search input::placeholder { color: rgba(255,255,255,0.4); }

  /* ═════════════════════════════ CHIPS ═════════════════════════════ */
  .fm-chips {
    padding: 18px 0 6px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  }
  .fm-chips-track {
    display: flex; gap: 10px;
    padding: 0 22px;
    overflow-x: auto;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .fm-chips-track::-webkit-scrollbar { display: none; }
  .fm-chip {
    flex-shrink: 0;
    padding: 9px 17px;
    border-radius: 999px;
    /* Dark glass surface, hairline border */
    background: rgba(12,12,18,0.55);
    border: 0.5px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.72);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .28s cubic-bezier(0.22,1,0.3,1),
                color .28s cubic-bezier(0.22,1,0.3,1),
                border-color .28s cubic-bezier(0.22,1,0.3,1),
                transform .18s cubic-bezier(0.22,1,0.3,1);
  }
  .fm-chip:active { transform: scale(0.97); background: rgba(255,255,255,0.05); }
  .fm-chip.is-active {
    /* Soft gold outline over dark glass — no bright fill */
    background: rgba(201,168,76,0.09);
    border-color: rgba(201,168,76,0.32);
    color: var(--fm-gold-2);
  }

  /* ═════════════════════════════ CTA CARD ═══════════════════════════ */
  /* Premium glass call-to-action — Freedom Profile. Sits below chips, above tabs. */
  .fm-cta {
    position: relative;
    margin: 20px 22px 4px;
    padding: 18px 18px 16px;
    border-radius: 20px;
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(201,168,76,0.07) 0%, rgba(255,255,255,0.02) 55%),
      rgba(12,12,18,0.6);
    border: 1px solid rgba(201,168,76,0.22);
    box-shadow: 0 14px 40px -22px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.04);
  }
  .fm-cta-glow {
    position: absolute; top: -60px; right: -40px;
    width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(201,168,76,0.16), transparent 70%);
    pointer-events: none;
  }
  .fm-cta-body { position: relative; display: flex; gap: 13px; align-items: flex-start; }
  .fm-cta-icon {
    flex-shrink: 0;
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.05));
    border: 1px solid rgba(201,168,76,0.32);
    color: var(--fm-gold-2);
  }
  .fm-cta-text { min-width: 0; }
  .fm-cta-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400; font-size: 20px; line-height: 1.1;
    letter-spacing: -0.005em;
    color: var(--fm-text);
    margin: 1px 0 5px 0;
  }
  .fm-cta-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; line-height: 1.5;
    color: var(--fm-text-2);
    margin: 0;
  }
  .fm-cta-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; margin-top: 15px;
    padding: 13px 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #D4B558 0%, #C9A84C 100%);
    color: #0a0a0b;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600; font-size: 14.5px; letter-spacing: 0.01em;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(201,168,76,0.26), inset 0 1px 0 rgba(255,255,255,0.28);
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease;
  }
  .fm-cta-btn:active { transform: translateY(1px) scale(0.99); }
  .fm-cta-time {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    margin-top: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px; letter-spacing: 0.04em;
    color: var(--fm-text-3);
  }
  .fm-cta-time svg { color: rgba(201,168,76,0.7); flex-shrink: 0; }

  /* ═════════════════════════════ TABS ═════════════════════════════ */
  /* Premium segmented navigation: larger type, thicker animated underline. */
  .fm-tabs {
    position: relative;
    display: flex;
    margin: 24px 22px 0;
    border-bottom: 1px solid var(--fm-line);
  }
  .fm-tab {
    flex: 1;
    padding: 15px 4px 16px;
    background: transparent; border: 0;
    color: rgba(255,255,255,0.5);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px; font-weight: 500; letter-spacing: 0.005em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .28s cubic-bezier(0.22,1,0.3,1);
  }
  .fm-tab.is-active { color: var(--fm-gold); font-weight: 600; }
  .fm-tab-underline {
    position: absolute;
    bottom: -1.5px; left: 0;
    width: 50%; height: 3px;
    background: linear-gradient(90deg, var(--fm-gold-2), var(--fm-gold));
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 12px rgba(201,168,76,0.28);
    transition: transform .38s cubic-bezier(0.16,1,0.3,1);
    transform: translateX(0);
  }
  .fm-tabs[data-active="watchlist"] .fm-tab-underline { transform: translateX(100%); }

  /* ═════════════════════════════ FEED / CARDS ═════════════════════════════ */
  .fm-feed { padding: 20px 18px 8px; }
  .fm-cards {
    display: flex; flex-direction: column;
    gap: 20px;
  }

  /* Outer card container — wraps photo + info strip as one unit */
  .fm-card-wrap {
    position: relative;
    display: block;
    border-radius: 22px;
    overflow: hidden;
    background: #101116;
    border: 1px solid rgba(255,255,255,0.07);
    /* Softer, more diffuse elevation — layered for a premium float. */
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 20px 44px -24px rgba(0,0,0,0.72);
    /* Cards permanently visible. NO will-change: promoting all 15 cards to
       persistent GPU layers exhausts the mobile texture budget, so off-screen
       layers get evicted and images "reload" (flash empty) on scroll-back. */
  }
  .fm-card-wrap.is-in { opacity: 1; transform: none; }

  /* Photo section (~16:9), rounded to match top of container */
  .fm-card {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #12131a;
    text-decoration: none; color: #fff;
    -webkit-tap-highlight-color: transparent;
    transition: transform .2s cubic-bezier(0.16,1,0.3,1);
  }
  .fm-card:active { transform: scale(0.992); }

  /* Skeleton shimmer while image loads */
  .fm-card-media {
    position: absolute; inset: 0;
    background: linear-gradient(120deg, #14151d 0%, #1b1c25 50%, #14151d 100%);
    background-size: 200% 100%;
    animation: fm-shimmer 2.2s linear infinite;
  }
  /* Stop the skeleton shimmer once the photo has loaded. Without this, 15
     gradients repaint forever → needless compositor work + battery drain.
     .fm-card-media precedes .fm-card-img in the DOM, so we gate off a class
     set on the wrapper (.img-ready) rather than a sibling combinator. */
  .fm-card-wrap.img-ready .fm-card-media { animation: none; opacity: 0; }
  @keyframes fm-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  .fm-card-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .4s ease;
  }
  .fm-card-img.is-loaded { opacity: 1; }

  .fm-card-scrim {
    position: absolute; inset: 0;
    /* Smoother multi-stop gradient for cleaner text legibility over photos. */
    background:
      linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.28) 58%, rgba(0,0,0,0.62) 80%, rgba(0,0,0,0.92) 100%);
    pointer-events: none;
  }

  /* Top corner badges */
  .fm-card-top {
    position: absolute; top: 14px; left: 14px; right: 14px;
    display: flex; justify-content: space-between; align-items: center;
    pointer-events: none;
  }
  .fm-card-rank {
    pointer-events: auto;
    padding: 6px 13px;
    /* Solid bg instead of backdrop-filter: this badge renders on all 15 cards;
       15 live blur layers cripple iOS Safari (re-blurs every scroll frame).
       A near-opaque fill looks identical over a photo at ~zero GPU cost. */
    background: rgba(8,9,7,0.82);
    border: 1px solid rgba(201,168,76,0.28);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
    color: rgba(255,255,255,0.95);
  }
  .fm-heart {
    pointer-events: auto;
    display: inline-grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    /* Solid bg instead of backdrop-filter (renders on all 15 cards). */
    background: rgba(10,10,14,0.72);
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.92);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .2s cubic-bezier(0.34,1.56,0.64,1), background .2s ease, border-color .2s ease, color .2s ease;
  }
  .fm-heart:active { transform: scale(0.9); }
  .fm-heart.is-saved {
    background: rgba(201,168,76,0.9);
    border-color: rgba(201,168,76,1);
    color: #0a0a0b;
  }
  .fm-heart.is-saved svg { fill: currentColor; }
  .fm-heart.pop { animation: fm-pop .38s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes fm-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.28); }
    100% { transform: scale(1); }
  }

  /* Bottom overlay on photo: city + score badge (score overlaps into info strip) */
  .fm-card-bottom {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 16px 16px 14px;
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 12px;
    z-index: 2;
  }
  .fm-card-place { min-width: 0; }
  /* Subtle social-proof label — one small pill per select destination. */
  .fm-card-tag {
    display: inline-flex; align-items: center; gap: 5px;
    margin: 0 0 8px 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(8,9,7,0.7);
    border: 0.5px solid rgba(201,168,76,0.4);
    font-family: 'DM Sans', sans-serif;
    font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--fm-gold-2);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  }
  .fm-card-tag-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--fm-gold-2);
    box-shadow: 0 0 6px rgba(201,168,76,0.6);
    flex-shrink: 0;
  }
  .fm-card-city {
    display: block;
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 30px; line-height: 1.02;
    letter-spacing: -0.01em;
    color: #fff;
    text-shadow: 0 2px 18px rgba(0,0,0,0.6);
    margin: 0 0 7px 0;
  }
  .fm-card-country {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 14.5px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 10px rgba(0,0,0,0.55);
  }
  .fm-card-flag { font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5)); }

  .fm-score-badge {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 82px;
    padding: 11px 14px 9px;
    /* Solid bg (renders on all 15 cards) — no per-card blur for iOS Safari. */
    background: rgba(8,9,7,0.9);
    border: 1px solid rgba(201,168,76,0.55);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 22px rgba(201,168,76,0.1);
    flex-shrink: 0;
  }
  .fm-score-num {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 34px; line-height: 1;
    color: var(--fm-gold);
    letter-spacing: -0.01em;
  }
  .fm-score-lbl {
    margin-top: 3px;
    font-family: 'DM Sans', sans-serif;
    font-size: 8.5px; font-weight: 600; letter-spacing: 0.16em;
    color: rgba(255,255,255,0.62);
    text-transform: uppercase;
    text-align: center;
    line-height: 1.25;
  }

  /* Info strip — inside the container, matching dark bg */
  .fm-card-info {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 16px;
    gap: 12px;
    background: #101116;
  }
  .fm-card-cost {
    display: flex; flex-direction: column;
    line-height: 1.15;
  }
  .fm-card-cost-lbl {
    font-size: 11px; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
  }
  .fm-card-cost-val {
    margin-top: 4px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 19px;
    color: #fff;
  }
  .fm-card-cost-val small { color: rgba(255,255,255,0.5); font-weight: 400; font-size: 13px; margin-left: 2px; }

  .fm-card-lifestyle {
    display: inline-flex; gap: 6px;
  }
  .fm-lifestyle-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--fm-line);
    color: var(--fm-gold-2);
  }
  .fm-lifestyle-btn svg { width: 16px; height: 16px; }

  /* ═════════════════════════════ EMPTY STATE ═════════════════════════════ */
  .fm-empty, .fm-inline-empty {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 60px 30px 40px;
  }
  .fm-empty[hidden] { display: none !important; }
  /* Card visibility toggle used by the instant filter (no DOM rebuild) */
  .fm-card-wrap[hidden] { display: none !important; }
  .fm-empty-mark {
    display: inline-grid; place-items: center;
    width: 68px; height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(201,168,76,0.04));
    border: 1px solid rgba(201,168,76,0.35);
    color: var(--fm-gold);
    margin-bottom: 22px;
  }
  .fm-empty-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400; font-size: 26px; line-height: 1.1;
    margin: 0 0 8px 0;
  }
  .fm-empty-sub {
    font-size: 14px; line-height: 1.5;
    color: var(--fm-text-2);
    max-width: 30ch;
    margin: 0 0 24px 0;
  }

  /* ═════════════════════════════ BUTTONS ═════════════════════════════ */
  .fm-btn-gold {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, #D4B558 0%, #C9A84C 100%);
    color: #0a0a0b;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600; font-size: 14.5px; letter-spacing: 0.01em;
    text-decoration: none;
    border: 0;
    box-shadow: 0 8px 24px rgba(201,168,76,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease;
  }
  .fm-btn-gold:active { transform: translateY(1px) scale(0.99); }

  .fm-btn-ghost {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 22px;
    border-radius: 999px;
    background: transparent;
    color: rgba(255,255,255,0.85);
    border: 1px solid var(--fm-line-2);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500; font-size: 14.5px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease;
  }
  .fm-btn-ghost:active { background: rgba(255,255,255,0.05); }

  /* ═════════════════════════════ DESKTOP NUDGE ═════════════════════════════ */
  .fm-desktop-nudge {
    display: flex; align-items: center; gap: 10px;
    margin: 28px 4px 6px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--fm-line);
    font-size: 12.5px; line-height: 1.45;
    color: var(--fm-text-3);
  }
  .fm-desktop-nudge svg { flex-shrink: 0; color: rgba(201,168,76,0.65); }

  .fm-bottom-space { height: 40px; }

  /* ═════════════════════════════ BOTTOM NAV ═════════════════════════════ */
  .fm-bottomnav {
    position: fixed;
    bottom: 14px; left: 14px; right: 14px;
    z-index: 60;
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    /* Fixed + blur(22px) = Safari re-blurs the whole page behind it every
       scroll frame (major cause of the black-repaint gaps). Near-opaque fill
       with a light blur keeps the floating-glass look at a fraction of cost. */
    background: rgba(10,10,14,0.92);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  }
  .fm-bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border: 0; background: transparent;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 10.5px; font-weight: 500; letter-spacing: 0.02em;
    border-radius: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, background .18s ease;
  }
  .fm-bn-item:active { background: rgba(255,255,255,0.04); }
  .fm-bn-item.is-active { color: var(--fm-gold); }
  .fm-bn-item svg { width: 22px; height: 22px; }

  /* ═════════════════════════════ MODAL ═════════════════════════════ */
  .fm-modal {
    /* Must sit ABOVE the city detail sheet (z-index:3000): the sign-in modal
       is often triggered from a save button inside the open sheet. */
    position: fixed; inset: 0; z-index: 4000;
    display: flex; align-items: flex-end;
    animation: fm-fade-in .2s ease;
  }
  .fm-modal[hidden] { display: none !important; }
  @keyframes fm-fade-in { from { opacity: 0; } to { opacity: 1; } }

  .fm-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .fm-modal-card {
    position: relative;
    width: 100%;
    padding: 28px 24px 26px;
    background: linear-gradient(180deg, #0e0f16 0%, #0a0a10 100%);
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 60px rgba(0,0,0,0.6);
    animation: fm-slide-up .32s cubic-bezier(0.16,1,0.3,1);
  }
  @keyframes fm-slide-up {
    from { transform: translateY(24px); opacity: 0.5; }
    to   { transform: translateY(0); opacity: 1; }
  }
  .fm-modal-close {
    position: absolute; top: 14px; right: 14px;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--fm-line);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .fm-modal-mark {
    display: inline-grid; place-items: center;
    width: 60px; height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.05));
    border: 1px solid rgba(201,168,76,0.35);
    color: var(--fm-gold);
    margin-bottom: 18px;
  }
  .fm-modal-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400; font-size: 26px; line-height: 1.1;
    margin: 0 0 8px 0;
    letter-spacing: -0.005em;
  }
  .fm-modal-sub {
    font-size: 14px; line-height: 1.5;
    color: var(--fm-text-2);
    margin: 0 0 20px 0;
  }
  .fm-modal-benefits {
    list-style: none; margin: 0 0 22px 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
  }
  .fm-modal-benefits li {
    display: flex; align-items: center; gap: 12px;
    font-size: 14px;
    color: rgba(255,255,255,0.82);
  }
  .fm-check {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px; flex-shrink: 0;
    border-radius: 50%;
    background: rgba(201,168,76,0.16);
    border: 1px solid rgba(201,168,76,0.4);
    position: relative;
  }
  .fm-check::after {
    content: '';
    width: 6px; height: 10px;
    border-right: 2px solid var(--fm-gold);
    border-bottom: 2px solid var(--fm-gold);
    transform: rotate(45deg) translate(-1px, -1px);
  }
  .fm-modal-cta { display: flex; width: 100%; margin-bottom: 10px; }
  .fm-modal-alt { display: flex; width: 100%; margin-bottom: 6px; }
  .fm-modal-later {
    display: block; width: 100%;
    margin-top: 6px; padding: 12px;
    background: transparent; border: 0;
    color: rgba(255,255,255,0.42);
    font-family: 'DM Sans', sans-serif; font-size: 13.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ═══ CITY DETAIL SHEET ═══ */
  .fm-card-wrap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .fm-card-wrap:active { transform: scale(0.988); }
  .fm-card { display: block; }

  .fm-detail {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(3,3,8,0);
    transition: background .3s ease;
    -webkit-tap-highlight-color: transparent;
  }
  /* When closed, the sheet must NOT cover the page. Without this the flex
     display overrides the [hidden] default (display:none) and leaves an
     invisible full-screen z-index:3000 layer swallowing every tap. */
  .fm-detail[hidden] { display: none !important; }
  .fm-detail.is-open { background: rgba(3,3,8,0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
  .fm-detail-panel {
    position: relative; width: 100%; max-width: 640px;
    max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: #0b0b11;
    border-radius: 26px 26px 0 0;
    border-top: 1px solid rgba(201,168,76,0.22);
    box-shadow: 0 -24px 60px rgba(0,0,0,0.6);
    transform: translateY(100%);
    transition: transform .34s cubic-bezier(.22,.9,.3,1);
  }
  .fm-detail.is-open .fm-detail-panel { transform: translateY(0); }

  .fm-d-hero { position: relative; width: 100%; aspect-ratio: 16/11; overflow: hidden; border-radius: 26px 26px 0 0; background: #14141c; }
  .fm-d-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .fm-d-hero-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,3,8,0.35) 0%, rgba(3,3,8,0) 34%, rgba(3,3,8,0.15) 60%, rgba(3,3,8,0.9) 100%); }
  .fm-d-close, .fm-d-heart {
    position: absolute; top: 14px; width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%;
    background: rgba(8,8,12,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .fm-d-close { right: 14px; }
  .fm-d-heart { right: 62px; }
  .fm-d-heart.is-saved { color: var(--fm-gold-2); }
  .fm-d-close:active, .fm-d-heart:active { transform: scale(0.9); }
  .fm-d-hero-meta { position: absolute; left: 18px; bottom: 16px; right: 96px; }
  .fm-d-rank { display: inline-block; font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--fm-gold-2); background: rgba(8,8,12,0.5); padding: 3px 9px; border-radius: 20px; margin-bottom: 8px; }
  .fm-d-city { font-family: 'DM Serif Display', serif; font-size: 32px; line-height: 1.02; color: #fff; margin: 0; }
  .fm-d-country { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; font-family: 'DM Sans', sans-serif; font-size: 14px; color: rgba(255,255,255,0.78); }
  .fm-d-flag { font-size: 16px; }
  .fm-d-score { position: absolute; right: 16px; bottom: 16px; text-align: center; padding: 9px 12px; border-radius: 16px; background: rgba(8,8,12,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(201,168,76,0.28); }
  .fm-d-score-num { display: block; font-family: 'DM Serif Display', serif; font-size: 24px; color: var(--fm-gold-2); line-height: 1; }
  .fm-d-score-lbl { display: block; font-family: 'DM Sans', sans-serif; font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,0.6); margin-top: 3px; }

  .fm-d-body { padding: 20px 18px calc(30px + env(safe-area-inset-bottom, 0px)); }
  .fm-d-desc { font-family: 'DM Sans', sans-serif; font-size: 15px; line-height: 1.55; color: rgba(255,255,255,0.82); margin: 0 0 20px; }
  .fm-d-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
  .fm-d-stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px; border-radius: 14px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.07); }
  .fm-d-stat-icon { font-size: 16px; }
  .fm-d-stat-val { font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; color: #fff; }
  .fm-d-stat-lbl { font-family: 'DM Sans', sans-serif; font-size: 11px; color: rgba(255,255,255,0.5); }
  .fm-d-h { font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--fm-gold-2); margin: 0 0 12px; }
  .fm-d-bullets { list-style: none; margin: 0 0 24px; padding: 0; }
  .fm-d-bullets li { position: relative; padding-left: 26px; margin-bottom: 12px; font-family: 'DM Sans', sans-serif; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,0.85); }
  .fm-d-check { position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: rgba(201,168,76,0.16); }
  .fm-d-check::after { content: ''; position: absolute; left: 5px; top: 3px; width: 4px; height: 8px; border: solid var(--fm-gold-2); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
  .fm-d-actions { margin-top: 4px; }
  .fm-d-cta { display: block; width: 100%; text-align: center; }

  /* ═════════════════════════════ EXTENDED SEARCH RESULTS ═════════════════════════════ */
  /* Cities beyond the Top 15 feed, shown as compact rows when searching. */
  .fm-more-results { margin: 8px 0 14px; padding: 0 2px; }
  .fm-more-head {
    font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase; color: var(--fm-gold-2);
    margin: 14px 4px 10px;
  }
  .fm-more-row {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px; margin-bottom: 8px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    text-decoration: none; color: #fff;
    transition: background .15s ease, border-color .15s ease;
  }
  .fm-more-row:active { background: rgba(201,168,76,0.12); border-color: rgba(201,168,76,0.35); }
  .fm-more-flag { font-size: 22px; line-height: 1; flex-shrink: 0; }
  .fm-more-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
  .fm-more-city { font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; color: #fff; }
  .fm-more-meta {
    font-family: 'DM Sans', sans-serif; font-size: 12px; color: rgba(255,255,255,0.55);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .fm-more-score {
    font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
    color: var(--fm-gold); flex-shrink: 0;
  }
  .fm-more-arrow { color: rgba(255,255,255,0.4); flex-shrink: 0; }

  /* ═════════════════════════════ REDUCED MOTION ═════════════════════════════ */
  @media (prefers-reduced-motion: reduce) {
    .fm-card-wrap { opacity: 1; transform: none; }
    .fm-card-img { transition: opacity .2s ease; }
    .fm-card-wrap.is-in .fm-card-img.is-loaded { transform: scale(1); }
    .fm-heart, .fm-tab-underline, .fm-modal-card { transition: none; animation: none; }
    .fm-card-media { animation: none; }
  }
}
