body{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;margin:16px;padding-bottom:128px;}
form{display:flex;gap:.5rem;flex-wrap:wrap;margin-bottom:1rem;}
input[name="q"]{flex:1;min-width:260px;padding:.6rem .8rem;}
select,button{padding:.5rem .7rem;}
table{width:100%;border-collapse:collapse;margin-top:.5rem;}
th,td{border-bottom:1px solid #eee;padding:.4rem .5rem;vertical-align:top;}
th{background:#fafafa;text-align:left;}
.thumb{width:80px;height:auto;object-fit:cover;}
.meta{font-size:.8em;color:#666;}
.badges{margin:.4rem 0 .6rem;}
a.badge{
    display:inline-block;
    border-radius:999px;
    padding:.2rem .7rem;
    font-size:.75em;
    margin:0 .25rem .25rem 0;
    background:#f1f5f9;
    border:1px solid #cbd5e1;
    text-decoration:none;
    color:#111827;
}
a.badge-total{
    background:#0b5cff;
    border-color:#0b5cff;
    color:#000;
    font-weight:600;
}
a.badge-active{
    box-shadow:0 0 0 2px rgba(37,99,235,.35);
    background:#dbeafe;
}

img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pager{margin:.5rem 0;}
.pager ul{list-style:none;padding:0;margin:0;display:flex;gap:.5rem;flex-wrap:wrap;align-items:center;}
.pager li{font-size:.85em;}
.pager a{display:inline-block;padding:.25rem .6rem;border-radius:999px;border:1px solid #ddd;text-decoration:none;color:#333;}
.pager li.current{padding:.25rem .4rem;}
.pager li.disabled{padding:.25rem .4rem;color:#999;}
.re-search-btn {
margin-left: .3rem;
font-size: .8em;
text-decoration: none;
color: #0b5cff;
}
.re-search-btn:hover {
    text-decoration: underline;
}
/* ★ メッシュ地図モーダル */
.mesh-modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:2000;
}
.mesh-modal[aria-hidden="false"]{
    display:flex;
}
.mesh-modal-panel{
    background:#fff;
    border-radius:10px;
    width:min(900px,96vw);
    height:min(80vh,520px);
    box-shadow:0 10px 40px rgba(15,23,42,.35);
    display:flex;
    flex-direction:column;
    overflow:hidden;
}
.mesh-modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:.4rem .7rem;
    border-bottom:1px solid #e5e7eb;
    background:#f9fafb;
    gap:.5rem;
}
.mesh-modal-title{
    font-size:.9rem;
    font-weight:600;
}
.mesh-modal-close{
    border:none;
    background:transparent;
    font-size:1.2rem;
    line-height:1;
    cursor:pointer;
}
.mesh-map{
  width: 100%;
  height: 100vh;      /* ★ min-height じゃなく height で固定 */
}
.mesh-btn{
    padding:.2rem .5rem;
    font-size:.8rem;
    border-radius:999px;
    border:1px solid #dc2626;
    background:#fee2e2;
    color:#b91c1c;
    cursor:pointer;
    white-space:nowrap;
}
.mesh-btn:hover{
    background:#fecaca;
}

.dist-btn {
    font-size: 0.6em;
    width:70px;
    height: 30px;
    padding:4px;
}

/* 詳細モーダル全体 */
.detail-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

/* 背景 */
.detail-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

/* パネル */
.detail-modal-panel {
  position: relative;
  background: #fff;
  max-width: 960px;
  width: 96%;
  height: 90%;
  max-height: 720px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ヘッダー */
.detail-modal-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.detail-modal-title {
  font-weight: 600;
  font-size: 14px;
}

.detail-modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* 本文 */
.detail-modal-body {
  flex: 1;
  overflow: hidden;
}

/* iframe */
.detail-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* 表示中状態 */
.detail-modal[aria-hidden="false"] {
  display: flex;
}

.badges-sub {
  margin-top: .5rem;
}
.badge-sub {
  background:#eef;
}
.badge-sub.badge-active {
  background:#88f;
  color:#fff;
}

.detail-modal-header {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.detail-nav-btn {
  white-space: nowrap;
}

.detail-modal-title {
  flex: 1;
  margin-left: .5rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.total-count{
  font-size: 0.8em;
  font-weight: normal;
  color: #333;
  margin-left: .5em;
}

.mark {
  background: #ffeb3b;
}
.db-filter-area {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fafafa;
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.db-filter-note {
  margin: 0 0 4px;
  color: #555;
  font-size: 0.8rem;
}

.db-filter-org {
  margin-bottom: 6px;
  padding: 4px 6px;
  border-bottom: 1px dashed #ddd;
}

.db-filter-org-label {
  display: block;
  margin-bottom: 2px;
}

.db-filter-src-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding-left: 1.5em;
}

.db-filter-src-item {
  white-space: nowrap;
}

/* ================================
 * 画像一覧モーダル（全画像ギャラリー）
 * ================================ */

/* フルスクリーンのオーバーレイ */
.imgpanel-modal {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 と同じ */
  display: none;           /* デフォルト非表示 */
  justify-content: center; /* 中央寄せ */
  align-items: center;
  z-index: 9000;
}

/* 表示時にだけ flex で表示 */
.imgpanel-modal.is-open {
  display: flex;
}

/* 背景の暗い幕 */
.imgpanel-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

/* 中央のパネル本体 */
.imgpanel-panel {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  max-width: 960px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9100;
}

/* ヘッダー */
.imgpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f3f3f3;
  border-bottom: 1px solid #ddd;
}

.imgpanel-title {
  font-weight: bold;
  font-size: 14px;
}

/* 閉じるボタン */
.imgpanel-close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* 画像グリッド部分 */
.imgpanel-grid {
  padding: 8px;
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

/* 各サムネカード */
.imgpanel-item {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
  padding: 4px;
  width: 120px;          /* サムネ横幅（お好みで調整） */
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
}

.imgpanel-item:hover {
  background: #f0f8ff;
}

/* サムネイル画像 */
.imgpanel-thumb-wrap {
  width: 100%;
  height: 90px;          /* 高さを揃えるための枠 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
}

.imgpanel-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* タイトルキャプション */
.imgpanel-caption {
  word-break: break-all;
}

/* スマホ用調整（パネルをちょっと大きめに） */
@media (max-width: 600px) {
  .imgpanel-panel {
    width: 96%;
    max-height: 85vh;
  }
  .imgpanel-item {
    width: 45%;        /* 2列並びくらい */
  }
}

/* 画像一覧モーダル：ヘッダー左右 */
/* 画像一覧モーダル：画面中央に */
.imgpanel-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;                 /* 開くときflexにする */
  align-items: center;           /* 縦中央 */
  justify-content: center;       /* 横中央 */
}

#allImgGrid{
  overflow-anchor: none;
}

/* 背景 */
.imgpanel-bg{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.35);
}

/* パネル本体（中央に置く） */
.imgpanel-panel{
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  height: min(85vh, calc(100vh - 32px));
  background:#fff;
  border-radius: 10px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  overflow-anchor: none;
}
.imgpanel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.imgpanel-header-left{
  display:flex;
  align-items:baseline;
  gap:8px;
}
.imgpanel-count{
  font-size:12px;
  opacity:.8;
}
.imgpanel-header-right{
  display:flex;
  align-items:center;
  gap:10px;
}
.imgpanel-perpage{
  font-size:12px;
  white-space:nowrap;
}
.imgpanel-perpage select{
  margin-left:6px;
}

/* 画像一覧モーダル：ページネーション */
.imgpanel-pager{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  padding:10px 0 4px;
  flex-wrap:wrap;
}
.imgpanel-pager a,
.imgpanel-pager button,
.imgpanel-pager span{
  border:1px solid #ccc;
  padding:4px 8px;
  border-radius:4px;
  font-size:12px;
  background:#fff;
}
.imgpanel-pager .current{
  font-weight:bold;
  background:#eee;
}
.imgpanel-pager .disabled{
  opacity:.45;
}
.imgpanel-pager a{
  text-decoration:none;
}
.imgpanel-item{
  border:1px solid #ddd;
  border-radius:6px;
  padding:6px;
  background:#fff;
}
.imgpanel-item img{
  width:100%;
  height:auto;
  display:block;
}
.imgpanel-cap{
  font-size:11px;
  line-height:1.25;
  margin-top:6px;
  white-space:pre-line;
}

/* ===== 画像一覧：スクロール担当を #allImgGrid に固定 ===== */
.imgpanel-panel{
  display: flex;
  flex-direction: column;
  overflow: hidden;         /* パネル自体はスクロールさせない */
  overflow-anchor: none;
}

#allImgGrid{
  flex: 1;                  /* ヘッダ/ページャを除いた残りを埋める */
  overflow: auto;           /* ★ここだけがスクロール */
  overflow-anchor: none;
  min-height: 0;            /* flex内スクロールで重要 */
}

/* ===== help modal ===== */
.help-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.help-modal.is-open {
  display: block;
}

.help-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.help-modal-panel {
  position: relative;
  width: min(960px, 95vw);
  height: min(85vh, 900px);
  margin: 5vh auto 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}

.help-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #ddd;
}

.help-modal-title {
  font-weight: 700;
}

.help-modal-close {
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
}

.help-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  height: calc(100% - 48px);
}

/* 背景スクロール停止 */
html.modal-open,
html.modal-open body {
  overflow: hidden;
}

.kw-rank-float{
  position:absolute;
  z-index:9999;
  width: min(520px, calc(100vw - 24px));
  max-height: 260px;
  overflow:auto;
  background:#fff;
  border:1px solid #c00;
  border-radius:12px;
  box-shadow:0 10px 24px rgba(0,0,0,.12);
  padding:10px 12px;
}
.kw-rank-float .ttl{font-weight:700;margin:0 0 8px 0;font-size:14px;}
.kw-rank-float ol{margin:0;padding-left:22px;}
.kw-rank-float li{display:flex;gap:10px;justify-content:space-between;padding:4px 0;}
.kw-rank-float a{color:inherit;text-decoration:none;}
.kw-rank-float a:hover{text-decoration:underline;}
.kw-rank-float .cnt{opacity:.7; white-space:nowrap;}

/* コメットくん（右下・控えめ） */
.concierge-star{
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 42px;              /* ★小さく */
  height: 42px;
  z-index: 9000;            /* 吹き出しより下 */
  pointer-events: none;
  user-select: none;
  transition: opacity .2s ease, transform .2s ease;
}

.concierge-star img{
  width: 100%;
  height: 100%;
  object-fit: contain;      /* ★はみ出し防止 */
  display: block;
}

/* 吹き出し表示中だけ少し主張 */
.concierge-star.is-active{
  opacity: .95;
  transform: scale(1.05);
}

/* スマホはさらに小さく */
@media (max-width: 640px){
  .concierge-star{
    width: 34px;
    height: 34px;
    right: 8px;
    bottom: 8px;
  }
}

/* ===== 位置パラメータ（ここだけ触ればOK） ===== */
:root{
  --tail-right: 58px;   /* しっぽの位置（右から） */
  --tail-size: 10px;    /* しっぽ（三角）のサイズ */
  --comet-w: 100px;     /* コメットくんの表示サイズ */
  --bubble-comet-gap: 4px;
  --comet-overlap: 0px; /* 吹き出しと少し重ねる量（0でもOK） */
}

/* ===== 吹き出し本体 ===== */
.concierge-bubble{
  position: fixed;
  z-index: 10000;
  max-width: 280px;

  /* ★上下は基本小さめ。空白を作らない */
  padding: 10px 12px 12px 12px;

  border-radius: 14px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;

  overflow: visible;

  /* アニメ */
  opacity: 0;
  transform: translateX(14px);
  transition: opacity .18s ease, transform .18s ease;
  will-change: opacity, transform;
}

/* 表示状態 */
.concierge-bubble.is-show{
  opacity: 1;
  transform: translateX(0);
}

/* しっぽ＆コメットも少し遅れて出す（しゃべってる感） */
.concierge-bubble::before,
.concierge-bubble::after,
.concierge-bubble-comet{
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease;
  transition-delay: .06s;
}

.concierge-bubble.is-show::before,
.concierge-bubble.is-show::after,
.concierge-bubble.is-show .concierge-bubble-comet{
  opacity: 1;
  transform: translateX(0);
}

/* 苦手な人向け：OSの「動きを減らす」を尊重 */
@media (prefers-reduced-motion: reduce){
  .concierge-bubble,
  .concierge-bubble::before,
  .concierge-bubble::after,
  .concierge-bubble-comet{
    transition: none !important;
    transform: none !important;
  }
}

.concierge-bubble-text{
  white-space: pre-line;
  /* ★本文が短い時に詰まって見えるのを軽く緩和 */
  min-height: 0;
}

/* ===== しっぽ：右下・下側 ===== */
/* 外側（枠） */
.concierge-bubble::before{
  content:"";
  position:absolute;
  right: var(--tail-right);
  bottom: calc(-1 * var(--tail-size));
  width: 0;
  height: 0;
  border-left: var(--tail-size) solid transparent;
  border-right: var(--tail-size) solid transparent;
  border-top: var(--tail-size) solid rgba(0,0,0,.12);
}
/* 内側（白） */
.concierge-bubble::after{
  content:"";
  position:absolute;
  right: var(--tail-right);
  bottom: calc(-1 * var(--tail-size) + 1px);
  width: 0;
  height: 0;
  border-left: var(--tail-size) solid transparent;
  border-right: var(--tail-size) solid transparent;
  border-top: var(--tail-size) solid rgba(255,255,255,.96);
}

/* ===== コメットくん：しっぽの“下”にぶら下げる ===== */
.concierge-bubble-comet{
  position: absolute;

  /* ★横：しっぽ中心に合わせる
     しっぽは right を基準に「左・右にtail-size」広がるので、中心は (tail-right + tail-size)
     コメットは中心合わせなので (comet_w/2) を引く
  */
  right: calc(var(--tail-right) + var(--tail-size) - (var(--comet-w) / 2) - 3px);

  /* ★縦：しっぽの下にコメットを配置（少し重ねたいなら comet-overlap を増やす） */
  bottom: calc(-1 * (var(--tail-size) + var(--comet-w) - var(--comet-overlap)));

  width: var(--comet-w);
  height: var(--comet-w);
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.22));
  pointer-events: none;
  user-select: none;
}

