/* Seedream Lab: a long scrolling report inside the shell. */

#lab {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: max(72px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 140px max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    background: radial-gradient(ellipse at 50% -10%, #34343b, var(--bg) 55%) fixed;
    font: 400 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    -webkit-user-select: text;
    user-select: text;
}

#lab > * { max-width: 1400px; margin-left: auto; margin-right: auto; }

#top h1, #lab h2, #detail h2 {
    font-family: "Chakra Petch", sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin: 0;
}

#top h1 { font-size: clamp(40px, 8vw, 88px); line-height: 0.95; }
#totals { color: var(--punch); margin: 10px 0 0; font-weight: 600; }

#play { margin-top: 28px; position: relative; }
#score {
    position: absolute;
    top: 3.2%;
    right: 2.4%;
    display: flex;
    align-items: center;
    gap: 0.4em;
    font: 700 clamp(14px, 2.6vw, 26px)/1 "Chakra Petch", sans-serif;
    color: var(--punch);
    text-shadow: 0 2px 0 #000;
    pointer-events: none;
}
#score i {
    width: 0.96em;
    height: 1em;
    background: url(play/coin.png) 0 0 / 800% 100% no-repeat;
    image-rendering: pixelated;
}
#game {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1b1a2e;
    touch-action: none;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

#recipe, .recipe {
    margin-top: 28px;
    padding: 20px 24px;
    border-left: 3px solid var(--punch);
    background: rgba(0, 0, 0, 0.18);
}
#recipe h2, .recipe h2 { font-size: 22px; margin-bottom: 10px; }
#recipe ol, .recipe ol { margin: 0; padding-left: 1.3em; max-width: 80ch; }
#recipe li, .recipe li { margin: 4px 0; padding-left: 0.3em; }
#recipe li::marker, .recipe li::marker { color: var(--punch); font-weight: 700; }

code { color: var(--punch); font: inherit; font-weight: 600; }

/* Hidden objects: one painting, taken apart and stacked back. */
#find { margin-top: 72px; }
#find .stage { position: relative; max-width: calc(78vh * 3 / 2); margin: 0 auto; }
#find canvas {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #1b1a1e;
    cursor: pointer;
    touch-action: manipulation;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
#find .tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
#find .tools button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: rgba(22, 22, 28, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
#find .tools svg { width: 20px; height: 20px; fill: currentColor; }
#find .tools button:hover { color: var(--punch); }
#find .tools button.on { background: var(--punch); color: #000; }
#find .under { max-width: calc(78vh * 3 / 2); margin: 10px auto 0; display: flex; gap: 14px; align-items: flex-start; }
#find .scenes { display: flex; gap: 6px; flex: none; }
#find .thumb {
    width: 64px;
    height: 48px;
    background: center / cover;
    opacity: 0.5;
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
#find .thumb:hover { opacity: 0.8; }
#find .thumb.on { opacity: 1; outline: 2px solid var(--punch); outline-offset: -2px; }
#find .tray { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
#find .slot {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.22);
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
#find .slot canvas { max-width: 40px; max-height: 40px; }
#find .slot.got { background: rgba(255, 252, 0, 0.16); }
#find.done .slot { background: rgba(255, 252, 0, 0.32); }
@media (max-width: 640px) {
    #find .under { flex-direction: column; }
    #find .slot { width: 40px; height: 40px; }
    #find .slot canvas { max-width: 34px; max-height: 34px; }
}

/* An experiment */
.exp { margin-top: 72px; scroll-margin-top: 24px; }
.exp > h2 { font-size: clamp(26px, 4vw, 38px); }
.exp > .intro { color: #b9b9c2; margin: 4px 0 0; max-width: 80ch; }
.findings { margin: 18px 0 0; padding: 0; list-style: none; max-width: 92ch; }
.findings li { position: relative; padding-left: 20px; margin: 7px 0; }
.findings li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    background: var(--punch);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.group { margin-top: 30px; }
.group > h3 {
    margin: 0 0 10px;
    font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8d8d97;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 10px;
}
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
    display: flex;
    flex-direction: column;
    text-align: left;
    background: rgba(0, 0, 0, 0.22);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    transition: background 0.15s;
    min-width: 0;
}
.card:hover { background: rgba(255, 252, 0, 0.12); }
.card:focus-visible { outline: 2px solid var(--punch); outline-offset: -2px; }

