/* コンデル？ v1.8.1 - mobile UX / search focus visual polish
   Existing map, PMTiles and API logic are intentionally untouched. */

:root{
  --ui-glass:rgba(10,15,22,.90);
  --ui-glass-strong:rgba(9,14,20,.97);
  --ui-border:rgba(255,255,255,.12);
  --ui-shadow:0 14px 40px rgba(0,0,0,.34);
}

/* Prevent accidental double-tap page zoom on controls while preserving map pinch zoom. */
button,
.top-action,
.info-menu summary,
.chip,
.sort,
.search-result{
  touch-action:manipulation;
}

/* Cleaner focus states for keyboard/accessibility. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

.search-panel{
  border-color:var(--ui-border);
  box-shadow:var(--ui-shadow);
}
.search-results{
  border-color:var(--ui-border);
  background:var(--ui-glass-strong);
}
.search-result{
  min-height:52px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  border:1px solid transparent;
}
.search-result + .search-result{margin-top:2px}
.search-result:hover,
.search-result:focus-visible{
  background:rgba(255,255,255,.07);
  border-color:rgba(255,255,255,.08);
}

/* Selected-place sheet is easier to scan. */
.status-card{gap:10px}
.metric{box-shadow:inset 0 1px 0 rgba(255,255,255,.04)}
.place-actions button{min-height:44px}

