/* CITY REVEAL | Mobile Commercial UX V2
 * Narrow, source-compatible additive layout. Never touches map tiles, joy,
 * purchasing, desktop style owners, existing theme tokens or application logic.
 */
@media (max-width:767px), (max-height:599px) and (pointer:coarse) {
  body.cr-mobile-commerce-v2 {
    --cr-mcu-ink:var(--cr-ink,#f1f6ff);
    --cr-mcu-panel:var(--cr-panel,#172338);
    --cr-mcu-line:var(--cr-line,#344961);
    --cr-mcu-soft:var(--cr-muted,#b0c2d9);
    --cr-mcu-accent:var(--cr-accent,#77c6f4);
    --cr-mcu-action-ink:var(--cr-accent-ink,#10243c);
    --cr-mcu-top:calc(12px + env(safe-area-inset-top,0px));
  }
  /* Preserve the real map and the authentic map controls, but keep the
     search and map actions clear of camera cut-outs/safe areas. */
  body.cr-mobile-commerce-v2 #cityRevealGlobalSearchV1197A {
    top:var(--cr-mcu-top)!important;
    left:max(12px,env(safe-area-inset-left,0px))!important;
    right:max(12px,env(safe-area-inset-right,0px))!important;
    max-width:none!important;
  }
  body.cr-mobile-commerce-v2 :is(#cityRevealGlobalSearchV1197A,#crUnifiedPlacePanelV1780U,#modalLayer) :is(button,a,input,select,textarea):focus-visible {
    outline:3px solid var(--cr-mcu-accent)!important;outline-offset:2px!important;
  }
  /* A native modal has exclusive foreground: it may still use its own
     navigation and its existing price, legal text and Free choice. */
  body.cr-mobile-commerce-v2[data-cr-mobile-surface="dialog"] :is(#crUnifiedPlacePanelV1780U,#atgPoiDockV1090,#cityRevealGlobalSearchV1197A,#buildTourTray,#crFeatherMapLauncherV1725F) {
    visibility:hidden!important;pointer-events:none!important;
  }
  /* Exactly one dominant interactive surface; no visibility change is
     permanent. Native app state remains authoritative and all surfaces
     reappear untouched when that owner closes. */
  body.cr-mobile-commerce-v2[data-cr-mobile-surface="place"] :is(#atgPoiDockV1090,#cityRevealGlobalSearchV1197A,#buildTourTray,#crFeatherMapLauncherV1725F),
  body.cr-mobile-commerce-v2[data-cr-mobile-surface="explore"] :is(#cityRevealGlobalSearchV1197A,#buildTourTray,#crFeatherMapLauncherV1725F),
  body.cr-mobile-commerce-v2[data-cr-mobile-surface="search"] :is(#buildTourTray,#crFeatherMapLauncherV1725F),
  body.cr-mobile-commerce-v2[data-cr-mobile-surface="tour"] :is(#cityRevealGlobalSearchV1197A,#crFeatherMapLauncherV1725F) {
    visibility:hidden!important;pointer-events:none!important;
  }
  /* The native unified place sheet already reserves geometry in the Leaflet
     viewport. Refine just its visual affordance, NEVER replace its layout. */
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"] {
    border-color:var(--cr-mcu-line)!important;
    box-shadow:0 -12px 48px rgba(0,0,0,.22)!important;
    background:var(--cr-mcu-panel)!important;
    color:var(--cr-mcu-ink)!important;
    overflow:hidden!important;
  }
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"]>.cr-unified-place-head {
    background:var(--cr-mcu-panel)!important;
    border-color:var(--cr-mcu-line)!important;
    padding:16px 14px 11px!important;
    min-height:62px;
  }
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"] .cr-unified-place-head::before {
    content:"";position:absolute;top:7px;left:50%;transform:translateX(-50%);
    width:42px;height:4px;border-radius:100px;background:var(--cr-mcu-line);
    pointer-events:none;
  }
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"] .cr-unified-place-title {
    font-family:var(--cr-heading,Inter,system-ui,sans-serif)!important;
    font-size:clamp(20px,5.4vw,25px)!important;
    font-weight:var(--cr-heading-weight,600)!important;
    line-height:1.12!important;
    letter-spacing:-.02em!important;
    color:var(--cr-mcu-ink)!important;
  }
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"] .cr-unified-place-meta {
    color:var(--cr-mcu-soft)!important;font-size:11px!important;
  }
  /* Contextual conversion rail lives INSIDE the real native place panel.
     It appears only after an explicit engagement, never on map entry.
     It is deliberately part of the sheet, not a viewport-floating popup. */
  body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"]>.cr-mcu-v2-value-rail {
    display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;
    flex:0 0 auto;position:relative;z-index:1;
    max-height:min(160px,30dvh);overflow:auto;
    padding:10px max(14px,env(safe-area-inset-right,0px)) calc(10px + env(safe-area-inset-bottom,0px)) max(14px,env(safe-area-inset-left,0px));
    border-top:1px solid var(--cr-mcu-line);
    background:var(--cr-mcu-panel);color:var(--cr-mcu-ink);
    box-shadow:0 -7px 16px rgba(3,8,16,.08);
    font-family:var(--cr-font,Inter,system-ui,sans-serif);
    box-sizing:border-box;
  }
  .cr-mcu-v2-value-copy {min-width:0;display:grid;align-content:start;gap:3px;}
  .cr-mcu-v2-eyebrow {font:700 9px/1.2 var(--cr-font,system-ui);letter-spacing:.14em;color:var(--cr-mcu-accent);}
  .cr-mcu-v2-value-copy>strong {font:650 15px/1.22 var(--cr-font,system-ui);color:var(--cr-mcu-ink);}
  .cr-mcu-v2-value-copy>p {margin:0;font:400 12px/1.36 var(--cr-font,system-ui);color:var(--cr-mcu-soft);}
  .cr-mcu-v2-value-actions {display:flex;align-items:center;gap:6px;flex:0 0 auto;}
  .cr-mcu-v2-primary {
    display:flex;align-items:center;justify-content:center;
    max-width:134px;min-height:44px;padding:8px 10px;
    border:1px solid var(--cr-mcu-accent);border-radius:11px;
    background:var(--cr-mcu-accent);color:var(--cr-mcu-action-ink);
    font:650 12px/1.2 var(--cr-font,system-ui);text-align:center;
    cursor:pointer;touch-action:manipulation;
  }
  .cr-mcu-v2-dismiss {
    width:44px;height:44px;flex:0 0 auto;
    background:transparent;border:0;color:var(--cr-mcu-soft);
    font-size:25px;cursor:pointer;touch-action:manipulation;
  }
  /* Native, catalogue-validated commercial CTAs for tours and Escape Games.
     Their event handlers, eligibility checks and prices remain source-owned. */
  body.cr-mobile-commerce-v2 #buildTourCulturalCommerceV1829A,
  body.cr-mobile-commerce-v2 [data-cr-escape-action="commerce"],
  body.cr-mobile-commerce-v2 .cr-premium-slides [data-cr-premium-destination] {
    min-height:48px!important;max-width:100%;
    touch-action:manipulation;
    border-radius:12px!important;
    font-weight:700!important;
  }
  body.cr-mobile-commerce-v2 #buildTourCulturalCommerceV1829A {
    border-color:var(--cr-mcu-accent)!important;
    box-shadow:0 4px 12px rgba(0,0,0,.08)!important;
  }
  /* In very narrow viewports, do not squeeze the original source-owned CTA. */
  @media (max-width:365px) {
    body.cr-mobile-commerce-v2 #crUnifiedPlacePanelV1780U[data-view="place"]>.cr-mcu-v2-value-rail {
      grid-template-columns:minmax(0,1fr);gap:6px;
      max-height:min(198px,34dvh);
    }
    .cr-mcu-v2-value-actions{justify-content:space-between;}
    .cr-mcu-v2-primary{max-width:none;flex:1;}
  }
  /* Only the existing plan comparison receives a bottom-aligned purchase
     action; its real event handlers, prices and free/back exits remain. */
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal {
    width:100vw!important;max-width:100vw!important;
    height:100dvh!important;max-height:100dvh!important;
    border:0!important;border-radius:0!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    padding-bottom:0!important;
    overscroll-behavior:contain;
  }
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal .plan-compare-actions {
    display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:8px!important;position:sticky!important;bottom:0!important;
    margin:14px 0 0!important;
    padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px))!important;
    background:var(--cr-panel,#172338)!important;
    border-top:1px solid var(--cr-line,#344961)!important;
    box-shadow:0 -10px 26px rgba(2,7,14,.14)!important;
    z-index:5!important;
  }
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal #planComparePremiumBtn {
    grid-column:1/-1!important;grid-row:1!important;
    width:100%!important;min-height:52px!important;
    background:var(--cr-accent,#77c6f4)!important;
    color:var(--cr-accent-ink,#10243c)!important;
    border:1px solid var(--cr-accent,#77c6f4)!important;
    border-radius:12px!important;font-weight:700!important;
  }
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal :is(#planCompareFreeBtn,#planCompareBackBtn,#planCompareSignInBtn) {
    min-width:0!important;width:100%!important;min-height:44px!important;
    margin:0!important;font-size:12px!important;
  }
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal #planCompareBackBtn{grid-column:1!important;grid-row:2!important;}
  body.cr-mobile-commerce-v2 .modal-card.plan-compare-modal :is(#planCompareFreeBtn,#planCompareSignInBtn){grid-column:2!important;grid-row:2!important;}
  body.cr-mobile-commerce-v2.app-theme-light .modal-card.plan-compare-modal .plan-compare-actions{
    background:#fff!important;
  }
}
@media(prefers-reduced-motion:reduce){
  body.cr-mobile-commerce-v2 .cr-mcu-v2-value-rail *{transition:none!important;animation:none!important;}
}
