html { -ms-touch-action: none; overflow: hidden; }
* { box-sizing: border-box; }
body {
  margin: 0; min-width: 0; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  background: radial-gradient(circle at 50% 15%, #32433e, #101b1e 68%);
  color: #f5eee0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
button, canvas { -webkit-tap-highlight-color: transparent; }
canvas { outline: none; }
.preview-shell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; width: 100%; height: 100vh; height: 100dvh; padding: 18px;
}
.preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; width: min(100%, 960px);
}
.preview-name { display: block; font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.preview-hint { display: block; margin-top: 3px; color: #a9b9b2; font-size: 11px; }
.game-stage {
  position: relative; flex: 0 1 auto;
  width: min(100%, 390px, calc(46.2085dvh - 55.4502px));
  aspect-ratio: 390 / 844; overflow: hidden; outline: 3px solid #c1ae84;
  border-radius: 24px; background: #162019;
  box-shadow: 0 0 0 7px #1f302a, 0 26px 75px #0009;
}
#GameDiv, #Cocos3dGameContainer, #GameCanvas {
  width: 100%; height: 100%; min-width: 0; min-height: 0;
}
#GameDiv { position: absolute; inset: 0; }
#GameCanvas { display: block; max-width: 100%; max-height: 100%; }
@media (max-width: 600px), (hover: none) and (pointer: coarse) {
  body { background: #101b1e; }
  .preview-shell {
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    gap: 0;
  }
  .preview-bar { display: none; }
  .game-stage {
    width: 100%; height: 100%; aspect-ratio: auto;
    outline: 0; border-radius: 0; box-shadow: none;
  }
}
[hidden] { display: none !important; }
html[data-tutorial-demo] .preview-bar { display: none; }
html[data-tutorial-demo] .preview-shell { padding: 0; gap: 0; }
html[data-tutorial-demo] .game-stage { width: min(100%, 46.2085dvh); border-radius: 0; outline: 0; box-shadow: none; }
html[data-tutorial-demo] #estate-qa-fixture-controls,
html[data-tutorial-demo] #r6-qa-tools-toggle,
html[data-tutorial-demo] button[id^="estate-"] { display: none; }
.estate-loading {
  position: absolute; inset: 0; z-index: 20; overflow: hidden;
  background: #fdfaf0; color: #684e31;
}
.loading-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.estate-loading h1 {
  position: absolute; top: 12.5%; left: 0; width: 100%; margin: 0;
  text-align: center; font-size: clamp(24px, 4dvh, 38px); letter-spacing: .12em;
  text-shadow: 0 2px #fffdf6;
}
.loading-bottom {
  position: absolute; top: 74%; left: 50%; width: 64%; max-width: 320px;
  transform: translateX(-50%); display: flex; flex-direction: column; align-items: center;
}
.estate-loading p { margin: 0 0 15px; color: #71818a; font-size: clamp(11px, 1.7dvh, 15px); text-align: center; white-space: nowrap; }
.loading-progress {
  width: 100%; height: clamp(21px, 3.4dvh, 30px); padding: 4px; border-radius: 999px;
  background: #d3eaf0; border: 3px solid #fffffa;
  box-shadow: 0 4px 0 #75a9c1, 0 6px 10px #76aac021, inset 0 2px 2px #a6cbdc66;
}
.loading-progress-fill {
  position: relative; width: 0; height: 100%; border-radius: inherit;
  background: linear-gradient(#6ec7f1 0%, #47a4de 65%, #348fcb 100%);
  box-shadow: 0 1px 0 #fff8 inset; transition: width .2s ease-out;
}
.loading-progress-fill::before {
  content: ''; position: absolute; top: 2px; left: 5px; right: 5px; height: 3px;
  border-radius: inherit; background: #bcecff; opacity: .9;
}
.loading-percent { margin-top: 12px; color: #4185ac; font-size: clamp(11px, 1.7dvh, 15px); font-weight: 700; font-variant-numeric: tabular-nums; }
#estate-loading-retry {
  margin-top: 12px; border: 2px solid #fffdf6; border-radius: 14px; padding: 9px 24px;
  background: #4ba1d3; box-shadow: 0 3px #327da9; color: #fffdf6; font-size: 14px; font-weight: 600; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .loading-progress-fill { transition: none; } }
