:root {
  --night: #0b0806;
  --card: #efe6d2;
  --card-edge: #cdbf9f;
  --ink: #1d1712;
  --ink-soft: #5b4d3d;
  --marker: #1a1410;
  --bulb: #ffd59a;
  --hand: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --type: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left));
  /* the screen's corners: each edge keeps clear of its own notch or rounded corner, and no more */
  --edge-t: max(12px, env(safe-area-inset-top));
  --edge-l: max(12px, env(safe-area-inset-left));
  --edge-r: max(12px, env(safe-area-inset-right));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--card); overflow: hidden; }
body { font: 15px/1.45 var(--type); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1; }
#stage, #stage canvas { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

/* room intro, top left, like a note taped to the wall */
#intro { position: fixed; top: var(--edge-t); left: var(--edge-l); max-width: 23rem; pointer-events: none; transition: opacity .5s; }
#intro h1 { font: 800 2.3rem/1 var(--hand); margin: 0 0 .55rem; color: var(--bulb); letter-spacing: -.02em; text-shadow: 0 0 24px rgba(255, 180, 90, .2); }
#intro p { margin: 0 0 .5rem; color: #d8ccb4; text-shadow: 0 1px 2px #000; }
#intro .hint { color: var(--bulb); font-weight: 600; font-size: .95rem; }
body.in-crate #intro, body.in-build #intro, body.at-deck #intro { opacity: 0; visibility: hidden; }
body.in-crate #credits, body.at-deck #credits { visibility: hidden; }

/* crate buttons: hidden until focused by keyboard */
#crates button { position: fixed; left: -9999px; }
#crates button:focus-visible { left: 50%; top: var(--gutter); transform: translateX(-50%); background: var(--card); color: var(--ink);
  border: 0; padding: .5rem .8rem; font-weight: 600; outline: 3px solid var(--bulb); }

/* hover label: a handwritten tag that follows the pointer */
#label { position: fixed; pointer-events: none; padding: .3rem .55rem .25rem; background: var(--card); color: var(--marker);
  font: 600 .85rem/1.1 var(--hand); transform: translate(14px, -50%); box-shadow: 0 6px 16px rgba(0,0,0,.5); border-radius: 3px;
  opacity: 0; transition: opacity .15s; white-space: nowrap; }
#label.on { opacity: 1; }

button:focus-visible { outline: 3px solid var(--bulb); outline-offset: 2px; }

#credits { position: fixed; left: var(--edge-l); bottom: max(10px, env(safe-area-inset-bottom)); font-size: .72rem; color: #8d7f69; }
/* start screen: the cover, what this is, progress, then the way in */
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--night); transition: opacity .9s; z-index: 10;
  overflow: auto; padding: var(--gutter); }
