/* Pixel Lab: a full-screen stage with an instrument dock under it. Builds on site.css.
   The stage is a low-res canvas scaled up in whole pixels; a second canvas over it carries
   the bloom. Sizes that depend on the pixel scale are set from lab.js. */

body.lab{height:100svh;height:100dvh;display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none}

/* The header floats over the stage. Its links take taps; the space between them falls through. */
body.lab .bar{pointer-events:none}
body.lab .bar > *{pointer-events:auto}

.lab main{position:relative;z-index:1;flex:1 1 auto;min-height:0;pointer-events:none}
.stage-wrap{position:absolute;inset:0;overflow:hidden;background:var(--night);pointer-events:auto}
#stage,#bloom{position:absolute;left:0;bottom:0;width:100%;height:100%;max-width:none}
#stage{image-rendering:crisp-edges;image-rendering:pixelated;touch-action:none;cursor:crosshair;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
#stage:focus-visible{outline-offset:-5px}
#bloom{display:none;pointer-events:none}
@supports (mix-blend-mode:screen){#bloom{display:block;mix-blend-mode:screen}}
@supports (mix-blend-mode:plus-lighter){#bloom{mix-blend-mode:plus-lighter}}

.lab-copy{position:absolute;z-index:2;top:calc(var(--head-h) + 4px);left:var(--gutter);right:var(--gutter);pointer-events:none}
.lab-copy h1{font:400 var(--step-4)/.9 var(--display);text-transform:uppercase;letter-spacing:.005em}
.lab-copy p{margin-top:8px;max-width:26ch;color:var(--mist);transition:opacity .25s}
.is-lit .lab-copy p{opacity:0}

.hint{position:absolute;z-index:2;left:0;right:0;top:50%;display:flex;align-items:center;justify-content:center;gap:14px;pointer-events:none;font:500 13px/1 var(--label);letter-spacing:.16em;text-transform:uppercase;color:var(--mist)}
.hint::before,.hint::after{content:"";width:22px;height:1px;background:var(--line-2)}
.need-js{position:absolute;z-index:3;left:var(--gutter);right:var(--gutter);top:50%;text-align:center;color:var(--mist)}

/* The dock */
.dock{--ink:var(--amber);position:relative;z-index:6;flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px max(10px,env(safe-area-inset-bottom,0px));border-top:1px solid var(--line-2);background:var(--slate)}
.dock > *{flex:1 1 100%;min-width:0}
.dock button,.custom{-webkit-tap-highlight-color:transparent;touch-action:manipulation}

/* The monitor sits on the dock's top edge, over the stage: the sprite that Export would
   save, at its true size, and what the lab last did. Taps pass through it. */
.monitor{position:absolute;left:12px;right:12px;bottom:calc(100% + 10px);display:flex;align-items:flex-end;gap:10px;pointer-events:none}
#preview{flex:none;box-sizing:content-box;width:64px;height:64px;border:1px solid var(--line-2);border-radius:var(--r-box);background:rgba(8,9,11,.84);image-rendering:crisp-edges;image-rendering:pixelated}
.monitor-text{min-width:0;max-width:21rem;text-shadow:0 0 6px var(--night),0 1px 2px var(--night)}
.kicker{font:600 13px/1.25 var(--label);letter-spacing:.04em;color:var(--paper)}
.status{min-height:1.35em;font-size:var(--step--1);line-height:1.35;color:var(--mist)}
.calm-note{margin-top:2px;font-size:var(--step--1);line-height:1.35;color:var(--ash)}

/* Effect pads: seven effects and a wild card. The lamp in the corner shows which is armed. */
.pads{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.pad{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:54px;padding:6px 4px;border:1px solid var(--line);border-radius:var(--r-box);background:var(--night);color:var(--mist);font:500 12px/1 var(--label);letter-spacing:.06em;text-transform:uppercase;transition:color .18s,border-color .18s,background .18s,transform .18s var(--ease)}
.pad::after{content:"";position:absolute;top:5px;right:5px;width:4px;height:4px;background:var(--line-2);transition:background .18s,box-shadow .18s}
.pad:hover{color:var(--paper);border-color:var(--line-2)}
.pad:active{transform:translateY(1px)}
.pad[aria-pressed="true"]{color:var(--paper);border-color:var(--ink);background:var(--slate-2)}
.pad[aria-pressed="true"]::after{background:var(--ink);box-shadow:0 0 6px var(--ink)}
.pad.is-hit::after{background:var(--paper);box-shadow:0 0 10px 1px var(--ink);transition:none}
.pad-random::after{display:none}
.pad-art{flex:none;width:24px;height:24px;image-rendering:crisp-edges;image-rendering:pixelated}
.pad-name{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Colours. Each chip shows three steps of the ramp its colour cools through. */
.inks{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:2px;justify-items:center}
.swatch{position:relative;width:100%;max-width:48px;min-height:44px;padding:0;border:0;background:transparent}
.swatch::before{content:"";position:absolute;left:50%;top:50%;width:26px;height:26px;margin:-13px 0 0 -13px;border-radius:50%;background:var(--chip);transition:transform .18s var(--ease),box-shadow .18s}
.swatch:hover::before{transform:scale(1.12)}
.swatch[aria-pressed="true"]::before{box-shadow:0 0 0 2px var(--slate),0 0 0 4px var(--paper)}
.swatch[data-color="#f2a33a"]{--chip:linear-gradient(135deg,#fde2ab 0 30%,#f2a33a 30% 68%,#91461a 68%)}
.swatch[data-color="#ff6b6b"]{--chip:linear-gradient(135deg,#ffc5bf 0 30%,#ff6b6b 30% 68%,#993045 68%)}
.swatch[data-color="#3ddc97"]{--chip:linear-gradient(135deg,#aefad1 0 30%,#3ddc97 30% 68%,#1b846c 68%)}
.swatch[data-color="#5cc8ff"]{--chip:linear-gradient(135deg,#b8eeff 0 30%,#5cc8ff 30% 68%,#295d99 68%)}
.swatch[data-color="#b388ff"]{--chip:linear-gradient(135deg,#e3cbff 0 30%,#b388ff 30% 68%,#4c3d99 68%)}
.swatch[data-color="#ffe66d"]{--chip:linear-gradient(135deg,#fffac0 0 30%,#ffe66d 30% 68%,#997331 68%)}
.swatch[data-color="#f4f1ea"]{--chip:linear-gradient(135deg,#fdfdf9 0 30%,#f4f1ea 30% 68%,#938d88 68%)}
.custom{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;color:var(--ash);font:500 12px/1 var(--label);letter-spacing:.08em;text-transform:uppercase;cursor:pointer}
.custom-word{display:none}
.custom input{-webkit-appearance:none;appearance:none;flex:none;width:30px;height:30px;padding:3px;border:0;border-radius:50%;background:conic-gradient(#ff6b6b,#ffe66d,#3ddc97,#5cc8ff,#b388ff,#ff6b6b);cursor:pointer;transition:box-shadow .18s}
.custom input::-webkit-color-swatch-wrapper{padding:0}
.custom input::-webkit-color-swatch{border:2px solid var(--slate);border-radius:50%}
.custom input::-moz-color-swatch{border:2px solid var(--slate);border-radius:50%}
.custom.is-on input{box-shadow:0 0 0 2px var(--slate),0 0 0 4px var(--paper)}

/* Size, then the two things you do with what you made. */
.deck{display:flex;align-items:center;gap:6px}
.sizes{flex:none;display:inline-flex;border:1px solid var(--line-2);border-radius:var(--r-pill)}
.sizes button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:44px;min-height:44px;padding:0 12px;border:0;background:transparent;color:var(--mist);font:500 12px/1 var(--label);letter-spacing:.08em;text-transform:uppercase;transition:background .18s,color .18s}
.sizes button:first-child{border-radius:var(--r-pill) 0 0 var(--r-pill)}
.sizes button:last-child{border-radius:0 var(--r-pill) var(--r-pill) 0}
.sizes button + button{border-left:1px solid var(--line)}
.sizes button:hover{color:var(--paper)}
.sizes button:focus-visible{outline-offset:-3px}
.sizes button[aria-pressed="true"]{background:var(--slate-2);color:var(--paper)}
.size-dot{flex:none;background:var(--ash)}
[data-size="small"] .size-dot{width:6px;height:6px}
[data-size="medium"] .size-dot{width:10px;height:10px}
[data-size="large"] .size-dot{width:14px;height:14px}
.sizes button[aria-pressed="true"] .size-dot{background:var(--ink)}
.size-word{display:none}
.dock .btn{flex:1 1 0;min-width:0;padding:10px 12px}
.dock .btn[aria-busy="true"]{opacity:.6;cursor:progress}
#play::before{content:"";flex:none;width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor}
.is-playing #play::before{width:9px;height:9px;border:0;background:currentColor}
#motion[aria-pressed="true"]{border-color:var(--paper)}

.status-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}
.status-row .btn{flex:none;padding:10px 16px}
body.lab .store-link{position:static;flex:none;max-width:100%;margin-left:auto;background:transparent}
body.lab .store-link:hover,body.lab .store-link:focus-visible{background:var(--amber)}

@media (min-width:600px){
  .pads{grid-template-columns:repeat(8,minmax(0,1fr))}
}
@media (min-width:720px){
  .inks{flex:0 0 auto;grid-template-columns:repeat(8,40px)}
  .deck{flex:1 1 0}
  .dock .deck .btn{flex:0 1 auto;padding:10px 20px}
}
@media (min-width:900px){
  .dock{gap:10px 24px;padding:12px var(--gutter) max(12px,env(safe-area-inset-bottom,0px))}
  .monitor{left:var(--gutter);right:var(--gutter);bottom:calc(100% + 14px)}
  .pads{gap:8px}
  .pad{flex-direction:row;gap:8px;min-height:48px;font-size:13px}
  .deck{flex:0 0 auto;gap:8px}
  .status-row{flex:1 1 auto}
}
@media (min-width:1280px){
  .size-word,.custom-word{display:inline}
  .inks{grid-template-columns:repeat(7,40px) auto}
  .custom{padding:0 4px 0 8px}
}

/* On the narrowest phones the shared header's links wrap to a third row. */
@media (max-width:359px){
  .lab-copy{top:calc(var(--head-h) + 24px)}
}

/* Short screens (a phone on its side): one row of text-only pads, and a smaller title. */
@media (max-height:520px){
  .lab-copy h1{font-size:var(--step-3)}
  .lab-copy p,.calm-note{display:none}
  .pad{flex-direction:row;min-height:44px}
  .pad-art{display:none}
  .dock{gap:6px 16px;padding-top:8px}
}
