[VISUAL WORLD RULES]

{visual_world_rules}

[ALL LOCATIONS]

{location_lines}

[SELECTED SHOTS BY SCENE]

Each shot line carries an authoritative location marker `(loc=Lxx)`. If a shot line has no marker, fall back to its scene's `primary_location` shown at the scene header.

{scene_blocks}

[TASK]

Decide the background generation plan for this episode. Following the frequency rules, building group rule, and order constraints in the system instructions, produce a single JSON object that conforms to the schema.

Required output keys: rationale_summary, floor_plans, floor_plan_order, chain_bg_groups, chain_bg_order, prev_shot_only.

Reminders:
- Every location with selected shots must appear in exactly one of floor_plans.location_ids, chain_bg_groups.location_id, or prev_shot_only.location_id.
- 1-shot and 2-shot locations -> prev_shot_only only.
- Outdoor locations (any shot count) -> prev_shot_only only.
- 3+ indoor locations -> floor_plans + chain_bg_groups required.
- Group related indoor + connected exterior locations under one floor_plan via building_group.
- Same building_group floor plans must be adjacent in floor_plan_order.
- chain_bg_groups parent_id (if non-empty) must appear earlier in chain_bg_order.
- All ids snake_case ASCII; no proper nouns from any specific scenario.
- rationale_summary in Korean (1-2 sentences); per-item rationale in one short Korean sentence.

Return JSON only.
