:root { color-scheme: dark; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #fff; background: #151515; }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid #ff9d1f; outline-offset: 4px; }
[hidden] { display: none !important; }
#viewer { display: grid; grid-template-rows: minmax(0, 1fr) auto; position: relative; width: 100%; height: 100%; height: 100dvh; overflow: hidden; }
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
.glass { border: 1px solid #ffffff24; background: #191919df; box-shadow: 0 5px 25px #0002, inset 0 1px #ffffff0d; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.viewer-header { position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 20px; min-height: 66px; padding: 10px 18px; border-radius: 20px; }
.back { display: flex; gap: 9px; align-items: center; min-height: 44px; font-size: 16px; }
.project-name { flex: 1; padding-left: 20px; border-left: 1px solid #ffffff26; min-width: 0; }
.project-name > span { display: block; color: #ffac42; font-size: 12px; font-weight: 700; letter-spacing: .13em; }
h1 { margin: 3px 0 0; font-size: 17px; line-height: 1.35; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 14px; white-space: nowrap; color: #ddd; padding: 12px 0 12px 16px; }
.download:hover, .back:hover { color: #ffac42; }
.download svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.controls { position: absolute; left: max(20px, env(safe-area-inset-left)); bottom: 24px; margin: 0; padding: 0; border: 0; width: 104px; transition: opacity .2s; }
.controls:disabled { opacity: .25; pointer-events: none; }
.orbit { position: relative; width: 104px; height: 104px; border-radius: 50%; display: block; padding: 0; touch-action: none; cursor: grab; }
.orbit:active { cursor: grabbing; }
.orbit svg { width: 100%; height: 100%; }
.orbit circle { fill: none; stroke: #ffffff13; stroke-width: 1; }
.orbit > span { position: absolute; bottom: 9px; left: 0; right: 0; font-size: 12px; font-weight: 650; letter-spacing: .08em; }
.lower-controls { display: flex; align-items: end; gap: 8px; margin-top: 8px; }
.walk { height: clamp(124px, 23vh, 180px); width: 48px; flex-shrink: 0; border-radius: 26px; padding: 9px 0; display: flex; align-items: center; flex-direction: column; justify-content: space-between; touch-action: none; cursor: ns-resize; }
.chevron { font-size: 26px; line-height: 22px; color: #ddd; }
.walk-track { position: relative; width: 3px; flex: 1; margin: 9px 0; background: #ffffff18; border-radius: 3px; }
.walk-track i { position: absolute; top: 50%; left: -9px; width: 21px; height: 5px; border-radius: 4px; background: #ffac42; margin-top: -2px; }
.walk-label { font-size: 12px; letter-spacing: .04em; color: #ddd; padding: 5px 0; }
.home { width: 48px; height: 48px; border-radius: 50%; padding: 12px; }
.home svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; width: 100%; height: 100%; }
.orbit:hover, .walk:hover, .home:hover { background-color: #252525ed; border-color: #ffffff4f; }
.instructions { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 18px; border-radius: 24px; font-size: 14px; color: #eee; white-space: nowrap; margin: 0; pointer-events: none; }
.instructions span { color: #bfbfbf; }
.loading { position: absolute; inset: 0; background: #151515; display: grid; place-items: center; }
.loading img { position: absolute; width: 100%; height: 100%; object-fit: contain; opacity: .35; filter: blur(3px); }
.loading-card { position: relative; padding: 28px 32px; border-radius: 24px; text-align: center; max-width: min(420px, calc(100% - 40px)); }
.loading-card p { font-size: 16px; line-height: 1.5; margin: 10px 0 0; }
#detail { color: #bfbfbf; font-size: 14px; }
.loading-card button { margin: 20px 0 0; border: 0; border-radius: 25px; padding: 13px 26px; background: #ff9d1f; color: #161616; font-weight: 650; }
.loading-card a { display: block; margin: 18px 0 0; font-size: 14px; text-decoration: underline; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid #ffffff25; border-top-color: #ffac42; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-header { z-index: 3; }
.controls, .instructions { z-index: 2; }
.loading { z-index: 1; }
.no-script { position: absolute; z-index: 5; top: 40%; width: 100%; padding: 30px; background: #181818; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .viewer-header { top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; padding: 8px 12px; gap: 12px; border-radius: 17px; }
  .back span, .download span, .extra-hints { display: none; }
  .download { padding: 10px; min-width: 44px; min-height: 44px; }
  .project-name > span { font-size: 10px; }
  .back { font-size: 24px; min-width: 36px; justify-content: center; }
  .project-name { flex: 1; padding-left: 12px; }
  h1 { font-size: 16px; }
  .controls { left: max(14px, env(safe-area-inset-left)); bottom: 16px; }
  .instructions { left: auto; right: 14px; transform: none; max-width: 155px; white-space: normal; line-height: 1.6; text-align: center; padding: 10px 14px; font-size: 14px; }
}
@media (max-height: 480px) {
  .orbit { width: 88px; height: 88px; }
  .controls { width: auto; bottom: 12px; display: flex; align-items: end; gap: 10px; }
  .walk { height: 92px; }
  .viewer-header { min-height: 54px; top: max(8px, env(safe-area-inset-top)); padding-top: 4px; padding-bottom: 4px; }
  .back { min-height: 40px; }
  .home { width: 40px; height: 40px; padding: 10px; }
  .lower-controls { gap: 8px; margin-top: 0; }
  .instructions { display: none; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .controls { transition: none; } }

/* The collection occupies its own row, so it never covers the scene controls. */
.library { position: relative; z-index: 4; background: #191919; border-top: 1px solid #ffffff1c; padding: 8px max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); min-width: 0; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 12px; margin-bottom: 6px; }
.library-toolbar h2 { font-size: 14px; font-weight: 550; margin: 0; }
#collection-count { font-size: 12px; font-weight: 400; color: #999; margin-left: 12px; }
.library-navigation { display: flex; align-items: center; gap: 6px; }
#position { font-size: 12px; font-variant-numeric: tabular-nums; color: #aaa; margin-right: 8px; }
.library-navigation button { width: 40px; height: 36px; border: 1px solid #ffffff20; background: #ffffff06; border-radius: 10px; font-size: 20px; }
.library-navigation button:hover:enabled { background: #ffffff12; }
.library-navigation button:disabled { opacity: .25; cursor: default; }
.filmstrip { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; padding: 3px 3px 7px; scrollbar-width: thin; scrollbar-color: #555 transparent; -webkit-overflow-scrolling: touch; }
.demo-tile { position: relative; flex: 0 0 152px; min-width: 0; padding: 3px; border: 1px solid #ffffff20; border-radius: 12px; background: #252525; text-align: left; }
.demo-tile img { display: block; width: 100%; height: 82px; object-fit: cover; border-radius: 8px; background: #303030; }
.demo-title { display: block; font-size: 13px; font-weight: 500; padding: 8px 5px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-number { position: absolute; top: 9px; left: 9px; min-width: 24px; padding: 4px 5px; color: #fff; background: #181818bb; border-radius: 5px; text-align: center; font-size: 10px; font-weight: 600; }
.demo-tile:hover { border-color: #ffffff68; background: #303030; }
.demo-tile[aria-selected="true"] { border-color: #ffac42; background: #392d20; box-shadow: 0 0 0 1px #ffac42; }
.demo-tile[aria-selected="true"] .demo-title { color: #ffc477; }
.demo-tile[aria-selected="true"] .demo-number { background: #ffac42; color: #191919; }
.demo-tile:focus-visible { outline-offset: 1px; }
.demo-tile.is-loading::after { content: ''; position: absolute; right: 10px; top: 10px; width: 18px; height: 18px; border: 2px solid #ffffff50; border-top-color: #ffac42; border-radius: 50%; background: #19191980; animation: spin 1s linear infinite; }
.has-scene .loading { background: transparent; place-items: end center; padding: 0 16px 82px 136px; pointer-events: none; }
.has-scene .loading img { display: none; }
.has-scene .loading-card { padding: 16px 22px; max-width: 360px; pointer-events: auto; }
.has-scene .loading-card p { font-size: 14px; margin-top: 5px; }
.has-scene .loading-card #detail, #choose-another { font-size: 12px; }
.has-scene .loading-card .spinner { width: 18px; height: 18px; }
@media (max-width: 700px) {
  .library { padding: 6px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .library-toolbar { margin-bottom: 4px; }
  .library-toolbar h2 { font-size: 13px; }
  #collection-count { display: none; }
  .library-navigation button { width: 40px; height: 36px; }
  #position { margin-right: 2px; }
  .filmstrip { gap: 8px; }
  .demo-tile { flex-basis: 128px; }
  .demo-tile img { height: 66px; }
  .demo-title { font-size: 12px; padding: 7px 4px 4px; }
  .has-scene .loading { padding: 80px 14px 0; place-items: start center; }
  .has-scene .loading-card { padding: 12px 18px; }
}
@media (max-height: 480px) {
  .library { padding-top: 3px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .library-toolbar { min-height: 30px; margin-bottom: 1px; }
  .library-navigation button { height: 30px; }
  .demo-tile { flex-basis: 128px; border-radius: 9px; }
  .demo-tile img { height: 44px; border-radius: 5px; }
  .demo-title { padding: 4px 3px 2px; font-size: 12px; }
  .filmstrip { padding-bottom: 3px; }
  .has-scene .loading { padding: 75px 14px 0 240px; place-items: start center; }
}
@media (prefers-reduced-motion: reduce) { .demo-tile.is-loading::after { animation: none; } }