/* 検索バー全体：横並び＆縦位置を揃える */
.search-bar{
  display:flex;
  align-items:center;   /* ←縦揃えの本体 */
  flex-wrap:wrap;       /* 画面が狭い時は自然に折り返す */
  gap:10px;             /* margin-left / margin-top の代わり */
}

/* 共通の高さ（ここだけ触れば全員揃う） */
.search-bar{
  --ctl-h: 40px;
}

/* 入力類も高さ統一 */
.search-bar input[type="text"],
.search-bar select{
  height:36px;
  box-sizing:border-box;
}

/* ボタン共通：形・高さ統一 */
.btn{
  height:36px;
  padding:0 12px;
  border:1px solid #666;
  border-radius:6px;
  background:#fff;
  cursor:pointer;
  box-sizing:border-box;
  white-space:nowrap;
}

/* 主要/サブ（色は好みで） */
.btn-main{
  font-weight:600;
}
.btn-sub{
  font-weight:500;
}

/* select はOSによって中身がズレるので微調整 */
.search-bar select{
  padding-right: 28px; /* ▼の分 */
}

/* 館選択エリアは“横並び”に混ぜないで、全幅で次の行へ */
.db-filter-area{
  flex-basis:100%;
  width:100%;
  margin:0;            /* 上下余白は必要ならここで調整 */
}

