* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  color: #182f55;
  background: #edf1f4;
}
#viewport,
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
canvas {
  touch-action: pan-y;
  cursor: grab;
}
canvas:active {
  cursor: grabbing;
}
header,
footer {
  position: absolute;
  left: 28px;
  right: 28px;
  z-index: 2;
}
header {
  top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.scene-title {
  font-size: 16px;
  font-weight: 650;
  padding: 12px 16px;
  background: #ffffffed;
  border: 1px solid #dce3ed;
  border-radius: 12px;
}
.scene-title small {
  display: block;
  font-size: 11px;
  color: #61718b;
  font-weight: 400;
  margin: 7px 0 0 16px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #138f9a;
  border-radius: 50%;
  margin-right: 9px;
}
.views,
.controls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.views {
  padding: 4px;
  background: #ffffffed;
  border: 1px solid #dce3ed;
  border-radius: 30px;
}
button {
  font: inherit;
  font-size: 12px;
  min-height: 36px;
  border: 1px solid transparent;
  color: #183150;
  background: #fff;
  border-radius: 22px;
  padding: 8px 14px;
  cursor: pointer;
}
button[aria-pressed="true"] {
  background: #182f55;
  color: #fff;
}
button:focus-visible {
  outline: 3px solid #357add;
  outline-offset: 3px;
}
.controls button {
  border: 1px solid #cdd8e5;
  box-shadow: 0 2px 8px #192d4b08;
}
footer {
  bottom: 22px;
}
footer p {
  display: inline-block;
  font-size: 11px;
  color: #263d58;
  background: #ffffffe8;
  padding: 6px 10px;
  border-radius: 4px;
  margin: 10px 0 0;
}
.legend {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 11px;
  background: #ffffffe8;
  padding: 14px;
  border-radius: 9px;
}
.legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #098e9d;
  margin-right: 8px;
  border-radius: 50%;
}
.legend span + span i {
  background: #548bd1;
}
#fallback {
  position: absolute;
  inset: 0;
  background: #fff;
}
#fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#fallback p {
  position: absolute;
  bottom: 20px;
  background: white;
  padding: 12px;
  font-size: 13px;
}
#fallback:not([hidden]) ~ * {
  display: none;
}
@media (max-width: 650px) {
  header,
  footer {
    left: 14px;
    right: 14px;
  }
  header {
    top: 14px;
    flex-direction: column;
  }
  .scene-title {
    font-size: 13px;
    padding: 10px 12px;
  }
  .scene-title small {
    font-size: 10px;
  }
  .views button {
    min-height: 32px;
    padding: 7px 12px;
  }
  .legend {
    display: none;
  }
  footer {
    bottom: 14px;
  }
  footer p {
    font-size: 10px;
    line-height: 1.5;
  }
  .controls {
    gap: 4px;
  }
  .controls button {
    font-size: 11px;
    padding: 8px 10px;
  }
}

.model-credit {
  display: block;
  width: fit-content;
  font-size: 10px;
  color: #29435f;
  background: #ffffffdc;
  padding: 3px 7px;
  border-radius: 3px;
  text-decoration: none;
  margin-top: 4px;
}

.legend .gaze-key i {
  background: #ee7900;
}
.legend span:first-child i {
  background: #00c6d6;
  box-shadow: 0 0 0 2px #003f52;
}
.legend {
  bottom: 30px;
  font-size: 12px;
  border: 1px solid #d7e1eb;
}
.controls button {
  font-weight: 600;
}
.scene-title {
  box-shadow: 0 3px 15px #182f5512;
}
@media (max-width: 650px) {
  .controls {
    max-width: 340px;
  }
  .controls button {
    padding: 7px 10px;
    min-height: 34px;
  }
  .model-credit {
    font-size: 9px;
  }
  .legend {
    display: flex;
    top: 124px;
    bottom: auto;
    right: 14px;
    gap: 6px;
    padding: 8px;
    font-size: 9px;
    background: #fffffff0;
  }
  .legend span:nth-child(2) {
    display: none;
  }
}

