/* [mob-b] phone fixes, group b (see scratchpad/mobile-issues.md). Loaded after theme.css. */
/* Group B: the city and world map, the landing held sideways, the sign-up creator and the log-in sheet.
   Every rule is scoped to touch phones (or touch screens), so the desktop look does not change.
   The landing's own <style> blocks come after this file, so its overrides carry an extra #auth for weight.
   --kb is the keyboard's height in px (set on :root by the shared keyboard helper while typing); 0 without it. */

/* ---------- the map's side card as a drawer: the button, the X and the scrim exist on every screen but show only on a phone held sideways ---------- */
#sideTog,#sideX,#sideScrim{display:none}

@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){
  /* the map takes the whole screen; the side card slides in over it from the left */
  #city{display:block;overflow:clip}
  #mapWrap{position:absolute;inset:0;isolation:isolate}
  #city #side{position:absolute;z-index:5;top:0;bottom:0;left:0;width:min(360px,calc(100vw - 92px));max-width:none;
    padding:12px 14px max(16px,env(safe-area-inset-bottom,0px)) max(14px,env(safe-area-inset-left,0px));border-right:1px solid var(--line);border-bottom:0;
    box-shadow:10px 0 32px rgba(42,28,18,.3);transform:translateX(calc(-100% - 48px));transition:transform .24s cubic-bezier(.2,.8,.2,1);overscroll-behavior:contain;overflow-y:auto}
  #city.side-open #side{transform:none}
  #sideX{display:grid;place-items:center;position:sticky;top:0;align-self:flex-end;flex:none;margin:-4px -4px -50px 0;z-index:2;box-shadow:0 2px 8px rgba(42,28,18,.18);width:44px;height:44px;border-radius:50%;border:1px solid var(--line);background:var(--raised);color:var(--fg);cursor:pointer}
  #city.side-open #sideScrim{display:block;position:absolute;inset:0;z-index:1002;background:rgba(26,17,11,.28)}
  #sideTog{display:inline-flex;align-items:center;gap:8px;position:absolute;z-index:1001;top:max(10px,env(safe-area-inset-top,0px));left:max(10px,env(safe-area-inset-left,0px));
    min-height:44px;max-width:190px;padding:0 16px 0 12px;border-radius:999px;border:1.5px solid var(--line-strong);background:var(--raised);color:var(--fg);
    font:650 14px var(--body);white-space:nowrap;box-shadow:0 3px 12px rgba(42,28,18,.28);cursor:pointer}
  #sideTog svg{flex:none}
  #sideTog.hot{background:var(--note);border-color:var(--note);color:#FFFDF8}
  #sideTog span{overflow:hidden;text-overflow:ellipsis}
  #sideTog .sidedot{width:9px;height:9px;border-radius:50%;background:#FFFDF8;box-shadow:0 0 0 2px var(--note);flex:none;margin-left:-2px}

  /* Leaflet's + and - sit under the drawer button, 44px each */
  #mapWrap .leaflet-top.leaflet-left{top:calc(max(10px,env(safe-area-inset-top,0px)) + 46px)}
  #mapWrap .leaflet-left .leaflet-control{margin-left:max(10px,env(safe-area-inset-left,0px))}
  /* the filter chips: one row beside the drawer button, scrolling sideways, faded at the edge so it reads as more */
  #mapWrap .leaflet-top.leaflet-right .leaflet-control{margin-top:max(10px,env(safe-area-inset-top,0px));margin-right:max(10px,env(safe-area-inset-right,0px))}
  #map .mapf{flex-wrap:nowrap;gap:6px;padding:2px;overflow-x:auto;overflow-y:hidden;max-width:calc(100vw - 222px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));
    scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;touch-action:pan-x;
    -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent);padding-right:24px}
  #map .mapf::-webkit-scrollbar{display:none}
  #map .mapf button{flex:none;min-height:40px;padding:0 13px 0 9px;font-size:13px;gap:6px}
  /* picking a plot: the chips step aside for the instruction, which sits beside the drawer button */
  #mapWrap:has(#placeHint:not([hidden])) .mapf{display:none}
  #mapWrap #placeHint{top:max(10px,env(safe-area-inset-top,0px));left:calc(max(10px,env(safe-area-inset-left,0px)) + 196px);right:max(10px,env(safe-area-inset-right,0px));transform:none;max-width:none;
    padding:6px 6px 6px 14px;gap:10px;font:650 13px/1.35 var(--body);border-radius:12px;z-index:1001}
  #mapWrap #placeHint span{flex:1;min-width:0}
  #mapWrap #placeCancel{flex:none;min-height:40px;padding:0 16px;border-radius:999px;font:650 14px var(--body)}
  /* the World map button */
  #mapWrap #bWorld{min-height:44px;bottom:max(24px,env(safe-area-inset-bottom,0px));right:max(12px,env(safe-area-inset-right,0px))}
  /* popups: scroll inside when taller than the screen */
  #map .leaflet-popup-content{max-height:calc(100dvh - 150px);overflow-y:auto;overscroll-behavior:contain}
}