/* チェックボックス列（画像ありのみ）も高さ揃え */
.search-bar label,
.search-bar .chk-wrap{
  height: var(--ctl-h);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
}

/* チェックボックス自体は小さいので位置だけ中央へ */
.search-bar input[type="checkbox"]{
  margin: 0;
}

/* キーワード欄が伸びるように（任意） */
.search-bar .q-input,
.search-bar input[name="q"]{
  flex: 1 1 420px;
  min-width: 260px;
}

.search-btn-row{
  display:flex;
  align-items:center;   /* ← ここが縦ズレ解消ポイント */
  gap:10px;
  margin-top:8px;
}

/* 幅は自動（文字に合わせる）・高さだけ揃える */
.search-btn-row button,
.search-btn-row .db-filter-toggle{  /* 念のため class 指定にも当てる */
  width:auto;              /* ← 文字列に合わせる */
  height:38px;             /* ← 縦を統一 */
  padding:0 14px;          /* ← 左右余白を統一 */
  line-height:38px;        /* ← 文字の上下ズレ防止 */
  box-sizing:border-box;

  display:inline-flex;     /* ← 中央寄せ */
  align-items:center;
  justify-content:center;

  vertical-align:middle;
  margin:0;                /* ← ブラウザ/既存CSSのズレ潰し */
}

