/* sumai3d 共通UI。コンセプト画像（明るい白壁・淡い木目・左上に間取りミニマップ・下に物件ラベル）に寄せた
   ライトテーマ。内見・リフォームの両アプリで使う。 */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #e3e6eb;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #e8efff;
  --warm: #f59e0b;
  --danger: #ef4444;
  --ok: #10b981;
  --pink: #ec4899;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 30, 50, .10);
  --shadow-lg: 0 10px 30px rgba(20, 30, 50, .18);
  --font: "Noto Sans JP", -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; font-size: 13px; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
h1, h2, h3 { margin: 0; font-weight: 700; }
[hidden] { display: none !important; }

/* ---- ヘッダー ---- */
.topbar { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .logo { font-weight: 800; font-size: 16px; letter-spacing: .01em; white-space: nowrap; }
.topbar .logo b { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; margin-left: auto; }
.topbar nav a { padding: 7px 12px; border-radius: 999px; color: var(--text); font-size: 13px; }
.topbar nav a.on, .topbar nav a:hover { background: var(--accent-soft); color: var(--accent-2); }
.topbar .badge { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.topbar .pill { font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; color: var(--muted); }

/* ---- ボタン ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); transition: background .12s, border-color .12s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: #c9d2e0; background: #fbfcfe; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.on { background: var(--accent-soft); border-color: #bcd0fb; color: var(--accent-2); font-weight: 600; }
.btn.warm.on { background: #fff4df; border-color: #f7d28f; color: #b45309; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 8px; width: 36px; justify-content: center; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---- カード・フォーム ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.input, .select, textarea.input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); width: 100%; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--text); cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: #bcd0fb; color: var(--accent-2); font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: #475569; margin: 2px 4px 2px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grade { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; letter-spacing: .03em; }
.grade.basic { background: #eef2f7; color: #475569; }
.grade.standard { background: #e0ecff; color: #1d4ed8; }
.grade.premium { background: #fdf0d5; color: #b45309; }

/* ---- モーダル ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 20, 30, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: 90vh; overflow: auto; }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; position: sticky; top: 0; background: var(--panel); }
.modal .m-body { padding: 18px 20px; }
.modal .m-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal .x { border: none; background: transparent; font-size: 20px; color: var(--muted); }
.modal.wide { width: min(960px, 100%); }

/* ---- トースト ---- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1f2430; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 200; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 3Dステージ（共通）---- */
.stage { position: relative; background: #dfe7f0; overflow: hidden; }
.stage canvas.scene { width: 100%; height: 100%; display: block; touch-action: none; }
.minimap-wrap { position: absolute; left: 12px; top: 12px; z-index: 5; }
.minimap-wrap canvas { display: block; border-radius: 10px; box-shadow: var(--shadow); background: #fff; cursor: pointer; }
.minimap-wrap .cap { position: absolute; left: 0; right: 0; bottom: -18px; font-size: 10px; color: rgba(31,36,48,.7); text-align: center; }
.prop-label { position: absolute; left: 12px; bottom: 12px; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow); max-width: min(420px, calc(100% - 24px)); }
.prop-label .t { font-weight: 700; font-size: 14px; }
.prop-label .s { font-size: 12px; color: var(--muted); }
.stage-toolbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px); }
.stage-toolbar .btn { box-shadow: var(--shadow); }
.walk-ui { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.walk-ui .pad { position: absolute; left: 20px; bottom: 90px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.7); pointer-events: auto; touch-action: none; display: none; }
.walk-ui .stick { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: var(--shadow); }
/* ---- 写真 ---- */
.photo-strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: thin; }
.ps-item { flex: none; width: 112px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); padding: 0; text-align: left; }
.ps-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.ps-item .ps-cap { display: block; font-size: 10px; color: var(--muted); padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bg { position: fixed; inset: 0; background: rgba(10, 14, 24, .88); z-index: 200; display: flex; align-items: center; justify-content: center; }
.lb-body { max-width: min(96vw, 1200px); max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb-img { max-width: 96vw; max-height: 84vh; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lb-cap { color: #fff; font-size: 13px; }
.lb-x { position: fixed; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 34px; border-radius: 10px; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.level-tabs { position: absolute; right: 12px; bottom: 14px; z-index: 6; display: flex; gap: 4px; background: rgba(255,255,255,.92); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.level-tabs button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.level-tabs button.on { background: var(--accent); color: #fff; }
.walk-ui .hint { position: absolute; right: 12px; top: 52px; background: rgba(31,36,48,.75); color: #fff; font-size: 11px; padding: 6px 10px; border-radius: 8px; }
@media (pointer: coarse) { .walk-ui .pad { display: block; } .level-tabs { position: absolute; right: 12px; bottom: 14px; z-index: 6; display: flex; gap: 4px; background: rgba(255,255,255,.92); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.level-tabs button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.level-tabs button.on { background: var(--accent); color: #fff; }
.walk-ui .hint { display: none; } }
.hs-pop { position: absolute; z-index: 8; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px 14px; width: min(320px, calc(100% - 24px)); }
.hs-pop .t { font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.hs-pop .k { font-size: 10px; padding: 2px 7px; border-radius: 999px; color: #fff; }
.hs-pop .x { position: absolute; right: 8px; top: 6px; border: none; background: transparent; font-size: 18px; color: var(--muted); }

/* ---- レイアウト（アプリ共通の2ペイン）---- */
.app-2col { display: grid; grid-template-columns: 1fr 360px; height: calc(100vh - 54px); }
.app-2col .side { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.side-tabs button { flex: 1; border: none; background: transparent; padding: 12px 6px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.side-tabs button.on { color: var(--accent-2); border-bottom-color: var(--accent); }
.side-body { padding: 14px; }
.side-body h3 { font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.side-body h3:first-child { margin-top: 0; }
.sheet-handle { display: none; }
@media (max-width: 900px) {
  .app-2col { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .app-2col .side { border-left: none; border-top: 1px solid var(--line); max-height: 42vh; }
  .app-2col.sheet-collapsed .side { max-height: 44px; overflow: hidden; }
  .sheet-handle { display: flex; justify-content: center; padding: 6px; cursor: pointer; }
  .sheet-handle span { width: 40px; height: 4px; border-radius: 2px; background: #cfd5df; }
  .topbar { padding: 0 10px; gap: 8px; height: 48px; }
  .topbar .badge { display: none; }
  .topbar .logo { font-size: 14px; }
  .topbar nav { overflow-x: auto; scrollbar-width: none; }
  .topbar nav a { padding: 6px 7px; font-size: 12px; white-space: nowrap; }
  /* ステージ: ツールバーは下端の横スクロール1行、ミニマップは小さく、部屋タブは上の横一列 */
  .stage-toolbar { top: auto; bottom: 8px; left: 8px; right: 8px; transform: none; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; max-width: none; padding-bottom: 2px; scrollbar-width: none; }
  .stage-toolbar::-webkit-scrollbar { display: none; }
  .stage-toolbar .btn { padding: 6px 10px; font-size: 12px; flex: none; }
  .minimap-wrap { left: 8px; top: 8px; }
  .minimap-wrap canvas { width: 104px; height: 122px; }
  .minimap-wrap .cap { display: none; }
  .prop-label { bottom: 52px; left: 8px; padding: 6px 10px; max-width: calc(100% - 16px); }
  .prop-label .t { font-size: 12px; }
  .prop-label .s { font-size: 11px; }
  .hs-pop { bottom: 100px !important; }
  .walk-ui .pad { bottom: 110px; width: 100px; height: 100px; }
  .walk-ui .stick { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
}
