@font-face { font-family: 'Yellowtail'; src: url(fonts/Yellowtail-Regular.ttf) format('truetype'); font-display: block; }
@font-face { font-family: 'Kaushan Script'; src: url(fonts/KaushanScript-Regular.ttf) format('truetype'); font-display: block; }
@font-face { font-family: 'Fraunces'; src: url(fonts/Fraunces-roman.ttf) format('truetype'); font-weight: 100 900; font-display: block; }
@font-face { font-family: 'Playfair Display'; src: url(fonts/PlayfairDisplay-roman.ttf) format('truetype'); font-weight: 400 900; font-display: block; }
@font-face { font-family: 'Cinzel'; src: url(fonts/Cinzel-roman.ttf) format('truetype'); font-weight: 400 900; font-display: block; }
@font-face { font-family: 'Marcellus'; src: url(fonts/Marcellus-Regular.ttf) format('truetype'); font-display: block; }
@font-face { font-family: 'Permanent Marker'; src: url(fonts/PermanentMarker-Regular.ttf) format('truetype'); font-display: block; }
@font-face { font-family: 'Special Elite'; src: url(fonts/SpecialElite-Regular.ttf) format('truetype'); font-display: block; }
@font-face { font-family: 'Stardos Stencil'; src: url(fonts/StardosStencil-Bold.ttf) format('truetype'); font-weight: 700; font-display: block; }
@font-face { font-family: 'Rubik Dirt'; src: url(fonts/RubikDirt-Regular.ttf) format('truetype'); font-display: block; }
:root {
  --store-marker: 'Permanent Marker', 'Impact', sans-serif; --store-type: 'Special Elite', 'Courier New', monospace; --store-stencil: 'Stardos Stencil', 'Impact', sans-serif; --store-dirt: 'Rubik Dirt', 'Impact', sans-serif;
  --safe-top: 0px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--text); font-family: var(--vt); font-size: var(--fs-xl); }
body { background: none; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr) 28px; gap: 12px; padding: calc(var(--safe-top) + 12px) 12px 8px; user-select: none; -webkit-user-select: none; cursor: default; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; image-rendering: pixelated; z-index: -1; }
#town { position: fixed; inset: 0; width: 100%; height: 100%; display: none; }
body.town #town { display: block; }
#town.crisp { image-rendering: pixelated; }
#emu { position: fixed; inset: 0; background: var(--deco-black); display: none; place-items: center; z-index: 10; }
#emu.on { display: grid; }
#emu canvas { image-rendering: pixelated; }
/* Cart rack: a neon list of Game Boy carts. */
#carts { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--sky); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#carts.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#carts .cart-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--cal-pink); text-shadow: 0 0 12px var(--cal-pink); margin-bottom: 16px; /* title */ }
#carts .cart-row { width: min(560px, 80vw); padding: 6px 16px; border: 2px solid var(--border); color: var(--sky); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#carts .cart-pick { border-color: var(--cal-pink); color: var(--cal-pink); box-shadow: 0 0 12px var(--cal-pink); }
#carts .cart-pick::before { content: "> "; }
#carts .cart-empty { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--cal-pink); /* title */ }
#carts .cart-path { font-size: var(--fs-s); color: var(--text-dim); margin-bottom: 8px; }
#carts .cart-keys { margin-top: 16px; font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
/* Claw King: a glass cabinet on a canvas. The state and position elements are read by tests and stay hidden. */
#claw { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--sky); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#claw.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#claw .claw-bar { display: flex; align-items: baseline; gap: 24px; }
#claw .claw-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--cal-pink); text-shadow: 0 0 12px var(--cal-pink); /* title */ }
#claw .claw-timer { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--sky); /* title */ }
#claw .claw-state, #claw .claw-pos { display: none; }
#claw canvas { width: min(640px, 90vw); aspect-ratio: 8 / 5; border: 2px solid var(--sky); box-shadow: 0 0 16px var(--sky); }
#claw .claw-result { min-height: 1.2em; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--cal-pink); /* title */ }
#claw .claw-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
/* Step Step: four arrow lanes on a canvas. The judgment and result lines are DOM text that tests read. */
#step { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--sky); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#step.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#step .step-bar { display: flex; align-items: baseline; gap: 24px; }
#step .step-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--cal-pink); text-shadow: 0 0 12px var(--cal-pink); /* title */ }
#step .step-score { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--sky); /* title */ }
#step .step-combo { min-width: 6em; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--leaf); /* title */ }
#step canvas { width: min(640px, 90vw); aspect-ratio: 8 / 5; border: 2px solid var(--sky); box-shadow: 0 0 16px var(--sky); }
#step .step-judge, #step .step-result { min-height: 1.2em; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--cal-pink); /* title */ }
#step .step-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
/* Cyber Pod: red on black. The distance and crash lines are DOM text that tests read. */
#pod { position: fixed; inset: 0; display: none; background: var(--deco-black); color: var(--alert); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#pod.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#pod .pod-bar { display: flex; align-items: baseline; gap: 12px; }
#pod .pod-title, #pod .pod-dist, #pod .pod-unit { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--alert); text-shadow: 0 0 12px var(--alert); /* title */ }
#pod canvas { width: min(640px, 90vw); aspect-ratio: 8 / 5; border: 2px solid var(--alert); box-shadow: 0 0 16px var(--alert); }
#pod .pod-result { min-height: 1.2em; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--alert); /* title */ }
#pod .pod-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--alert); /* label */ }