.media {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.grid.wide .media { aspect-ratio: 3 / 2; }
.media img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.media img.px { image-rendering: pixelated; position: absolute; inset: 7%; width: 86%; height: 86%; max-width: none; max-height: none; object-fit: contain; }

.card .label { padding: 7px 9px 9px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { color: #9a9aa4; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.input .name { color: var(--punch); }
.card.error .media { color: #ff6a6a; padding: 14px; font-size: 11px; line-height: 1.4; text-align: center; place-items: center; }

/* Before and after, above an experiment's runs. */
.showcase { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 26px; }
.pair { display: contents; }
.card.big .media { aspect-ratio: 3 / 4; }

/* Backgrounds behind transparent results, switched from the bar. */
.see { background-color: #3a3a41; }
body.checker .see {
    background-color: #c9c9cf;
    background-image: conic-gradient(#e9e9ee 25%, #c9c9cf 0 50%, #e9e9ee 0 75%, #c9c9cf 0);
    background-size: 16px 16px;
}
body.light .see { background-color: #eceae4; }

/* The detail window */
#detail {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 12px;
    background: rgba(10, 10, 14, 0.55);
}
#detail[hidden] { display: none; }
#detail .window {
    width: min(1180px, 100%);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    display: flex;
}
#detail .inner {
    padding: 26px 28px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 26px;
    font: 400 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
    -webkit-user-select: text;
    user-select: text;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 820px) {
    #detail .inner { grid-template-columns: 1fr; padding: 20px 18px; }
}

#detail .big { display: grid; place-items: center; min-height: 280px; max-height: 64vh; }
#detail .big img { max-width: 100%; max-height: 64vh; object-fit: contain; }
#detail .big img.px { image-rendering: pixelated; }
#detail .views { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
#detail .views button {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
#detail .views button.on { background: var(--punch); color: #000; }
#detail .strip { margin-top: 12px; overflow-x: auto; }
#detail .strip img { height: 96px; display: block; }

#detail h2 { font-size: 26px; line-height: 1.1; margin-right: 30px; word-break: break-word; }
#detail .facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 14px 0; }
#detail .facts dt { color: #8d8d97; }
#detail .facts dd { margin: 0; }
#detail .prompt {
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    margin: 6px 0 0;
    max-height: 30vh;
    overflow: auto;
}
#detail .head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; color: #8d8d97; }
#detail .head button { color: var(--punch); }
#detail pre.req { margin: 6px 0 0; padding: 10px 14px; background: rgba(0, 0, 0, 0.3); font-size: 11px; overflow: auto; max-height: 26vh; }
#detail .ins { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
#detail .ins img { height: 96px; max-width: 200px; object-fit: contain; }
#detail .err { color: #ff8080; margin-top: 12px; }
#detail .close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #aaa;
}
#detail .close:hover { color: var(--punch); }
#detail .close svg { width: 16px; height: 16px; fill: currentColor; }
#detail .nav { position: absolute; bottom: 12px; right: 18px; display: flex; gap: 14px; color: #8d8d97; }
#detail .nav button { color: inherit; }
#detail .nav button:hover { color: var(--punch); }

#section-menu { gap: 2px; padding: 10px 8px; max-height: 60vh; overflow-y: auto; }
#section-menu button { text-align: left; padding: 8px 10px; }
#section-menu button:hover { color: var(--punch); }

/* Figures under an experiment's findings */
.figure { margin: 26px 0 0; max-width: 1100px; }
.figure img { display: block; max-width: 100%; height: auto; }
.figure figcaption { color: #9a9aa4; margin-top: 6px; font-size: 12px; max-width: 92ch; }

#find .thumb.gpt { position: relative; }
#find .thumb.gpt::after { content: "GPT"; position: absolute; left: 3px; bottom: 2px; font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 1px 0 #000; }
#find .scenes { flex-wrap: wrap; max-width: 50%; }

/* Animations above the animation runs */
.loops { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 26px; }
.loops .media { aspect-ratio: 1; }
.media .count { position: absolute; right: 6px; bottom: 4px; font-size: 11px; color: #fff; text-shadow: 0 1px 0 #000; }

/* A layer's box over the stacked scene */
#detail .pic { position: relative; display: inline-block; line-height: 0; }
#detail .pic img { max-width: 100%; max-height: 56vh; }
#detail .pic .box { position: absolute; outline: 2px solid var(--punch); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); pointer-events: none; }
#detail .big { overflow: hidden; }

/* Every layer of a layerize */
#detail .layers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 4px;
    margin-top: 12px;
    max-height: 28vh;
    overflow-y: auto;
}
#detail .layers button { display: flex; flex-direction: column; align-items: center; padding: 4px; min-width: 0; }
#detail .layers img { width: 100%; aspect-ratio: 1; object-fit: contain; }
#detail .layers span { font-size: 9px; line-height: 1.2; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.dark #detail .layers span { color: #ccc; }
#detail .layers button.on { outline: 2px solid var(--punch); outline-offset: -2px; }
#detail .inner { overflow-y: auto; }
#detail canvas.apart { width: 100%; aspect-ratio: 3 / 2; max-height: 56vh; display: block; }
