/* Keep the desktop dashboard intact; phone layouts reuse the same map and players. */
.phone-view-bar,#phoneModeHint,.phone-preview-open,.phone-preview-hint,.map-options-scroll-hint{display:none}
.map-options{margin:0;bottom:auto;color:var(--ink)}
.map-options-content{display:contents}
.camera-chrome{flex:0 0 auto;min-width:0}
.brand-mark{width:32px;height:32px;flex:0 0 32px;color:var(--accent)}
.phone-wordmark{display:none}
.brand-copy{min-width:0}

@media (max-width:760px), (max-width:1024px) and (max-height:500px){
  body{grid-template-rows:44px auto minmax(0,1fr) auto 48px 32px;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
  button,a,select{touch-action:manipulation}
  .app-header{padding:0 8px;gap:6px}
  h1{font-size:19px}.brand-icon,#clock,#refresh{display:none}
  .app-header .brand{gap:5px;min-width:0}
  .brand-mark{width:26px;height:26px;flex-basis:26px}
  .phone-wordmark{display:block;font-size:20px;font-weight:800;line-height:21px;letter-spacing:-1px}
  .app-header h1{font-size:10px;font-weight:500;line-height:12px;letter-spacing:0;white-space:nowrap}
  .app-header h1 span{display:inline;font-weight:400;margin-left:2px}
  .header-right .pill{max-width:78px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .header-right{gap:5px}.header-right button{min-height:38px;font-size:14px;padding:7px 10px}
  .pill{font-size:10px;letter-spacing:.4px;padding:6px}
  .drive-controls{padding:5px 8px 4px}
  .control-row{display:flex;flex-wrap:wrap;gap:5px}
  .mode-group{width:100%;gap:5px}.mode-group span{display:none}
  .mode-group button{flex:1;justify-content:center;min-height:40px;padding:7px 5px;font-size:14px}
  .cell-picker{width:100%;gap:5px;min-width:0}
  .cell-picker label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .cell-picker select{flex:1;width:0;min-height:38px;font-size:16px;padding:5px 24px 5px 8px}
  .cell-picker button{min-height:38px;font-size:12px;padding:5px 10px}
  .mode-explanation{min-height:0;padding-top:4px;display:block}
  .mode-explanation #modeHint,.mode-explanation #trackingStatus{display:none}
  #phoneModeHint{display:block;font-size:12px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body[data-phone-layout="map"]:not(.calibration-active) .mode-explanation{display:none}
  .dashboard{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 96px;padding:4px 7px 3px;gap:6px}
  .map-top{padding:3px 6px}.map-top h2{display:none}
  .map-actions{width:100%;gap:5px}.map-actions button{flex:1;min-height:34px;font-size:12px;padding:5px}
  .map-key{display:none}
  .map-stage{display:flex;flex-direction:column}
  #map{flex:1;min-height:0;height:auto}
  .target-tooltip{display:none}
  .target-summary{position:static;flex:0 0 auto;gap:5px;padding:2px 7px;border:0;border-top:1px solid var(--border);border-radius:0;min-height:30px;background:var(--surface)}
  .target-summary>div{min-width:0}.target-summary strong{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .target-summary span{display:none}.target-summary button{min-height:30px;padding:3px 8px;font-size:11px}
  .explore-map-hint{display:none!important}
  .map-bottom{display:flex;min-height:20px;padding:2px 7px}.legend{font-size:10px;gap:5px}
  .map-bottom #coneStatus,.radar-brief{display:none}
  .leaflet-touch .leaflet-bar a{width:36px;height:36px;line-height:36px}
  .weather-camera-marker:after{content:'';position:absolute;inset:-10px;border-radius:50%}
  .camera-stack,.mode-explore .camera-stack{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:6px}
  .camera-panel{border-top:2px solid var(--main)}
  .camera-chrome{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px;align-items:center;padding:4px 6px}
  .camera-heading{display:contents}
  .camera-heading>.camera-number,.camera-heading>div:nth-child(2){display:none}
  .main-camera-actions{grid-column:2;grid-row:1;margin:0;gap:4px}
  .main-camera-actions #aim{display:none}
  .main-camera-actions #fullscreen,.main-camera-actions #skipView{min-height:38px;padding:5px 8px;font-size:12px}
  .camera-select{grid-column:1;grid-row:1;min-width:0;padding:0;gap:5px}
  .camera-select:before{content:'1';display:grid;place-items:center;flex:0 0 21px;height:21px;border-radius:50%;background:var(--main);color:#102b26;font-size:12px;font-weight:700}
  .camera-select label,.camera-select #cameraCount{display:none}
  .camera-select select{width:0;min-width:0;min-height:38px;font-size:16px;padding:5px 23px 5px 7px}
  .compass{top:6px;left:6px;font-size:10px;padding:4px 5px}
  .pano-bottom{padding:4px 6px;flex-wrap:nowrap;align-items:flex-end;gap:4px}
  #imageAge{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;padding-bottom:8px}
  .pano-bottom div{flex:0 0 auto;gap:4px}.pano-bottom button{min-width:36px;min-height:36px;padding:4px 7px;font-size:14px}
  .overview,.mode-explore .overview{display:block;height:24px;min-height:24px;flex-basis:24px}
  .camera-caption,.mode-explore .camera-caption{display:none}
  .resume-target{top:37px;right:6px;min-height:36px;padding:6px 9px;font-size:12px}
  .camera-loading{top:35px;right:6px;font-size:10px;padding:5px}
  #targetBearingMarker{top:40px;bottom:43px}#targetBearingMarker span{font-size:10px}
  .panorama #closeExpanded{min-height:44px;top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right))}
  body[data-phone-layout="cameras"] .dashboard{grid-template-rows:minmax(0,1fr)}
  body[data-phone-layout="cameras"] .cell-picker{display:none}
  body[data-phone-layout="cameras"] .map-panel{display:none}
  body[data-phone-layout="cameras"] .camera-stack{grid-template-rows:minmax(0,1.5fr) minmax(0,1fr)}
  body[data-phone-layout="cameras"].mode-explore .camera-stack,body[data-phone-layout="cameras"].pano-peeking .camera-stack{grid-template-rows:minmax(0,1fr)}
  .comparison-top{padding:6px 8px 3px}.comparison-top h2{font-size:13px}
  .comparison-top:after{content:'Tap a view to make main';font-size:10px;color:var(--subtle)}
  .comparison-top span,.comparison-status{display:none}
  .comparison-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);padding:2px 6px 6px;gap:6px}
  .comparison-card-header{padding:5px;gap:3px;flex-wrap:wrap}
  .comparison-card-header>div{flex:1;min-width:0}.comparison-card-title{font-size:12px;line-height:18px}
  .comparison-role{display:inline-grid;place-items:center;float:left;width:18px;height:18px;border-radius:50%;margin-right:4px;background:var(--two);color:#102432;font-size:11px;font-weight:700}
  .comparison-card[data-view-number="3"] .comparison-role{background:var(--three);color:#102432}
  .comparison-open{display:none}
  .comparison-distance,.comparison-identifiers,.comparison-credit{display:none}
  .comparison-card-meta{display:block;padding:3px 5px;font-size:10px}
  .comparison-aim-label{font-size:10px;top:4px;left:4px;padding:3px}
  .comparison-empty{inset:32px 8px 8px;font-size:13px}
  .phone-view-bar{grid-row:5;display:flex;align-items:stretch;gap:6px;padding:3px 7px 2px}
  .phone-view-bar button{flex:1;min-width:0;min-height:42px;font-size:14px;font-weight:600;padding:7px}
  #phoneViewCount:empty{display:none}#phoneViewCount{display:inline-grid;place-items:center;min-width:19px;height:19px;padding:0 4px;border:1px solid currentColor;border-radius:12px;margin-left:3px;font-size:11px}
  footer{grid-row:6;justify-content:center;font-size:10px;gap:10px;padding:0 7px}footer #footerHint{display:none}
  .settings-page{inset:8px;width:calc(100vw - 16px);height:calc(100dvh - 16px)}
  .settings-header{padding:12px}.settings-header .eyebrow{display:none}.settings-header h2{font-size:21px}
  .settings-header button{font-size:13px;min-height:44px;padding:7px}
  .settings-layout{display:flex;flex-direction:column}.settings-nav{flex-direction:row;padding:6px;gap:4px;border-right:0;border-bottom:1px solid var(--border)}
  .settings-nav button{flex:1;white-space:normal;min-height:44px;text-align:center;font-size:12px;padding:5px}
  .settings-content{padding:14px;font-size:14px}.settings-content select,.settings-content input{font-size:16px}
  .setting.field{flex-wrap:wrap}.setting.field select{max-width:100%}.settings-content button{min-height:40px;white-space:normal}
  .map-options[open]{position:fixed;inset:auto 8px max(8px,env(safe-area-inset-bottom));width:auto;max-width:none;max-height:calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));padding:0;display:flex;flex-direction:column;gap:0;border-radius:16px;font-size:15px;overflow:hidden;box-shadow:0 12px 50px #0008}
  .map-options::backdrop{background:#050c16a6}
  .map-options-heading{flex:0 0 auto;padding:8px 14px;border-bottom:1px solid var(--border);min-height:55px}
  .map-options-content{display:grid;gap:12px;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:14px;flex:1 1 auto}
  .map-options select{font-size:16px;min-height:44px}
  .map-options button,.site-camera-picker button{min-height:44px}.map-options-heading button{min-width:44px}
  .map-options-scroll-hint{display:block;flex:0 0 auto;text-align:center;margin:0;padding:8px;background:var(--surface-alt);border-top:1px solid var(--border);font-size:12px;font-weight:600}
  .map-options .webcam-toggle{min-height:44px;align-items:center}
  .goakamai-dot-hit{width:44px!important;height:44px!important;margin-left:-22px!important;margin-top:-22px!important}
  .goakamai-dot{width:13px;height:13px}
  .dashboard:has(.goakamai-map-popup){grid-template-rows:minmax(0,1fr)}
  .dashboard:has(.goakamai-map-popup) .camera-stack{display:none!important}
  body:has(.goakamai-map-popup) :is(.cell-picker,.mode-explanation){display:none}
  .goakamai-map-popup .leaflet-popup-content{width:min(360px,calc(100vw - 64px))!important;height:auto!important;max-height:none!important;overflow:visible}
  .goakamai-preview-stage{width:100%;aspect-ratio:auto;height:clamp(100px,calc(100dvh - 390px),240px)!important}
  .goakamai-preview-image{width:100%;min-height:0}
  .goakamai-preview-footer{min-height:36px;font-size:12px}
  .goakamai-preview-footer a,.goakamai-preview-footer button{min-height:36px;display:inline-flex;align-items:center;font-size:13px}
  .goakamai-map-popup .leaflet-popup-close-button{width:40px;height:40px;font-size:26px;line-height:34px}
  .goakamai-preview h3{margin-right:26px}
  .map-stage:has(.goakamai-map-popup) .leaflet-control-zoom{visibility:hidden}
  /* The map screen reuses all three players as a short, tappable filmstrip. */
  body[data-phone-layout="map"]:not(.calibration-active) .camera-stack{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:5px}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-panel{position:relative;border-radius:8px}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-chrome{display:block;padding:0}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-heading{display:flex;padding:3px 4px;gap:3px;height:25px;min-width:0}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-heading>.camera-number{display:grid;width:17px;height:17px;flex-basis:17px;font-size:10px}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-heading>div:nth-child(2){display:block;min-width:0}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-heading h2{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body[data-phone-layout="map"]:not(.calibration-active) :is(.main-camera-actions,.camera-select,.eyebrow,.overview,.pano-bottom,.camera-caption,.resume-target,#cameraNotice){display:none!important}
  body[data-phone-layout="map"]:not(.calibration-active) .phone-preview-open{display:block;position:absolute;inset:0;z-index:5;padding:0;border:0;background:transparent;border-radius:inherit}
  .phone-preview-open:focus-visible{outline:3px solid var(--accent);outline-offset:-3px}
  body[data-phone-layout="map"]:not(.calibration-active) :is(#comparisonPanel,#comparisonViews){display:contents}
  body[data-phone-layout="map"]:not(.calibration-active) :is(.comparison-top,.comparison-status,.comparison-card-meta){display:none}
  body[data-phone-layout="map"]:not(.calibration-active) .comparison-card{border-radius:8px;min-width:0}
  body[data-phone-layout="map"]:not(.calibration-active) .comparison-card-header{padding:3px 4px;min-height:25px;height:25px;flex-shrink:0;flex-wrap:nowrap}
  body[data-phone-layout="map"]:not(.calibration-active) .comparison-card-title{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:17px}
  body[data-phone-layout="map"]:not(.calibration-active) .comparison-role{width:17px;height:17px;font-size:10px;margin-right:3px}
  body[data-phone-layout="map"]:not(.calibration-active) :is(.compass,.comparison-aim-label){top:3px;left:3px;max-width:calc(100% - 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px;padding:2px 3px}
  body[data-phone-layout="map"]:not(.calibration-active) #targetBearingMarker{top:25px;bottom:0}
  body[data-phone-layout="map"]:not(.calibration-active) #targetBearingMarker span{display:none}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-loading{top:auto;bottom:4px;right:3px;max-width:calc(100% - 6px);font-size:9px;padding:3px}
  body[data-phone-layout="map"]:not(.calibration-active) .comparison-image-status{font-size:10px;padding:5px}
  body[data-phone-layout="map"]:not(.calibration-active) #comparisonEmpty{position:static;grid-column:2 / span 2;font-size:11px;padding:8px;align-self:center}
  body[data-phone-layout="map"].mode-explore:not(.calibration-active) .phone-preview-hint{display:block;grid-column:2 / span 2;align-self:center;padding:8px;font-size:12px;line-height:1.5;color:var(--subtle)}
  .phone-preview-hint span{font-size:11px}
  .calibration-active .dashboard{grid-row:3;grid-template-rows:minmax(0,1fr) minmax(0,1fr)}
  body.calibration-active{grid-template-rows:44px 0 minmax(0,1fr) auto 0 32px}
  .calibration-active .drive-controls,.calibration-active .phone-view-bar{display:none}
  .calibration-active .calibration-dock{max-height:150px}
}

/* In landscape, the preview strip moves beside the map to preserve its height. */
@media (min-width:600px) and (max-width:1024px) and (max-height:500px){
  body{grid-template-rows:40px auto minmax(0,1fr) auto 44px 30px}
  .control-row{flex-wrap:nowrap}.mode-group{width:52%;flex:1}.cell-picker{width:44%;flex:1}
  .mode-explanation{display:none}.drive-controls{padding-top:3px;padding-bottom:3px}
  .dashboard{grid-template-columns:minmax(0,1fr) 144px;grid-template-rows:minmax(0,1fr);padding-top:4px}
  body[data-phone-layout="map"]:not(.calibration-active) .camera-stack{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(3,minmax(0,1fr));gap:4px}
  body[data-phone-layout="map"].mode-explore:not(.calibration-active) .phone-preview-hint,body[data-phone-layout="map"]:not(.calibration-active) #comparisonEmpty{grid-column:1;grid-row:2 / span 2}
  .calibration-active .dashboard{grid-template-columns:1fr 1fr;grid-template-rows:minmax(0,1fr)}
  body[data-phone-layout="cameras"] .dashboard{grid-template-columns:minmax(0,1fr)}
  body[data-phone-layout="cameras"] .camera-stack{grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
  body[data-phone-layout="cameras"].mode-explore .camera-stack,body[data-phone-layout="cameras"].pano-peeking .camera-stack{grid-template-columns:minmax(0,1fr)}
  .phone-view-bar{max-width:440px;justify-self:center;width:100%}.phone-view-bar button{min-height:38px}
  .overview,.mode-explore .overview{height:18px;min-height:18px;flex-basis:18px}
  .map-bottom{display:none}
}

@media (max-width:360px){.brand-mark{display:none}}

@media(max-width:760px),(max-width:1024px) and (max-height:500px){
 .map-layer-controls button{width:44px;height:44px}
 .map-stage:has(.goakamai-map-popup) .map-layer-controls{visibility:hidden}
 .goakamai-preview-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 8px}
 .goakamai-preview-footer .goakamai-preview-status{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .goakamai-preview-footer a{grid-column:2;grid-row:1;white-space:nowrap}
 .goakamai-preview-footer button{grid-column:1;grid-row:2;justify-self:start;min-height:28px}
 .leaflet-container .goakamai-map-popup a.leaflet-popup-close-button{width:36px;height:36px;line-height:34px;font-size:26px}
}

@media(max-width:760px),(max-width:1024px) and (max-height:500px){
 body>footer{flex-wrap:wrap;align-content:center;row-gap:0;line-height:14px}
 body>footer .site-status{flex-basis:100%;text-align:center}
}