/* Dino Park: green and amber jungle run. The title, score and end lines are DOM text that tests read. */
#dino { position: fixed; inset: 0; display: none; background: var(--deco-dino-bg); color: var(--deco-dino-amber); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#dino.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#dino .dino-bar { display: flex; align-items: baseline; gap: 12px; }
#dino .dino-title, #dino .dino-dist, #dino .dino-unit { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--deco-dino-amber); text-shadow: 0 0 12px var(--deco-dino-orange); /* title */ }
#dino canvas { width: min(640px, 90vw); aspect-ratio: 16 / 9; border: 2px solid var(--deco-dino-green); box-shadow: 0 0 16px var(--deco-dino-green); }
#dino .dino-msg { min-height: 1.2em; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--deco-dino-amber); /* title */ }
#dino .dino-sub, #dino .dino-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--deco-dino-orange); /* label */ }
/* Crate: 3D cover flow. Covers are keyed nodes placed by position class; the info panel has a fixed height. */
#crate { position: fixed; inset: 0; display: none; background: var(--store-bg); color: var(--store-paper); z-index: 10; overflow: hidden; font-family: var(--store-type); font-size: 20px; }
#crate.on { display: block; }
#crate .crate-backdrop { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; filter: blur(40px) brightness(.35) saturate(1.2); transform: scale(1.2); }
#crate .crate-title { position: absolute; top: 10px; left: 24px; font-family: var(--store-marker); font-size: 34px; line-height: 1; color: var(--store-paper); text-shadow: 3px 3px 0 var(--store-oxblood); }
#crate .crate-count { position: absolute; top: 16px; right: 24px; font-size: 22px; color: var(--store-paper); }
#crate .crate-stage { --s: min(46vh, 420px); position: absolute; left: 0; right: 0; top: 56px; height: calc(var(--s) + 20px); perspective: 1400px; perspective-origin: 50% 40%; }
#crate .crate-album { position: absolute; left: 50%; top: 10px; width: var(--s); height: var(--s); margin-left: calc(var(--s) / -2); overflow: hidden; border-radius: 0; background: var(--store-ink); box-shadow: 8px 8px 0 var(--deco-black-a70); transition: transform 250ms ease, opacity 250ms ease; -webkit-box-reflect: below 4px linear-gradient(transparent 60%, var(--deco-white-a25)); will-change: transform, opacity; }
#crate .crate-album.crate-off { opacity: 0; pointer-events: none; transform: translateZ(-600px) scale(.5); }
#crate .crate-hide { display: none; }
#crate .crate-at-0 { transform: translateZ(40px); opacity: 1; }
#crate .crate-at-n1 { transform: translateX(calc(var(--s) * -.68)) rotateY(60deg) translateZ(-60px); opacity: .95; }
#crate .crate-at-1 { transform: translateX(calc(var(--s) * .68)) rotateY(-60deg) translateZ(-60px); opacity: .95; }
#crate .crate-at-n2 { transform: translateX(calc(var(--s) * -.9)) rotateY(60deg) translateZ(-160px); opacity: .85; }
#crate .crate-at-2 { transform: translateX(calc(var(--s) * .9)) rotateY(-60deg) translateZ(-160px); opacity: .85; }
#crate .crate-at-n3 { transform: translateX(calc(var(--s) * -1.12)) rotateY(60deg) translateZ(-260px); opacity: .7; }
#crate .crate-at-3 { transform: translateX(calc(var(--s) * 1.12)) rotateY(-60deg) translateZ(-260px); opacity: .7; }
#crate .crate-art { width: 100%; height: 100%; object-fit: cover; display: block; }
#crate .crate-sleeve { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px; text-align: center; overflow: hidden; color: var(--store-paper); border: 4px solid var(--store-ink); }
#crate .crate-sleeve-title { font-family: var(--store-stencil); font-weight: 700; font-size: 28px; line-height: 1.1; text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
#crate .crate-sleeve-artist { font-family: var(--store-type); font-size: 18px; opacity: .85; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; }
#crate .crate-info { position: absolute; left: 24px; right: 24px; bottom: 52px; height: 300px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: 2.3em 1.3em 1.3em 1.3em 1.3em minmax(0, 1fr); column-gap: 24px; row-gap: 6px; padding: 14px 18px; background: var(--deco-store-bg-a88); border: 3px solid var(--store-paper); border-radius: 0; box-shadow: 8px 8px 0 var(--store-oxblood); overflow: hidden; }
#crate .crate-name { grid-column: 1; grid-row: 1; font-family: var(--store-marker); font-size: 28px; line-height: 1.15; color: var(--store-paper); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#crate .crate-artist { grid-column: 1; grid-row: 2; font-family: var(--store-stencil); font-weight: 700; font-size: 22px; color: var(--store-mustard); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#crate .crate-meta { grid-column: 1; grid-row: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#crate .crate-genres { grid-column: 1; grid-row: 4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
#crate .crate-stats { grid-column: 1; grid-row: 5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; font-variant-numeric: tabular-nums; }
#crate .crate-five { position: absolute; top: -3px; right: -3px; padding: 4px 12px; background: var(--store-ink); color: var(--store-mustard); border: 3px solid var(--store-mustard); border-radius: 0; font-family: var(--store-stencil); font-weight: 700; font-size: 18px; letter-spacing: 2px; box-shadow: 4px 4px 0 var(--store-oxblood); }
#crate .crate-tracks { grid-column: 2; grid-row: 1 / 7; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 1.3em; column-gap: 18px; font-size: 17px; font-variant-numeric: tabular-nums; min-height: 0; overflow: hidden; padding-top: 36px; }
#crate .crate-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
#crate .crate-track:hover { color: var(--store-mustard); }
#crate .crate-track { appearance: none; background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; white-space: pre; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; font-variant-numeric: tabular-nums; }
#crate .crate-more { grid-column: 1 / 3; grid-row: 2; color: var(--store-mustard); }
#crate .crate-note { position: absolute; left: 24px; right: 24px; bottom: 26px; height: 24px; line-height: 24px; text-align: center; color: var(--store-mustard); font-size: 18px; }
#crate .crate-keys { position: absolute; left: 0; right: 0; bottom: 6px; white-space: pre; text-align: center; font-size: 16px; opacity: .7; }
#listen { position: fixed; inset: 0; display: none; background: var(--deco-0b0705); z-index: 10; }
#listen.on { display: block; }
#listen .listen-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#listen .listen-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
#listen .listen-card { position: absolute; left: 28px; bottom: 22px; z-index: 2; width: min(460px, 60vw); padding: 14px; background: var(--store-ink); border: 3px solid var(--store-paper); box-shadow: 6px 6px 0 var(--store-oxblood); color: var(--store-paper); }
#listen .listen-info { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
#listen .listen-art, #listen .listen-sleeve { width: 96px; height: 96px; flex: none; object-fit: cover; background: var(--store-paper); border: 2px solid var(--store-paper); display: block; }
#listen .listen-text { min-width: 0; }
#listen .listen-title { font-family: var(--store-marker); font-size: 22px; line-height: 1.15; }
#listen .listen-album { font-family: var(--store-type); font-size: 16px; color: var(--store-paper); opacity: .7; }
#listen .listen-artist { font-family: var(--store-type); font-size: 18px; color: var(--store-mustard); }
#listen .deck-strip { position: static; padding: 0; background: none; border: 0; }
#listen .deck-strip-text { display: none; }
#listen .deck-strip-row { gap: 10px; }
#listen .deck-strip button { padding: 4px 10px; font-size: 16px; }
#listen .deck-vol { width: 60px; }
#listen .listen-toast { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 8px 20px; font-family: var(--store-marker); font-size: 26px; color: var(--store-ink); background: var(--store-mustard); border: 3px solid var(--store-ink); opacity: 0; transition: opacity .25s; pointer-events: none; }
#listen .listen-toast.on { opacity: 1; }
#deck { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: radial-gradient(ellipse at 50% 40%, var(--deco-241210) 0%, var(--store-bg) 75%); color: var(--store-paper); z-index: 10; text-align: center; padding: 24px; }
#deck.on { display: flex; }
#deck .deck-strip, #studio .deck-strip { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 28px; background: var(--store-ink); border-bottom: 3px solid var(--store-mustard); text-align: left; }
.deck-strip-text { min-width: 0; flex: 0 1 28%; }
.deck-strip-title { font-family: var(--store-marker); font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-strip-artist { font-family: var(--store-type); font-size: 18px; color: var(--store-mustard); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-strip-row { flex: 1; display: flex; align-items: center; gap: 14px; }
.deck-strip button { font: inherit; font-family: var(--store-stencil); font-weight: 700; font-size: 20px; color: var(--store-ink); background: var(--store-paper); border: 2px solid var(--store-ink); border-radius: 0; padding: 6px 18px; cursor: pointer; }
.deck-strip button:disabled { opacity: .35; cursor: default; }
.deck-seek, .deck-vol { position: relative; height: 10px; border-radius: 0; background: var(--deco-store-paper-a20); cursor: pointer; touch-action: none; }
.deck-seek { flex: 1; }
.deck-vol { width: 110px; }
.deck-seek.off { opacity: .35; cursor: default; }
.deck-seek-fill, .deck-vol-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 0; background: var(--store-mustard); }
.deck-vol-fill { background: var(--store-paper); }
#deck .deck-cover { width: min(48vh, 40vw); height: min(48vh, 40vw); overflow: hidden; background: var(--store-paper); border: 4px solid var(--store-paper); box-shadow: 8px 8px 0 var(--store-oxblood); transform: rotate(-1deg); margin-top: 48px; }
#deck .deck-art { width: 100%; height: 100%; object-fit: cover; display: block; }
#deck .deck-sleeve { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; font-family: var(--store-marker); font-size: 22px; color: var(--store-ink); }
#deck .deck-name { font-family: var(--store-marker); font-size: 34px; line-height: 1.1; }
#deck .deck-artist { font-family: var(--store-type); font-size: 30px; color: var(--store-mustard); }
#deck .deck-album { font-family: var(--store-type); font-size: 24px; color: var(--store-paper); opacity: .7; }
#deck .deck-keys { font-family: var(--store-type); font-size: 22px; color: var(--store-paper); opacity: .6; margin-top: 8px; }
#feature { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; gap: 14px; background: radial-gradient(ellipse at 50% 40%, var(--deco-241210) 0%, var(--store-bg) 75%); color: var(--store-paper); font-family: var(--store-type); z-index: 10; padding: 24px; }
#feature.on { display: flex; }
#feature .feature-title { font-family: var(--store-dirt); font-size: 52px; line-height: 1; color: var(--store-paper); background: var(--store-oxblood); padding: 6px 22px; transform: rotate(-1deg); text-align: center; }
#feature .feature-body { flex: 1; min-height: 0; overflow-y: auto; width: min(820px, 92vw); display: flex; flex-direction: column; gap: 26px; }
#feature .feature-heading { font-family: var(--store-stencil); font-weight: 700; font-size: 30px; color: var(--store-mustard); margin-bottom: 8px; }
#feature .feature-text { font-size: 24px; line-height: 1.45; margin-bottom: 10px; }
#feature .feature-note { font-family: var(--store-marker); font-size: 30px; color: var(--store-mustard); text-align: center; }
#feature .feature-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 14px; }
#feature .feature-album { width: 160px; opacity: .7; }
#feature .feature-album.feature-pick { opacity: 1; outline: 3px solid var(--store-mustard); outline-offset: 4px; }
#feature .feature-art, #feature .feature-sleeve { width: 160px; height: 160px; object-fit: cover; display: block; background: var(--store-paper); box-shadow: 5px 5px 0 var(--store-oxblood); }
#feature .feature-sleeve { display: flex; align-items: center; justify-content: center; padding: 10px; box-sizing: border-box; font-family: var(--store-marker); font-size: 18px; color: var(--store-ink); overflow: hidden; }
#feature .feature-album-title { font-size: 20px; margin-top: 8px; }
#feature .feature-album-artist { font-size: 18px; color: var(--store-mustard); }
#feature .feature-keys { white-space: pre; font-size: 22px; color: var(--store-paper); opacity: .6; }
#archive { position: fixed; inset: 0; display: none; flex-direction: column; gap: 10px; z-index: 10; padding: 20px 28px; box-sizing: border-box; }
#archive:not(.lib-study) { background: var(--store-bg); color: var(--store-paper); font-family: var(--store-type); font-size: 20px; }
#archive.on { display: flex; }
#townHint { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); display: none; padding: 6px 16px; background: var(--deco-black-a70); color: var(--deco-white); z-index: 5; }
#townHint.on { display: block; }
#townFade { position: fixed; inset: 0; background: var(--deco-black); opacity: 0; pointer-events: none; z-index: 6; }
#townFade.on { animation: townFade .4s ease-out; }
@keyframes townFade { from { opacity: 1; } to { opacity: 0; } }
#townPreview { position: fixed; left: 50%; top: 48px; transform: translateX(-50%); display: none; padding: 6px 16px; background: var(--deco-black-a70); color: var(--deco-white); z-index: 5; }
#townPreview.on { display: block; }
#townJump { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; min-width: 280px; padding: 8px; background: var(--deco-1d1b2b); color: var(--deco-f2e8cc); z-index: 8; font-family: var(--label); font-size: var(--lb-m); box-shadow: 0 0 0 2px var(--edge2); /* label */ }
#townJump.on { display: block; }
#townJump .row { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 8px 10px; }
#townJump .row.sel { background: var(--deco-e3a24a); color: var(--deco-1d1b2b); }
#townJump .q { padding: 8px 10px; }
#townJump .q.hint { opacity: .5; }
#townJump .none { padding: 8px 10px; opacity: .5; }
body.town .bar, body.town .screens, body.town .foot, body.town #scene, body.town #topline { display: none; }
/* Focus status line: its own auto row, only while the line shows. Other screens keep the three-row template. */
body.focusline { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px auto minmax(0, 1fr) 28px; }
body.focusline .bar { grid-row: 1; }
body.focusline #topline { grid-row: 2; }
body.focusline .screens { grid-row: 3; }
body.focusline .foot { grid-row: 4; }
#topline { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; white-space: nowrap; font-family: var(--label); font-size: var(--lb-m); color: var(--text); /* label */ }
#topline[hidden] { display: none; }
#topline .sep { color: var(--text-dim); white-space: pre; }
#topline .alert { color: var(--alert); }
:root[data-skin="moss"] #scene { display: none; }
body.hidden *, body.hidden *::before, body.hidden *::after { animation-play-state: paused !important; }
.spr { display: block; image-rendering: pixelated; flex: none; }
.sp-w { display: inline-block; line-height: 0; }

.bar { min-width: 0; display: flex; align-items: center; gap: 24px; padding: 0 14px; background: var(--deco-181234-a68);
  border: 2px solid var(--deco-edge-a95); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--deco-edge2-a50); }
