.office-scene {
  --scene-ratio: 16 / 9;
  overflow: hidden;
}

.office-scene:focus {
  outline: none;
}

.office-scene > .scene-art {
  transform: scale(1.032);
}

.office-player {
  position: absolute;
  top: var(--player-feet, 96%);
  left: 50%;
  height: var(--player-height, 11%);
  aspect-ratio: 156 / 282;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.office-player-sprite {
  width: 100%;
  height: calc(100% * 320 / 282);
  aspect-ratio: auto;
  background: none;
}

.office-reaction {
  position: absolute;
  width: 4.6cqw;
  height: auto;
  transform: translateX(-50%);
  image-rendering: pixelated;
  pointer-events: none;
}

.player-reaction {
  left: 50%;
  bottom: 100%;
}

.teacher-reaction {
  left: 50%;
  bottom: 86%;
}

.office-reaction:not([hidden]) {
  animation: office-reaction-in 360ms steps(5, end) both;
}

@keyframes office-reaction-in {
  from { transform: translate(-50%, 22%) scale(0.75); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.office-dialogue {
  position: absolute;
  inset: auto 11% 1.5%;
  aspect-ratio: 1275 / 386;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  color: #45240f;
  touch-action: manipulation;
}

.office-dialogue-button {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.office-dialogue-button:focus-visible {
  outline: 2px solid #fff0b7;
  outline-offset: -2px;
}

.office-dialogue-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.office-line {
  position: absolute;
  inset: 13% 40% 16% 4.5%;
  text-align: left;
  font-size: clamp(9px, 1.85cqw, 26px);
  line-height: 1.45;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.office-portrait {
  position: absolute;
  left: 73%;
  top: 18%;
  width: 15%;
  height: 50%;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
}

.office-speaker {
  position: absolute;
  inset: 81% 5.4% 11.8% 67%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(19px, 1.28cqw, var(--speaker-fit, 1.28cqw));
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .office-reaction:not([hidden]) { animation: none; }
}

.office-speed {
  position: absolute;
  right: 2.1%;
  bottom: 2.4%;
  width: clamp(28px, 4.6cqw, 58px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: #201910;
  touch-action: manipulation;
}

.office-speed-icon {
  position: relative;
  width: 73%;
  aspect-ratio: 1;
  border: max(1.5px, .22cqw) solid currentColor;
  border-radius: 50%;
  background: #d0d0cf;
  box-sizing: border-box;
}

.office-speed-icon i {
  position: absolute;
  left: 44%;
  top: 50%;
  width: 38%;
  aspect-ratio: 1;
  box-sizing: border-box;
  border-right: max(1.5px, .22cqw) solid currentColor;
  border-top: max(1.5px, .22cqw) solid currentColor;
  border-radius: 14%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.office-speed-icon i + i { display: none; }
.office-speed:not([data-mode="normal"]) .office-speed-icon i { left: 29%; }
.office-speed:not([data-mode="normal"]) .office-speed-icon i + i {
  display: block;
  left: 55%;
}

.office-speed[aria-pressed="true"] .office-speed-icon {
  background: #ffcb62;
  box-shadow: 0 0 0 max(1px, .17cqw) #fff0a7;
}

.office-speed:focus-visible {
  outline: 2px solid #fff0b7;
  outline-offset: -2px;
  border-radius: 50%;
}

.office-journal-flight {
  position: fixed;
  height: auto;
  transform-origin: left top;
  z-index: 5;
  image-rendering: pixelated;
  pointer-events: none;
}

.office-advance {
  position: absolute;
  left: 58.196%;
  top: 83.42%;
  width: 2.039%;
  height: 4.663%;
  background: url("../assets/ui/dialogue-advance.png") center / contain no-repeat;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .office-advance { animation: office-advance-bob 2.2s ease-in-out infinite; }
}

@keyframes office-advance-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-40%); }
}
