/* Mobile-first interaction layer: map stays full-screen, controls live in a bottom sheet. */
.mobile-sheet,.mobile-toast{display:none}

@media (max-width:760px){
  html,body{height:100%;overflow:hidden;overscroll-behavior:none}
  body{position:fixed;inset:0;width:100%}
  .app-shell{height:100dvh;min-height:100dvh;padding:0;overflow:hidden;background:#dfeaf5}

  .topbar{position:fixed;z-index:35;top:calc(env(safe-area-inset-top) + 8px);left:10px;right:10px;margin:0;align-items:flex-start;gap:6px;pointer-events:none}
  .topbar>div{pointer-events:auto}
  .topbar>div:first-child{background:rgba(255,255,255,.88);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid rgba(255,255,255,.92);border-radius:18px;padding:9px 11px;box-shadow:0 10px 28px rgba(28,59,96,.16)}
  .eyebrow{display:none}
  .title-row{gap:6px}
  h1{font-size:16px;letter-spacing:-.025em;white-space:nowrap}
  .count-badge{font-size:10px;padding:4px 7px}
  .top-actions{width:auto;max-width:calc(100vw - 20px);overflow-x:auto;flex-wrap:nowrap;justify-content:flex-start;padding:0 0 2px;scrollbar-width:none}
  .top-actions::-webkit-scrollbar{display:none}
  .chip-button{padding:8px 10px;font-size:11px;background:rgba(20,33,61,.92);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
  .chip-button.secondary{background:rgba(255,255,255,.9)}

  .district-note,.footer-note{display:none}
  .map-stage{height:100dvh;min-height:0;max-width:none;margin:0;border:0;border-radius:0;box-shadow:none}
  .map-gradient{background:linear-gradient(180deg,rgba(245,249,255,.03) 45%,rgba(14,29,55,.08) 100%)}
  .legend,.origin-card{display:none}
  .maplibregl-ctrl-bottom-right{display:none}
  .maplibregl-ctrl-attrib{max-width:46vw!important;font-size:8px!important;bottom:calc(138px + env(safe-area-inset-bottom))!important}

  .mobile-sheet{display:block;position:fixed;z-index:50;left:0;right:0;bottom:0;height:min(46dvh,420px);padding:0 12px calc(10px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);backdrop-filter:blur(22px);-webkit-backdrop-filter:blur(22px);border-radius:28px 28px 0 0;box-shadow:0 -18px 48px rgba(25,48,80,.18);transition:height .3s cubic-bezier(.2,.8,.2,1);touch-action:none;overflow:hidden}
  .mobile-sheet[data-state="peek"]{height:154px}
  .mobile-sheet[data-state="medium"]{height:min(46dvh,420px)}
  .mobile-sheet[data-state="full"]{height:82dvh}

  .mobile-sheet-handle{display:flex;width:100%;height:38px;border:0;background:transparent;align-items:center;justify-content:center;position:relative;cursor:grab;touch-action:none}
  .mobile-sheet-handle:active{cursor:grabbing}
  .sheet-grabber{position:absolute;top:8px;width:46px;height:5px;border-radius:99px;background:#c7cbd1}
  .sheet-state-label{margin-top:10px;font-size:10px;font-weight:800;color:#8a93a2;opacity:0;transition:opacity .15s}
  .mobile-sheet-handle:focus-visible .sheet-state-label{opacity:1}

  .mobile-origin-picker{width:100%;height:54px;border:1px solid #e2e8f0;border-radius:17px;background:#f7f9fc;display:grid;grid-template-columns:34px 1fr 26px;align-items:center;text-align:left;padding:7px 10px;cursor:pointer}
  .origin-picker-icon{width:29px;height:29px;border-radius:50%;display:grid;place-items:center;background:#eaf2ff;color:#2677ff;font-size:18px;font-weight:900}
  .origin-picker-copy small{display:block;color:#7a8799;font-size:9px;font-weight:800;letter-spacing:.08em}
  .origin-picker-copy strong{display:block;font-size:16px;line-height:1.25}
  .origin-picker-chevron{font-size:22px;color:#62708a;text-align:center;transform:translateY(-2px)}

  .mobile-sheet-content{height:calc(100% - 92px);overflow:hidden;padding:0 2px 8px}
  .mobile-sheet .route-summary{position:static;left:auto;bottom:auto;width:100%;margin:0;border:0;border-radius:0;padding:12px 2px 8px;background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none}
  .mobile-sheet .summary-head h2{font-size:20px}
  .mobile-sheet .summary-kind{font-size:10px}
  .mobile-sheet .total-time{padding:8px 11px;border-radius:15px}
  .mobile-sheet .total-time strong{font-size:28px}
  .mobile-sheet .route-steps{margin:10px 0 6px;gap:5px}
  .mobile-sheet .step-pill{padding:7px 9px;font-size:11px}

  .mobile-sheet[data-state="peek"] .route-summary{padding-top:8px}
  .mobile-sheet[data-state="peek"] .summary-kind,
  .mobile-sheet[data-state="peek"] .route-steps,
  .mobile-sheet[data-state="peek"] .demo-note,
  .mobile-sheet[data-state="peek"] .school-strip{display:none}
  .mobile-sheet[data-state="peek"] .summary-head{align-items:center}

  .mobile-sheet[data-state="medium"] .school-strip{display:none}
  .mobile-sheet[data-state="medium"] .mobile-sheet-content{overflow:hidden}

  .mobile-sheet[data-state="full"] .mobile-sheet-content{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:24px;touch-action:pan-y}
  .mobile-sheet[data-state="full"] .route-summary{position:sticky;top:0;z-index:2;background:linear-gradient(180deg,rgba(255,255,255,.99) 78%,rgba(255,255,255,.82) 100%);padding-bottom:10px}
  .mobile-sheet .school-strip{max-width:none;margin:0;padding:8px 0 4px}
  .mobile-sheet .strip-title{align-items:flex-start;flex-direction:column;gap:3px;margin:0 0 8px}
  .mobile-sheet .strip-title h2{font-size:18px}
  .mobile-sheet .strip-title p{display:none}
  .mobile-sheet .school-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;overflow:visible;padding:0;scroll-snap-type:none}
  .mobile-sheet .school-card{min-width:0;border-radius:16px;padding:10px;box-shadow:0 5px 15px rgba(32,69,111,.07)}
  .mobile-sheet .school-card .school-name{font-size:13px}
  .mobile-sheet .school-card .school-time{margin-top:5px}
  .mobile-sheet .school-card .school-time strong{font-size:23px}

  .mobile-toast{display:block;position:fixed;z-index:80;left:50%;bottom:calc(174px + env(safe-area-inset-bottom));max-width:calc(100vw - 32px);transform:translate(-50%,12px);opacity:0;pointer-events:none;background:rgba(20,33,61,.94);color:#fff;border-radius:999px;padding:10px 14px;font-size:11px;font-weight:800;box-shadow:0 10px 28px rgba(20,33,61,.24);transition:.2s ease;white-space:nowrap}
  .mobile-toast.show{opacity:1;transform:translate(-50%,0)}

  .school-marker.compact:not(.selected) .school-badge{width:22px;height:22px;min-width:22px;font-size:8px}
  .school-marker.selected .school-label{font-size:10px}
  .time-bubble{font-size:12px;padding:6px 9px}
}

@media (max-width:390px){
  @media (max-height:700px){
    .mobile-sheet[data-state="medium"]{height:50dvh}
    .mobile-sheet[data-state="full"]{height:86dvh}
  }
  .mobile-sheet .school-list{grid-template-columns:1fr}
}