.brand { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); /* title */ }
.tbi { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xl); flex: 0 1 auto; min-width: 0; }
.tbi[hidden] { display: none; }
.bar > .tbi { flex: none; }
.tbi.grey { color: var(--deco-6f6a8c); }
.tbw { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; }
.tbw > .tbi[data-id=weather] { margin-left: auto; }
.tbr { display: flex; align-items: center; gap: 24px; }
.tbr:empty { display: none; }
#toolbarSpeaker { position: relative; }
#toolbarSpeaker:empty { display: none; }
.clk { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); cursor: pointer; background: none; border: 0; color: var(--text); padding: 2px 0; /* label */ }
.clk:focus { outline: none; }

/* Screens: each grid fills the area under the bar; the shape class places its tiles. Size classes (L, M, S) only style widgets. */
.screens { position: relative; min-height: 0; }
.grid { position: absolute; inset: 0; display: grid; gap: 12px; min-height: 0; }
.shape-home { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: repeat(5, minmax(0, 1fr)); }
.shape-home .tile.L { grid-column: 1; grid-row: 1 / 6; }
.shape-home .tile.M1, .shape-home .tile.M2, .shape-home .tile.M3, .shape-home .tile.M4 { grid-column: 2 / 4; }
.shape-home .tile.M1 { grid-row: 1; } .shape-home .tile.M2 { grid-row: 2; } .shape-home .tile.M3 { grid-row: 3; } .shape-home .tile.M4 { grid-row: 4; }
.shape-home .tile.S1 { grid-column: 2; grid-row: 5; } .shape-home .tile.S2 { grid-column: 3; grid-row: 5; }
.shape-3x2 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.shape-3x2 .tile.a1 { grid-column: 1; grid-row: 1; } .shape-3x2 .tile.a2 { grid-column: 2; grid-row: 1; } .shape-3x2 .tile.a3 { grid-column: 3; grid-row: 1; }
.shape-3x2 .tile.a4 { grid-column: 1; grid-row: 2; } .shape-3x2 .tile.a5 { grid-column: 2; grid-row: 2; } .shape-3x2 .tile.a6 { grid-column: 3; grid-row: 2; }
.shape-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.shape-2x2 .tile.a1 { grid-column: 1; grid-row: 1; } .shape-2x2 .tile.a2 { grid-column: 2; grid-row: 1; }
.shape-2x2 .tile.a3 { grid-column: 1; grid-row: 2; } .shape-2x2 .tile.a4 { grid-column: 2; grid-row: 2; }
.shape-big2 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.shape-big2 .tile.a1 { grid-column: 1; grid-row: 1 / 3; }
.shape-big2 .tile.a2 { grid-column: 2; grid-row: 1; } .shape-big2 .tile.a3 { grid-column: 2; grid-row: 2; }
.shape-solo { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
.shape-solo .tile.a1 { grid-column: 2; grid-row: 2; }
.shape-focus { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.shape-focus .tile.main { grid-column: 1; grid-row: 1 / 4; }
.shape-focus .tile.d1 { grid-column: 2; grid-row: 1; } .shape-focus .tile.d2 { grid-column: 2; grid-row: 2; } .shape-focus .tile.d3 { grid-column: 2; grid-row: 3; }
/* Gutters: drag handles over the grid gaps. Placed by the page with calc(); hidden while a tile is full screen. */
.gutter { position: absolute; z-index: 3; touch-action: none; }
.gutter.col { cursor: col-resize; }
.gutter.row { cursor: row-resize; }
.gutter:hover { background: var(--deco-edge-a35); }
.grid.full .gutter { display: none; }
.shape-solo .gutter:hover { background: none; }
/* Now screen: a small pixel grip (three 4px squares) centered in each handle, always visible. */
.shape-solo .gutter::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 24px; transform: translate(-50%, -50%); pointer-events: none;
  background: linear-gradient(var(--edge) 0 0) 0 0 / 4px 4px no-repeat, linear-gradient(var(--edge) 0 0) 0 8px / 4px 4px no-repeat, linear-gradient(var(--edge) 0 0) 0 16px / 4px 4px no-repeat;
  filter: drop-shadow(1px 0 0 var(--edge2)) drop-shadow(-1px 0 0 var(--edge2)) drop-shadow(0 1px 0 var(--edge2)) drop-shadow(0 -1px 0 var(--edge2)); }
.shape-solo .gutter.row::after { width: 24px; height: 4px;
  background: linear-gradient(var(--edge) 0 0) 0 0 / 4px 4px no-repeat, linear-gradient(var(--edge) 0 0) 8px 0 / 4px 4px no-repeat, linear-gradient(var(--edge) 0 0) 16px 0 / 4px 4px no-repeat; }
.shape-solo .gutter:hover::after { background-image: linear-gradient(var(--sun) 0 0), linear-gradient(var(--sun) 0 0), linear-gradient(var(--sun) 0 0); }
.prompt-input { font-family: var(--vt); font-size: var(--fs-xl); color: var(--text); background: var(--night); border: 2px solid var(--slate); padding: 4px 8px; min-width: 240px; user-select: text; -webkit-user-select: text; }
.prompt-input:focus { outline: none; border-color: var(--sun); }
.stabs { display: flex; gap: 8px; align-items: center; }
.stab { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); background: none; border: 2px solid var(--edge2); color: var(--dim); padding: 4px 8px; cursor: pointer; /* label */ }
.stab.on { color: var(--sun); border-color: var(--sun); }
.stab:focus { outline: none; }
.th .replace { margin-left: auto; }
.th .replace + .swap { margin-left: 0; }
.tile.empty .soon { color: var(--dim); }
.tile.empty.dock { background: none; border-color: transparent; box-shadow: none; }
.tile.empty.dock > * { visibility: hidden; }
.th .clear[hidden], .th .replace[hidden] { display: none; }
.th .tt.pick { cursor: pointer; }
.menu { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 140px; background: var(--edge2); border: 2px solid var(--slate); }
.menu[hidden], .confirm[hidden], .prompt[hidden] { display: none; }
.mi { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; cursor: pointer; white-space: nowrap; /* label */ }
.mi:hover, .mi:focus-visible { background: var(--slate); color: var(--edge2); outline: none; }
.mi.on { color: var(--sun); }
.menu.pk { width: 460px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 8px; gap: 8px; }
.pk-box { flex: none; font-family: var(--vt); font-size: var(--fs-m); color: var(--text); background: var(--night); border: 2px solid var(--slate); padding: 4px 8px; user-select: text; -webkit-user-select: text; }
.pk-box:focus { outline: none; border-color: var(--sun); }
.pk-list { flex: 1; min-height: 0; overflow-y: auto; }
.pk-label { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--dim); padding: 8px 10px 4px; /* label */ }
.pk-cols { column-count: 2; column-gap: 0; }
.pk-row { display: flex; align-items: center; gap: 8px; width: 100%; break-inside: avoid; text-transform: uppercase; }
.pk-ic { display: block; flex: none; width: 16px; height: 16px; }
.pk-ic .spr { display: block; }
.pk-name { overflow: hidden; text-overflow: ellipsis; }
.mi.pk-on { background: var(--slate); color: var(--edge2); }
.pk-none { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); color: var(--dim); padding: 8px 10px; /* label */ }
.confirm { position: fixed; z-index: 70; left: 50%; top: 40%; transform: translateX(-50%); background: var(--edge2); border: 2px solid var(--sun); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.confirm-text { font-family: var(--label); font-size: var(--lb-m); color: var(--text); /* label */ }
.confirm-row { display: flex; gap: 8px; justify-content: flex-end; }
.stab-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; background: var(--amber); }
/* One shrinkable column: an in-flow .th must not stretch the implicit column past the tile. */
.tile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 0; min-width: 0; background: var(--deco-tile);
  border: 2px solid var(--deco-edge-a95); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--deco-edge2-a50); overflow: hidden; }