/* もし #toggleDbFilter が <a> など button以外なら保険 */
.search-btn-row a,
.search-btn-row input[type="button"],
.search-btn-row input[type="submit"]{
  height:38px;
  padding:0 14px;
  line-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  margin:0;
}

/* タイトル */
.site-title{
  margin: 0 0 16px;
  padding: 18px 20px;

  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: .04em;

  color: #ffffff;

  /* 青系グラデーション */
  background: linear-gradient(
    135deg,
    #1e3a8a 0%,   /* 濃紺 */
    #2563eb 45%,  /* メイン青 */
    #38bdf8 100%  /* 明るめ */
  );

  border-radius: 12px;

  /* 立体感（やりすぎない） */
  box-shadow:
    0 6px 18px rgba(30,58,138,.25),
    inset 0 1px 0 rgba(255,255,255,.15);
}
.site-title{
  position: relative;
}

.reset-btn{
  margin-left: .5rem;
  padding: 6px 10px;
  border: 1px solid #888;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.reset-btn:hover{ background:#f3f3f3; }

.note-info {
  background: #f0f6ff;
  border-left: 4px solid #2563eb;
  padding: 8px 10px;
  font-size: 13px;
}
/* 検索ボタン（青） */
.btn-primary{
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 700;
}

.btn-primary:hover{
  background: #1d4ed8;
  border-color: #1e40af;
}

.btn-primary:active{
  transform: translateY(1px);
}

.btn-primary:focus-visible{
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

/* 無効時（必要なら） */
.btn-primary:disabled{
  opacity: .55;
  cursor: not-allowed;
}
#search-wait-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-wait-box {
  background: #fff;
  padding: 28px 36px;
  border-radius: 12px;
  text-align: center;
  min-width: 260px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.wait-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}

.wait-sub {
  font-size: 14px;
  color: #444;
}

#wait-seconds {
  font-weight: bold;
  color: #c62828;
}


