@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/ZenKakuGothicNew-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: "Zen Kaku Gothic New", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body,
#pano {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body { background: #000; color: #fff; }

.fatal-message {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 100;
  transform: translate(-50%, -50%);
}

.loading-indicator,
.error-message {
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  font-size: 13px;
}

.loading-indicator {
  top: max(16px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: calc(100vw - 24px);
  white-space: nowrap;
}

.loading-indicator[hidden],
.error-message[hidden] { display: none; }

.loading-indicator__spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-message {
  top: max(62px, calc(env(safe-area-inset-top) + 52px));
  max-width: min(90vw, 520px);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fee2e2;
}

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

.map-drag {
  position: fixed;
  z-index: 24;
  pointer-events: none;
  transition: transform 0.42s ease-in-out;
}

.map-drag__point {
  position: absolute;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.map-drag__point:active { cursor: grabbing; }
.map-drag__point:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.map-drag[data-edit="false"] .map-drag__point { cursor: pointer; }
.map-drag--closed { transform: translateX(calc(-100% - 16px)); }

.map-slide {
  position: fixed;
  z-index: 23;
  box-sizing: border-box;
  padding: var(--map-pad-y, 14px) var(--map-pad-x, 14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  pointer-events: none;
  transition: transform 0.42s ease-in-out;
}

.map-slide--closed { transform: translateX(calc(-100% - 16px)); }
.map-slide__image { display: block; width: 100%; height: 100%; object-fit: fill; opacity: 0.8; }
.map-slide__radar {
  position: absolute;
  z-index: 3;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from var(--radar-angle), rgba(0, 0, 0, 0.28) 0deg 90deg, transparent 90deg 360deg);
  transform: translate(-50%, -50%);
}

.map-slide__point {
  position: absolute;
  z-index: 4;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font: 14px/1 Futura, "Century Gothic", "Avenir Next", sans-serif;
  box-sizing: border-box;
  padding: 0;
  text-indent: -0.5px;
  transform: translate(-50%, -50%);
}

.map-close,
.map-open {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.map-close {
  position: fixed;
  z-index: 26;
  top: 8px;
  width: 24px;
  height: 24px;
  background: #000;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.map-close--hidden { opacity: 0; pointer-events: none; }

.map-open {
  position: fixed;
  z-index: 25;
  top: max(16px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  width: 44px;
  height: 44px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.map-open.is-visible { opacity: 1; transform: translateX(0); }
.map-open svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.map-close svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.25; transform: translateX(-1px); }
.map-close:hover,
.map-open:hover { background: rgba(45, 55, 72, 0.9); }
.map-close:focus-visible,
.map-open:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }

.map-editor {
  position: fixed;
  z-index: 35;
  left: 16px;
  width: 300px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 12px;
  transition: transform 0.42s ease-in-out;
}

.map-editor[hidden] { display: none; }
.map-editor--closed { transform: translateX(calc(-100% - 16px)); }
.map-editor__title { margin: 0 0 3px; font-size: 14px; }
.map-editor__note { margin: 0 0 8px; color: #c7ced7; line-height: 1.4; }
.map-editor__group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 8px; }
.map-editor__group h2 { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 400; }
.map-editor__group label { display: grid; gap: 3px; color: #c7ced7; }
.map-editor__group label:nth-of-type(3) { grid-column: 1 / -1; grid-template-columns: auto 1fr 36px; align-items: center; }
.map-editor input { min-width: 0; width: 100%; accent-color: #fff; }
.map-editor input[type="number"] { height: 28px; padding: 3px 5px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; color: #fff; background: rgba(255, 255, 255, 0.12); font: inherit; }
.map-editor output { text-align: right; color: #fff; }
.map-editor__copy { grid-column: 1 / -1; min-height: 30px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 3px; color: #fff; background: rgba(103, 111, 122, 0.78); cursor: pointer; font: inherit; }
.map-editor__copy:hover { background: rgba(126, 135, 147, 0.9); }
.map-editor__status { min-height: 1.4em; margin: 8px 0 0; color: #d1fae5; }

.hotspot-editor {
  position: fixed;
  z-index: 35;
  top: 70px;
  right: 16px;
  width: 276px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 12px;
}

.hotspot-editor[hidden] { display: none; }
.hotspot-editor__title { margin: 0 0 3px; font-size: 14px; }
.hotspot-editor__note { margin: 0 0 8px; color: #c7ced7; }
.hotspot-editor__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hotspot-editor__tabs button,
.hotspot-editor__copy {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  color: #fff;
  background: rgba(103, 111, 122, 0.78);
  cursor: pointer;
  font: inherit;
}
.hotspot-editor__tabs button[aria-pressed="true"] { background: rgba(0, 0, 0, 0.82); cursor: default; }
.hotspot-editor__tabs button:hover:not(:disabled),
.hotspot-editor__copy:hover { background: rgba(126, 135, 147, 0.9); }
.hotspot-editor__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 8px; }
.hotspot-editor__fields label { display: grid; gap: 3px; color: #c7ced7; }
.hotspot-editor__fields input {
  min-width: 0;
  width: 100%;
  height: 28px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font: inherit;
}
.hotspot-editor__copy { width: 100%; margin-top: 8px; }
.hotspot-editor__status { min-height: 1.4em; margin: 8px 0 0; color: #d1fae5; }

.selection-summary {
  position: fixed;
  z-index: 20;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 180px;
  padding: 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  pointer-events: none;
}

.selection-summary__item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid rgba(176, 185, 196, 0.42);
}

.selection-summary__title {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  color: #fff;
  font-size: 0.9em;
  letter-spacing: 0.14em;
  line-height: 1;
}

.selection-summary__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.38);
}

.selection-summary__item:first-child { padding-top: 0; }
.selection-summary__item:last-child { padding-bottom: 0; border-bottom: 0; }
.selection-summary__label {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border-radius: 2px;
  color: #fff;
  background: rgba(47, 53, 62, 0.80);
  font-size: 0.9em;
  line-height: 1.3;
}
.selection-summary__value {
  padding: 5px 2px 0;
  color: #fff;
  font-size: 1.08em;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

body[data-guide-focus="summary"] .selection-summary {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.72);
}

@media (max-width: 700px) {
  .map-editor {
    left: 12px;
    width: min(300px, calc(100vw - 24px));
    font-size: 11px;
  }

  .hotspot-editor {
    top: 130px;
    right: 12px;
    width: min(276px, calc(100vw - 24px));
    font-size: 11px;
  }

  .selection-summary {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    min-width: 140px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .selection-summary__item { padding: 9px 0; }
  .selection-summary__title { margin-bottom: 7px; }
  .selection-summary__label { padding: 3px 4px; }
  .selection-summary__value {
    padding-top: 3px;
    font-size: 14px;
    font-weight: 700;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .map-editor { left: 8px; max-height: calc(100vh - 16px); overflow: auto; }
  .hotspot-editor { top: 106px; right: 8px; max-height: calc(100vh - 114px); overflow: auto; }

  .selection-summary {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    min-width: 126px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .selection-summary__item { padding: 7px 0; }
  .selection-summary__title { margin-bottom: 5px; }
  .selection-summary__label { padding: 2px 4px; }
  .selection-summary__value { padding-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}