/* touch screens of every size: map targets and labels big enough to hit and read */
@media (pointer:coarse){
  #map .leaflet-control-zoom a{width:44px;height:44px;line-height:44px;font-size:22px}
  #map a.leaflet-popup-close-button{width:40px;height:40px;font:24px/38px Tahoma,Verdana,sans-serif;top:2px;right:2px}
  #map .leaflet-popup-content .pop>b:first-child{padding-right:30px}
  #map .leaflet-popup-content .pop .hb{min-height:44px}
  #map .mapf button{min-height:40px}
  /* the world map has only cities on it: no filter chips there */
  #map.world .mapf{display:none}
  /* every pin is a 44px target, whatever it looks like */
  #map .mpin>i{position:relative}
  #map .mpin>i::before{content:'';position:absolute;inset:-9px;border-radius:50%}
  #map .lm,#map .suburb,#map .dlabel,#map .mpin-name,#map .pinbox span,#map .citypin span{font-size:12px}
  #map .citypin.open span{font-size:12.5px}
  #map .mpin em{min-width:18px;height:18px;font-size:11.5px;line-height:18px}
  .mtip{font-size:13px}
}

/* ---------- the landing held sideways: the headline and Play now on the first screen, the gallery in short rows ---------- */
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){
  #auth #lnTop{padding:8px max(16px,env(safe-area-inset-right,0px)) 8px max(16px,env(safe-area-inset-left,0px))}
  #auth .ln-logo{font-size:22px}
  #auth #lnHero{min-height:100svh;padding:62px 0 18px;justify-content:center}
  #auth #lnHero .ln-wrap{padding-left:max(20px,env(safe-area-inset-left,0px));padding-right:max(20px,env(safe-area-inset-right,0px))}
  #auth .ln-hero{grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);gap:24px;align-items:center}
  #auth .ln-reel{order:0;width:100%;transform:rotate(-1deg);border-radius:12px}
  #auth .ln-reel-play{width:56px;height:56px;margin:-28px 0 0 -28px}
  #auth .ln-kick{font-size:12px;letter-spacing:.14em}#auth .ln-kick::before{width:20px;margin-right:8px}
  #auth .ln-hero h1{margin-top:8px;font-size:clamp(28px,4.4vw,40px);line-height:1.02}
  #auth .ln-lede{margin-top:10px;font-size:14px;line-height:1.45;max-width:46ch}
  #auth .ln-hero .tr-ctl{flex-direction:row;flex-wrap:nowrap;gap:10px;margin-top:14px}
  #auth .ln-hero .tr-ctl>*{width:auto;min-height:44px;padding:0 20px;font-size:15px}
  #auth .ln-down,#auth .ln-hero .ln-small{display:none}
  /* the gallery: four columns, rows a third of the screen, so a whole tile fits on screen */
  #auth #lnFeat{padding-top:40px}
  #auth #lnFeat>h2{margin-bottom:20px}
  #auth .bento{gap:10px;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:clamp(110px,30vh,140px);
    grid-template-areas:"floor floor park park" "floor floor cine trek" "map map home trek" "drive drive home heist" "cars cars bot bot"}
  #auth .bt figcaption{padding:10px 12px}#auth .bt figcaption b{font-size:16px}#auth .bt figcaption span{font-size:12.5px}
  #auth .bt-floor figcaption{padding:12px 14px}#auth .bt-floor figcaption b{font-size:22px}#auth .bt-floor figcaption span{font-size:13.5px}
  #auth .ln-band{padding:40px 0}
  #auth .ln-steps{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:20px;gap:12px}
  #auth .ln-trust{grid-template-columns:repeat(3,minmax(0,1fr))}
  #auth #lnTry{padding-top:40px}#auth #lnTrust{padding-top:32px}#auth #lnEnd{padding-top:44px;padding-bottom:48px}
}