/* =========================================================
   Mobile result table: allow horizontal overflow intentionally
   - keep PC/tablet intact
   - badges, pager, result table can extend beyond viewport
   ========================================================= */
@media (max-width: 440px) {
  /* 画面全体ははみ出させないが、結果系の部品だけ横スクロール */
  html, body {
    overflow-x: hidden;
  }

  /* 館バッジ・カテゴリバッジ：1行横スクロール */
  .badges {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    width: 100%;
  }

  .badges .badge {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  /* ページャー：1行横スクロール */
  .pager {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .pager ul {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
    white-space: nowrap !important;
  }

  /* 検索結果一覧：テーブルは縮めず、外側だけ横スクロール */
  #results {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  #results > form {
    display: inline-block !important;
    width: max-content !important;
    min-width: max-content !important;
    max-width: none !important;
    overflow: visible !important;
    padding-bottom: 8px;
  }

  #results > form > table,
  #results table {
    width: max-content !important;
    min-width: 1180px !important;
    max-width: none !important;
    table-layout: auto !important;
  }

  #results thead th,
  #results tbody td,
  #results > form > table th,
  #results > form > table td {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: top;
  }

  /* 列幅をしっかり確保 */
  #results > form > table th:nth-child(1),
  #results > form > table td:nth-child(1) { min-width: 90px !important; }

  #results > form > table th:nth-child(2),
  #results > form > table td:nth-child(2) { min-width: 150px !important; }

  #results > form > table th:nth-child(3),
  #results > form > table td:nth-child(3) {
    min-width: 340px !important;
    width: 340px !important;
    white-space: normal !important;
    line-height: 1.45;
  }

  #results > form > table th:nth-child(4),
  #results > form > table td:nth-child(4) {
    min-width: 210px !important;
    width: 210px !important;
    white-space: normal !important;
    line-height: 1.45;
  }

  #results > form > table th:nth-child(5),
  #results > form > table td:nth-child(5) { min-width: 120px !important; }

  #results > form > table th:nth-child(6),
  #results > form > table td:nth-child(6) {
    min-width: 200px !important;
    width: 200px !important;
    white-space: normal !important;
    line-height: 1.45;
  }

  /* 画像列 */
  #results .thumb {
    width: 80px !important;
    max-width: none !important;
    height: auto;
  }

  /* 右下コメット君は固定表示のまま、操作を邪魔しない */
  #mobileComet {
    position: fixed !important;
    right: 10px !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px) !important;
    width: 58px !important;
    z-index: 9998 !important;
    pointer-events: none !important;
  }
}


