.hb-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.25rem - 2rem);
    height: calc(100dvh - 3.25rem - 2rem);
    min-height: 420px;
}

.hb-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}

.hb-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
}

.hb-header p {
    margin: 0;
    color: #5b6472;
}

.hb-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #9ddcff;
    box-shadow: 0 6px 24px rgba(20, 40, 80, .18);
}

.hb-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.hb-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #1d4b7a;
}

.hb-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    font-size: .9rem;
}

.hb-hud > * {
    pointer-events: auto;
}

.hb-plan {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 232px;
    padding: 12px 14px;
    color: #fff;
    background:
        linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px) 0 0 / 16px 16px,
        linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px) 0 0 / 16px 16px,
        rgba(29, 95, 209, .92);
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 10px;
}

.hb-plan h2 {
    margin: 0 0 8px;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.hb-plan ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hb-plan li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    opacity: .6;
}

.hb-plan li.active {
    opacity: 1;
    font-weight: 700;
}

.hb-plan li.done {
    opacity: .9;
}

.hb-tick {
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 3px;
}

.hb-plan li.active .hb-tick {
    background: #ffd23f;
    border-color: #ffd23f;
}

.hb-plan li.done .hb-tick {
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5l2.6 2.6L10 3.6' fill='none' stroke='%231d5fd1' stroke-width='2.2'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.hb-name {
    flex: 1;
}

.hb-count {
    font-variant-numeric: tabular-nums;
    font-size: .78rem;
    opacity: .85;
}

.hb-crew {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 250px;
    padding: 10px;
    background: rgba(255, 255, 255, .93);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(20, 40, 80, .2);
    color: #2a3442;
}

.hb-crew h2 {
    margin: 0 4px 6px;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #1d5fd1;
}

.hb-crew ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hb-crew li button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 3px 6px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.hb-crew li button:hover {
    background: #eaf1fb;
}

.hb-crew li button.on {
    border-color: #1d5fd1;
    background: #dfeaff;
}

.hb-dot {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .35);
}

.hb-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.hb-who small {
    font-size: .72rem;
    color: #5b6472;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hb-cam {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #d6dde8;
}

.hb-cam[hidden] {
    display: none;
}

.hb-cam button {
    border: 2px solid #1d5fd1;
    background: #fff;
    color: #1d5fd1;
    font-weight: 700;
    font-size: .8rem;
    padding: 2px 8px;
    cursor: pointer;
}

.hb-cam button.on,
.hb-cam button:hover {
    background: #1d5fd1;
    color: #fff;
}

.hb-cam .hb-site {
    border-radius: 8px;
}

.hb-controls {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .92);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(20, 40, 80, .2);
}

.hb-progress {
    flex: 1;
    height: 12px;
    background: #dfe6ee;
    border-radius: 6px;
    overflow: hidden;
}

.hb-progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff8a3d, #ffd23f);
    transition: width .2s;
}

.hb-pct {
    width: 3em;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #2a3442;
}

.hb-speed {
    display: flex;
}

.hb-controls button {
    border: 2px solid #1d5fd1;
    background: #fff;
    color: #1d5fd1;
    font-weight: 700;
    padding: 3px 12px;
    cursor: pointer;
}

.hb-speed button + button {
    border-left: 0;
}

.hb-speed button:first-child {
    border-radius: 8px 0 0 8px;
}

.hb-speed button:last-child {
    border-radius: 0 8px 8px 0;
}

.hb-controls button.on,
.hb-controls button:hover {
    background: #1d5fd1;
    color: #fff;
}

.hb-controls .hb-restart {
    border-radius: 8px;
    border-color: #f26a1b;
    color: #c2470a;
}

.hb-controls .hb-restart:hover {
    background: #f26a1b;
    color: #fff;
}

/* music on/off */
.hb-controls .hb-music {
    border-radius: 8px;
}

/* record button, in the corner beside Build again */
.hb-controls .hb-record {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 6.5em;
    border-radius: 8px;
    border-color: #d62f4b;
    color: #b0213a;
    font-variant-numeric: tabular-nums;
}

.hb-rec-dot {
    width: .7em;
    height: .7em;
    border-radius: 50%;
    background: #e5304f;
}

.hb-controls .hb-record:hover,
.hb-controls .hb-record.recording {
    background: #d62f4b;
    color: #fff;
}

.hb-record:hover .hb-rec-dot,
.hb-record.recording .hb-rec-dot {
    background: #fff;
}

.hb-record.recording .hb-rec-dot {
    border-radius: 2px;
    animation: hb-rec 1s ease-in-out infinite;
}

@keyframes hb-rec {
    50% { opacity: .35; }
}

/* the Start button, in the middle of the scene until the build begins */
.hb-start {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 24px);
    text-align: center;
}

.hb-start[hidden] {
    display: none;
}

.hb-start-btn {
    padding: .7rem 2.2rem;
    border: 4px solid #fff;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff5d8f, #ffa23a);
    color: #fff;
    font: inherit;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 0 #a8324f, 0 12px 24px rgba(0, 20, 70, .35);
    transition: transform .12s, box-shadow .12s;
}

.hb-start-btn:hover,
.hb-start-btn:focus-visible {
    transform: translateY(3px);
    box-shadow: 0 3px 0 #a8324f, 0 8px 16px rgba(0, 20, 70, .35);
}

.hb-start p {
    margin: 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(30, 40, 70, .78);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}

/* a short message over the scene (e.g. where a recording was saved) */
.hb-note {
    position: absolute;
    right: 12px;
    bottom: 64px;
    max-width: calc(100% - 24px);
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(30, 40, 70, .88);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}

@media (max-width: 900px) {
    .hb-crew {
        width: 150px;
    }

    .hb-who small {
        display: none;
    }

    .hb-plan li:not(.active) {
        display: none;
    }
}

@media (max-width: 640px) {
    .hb-plan {
        width: 180px;
        font-size: .78rem;
        padding: 8px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hb-record.recording .hb-rec-dot { animation: none; }
    .hb-start-btn { transition: none; }
}