@media(max-width:700px){
  /* Important: iOS Safari auto-zooms form controls below 16px. */
  .search-row input,
  .field input,
  .field select,
  dialog input,
  dialog select{
    font-size:16px!important;
  }

  :root{--top-h:54px}

  .topbar{
    padding-left:max(10px,env(safe-area-inset-left,0px));
    padding-right:max(8px,env(safe-area-inset-right,0px));
    background:linear-gradient(180deg,rgba(7,10,14,.96),rgba(7,10,14,.86));
    border-bottom-color:rgba(255,255,255,.09);
  }
  .brand{font-size:18px;gap:8px}
  .brand-dot{width:9px;height:9px}
  .top-actions{gap:6px}
  .top-action,
  .info-menu summary{
    min-width:44px;
    height:44px;
    border-radius:14px;
  }
  .top-action{padding:0 10px;font-size:11px}

  /* Menu is viewport-anchored so it cannot escape when keyboard/zoom changes viewport. */
  .info-menu[open] nav{
    position:fixed!important;
    z-index:90!important;
    top:calc(var(--top-h) + env(safe-area-inset-top,0px) + 7px)!important;
    left:8px!important;
    right:8px!important;
    bottom:auto!important;
    width:auto!important;
    max-height:calc(100dvh - var(--top-h) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 18px)!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    padding:8px!important;
    border-radius:18px!important;
    background:rgba(10,15,22,.98)!important;
    box-shadow:0 20px 70px rgba(0,0,0,.58)!important;
  }
  .info-menu nav a{
    min-height:44px!important;
    display:flex;
    align-items:center;
    padding:10px 12px!important;
    font-size:14px!important;
    line-height:1.35!important;
    border-radius:12px!important;
  }
  .info-menu nav span{
    padding:9px 12px!important;
    font-size:10px!important;
    line-height:1.45!important;
  }

  .search-panel{
    top:calc(var(--top-h) + env(safe-area-inset-top,0px) + 7px);
    width:calc(100% - 14px);
    padding:7px;
    border-radius:19px;
    background:var(--ui-glass);
    box-shadow:0 12px 34px rgba(0,0,0,.30);
  }
  .search-row{gap:6px}
  .search-icon{left:13px}
  .search-row input{
    height:46px!important;
    border-radius:14px;
    padding-left:39px;
    background:rgba(6,10,15,.88);
  }
  .search-row button{
    height:46px!important;
    min-width:62px;
    padding:0 13px!important;
    border-radius:14px;
    font-size:12px!important;
  }

  /* Categories and sorting get their own rows instead of squeezing each other off-screen. */
  .toolbar{
    grid-template-columns:minmax(0,1fr)!important;
    gap:6px!important;
    margin-top:6px!important;
  }
  .chips{
    width:100%;
    gap:5px;
    padding:0 1px 1px;
    mask-image:linear-gradient(90deg,#000 0,#000 88%,transparent 100%);
  }
  .chip{
    min-height:32px;
    height:32px!important;
    padding:0 11px!important;
    font-size:11px!important;
  }
  .sorts{
    width:100%;
    display:grid!important;
    grid-template-columns:1fr 1fr;
    gap:6px!important;
  }
  .sort{
    width:100%;
    min-height:32px;
    height:32px!important;
    padding:0 8px!important;
    font-size:11px!important;
  }

  .search-results{
    left:4px;
    right:4px;
    margin-top:7px;
    max-height:min(44dvh,360px)!important;
    padding:6px;
    border-radius:16px;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  .search-result{
    min-height:55px;
    padding:10px 11px;
    border-radius:12px;
  }
  .search-result strong{font-size:14px}
  .search-result small{font-size:11px;line-height:1.4}

  /* Bottom sheet stays usable without hiding primary actions. */
  .sheet{
    max-height:calc(100dvh - var(--top-h) - env(safe-area-inset-top,0px) - 8px);
    border-radius:22px 22px 0 0;
    border-color:rgba(255,255,255,.12);
    background:rgba(9,14,20,.965);
  }
  .sheet-handle{height:28px}
  .sheet-handle span{width:38px;height:4px}
  .sheet-content{
    padding-left:12px;
    padding-right:12px;
    padding-bottom:max(20px,calc(12px + env(safe-area-inset-bottom,0px)));
    scroll-padding-bottom:24px;
  }
  .welcome h1{font-size:22px}
  .welcome-copy{font-size:11px;margin:7px 0 10px}
  .welcome-actions{gap:6px}
  .welcome-actions button{min-height:44px;font-size:11px}

  .place-title h2{font-size:20px}
  .status-card{margin:9px 0;gap:7px}
  .metric{padding:10px;border-radius:13px}
  .metric strong{font-size:18px}
  .confidence{padding:8px 9px;line-height:1.4}
  .place-actions.three{gap:6px}
  .place-actions.three button{min-height:44px;padding:9px 8px}
  .text-actions{flex-wrap:wrap;row-gap:8px}

  .list{gap:7px}
  .list-item{
    min-height:62px;
    padding:9px 9px 9px 11px;
    border-radius:15px;
  }
  .list-item strong{font-size:13px}
  .list-item small{font-size:10px}
  .list-item>button{
    flex:0 0 52px;
    width:52px;
    height:38px;
    border-radius:11px;
    background:#222c3a;
  }
  .list-item>button::after{
    content:'見る';
    font-size:11px;
    font-weight:900;
    transform:none;
  }

  .fab{
    right:10px;
    min-width:44px;
    height:44px;
    border-radius:14px;
    box-shadow:0 10px 30px rgba(0,0,0,.42);
  }

  dialog{
    width:calc(100% - 14px);
    max-height:calc(100dvh - 14px);
    border-radius:20px;
  }
  dialog form{padding:18px 15px max(18px,env(safe-area-inset-bottom,0px))}
  .dialog-close{width:44px;height:44px;right:7px;top:6px}
  .field input,.field select{min-height:48px}
  .queue-option{min-height:46px}
}

/* Very narrow phones: keep the header and actions visible. */
@media(max-width:380px){
  .top-action span:last-child{display:none}
  .top-action{padding:0;width:44px;justify-content:center}
  .search-row button{min-width:58px;padding-inline:10px!important}
  .chip{padding-inline:9px!important}
  .place-actions.three{grid-template-columns:1fr!important}
  .place-actions.three button:first-child{grid-column:auto!important}
}

/* Short landscape screens: menu and dialogs remain reachable. */
@media(max-height:560px){
  .info-menu[open] nav{max-height:calc(100dvh - 66px)!important}
  .search-results{max-height:32dvh!important}
  dialog{max-height:calc(100dvh - 8px)}
}
