﻿html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
/* ========== スマホ操作時の選択色・長押しメニュー・タップ色を抑制 ========== */
html,
body,
#app {
  -webkit-user-select: none;
  user-select: none;

  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;

  overscroll-behavior: none;
  touch-action: none;
}

* {
  -webkit-tap-highlight-color: transparent;
}
img,
button,
canvas {
  -webkit-user-select: none;
  user-select: none;

  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
}

canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;

  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#camera-ui {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;

  display: flex;
  align-items: center;

  max-width: calc(100vw - 36px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
#page-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;

  min-height: 40px;
  padding: 0 8px;

  color: #fff;
  font-family:
    "Yu Mincho",
    "Hiragino Mincho ProN",
    "Noto Serif JP",
    serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.camera-row {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 8;

  display: flex;
  align-items: center;
  box-sizing: border-box;
  gap: 8px;
  width: auto;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.camera-row .camera-button {
  flex: 0 0 auto;
}
.camera-button {
  appearance: none;
  border: none;
  box-shadow: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  box-sizing: border-box;
  white-space: nowrap;
}

.camera-button-sub {
  height: 36px;
  padding: 0 13px;
  font-size: 11.5px;
}

.camera-button-sub.is-active {
  background: rgba(255, 255, 255, 0.9);
  color: #111;
}

.camera-button:focus {
  outline: none;
}

#hotspot-layer {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.hotspot-button {
  --hotspot-scale: 1;

  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: rgba(230, 0, 18, 0.94);
  color: #fff;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.42),
    inset 0 0 0 5px rgba(255, 255, 255, 0.18);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  transform: translate(-50%, -50%) scale(var(--hotspot-scale));
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
  pointer-events: auto;
}

.hotspot-button::before {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: hotspotPulse 1.8s ease-out infinite;
}

.hotspot-button:hover,
.hotspot-button.is-active {
  background: rgba(255, 255, 255, 0.95);
  color: #111;
}

.hotspot-button.has-custom-icon {
  width: 96px;
  height: 96px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.hotspot-button.has-custom-icon::before {
  display: none;
}

.hotspot-button.has-custom-icon:hover,
.hotspot-button.has-custom-icon.is-active {
  background: transparent;
  color: inherit;
}

.hotspot-button.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.hotspot-button.is-debug-index {
  font-size: 18px;
}

.hotspot-icon-text {
  position: relative;
  z-index: 1;
}

.hotspot-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.42));
  transition: filter 0.18s ease;
}

.hotspot-button.has-custom-icon:hover .hotspot-icon-image,
.hotspot-button.has-custom-icon.is-active .hotspot-icon-image {
  filter:
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.48))
    brightness(1.08);
}

#hotspot-detail {
  position: fixed;
  left: 50%;
  bottom: clamp(20px, 5vh, 56px);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  min-height: 68px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

#hotspot-detail.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

#hotspot-detail-name {
  max-width: min(52vw, 420px);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

#btn-open-hotspot-link,
#btn-close-hotspot-detail {
  appearance: none;
  border: none;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

#btn-open-hotspot-link {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4d26a, #b77b1d);
  color: #231300;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.38),
    inset 0 0 0 2px rgba(255, 255, 255, 0.36),
    inset 0 -5px 10px rgba(80, 44, 0, 0.18);
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.panorama-icon {
  display: block;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

#btn-close-hotspot-detail {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

#btn-close-hotspot-detail:hover {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
}

#btn-open-hotspot-link:hover {
  background: linear-gradient(145deg, #ffe28a, #c88b25);
  color: #1c1000;
  transform: translateY(-1px);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.44),
    inset 0 0 0 2px rgba(255, 255, 255, 0.48),
    inset 0 -5px 10px rgba(80, 44, 0, 0.16);
}

@keyframes hotspotPulse {
  from {
    opacity: 0.85;
    transform: scale(0.72);
  }

  to {
    opacity: 0;
    transform: scale(1.35);
  }
}

#loading,
#error {
  position: fixed;
  inset: 0;
  z-index: 10;
  place-items: center;
  background: #111;
  color: #fff;
}

#loading {
  display: grid;
}

#error {
  display: none;
}

#error.is-visible {
  display: grid;
}
#error h1 {
  margin: 0 0 12px;
  font-size: 20px;
}

#error p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  word-break: break-all;
  white-space: pre-wrap;
  text-align: left;
}
.loading-box,
.error-box {
  width: min(420px, calc(100vw - 40px));
  padding: 28px;
  box-sizing: border-box;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.loading-progress {
  position: relative;
  width: 100%;
  height: 12px;
  margin: 0 auto 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 8px 22px rgba(0, 0, 0, 0.26);
}

#loading-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #c99b2e 0%, #f4d67c 52%, #fff0b8 100%);
  box-shadow: 0 0 18px rgba(244, 214, 124, 0.42);
  transition: width 0.24s ease-out;
}

#loading-progress-percent {
  margin-bottom: 10px;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