.grid.full .tile:not(.full) { visibility: hidden; }
.tile.full { grid-column: 1 / -1; grid-row: 1 / -1; z-index: 5; }
.th { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 8px; height: 36px;
  background: linear-gradient(var(--deco-panel-a97), var(--deco-panel-a90)); border-bottom: 2px solid var(--edge2);
  transform: translateY(-100%); transition: transform 160ms ease-in 200ms; }
.th .hs { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; }
/* Top-edge reveal: a 12 px hot zone before .th. The 200 ms hide delay is a transition-delay on the way out only. */
.hot { position: absolute; top: 0; left: 0; right: 0; height: 12px; z-index: 1; }
.hot:hover + .th, .th:hover, .th.pin { transform: none; transition: transform 120ms ease-out; }
/* Error, placeholder, keep, and hold tiles keep the bar in flow, so their text is never covered. */
.tile.err > .th, .tile.grey > .th, .tile.keep > .th, .tile.hold > .th { position: static; transform: none; transition: none; grid-row: 1; }
.tile.err > .tb, .tile.grey > .tb, .tile.keep > .tb, .tile.hold > .tb { grid-row: 2; }
.tile.err > .hot, .tile.grey > .hot, .tile.keep > .hot, .tile.hold > .hot { display: none; }
/* Thin bar (M and L Claude tiles): about 22 px, always visible. The header's own icon and title hide; the drag ghost still reads .tt. */
.tile.keep .th { height: 22px; padding: 0 6px; gap: 6px; box-sizing: border-box; }
.tile.keep .th > .sp-w, .tile.keep .th > .tt { display: none; }
.tile.keep .th > .hs { order: 0; flex: 1 1 auto; gap: 6px; }
.tile.keep .th > .swap { order: 1; flex: none; margin-left: 0; }
/* Only the claude manifest sets `bar: 'keep'`; its bar carries Replace with… in the ⋯ menu, and swap stays on ⌘L and header drag. */
.tile.keep .th > .replace, .tile.keep .th > .swap { display: none; }
.tile.keep .th .btn { height: 18px; min-height: 0; padding: 0 4px; }
/* Drag to swap: ghost, dimmed source, blinking target. Never touches .pin. */
.th, .th svg, .th img { -webkit-user-drag: none; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; display: flex; align-items: center; padding: 6px 10px; height: 36px;
  font-family: var(--label); font-size: var(--lb-m); background: var(--panel2); border: 2px solid var(--sun); box-shadow: 0 0 0 2px var(--edge2), 6px 6px 0 var(--deco-edge2-a60);
  transform: translate(-20px, -18px) rotate(-2deg); /* label */ }
.tile.drag-src { opacity: .45; }
.tile.drag-src .th { transform: none; }
.tile.drop-target { border-color: var(--sun); }
.tile.drop-target::after { content: 'SWAP'; position: absolute; inset: 6px; display: grid; place-items: center; font-family: var(--label); font-size: var(--lb-m); color: var(--sun);
  border: 2px dashed var(--sun); background: var(--deco-sun-a08); z-index: 3; animation: drop-blink 600ms steps(2) infinite; /* label */ }
@keyframes drop-blink { 50% { border-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .tile.drop-target::after { animation: none; } }
/* Swap animation: WebKit moves and resizes each tile's snapshot. */
::view-transition-group(*) { animation-duration: 260ms; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
::view-transition-old(*), ::view-transition-new(*) { height: 100%; width: 100%; object-fit: fill; }
.th .tt { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); /* title */ }
.tb { grid-row: 1 / 3; padding: 6px 10px; min-height: 0; overflow: hidden; line-height: 1.05; position: relative; }
.tile.grey { border-color: var(--deco-4a4566); }
.tile.grey .tt { color: var(--deco-6f6a8c); }
.soon { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--dim); padding-top: 8px; /* label */ }
.state { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--dim); padding-top: 8px; /* label */ }
.tile.err { border-color: var(--cherry); }
.tile.err .state { color: var(--cherry); }
.tile.focused { border-color: var(--sun); outline: none; }
.tile.waiting { border-color: var(--amber); }
.reason { color: var(--text); padding: 6px 0; white-space: pre-wrap; word-break: break-word; }
/* Buttons: the one button system. 12 px text and a 12 px icon, 28 px tall; .c is 24 px. Every button in a row shares one size.
   Variants set the border and text color; hover fills with that color and turns the text dark, so currentColor icons flip too. */
