:root {
  --bg: #fff;
  --fg: #f2f2f2;
  --muted: rgba(255,255,255,.7);
  --btn: rgba(255,255,255,.10);
  --btnHover: rgba(255,255,255,.18);
  --btnBorder: rgba(255,255,255,.20);
  --shadow: rgba(0,0,0,.35);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding: 20px; */
  box-sizing: border-box;
}

/* 360 viewer root */
.viewer360 {
  position: relative;
  width: 100%;
  height: 100%;

  /* max-width: 900px;
  max-height: 600px; */

  margin: 0 auto;
  background: var(--bg);
  border-radius: 12px;
  border-radius: 0;
  overflow: hidden;
  /* box-shadow: 0 12px 28px var(--shadow); */
  aspect-ratio: 16 / 9;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* ドラッグ時のブラウザスクロール等抑止 */
}


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

canvas.viewer360__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Controls */
.viewer360__controls {
  position: absolute;

  right: 0;
  left: 0;
  max-width: 320px;
  margin: auto;

  bottom: 10px;
  display: grid;
  grid-auto-flow: column;


  display: flex;
  justify-content: center;

  gap: 8px;
  gap: 30px;
  z-index: 5;
}

.viewer360__btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--btn);
  border: 1px solid var(--btnBorder);
  color: var(--fg);
  cursor: pointer;
  outline: none;
  padding: 4px;
  transition: background 120ms ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.viewer360__btn:hover { background: var(--btnHover); }
.viewer360__btn:active { transform: translateY(1px); }
.viewer360__btn[disabled] { opacity: .45; cursor: default; }

.viewer360__btn svg { width: 22px; height: 22px; fill: currentColor; }

/* Top-left label */
.viewer360__hud {
  position: absolute;
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  z-index: 10;
  color: var(--muted);
  font-size: 12px;
  background: rgba(0,0,0,.35);
  display: flex;
  justify-content: center;
  align-items: center;

   /* UI操作不可 */
  pointer-events: all;
}

.viewer360__bar {
  width: 140px;
  height: 6px;
  background: rgba(255,255,255,.14);
  border-radius: 999px;
  overflow: hidden;
}
.viewer360__bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,.75);
}

/* 閉じるボタン */
.viewer360__close {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 10;
  display: none;
}
.viewer360__overlay.is-open .viewer360__close {
  display: grid;
}

/* Small helper text */
.viewer360__help {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 5;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 6px 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: calc(100% - 120px);
}

/* モバイルでは Play / Fullscreen を非表示 */
@media (max-width: 900px), (pointer: coarse) {
  #btnPlay, #btnFullscreen, #btnCloseFS { display: none !important; }
  .viewer360__help { display: none; } /* 必要なら */
}