/* =========================================================
   Mobile: results table must overflow horizontally
   (do not compress columns into viewport)
   ========================================================= */
@media (max-width: 440px) {
  .results-table-scroll {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
  }

  .results-table-scroll > table.results-table-mobile-scroll {
    display: table !important;
    width: auto !important;
    min-width: 1180px !important;
    max-width: none !important;
    table-layout: auto !important;
  }

  .results-table-scroll > table.results-table-mobile-scroll th,
  .results-table-scroll > table.results-table-mobile-scroll td {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: top !important;
  }

  .results-table-scroll > table.results-table-mobile-scroll th { white-space: nowrap !important; }

  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(1) { min-width: 110px !important; white-space: nowrap !important; }
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(2) { min-width: 160px !important; white-space: nowrap !important; }
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(3) {
    min-width: 360px !important; width: 360px !important; white-space: normal !important; line-height: 1.45 !important;
  }
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(4) {
    min-width: 240px !important; width: 240px !important; white-space: normal !important; line-height: 1.45 !important;
  }
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(5) { min-width: 140px !important; white-space: nowrap !important; }
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(6) {
    min-width: 220px !important; width: 220px !important; white-space: normal !important; line-height: 1.45 !important;
  }
}


/* =========================================================
   Results table desktop reset + mobile horizontal scroll
   - desktop/tablet: keep original full-width layout
   - mobile only: overflow horizontally
   ========================================================= */
/* desktop/tablet reset */
.results-table-scroll{
  display:block;
  width:100%;
  max-width:100%;
  overflow:visible;
}
.results-table-scroll > form{
  display:block;
  width:100%;
  min-width:0;
  max-width:none;
}
.results-table-scroll > form > table.results-table-mobile-scroll{
  width:100%;
  min-width:0;
  max-width:none;
  table-layout:auto;
}