.btn { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex: none; background: var(--edge2); border: 2px solid var(--edge); color: var(--text); cursor: pointer; --hb: var(--edge); /* label */ }
.btn.c { height: 24px; padding: 0 8px; }
.btn.only { width: 28px; padding: 0; justify-content: center; }
.btn.c.only { width: 24px; }
.btn.go { --hb: var(--leaf); border-color: var(--leaf); color: var(--leaf); }
.btn.gold { --hb: var(--sun); border-color: var(--sun); color: var(--sun); }
.btn.quiet { --hb: var(--slate); border-color: var(--slate); color: var(--dim); }
.btn.danger { --hb: var(--cherry); border-color: var(--cherry); color: var(--cherry); }
.btn:not(:disabled):not(.busy):hover, .btn:focus-visible { background: var(--hb); color: var(--edge2); outline: none; }
.btn:disabled { opacity: .4; cursor: default; }
/* Save loader (web/busy.js). The label stays in place and turns transparent; the loader overlays the button. */
:is(.btn, button).busy { position: relative; overflow: hidden; cursor: progress; color: transparent; }
:is(.btn, button).busy:focus-visible { background: var(--edge2); color: transparent; }
:is(.btn, button).busy > :not(.ld) { visibility: hidden; }
:is(.btn, button).fail { border-color: var(--cherry); color: var(--cherry); --hb: var(--cherry); }
.ld { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--hb, var(--text)); pointer-events: none; }
.ld.ld-inline { position: relative; inset: auto; display: inline-flex; width: 64px; height: 20px; overflow: hidden; vertical-align: middle; }
.ld svg { display: block; image-rendering: pixelated; }
.ldx-dots { display: inline-flex; gap: 4px; }
.ldx-dots i { width: 6px; height: 6px; background: currentColor; animation: ld-dot 900ms steps(1) infinite; }
.ldx-dots i:nth-child(2) { animation-delay: 150ms; } .ldx-dots i:nth-child(3) { animation-delay: 300ms; }
@keyframes ld-dot { 0% { transform: translateY(0); } 25% { transform: translateY(-4px); } 50% { transform: translateY(0); } }
.ldx-floppy { width: 14px; height: 14px; animation: ld-wob 600ms steps(4) infinite; }
.ldx-floppy .led { animation: ld-led 300ms steps(1) infinite; }
@keyframes ld-led { 50% { fill: var(--edge2); } }
@keyframes ld-wob { 0% { transform: translateY(0); } 25% { transform: translateY(-1px); } 50% { transform: translateY(0); } 75% { transform: translateY(1px); } }
.ldx-cd { width: 14px; height: 14px; animation: ld-cd 640ms steps(8) infinite; }
@keyframes ld-cd { to { transform: rotate(360deg); } }
.ld-bird { justify-content: flex-start; }
.ldx-bird { position: absolute; top: 4px; left: -18px; width: 16px; height: 12px; animation: ld-fly 1400ms steps(18) infinite, ld-bob 560ms steps(1) infinite; }
@keyframes ld-fly { to { left: 100%; } }
@keyframes ld-bob { 0% { top: 0; } 12.5% { top: 2px; } 25% { top: 4px; } 37.5% { top: 6px; } 50% { top: 8px; } 62.5% { top: 6px; } 75% { top: 4px; } 87.5% { top: 2px; } }
.ldx-bird .up { animation: ld-flap 200ms steps(1) infinite; } .ldx-bird .down { animation: ld-flap 200ms steps(1) infinite reverse; }
@keyframes ld-flap { 0% { opacity: 1; } 50% { opacity: 0; } }
.ldx-spin { position: relative; display: inline-block; width: 12px; height: 1em; text-align: center; font-style: normal; }
.ldx-spin i { position: absolute; inset: 0; font-style: normal; line-height: 1em; opacity: 0; animation: ld-spin 440ms steps(1) infinite; }
.ldx-spin i:nth-child(2) { animation-delay: 110ms; } .ldx-spin i:nth-child(3) { animation-delay: 220ms; } .ldx-spin i:nth-child(4) { animation-delay: 330ms; }
@keyframes ld-spin { 0% { opacity: 1; } 25%, 100% { opacity: 0; } }
.ldx-glass { width: 10px; height: 14px; animation: ld-flip 1800ms infinite; animation-timing-function: steps(1); }
.ldx-glass .sand-t, .ldx-glass .sand-b { transform-box: fill-box; transform-origin: 50% 100%; animation-duration: 1800ms; animation-iteration-count: infinite; }
.ldx-glass .sand-t { animation-name: ld-drain-t; } .ldx-glass .sand-b { animation-name: ld-fill-b; }
@keyframes ld-flip { 0%, 70% { transform: rotate(0); } 77.5% { transform: rotate(45deg); } 85% { transform: rotate(90deg); } 92.5% { transform: rotate(135deg); } 100% { transform: rotate(180deg); } }
@keyframes ld-drain-t { 0% { transform: scaleY(1); animation-timing-function: steps(3, end); } 70%, 100% { transform: scaleY(0); } }
@keyframes ld-fill-b { 0% { transform: scaleY(0); animation-timing-function: steps(3, end); } 70%, 100% { transform: scaleY(1); } }
.ldx-rbow { display: block; width: 56px; height: 8px; border: 1px solid currentColor;
  background: linear-gradient(90deg, var(--cherry) 0 16.66%, var(--deco-ff8c32) 0 33.33%, var(--sun) 0 50%, var(--leaf) 0 66.66%, var(--sky) 0 83.33%, var(--edge) 0 100%);
  background-size: 48px 100%; animation: ld-rbow 720ms steps(12) infinite; }
@keyframes ld-rbow { from { background-position: 0 0; } to { background-position: 48px 0; } }
/* Reduced motion: each loader holds one still frame. */
@media (prefers-reduced-motion: reduce) {
  .ld *, .ld { animation: none !important; }
  .ld-bird .ldx-bird { left: calc(50% - 8px); top: 6px; }
  .ldx-spin i:first-child { opacity: 1; }
}
.btn .ic { display: block; }
.ic { flex: none; }

.foot { min-width: 0; overflow: hidden; font-size: var(--fs-m); color: var(--text); display: flex; align-items: center; gap: 14px; padding: 0 4px; }
.foot b { color: var(--text); font-weight: 400; }
.th .swap { margin-left: auto; }
.th .swap[hidden] { display: none; }
.foot b { display: inline-flex; align-items: center; gap: 1px; }
.foot b .ic { display: block; }

/* Context pill and picker. Values from design/prototypes/reminders-mockup.html. */
.ctxw { position: relative; }
.ctxpill { display: inline-flex; align-items: center; gap: 8px; padding: 3px 8px; border: 1px solid var(--leaf); background: none;
  font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--leaf); cursor: pointer; /* label */ }
.ctxpill.away { border-color: var(--sky); color: var(--sky); }
.ctxpill .t { color: var(--sun); }
.ctx-panel { position: absolute; top: calc(100% + 14px); left: -14px; z-index: 100; display: grid; gap: 10px; padding: 10px 12px; cursor: default;
  background: linear-gradient(var(--panel2), var(--panel)); border: 2px solid var(--edge); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--edge2); }
.ctx-panel .ttl { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); white-space: nowrap; /* title */ }
.ctxpick { display: flex; flex-wrap: wrap; gap: 4px; }
.ctxpick .tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--label); font-size: var(--lb-s); padding: 4px 7px 4px 3px;
  border: 1px solid var(--edge2); background: var(--edge2); white-space: nowrap; cursor: pointer; color: var(--text); /* label */ }
