:root {
  color-scheme: dark;
  --ink: #0e0e0d;
  --paper: #faf9f6;
  --line: rgba(255, 255, 255, .16);
  --ease: cubic-bezier(.2, .6, .35, 1);
  --ease2: cubic-bezier(.35, 1, .7, 1);
  --gut: clamp(16px, 2.6vw, 42px);
  --font-display: "ITC Avant Garde Gothic LT", "Helvetica Neue", Arial, sans-serif;
  --font-jp: "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--font-jp);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: -.01em;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; }

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  transition: opacity .4s var(--ease);
}

canvas.is-dragging { cursor: grabbing; }

/* ── 画面内ナビゲーション（床のマーカー）─────────────────── */

#hotspots {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

/* 床は明るいタイルのことも濃い木のこともあるので、白い線＋暗い落ち影の2枚重ねで
   どちらの床でも輪郭が消えないようにしている（白床で完全に見えなくなる事故があった）。 */
#hotspots .hs { pointer-events: auto; cursor: pointer; filter: drop-shadow(0 1px 2.5px rgba(0, 0, 0, .55)); }
#hotspots .hs-disc { fill: rgba(255, 255, 255, .16); stroke: rgba(255, 255, 255, .92); stroke-width: 1.5; }
#hotspots .hs-core { fill: #fff; }
#hotspots .hs-ring { fill: none; stroke: rgba(255, 255, 255, .62); stroke-width: 1.1; }
#hotspots .hs:hover .hs-disc, #hotspots .hs:focus-visible .hs-disc { fill: rgba(255, 255, 255, .34); stroke: #fff; }
#hotspots .hs:focus-visible { outline: none; }
#hotspots .hs:focus-visible .hs-ring { stroke: #fff; stroke-dasharray: 3 3; }

.hs-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 5px 10px;
  background: rgba(14, 14, 13, .66);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s var(--ease);
}

.hs-label.is-on { opacity: 1; }

/* ── 上部 ───────────────────────────────────────────── */

.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: var(--gut);
  pointer-events: none;
  background: linear-gradient(rgba(14, 14, 13, .62), rgba(14, 14, 13, 0));
}

