Prompt specification
Build or customize the Three.js 3D scene "Shared Room Schedule Mediation" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Shared Room Schedule Mediation
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/shared-room-schedule-mediation-x3214
Scene Description Prompt:
Resolve overlapping room bookings by moving stylized appointment blocks to satisfy both groups' constraints. Three.js from cdnjs, one HTML file.
Working Three.js Starter (shared-room-schedule-mediation-x3214):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RoomFlow — Booking Conflict Resolver</title>
<style>
:root {
color-scheme: dark;
--bg: #07100e;
--panel: #0c1714;
--panel-2: #101e1a;
--line: rgba(202, 239, 224, 0.11);
--muted: #82988f;
--text: #eef8f3;
--mint: #67e8c2;
--mint-soft: rgba(103, 232, 194, 0.12);
--orange: #ffad66;
--orange-soft: rgba(255, 173, 102, 0.12);
--red: #ff7c7c;
--red-soft: rgba(255, 124, 124, 0.12);
--shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { font: inherit; }
.app {
width: 100%;
height: 100%;
display: grid;
grid-template-rows: 70px minmax(0, 1fr);
background:
radial-gradient(circle at 80% 0%, rgba(71, 177, 143, 0.08), transparent 35%),
var(--bg);
}
header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
padding: 0 24px;
border-bottom: 1px solid var(--line);
background: rgba(7, 16, 14, 0.9);
backdrop-filter: blur(18px);
z-index: 10;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
min-width: 220px;
}
.brand-mark {
width: 35px;
height: 35px;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 3px;
transform: rotate(-7deg);
}
.brand-mark span {
border-radius: 5px;
background: var(--mint);
box-shadow: 0 0 18px rgba(103, 232, 194, 0.18);
}
.brand-mark span:nth-child(2) { opacity: 0.55; }
.brand-mark span:nth-child(3) { opacity: 0.78; }
.brand-mark span:nth-child(4) { background: var(--orange); }
.brand strong {
display: block;
font-size: 16px;
letter-spacing: -0.02em;
}
.brand small {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 11px;
}
.header-center {
display: flex;
align-items: center;
gap: 10px;
color: #a9bdb4;
font-size: 12px;
}
.live-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--mint);
box-shadow: 0 0 0 5px rgba(103, 232, 194, 0.08);
}
.header-actions {
display: flex;
align-items: center;
gap: 10px;
}
.conflict-badge {
display: flex;
align-items: center;
gap: 7px;
padding: 7px 11px;
border: 1px solid rgba(255, 124, 124, 0.17);
border-radius: 999px;
color: #ffaaaa;
background: var(--red-soft);
font-size: 11px;
font-weight: 700;
white-space: nowrap;
}
.conflict-badge.good {
color: var(--mint);
border-color: rgba(103, 232, 194, 0.16);
background: var(--mint-soft);
}
.button {
border: 1px solid var(--line);
border-radius: 10px;
padding: 10px 14px;
color: var(--text);
background: rgba(255, 255, 255, 0.035);
cursor: pointer;
font-size: 12px;
font-weight: 700;
transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.button:hover {
transform: translateY(-1px);
background: rgba(255, 255, 255, 0.07);
border-color: rgba(255, 255, 255, 0.17);
}
.button:disabled {
opacity: 0.5;
cursor: wait;
transform: none;
}
.button.primary {
color: #082018;
border-color: transparent;
background: var(--mint);
box-shadow: 0 10px 28px rgba(103, 232, 194, 0.16);
}
.button.primary:hover { background: #83f0d0; }
main {
min-height: 0;
display: grid;
grid-template-columns: 318px minmax(0, 1fr);
}
aside {
min-height: 0;
overflow: auto;
padding: 27px 23px 24px;
border-right: 1px solid var(--line);
background: linear-gradient(180deg, rgba(14, 27, 23, 0.98), rgba(8, 18, 15, 0.98));
scrollbar-width: thin;
scrollbar-color: rgba(255,255,255,.12) transparent;
}
.eyebrow {
margin-bottom: 10px;
color: var(--mint);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0;
max-width: 260px;
font-size: 31px;
line-height: 1.08;
letter-spacing: -0.045em;
}
.intro {
margin: 13px 0 23px;
color: var(--muted);
font-size: 12px;
line-height: 1.6;
}
.group-card {
position: relative;
margin-bottom: 12px;
padding: 17px;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 16px;
background: rgba(255, 255, 255, 0.025);
}
.group-card::before {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: 3px;
background: var(--group-color);
}
.group-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 14px;
}
.group-title {
display: flex;
align-items: center;
gap: 9px;
font-size: 13px;
font-weight: 800;
}
.group-dot {
width: 9px;
height: 9px;
border-radius: 3px;
background: var(--group-color);
box-shadow: 0 0 16px color-mix(in srgb, var(--group-color) 35%, transparent);
}
.group-meta {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 10px;
font-weight: 500;
}
.status-pill {
padding: 5px 7px;
border-radius: 999px;
color: #ff9b9b;
background: var(--red-soft);
font-size: 9px;
font-weight: 800;
white-space: nowrap;
}
.status-pill.good {
color: var(--mint);
background: var(--mint-soft);
}
.constraint {
display: flex;
align-items: center;
gap: 9px;
margin-top: 9px;
color: #b9c9c2;
font-size: 11px;
line-height: 1.4;
}
.constraint-mark {
flex: 0 0 auto;
width: 17px;
height: 17px;
display: grid;
place-items: center;
border-radius: 50%;
color: var(--group-color);
background: color-mix(in srgb, var(--group-color) 12%, transparent);
font-size: 9px;
font-weight: 900;
}
.health-card {
margin-top: 18px;
padding: 16px;
border: 1px solid var(--line);
border-radius: 16px;
background: rgba(255,255,255,.018);
}
.health-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
color: #c7d7d0;
font-size: 11px;
font-weight: 800;
}
.health-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 8px 0;
border-top: 1px solid rgba(255,255,255,.055);
color: var(--muted);
font-size: 10px;
}
.health-value {
display: flex;
align-items: center;
gap: 6px;
font-weight: 800;
}
.health-value::before {
content: "";
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--red);
}
.health-value.good { color: var(--mint); }
.health-value.good::before { background: var(--mint); }
.legend {
display: flex;
flex-wrap: wrap;
gap: 13px;
margin-top: 17px;
color: var(--muted);
font-size: 9px;
}
.legend span {
display: flex;
align-items: center;
gap: 6px;
}
.legend i {
width: 8px;
height: 8px;
border-radius: 3px;
background: var(--mint);
}
.legend i.orange { background: var(--orange); }
.legend i.conflict { background: var(--red); }
.keyboard-note {
margin-top: 20px;
color: #5f746b;
font-size: 9px;
line-height: 1.65;
}
kbd {
padding: 2px 4px;
border: 1px solid var(--line);
border-radius: 4px;
color: #91a69d;
background: rgba(255,255,255,.03);
font: inherit;
}
#stage {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
background:
radial-gradient(circle at 55% 30%, rgba(81, 171, 140, 0.08), transparent 38%),
linear-gradient(145deg, #091411, #06100d 70%);
}
#scene {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
outline: none;
}
.stage-toolbar {
position: absolute;
z-index: 3;
top: 18px;
left: 20px;
display: flex;
align-items: center;
gap: 9px;
}
.tool-chip {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 11px;
border: 1px solid var(--line);
border-radius: 10px;
color: #9fb2a9;
background: rgba(10, 22, 18, 0.78);
backdrop-filter: blur(12px);
font-size: 10px;
font-weight: 650;
}
.tool-chip strong { color: var(--text); }
.icon-button {
width: 35px;
height: 35px;
display: grid;
place-items: center;
padding: 0;
border: 1px solid var(--line);
border-radius: 10px;
color: #adc0b7;
background: rgba(10, 22, 18, 0.78);
cursor: pointer;
font-size: 15px;
}
.icon-button:hover {
color: white;
background: rgba(26, 45, 38, 0.9);
}
.date-chip {
position: absolute;
z-index: 3;
top: 20px;
right: 20px;
text-align: right;
pointer-events: none;
}
.date-chip strong {
display: block;
font-size: 12px;
letter-spacing: -0.01em;
}
.date-chip span {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 9px;
}
.report {
position: absolute;
z-index: 5;
top: 72px;
right: 20px;
width: min(340px, calc(100% - 40px));
max-height: calc(100% - 168px);
overflow: auto;
padding: 16px;
border: 1px solid rgba(255, 124, 124, 0.2);
border-radius: 15px;
background: rgba(14, 25, 22, 0.94);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
opacity: 0;
transform: translateY(-8px);
pointer-events: none;
transition: 180ms ease;
}
.report.show {
opacity: 1;
transform: none;
pointer-events: auto;
}
.report.valid {
border-color: rgba(103, 232, 194, 0.2);
}
.report-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.report-head strong { font-size: 12px; }
.report-head p {
margin: 5px 0 0;
color: var(--muted);
font-size: 10px;
line-height: 1.5;
}
.close-button {
border: 0;
color: var(--muted);
background: transparent;
cursor: pointer;
font-size: 16px;
}
.report-list {
margin: 13px 0 0;
padding: 0;
list-style: none;
}
.report-list li {
display: flex;
gap: 9px;
padding: 9px 0;
border-top: 1px solid rgba(255,255,255,.06);
color: #bdcbc5;
font-size: 10px;
line-height: 1.5;
}
.report-list li::before {
content: "!";
flex: 0 0 auto;
width: 15px;
height: 15px;
display: grid;
place-items: center;
border-radius: 50%;
color: #ffabab;
background: var(--red-soft);
font-size: 9px;
font-weight: 900;
}
.bottom-bar {
position: absolute;
z-index: 4;
left: 20px;
right: 20px;
bottom: 18px;
min-height: 67px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 11px 12px 11px 16px;
border: 1px solid var(--line);
border-radius: 15px;
background: rgba(9, 20, 16, 0.88);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
}
.selection {
display: flex;
align-items: center;
gap: 12px;
min-width: 0;
}
.selection-swatch {
flex: 0 0 auto;
width: 35px;
height: 35px;
border-radius: 10px;
background: var(--selection-color, var(--mint));
box-shadow: 0 0 20px color-mix(in srgb, var(--selection-color, var(--mint)) 22%, transparent);
}
.selection-copy { min-width: 0; }
.selection-copy strong {
display: block;
overflow: hidden;
color: #edf7f2;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.selection-copy span {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 9px;
}
.bottom-actions {
display: flex;
align-items: center;
gap: 9px;
flex: 0 0 auto;
}
.snap-label {
color: #70867c;
font-size: 9px;
white-space: nowrap;
}
.toast {
position: absolute;
z-index: 8;
left: 50%;
bottom: 101px;
padding: 10px 14px;
border: 1px solid var(--line);
border-radius: 999px;
color: #c7d7d0;
background: rgba(12, 27, 22, 0.94);
box-shadow: var(--shadow);
font-size: 10px;
opacity: 0;
transform: translate(-50%, 8px);
pointer-events: none;
transition: 180ms ease;
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
.success {
position: absolute;
z-index: 9;
inset: 0;
display: grid;
place-items: center;
padding: 20px;
background: rgba(3, 10, 8, 0.48);
backdrop-filter: blur(5px);
opacity: 0;
pointer-events: none;
transition: opacity 220ms ease;
}
.success.show {
opacity: 1;
pointer-events: auto;
}
.success-card {
width: min(390px, 100%);
padding: 28px;
border: 1px solid rgba(103, 232, 194, 0.24);
border-radius: 22px;
background: linear-gradient(145deg, #11251e, #0a1713);
box-shadow: 0 30px 100px rgba(0,0,0,.55);
text-align: center;
transform: translateY(12px) scale(.98);
transition: 240ms ease;
}
.success.show .success-card {
transform: none;
}
.success-icon {
width: 54px;
height: 54px;
display: grid;
place-items: center;
margin: 0 auto 16px;
border-radius: 50%;
color: #082018;
background: var(--mint);
box-shadow: 0 0 35px rgba(103,232,194,.24);
font-size: 24px;
font-weight: 900;
}
.success h2 {
margin: 0;
font-size: 24px;
letter-spacing: -.035em;
}
.success p {
margin: 10px auto 20px;
color: var(--muted);
font-size: 11px;
line-height: 1.65;
}
.confetti {
position: absolute;
z-index: 10;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.confetti i {
position: absolute;
top: 42%;
left: 50%;
width: 8px;
height: 13px;
border-radius: 2px;
background: var(--mint);
animation: burst 1.1s ease-out forwards;
}
@keyframes burst {
from {
opacity: 1;
transform: translate(-50%, -50%) rotate(0deg);
}
to {
opacity: 0;
transform: translate(var(--x), var(--y)) rotate(var(--r));
}
}
@media (max-width: 980px) {
html, body { overflow: auto; }
.app { height: auto; min-height: 100%; grid-template-rows: auto auto; }
header { min-height: 70px; padding: 13px 17px; }
.header-center { display: none; }
main { display: block; }
aside {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
padding: 20px;
border-right: 0;
border-bottom: 1px solid var(--line);
overflow: visible;
}
aside > .intro-block { grid-column: 1 / -1; }
.intro { margin-bottom: 3px; }
.group-card { margin: 0; }
.health-card, .legend, .keyboard-note { display: none; }
#stage { height: 70vh; min-height: 560px; }
}
@media (max-width: 650px) {
header { flex-wrap: wrap; }
.brand { min-width: 0; }
.header-actions { width: 100%; justify-content: flex-end; }
.conflict-badge { margin-right: auto; }
aside { grid-template-columns: 1fr; }
.stage-toolbar { left: 12px; top: 12px; }
.tool-chip span { display: none; }
.date-chip { top: 59px; left: 15px; right: auto; text-align: left; }
.report { top: 95px; right: 12px; width: calc(100% - 24px); }
.bottom-bar { left: 10px; right: 10px; bottom: 10px; }
.snap-label { display: none; }
.selection-copy span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
</style>
</head>
<body>
<div class="app">
<header>
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<span></span><span></span><span></span><span></span>
</div>
<div>
<strong>RoomFlow</strong>
<small>Conflict resolution workspace</small>
</div>
</div>
<div class="header-center">
<span class="live-dot"></span>
<span>Live scheduling canvas</span>
<span>·</span>
<span>Friday, May 16</span>
</div>
<div class="header-actions">
<div id="conflictBadge" class="conflict-badge">
<span>●</span>
<span id="conflictCount">5 conflicts</span>
</div>
<button id="resetButton" class="button">Reset</button>
<button id="autoButton" class="button primary">✦ Resolve schedule</button>
</div>
</header>
<main>
<aside>
<div class="intro-block">
<div class="eyebrow">Launch week · May 16</div>
<h1>Give every meeting room.</h1>
<p class="intro">
Drag appointment blocks across the timeline or between rooms.
Both teams’ requirements must be satisfied at the same time.
</p>
</div>
<div class="group-card" style="--group-color: var(--mint)">
<div class="group-head">
<div>
<div class="group-title">
<span class="group-dot"></span>
Northstar
</div>
<span class="group-meta">3 appointments · teal</span>
</div>
<span id="northstarStatus" class="status-pill">Needs changes</span>
</div>
<div class="constraint">
<span class="constraint-mark">1</span>
Keep all three appointments in the same room.
</div>
<div class="constraint">
<span class="constraint-mark">2</span>
Every appointment starts on the hour.
</div>
</div>
<div class="group-card" style="--group-color: var(--orange)">
<div class="group-head">
<div>
<div class="group-title">
<span class="group-dot"></span>
Lumen
</div>
<span class="group-meta">2 appointments · orange</span>
</div>
<span id="lumenStatus" class="status-pill">Needs changes</span>
</div>
<div class="constraint">
<span class="constraint-mark">1</span>
Keep both appointments in the same room.
</div>
<div class="constraint">
<span class="constraint-mark">2</span>
Every appointment starts on the half-hour.
</div>
</div>
<div class="health-card">
<div class="health-title">
<span>Constraint health</span>
<span style="color:var(--muted);font-size:9px">LIVE</span>
</div>
<div class="health-row">
<span>Northstar rules</span>
<span id="northstarHealth" class="health-value">Needs changes</span>
</div>
<div class="health-row">
<span>Lumen rules</span>
<span id="lumenHealth" class="health-value">Needs changes</span>
</div>
<div class="health-row">
<span>Room double-bookings</span>
<span id="overlapHealth" class="health-value">1 conflict</span>
</div>
</div>
<div class="legend">
<span><i></i> Northstar</span>
<span><i class="orange"></i> Lumen</span>
<span><i class="conflict"></i> Conflict</span>
</div>
<div class="keyboard-note">
<kbd>←</kbd> <kbd>→</kbd> move 15 minutes · <kbd>↑</kbd> <kbd>↓</kbd> change room<br />
Drag empty space to orbit · Scroll to zoom.
</div>
</aside>
<section id="stage" aria-label="Interactive room booking schedule">
<canvas id="scene" tabindex="0" aria-label="3D room booking timeline. Select and drag appointment blocks."></canvas>
<div class="stage-toolbar">
<div class="tool-chip">
<strong>↔</strong>
<span>Drag bookings · 15 min snap</span>
</div>
<button id="fitButton" class="icon-button" title="Reset camera view" aria-label="Reset camera view">⌖</button>
<button id="zoomInButton" class="icon-button" title="Zoom in" aria-label="Zoom in">+</button>
<button id="zoomOutButton" class="icon-button" title="Zoom out" aria-label="Zoom out">−</button>
</div>
<div class="date-chip">
<strong>Friday, May 16</strong>
<span>09:00 — 17:00 · 4 rooms</span>
</div>
<div id="report" class="report" aria-live="polite">
<div class="report-head">
<div>
<strong id="reportTitle">Schedule conflicts</strong>
<p id="reportSubtitle">Move the highlighted bookings to satisfy every rule.</p>
</div>
<button id="closeReport" class="close-button" aria-label="Close report">×</button>
</div>
<ul id="reportList" class="report-list"></ul>
</div>
<div class="bottom-bar">
<div class="selection">
<div id="selectionSwatch" class="selection-swatch"></div>
<div class="selection-copy">
<strong id="selectionTitle">Sprint workshop</strong>
<span id="selectionMeta">Northstar · Cedar · 10:30 — 12:00</span>
</div>
</div>
<div class="bottom-actions">
<span class="snap-label">15-minute increments</span>
<button id="checkButton" class="button primary">Check schedule</button>
</div>
</div>
<div id="toast" class="toast"></div>
<div id="success" class="success">
<div class="success-card">
<div class="success-icon">✓</div>
<h2>Schedule resolved</h2>
<p>
All five appointments now fit without room conflicts, and both
teams’ timing and room-grouping requirements are satisfied.
</p>
<button id="keepEditing" class="button primary">Keep editing</button>
</div>
</div>
<div id="confetti" class="confetti"></div>
</section>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const canvas = document.getElementById("scene");
const TIME_START = 9 * 60;
const TIME_END = 17 * 60;
const TOTAL_MINUTES = TIME_END - TIME_START;
const GRID_WIDTH = 17.6;
const ROOM_SPACING = 2.25;
const ROOM_NAMES = ["Cedar", "Atlas", "Orbit", "Harbor"];
const ROOM_POSITIONS = ROOM_NAMES.map((_, i) => 3.15 - i * ROOM_SPACING);
const COLORS = {
Northstar: 0x67e8c2,
Lumen: 0xffad66
};
const initialBookings = [
{
id: "northstar-kickoff",
group: "Northstar",
title: "Team kickoff",
duration: 60,
start: 9 * 60,
room: 0
},
{
id: "northstar-sprint",
group: "Northstar",
title: "Sprint workshop",
duration: 90,
start: 10 * 60 + 30,
room: 0
},
{
id: "northstar-handoff",
group: "Northstar",
title: "Team handoff",
duration: 45,
start: 13 * 60,
room: 2
},
{
id: "lumen-discovery",
group: "Lumen",
title: "Client discovery",
duration: 75,
start: 10 * 60 + 30,
room: 0
},
{
id: "lumen-retro",
group: "Lumen",
title: "Launch retro",
duration: 60,
start: 14 * 60,
room: 2
}
];
const solution = {
"northstar-kickoff": { start: 9 * 60, room: 1 },
"northstar-sprint": { start: 11 * 60, room: 1 },
"northstar-handoff": { start: 14 * 60, room: 1 },
"lumen-discovery": { start: 10 * 60 + 30, room: 2 },
"lumen-retro": { start: 14 * 60 + 30, room: 2 }
};
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: true
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
const scene = new THREE.Scene();
const camera = new THREE.OrthographicCamera(-10, 10, 7, -7, 0.1, 100);
const cameraState = {
azimuth: 0.38,
polar: 0.76,
radius: 26,
zoom: 1
};
const ambient = new THREE.HemisphereLight(0xb9ffe7, 0x09110e, 2.0);
scene.add(ambient);
const keyLight = new THREE.DirectionalLight(0xffffff, 3.2);
keyLight.position.set(-7, 16, 10);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -14;
keyLight.shadow.camera.right = 14;
keyLight.shadow.camera.top = 12;
keyLight.shadow.camera.bottom = -12;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x67e8c2, 1.4);
rimLight.position.set(12, 8, -10);
scene.add(rimLight);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(20.2, 10.3),
new THREE.MeshStandardMaterial({
color: 0x0b1713,
roughness: 0.92,
metalness: 0.04
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.045;
floor.receiveShadow = true;
scene.add(floor);
ROOM_POSITIONS.forEach((z, index) => {
const lane = new THREE.Mesh(
new THREE.PlaneGeometry(GRID_WIDTH, 2.08),
new THREE.MeshStandardMaterial({
color: index % 2 === 0 ? 0x10201a : 0x0e1c18,
roughness: 0.95,
transparent: true,
opacity: 0.9
})
);
lane.rotation.x = -Math.PI / 2;
lane.position.set(0, -0.025, z);
lane.receiveShadow = true;
scene.add(lane);
});
function addGridLines(points, color, opacity) {
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity
});
scene.add(new THREE.LineSegments(geometry, material));
}
const minorPoints = [];
const majorPoints = [];
const topZ = ROOM_POSITIONS[0] + 1.13;
const bottomZ = ROOM_POSITIONS[ROOM_POSITIONS.length - 1] - 1.13;
for (let minute = TIME_START; minute <= TIME_END; minute += 30) {
const x = -GRID_WIDTH / 2 + ((minute - TIME_START) / TOTAL_MINUTES) * GRID_WIDTH;
const target = minute % 60 === 0 ? majorPoints : minorPoints;
target.push(
new THREE.Vector3(x, 0.008, topZ),
new THREE.Vector3(x, 0.008, bottomZ)
);
}
for (let i = 0; i <= ROOM_NAMES.length; i++) {
const z = i === 0
? ROOM_POSITIONS[0] + 1.13
: ROOM_POSITIONS[i - 1] - 1.13;
majorPoints.push(
new THREE.Vector3(-GRID_WIDTH / 2, 0.009, z),
new THREE.Vector3(GRID_WIDTH / 2, 0.009, z)
);
}
addGridLines(minorPoints, 0x78958a, 0.12);
addGridLines(majorPoints, 0x9ec4b6, 0.24);
function makeTextSprite(text, color = "#c9ddd5", scale = [1.4, 0.34, 1]) {
const textCanvas = document.createElement("canvas");
textCanvas.width = 768;
textCanvas.height = 128;
const ctx = textCanvas.getContext("2d");
ctx.clearRect(0, 0, textCanvas.width, textCanvas.height);
ctx.font = "700 48px Inter, Arial, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = color;
ctx.fillText(text, textCanvas.width / 2, textCanvas.height / 2);
const texture = new THREE.CanvasTexture(textCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(...scale);
sprite.renderOrder = 20;
return sprite;
}
for (let minute = TIME_START; minute < TIME_END; minute += 60) {
const x = -GRID_WIDTH / 2 + ((minute - TIME_START) / TOTAL_MINUTES) * GRID_WIDTH;
const label = makeTextSprite(
`${String(Math.floor(minute / 60)).padStart(2, "0")}:00`,
"#78958a",
[0.82, 0.25, 1]
);
label.position.set(x, 0.12, 5.12);
scene.add(label);
}
ROOM_NAMES.forEach((name, index) => {
const label = makeTextSprite(
`${String(index + 1).padStart(2, "0")} ${name.toUpperCase()}`,
"#b8cdc4",
[1.85, 0.35, 1]
);
label.position.set(-9.62, 0.22, ROOM_POSITIONS[index]);
scene.add(label);
});
function roundedRectShape(width, height, radius) {
const shape = new THREE.Shape();
const x = -width / 2;
const y = -height / 2;
shape.moveTo(x + radius, y);
shape.lineTo(x + width - radius, y);
shape.quadraticCurveTo(x + width, y, x + width, y + radius);
shape.lineTo(x + width, y + height - radius);
shape.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
shape.lineTo(x + radius, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - radius);
shape.lineTo(x, y + radius);
shape.quadraticCurveTo(x, y, x + radius, y);
return shape;
}
function formatTime(minutes) {
const normalized = ((minutes % 1440) + 1440) % 1440;
const h = Math.floor(normalized / 60);
const m = normalized % 60;
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
}
function timeFor(start, duration) {
return `${formatTime(start)} — ${formatTime(start + duration)}`;
}
function worldXFor(start, duration) {
return -GRID_WIDTH / 2 +
(((start + duration / 2) - TIME_START) / TOTAL_MINUTES) * GRID_WIDTH;
}
function updateLabelTexture(booking) {
const blockWidth = (booking.duration / TOTAL_MINUTES) * GRID_WIDTH;
const canvasHeight = Math.max(190, Math.round(1024 * 0.9 / blockWidth));
const labelCanvas = document.createElement("canvas");
labelCanvas.width = 1024;
labelCanvas.height = canvasHeight;
const ctx = labelCanvas.getContext("2d");
ctx.clearRect(0, 0, 1024, canvasHeight);
const titleSize = Math.min(58, canvasHeight * 0.22);
const detailSize = Math.min(39, canvasHeight * 0.15);
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = `800 ${titleSize}px Inter, Arial, sans-serif`;
ctx.fillStyle = "#f3fff9";
ctx.fillText(booking.title, 512, canvasHeight * 0.40);
ctx.font = `650 ${detailSize}px Inter, Arial, sans-serif`;
ctx.fillStyle = "rgba(238, 255, 248, .78)";
ctx.fillText(
`${booking.groupName.toUpperCase()} · ${timeFor(booking.start, booking.duration)}`,
512,
canvasHeight * 0.70
);
const texture = new THREE.CanvasTexture(labelCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
if (booking.labelTexture) booking.labelTexture.dispose();
booking.labelTexture = texture;
booking.label.material.map = texture;
booking.label.material.needsUpdate = true;
}
const bookings = [];
const bookingById = new Map();
const blockMeshes = [];
initialBookings.forEach((definition) => {
const color = COLORS[definition.group];
const width = (definition.duration / TOTAL_MINUTES) * GRID_WIDTH;
const depth = 1.45;
const height = 0.43;
const geometry = new THREE.ExtrudeGeometry(
roundedRectShape(width, depth, 0.18),
{
depth: height,
bevelEnabled: true,
bevelSegments: 3,
bevelSize: 0.055,
bevelThickness: 0.055,
curveSegments: 8,
steps: 1
}
);
geometry.center();
geometry.rotateX(-Math.PI / 2);
const material = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 0.08,
roughness: 0.3,
metalness: 0.12
});
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
const group = new THREE.Group();
group.add(mesh);
const edge = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry, 28),
new THREE.LineBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.22
})
);
group.add(edge);
const labelWidth = Math.max(1.35, width - 0.18);
const labelHeight = 0.92;
const label = new THREE.Mesh(
new THREE.PlaneGeometry(labelWidth, labelHeight),
new THREE.MeshBasicMaterial({
transparent: true,
depthWrite: false,
side: THREE.DoubleSide
})
);
label.rotation.x = -Math.PI / 2;
label.position.y = height / 2 + 0.012;
label.renderOrder = 3;
group.add(label);
const booking = {
...definition,
color,
groupName: definition.group,
group,
mesh,
material,
label,
labelTexture: null,
targetY: 0.255,
conflictLevel: 0
};
mesh.userData.bookingId = booking.id;
group.position.set(
worldXFor(booking.start, booking.duration),
0.255,
ROOM_POSITIONS[booking.room]
);
scene.add(group);
bookings.push(booking);
bookingById.set(booking.id, booking);
blockMeshes.push(mesh);
updateLabelTexture(booking);
});
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const dragPlane = new THREE.Plane(new THREE.Vector3(0, 1, 0), -0.255);
const planePoint = new THREE.Vector3();
let selectedId = "northstar-sprint";
let drag = null;
let orbit = null;
let issueIds = new Set();
let tween = null;
let toastTimer = null;
function updateCamera() {
const { azimuth, polar, radius, zoom } = cameraState;
camera.position.set(
Math.sin(polar) * Math.sin(azimuth) * radius,
Math.cos(polar) * radius,
Math.sin(polar) * Math.cos(azimuth) * radius
);
camera.lookAt(0, 0.15, 0);
camera.zoom = zoom;
camera.updateProjectionMatrix();
}
function resize() {
const width = stage.clientWidth;
const height = stage.clientHeight;
if (!width || !height) return;
renderer.setSize(width, height, false);
const aspect = width / height;
const viewHeight = Math.max(12.6, 21.4 / aspect);
camera.left = -viewHeight * aspect / 2;
camera.right = viewHeight * aspect / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
}
new ResizeObserver(resize).observe(stage);
resize();
updateCamera();
function overlaps(a, b) {
return a.room === b.room &&
a.start < b.start + b.duration &&
b.start < a.start + a.duration;
}
function updateStackLevels() {
bookings.forEach((booking, index) => {
let level = 0;
bookings.slice(0, index).forEach(other => {
if (overlaps(booking, other)) level++;
});
booking.conflictLevel = level;
booking.targetY = 0.255 + level * 0.55;
});
}
function validate() {
const issues = [];
const [northstar, lumen] = ["Northstar", "Lumen"].map(name => bookings.filter(b => b.groupName === name));
function checkGroup(groupBookings, label, requiredMinute) {
const rooms = new Set(groupBookings.map(b => b.room));
if (rooms.size > 1) {
const roomNames = [...rooms].map(room => ROOM_NAMES[room]).join(", ");
issues.push({
text: `${label} appointments are split across ${roomNames}. Keep them in one room.`,
ids: groupBookings.map(b => b.id)
});
}
groupBookings.forEach(booking => {
const minute = booking.start % 60;
if (minute !== requiredMinute) {
const expected = requiredMinute === 0 ? "on the hour" : "on the half-hour";
issues.push({
text: `“${booking.title}” starts at ${formatTime(booking.start)}. ${label} appointments must start ${expected}.`,
ids: [booking.id]
});
}
});
}
checkGroup(northstar, "Northstar", 0);
checkGroup(lumen, "Lumen", 30);
for (let i = 0; i < bookings.length; i++) {
for (let j = i + 1; j < bookings.length; j++) {
if (overlaps(bookings[i], bookings[j])) {
issues.push({
text: `“${bookings[i].title}” and “${bookings[j].title}” overlap in ${ROOM_NAMES[bookings[i].room]}.`,
ids: [bookings[i].id, bookings[j].id]
});
}
}
}
return issues;
}
function setStatus(element, good, goodText, badText) {
element.textContent = good ? goodText : badText;
element.classList.toggle("good", good);
}
function updateHealth() {
const issues = validate();
issueIds = new Set(issues.flatMap(issue => issue.ids));
const [northstar, lumen] = ["Northstar", "Lumen"].map(name => bookings.filter(b => b.groupName === name));
const northstarGood =
new Set(northstar.map(b => b.room)).size === 1 &&
northstar.every(b => b.start % 60 === 0);
const lumenGood =
new Set(lumen.map(b => b.room)).size === 1 &&
lumen.every(b => b.start % 60 === 30);
const overlapIssues = issues.filter(issue =>
issue.text.includes("overlap in")
);
setStatus(
document.getElementById("northstarStatus"),
northstarGood,
"Satisfied",
"Needs changes"
);
setStatus(
document.getElementById("lumenStatus"),
lumenGood,
"Satisfied",
"Needs changes"
);
setStatus(
document.getElementById("northstarHealth"),
northstarGood,
"Satisfied",
"Needs changes"
);
setStatus(
document.getElementById("lumenHealth"),
lumenGood,
"Satisfied",
"Needs changes"
);
setStatus(
document.getElementById("overlapHealth"),
overlapIssues.length === 0,
"No conflicts",
`${overlapIssues.length} conflict${overlapIssues.length === 1 ? "" : "s"}`
);
const badge = document.getElementById("conflictBadge");
const count = document.getElementById("conflictCount");
badge.classList.toggle("good", issues.length === 0);
count.textContent = issues.length === 0
? "All constraints satisfied"
: `${issues.length} conflict${issues.length === 1 ? "" : "s"}`;
}
function updateSelection() {
const booking = bookingById.get(selectedId);
if (!booking) return;
document.documentElement.style.setProperty(
"--selection-color",
`#${booking.color.toString(16).padStart(6, "0")}`
);
document.getElementById("selectionTitle").textContent = booking.title;
document.getElementById("selectionMeta").textContent =
`${booking.groupName} · ${ROOM_NAMES[booking.room]} · ${timeFor(booking.start, booking.duration)}`;
}
function selectBooking(id) {
selectedId = id;
updateSelection();
}
function showToast(message) {
const toast = document.getElementById("toast");
toast.textContent = message;
toast.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toast.classList.remove("show"), 2200);
}
function showReport(issues) {
const report = document.getElementById("report");
const list = document.getElementById("reportList");
list.innerHTML = "";
if (!issues.length) {
report.classList.add("valid");
document.getElementById("reportTitle").textContent = "Everything fits";
document.getElementById("reportSubtitle").textContent =
"No room conflicts. Every group rule is satisfied.";
report.classList.add("show");
return;
}
report.classList.remove("valid");
document.getElementById("reportTitle").textContent =
`${issues.length} constraint${issues.length === 1 ? "" : "s"} to resolve`;
document.getElementById("reportSubtitle").textContent =
"The affected blocks are marked in red.";
issues.forEach(issue => {
const li = document.createElement("li");
li.textContent = issue.text;
list.appendChild(li);
});
report.classList.add("show");
}
function celebrate() {
const container = document.getElementById("confetti");
container.innerHTML = "";
const colors = ["#67e8c2", "#ffad66", "#ffffff", "#8be8ff"];
for (let i = 0; i < 42; i++) {
const piece = document.createElement("i");
const angle = Math.random() * Math.PI * 2;
const distance = 90 + Math.random() * 260;
piece.style.setProperty("--x", `${Math.cos(angle) * distance}px`);
piece.style.setProperty("--y", `${Math.sin(angle) * distance + 90}px`);
piece.style.setProperty("--r", `${Math.random() * 720 - 360}deg`);
piece.style.background = colors[i % colors.length];
piece.style.animationDelay = `${Math.random() * 0.14}s`;
container.appendChild(piece);
}
setTimeout(() => { container.innerHTML = ""; }, 1500);
}
function showSuccess() {
document.getElementById("success").classList.add("show");
celebrate();
}
function setPointer(event) {
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function moveBooking(booking, start, room) {
booking.start = THREE.MathUtils.clamp(
start,
TIME_START,
TIME_END - booking.duration
);
booking.room = THREE.MathUtils.clamp(room, 0, ROOM_NAMES.length - 1);
booking.group.position.x = worldXFor(booking.start, booking.duration);
booking.group.position.z = ROOM_POSITIONS[booking.room];
updateLabelTexture(booking);
updateStackLevels();
updateSelection();
updateHealth();
}
canvas.addEventListener("pointerdown", event => {
canvas.focus();
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(blockMeshes, false)[0];
if (hit && event.button === 0) {
const booking = bookingById.get(hit.object.userData.bookingId);
selectBooking(booking.id);
dragPlane.set(
new THREE.Vector3(0, 1, 0),
-booking.group.position.y
);
if (raycaster.ray.intersectPlane(dragPlane, planePoint)) {
drag = {
booking,
pointerId: event.pointerId,
offsetX: planePoint.x - booking.group.position.x,
offsetZ: planePoint.z - booking.group.position.z
};
}
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
event.preventDefault();
} else {
orbit = {
pointerId: event.pointerId,
x: event.clientX,
y: event.clientY
};
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "move";
}
});
canvas.addEventListener("pointermove", event => {
if (drag && event.pointerId === drag.pointerId) {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
if (raycaster.ray.intersectPlane(dragPlane, planePoint)) {
const rawX = planePoint.x - drag.offsetX;
const rawCenterMinutes =
TIME_START + ((rawX + GRID_WIDTH / 2) / GRID_WIDTH) * TOTAL_MINUTES;
const rawStart = rawCenterMinutes - drag.booking.duration / 2;
const snappedStart = Math.round(rawStart / 15) * 15;
const rawZ = planePoint.z - drag.offsetZ;
let nearestRoom = 0;
let nearestDistance = Infinity;
ROOM_POSITIONS.forEach((z, index) => {
const distance = Math.abs(rawZ - z);
if (distance < nearestDistance) {
nearestDistance = distance;
nearestRoom = index;
}
});
moveBooking(drag.booking, snappedStart, nearestRoom);
}
return;
}
if (orbit && event.pointerId === orbit.pointerId) {
const dx = event.clientX - orbit.x;
const dy = event.clientY - orbit.y;
orbit.x = event.clientX;
orbit.y = event.clientY;
cameraState.azimuth -= dx * 0.005;
cameraState.polar = THREE.MathUtils.clamp(
cameraState.polar + dy * 0.004,
0.35,
1.18
);
updateCamera();
} else {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(blockMeshes, false)[0];
canvas.style.cursor = hit ? "grab" : "default";
}
});
function endPointer(event) {
if (drag && event.pointerId === drag.pointerId) {
drag = null;
showToast("Booking moved · 15-minute grid");
}
if (orbit && event.pointerId === orbit.pointerId) {
orbit = null;
}
canvas.style.cursor = "default";
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("wheel", event => {
event.preventDefault();
cameraState.zoom = THREE.MathUtils.clamp(
cameraState.zoom * Math.exp(-event.deltaY * 0.001),
0.7,
1.75
);
updateCamera();
}, { passive: false });
canvas.addEventListener("keydown", event => {
const booking = bookingById.get(selectedId);
if (!booking) return;
let handled = true;
if (event.key === "ArrowLeft") {
moveBooking(booking, booking.start - 15, booking.room);
} else if (event.key === "ArrowRight") {
moveBooking(booking, booking.start + 15, booking.room);
} else if (event.key === "ArrowUp") {
moveBooking(booking, booking.start, booking.room - 1);
} else if (event.key === "ArrowDown") {
moveBooking(booking, booking.start, booking.room + 1);
} else {
handled = false;
}
if (handled) {
event.preventDefault();
updateStackLevels();
updateHealth();
}
});
function resetSchedule(animate = false) {
tween = null;
issueIds.clear();
bookings.forEach(booking => {
const original = initialBookings.find(item => item.id === booking.id);
booking.start = original.start;
booking.room = original.room;
const targetX = worldXFor(booking.start, booking.duration);
const targetZ = ROOM_POSITIONS[booking.room];
if (animate) {
tween = {
elapsed: 0,
duration: 850,
items: bookings.map(item => {
const originalItem = initialBookings.find(entry => entry.id === item.id);
return {
booking: item,
fromX: item.group.position.x,
fromZ: item.group.position.z,
toX: worldXFor(originalItem.start, originalItem.duration),
toZ: ROOM_POSITIONS[originalItem.room]
};
})
};
} else {
booking.group.position.x = targetX;
booking.group.position.z = targetZ;
}
updateLabelTexture(booking);
});
updateStackLevels();
updateHealth();
document.getElementById("success").classList.remove("show");
document.getElementById("report").classList.remove("show");
}
function autoResolve() {
if (tween) return;
const button = document.getElementById("autoButton");
button.disabled = true;
button.textContent = "Resolving…";
document.getElementById("success").classList.remove("show");
document.getElementById("report").classList.remove("show");
const items = bookings.map(booking => {
const target = solution[booking.id];
const fromX = booking.group.position.x;
const fromZ = booking.group.position.z;
const toX = worldXFor(target.start, booking.duration);
const toZ = ROOM_POSITIONS[target.room];
booking.start = target.start;
booking.room = target.room;
updateLabelTexture(booking);
return { booking, fromX, fromZ, toX, toZ };
});
tween = { elapsed: 0, duration: 1050, items };
updateStackLevels();
updateHealth();
}
document.getElementById("autoButton").addEventListener("click", autoResolve);
document.getElementById("resetButton").addEventListener("click", () => resetSchedule(true));
document.getElementById("keepEditing").addEventListener("click", () => {
document.getElementById("success").classList.remove("show");
});
document.getElementById("closeReport").addEventListener("click", () => {
document.getElementById("report").classList.remove("show");
});
document.getElementById("checkButton").addEventListener("click", () => {
const issues = validate();
issueIds = new Set(issues.flatMap(issue => issue.ids));
showReport(issues);
if (!issues.length) showSuccess();
});
document.getElementById("fitButton").addEventListener("click", () => {
cameraState.azimuth = 0.38;
cameraState.polar = 0.76;
cameraState.zoom = 1;
updateCamera();
});
document.getElementById("zoomInButton").addEventListener("click", () => {
cameraState.zoom = THREE.MathUtils.clamp(cameraState.zoom * 1.12, 0.7, 1.75);
updateCamera();
});
document.getElementById("zoomOutButton").addEventListener("click", () => {
cameraState.zoom = THREE.MathUtils.clamp(cameraState.zoom / 1.12, 0.7, 1.75);
updateCamera();
});
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
if (tween) {
tween.elapsed += delta * 1000;
const progress = THREE.MathUtils.clamp(tween.elapsed / tween.duration, 0, 1);
const eased = 1 - Math.pow(1 - progress, 3);
tween.items.forEach(item => {
item.booking.group.position.x = THREE.MathUtils.lerp(item.fromX, item.toX, eased);
item.booking.group.position.z = THREE.MathUtils.lerp(item.fromZ, item.toZ, eased);
});
if (progress >= 1) {
tween.items.forEach(item => {
item.booking.group.position.x = item.toX;
item.booking.group.position.z = item.toZ;
});
tween = null;
document.getElementById("autoButton").disabled = false;
document.getElementById("autoButton").textContent = "✦ Resolve schedule";
updateStackLevels();
updateHealth();
showReport([]);
showSuccess();
}
}
bookings.forEach(booking => {
booking.group.position.y = THREE.MathUtils.lerp(
booking.group.position.y,
booking.targetY,
1 - Math.exp(-delta * 11)
);
const isConflict = issueIds.has(booking.id);
const isSelected = booking.id === selectedId;
if (isConflict) {
booking.material.emissive.set(0xff5555);
booking.material.emissiveIntensity = 0.22 + Math.sin(elapsed * 5.2) * 0.10;
} else if (isSelected) {
booking.material.emissive.set(booking.color);
booking.material.emissiveIntensity = 0.17;
} else {
booking.material.emissive.set(booking.color);
booking.material.emissiveIntensity = 0.065;
}
});
renderer.render(scene, camera);
}
resetSchedule(false);
selectBooking(selectedId);
updateHealth();
animate();
</script>
</body>
</html>
```