.ctxpick .tag.home { color: var(--leaf); }
.ctxpick .tag.away { color: var(--sky); }
.ctxpick .tag.auto { padding-left: 7px; }
.ctxpick .tag.sel { border-color: currentColor; background: var(--deco-white-a05); }
.ctxdot { width: 6px; height: 6px; background: var(--sun); }
.ctx-panel .go.namehere { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 8px; font-family: var(--label); font-size: var(--lb-s);
  color: var(--sun); background: var(--edge2); border: 1px solid var(--sun); cursor: pointer; /* label */ }
.ctx-panel .chips { display: inline-flex; flex-wrap: nowrap; border: 1px solid var(--edge2); justify-self: start; }
.ctx-panel .chip { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); padding: 6px 8px; color: var(--dim); background: var(--edge2); border: 0;
  border-right: 1px solid var(--deco-2a2346); white-space: nowrap; cursor: pointer; /* label */ }
.ctx-panel .chip:last-child { border-right: 0; }
.ctx-panel .chip.on { background: var(--sun); color: var(--edge2); }
.ctxpill:focus, .ctx-panel button:focus { outline: none; }

/* App palette (⌘/). Same look as the capture box. */
.pal-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 12vh; background: var(--deco-edge2-a60); }
.pal-wrap[hidden] { display: none; }
.pal-box { width: 720px; max-width: calc(100% - 32px); border: 2px solid var(--sun); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--edge2);
  background: linear-gradient(var(--panel2), var(--panel)); padding: 12px 14px; display: grid; gap: 10px; }
.pal-h { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); /* title */ }
.pal-prompt { font-size: var(--fs-xl); color: var(--sun); }
.pal-prompt:empty, .pal-running:empty, .pal-out:empty, .pal-list:empty { display: none; }
.pal-field { border: 2px solid var(--sun); background: var(--edge2); padding: 8px 10px; font-family: var(--vt); font-size: var(--fs-2xl); color: var(--text); outline: none; }
.pal-row { font-size: var(--fs-xl); color: var(--text); padding: 2px 6px; }
.pal-row.top { background: var(--edge2); color: var(--sun); }
.pal-row.bad { color: var(--dim); }
.pal-desc, .pal-meta { font-size: var(--fs-m); color: var(--dim); }
.pal-running { font-size: var(--fs-m); color: var(--sun); }
.pal-out { font-size: var(--fs-l); max-height: 30vh; overflow: auto; white-space: pre-wrap; }
.pal-err { font-size: var(--fs-m); color: var(--cherry); white-space: pre-wrap; }
.pal-plan-h { font-size: var(--fs-m); color: var(--sun); }

/* Shortcut sheet (⌘⇧/). Same frame as the palette. */
.sc-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 8vh; background: var(--deco-edge2-a60); }
.sc-wrap[hidden] { display: none; }
.sc-box { width: 720px; max-width: calc(100% - 32px); max-height: 80vh; overflow: auto; border: 2px solid var(--sun); background: linear-gradient(var(--panel2), var(--panel)); padding: 12px 14px; display: grid; gap: 10px; }
.sc-title { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); /* title */ }
.sc-h { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); color: var(--dim); margin-bottom: 4px; /* label */ }
.sc-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-l); color: var(--text); padding: 2px 0; }
.sc-label { min-width: 0; }
.sc-meta { font-size: var(--fs-m); color: var(--dim); }
.pal-plan-line { font-size: var(--fs-xl); color: var(--text); padding: 0 6px; }
.pal-busy { font-size: var(--fs-l); color: var(--dim); }
.pal-err:empty { display: none; }

/* Settings screen over the grid. */
.st-wrap { position: fixed; inset: 0; z-index: 150; background: var(--night); }
.st-wrap[hidden] { display: none; }
.st-box { height: 100%; display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; padding: calc(var(--safe-top) + 12px) 12px 12px; }
.st-nav { border: 2px solid var(--edge); background: var(--panel); padding: 10px; align-content: start; display: grid; gap: 8px; }
.st-navgroup { margin-top: 6px; font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--sky); /* label */ }
.st-navgroup:first-child { margin-top: 0; }
.st-navitem { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--dim); padding: 6px 8px; text-align: left; background: none; border: 0; cursor: pointer; /* label */ }
.st-navitem:hover { color: var(--text); }
.st-navitem.on { color: var(--sun); background: var(--edge2); }
.st-main { border: 2px solid var(--edge); background: var(--panel); padding: 12px 14px; overflow-y: auto; display: grid; gap: 18px; align-content: start; user-select: text; -webkit-user-select: text; cursor: default; }
.st-head { display: flex; align-items: center; gap: 12px; }
.st-status { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--sun); /* title */ }
.st-h { margin: 0 0 8px; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sky); /* title */ }
.st-sec { display: grid; gap: 8px; }
.st-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-tile-range { flex: 1; min-width: 120px; max-width: 240px; accent-color: var(--sun); }
.st-tile-lbl { font-family: var(--vt); font-size: var(--fs-xl); color: var(--text); }
.st-tile-val { font-family: var(--vt); font-size: var(--fs-xl); color: var(--text); min-width: 4ch; }
.st-card { display: grid; gap: 6px; padding: 8px; border: 2px solid var(--edge2); background: var(--deco-edge2-a40); }
.st-card.st-on { border-color: var(--sun); }
.st-help, .st-login { font-size: var(--fs-l); color: var(--dim); }
.st-now { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border: 2px dashed var(--edge); font-size: var(--fs-l); color: var(--text); }
.st-now-tag { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--sun); /* label */ }
.st-rule-n { min-width: 2ch; font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); color: var(--sun); /* label */ }
.st-slot { display: inline-flex; gap: 4px; }
.st-active, .st-here { padding: 2px 6px; border: 2px solid var(--sun); }
.st-in { color: var(--leaf); }
.st-site { font-family: var(--label); font-size: var(--lb-m); line-height: var(--lh-tight); color: var(--text); /* label */ }
.st-sample { font-size: var(--fs-xl); color: var(--text); }
.st-fieldwrap { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-fielderr { font-size: var(--fs-xs); color: var(--cherry); }
.st-fielderr:empty { display: none; }
.st-field.st-bad { border-color: var(--cherry); }
.st-lists, .st-days { display: flex; flex-wrap: wrap; gap: 4px; }
.st-field { font-family: var(--vt); font-size: var(--fs-xl); color: var(--text); background: var(--edge2); border: 2px solid var(--edge); padding: 2px 8px; min-width: 0; outline: none; }
.st-field:focus { border-color: var(--sun); }
.st-radius { width: 90px; }
.st-time { width: 90px; }
.st-unit, .st-note, .st-coords { font-size: var(--fs-l); color: var(--dim); }
.st-tag { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--sun); /* label */ }
.st-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border: 2px solid var(--leaf); }
.st-arrow { display: inline-flex; color: var(--dim); }
.st-nomatch { font-size: var(--fs-l); color: var(--dim); gap: 6px; }
.st-err { font-size: var(--fs-l); color: var(--cherry); }
.st-ok { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-l); color: var(--leaf); }
.st-err:empty, .st-ok:empty { display: none; }
.st-hk { display: flex; flex-direction: column; gap: 6px; }
.st-hk-name { font-size: var(--fs-l); min-width: 140px; }
.st-hk-combo { display: inline-flex; gap: 4px; align-items: center; }
.st-hk-msg { font-size: var(--fs-s); }

/* Ideas board (⌘I). Reuses the palette look. */
.tbi[data-id=ideas] { cursor: pointer; }
.idb-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 8vh; background: var(--deco-edge2-a60); outline: none; }
.idb-wrap[hidden] { display: none; }
.idb-box { width: 1100px; max-width: calc(100% - 32px); height: 80vh; overflow: hidden; border: 2px solid var(--sun); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--edge2);
  background: linear-gradient(var(--panel2), var(--panel)); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.idb-h { display: flex; justify-content: space-between; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); /* title */ }