.brand { color: #fff; min-width: 0; }
.brand svg { display: block; width: clamp(96px, 9vw, 132px); height: auto; color: #fff; }
.brand small {
  display: block;
  margin-top: 9px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: .24em;
  color: rgba(255, 255, 255, .58);
  white-space: nowrap;   /* 「REMODEL ／ 360° VIRTUAL TOUR」を2行に折らない */
}

.room { margin: 0; text-align: right; min-width: 0; }
.room .en {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: .24em;
  color: rgba(255, 255, 255, .58);
  text-transform: uppercase;
  white-space: nowrap;
}
.room .jp {
  display: block;
  margin-top: 6px;
  font-family: "ot-pa1-mincho-stdn", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(16px, 1.7vw, 23px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .06em;
  color: #fff;
  /* 和文は既定でどこでも折れる。「マスターベッドルー／ム」になるので折らせない */
  white-space: nowrap;
}

/* ── 間取りパネル ────────────────────────────────────── */

.plan {
  position: absolute;
  left: var(--gut);
  bottom: var(--gut);
  z-index: 4;
  width: clamp(250px, 25vw, 372px);
  background: var(--paper);
  color: #1c1b1b;
  border: 1px solid rgba(28, 27, 27, .18);
}

.plan__hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid #d9d6d1;
}

.plan__hd b {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2em;
  color: #747878;
  text-transform: uppercase;
}

.plan__hd span { font-size: 11px; color: #747878; letter-spacing: .02em; }

.plan__body { position: relative; padding: 11px 12px 12px; }
.plan__fig { position: relative; aspect-ratio: 841.89 / 595.28; }
.plan__fig svg.floorplan { display: block; width: 100%; height: 100%; color: #57595a; }
.plan__fig svg.floorplan #labels,
.plan__fig svg.floorplan .total { display: none; }
.plan__fig svg.floorplan #furniture { opacity: .5; }

.plan__overlay { position: absolute; inset: 0; }

.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  line-height: 0;
}

/* 図面の家具線と見分けがつくよう、公開ページの室ピンと同じ丸印にして、
   まわりに紙色のリングを回して線画から浮かせている。 */
.pin i {
  display: block;
  width: 9px;
  height: 9px;
  border: 1.5px solid #1c1b1b;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 2.5px var(--paper);
  transition: background .3s var(--ease), transform .3s var(--ease);
}

.pin:hover i, .pin:focus-visible i { background: #1c1b1b; transform: scale(1.25); }
.pin:focus-visible { outline: 1px solid #1c1b1b; outline-offset: 4px; }
.pin[aria-current="true"] i { background: #1c1b1b; border-color: #1c1b1b; }

.pin u {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  font-size: 9.5px;
  line-height: 1.3;
  letter-spacing: .02em;
  text-decoration: none;
  color: #1c1b1b;
  opacity: 0;
  transition: opacity .25s var(--ease);
}

.pin:hover u, .pin:focus-visible u, .pin[aria-current="true"] u { opacity: 1; }
.pin[aria-current="true"] u { font-weight: 500; }

/* 現在地マーカーと視野 */
.here { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.here__cone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  /* 視野は 54°。conic-gradient の基準が真上なので、JS 側で yaw+90 して回す */
  background: conic-gradient(from -27deg, rgba(28, 27, 27, .34), rgba(28, 27, 27, .06) 40deg, rgba(28, 27, 27, 0) 54deg);
  clip-path: circle(50% at 50% 50%);
}
.here__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  background: #1c1b1b;
  border: 2px solid var(--paper);
}

.plan__toggle {
  display: none;
  position: absolute;
  left: var(--gut);
  bottom: var(--gut);
  z-index: 4;
}

/* ── 右下のコントロール ───────────────────────────────── */

.tools {
  position: absolute;
  right: var(--gut);
  bottom: var(--gut);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.zoom { display: flex; gap: 1px; }

button.ui {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(14, 14, 13, .58);
  backdrop-filter: blur(6px);
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: .06em;
  line-height: 1;
  padding: 10px 13px;
  min-width: 38px;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}

button.ui:hover, button.ui:focus-visible { background: var(--paper); color: #1c1b1b; border-color: var(--paper); }
button.ui:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--paper); }

/* ── 状態表示 ───────────────────────────────────────── */

.status {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .18em;
  color: rgba(255, 255, 255, .7);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s var(--ease);
}

.status.is-on { opacity: 1; }

/* ── 埋め込み／狭い画面 ───────────────────────────────── */

body.is-embed .brand small { display: none; }

/* 埋め込み時のスマホは、ページ側の固定CTAバーが枠の下端に重なるので操作系を少し上げる */
@media (max-width: 760px) {
  body.is-embed { --gut: 14px; }
  body.is-embed .tools, body.is-embed .plan__toggle { bottom: 28px; }
  body.is-embed .plan.is-open { bottom: 74px; }
}

/* 埋め込み枠が低いときは間取りパネルを縮める／畳む */
@media (max-height: 620px) { .plan { width: clamp(200px, 21vw, 250px); } }
@media (max-height: 460px) {
  .plan { display: none; }
  .plan.is-open { display: block; }
  .plan__toggle { display: block; }
}

@media (max-width: 900px) {
  .plan { display: none; }
  .plan.is-open { display: block; width: min(360px, calc(100vw - var(--gut) * 2)); bottom: calc(var(--gut) + 46px); }
  .plan__toggle { display: block; }
}

@media (max-width: 560px) {
  .top { gap: 10px; }
  .room .jp { font-size: 15px; letter-spacing: .02em; }
  .room .en { font-size: 9px; letter-spacing: .14em; }
  .brand svg { width: 84px; }
  .brand small { font-size: 9px; letter-spacing: .12em; margin-top: 7px; }
}

/* さらに狭い端末（iPhone SE 等）。ここまで詰めれば10文字の室名も1行で収まる */
@media (max-width: 400px) {
  .room .jp { font-size: 14px; }
  .brand svg { width: 76px; }
  .brand small { font-size: 8px; letter-spacing: .08em; }
}

@media (prefers-reduced-motion: reduce) {
  canvas, .hs-label, .pin i, .pin u, button.ui, .status { transition-duration: .01ms !important; }
}