#loading.done { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .6s, visibility 0s .6s; }
.start { display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 25rem); gap: 3rem; align-items: center; color: #d8ccb4; }
.start-cover { width: 100%; height: auto; display: block; box-shadow: 0 30px 70px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04); }
.start .kicker { margin: 0; font-size: .72rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #9a8b74; }
.start-title { margin: .35rem 0 .8rem; font: 800 2.6rem/1 var(--type); letter-spacing: -.02em; color: var(--bulb); }
.start .lede { margin: 0 0 1rem; font-size: 1.02rem; line-height: 1.5; }
.start .how { margin: 0 0 1.4rem; color: #c9bca3; }
.start .how strong { color: var(--card); }
.ld-bar { height: 2px; background: rgba(255, 213, 154, .15); overflow: hidden; transition: opacity .4s; }
.ld-bar span { display: block; height: 100%; width: 0; background: var(--bulb); transition: width .3s ease-out; }
.ld-text { margin: .6rem 0 0; font-size: .8rem; color: #9a8b74; font-variant-numeric: tabular-nums; min-height: 1.3em; }
/* progress and the button share one slot: the bar fades out and the button fades in, in place */
.door { display: grid; width: 11.5rem; min-height: var(--tap); }
.door > * { grid-area: 1 / 1; }
.door .ld { align-self: center; transition: opacity .35s; }
.door .ld-text { margin-top: .45rem; }
.door #enter[hidden] { display: inline-flex; visibility: hidden; opacity: 0; transform: translateY(3px); }
.door #enter { width: 100%; transition: opacity .45s .15s, transform .45s .15s, visibility 0s; }
.ready .door .ld { opacity: 0; visibility: hidden; pointer-events: none; } /* gone, not just faded: it mustn't catch the click */
.door #enter { position: relative; z-index: 1; }
.start .actions { margin-top: .9rem; align-items: center; }
@media (max-width: 760px) { /* phones: the cover across the top, edge to edge; text; the way in at the bottom */
  #loading { place-items: stretch; padding: 0; }
  .start { display: flex; flex-direction: column; gap: 0; max-width: none; min-height: 100dvh; }
  .start-cover { width: 100%; height: min(58vh, 100vw); object-fit: cover; object-position: 50% 40%; box-shadow: none;
    -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
  .start-text { flex: 1; display: flex; flex-direction: column; padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom)); margin-top: -2.2rem; position: relative; }
  .start-title { font-size: 2.3rem; margin: .3rem 0 .6rem; }
  .start .lede { font-size: 1rem; margin-bottom: .8rem; }
  .start .how { margin-bottom: 1rem; gap: .3rem; font-size: .92rem; }
  .start .actions { margin-top: auto; flex-direction: column; align-items: stretch; gap: .25rem; }
  .door { width: 100%; }
}
@media (max-width: 760px) and (max-height: 720px) { /* small phones: a shorter cover, tighter text */
  .start-cover { height: 42vh; }
  .start-title { font-size: 2rem; }
  .start .lede { font-size: .92rem; }
  .start .how { font-size: .86rem; margin-bottom: .7rem; }
}
#now-playing { font-size: .82rem; color: #b9ab92 !important; }
#now-playing[hidden] { display: none; }

/* intro and about: cards over the dimmed room */
dialog { border: 0; padding: 0; background: var(--card); color: var(--ink); border-radius: 8px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
dialog::backdrop { background: radial-gradient(ellipse at 50% 40%, rgba(11,8,6,.35), rgba(11,8,6,.85)); }
dialog .kicker { margin: 0; font-size: .72rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-soft); }
dialog h2 { margin: .3rem 0 .7rem; font: 800 2rem/1.05 var(--type); letter-spacing: -.02em; color: var(--marker); }
dialog .lede { font-size: 1.05rem; line-height: 1.5; margin: 0 0 1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.how { margin: 0 0 1rem; padding-left: 1.25rem; display: grid; gap: .45rem; }
.how li { padding-left: .2rem; line-height: 1.45; }
.how li::marker { font-weight: 700; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
#about { width: min(40rem, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 2 * var(--gutter)); overflow: auto; overscroll-behavior: contain; }
#about[open] { animation: rise .4s ease-out; }
#about article { padding: 1.8rem 1.8rem 1.6rem; }
#about .close { position: sticky; top: .8rem; float: right; margin: .8rem .8rem 0 0; background: var(--card); z-index: 1; }
#about h3 { margin: 1.6rem 0 .5rem; font: 700 1.1rem var(--type); color: var(--marker); }
#about p, #about li { line-height: 1.6; }
#about p { margin: 0 0 .8rem; }
#about ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
#about blockquote { margin: .8rem 0; padding: .1rem 0 .1rem 1rem; border-left: 3px solid var(--marker); font: 600 1.15rem/1.4 var(--type); color: var(--marker); }
#about .photo { margin: .4rem 0 1rem; float: right; width: 42%; margin-left: 1.2rem; }
#about .photo img { display: block; width: 100%; height: auto; border-radius: 3px; filter: contrast(1.05); }
#about .photo figcaption { margin-top: .4rem; font-size: .72rem; line-height: 1.35; color: var(--ink-soft); }
#about h3 { clear: both; }
@media (max-width: 640px) { #about .photo { float: none; width: 100%; margin-left: 0; } }
#about blockquote.excerpt { font: 400 1rem/1.6 var(--type); color: var(--ink); border-left-width: 2px; margin: 1rem 0; padding-left: 1.1rem; }
#about blockquote.excerpt p { margin: 0 0 .6rem; }
#about blockquote.excerpt p:last-child { margin-bottom: 0; }
.credits { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.credits dt { font-weight: 700; }
.credits dd { margin: 0; }
#about .small { font-size: .82rem; color: var(--ink-soft); }
dialog a { color: inherit; }
@media (max-width: 640px) {
  dialog h2 { font-size: 1.6rem; }
    #about article { padding: 1.2rem 1.1rem; }
  .credits { grid-template-columns: 1fr; }
  .credits dd { margin-bottom: .4rem; }
}

/* YouTube player: shown, at YouTube's minimum size or more, only while a video plays */
.yt { margin-top: .7rem; width: 100%; height: 200px; position: relative; background: #000; border-radius: 4px; overflow: hidden; }
.yt[hidden] { display: none; }
.card .yt { flex: none; min-height: 200px; } /* never squeezed below YouTube's minimum */
.yt iframe { display: block; width: 100%; height: 100%; border: 0; }
.yt-layer { position: fixed; z-index: 7; background: #000; border-radius: 4px; overflow: hidden; } /* the one player, laid over the box that's showing */
.yt-layer[hidden] { display: none; }
.yt-layer iframe { display: block; width: 100%; height: 100%; border: 0; }
.yt-tap { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); margin: 0; padding: .35rem .7rem; border-radius: 4px; background: rgba(0,0,0,.78); color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; pointer-events: none; }
.yt-tap[hidden] { display: none; }

.start .deep { margin: .5rem 0 .9rem; font-size: .9rem; color: var(--bulb); font-weight: 600; }
.start .deep[hidden] { display: none; }

/* build view: marker lines and notes over the photograph */
#annot { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; overflow: visible; }
body.in-build #annot { display: block; }
.a-halo { stroke: rgba(0, 0, 0, .55); stroke-width: 4; stroke-linecap: round; }
.a-line { stroke: #f4eee0; stroke-width: 1.5; stroke-linecap: round; }
.a-dot { fill: #f4eee0; }
.a-note { fill: #f4eee0; font: 700 11px var(--type); letter-spacing: .12em; text-transform: uppercase;
  paint-order: stroke; stroke: rgba(0, 0, 0, .8); stroke-width: 3px; stroke-linejoin: round; }
.dim { opacity: .45; }

/* the About button, top right in the room */
body.in-crate .corner, body.in-build .corner, body.at-deck .corner, body.welcome .corner { opacity: 0; pointer-events: none; visibility: hidden; } /* out of the Tab order too */
body.welcome #intro, body.welcome #credits { opacity: 0; }

@media (max-width: 640px) {
  #intro h1 { font-size: 1.9rem; }
  #intro p { font-size: .9rem; }
}

/* progress + the album button in the room note */
.dig-progress { margin: .8rem 0 .7rem; max-width: 15rem; }
#progress { margin: 0 0 .4rem !important; font-size: .9rem; font-weight: 600; color: var(--card) !important; }
.dig-bar { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.dig-bar span { height: 5px; border-radius: 2px; background: rgba(244, 238, 224, .18); transition: background-color .4s; }
.dig-bar span.on { background: var(--bulb); box-shadow: 0 0 8px rgba(255, 180, 90, .35); }
#put-on { pointer-events: auto; }
#put-on.ready { background: var(--bulb); color: var(--ink); border-color: transparent; font-weight: 700; box-shadow: 0 0 26px rgba(255, 180, 90, .28); }
.put-on-note { margin: .45rem 0 0 !important; font-size: .8rem; color: #b9ab92 !important; max-width: 17rem; }
.put-on-note:empty { display: none; }
body.at-deck #intro { opacity: 0; }
body.at-deck #intro #put-on { pointer-events: none; }

/* build: a photo caption set in the panorama's bottom bar */
body.in-build #credits { display: none; }


/* ===================================================================================================
   UI system: buttons, cards, and where the card sits on each kind of screen
   =================================================================================================== */
:root {
  --tap: 40px;               /* button height: mouse and trackpad */
  --pad: 1.1rem;             /* card padding */
  --radius: 10px;
  --btn-radius: 6px;
  --sheet-w: 22rem;
}
@media (pointer: coarse) { :root { --tap: 46px; } } /* fingers: phones, tablets, touch laptops */

/* buttons: one base, a few variants. Light surfaces: primary, secondary, quiet. Dark: light, dark, accent */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--tap); padding: 0 1rem;
  border: 1.5px solid transparent; border-radius: var(--btn-radius); background: none; color: inherit;
  font: 600 .95rem/1 var(--type); white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, opacity .15s; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: .3; cursor: default; }
.btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--ink); color: var(--card); }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-secondary { border-color: rgba(29, 23, 18, .28); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink); }
.btn-quiet { color: var(--ink-soft); }
.btn-quiet:hover:not(:disabled) { color: var(--ink); background: rgba(29, 23, 18, .06); }
.btn-light { background: #f4eee0; color: #111; }
.btn-dark { background: rgba(0, 0, 0, .45); border-color: rgba(244, 238, 224, .35); color: #f4eee0; }
.btn-dark:hover:not(:disabled) { border-color: #f4eee0; }
.btn-accent { background: var(--bulb); color: var(--ink); font-weight: 700; box-shadow: 0 0 26px rgba(255, 180, 90, .28); }
.btn-on-dark { color: #c9bca3; }
.btn-on-dark:hover:not(:disabled) { color: var(--card); background: rgba(255, 255, 255, .08); } /* outranks .btn-quiet's dark hover */

/* the card */
.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: var(--pad); box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; gap: .85rem; }
.card p, .card h2 { margin: 0; }
.card-head { display: flex; align-items: flex-start; gap: .35rem; margin: -.35rem -.45rem 0; }
.card-titles { flex: 1; min-width: 0; padding-top: .35rem; }
.card-head:not(:has(.btn-icon)) { margin: 0; } /* a header with no icon buttons lines up with the body */
.card-head:not(:has(.btn-icon)) .card-titles { padding-top: 0; }
.crate-no { font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-soft); }
.track { font: 700 1.25rem/1.15 var(--type); letter-spacing: -.01em; color: var(--marker); margin-top: .15rem !important; }
.rec-artist { font-weight: 700; font-size: 1rem; }
.rec-title { color: var(--ink); }
.rec-took { color: var(--ink-soft); font-size: .92rem; }
.rec-status { min-height: 1.35em; font-size: .88rem; font-weight: 600; color: #9a3a22; }
.note { font-size: .85rem; line-height: 1.45; color: var(--ink-soft); }
.note[hidden] { display: none; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.stepper { display: flex; align-items: center; gap: .35rem; }
.count { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .92rem; }
.card-actions .play { min-width: 6rem; }
/* the stepper sits in the crate card's header, beside the track: a row saved */
#panel .card-head { margin: 0; align-items: center; } /* lines up with the body, stepper or not */
#panel .card-titles { padding-top: 0; }
.card-head .stepper { flex: none; gap: .2rem; }
.card-head .stepper .btn-icon { width: 36px; min-height: 36px; }
.card-head .stepper .btn-icon svg { width: 18px; height: 18px; }
.card-head .stepper .count { min-width: 2.9rem; font-size: .85rem; }
.stepper[hidden] { display: none; }
/* what Shadow took and what's playing share a line */
.rec-took, .rec-status { display: inline; }
.rec-took:not(:empty) + .rec-status:not(:empty)::before { content: ' · '; color: var(--ink-soft); font-weight: 400; }
#deck .from { color: var(--ink-soft); }

/* where the card sits. Default: laptops and desktops, bottom right */
.sheet { position: fixed; right: var(--gutter); bottom: var(--gutter); width: min(var(--sheet-w), calc(100vw - 2 * var(--gutter))); z-index: 5; }
.sheet[hidden] { display: none; }
.sheet .card { max-height: calc(100dvh - 2 * var(--gutter)); overflow-y: auto; overscroll-behavior: contain; }
/* phones held upright: a sheet along the bottom edge, full width */
@media (orientation: portrait) and (max-width: 700px) {
  :root { --pad: 1rem; }
  .sheet { left: 0; right: 0; bottom: 0; width: auto; }
  .sheet .card { border-radius: 16px 16px 0 0; padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom)); max-height: 75dvh; gap: .7rem; }
  .track { font-size: 1.1rem; }
  body.in-crate #credits, body.at-deck #credits { display: none; }
}
/* phones on their side (and other short screens): a panel down the right, full height */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --pad: .9rem; --sheet-w: 19rem; }
  .sheet { top: var(--edge-t); bottom: max(12px, env(safe-area-inset-bottom)); right: var(--edge-r); display: flex; flex-direction: column; justify-content: flex-end; }
  .sheet .card { gap: .55rem; }
  .track { font-size: 1.05rem; }
  .rec-status { min-height: 0; }
  body.in-crate #credits, body.at-deck #credits { display: none; }
}
/* tablets and big touch screens: same place as desktop, a little wider for fingers */
@media (pointer: coarse) and (min-width: 701px) and (min-height: 541px) { :root { --sheet-w: 24rem; } }

/* the screen's top corners: Back always top left, Share top right (About's place in the room) */
.top-left, .top-right { position: fixed; top: var(--edge-t); z-index: 6; }
.top-left { left: var(--edge-l); padding-left: .7rem; }
.top-right { right: var(--edge-r); padding-left: .8rem; }
.top-left[hidden], .top-right[hidden] { display: none; }

/* build view: the same card as the crate. Its player sits inside it; the two actions split the width */
#build .layer { font-weight: 700; }
#build .b-status { color: #9a3a22; font-size: .88rem; font-weight: 600; min-height: 1.35em; }
#build .b-status:empty { min-height: 0; }
#build .also { font-size: .8rem; color: var(--ink-soft); }
.b-info { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.card-actions.split > .btn { flex: 1 1 0; }
.b-yt { margin-top: 0; }
@media (orientation: portrait) and (max-width: 700px) { .b-yt { height: auto; aspect-ratio: 16 / 9; min-height: 200px; } }
/* laptops, desktops and tablets: laid out wide along the bottom, over the panorama's lower bar, so the
   records stay clear; the player floats just above the card's right end */
@media (min-width: 701px) and (min-height: 541px) {
  .build-sheet { left: var(--gutter); width: auto; }
  .build-sheet .card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); align-items: end; gap: 1.5rem; overflow: visible; }
  .build-sheet .b-yt { position: absolute; right: 0; bottom: calc(100% + 12px); width: 336px; height: 200px; margin: 0; box-shadow: 0 14px 34px rgba(0,0,0,.6); }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dig-progress { margin-top: 0 !important; }

/* small confirmations ("Link copied") */
#toast { position: fixed; left: 50%; bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); transform: translate(-50%, 8px); margin: 0;
  background: #f4eee0; color: #111; padding: .55rem .9rem; border-radius: 6px; font: 600 .9rem var(--type); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.corner { position: fixed; top: var(--edge-t); right: var(--edge-r); transition: opacity .4s, visibility 0s .4s; }
/* short screens (phones on their side) and narrow ones: the corner buttons and the room note, smaller */
@media (max-height: 500px), (max-width: 640px) {
  .top-left, .top-right, .corner, #put-on { min-height: 38px; font-size: .88rem; padding-right: .8rem; }
  .top-left, .top-right, .corner { padding-left: .65rem; }
  .corner { padding-right: .65rem; }
  .btn.top-left svg, .btn.top-right svg { width: 18px; height: 18px; }
  #progress { font-size: .8rem; }
  .dig-progress { max-width: 11rem; margin-bottom: .5rem; }
  #put-on { padding-left: .8rem; }
}
.card-actions[hidden] { display: none; }

/* build on a phone held sideways: split screen. The records on the left, a full-height panel on the right
   with the track, Share and the video (which takes whatever height is left). build.js moves the picture
   into the left part to match (SPLIT there is this same query) */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --split-w: clamp(300px, 44vw, 420px); }
  .sheet.build-sheet { top: 0; bottom: 0; right: 0; left: auto; width: var(--split-w); display: block; }
  .sheet.build-sheet[hidden] { display: none; }
  .build-sheet .card { height: 100%; max-height: none; border-radius: 0; box-shadow: -10px 0 30px rgba(0, 0, 0, .45);
    display: flex; flex-direction: column; gap: .5rem; overflow: hidden;
    padding: var(--edge-t) max(var(--pad), env(safe-area-inset-right)) max(.8rem, env(safe-area-inset-bottom)) var(--pad); }
  .build-sheet .b-info { flex: none; gap: .2rem; }
  .build-sheet .card-head { min-height: 38px; align-items: center; padding-right: 6.5rem; } /* Share sits at the panel's top right */
  .build-sheet .b-track { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .build-sheet .crate-no { display: none; }
  .build-sheet .layer { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  .build-sheet .b-status { font-size: .82rem; margin: 0; }
  .build-sheet .b-yt { order: 2; flex: 1 1 auto; min-height: 150px; height: auto; aspect-ratio: auto; margin: 0; }
  .build-sheet .card-actions { order: 3; margin-top: auto; }
  .build-sheet .card-actions .btn { min-height: 40px; font-size: .9rem; }
  .build-sheet .top-right { background: transparent; color: var(--ink); border-color: rgba(29, 23, 18, .28); }
  .build-sheet .top-right:hover:not(:disabled) { border-color: var(--ink); }
  /* the crate card the same way: a full-height panel, Share in its top corner, the video taking what's left */
  #panel.sheet { top: 0; bottom: 0; right: 0; left: auto; width: var(--split-w); display: block; }
  #panel.sheet[hidden] { display: none; }
  #panel .card { height: 100%; max-height: none; border-radius: 0; box-shadow: -10px 0 30px rgba(0, 0, 0, .45);
    display: flex; flex-direction: column; gap: .5rem; overflow-y: auto;
    padding: var(--edge-t) max(var(--pad), env(safe-area-inset-right)) max(.8rem, env(safe-area-inset-bottom)) var(--pad); }
  #panel .crate-no { min-height: 38px; display: flex; align-items: center; white-space: nowrap; margin: 0; } /* level with Share */
  #panel .card-head { align-items: end; }
  #panel .stepper { margin-top: 46px; } /* always below Share, even when the title is one line */
  #panel .yt { flex: 1 1 auto; min-height: min(150px, 30dvh); height: auto; aspect-ratio: auto; margin: 0; }
  #panel .card-actions { margin-top: auto; }
  #panel .card-actions .btn { min-height: 40px; font-size: .9rem; }
  body.in-crate #toast { left: calc((100% - var(--split-w)) / 2); }
  #panel .top-right { background: transparent; color: var(--ink); border-color: rgba(29, 23, 18, .28); }
  #panel .top-right:hover:not(:disabled) { border-color: var(--ink); }
}

/* the start screen on a phone held sideways: split screen, the cover down the left at full height, the
   words and the way in on the right */
@media (orientation: landscape) and (max-height: 540px) {
  #loading { place-items: stretch; padding: 0; }
  .start { display: grid; grid-template-columns: min(46vw, 100dvh) minmax(0, 1fr); gap: 0; min-height: 100dvh; max-width: none; }
  .start-cover { width: 100%; height: 100dvh; object-fit: cover; object-position: 50% 40%; box-shadow: none;
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent); mask-image: linear-gradient(90deg, #000 80%, transparent); }
  .start-text { margin: 0; display: flex; flex-direction: column; justify-content: safe center; overflow-y: auto; max-height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) max(1.4rem, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) 1.4rem; }
  .start-title { font-size: 1.9rem; margin: .25rem 0 .5rem; }
  .start .lede { font-size: .92rem; margin-bottom: .6rem; }
  .start .how { font-size: .84rem; gap: .2rem; margin-bottom: .8rem; }
  .start .actions { margin-top: .2rem; flex-direction: row; align-items: center; }
  .door { width: 12rem; }
}
@media (orientation: landscape) and (max-height: 360px) { /* the smallest phones: tighter still */
  .start { grid-template-columns: 38vw minmax(0, 1fr); }
  .start-title { font-size: 1.6rem; margin: .15rem 0 .35rem; }
  .start .lede { font-size: .84rem; margin-bottom: .45rem; line-height: 1.4; }
  .start .how { font-size: .78rem; margin-bottom: .55rem; }
  .start .kicker { font-size: .66rem; }
}

/* build on a phone held upright: a tighter card, so the video and both buttons fit above the browser's bar */
@media (orientation: portrait) and (max-width: 700px) {
  .build-sheet .card { gap: .5rem; }
  .build-sheet .crate-no { display: none; }
  .build-sheet .b-track { font-size: 1.05rem; }
  .build-sheet .b-info { gap: .15rem; }
  .build-sheet .layer { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .build-sheet .b-status { font-size: .85rem; }
}

/* opened inside Instagram and other in-app browsers (js/inapp.js): the way out to the phone's own browser
   comes first, the way in without sound second */
.inapp { margin: .2rem 0 .9rem; }
.inapp[hidden] { display: none; }
.inapp-note { margin: 0 0 .7rem; font-size: .92rem; color: var(--bulb); font-weight: 600; }
.inapp-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.inapp-btns .btn { text-decoration: none; }
.inapp-browser .door { width: auto; }
.inapp-browser .door #enter { background: transparent; border-color: transparent; color: rgba(244, 238, 224, .75); box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 640px), (orientation: portrait) and (max-width: 760px) {
  .inapp-btns { flex-direction: column; }
  .inapp-btns .btn { width: 100%; }
}
@media (orientation: portrait) and (max-width: 760px) { /* a phone in Instagram: a shorter cover so the buttons show without scrolling */
  .inapp-browser .start-cover { height: 20vh; }
  .inapp-browser .start .how { display: none; }
  .inapp-browser .start .lede { margin-bottom: .6rem; }
  .inapp-browser .start .actions { margin-top: .2rem; }
}

/* keyboard focus: the bulb's yellow on the dark room, ink on the cream cards where yellow barely shows */
a:focus-visible { outline: 3px solid var(--bulb); outline-offset: 2px; }
.card button:focus-visible, .card a:focus-visible { outline-color: var(--ink); }
body.in-crate #crates, body.in-build #crates, body.at-deck #crates { display: none; } /* the room's crate list: not while a crate is open */
body:not(.in-crate):not(.in-build):not(.at-deck) .corner { transition: opacity .4s, visibility 0s; }