.idb-add { flex: 1; min-width: 0; margin: 0 12px; font-family: var(--vt); font-size: var(--fs-m); color: var(--text); background: var(--edge2); border: 2px solid var(--edge2); padding: 0 6px; outline: none; }
.idb-add:focus { border-color: var(--sun); }
.idb-h .idb-err { font-family: var(--vt); font-size: var(--fs-m); margin-left: 12px; }
.idb-esc { font-family: var(--vt); font-size: var(--fs-m); color: var(--dim); }
.idb-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 10px; }
.idb-colh { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); padding-bottom: 6px; min-height: calc(2 * var(--px-m) + 6px); /* title */ }
.idb-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.idb-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.idb-card { border: 2px solid var(--edge2); background: var(--edge2); padding: 6px 8px; display: grid; gap: 4px; cursor: pointer; min-width: 0; }
.idb-card.sel { border-color: var(--sun); }
.idb-ct { font-size: var(--fs-xl); color: var(--text); display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.idb-cl { font-size: var(--fs-m); color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.idb-msg { font-size: var(--fs-m); color: var(--dim); }
.idb-btns { display: flex; gap: 6px; }
.idb-btn { font-family: var(--label); font-size: var(--lb-s); border: 2px solid var(--sun); background: none; color: var(--sun); padding: 4px 6px; cursor: pointer; /* label */ }
.idb-err { font-size: var(--fs-m); color: var(--cherry); white-space: pre-wrap; }
.idb-ask { font-size: var(--fs-l); color: var(--sun); }

/* Shared UI pieces: key badge, chip, count line, empty message. The Sorter tile uses all four. */
.ui-kbd { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); min-width: 20px; height: 20px; padding: 0 4px; display: inline-grid; place-items: center; flex: none;
  background: var(--edge2); color: var(--sun); border: 1px solid var(--slate); /* label */ }
.ui-chip { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 6px; text-align: left; font-family: inherit; font-size: inherit; line-height: var(--lh-tight);
  background: var(--panel2); color: var(--text); border: 1px solid transparent; cursor: pointer; }
.ui-chip:hover, .ui-chip:focus-visible { border-color: var(--sun); outline: none; }
.ui-count { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--dim); /* label */ }
.ui-empty { font-size: var(--fs-m); line-height: var(--lh-tight); color: var(--dim); }

/* Planner (palette command "plan"). */
.pln-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 6vh; background: var(--deco-edge2-a60); outline: none; }
.pln-wrap[hidden] { display: none; }
.pln-box { width: 1040px; max-width: calc(100% - 32px); max-height: 86vh; overflow: hidden; border: 2px solid var(--sun); box-shadow: 0 0 0 2px var(--edge2), inset 0 0 0 2px var(--edge2);
  background: linear-gradient(var(--panel2), var(--panel)); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pln-h { display: flex; justify-content: space-between; font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--sun); /* title */ }
.pln-sync, .pln-esc { font-family: var(--vt); font-size: var(--fs-m); color: var(--dim); }
.pln-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.pln-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.pln-piles { display: grid; gap: 10px; }
.pln-pile { display: grid; gap: 4px; }
.pln-pile-h { display: flex; align-items: baseline; gap: 8px; font-family: var(--px); font-size: var(--px-s); color: var(--sun); line-height: var(--lh-title); /* title */ }
.pln-count { font-family: var(--vt); font-size: var(--fs-m); color: var(--dim); }
.pln-sort { margin-left: auto; }
.pln-item { display: flex; gap: 8px; align-items: baseline; text-align: left; border: 2px solid var(--edge2); background: var(--edge2); color: var(--text); font-size: var(--fs-l); padding: 3px 8px; cursor: pointer; }
.pln-item:hover { border-color: var(--sun); }
.pln-due { font-family: var(--label); font-size: var(--lb-s); color: var(--cherry); /* label */ }
.pln-item-t { overflow-wrap: anywhere; }
.pln-plan { display: grid; gap: 6px; align-content: start; border: 2px solid var(--edge2); padding: 8px 10px; }
.pln-plan-h { font-family: var(--px); font-size: var(--px-s); color: var(--sun); line-height: var(--lh-title); /* title */ }
.pln-entry { display: flex; gap: 6px; align-items: baseline; }
.pln-star { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 0 2px; line-height: 0; }
.pln-star.on { color: var(--sun); }
.pln-entry-t { flex: 1 1 auto; text-align: left; border: 0; background: none; color: var(--text); font-size: var(--fs-xl); cursor: pointer; padding: 0; overflow-wrap: anywhere; }
.pln-done .pln-entry-t { color: var(--dim); text-decoration: line-through; }
.pln-none, .pln-msg { font-size: var(--fs-l); color: var(--dim); }
.pln-began { font-size: var(--fs-l); color: var(--dim); }
.pln-wrapup { display: grid; gap: 4px; border: 2px solid var(--edge2); padding: 8px 10px; }
.pln-wrap-h { font-family: var(--px); font-size: var(--px-s); color: var(--sun); line-height: var(--lh-title); /* title */ }
.pln-total { font-family: var(--label); font-size: var(--lb-s); color: var(--sun); line-height: var(--lh-tight); /* label */ }
.pln-wrap-done { font-size: var(--fs-l); overflow-wrap: anywhere; }
.pln-focus-row { font-size: var(--fs-l); color: var(--dim); }
.pln-err { font-size: var(--fs-m); color: var(--cherry); }

.bar, .th, .tb, .foot, .state, .soon { text-shadow: 2px 2px 0 var(--edge2); }
.tb .on, .tb .sel, .btn:hover, .btn:focus-visible { text-shadow: none; }
#studio { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 84px 28px 12px; background: radial-gradient(ellipse at 50% 40%, var(--deco-241210) 0%, var(--store-bg) 75%); color: var(--store-paper); font-family: var(--store-type); z-index: 10; }
#studio.on { display: flex; }
#studio .studio-title { font-family: var(--store-dirt); font-size: 48px; line-height: 1; color: var(--store-paper); background: var(--store-oxblood); padding: 6px 22px; transform: rotate(-1deg); }
#studio .studio-info { display: flex; align-items: baseline; gap: 12px; font-size: 20px; }
#studio .studio-label { font-family: var(--store-stencil); color: var(--store-paper); opacity: .6; font-size: 15px; letter-spacing: .08em; margin-left: 14px; }
#studio .studio-info b { font-family: var(--store-marker); color: var(--store-mustard); font-weight: 400; min-width: 3ch; }
#studio .studio-state { margin-left: 18px; color: var(--store-paper) !important; }
#studio .studio-rec { margin-left: 18px; padding: 0 8px; border-radius: 0; color: var(--store-oxblood) !important; border: 2px solid var(--store-oxblood); }
#studio .studio-rec.on { color: var(--store-paper) !important; background: var(--store-oxblood); border-color: var(--store-oxblood); box-shadow: 0 0 12px var(--deco-a02828-a80); }
#studio .studio-slot { margin-left: 18px; }
#studio .studio-sounds { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; max-width: 900px; font-family: var(--store-stencil); font-size: 18px; }
#studio .studio-sound { padding: 2px 10px; color: var(--store-paper); opacity: .55; border: 2px solid transparent; }
#studio .studio-sound.on { opacity: 1; color: var(--store-ink); background: var(--store-mustard); border-color: var(--store-ink); }
#studio .studio-msg { min-height: 24px; font-size: 18px; color: var(--store-mustard); }
#studio .studio-grid { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; background: var(--store-ink); border: 3px solid var(--store-paper); border-radius: 0; box-shadow: 8px 8px 0 var(--store-oxblood); }
#studio .studio-row { display: flex; align-items: center; gap: 3px; }
#studio .studio-voice { width: 64px; font-family: var(--store-stencil); font-size: 13px; color: var(--store-paper); opacity: .7; text-align: right; margin-right: 8px; }
#studio .studio-cell { display: block; width: min(3vw, 24px); height: min(3vw, 24px, 2.6vh); border-radius: 0; background: var(--deco-2a2622); }
#studio .studio-cell.beat { background: var(--deco-3a342e); }
#studio .studio-cell.on { background: var(--store-mustard); }
#studio .studio-cell.now { box-shadow: inset 0 0 0 3px var(--store-paper); }
#studio .studio-cell.cursor { outline: 2px solid var(--store-paper); outline-offset: 1px; }
#studio .studio-keyboard { display: flex; flex-direction: column; gap: 6px; }
#studio .studio-keys { display: flex; gap: 4px; }
#studio .studio-keys.lower { margin-left: 22px; }
#studio .studio-key { width: 34px; height: 34px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; border-radius: 0; background: var(--store-paper); color: var(--store-ink); font-size: 15px; }
#studio .studio-key.black { background: var(--store-ink); color: var(--store-paper); border: 1px solid var(--store-paper); }
#studio .studio-key.down { background: var(--store-mustard); color: var(--store-ink); }
#studio .studio-help { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; font-size: 16px; color: var(--store-paper); opacity: .6; margin-top: 6px; }
#studio .studio-list { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); min-width: 360px; max-height: 60vh; overflow-y: auto; padding: 16px 20px; background: var(--store-ink); border: 3px solid var(--store-mustard); box-shadow: 8px 8px 0 var(--store-oxblood); font-family: var(--store-stencil); font-size: 20px; z-index: 2; }
#studio .studio-list.on { display: block; }
#studio .studio-list-save, #studio .studio-list-item, #studio .studio-list-name { padding: 3px 10px; color: var(--store-paper); }
#studio .studio-list-save, #studio .studio-list-name { color: var(--store-mustard); }
#studio .studio-list .sel { background: var(--store-mustard); color: var(--store-ink); }
#studio .studio-list-help { margin-top: 10px; font-size: 14px; color: var(--store-paper); opacity: .6; }
#studio .studio-help-item.soon { opacity: .35; }