/* ---------- the sign-up / log-in sheet on a phone ---------- */
@media (pointer:coarse){
  #auth #authCard .su-prog .dot{font-size:13px}
  #auth #authCard .su-price{font-size:12px}
  #auth #authCard .su .adult input{width:24px;height:24px;flex:none}
  #auth #authCard .su .adult{min-height:48px}
}

/* sideways: the creator in two columns (the figure and the Back / Next bar on the left, the steps and choices on the right), the whole screen tall */
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){
  #auth #authSheet{padding:6px max(8px,env(safe-area-inset-right,0px)) 6px max(8px,env(safe-area-inset-left,0px));align-items:flex-start}
  #auth #authSheet .as-panel{max-height:calc(100dvh - 12px - var(--kb,0px))}
  #auth #authSheet.as-wide .as-panel{width:100%}
  #auth #authSheet .as-x{top:8px;right:8px}
  #auth #authSheet #authCard[data-mode=signup]{height:calc(100dvh - 12px - var(--kb,0px));border-radius:16px}
  #auth #authCard .su{display:grid;grid-template-columns:minmax(210px,33%) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto}
  #auth #authCard .su-body{display:contents}
  #auth #authCard .su-stage{grid-column:1;grid-row:1/3;min-height:0;border-right:1px solid var(--line);border-bottom:0}
  #auth #authCard .su-head{grid-column:2;grid-row:1;gap:6px;padding:10px 62px 8px 18px}
  #auth #authSheet #authCard .su-head h2{font-size:20px;line-height:1.2}
  #auth #authCard .su-head>.sub{font-size:13px}
  #auth #authCard .su-prog{gap:8px}#auth #authCard .su-prog button{min-height:40px;margin:-8px 0 -8px;font-size:13px;gap:6px}#auth #authCard .su-prog .dot{width:24px;height:24px}
  #auth #authCard .su-pane{grid-column:2;grid-row:2/4;padding:12px 18px 16px}
  #auth #authCard .su-tabs{margin-bottom:12px}#auth #authCard .su-tabs button{min-height:40px;font-size:14px}
  #auth #authCard .su-row{margin-bottom:14px}
  #auth #authCard .su-faces{grid-template-columns:repeat(auto-fill,minmax(74px,1fr));gap:8px}
  #auth #authCard .su-tiles{grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:8px}
  #auth #authCard .su-lede{font-size:14.5px;margin-bottom:12px}
  #auth #authCard .su-f{margin-bottom:12px}
  #auth #authSheet #authCard .su-name input{min-height:52px;font-size:21px}
  /* the bar under the figure: Next on top, full width; Back beside it; the log-in link under */
  #auth #authCard .su-bar{grid-column:1;grid-row:3;flex-wrap:wrap;gap:6px 8px;padding:8px 10px max(8px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));border-right:1px solid var(--line)}
  #auth #authCard .su-next{order:1;flex:1 1 0;min-width:0;min-height:48px;margin-left:0;padding:0 14px;font-size:15.5px}
  #auth #authCard .su-next.su-go{min-width:0;font-size:15.5px}
  #auth #authCard .su-back{order:0;min-height:48px;padding:0 16px;font-size:15px}
  #auth #authCard .su-alt{order:2;flex:1 1 100%;min-height:40px;font-size:14px}
  /* Surprise me sits at the foot of the stage, clear of the hint and the face */
  #auth #authCard .su-dice{top:auto;bottom:8px;right:auto;left:50%;transform:translateX(-50%);min-height:42px;padding:0 14px;font-size:14px;white-space:nowrap}
  #auth #authCard .su[data-step="0"] .su-cv{height:calc(100% - 56px)}
  #auth #authCard .su-hint{top:10px;left:12px}
  #auth #authCard .su-tag{top:10px;font-size:15px;padding:5px 14px}
  /* typing (the keyboard is up): the stepper folds away so the field and the button stay in view */
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-prog{display:none}
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-head{padding-top:8px;padding-bottom:6px}
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-lede{display:none}
  /* the log-in card: compact, scrolling inside, above the keyboard */
  #auth #authSheet #authCard[data-mode=login]{padding:14px 20px 14px;gap:8px}
  #auth #authSheet #authCard[data-mode=login] h2{font-size:22px}
  #auth #authSheet #authCard[data-mode=login]:has(input:focus)>.sub,#auth #authSheet #authCard[data-mode=login]:has(input:focus)>.kindrow{display:none}
}

