/* 웹앱(PWA) 전용: 휴대폰에서는 지도 전체 화면 + 아래 시트, 넓은 화면에서는 PC 버전과 같은 3단 */
.web-hidden { display: none !important; }
html, body { height: 100%; }
body.web { height: 100dvh; }

/* ---------------- 넓은 화면 (PC·태블릿 가로) */
.sheet { display: contents; }
.sheet-grip, .sheet-tabs { display: none; }
.layout > .mapwrap { grid-column: 2; grid-row: 1; }
.sheet > .panel.left { grid-column: 1; grid-row: 1; }
.sheet > .panel.right { grid-column: 3; grid-row: 1; }
.add-row { display: flex; gap: 8px; }
.add-row .add { flex: 1; }
.add-row .myloc { flex: 0 0 auto; padding: 9px 12px; }
.ios-hint {
  position: fixed; z-index: 6000; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; font-size: 13px; line-height: 1.6;
}
.ios-hint[hidden] { display: none; }
.ios-hint .mini { float: right; margin-top: 2px; }

/* ---------------- 휴대폰 */
@media (max-width: 820px) {
  :root { --sheet-h: 50dvh; }
  .topbar { height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0; }
  .brand { font-size: 15px; }
  .brand small, #providerPill, .seg.theme .tx, .icon-btn .tx { display: none; }
  .top-actions { gap: 6px; }
  .ghost { padding: 5px 9px; }
  .seg.theme button { padding: 3px 7px; }

  .layout { display: block; position: relative; flex: 1; min-height: 0; }
  .layout > .mapwrap { position: absolute; inset: 0; }

  .sheet {
    display: flex; flex-direction: column;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
    height: var(--sheet-h); transition: height .22s ease;
    background: var(--panel); border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0, 0, 0, .18);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet-grip { display: flex; justify-content: center; padding: 8px 0 4px; cursor: grab; touch-action: none; flex: none; }
  .sheet-grip span { width: 42px; height: 5px; border-radius: 3px; background: var(--dash); }
  .sheet-tabs { display: flex; gap: 6px; padding: 0 12px 8px; flex: none; }
  .sheet-tabs button {
    flex: 1; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
    border-radius: 10px; padding: 7px 0; font-weight: 600; font-size: 13.5px;
  }
  .sheet-tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
  .sheet > .panel { display: none; flex: 1; min-height: 0; overflow-y: auto; border: none; padding: 4px 14px 16px; }
  .sheet > .panel.left.active { display: flex; }
  .sheet > .panel.right.active { display: block; }
  .sheet[data-size="min"] > .panel { display: none !important; }

  /* 범례는 짧게 (자세한 내용은 아래 결과 탭에 있음) */
  .legend { bottom: calc(var(--sheet-h) + 8px); left: 8px; right: auto; max-width: 62%; font-size: 11.5px; padding: 6px 10px; }
  .legend .t, .legend .foot { display: none; }
  .map-banner { bottom: calc(var(--sheet-h) + 10px); left: 10px; right: 10px; max-width: none; }
  .legend:not([hidden]) ~ .map-banner { display: none; }
  .progress { top: 10px; max-width: calc(100% - 20px); }
  .leaflet-bottom, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: var(--sheet-h); }

  .person .addr, .dlg input { font-size: 16px; } /* iPhone 입력 시 화면 확대 방지 */
  .primary { padding: 12px; }
  .stats .stat .v { font-size: 14px; }
}