.toasts { position: fixed; top: 48px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; cursor: pointer; max-width: 360px; padding: 8px 12px; background: var(--panel); color: var(--text); border: 2px solid var(--sun); font-family: var(--label); font-size: var(--lb-m); /* label */ }
.toast.error { display: flex; gap: 10px; align-items: center; border-color: var(--alert); }
.toast-retry { flex: none; cursor: pointer; padding: 2px 8px; background: transparent; color: var(--text); border: 2px solid var(--alert); font-family: var(--label); font-size: var(--lb-s); /* label */ }

/* CLEAN: Plex Mono needs more line height than VT323; tile bodies and multi-line reading text use the single-line height. */
:root[data-text="clean"] .tb { line-height: var(--lh-tight); }
/* Sticker booth: a photo strip drawn on a canvas. The shirt, frame, pose names and save line are DOM text that tests read. */
#booth { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--text); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-xl); }
#booth.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#booth .booth-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--accent); /* title */ }
#booth canvas { height: min(480px, 60vh); aspect-ratio: 1 / 3; border: 2px solid var(--border); }
#booth .booth-poses { display: none; }
#booth .booth-row, #booth .booth-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
#booth .booth-shirt, #booth .booth-frame, #booth .booth-msg { min-height: 1.2em; color: var(--accent); }
/* Pixel editor: menu bar on top, palette left, canvas center, tools right. Swatch colors and canvas pixels are set from script. */
#pixel { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--text); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-s); }
#pixel.on { display: flex; flex-direction: column; }
#pixel button, #pixel input, #pixel select { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); background: var(--surface); color: var(--text); border: 2px solid var(--border); padding: 4px 8px; /* label */ }
#pixel button { cursor: pointer; }
#pixel .px-bar { display: flex; gap: 4px; padding: 6px 8px; border-bottom: 2px solid var(--border); background: var(--surface); }
#pixel .px-menubox { position: relative; }
#pixel .px-drop { display: none; position: absolute; top: 100%; left: 0; z-index: 2; flex-direction: column; min-width: 140px; background: var(--surface); border: 2px solid var(--border); }
#pixel .px-drop.on { display: flex; }
#pixel .px-drop button { border: 0; text-align: left; }
#pixel .px-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr) 160px; }
#pixel .px-palette { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-right: 2px solid var(--border); overflow-y: auto; }
#pixel .px-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
#pixel .px-swatch { aspect-ratio: 1; padding: 0; border-width: 1px; }
#pixel .px-note, #pixel .px-msg { min-height: 1.2em; color: var(--alert); }
#pixel .px-colors { position: relative; height: 56px; }
#pixel .px-fg, #pixel .px-bg { position: absolute; width: 36px; height: 36px; border: 2px solid var(--border); }
#pixel .px-fg { left: 0; top: 0; }
#pixel .px-bg { left: 20px; top: 18px; }
#pixel .px-center { display: flex; flex-direction: column; min-width: 0; }
#pixel .px-head, #pixel .px-layers { padding: 6px 8px; font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
#pixel .px-layers { border-top: 2px solid var(--border); }
#pixel .px-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#pixel .px-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; }
#pixel .px-tools { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-left: 2px solid var(--border); }
#pixel .px-tool { text-align: left; }
#pixel .px-tool.on { border-color: var(--accent); color: var(--accent); }
#pixel .px-dialog { display: none; position: absolute; top: 80px; left: 50%; transform: translateX(-50%); z-index: 3; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 2px solid var(--border); }
#pixel .px-dialog.on { display: flex; }
#pixel .px-dialog-title { font-family: var(--px); font-size: var(--px-m); line-height: var(--lh-title); color: var(--accent); /* title */ }
#pixel .px-sizes { display: flex; gap: 4px; }
#pixel .px-status { margin-left: auto; align-self: center; font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
#pixel .px-layers { display: flex; flex-direction: column; gap: 4px; max-height: 168px; }
#pixel .px-layer-tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#pixel .px-opacity { width: 56px; }
#pixel .px-layer-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
#pixel .px-layer { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border: 2px solid transparent; cursor: pointer; color: var(--text); }
#pixel .px-layer.on { border-color: var(--accent); }
#pixel .px-eye { border: 0; padding: 0 4px; background: transparent; }
#pixel .px-eye.off { color: var(--text-dim); }
#pixel .px-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pixel .px-layer-op { color: var(--text-dim); }
#pixel .px-ref { display: none; align-items: center; gap: 8px; padding: 2px 4px; border: 2px solid transparent; border-top-color: var(--border); cursor: pointer; color: var(--text); }
#pixel .px-ref.on { display: flex; }
#pixel .px-ref.sel { border-color: var(--accent); }
#pixel .px-ref-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pixel .px-ref-info { color: var(--text-dim); white-space: nowrap; }
#pixel .px-ref-eye { border: 0; padding: 0 4px; background: transparent; }
#pixel .px-ref-eye.off { color: var(--text-dim); }
#pixel .px-ref-opacity, #pixel .px-ref-scale { width: 56px; }
#pixel .px-confirm-text { color: var(--text); }
#pixel .px-scale:disabled { color: var(--text-dim); cursor: default; }
#pixel .px-gallery { display: none; position: absolute; inset: 40px; z-index: 4; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 2px solid var(--border); overflow: hidden; }
#pixel .px-gallery.on { display: flex; }
#pixel .px-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; align-content: start; }
#pixel .px-tile { display: flex; flex-direction: column; gap: 4px; }
#pixel .px-tile-open { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; }
#pixel .px-thumb { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: var(--bg); }
#pixel .px-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hang picker: choose a saved piece for an easel or a frame in the Art School. */
#hang { position: fixed; inset: 0; display: none; background: var(--bg); color: var(--text); z-index: 10; overflow: hidden; font-family: var(--vt); font-size: var(--fs-m); }
#hang.on { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; }
#hang .hang-title { font-family: var(--px); font-size: var(--px-l); line-height: var(--lh-title); color: var(--accent); /* title */ }
#hang .hang-empty { color: var(--text-dim); }
#hang .hang-grid { flex: 1; min-height: 0; width: min(720px, 90vw); overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-content: start; }
#hang .hang-tile { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; }
#hang .hang-pick { border-color: var(--accent); }
#hang .hang-thumb { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: var(--bg); }
#hang .hang-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hang .hang-keys { font-family: var(--label); font-size: var(--lb-s); line-height: var(--lh-tight); color: var(--text-dim); /* label */ }
