:root {
  color-scheme: dark;
  --bg: #0a1710;
  --panel: #10271b;
  --line: rgba(214, 255, 230, 0.16);
  --text: #f4fbf6;
  --muted: #b7d4c2;
  --accent: #7ee2a8;
  --accent-strong: #06b14e;
  --warning: #ffd58a;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(38, 166, 100, 0.22), transparent 36%),
    var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button,
#viewer {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: flex;
  width: min(100%, 980px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  flex-direction: column;
  gap: 12px;
}

.tour-header {
  padding: 2px 2px 0;
}

.eyebrow,
.guide-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* 小さい文字が「短いラベル」ではなく「文章」を持つとき（サンプルの案内）。
   字間を詰めて行間を空け、2行になっても読みやすくする。 */
.eyebrow--notice {
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

#tour-title {
  margin: 5px 0 3px;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

#tour-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* hidden を付けたら本当に消えるようにする。
   display を指定していると hidden 属性が打ち消されてしまい、
   文字だけ消えて場所が残る（2026-07-28 の実機で発生）。 */
#status[hidden],
#tour-note[hidden],
#viewer[hidden],
.room-navigation[hidden],
.tour-guide[hidden],
.error-guide[hidden] {
  display: none !important;
}

#status {
  display: flex;
  min-height: 44px;
  margin: 0;
  padding: 11px 13px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 39, 27, 0.9);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

#liff-diagnostic {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px) + 92px);
  z-index: 20;
  width: min(calc(100vw - 16px), 360px);
  max-width: calc(100vw - 16px);
  max-height: min(30vh, 180px);
  margin: 0;
  padding: 3px 8px;
  border: 1px solid rgba(214, 255, 230, 0.2);
  border-radius: 10px;
  background: rgba(5, 16, 10, 0.86);
  color: #94bda6;
  font-size: 0.65rem;
  line-height: 1.3;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: pre-wrap;
}

#viewer {
  position: relative;
  width: 100%;
  height: clamp(440px, calc(100dvh - 170px), 900px);
  min-height: 420px;
  flex: 1 1 auto;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #04120b;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  touch-action: none;
}

#viewer:empty::after {
  position: absolute;
  top: calc(50% - 29px);
  left: calc(50% - 10px);
  width: 20px;
  height: 20px;
  content: "";
  border: 2px solid rgba(126, 226, 168, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: viewer-spin 0.85s linear infinite;
}

#viewer > *,
#viewer canvas,
#viewer .psv-container,
#viewer .psv-canvas-container,
#viewer .psv-canvas {
  width: 100%;
  height: 100%;
}

#viewer .psv-container {
  font-family: inherit;
  background: #04120b;
}

#viewer .psv-marker--html {
  display: grid;
  place-items: center;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#viewer .psv-marker--html button,
#viewer .psv-marker button {
  display: inline-flex;
  min-width: 132px;
  min-height: 56px;
  width: auto;
  height: auto;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 4px solid rgba(255, 255, 255, 0.98);
  border-radius: 999px;
  background: rgba(6, 26, 16, 0.94);
  box-shadow: 0 0 0 4px rgba(3, 14, 8, 0.78), 0 10px 28px rgba(0, 0, 0, 0.52);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  touch-action: manipulation;
  user-select: none;
  transition: transform 120ms ease, background-color 120ms ease;
}

#viewer .psv-marker--html .tour-link,
#viewer .psv-marker .tour-link {
  display: inline-flex !important;
  min-width: 132px !important;
  min-height: 56px !important;
  width: auto !important;
  height: auto !important;
  padding: 10px 16px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  border: 4px solid #fff !important;
  border-radius: 999px !important;
  background: rgba(6, 26, 16, 0.94) !important;
  box-shadow: 0 0 0 4px rgba(3, 14, 8, 0.78), 0 10px 28px rgba(0, 0, 0, 0.52) !important;
  color: #fff !important;
  font-size: clamp(0.9rem, 2.7vw, 1.05rem) !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#viewer .psv-marker--html .tour-link::before,
#viewer .psv-marker .tour-link::before {
  content: none !important;
  display: none !important;
}

#viewer .psv-marker--html .tour-link .tour-link__icon,
#viewer .psv-marker .tour-link .tour-link__icon {
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

#viewer .psv-marker--html .tour-link .tour-link__label,
#viewer .psv-marker .tour-link .tour-link__label {
  display: block !important;
  min-width: 0;
  max-width: min(58vw, 220px);
  overflow: hidden;
  color: #fff !important;
  font-size: inherit !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#viewer .psv-marker--html button::before,
#viewer .psv-marker button::before {
  content: none;
  display: none;
}

#viewer .psv-marker--html button:active,
#viewer .psv-marker button:active {
  background: var(--accent-strong) !important;
  transform: scale(0.92);
}

#viewer .psv-marker--html button:focus-visible,
#viewer .psv-marker button:focus-visible,
#retry:focus-visible,
#next-room-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.room-navigation {
  position: sticky;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: flex;
  min-height: 82px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(126, 226, 168, 0.32);
  border-radius: 16px;
  background: rgba(8, 26, 17, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  opacity: 1;
  visibility: visible;
}

.room-navigation__route {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
}

.room-navigation__place {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  gap: 3px;
}

.room-navigation__label {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.room-navigation__place strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(0.92rem, 3vw, 1.12rem);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-navigation__arrow {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

/* 「戻る」と「進む」を並べる入れ物（app.js が作る） */
.room-navigation__buttons {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* 「前のお部屋へ戻る」。主役は「進む」なので、こちらは枠線だけの控えめな見た目にする */
#prev-room-button {
  display: inline-flex;
  min-width: 92px;
  min-height: 52px;
  padding: 10px 14px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.15;
  touch-action: manipulation;
}

#prev-room-button[hidden] {
  display: none;
}

#prev-room-button:active {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(1px) scale(0.98);
}

