/* GOT3D 360° spin viewer (used on got3d.net and inside embeds) */
.spin { --spin-bg: #f4f4f0; position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden;
  background: var(--spin-bg); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; outline-offset: -3px; }
.spin.is-grab { cursor: grabbing; }
.spin:focus-visible { outline: 2px solid #00f0ff; }
.spin-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; display: block; }
.spin-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; background: var(--spin-bg); z-index: 2;
  font: 600 13px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; color: #555; transition: opacity .3s; }
.spin.is-ready .spin-load { opacity: 0; pointer-events: none; }
.spin-load svg, .spin-proc-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.spin-ring-bg { fill: none; stroke: rgba(128, 128, 128, .25); stroke-width: 6; }
.spin-ring-fg { fill: none; stroke: #00f0ff; stroke-width: 6; stroke-dasharray: 283; stroke-dashoffset: 283; stroke-linecap: square; transition: stroke-dashoffset .2s; filter: drop-shadow(0 0 4px #00f0ff); }
.spin-load b { font-size: 20px; color: #222; margin-top: -60px; margin-bottom: 36px; }
.spin-badge { position: absolute; left: 10px; top: 10px; z-index: 3; padding: 4px 8px; font: 700 12px/1 ui-monospace, Menlo, monospace; letter-spacing: .1em;
  color: #fff; background: rgba(7, 3, 26, .72); }
.spin-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3; padding: 6px 10px; font: 600 12px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .1em; text-transform: uppercase; color: #fff; background: rgba(7, 3, 26, .72); transition: opacity .3s; white-space: nowrap; }
.spin[data-touched] .spin-hint { opacity: 0; }
.spin-full { position: absolute; right: 10px; top: 10px; z-index: 3; width: 36px; height: 36px; border: 0; cursor: pointer; font-size: 18px; color: #fff; background: rgba(7, 3, 26, .72); }
.spin:fullscreen, .spin.is-full { max-width: none; aspect-ratio: auto; width: 100vw; height: 100vh; }
.spin.is-full { position: fixed; inset: 0; z-index: 1000; }

/* ---------- shoot a spin with the phone camera ---------- */
.spin-shoot { margin: 10px 0; }
.spin-cam { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; display: grid; grid-template-rows: 1fr auto; }
.spin-cam[hidden] { display: none; }
.spin-cam video { grid-row: 1; grid-column: 1; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.cam-guide { grid-row: 1; grid-column: 1; place-self: center; width: min(86vw, 60vh); aspect-ratio: 1; border: 2px dashed #ff2bd6; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.cam-count { grid-row: 1; grid-column: 1; place-self: center; font-size: 22vmin; line-height: 1; color: #ff2bd6; text-shadow: 0 0 24px #000, 0 0 6px #000; pointer-events: none; }
.spin-cam.is-shooting .cam-opts { visibility: hidden; }
.cam-bar { grid-row: 2; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #07031a; display: grid; gap: 10px; }
.cam-note { margin: 0; font-size: .85rem; text-transform: none; opacity: .85; }
.cam-opts { display: flex; gap: 12px; flex-wrap: wrap; }
.cam-opts label { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.cam-bar .row { display: flex; gap: 10px; }
.cam-bar .btn-lg { flex: 1; }

/* camera: a square window = exactly what the spin shows, controls below */
.spin-cam { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding-top: env(safe-area-inset-top); background: #07031a; }
.cam-stage { position: relative; width: min(100vw, calc(100dvh - 230px - env(safe-area-inset-top))); aspect-ratio: 1; flex: none; background: #000; }
.cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-stage .cam-guide { position: absolute; inset: 0; width: auto; aspect-ratio: auto; border: 2px solid #ff2bd6; box-shadow: 0 0 24px rgba(255, 43, 214, .5); place-self: auto; }
.cam-stage .cam-count { position: absolute; inset: 0; display: grid; place-items: center; }
.spin-cam .cam-bar { width: 100%; max-width: 560px; }
.spin-cam { touch-action: none; }
.cam-stage { overflow: hidden; }
.cam-stage video { transform-origin: 50% 50%; }
.cam-zoom { display: flex; gap: 8px; justify-content: center; }
.cam-zoom:empty { display: none; }
.cam-zoom button { min-width: 48px; height: 36px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.4); color: #fff; font: 15px var(--font-display, monospace); border-radius: 18px; cursor: pointer; }
.cam-zoom button.on { border-color: #ff2bd6; color: #ff2bd6; box-shadow: 0 0 14px rgba(255,43,214,.5); }
.spin-cam.is-shooting .cam-zoom { opacity: .35; pointer-events: none; }
.spin-cam.is-manual .cam-opts { visibility: hidden; }
.cam-stage::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-stage.snap::after { animation: cam-snap .18s ease-out; }
@keyframes cam-snap { from { opacity: .55; } to { opacity: 0; } }
#cam-gap-wrap[hidden] { display: none; }
.spin-cam.is-manual .cam-bar .row { flex-wrap: wrap; }
.spin-cam.is-manual #cam-start { flex-basis: 100%; }
.spin-cam.is-manual #cam-done, .spin-cam.is-manual #cam-close { flex: 1; }
.cam-top { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.cam-flip { height: 36px; padding: 0 14px; border: 1px solid #00f0ff; background: rgba(0,0,0,.4); color: #fff; font: 15px var(--font-display, monospace); border-radius: 18px; cursor: pointer; }
.spin-cam.is-selfie .cam-flip { border-color: #ff2bd6; color: #ff2bd6; }
.spin-cam.is-shooting .cam-flip { opacity: .35; pointer-events: none; }

/* environment sphere capture */
.sphere-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sphere-cam { display: block; }
.sphere-hud { position: absolute; inset: 0 0 auto 0; height: calc(100% - 210px); display: grid; place-items: center; pointer-events: none; }
.sphere-hud canvas { width: 180px; height: 180px; filter: drop-shadow(0 0 8px rgba(0,0,0,.8)); }
.sphere-level-track { position: absolute; left: 10%; right: 10%; top: 50%; height: 0; border-top: 1px dashed rgba(255,255,255,.5); }
.sphere-level { position: absolute; left: 0; right: 0; top: -2px; height: 4px; background: #00f0ff; box-shadow: 0 0 10px #00f0ff; transition: transform .1s; }
.sphere-level.bad { background: #ff2b5e; box-shadow: 0 0 10px #ff2b5e; }
.sphere-cam .cam-bar { position: absolute; left: 0; right: 0; bottom: 0; max-width: none; background: rgba(7,3,26,.88); }
.sphere-open { margin: 10px 0; }

/* tall 9:16 spins (selfies, environments): full-screen camera, controls floating on top like Instagram */
.spin-cam.is-tall { justify-content: center; padding: 0; background: #000; }
.spin-cam.is-tall .cam-stage { width: min(100vw, calc(100dvh * 9 / 16)); aspect-ratio: 9 / 16; }
.spin-cam.is-tall .cam-bar { position: fixed; left: 0; right: 0; bottom: 0; max-width: none; padding: 40px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .75) 40%); }
.spin-cam.is-tall .cam-top { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); }
.spin-cam.is-tall .cam-note { text-shadow: 0 1px 3px #000; }
.spin.is-tall { max-width: min(100%, calc(80vh * 9 / 16)); margin-inline: auto; }
.viewer-spin .spin.is-tall { max-width: min(100%, calc(82vh * 9 / 16)); }
@media (max-width: 640px) { .viewer-spin .spin.is-tall { max-width: 100%; } }
