.phone-sheet-handle,.phone-person-name,.phone-map-credits{display:none}

@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
  :root{--phone-dock-height:68px;--phone-dock-bottom:max(8px,env(safe-area-inset-bottom,0px));--phone-sheet-bottom:calc(var(--phone-dock-height) + var(--phone-dock-bottom) + 12px);--phone-peek-height:210px;--phone-glass:rgba(255,254,250,.85);--phone-sheet:rgba(255,254,250,.96)}
  :root:has(#hikes-tab[aria-selected=true]){--phone-peek-height:124px}
  :root:has(#hikes-tab[aria-selected=true]):has(#hike-filters :is(#reset-hike-filters,#tag-filter,#record-filter):not([hidden])){--phone-peek-height:166px}
  :root:has(#badges-tab[aria-selected=true]){--phone-peek-height:110px}
  :root:has(#peaks-tab[aria-selected=true]){--phone-peek-height:80px}
  :root:has(body[data-editor=false] #inbox-tab[aria-selected=true]){--phone-peek-height:160px}
  :root{--phone-safe-bottom:env(safe-area-inset-bottom,0px)}
  html,body{height:100%;overflow:hidden;overscroll-behavior:none}
  body{height:var(--phone-viewport-height,100dvh);min-height:0;-webkit-text-size-adjust:100%}
  main{position:relative;display:block;flex:none;min-height:0;width:100%;height:100%}
  .workspace,.workspace.focused,.workspace.phone-expanded,.workspace.showing-stats{position:fixed;inset:0;width:100%;height:var(--phone-viewport-height,100dvh);min-height:0;display:block;flex:none;overflow:visible;border:0;grid-template-columns:none;grid-template-rows:none}
  .workspace .map-section,.workspace.has-hike .map-section{position:absolute;inset:0;display:block;width:100%;height:var(--phone-map-height,var(--phone-viewport-height,100dvh));min-height:0;max-height:none;border:0;overflow:visible;isolation:auto;grid-template-columns:none;grid-template-rows:none}
  .workspace.showing-stats .map-section{display:none}
  #map{position:absolute;inset:0;width:100%;height:100%;min-height:0}
  #hike-dialog{inset:calc(var(--phone-viewport-top,0px) + 12px + env(safe-area-inset-top)) 0 auto;margin:0 auto;max-height:calc(var(--phone-viewport-height,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}

  /* Keep the original compact title/totals header, flush with the safe area. */
  .collection-heading{position:fixed;z-index:1100;top:0;left:0;right:0;width:100%;background:var(--paper);border-bottom:1px solid var(--line);transition:opacity .18s}
  .collection-heading .phone-person-name{display:none}
  .collection-heading .collection-stats{display:grid}
  .collection-heading>#import-button{position:fixed;z-index:1100;right:max(12px,env(safe-area-inset-right));bottom:calc(var(--phone-dock-height) + var(--phone-dock-bottom) + 12px);display:flex;align-items:center;justify-content:center;width:52px;height:52px;min-height:52px;margin:0;padding:0;border-radius:50%;box-shadow:0 4px 18px #173b2b35}
  html:has(.workspace:not(.focused):not(.showing-stats):not(.phone-expanded):not(.phone-keyboard)):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) #import-button{bottom:calc(var(--phone-sheet-bottom) + var(--phone-peek-height) + 12px)}
  #import-button .icon{width:25px;height:25px}.add-hike-label{display:none}
  .phone-sheet-full .collection-heading{opacity:0;pointer-events:none}
  .phone-sheet-full .collection-heading button{pointer-events:none}
  html:has(.workspace.showing-stats) #import-button,html:has(.workspace.showing-inbox:not(.focused)) #import-button{visibility:hidden}

  .workspace .collection-rail{position:fixed;z-index:1200;left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));bottom:var(--phone-dock-bottom);display:block;width:auto;max-width:380px;height:var(--phone-dock-height);min-height:var(--phone-dock-height);margin:0 auto;padding:5px;border:1px solid #ffffffb8;border-radius:35px;background:var(--phone-glass);box-shadow:0 5px 24px #15332326,inset 0 1px 0 #ffffffc4;-webkit-backdrop-filter:blur(28px) saturate(160%);backdrop-filter:blur(28px) saturate(160%);transition:opacity .18s,transform .18s}
  .collection-rail .collection-tabs{position:static;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:stretch;gap:2px;height:100%;margin:0;padding:0;border:0}
  .collection-rail .collection-tabs button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;height:100%;min-height:0;padding:5px 2px;border:0;border-radius:28px;background:transparent;color:#58685d;touch-action:manipulation}
  .collection-rail .collection-tabs button[aria-selected=true]{background:#fffefae8;color:var(--green);box-shadow:0 1px 7px #1e3a2212}
  .collection-rail .collection-tabs button[aria-selected=true]:before{display:none}
  .collection-rail .tab-icon{width:23px;height:23px}.collection-rail .tab-label{font-size:12px;line-height:1.25;letter-spacing:0}

  .workspace .sidebar,.workspace.phone-expanded .sidebar,.workspace.phone-keyboard .sidebar{position:fixed;z-index:950;left:0;right:0;top:auto;bottom:0;display:flex;flex-direction:column;flex:none;width:auto;height:calc(var(--phone-peek-height) + var(--phone-sheet-bottom));max-height:calc(var(--phone-viewport-height,100dvh) - 12px);padding-bottom:var(--phone-sheet-bottom);scroll-padding-bottom:var(--phone-sheet-bottom);min-height:0;border:1px solid #ffffffb3;border-radius:22px 22px 0 0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding-top:35px;background:var(--phone-sheet);box-shadow:0 5px 28px #18352729;-webkit-backdrop-filter:blur(22px);backdrop-filter:blur(22px);transition:height .24s cubic-bezier(.2,.8,.2,1);font-size:15px;-webkit-overflow-scrolling:touch;touch-action:pan-y}
  .workspace.phone-expanded .sidebar,.workspace.phone-keyboard .sidebar{height:var(--phone-full-height,85dvh)}
  .workspace.focused .sidebar,.workspace.showing-stats .sidebar{display:none}
  .workspace.phone-dragging .sidebar,.workspace.phone-dragging #hike-inspector{transition:none}
  .phone-sheet-handle{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:center;flex:none;width:100%;height:24px;min-height:24px;margin:0;padding:0;border:0;border-radius:25px 25px 0 0;background:transparent;cursor:ns-resize;touch-action:none;user-select:none;-webkit-user-select:none}
  .phone-sheet-grip{display:block;width:38px;height:5px;border-radius:3px;background:#aab5a9}
  .phone-sheet-handle:focus-visible{outline:2px solid var(--green);outline-offset:-4px}
  .sidebar-tools{padding:0 16px;flex:none}
  .sidebar .panel-heading{min-height:42px;margin:0 0 4px;font-size:18px}
  .sidebar .panel-heading .icon-button{width:44px;height:44px;min-height:44px}
  .sidebar .list-heading{min-height:34px;padding:7px 0;font-size:13px}
  .workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar .filter-row,.workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar #badge-summary,.workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar #peak-summary,.workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar #sort{display:none!important}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) .sidebar{overflow:hidden}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) .sidebar :is(.panel-heading,.list-heading,.hike-list){display:none!important}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) .sidebar-tools{display:flex;flex:1;flex-direction:column;justify-content:center;padding:6px 16px 14px}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) .sidebar-tools>:is(.search,#peak-controls,.land-toggles){width:100%;margin:0}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(#badges-tab[aria-selected=true]) .sidebar .search{display:none!important}
  .sidebar .search{height:48px;border-radius:15px;background:#eef1e9;border-color:transparent}
  .workspace .sidebar .panel-heading,.workspace.phone-expanded .sidebar .panel-heading{display:none!important}
  .workspace.phone-expanded .sidebar>.phone-sheet-handle{height:24px;min-height:24px}
  .workspace:not(.phone-expanded):not(.phone-keyboard):has(:is(#hikes-tab,#badges-tab,#peaks-tab)[aria-selected=true]) .sidebar-tools{justify-content:flex-start;padding:0 16px 8px}
  .sidebar .search input,.sidebar select,.field input,.field select,.field textarea{font-size:16px}
  .sidebar .filter-row{margin-top:10px}.sidebar .filter-row select,.sidebar #peak-list-filter{font-size:16px}
  .sidebar .hike-list,.sidebar .badge-list,.sidebar .peak-list{flex:none;max-height:none;min-height:0;overflow:visible;padding:3px 12px 16px;touch-action:pan-y}
  .sidebar .hike-card{min-height:116px;padding:15px 10px;border-radius:16px}
  .sidebar .card-title{font-size:18px;line-height:1.35;font-weight:600}
  .sidebar .card-place,.sidebar .card-metrics{font-size:14px;line-height:1.45}
  .sidebar .card-date{font-size:12px;position:static;margin-top:7px}
  .sidebar .trip-heading>span{font-size:16px}.sidebar .trip-heading small{font-size:12px}
  .sidebar .place-badge strong,.sidebar .peak-card-body strong{font-size:17px}
  .sidebar .place-badge small,.sidebar .peak-card-body small{font-size:14px}
  .sidebar .badge-kind,.sidebar .peak-caption{font-size:11px}

  .sidebar .badge-grid{gap:8px}
  .sidebar .place-badge{min-height:128px;padding:10px 7px 9px}
  .sidebar .badge-shield{flex:none;width:32px;height:37px;margin-bottom:6px;border-radius:6px 6px 15px 15px}
  .sidebar .badge-shield>.icon{width:19px;height:19px}
  .sidebar .badge-earned-check{right:-4px;width:14px;height:14px}
  .sidebar .badge-earned-check .icon{width:8px;height:8px}
  .sidebar .place-badge strong{font-size:15px;line-height:1.3;color:var(--green)}
  .sidebar .place-badge small{margin-top:6px;font-size:12px;line-height:1.3;color:#63715c}
  .sidebar .badge-kind{display:none}

  .workspace .map-top,.workspace.has-hike .map-top{position:absolute;z-index:850;top:calc(var(--phone-header-height,90px) + 10px);left:auto;right:max(12px,env(safe-area-inset-right));display:block;width:auto;gap:0;pointer-events:none}
  .map-actions{display:flex;flex-direction:column;gap:8px;pointer-events:auto}
  .map-actions .map-button,.map-actions .locate-button{display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-height:44px;padding:0!important;gap:0;border:1px solid #ffffffb3;border-radius:50%;background:var(--phone-glass);color:var(--green);font-size:0;line-height:0;box-shadow:0 3px 14px #19382a20;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}
  .map-actions .map-button .icon{display:block;flex:none;width:20px;height:20px;margin:0}
  .map-actions .map-action-label{display:none}
  .workspace.phone-expanded .map-top,.workspace.phone-trail-expanded .map-top{visibility:hidden;pointer-events:none}
  .map-compass,.leaflet-control-zoom{display:none!important}
  .leaflet-bottom.leaflet-right{bottom:calc(var(--phone-dock-bottom) + var(--phone-dock-height) + 5px)}

  .workspace #hike-inspector{position:fixed;z-index:1000;left:0;right:0;top:auto;bottom:0;display:none;width:auto;height:var(--phone-full-height,85dvh);max-height:calc(var(--phone-viewport-height,100dvh) - 12px);padding-bottom:var(--phone-sheet-bottom);scroll-padding-bottom:var(--phone-sheet-bottom);min-height:0;border:1px solid #ffffffb3;border-radius:22px 22px 0 0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding-top:35px;background:var(--phone-sheet);box-shadow:0 5px 28px #18352729;-webkit-backdrop-filter:blur(22px);backdrop-filter:blur(22px);transition:height .24s cubic-bezier(.2,.8,.2,1);touch-action:pan-y}
  .workspace.phone-trail-expanded #hike-inspector{display:block}
  .workspace.phone-trail-expanded #hike-inspector:has(.area-details){height:auto;max-height:calc(var(--phone-viewport-height,100dvh) - var(--phone-header-height,100px) - 20px)}
  #hike-inspector .detail-panel,.workspace.focused #hike-inspector .detail-panel{position:relative;inset:auto;display:block;width:100%;max-width:none;max-height:none;min-height:0;padding:8px 18px 15px;overflow:visible;border:0;box-shadow:none;background:transparent}
  #hike-inspector .detail-panel h2,.workspace.focused #hike-inspector .detail-panel h2{font-size:25px;line-height:1.2}
  #hike-inspector .detail-meta,#hike-inspector .detail-notes{font-size:15px;line-height:1.6}
  #hike-inspector .detail-stats strong{font-size:20px}#hike-inspector .detail-stats span{font-size:11px}
  #hike-inspector .profile-panel,.workspace.focused #hike-inspector .profile-panel{position:relative;inset:auto;width:100%;max-width:none;padding:16px 18px;border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:none;background:transparent}
  #hike-inspector .profile-chart-wrap{height:170px}#hike-inspector .profile-heading h2{font-size:16px}

  .workspace.showing-stats #stats-panel{position:absolute;inset:0;display:block;width:100%;height:100%;min-height:0;overflow:auto;padding-top:calc(var(--phone-header-height,90px) + 12px);padding-bottom:calc(var(--phone-dock-bottom) + var(--phone-dock-height) + 16px);background:var(--paper)}
  .stats-panel .stats-phone-summary{display:none}
  .workspace.phone-keyboard .sidebar{top:calc(var(--phone-viewport-top,0px) + 12px + env(safe-area-inset-top));bottom:auto;height:calc(var(--phone-viewport-height,100dvh) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-height:calc(var(--phone-viewport-height,100dvh) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  .workspace.phone-keyboard .collection-rail{opacity:0;pointer-events:none;transform:translateY(14px)}
  .workspace.phone-keyboard .map-top{visibility:hidden}
  .toast{bottom:calc(var(--phone-dock-bottom) + var(--phone-dock-height) + 20px);font-size:14px}

  @supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
    .workspace .collection-rail,.map-actions .map-button{background:#fffefa}
  }
}
@media(max-width:360px){#person-heading .phone-person-name{font-size:14px}}
@media(max-width:1000px) and (max-height:500px) and (pointer:coarse){
  :root{--phone-dock-height:60px;--phone-peek-height:150px}
  .workspace .collection-rail{max-width:360px}
  .collection-rail .collection-tabs button{flex-direction:row;gap:7px;padding:4px}
  .collection-rail .tab-icon{width:21px;height:21px}.collection-rail .tab-label{font-size:12px}
  .map-actions{flex-direction:row}
}
@media(prefers-reduced-motion:reduce){.phone-sheet-handle{scroll-behavior:auto}@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){.workspace .sidebar,.workspace #hike-inspector,.collection-heading,.workspace .collection-rail{transition:none}}}
@media(prefers-reduced-transparency:reduce),(prefers-contrast:more){
  @media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
    :root{--phone-glass:#fffefa;--phone-sheet:#fffefa}
    #page-title .name-switch,.collection-heading>.unit-button,.collection-heading>#import-button,.workspace .collection-rail,.workspace .sidebar,.workspace #hike-inspector,.map-actions .map-button{-webkit-backdrop-filter:none;backdrop-filter:none;border-color:#c7d1c1}
  }
}

@media(max-width:700px) and (orientation:portrait){
  .collection-heading{grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto auto;gap:3px 8px;padding-top:max(6px,env(safe-area-inset-top));padding-bottom:6px}
  .collection-heading>.unit-button{grid-column:2;grid-row:1}
  .collection-heading .collection-stats{grid-column:1/-1;grid-row:2}
}
@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
  .workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar .land-toggles{margin-top:4px;gap:8px}
  .workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar .land-toggle{min-height:60px;padding:6px 3px}
  .workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar .land-toggle-symbol{width:25px;height:28px}
  .workspace:not(.phone-expanded):not(.phone-keyboard) .sidebar #peak-controls{margin:0}
  .map-section:has(.phone-map-credits) .leaflet-control-attribution{display:none!important}
  .phone-map-credits{display:grid;place-items:center;position:relative;width:44px;height:44px;pointer-events:auto}
  .phone-map-credits>summary{display:flex;align-items:center;justify-content:center;width:32px;height:32px;margin:0;padding:0;border:1px solid #ffffffb3;border-radius:50%;background:var(--phone-glass);color:var(--green);box-shadow:0 2px 10px #19382a18;font:500 16px/1 var(--sans);cursor:pointer;list-style:none;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}
  .phone-map-credits>summary::-webkit-details-marker{display:none}
  .phone-map-credits>summary::marker{content:""}
  .phone-map-credits__panel{position:fixed;right:64px;top:calc(var(--phone-header-height,90px) + 10px);width:min(260px,calc(100vw - 82px));max-height:40dvh;overflow:auto;padding:13px 15px;border:1px solid var(--line);border-radius:15px;background:var(--white);box-shadow:0 4px 24px #19382a22;font:12px/1.7 var(--sans);color:var(--green)}
  .phone-map-credits__panel strong{display:block;margin-bottom:7px;font-size:13px;font-weight:600}
  .phone-map-credits__panel a{color:var(--green);text-underline-offset:2px}
}

@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){.maptiler-credit-logo{top:calc(var(--phone-header-height,90px) + 14px);left:max(12px,env(safe-area-inset-left))}}

@media(max-width:700px),(max-width:1000px) and (max-height:500px) and (pointer:coarse){
  .phone-hike-label-icon{display:flex;align-items:center;justify-content:center;background:transparent;border:0}
  .phone-hike-label{display:inline-flex;align-items:center;gap:5px;max-width:100%;padding:6px 9px;border:1px solid #afc1a8;border-radius:16px;background:#fffefa;color:var(--green);box-shadow:0 2px 7px #20372b26;font-family:var(--sans);font-size:11px;font-weight:650;line-height:1.25;white-space:nowrap}
  .phone-hike-label.is-selected{background:var(--green);border-color:#fffefa;color:#fffefa;box-shadow:0 2px 9px #20372b38}
  .phone-hike-label-name{min-width:0;overflow:hidden;text-overflow:ellipsis;font-weight:500}
  .phone-hike-label-distance{flex:none;font-variant-numeric:tabular-nums}
  .phone-hike-label-icon:focus-visible{border-radius:18px;outline-offset:0}
}