#prev-room-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

#prev-room-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

#next-room-button {
  display: inline-flex;
  min-width: 136px;
  min-height: 52px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.38);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.15;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  touch-action: manipulation;
}

#next-room-button[hidden] {
  display: none;
}

#next-room-button:active {
  background: #059441;
  transform: translateY(1px) scale(0.98);
}

#next-room-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

/* 最後のお部屋で出す行き先ボタン（LINEの友だち追加など・app.js が作る）。
   LINEだと一目で分かるよう、LINEの緑をそのまま使う。
   販売終了の画面のボタン（#sold-link-button）も同じ見た目にする。 */
#end-link-button,
#sold-link-button {
  display: inline-flex;
  min-width: 136px;
  min-height: 52px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: #06c755;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.38);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}

#end-link-button[hidden],
#sold-link-button[hidden] {
  display: none;
}

#end-link-button:active,
#sold-link-button:active {
  background: #05a948;
  transform: translateY(1px) scale(0.98);
}

#end-link-button:focus-visible,
#sold-link-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* 販売が終わった物件で出す画面（app.js が作る）。
   写真の代わりに、ここだけが表示される。 */
.sold-notice {
  display: flex;
  /* 上下の余白を等分にして、画面の真ん中に置く。
     上に寄せたままだと下が大きく空いて「読み込みに失敗した画面」に見えるため。
     （.app-shell が min-height:100dvh の縦並びなので、margin auto で中央に寄る） */
  margin-block: auto;
  padding: 28px 20px;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 39, 27, 0.82);
  text-align: center;
}

.sold-notice[hidden] {
  display: none !important;
}

/* 物件名。どの物件のことか分かるように出す */
.sold-notice__property {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.sold-notice__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.room-navigation__button-icon {
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
}

#viewer .psv-tooltip {
  max-width: min(72vw, 280px);
  font-family: inherit;
  line-height: 1.35;
}

.tour-guide {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 39, 27, 0.82);
}

.tour-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

/* 操作方法の箇条書き。スマホで一目で読めるよう、行を短く詰めて出す */
.tour-guide .guide-list {
  margin: 0;
  padding: 0 0 0 1.1em;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.tour-guide .guide-list li {
  margin: 0;
}

.tour-guide .guide-label {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.8rem;
}

.tour-guide .asset-note {
  margin-top: 8px;
  color: #94bda6;
  font-size: 0.75rem;
}

/* 画面の一番下に出すホームページのボタン（app.js が作る）。
   tour.json に homeLink を書いた物件だけに出る（2026-08-02 追加・いまはサンプルのみ）。
   案内ページ（0yen.love の物件ページ）の副ボタンと同じ「白地に緑文字」で揃える。
   最後のお部屋で出る #end-link-button はLINEの緑なので、見た目がぶつからない。 */
#home-link-button {
  display: flex;
  min-height: 48px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #0d7a42;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}

#home-link-button[hidden] {
  display: none;
}

#home-link-button:active {
  background: #eef7f1;
  transform: translateY(1px) scale(0.99);
}

#home-link-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

code {
  padding: 0.12em 0.34em;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.24);
  color: #d8f1ff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

#retry {
  align-self: flex-start;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(126, 226, 168, 0.55);
  border-radius: 999px;
  background: rgba(29, 155, 240, 0.18);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  touch-action: manipulation;
}

#retry:active {
  background: rgba(29, 155, 240, 0.38);
  transform: translateY(1px);
}

#retry[hidden] {
  display: none;
}

.error-guide {
  margin: 0;
  color: var(--warning);
  font-size: 0.74rem;
  line-height: 1.5;
}

noscript {
  display: block;
  padding: 16px;
  color: var(--warning);
  text-align: center;
}

@keyframes viewer-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (orientation: portrait) and (max-width: 600px) {
  #liff-diagnostic {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px) + 138px);
  }

  .app-shell {
    gap: 10px;
  }

  #viewer {
    height: clamp(380px, 72dvh, 700px);
    min-height: 360px;
  }

  .room-navigation {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .room-navigation__route {
    width: 100%;
  }

  .room-navigation__buttons {
    width: 100%;
  }

  #prev-room-button {
    flex: 0 0 auto;
  }

  #next-room-button {
    flex: 1 1 auto;
    width: auto;
    min-height: 52px;
  }

  #end-link-button {
    flex: 1 1 auto;
    width: auto;
    min-height: 52px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    gap: 8px;
  }

  #viewer {
    height: calc(100dvh - 142px);
    min-height: 220px;
  }

  .tour-guide,
  .error-guide,
  #home-link-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #viewer:empty::after {
    animation: none;
  }

  #viewer .psv-marker--html button,
  #viewer .psv-marker button,
  #retry {
    transition: none;
  }
}

/* 「LINEに戻る」ボタン（LINEアプリの中で開いたときだけ app.js が作る）。
   主役は内見なので、控えめな枠線だけの見た目にする。 */
#close-liff-button {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 2px 0 4px;
  padding: 12px 16px;
  border: 1.5px solid rgba(126, 226, 168, 0.55);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  touch-action: manipulation;
}

#close-liff-button:active {
  background: rgba(126, 226, 168, 0.14);
  transform: translateY(1px) scale(0.99);
}

#close-liff-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
