/* 3D不動産内見AI 固有のスタイル（共通は ../../shared/ui.css） */
.page { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.page h1 { font-size: 20px; margin-bottom: 4px; }
.page .lead { color: var(--muted); margin-bottom: 14px; }

/* 検索 */
.search { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 14px; margin-bottom: 16px; }
.search .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search .row .field { min-width: 140px; flex: 1; }
.search .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.search .count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* 物件カード */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pcard .thumb { position: relative; background: linear-gradient(180deg, #eef2f7, #e6ebf2); height: 170px; display: flex; align-items: center; justify-content: center; }
.pcard .thumb canvas { width: 100%; height: 100%; }
.pcard .thumb .kind { position: absolute; left: 10px; top: 10px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #fff; color: var(--accent-2); box-shadow: var(--shadow); }
.pcard .thumb .fav { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,.95); box-shadow: var(--shadow); font-size: 16px; }
.pcard .thumb .fav.on { color: var(--pink); }
.pcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .price { font-size: 20px; font-weight: 800; color: var(--text); }
.pcard .price small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.pcard .name { font-weight: 700; }
.pcard .meta { color: var(--muted); font-size: 12px; }
.pcard .catch { font-size: 12px; color: #374151; }
.pcard .tags { line-height: 1.4; }
.pcard .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.pcard .actions .btn { flex: 1; justify-content: center; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---- 3D内見の画面（Matterport のように 3D を最大に、操作は下の1列と右上に） ---- */
.viewer-layout { position: relative; height: calc(100vh - 54px); height: calc(100dvh - 54px); overflow: hidden; }
.viewer-layout .stage { position: absolute; inset: 0; }
body.embed .topbar, body.embed #page { display: none !important; }
body.embed .viewer-layout { height: 100vh; height: 100dvh; }

#toast { bottom: 96px; }
/* 主モード（下） */
.mode-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 8; display: flex; gap: 2px; padding: 4px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-radius: 16px; box-shadow: var(--shadow-lg); max-width: calc(100% - 24px); }
.mode-bar .mode { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 68px; padding: 6px 8px; border: none; border-radius: 12px; background: transparent; color: var(--muted); }
.mode-bar .mode .ic { font-size: 20px; line-height: 1.1; }
.mode-bar .mode .lb { font-size: 11px; font-weight: 700; }
.mode-bar .mode.on { background: var(--accent); color: #fff; }
.mode-bar .mode:hover:not(.on) { background: var(--accent-soft); color: var(--accent-2); }

/* 右上のユーティリティ */
.util-bar { position: absolute; right: 12px; top: 12px; z-index: 8; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.ubtn { border: 1px solid var(--line); background: rgba(255,255,255,.94); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--text); box-shadow: var(--shadow); white-space: nowrap; }
.ubtn.on { background: var(--accent-soft); border-color: #bcd0fb; color: var(--accent-2); }
.ubtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ubtn:disabled { opacity: .5; }

/* 測定バー・部屋チップ */
.measure-bar { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 8; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; background: rgba(31,36,48,.88); color: #fff; border-radius: 12px; padding: 8px 12px; max-width: calc(100% - 24px); font-size: 12px; }
.measure-bar .hint { opacity: .85; }
.measure-bar .ubtn { padding: 4px 10px; }
.measure-bar .ml { display: flex; gap: 6px; flex-wrap: wrap; }
.measure-bar .mv { background: #ff8a1e; color: #1f2430; border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.stage.measuring canvas.scene { cursor: crosshair; }
.room-chip { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 8; display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.96); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow-lg); font-size: 14px; }

/* 部屋タブ（左） */
.room-tabs { position: absolute; left: 12px; top: 232px; z-index: 5; display: flex; flex-direction: column; gap: 4px; max-height: calc(100% - 340px); overflow: auto; }
.room-tabs button { text-align: left; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.92); font-size: 12px; box-shadow: var(--shadow); }
.room-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.room-tabs button small { color: inherit; opacity: .7; margin-left: 4px; }
.room-tabs button .cam { font-size: 10px; margin-left: 2px; }
.room-tabs .lv-cap { font-size: 11px; color: var(--muted); padding: 2px 4px; }
.level-tabs { bottom: 92px; }

/* ホットスポットの吹き出し（写真・設備情報） */
.hs-pop { left: 50%; transform: translateX(-50%); bottom: 92px; max-height: 60%; overflow: auto; }
.hs-pop .ph { width: 100%; border-radius: 8px; margin: 6px 0; display: block; }
.hs-pop .spec { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 12px; }
.hs-pop .spec dt { color: var(--muted); }
.hs-pop .spec dd { margin: 0; }

/* 写真の読み込み中 */
.pano-loading { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); z-index: 8; background: rgba(31,36,48,.8); color: #fff; font-size: 12px; padding: 6px 12px; border-radius: 999px; }
/* 写真バッジ */
.pano-badge { position: absolute; left: 12px; bottom: 92px; z-index: 5; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; max-width: min(360px, calc(100% - 24px)); box-shadow: 0 4px 16px rgba(20,30,60,.1); }
.pano-badge b { font-size: 13px; }
.pano-badge .small { color: var(--muted); }
.prop-label { bottom: auto; top: 12px; left: 50%; transform: translateX(-50%); max-width: min(520px, calc(100% - 300px)); text-align: center; }

/* サイドパネル（右からのドロワー。デスクトップ 380px） */
.viewer-layout .side { position: absolute; top: 0; right: 0; bottom: 0; width: 380px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; z-index: 9; transform: translateX(100%); transition: transform .2s ease; box-shadow: -8px 0 30px rgba(20,30,50,.12); }
.viewer-layout.side-open .side { transform: translateX(0); }
.side-tabs .close { flex: none; width: 40px; font-size: 16px; }
.walk-ui .pad { bottom: 100px; }
@media (max-width: 900px) {
  .viewer-layout { height: calc(100vh - 48px); height: calc(100dvh - 48px); }
  .viewer-layout .side { top: auto; left: 0; right: 0; width: auto; height: 62%; transform: translateY(100%); border-left: none; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .viewer-layout.side-open .side { transform: translateY(0); }
  .sheet-handle { display: flex; }
  .mode-bar { bottom: 8px; padding: 3px; border-radius: 14px; }
  .mode-bar .mode { min-width: 52px; padding: 5px 4px; }
  .mode-bar .mode .ic { font-size: 18px; }
  .mode-bar .mode .lb { font-size: 10px; }
  /* 右上のユーティリティは1行の横スクロール（縦に積むと画面を隠す）。部屋タブはその下 */
  .util-bar { left: 120px; right: 8px; top: 8px; gap: 4px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; align-items: center; scrollbar-width: none; padding-bottom: 2px; }
  .util-bar::-webkit-scrollbar { display: none; }
  .ubtn { padding: 5px 9px; font-size: 11px; flex: none; }
  .room-tabs { top: 44px; left: 120px; right: 8px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-height: none; scrollbar-width: none; }
  .mode-bar .mode .lb { white-space: nowrap; font-size: 9.5px; }
  .pano-badge { display: none; }
  .room-tabs::-webkit-scrollbar { display: none; }
  .room-tabs button { padding: 4px 8px; font-size: 11px; flex: none; }
  .room-tabs .lv-cap { display: none; }
  .prop-label { top: auto; bottom: 76px; left: 8px; transform: none; max-width: calc(100% - 16px); text-align: left; padding: 6px 10px; }
  .prop-label .t { font-size: 12px; } .prop-label .s { font-size: 11px; }
  .pano-badge { left: 8px; bottom: 120px; font-size: 11px; padding: 6px 10px; } .pano-badge .small { display: none; }
  .measure-bar, .room-chip { bottom: 76px; }
  .level-tabs { right: 8px; bottom: 76px; }
  .hs-pop { bottom: 76px !important; max-height: 50%; }
  .walk-ui .pad { bottom: 130px; width: 100px; height: 100px; }
  .walk-ui .stick { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .minimap-wrap { left: 8px; top: 8px; } .minimap-wrap canvas { width: 104px; height: 122px; } .minimap-wrap .cap { display: none; }
}

/* サイドパネル */
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.side-price { font-size: 22px; font-weight: 800; }
.side-price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.side-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.side-actions .btn { flex: 1; justify-content: center; }
.roomlist { display: grid; gap: 4px; }
.roomlist button { display: flex; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); text-align: left; }
.roomlist button.on { border-color: var(--accent); background: var(--accent-soft); }
.ai-sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.ai-sec .t { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ai-sec .t .ic { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
.ai-sec ul { margin: 6px 0 0; padding-left: 18px; }
.ai-sec li { margin: 2px 0; }
.ai-note { font-size: 11px; color: var(--muted); }
.ai-ask { display: flex; gap: 6px; margin-top: 10px; }
.ai-ask input { flex: 1; }
.ai-loading { padding: 20px; text-align: center; color: var(--muted); }
.ai-loading::before { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin-right: 8px; vertical-align: middle; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pt-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.pt-item .dot { width: 26px; height: 26px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; font-size: 13px; }
.pt-item .t { font-weight: 600; font-size: 13px; }
.pt-item .b { font-size: 12px; color: var(--muted); }

/* 比較表 */
.cmp-wrap { overflow-x: auto; }
.cmp { border-collapse: collapse; width: 100%; min-width: 640px; background: var(--panel); }
.cmp th, .cmp td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; font-size: 13px; }
.cmp th { background: var(--panel-2); color: var(--muted); font-weight: 600; width: 120px; }
.cmp td.best { background: #ecfdf5; }
.cmp .pname { font-weight: 700; }
.cmp canvas { width: 160px; height: 110px; display: block; border-radius: 6px; border: 1px solid var(--line); }

/* 予約フォーム */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.reserve-summary { background: var(--panel-2); border-radius: 8px; padding: 10px; font-size: 13px; margin-bottom: 10px; }

/* 家具パネル */
.furn-list { display: grid; gap: 4px; margin-top: 8px; }
.furn-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.furn-item .t { font-weight: 600; font-size: 13px; }
.furn-temp { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; margin-bottom: 4px; }
.furn-temp.v-ok { border-left-color: var(--ok); } .furn-temp.v-warn { border-left-color: var(--warm); } .furn-temp.v-err { border-left-color: var(--danger); }
.furn-temp .acts { display: flex; gap: 4px; flex: none; }
.furn-panel .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
/* AI チャット */
.ai-chat { display: flex; flex-direction: column; gap: 8px; min-height: 60vh; }
.ai-log { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 48vh; padding: 4px 0; }
.ai-log .msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.ai-log .msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-log .msg.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-log .msg .t { font-weight: 700; margin-bottom: 2px; }
.ai-log .msg ul { margin: 6px 0 0; padding-left: 18px; }
.ai-chat .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-chat .quota { text-align: right; }
/* 写真（一覧カード） */
.pcard .thumb .thumb-img { width: 100%; height: 170px; object-fit: cover; display: block; }
.pcard .thumb .nphoto { position: absolute; right: 44px; top: 10px; font-size: 11px; background: rgba(31,36,48,.7); color: #fff; padding: 2px 7px; border-radius: 999px; }
.photo-groups { display: flex; flex-direction: column; gap: 4px; }