/* upright: the sheet sits above the keyboard; while typing the figure shrinks to a strip (the name tag stays) and the stepper folds */
@media (pointer:coarse) and (orientation:portrait) and (max-width:600px){
  /* [mobe] the sheet sits on the keyboard, not under it (iOS keeps the page full height and lays the keyboard over its bottom) */
  html.kb-open #auth #authSheet{padding-bottom:var(--kb,0px)}
  #auth #authSheet .as-panel{max-height:calc(100dvh - 12px - var(--kb,0px))}
  #auth #authSheet #authCard[data-mode=signup]{height:calc(100dvh - 12px - var(--kb,0px))}
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-stage{flex-basis:64px}
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-prog{display:none}
  #auth #authCard .su:has(.su-pane input:not([type=checkbox]):focus) .su-head{padding-bottom:10px}
}
@media (pointer:coarse){#map .plot{position:relative}#map .plot::before{content:'';position:absolute;inset:-9px}}
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){#mapWrap:has(#sideTog:not(.hot)) #map .mapf{max-width:calc(100vw - 132px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px))}}
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){#city #meCard .hb{min-height:44px}}

/* [mobe] the recovery code card: a Copy button (44 px) under the code, which stays selectable */
#mwrap .reccopy{min-height:44px;min-width:120px;display:block;margin:0 auto;padding:8px 20px;border:1.5px solid var(--line-strong);border-radius:999px;background:var(--btn-bg,var(--raised));color:var(--fg);text-decoration:none;font-weight:700}

/* [mobe] the world map: London's label hangs to the west of its spot and Berlin's to the east, so the two never overlap */
.citypin.cp-w{transform:translate(-92%,-100%)}.citypin.cp-e{transform:translate(-8%,-100%)}

/* [mobe] the map's filter chips: shown kinds are filled in their colour, hidden ones outlined (dashed) and struck through; "Show all" leads when any is off */
#map .mapf button[data-k]{opacity:1}
#map .mapf button[data-k].on{background:color-mix(in srgb,var(--kc,#888) 14%,#fff);border-style:solid}
#map .mapf button[data-k]:not(.on){background:transparent;border:2px dashed #b9b0a2;color:#7a7268}
#map .mapf button[data-k]:not(.on) span{text-decoration:line-through;text-decoration-thickness:1.5px}
#map .mapf button[data-k]:not(.on) i{opacity:.5}
#map .mapf .mf-all{opacity:1;display:flex;align-items:center;border:2px solid var(--note,#a8401f);background:var(--note,#a8401f);color:#FFFDF8;border-radius:16px;padding:3px 11px;font:700 12px var(--body);cursor:pointer;flex:none}
#map .mapf .mf-all[hidden]{display:none}
@media (pointer:coarse){#map .mapf .mf-all{min-height:40px;font-size:13px;padding:0 14px}}
