#lab {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    padding: 84px 16px 110px;
    box-sizing: border-box;
    -webkit-user-select: text;
    user-select: text;
}

.subject { max-width: 1500px; margin: 0 auto 64px; }
.subject h2 {
    font: 700 28px/1 "Chakra Petch", system-ui, sans-serif;
    margin: 0 0 6px 64px;
}
.subject .want { margin: 0 0 18px 64px; color: #a9a9b3; font-weight: 400; line-height: 1.5; max-width: 70ch; }
.subject .want b { color: var(--punch); font-weight: 600; }

.grid {
    display: grid;
    grid-template-columns: 56px repeat(var(--cols), 1fr);
    gap: 8px;
    align-items: center;
}
.grid .head { text-align: center; color: #a9a9b3; padding-bottom: 2px; }
.grid .side { writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; color: #a9a9b3; }
.grid button.shot {
    display: block;
    padding: 0;
    width: 100%;
    aspect-ratio: 2 / 3;
    background: #1e1e22;
    cursor: zoom-in;
}
.grid button.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.grid button.shot:hover { outline: 2px solid var(--punch); outline-offset: 2px; }

/* The skill file: a download, a copy button and the file itself. */
.skill { margin-top: -24px; }
.skill .get { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; }
.frame-button {
    display: inline-block;
    padding: 11px 22px;
    font: 600 13px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: #000;
    background: var(--punch);
    text-decoration: none;
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.intro a.frame-button { color: #000; border: 0; }
.frame-button:hover { background: #fff; }
.skill pre {
    margin: 0;
    max-height: 60vh;
    overflow: auto;
    padding: 18px 20px;
    background: #1e1e22;
    border-left: 3px solid var(--punch);
    font: 400 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* The three approaches being tested each get a colour: Obsession yellow, Craft green, Blend the two together. */
.c-obsession { color: var(--punch) !important; }
.c-craft { color: #7ee89a !important; }
.c-blend {
    background: linear-gradient(90deg, var(--punch), #7ee89a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

/* The prompt parts, in the key and in the viewer. */
.p-style { --part: #b9a7ff; }
.p-subject { --part: #f1f1f3; }
.p-detail { --part: #8f8f9c; }
.p-obsession { --part: #fffc00; }
.p-leave { --part: #6fd3ff; }
.p-mood { --part: #ffab5e; }
.p-craft { --part: #7ee89a; }
.p-rules { --part: #ff7d8e; }

.intro {
    max-width: 760px;
    margin: 0 auto 72px;
    font: 400 16px/1.55 "Chakra Petch", system-ui, sans-serif;
}
.intro h1 { font: 700 44px/1.05 "Chakra Petch", system-ui, sans-serif; margin: 0 0 20px; }
.intro h2 { font: 700 22px/1.2 "Chakra Petch", system-ui, sans-serif; margin: 36px 0 10px; }
.intro p { margin: 0 0 14px; }
.intro a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--punch); }
.intro a:hover { color: var(--punch); }
.intro dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 18px 0 0; }
.intro dt { font: 600 13px/1.9 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #a9a9b3; }
.intro dd { margin: 0; }
.intro .key dt { color: var(--part); }
.intro .key dt::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    background: var(--part);
}

@media (max-width: 760px) {
    .grid { grid-template-columns: 22px repeat(var(--cols), 1fr); gap: 4px; }
    .grid .head { font-size: 9px; }
    .subject h2, .subject .want { margin-left: 26px; }
}

#view {
    position: fixed;
    inset: 0;
    z-index: 3;
    background: rgba(24, 24, 28, 0.985);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 64px 24px 24px;
    box-sizing: border-box;
}
#view[hidden] { display: none; }
#view figure {
    margin: 0;
    height: 100%;
    max-width: 54%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
#view figure img { flex: 0 1 auto; min-height: 0; max-width: 100%; object-fit: contain; cursor: zoom-out; }
#view .parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; flex-shrink: 0; }
#view .parts span { color: var(--part); white-space: nowrap; }
#view .parts span::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    background: var(--part);
}
#view .nav { flex-shrink: 0; width: 48px; height: 48px; }
#view .nav svg { width: 22px; height: 22px; }
#view #close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; }
#view #close svg { width: 18px; height: 18px; }
#view .panel {
    position: relative;
    transform: none;
    left: auto;
    bottom: auto;
    width: min(420px, 36vw);
    max-height: 100%;
    overflow: hidden;
    -webkit-user-select: text;
    user-select: text;
}
#view .panel .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
#view .panel b { color: #a9a9b3; }
#view .prompt {
    margin: 0;
    font-weight: 400;
    line-height: 1.6;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
#view .prompt span { color: var(--part); }

@media (max-width: 760px) {
    #view { flex-wrap: wrap; align-content: center; gap: 12px; padding: 64px 16px 16px; }
    #view figure { order: 0; max-width: 100%; height: 55%; flex-basis: 100%; }
    #view .nav { order: 1; }
    #view .panel { order: 2; width: 100%; max-height: calc(45% - 72px); }
    .intro dl { grid-template-columns: 1fr; gap: 2px; }
    .intro dd { margin-bottom: 10px; }
}

/* Where the bar's jumps land: clear of the badge. */
#intro, #skill, #sets { scroll-margin-top: 72px; }

/* The explainer under the title. */
/* In the shell's frame, so it reads as its own thing. The frame is fixed and centred by default: undo that. */
#explain.frame {
    position: relative;
    left: auto;
    transform: none;
    margin: 6px 0 40px;
    padding: 22px 22px 10px;
}
#explain .stage { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 26px; align-items: stretch; }
#explain .pic { position: relative; aspect-ratio: 2 / 3; background: #1e1e22; overflow: hidden; }
#explain .pic img, #explain .pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#explain .pic img.under { opacity: 0; }
#explain .pic img.over { opacity: 0; }
#explain .words { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#explain .say {
    margin: 0 0 14px;
    min-height: 2.6em;
    font: 700 21px/1.3 "Chakra Petch", system-ui, sans-serif;
    opacity: 0;
}
#explain .box {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
    background: #1e1e22;
    border-left: 3px solid var(--punch);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
#explain .typed { margin: 0; font: 400 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
#explain .typed span { color: var(--part); transition: opacity 0.6s; }
#explain .typed span.old { opacity: 0.4; }
#explain .dots { display: flex; justify-content: center; gap: 4px; margin-top: 14px; }
#explain .dots button { width: 26px; height: 26px; padding: 0; background: none; cursor: pointer; }
#explain .dots button::after {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    margin: auto;
    border: 2px solid #000;
    border-radius: 50%;
    background: #6a6a72;
}
#explain .dots button:hover::after { background: #fff; }
#explain .dots button.on::after { background: var(--punch); }

@media (max-width: 640px) {
    #explain .stage { grid-template-columns: 1fr; gap: 14px; }
    #explain .pic { width: min(100%, 300px, 24vh); margin: 0 auto; }
    #explain .say { font-size: 18px; min-height: 0; margin-bottom: 10px; }
    #explain .box { flex: none; height: 150px; }
}

/* ?video: just the title and the explainer, laid out for a 1920x1080 recording. */
body.video #bar, body.video #intro > p, body.video #intro > dl, body.video #skill, body.video #sets { display: none; }
body.video #lab { padding: 34px 60px 0; overflow: hidden; }
body.video .intro { max-width: 1120px; }
body.video .intro h1 { margin-bottom: 18px; }
body.video #explain.frame { margin: 0; padding: 26px 28px 10px; }
body.video #explain .stage { grid-template-columns: 340px 1fr; gap: 34px; }
body.video #explain .say { font-size: 30px; }
body.video #explain .typed { font-size: 16px; }