.scenario-panel {
  position: absolute;
  top: 106px;
  left: 28px;
  z-index: 3;
  width: 318px;
  padding: 14px;
  background: #fffffff0;
  border: 1px solid #d5e0eb;
  border-radius: 12px;
  box-shadow: 0 5px 24px #18345110;
}
.scenario-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.scenario-tabs button {
  padding: 6px 10px;
  font-size: 11px;
  min-height: 30px;
  border: 1px solid #dce4ed;
}
.scenario-panel strong {
  display: block;
  font-size: 15px;
}
.scenario-panel p {
  font-size: 11px;
  line-height: 1.5;
  color: #576b83;
  margin: 6px 0 10px;
}
.dwell-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}
.dwell-row span {
  min-width: 102px;
}
.dwell-row progress {
  width: 140px;
  height: 7px;
  accent-color: #219560;
}
.scenario-panel[data-warning="true"] {
  background: #fff0f1;
  border-color: #e1495c;
  color: #a51c30;
}
.scenario-panel[data-warning="true"] p {
  color: #923746;
}
@media (max-width: 650px) {
  .scenario-panel {
    top: 127px;
    left: 14px;
    right: 14px;
    width: auto;
    padding: 10px;
  }
  .scenario-tabs {
    margin-bottom: 7px;
  }
  .scenario-panel strong {
    font-size: 13px;
  }
  .scenario-panel p {
    font-size: 10px;
    margin: 4px 0 7px;
  }
  .scenario-tabs button {
    padding: 5px 9px;
  }
  .legend {
    display: none;
  }
  .dwell-row {
    font-size: 10px;
  }
  header .scene-title {
    padding: 8px 12px;
  }
  .scene-title small {
    margin-top: 4px;
  }
}

.legend .screen-key i {
  background: #20ae62;
}

@media (max-width: 650px) {
  .scenario-panel p {
    display: none;
  }
  .dwell-row {
    margin-top: 7px;
  }
}
/* Interactive theatre: status above, all controls in the bottom dock. */
header {
  left: 24px;
  right: 24px;
  top: 20px;
}
.scenario-panel {
  top: 20px;
  left: auto;
  right: 24px;
  width: 290px;
  padding: 12px 16px;
}
.scenario-panel p {
  margin-bottom: 8px;
}
.legend {
  right: 24px;
  bottom: 180px;
  font-size: 10px;
  padding: 10px;
  gap: 7px;
  opacity: 0.9;
}
footer {
  left: 20px;
  right: 20px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.control-dock {
  width: max-content;
  max-width: 100%;
  border: 1px solid #ced9e5;
  border-radius: 16px;
  background: #ffffffed;
  padding: 10px 14px;
  box-shadow: 0 8px 30px #19334d16;
  backdrop-filter: blur(10px);
}
.dock-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.dock-primary .scenario-tabs {
  margin: 0;
  gap: 5px;
}
.dock-primary button {
  min-height: 36px;
  font-size: 12px;
  padding: 8px 13px;
}
.dock-primary #play {
  background: #e8edf3;
  border: 1px solid #d4deea;
  color: #183150;
}
.display-options > summary {
  cursor: pointer;
  list-style: none;
  text-align: center;
  font-size: 11px;
  padding: 8px 12px 1px;
  color: #50627b;
}
.display-options > summary::after {
  content: " ＋";
}
.display-options[open] > summary::after {
  content: " −";
}
.display-options > summary::-webkit-details-marker {
  display: none;
}
.display-options > summary:focus-visible {
  outline: 3px solid #357add;
  outline-offset: 2px;
}
.dock-options {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding-top: 10px;
  flex-wrap: wrap;
}
.dock-options .views {
  border-radius: 8px;
}
.dock-options button {
  font-size: 11px;
}
.credits {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.model-credit {
  background: transparent;
  font-size: 9px;
  padding: 0;
  margin-top: 4px;
}
footer p {
  margin-top: 7px;
  padding: 3px 8px;
  font-size: 10px;
  line-height: 1.5;
}
body.story-mode header,
body.story-mode footer,
body.story-mode .scenario-panel,
body.story-mode .legend {
  display: none;
}
@media (max-width: 650px) {
  header {
    top: 12px;
    left: 14px;
    right: 14px;
  }
  .scene-title {
    font-size: 12px;
    padding: 8px 11px;
  }
  .scene-title small {
    font-size: 9px;
  }
  .scenario-panel {
    top: 78px;
    left: 14px;
    right: 14px;
    width: auto;
    padding: 9px 12px;
  }
  .scenario-panel strong {
    font-size: 12px;
  }
  .scenario-panel .dwell-row {
    margin-top: 5px;
  }
  .legend {
    display: none;
  }
  footer {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  .control-dock {
    padding: 8px;
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
  }
  .dock-primary {
    gap: 6px;
  }
  .dock-primary .scenario-tabs {
    gap: 3px;
  }
  .dock-primary button {
    font-size: 10px;
    padding: 7px 8px;
    min-height: 34px;
    white-space: nowrap;
  }
  .dock-options {
    gap: 6px;
    padding-top: 6px;
  }
  .dock-options button {
    padding: 6px 9px;
    min-height: 32px;
  }
  .credits {
    gap: 3px 8px;
  }
  .model-credit {
    font-size: 8px;
  }
  footer p {
    font-size: 9px;
    margin-top: 5px;
  }
  .display-options > summary {
    font-size: 10px;
    padding-top: 6px;
  }
}