#loading-text {
  font-size: 16px;
  line-height: 1.6;
}

#loading-detail {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.75;
}

/* ========== 初回説明オーバーレイ ========== */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 10px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.18s ease;
}

#intro-overlay.is-hiding {
  opacity: 0;
  pointer-events: none;
}

#intro-overlay:focus {
  outline: none;
}

.intro-overlay-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(750px, 900px, calc(100vw - 20px));
  max-height: min(750px, 900px, calc(100vh - 20px));
  max-height: min(750px, 900px, calc(100dvh - 20px));
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* ========== スマホ回線向け画像メニュー ========== */
#app.is-image-menu {
  background: #000;
}

#app.is-image-menu .camera-row {
  display: none;
}

#sp-image-menu {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

.sp-image-menu-stage {
  position: relative;
  width: min(86vw, 86vh);
  width: min(86vw, 86dvh);
  height: min(86vw, 86vh);
  height: min(86vw, 86dvh);
  flex: 0 0 auto;
}

.sp-image-menu-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.sp-image-menu-hotspots {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.sp-map-hotspot {
  --sp-map-hotspot-size: clamp(68px, 10.2%, 118px);

  position: absolute;
  width: var(--sp-map-hotspot-size);
  height: var(--sp-map-hotspot-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    filter 0.18s ease,
    transform 0.18s ease;
}

.sp-map-hotspot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

.sp-map-hotspot:hover,
.sp-map-hotspot:focus-visible {
  filter: brightness(1.08);
  transform: translate(-50%, -50%) scale(1.04);
}

.sp-map-hotspot:focus {
  outline: none;
}

.sp-map-hotspot:focus-visible {
  outline: 2px solid #c4ad68;
  outline-offset: 4px;
}

.sp-image-menu-switch-button {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 7;
  transform: translateX(-50%);

  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 32px));
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  background: #c4ad68;
  color: #111;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.sp-image-menu-switch-button:hover,
.sp-image-menu-switch-button:focus-visible {
  background: #d2bc78;
}

.sp-image-menu-switch-button:focus {
  outline: none;
}

.mobile-viewer-map-switch-button {
  display: none;
}

/* ========== iframeモーダル ========== */
#iframe-modal {
  position: fixed;
  inset: 0;
  z-index: 20; /* UIより上に表示 */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#iframe-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.iframe-container {
  position: relative;
  width: min(96vw, 1440px);
  height: min(calc(100vh - 104px), 960px);
  height: min(calc(100dvh - 104px), 960px);
  max-height: 960px;
  background: #fff;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#btn-close-iframe {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  background: #c4ad68;
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-close-iframe:hover {
  background: #c4ad68;
}

#work-iframe {
  width: 100%;
  height: 100%;
  display: block;
  background: #f0f0f0;
  border: none;
  border-radius: inherit;
}

@media (max-width: 700px) {
   #camera-ui {
    top: 8px;
    left: 8px;
    right: 8px;
    max-width: none;
    width: auto;

    justify-content: center;
    padding: 10px 12px;
  }
  #page-title {
    width: 100%;
    justify-content: center;
    min-height: auto;
    padding: 0;
    font-size: 18px;
    letter-spacing: 0.04em;
  }
  .camera-row {
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 20px));
    gap: 8px;
    padding: 8px;
    transform: translateX(-50%);
  }

  .camera-row .camera-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .camera-button-sub {
    height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .hotspot-button {
    width: 44px;
    height: 44px;
    font-size: 11px;
  }

  .hotspot-button.has-custom-icon {
    width: 88px;
    height: 88px;
  }

  #hotspot-detail {
    bottom: calc(128px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
    justify-content: center;
    min-height: 64px;
    padding: 9px 10px 9px 14px;
    gap: 9px;
  }

  #hotspot-detail-name {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #btn-open-hotspot-link {
    width: 50px;
    height: 50px;
    font-size: 12px;
  }

  #btn-close-hotspot-detail {
    width: 32px;
    height: 32px;
  }

  .sp-image-menu-switch-button {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 20px));
    min-height: 52px;
    font-size: 14px;
  }

  .mobile-viewer-map-switch-button {
    position: fixed;
    left: 50%;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 8;
    transform: translateX(-50%);

    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(220px, calc(100vw - 20px));
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.66);
    color: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }

  .mobile-viewer-map-switch-button:hover,
  .mobile-viewer-map-switch-button:focus-visible {
    background: rgba(255, 255, 255, 0.92);
    color: #111;
  }

  .mobile-viewer-map-switch-button:focus {
    outline: none;
  }

  .iframe-container {
    width: calc(100vw - 40px);
    height: calc(100vh - 112px);
    height: calc(100dvh - 112px);
    max-height: none;
  }

  #btn-close-iframe {
    top: -48px;
    width: 44px;
    height: 44px;
  }
}
@media (max-width: 1024px) {
  #btn-fullscreen {
    display: none !important;
  }
}