@media (max-width: 440px){
  .results-table-scroll{
    overflow-x:auto !important;
    overflow-y:visible !important;
    -webkit-overflow-scrolling:touch;
  }
  .results-table-scroll > form{
    display:block !important;
    width:max-content !important;
    min-width:max-content !important;
    max-width:none !important;
  }
  .results-table-scroll > form > table.results-table-mobile-scroll{
    width:max-content !important;
    min-width:920px !important;
    max-width:none !important;
    table-layout:auto !important;
  }
  .results-table-scroll > form > table.results-table-mobile-scroll th,
  .results-table-scroll > form > table.results-table-mobile-scroll td{
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:normal !important;
    white-space:nowrap !important;
    vertical-align:top !important;
  }
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(1),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(1){min-width:72px !important;}
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(2),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(2){min-width:108px !important;}
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(3),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(3){min-width:220px !important; width:220px !important; white-space:normal !important; line-height:1.4 !important;}
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(4),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(4){min-width:150px !important; width:150px !important; white-space:normal !important; line-height:1.4 !important;}
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(5),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(5){min-width:88px !important;}
  .results-table-scroll > form > table.results-table-mobile-scroll th:nth-child(6),
  .results-table-scroll > form > table.results-table-mobile-scroll td:nth-child(6){min-width:120px !important; width:120px !important; white-space:normal !important; line-height:1.4 !important;}
}


/* =========================================================
   Final mobile result table + comet adjustments
   - desktop/tablet: keep original layout
   - mobile only: horizontal scroll for result table/badges/pager
   ========================================================= */
#mobileComet{display:none;}

.results-table-scroll{
  display:block;
  width:100%;
  max-width:100%;
  overflow:visible;
}
.results-table-scroll > table.results-table-mobile-scroll{
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
  table-layout:auto !important;
}

@media (max-width: 440px){
  #mobileComet{
    display:block;
    position:fixed;
    right:10px;
    bottom:86px;
    z-index:9998;
    pointer-events:none;
    user-select:none;
  }
  #mobileComet img{
    display:block;
    width:64px;
    height:auto;
    filter:drop-shadow(0 4px 10px rgba(0,0,0,.22));
  }

  #conciergeBubble.mobile-fixed{
    position:fixed !important;
    right:82px !important;
    bottom:98px !important;
    left:auto !important;
    top:auto !important;
    max-width:220px;
    z-index:9999;
  }

  .results-table-scroll{
    overflow-x:auto !important;
    overflow-y:visible !important;
    -webkit-overflow-scrolling:touch;
    width:100%;
  }
  .results-table-scroll > table.results-table-mobile-scroll{
    width:max-content !important;
    min-width:760px !important;
    max-width:none !important;
    table-layout:auto !important;
  }
  .results-table-scroll > table.results-table-mobile-scroll th,
  .results-table-scroll > table.results-table-mobile-scroll td{
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:normal !important;
    white-space:nowrap !important;
    vertical-align:top !important;
  }
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(1),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(1){min-width:70px !important;}
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(2),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(2){min-width:100px !important;}
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(3),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(3){min-width:180px !important; width:180px !important; white-space:normal !important; line-height:1.35 !important;}
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(4),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(4){min-width:120px !important; width:120px !important; white-space:normal !important; line-height:1.35 !important;}
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(5),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(5){min-width:76px !important;}
  .results-table-scroll > table.results-table-mobile-scroll th:nth-child(6),
  .results-table-scroll > table.results-table-mobile-scroll td:nth-child(6){min-width:110px !important; width:110px !important; white-space:normal !important; line-height:1.35 !important;}

}
.wait-pc {
    display: block;
}

.wait-mobile {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
}

.wait-spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #d9e3f2;
    border-top: 5px solid #2f80ed;
    border-radius: 50%;
    animation: wait-spin 0.9s linear infinite;
}

.wait-mobile-text {
    margin-top: 14px;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

@keyframes wait-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media screen and (max-width: 480px) {
    .wait-pc {
        display: none;
    }

    .wait-mobile {
        display: flex;
    }
}

/* 検索条件の長いDBリストを枠内で折り返す */
.search-conditions {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* DB行を複数行で折り返す */
.search-conditions .cond-db {
    display: block;
    line-height: 1.6;
}

/* チップ風要素の折り返し */
.search-conditions span,
.search-conditions div {
    flex-wrap: wrap;
}