/* BENCHLIGHT — the workshop. Built from the v5 materials in v5.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, p, ol, dl, dd { margin: 0; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the launch ---------- */
#launch, #finale { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; overflow: hidden; }
#launchRain, #finaleRain { position: absolute; inset: 0; width: 100%; height: 100%; }
#splash { position: relative; display: flex; flex-direction: column; align-items: center; gap: 40px; transition: opacity .6s var(--ease); }
#splash.gone { opacity: 0; pointer-events: none; }
.sealwrap { position: relative; }
.sig { width: 220px; height: 220px; overflow: visible; }
.sig line:nth-of-type(1) { --d: .15s; } .sig line:nth-of-type(2) { --d: .33s; } .sig line:nth-of-type(3) { --d: .51s; } .sig line:nth-of-type(4) { --d: .69s; } .sig line:nth-of-type(5) { --d: .87s; } .sig line:nth-of-type(6) { --d: 1.05s; } .sig circle:nth-of-type(1) { --d: 1.3s; } .sig circle:nth-of-type(2) { --d: 1.36s; } .sig circle:nth-of-type(3) { --d: 1.42s; } .sig circle:nth-of-type(4) { --d: 1.48s; } .sig circle:nth-of-type(5) { --d: 1.54s; } .sig circle:nth-of-type(6) { --d: 1.6s; } 
.sig line { fill: none; stroke: var(--oak); stroke-width: 14; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .5s var(--ease) var(--d) forwards; }
.sig circle { fill: #020202; stroke: var(--oak); stroke-width: 9; opacity: 0; transform-box: fill-box; transform-origin: center; animation: node .35s var(--ease) var(--d) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes node { 0% { opacity: 0; transform: scale(1.4); } 100% { opacity: 1; transform: scale(1); } }
.reg { position: absolute; inset: -34px; pointer-events: none; animation: fade .4s 1.9s both; }
.reg i { position: absolute; width: 18px; height: 18px; border: 0 solid var(--mauve); }
.reg i:nth-child(1) { left: 0; top: 0; border-left-width: 1px; border-top-width: 1px; }
.reg i:nth-child(2) { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.reg i:nth-child(3) { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.reg i:nth-child(4) { right: 0; bottom: 0; border-right-width: 1px; border-bottom-width: 1px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.name { display: flex; align-items: center; gap: 22px; }
.name b { display: block; height: 1px; width: 110px; background: var(--oak); transform: scaleX(0); animation: rule .6s var(--ease) 2.1s forwards; }
.name b:first-child { transform-origin: right; } .name b:last-child { transform-origin: left; }
@keyframes rule { to { transform: scaleX(1); } }
.word { font-size: 40px; line-height: 48px; letter-spacing: .5em; margin-right: -.5em; color: var(--oak); white-space: nowrap; text-shadow: 0 0 1px var(--oak), 0 0 14px #c9bab055; animation: flick .5s steps(1) 2.0s both; }
@keyframes flick { 0% { opacity: 0; } 20% { opacity: 1; } 40% { opacity: 0; } 60%, 100% { opacity: 1; } }
.house { font-size: 11px; line-height: 16px; letter-spacing: .42em; margin-right: -.42em; text-transform: uppercase; color: var(--dim); animation: fade .5s 2.6s both; }
.skip { position: absolute; right: 20px; bottom: 20px; z-index: 3; }

#boot { position: relative; z-index: 2; width: min(560px, calc(100% - 32px)); animation: fade .5s both; }
.bootcard { display: flex; flex-direction: column; gap: 20px; }
.boothead { display: flex; align-items: center; gap: 16px; }
.boothead .window, .bar .brand { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 20px; line-height: 24px; }
.msig { width: 22px; height: 22px; stroke: var(--oak); stroke-width: 34; fill: none; }
.bootsay { color: var(--rose); font-size: 13px; line-height: 20px; }
#bootState { display: flex; align-items: center; gap: 8px; color: var(--working); }
#bootState.ready { color: var(--done); }
.steps { list-style: none; padding: 6px 0; }
.steps li { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 7px 14px; font-size: 13px; line-height: 20px; }
.steps li + li { border-top: 1px solid #1d1414; }
.steps .ic { color: var(--dusty); text-align: center; }
.steps li.done .ic { color: var(--done); } .steps li.run .ic { color: var(--working); }
.steps .sub { display: block; font-size: 11px; color: var(--dusty); }
.steps .meter { grid-column: 2 / 4; height: 6px; border-radius: 4px; background: #050606; box-shadow: inset 0 1px 2px #000; overflow: hidden; }
.steps .meter i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--rose2) 0 6px, transparent 6px 8px); box-shadow: 0 0 6px #b19a9855; transition: width .3s linear; }
.bootkeys { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- the workshop ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; height: 100vh; }
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 6px 12px; border-bottom: 1px solid #000; box-shadow: 0 1px 0 var(--mocha); position: relative; z-index: 5; }
.bar > .l { justify-self: start; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar > .r { justify-self: end; display: flex; align-items: center; gap: 10px; }
.bar .pocket { padding: 5px; }
.bar .window { height: 36px; display: flex; align-items: center; }
.bar .brand { font-size: 15px; height: 36px; }
.instr .window { padding: 0; }
.ro { display: flex; align-items: center; gap: 8px; padding: 0 14px; white-space: nowrap; align-self: stretch; }
.ro + .ro { border-left: 1px solid var(--mocha); box-shadow: inset 1px 0 0 #000000a6; }
.ro .v { font-size: 14px; line-height: 20px; color: var(--oak); }
.babble .window { padding: 0 0 0 12px; gap: 12px; }
.babble .lbl { flex: none; }
.tk { flex: none; width: 46ch; height: 36px; font-size: 13px; overflow: hidden; white-space: nowrap; display: flex; align-items: center; border-left: 1px solid var(--mocha); box-shadow: inset 1px 0 0 #00000099; padding-left: 8px;
  background-image: repeating-linear-gradient(90deg, #c9bab00c 0 calc(1ch - 1px), transparent calc(1ch - 1px) 1ch); background-size: 100% 60%; background-position: 0 50%; background-repeat: repeat-x; }
#babble { color: var(--rose); letter-spacing: 0; white-space: pre; text-shadow: 0 0 1px currentColor, 0 0 6px color-mix(in srgb, currentColor 38%, transparent); }

.shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; }
.pane { display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; min-width: 0; min-height: 0; }
.left { box-shadow: inset -1px 0 0 #c9bab00d; }
.right { box-shadow: inset 1px 0 0 #c9bab00d; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--mocha) transparent; }
.ph { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.ph.ruled::after { content: ""; flex: 1; order: 1; height: 1px; background: linear-gradient(90deg, var(--mocha), transparent); }
.ph .cap { order: 2; }
.chapters { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.chapters > .sc { position: absolute; inset: 0; }
.chap { display: flex; flex-direction: column; gap: 4px; }
.chap + .chap { margin-top: 6px; }
.chap > .lbl { padding: 4px 4px 2px; color: var(--dusty); display: flex; flex-direction: column; gap: 2px; }
.chap > .lbl .line { text-transform: none; letter-spacing: 0; color: var(--rose); font-size: 11px; }
.it.lv .t { display: flex; gap: 8px; }
.it.lv .word2 { color: var(--dusty); }
.it.lv[aria-current="true"] { background: #222626; box-shadow: 0 1px 0 #000, 0 2px 4px #000000b3, inset 0 1px 0 #c9bab01f, inset 2px 0 0 var(--clay); }
.it.lv.locked { opacity: .45; cursor: default; }
.it .leds { display: flex; gap: 5px; }
.it .leds .led { width: 5px; height: 5px; }
.commissions { display: flex; flex-direction: column; gap: 6px; }

/* the well */
.well { position: relative; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #0b0c0c 0%, #070808 60%, #040505 100%); border-top: 1px solid #000;
  box-shadow: inset 0 18px 28px -8px #000000f2, inset 0 2px 0 #000, inset 16px 0 22px -12px #000000d9, inset -16px 0 22px -12px #000000d9, inset 0 -14px 20px -12px #000000b3, inset 0 -1px 0 var(--mocha);
  scrollbar-width: thin; scrollbar-color: var(--mocha) transparent; }
.well > .floor { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .55; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 48%, #0003 0%, #0008 55%, #000 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 48%, #0003 0%, #0008 55%, #000 100%); }
.lightsrc { position: absolute; left: 18px; top: 16px; z-index: 2; display: flex; align-items: center; gap: 10px; color: var(--dusty); }
.lightsrc .lamp { width: 14px; height: 14px; border-radius: 99px; background: radial-gradient(circle at 40% 40%, #fff6ee, #f1e6dc 40%, #d4b07a 75%, #a46f67);
  box-shadow: 0 0 0 2px #050606, 0 0 18px 6px #f1e6dc33, 0 0 60px 20px #f1e6dc12; }
.stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 54px 24px 28px; margin: auto 0; }
.titleline { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.titleline h2 { font-size: 24px; line-height: 30px; }

/* the bench: a milled plate; squares are cut into it with a groove between them */
.benchwrap { --sq: 64px; position: relative; padding: 14px; border-radius: 10px;
  background: #121414 repeating-linear-gradient(0deg, #c9bab003 0 1px, transparent 1px 3px);
  box-shadow: 0 2px 0 #000, 0 18px 40px #000000e6, inset 0 1px 0 #c9bab01f, inset 1px 0 0 #c9bab010, inset 0 -1px 0 #000, inset -1px 0 0 #00000099;
  transition: transform .6s var(--ease); }
.benchwrap::before { content: ""; position: absolute; inset: 5px; border-radius: 6px; pointer-events: none; box-shadow: inset 0 0 0 1px #0a0b0b, inset 0 1px 0 #c9bab00a; }
.benchwrap.turning { transform: rotate(90deg); }
.benchwrap.turning .bench { opacity: .65; }
.bench { position: relative; display: grid; gap: 3px; background: #050606; padding: 3px; border-radius: 4px; box-shadow: inset 0 2px 3px #000; }

.sq { position: relative; width: var(--sq); height: var(--sq); border: 0; padding: 0; margin: 0; font: inherit; color: inherit; border-radius: 3px; cursor: pointer;
  background: #1e2121 repeating-linear-gradient(0deg, #c9bab005 0 1px, transparent 1px 3px);
  box-shadow: inset 0 1px 0 #c9bab014, inset 1px 0 0 #c9bab00a, inset 0 -1px 0 #000000a0; }
.sq.locked { cursor: default; }
/* light on a square: a warm sheen from the top left, and the rays */
.sq::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  background: linear-gradient(135deg, #f1e6dc12 0%, transparent 55%), repeating-linear-gradient(135deg, #f1e6dc07 0 2px, transparent 2px 11px); transition: opacity .25s ease; }
/* shade: the light's absence, cast from the top left */
.sq::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 6; opacity: 0;
  background: linear-gradient(135deg, #000000d0 0%, #000000a8 60%, #00000096 100%); transition: opacity .25s ease; }
.sq.shade::before { opacity: 0; }
.sq.shade::after { opacity: 1; }
.sq.preview-shade::after { opacity: .7; background: repeating-linear-gradient(135deg, #000000c0 0 5px, #00000080 5px 10px); }
.sq.preview-lit::after { opacity: 0; }
.sq.preview-lit.shade::after { opacity: .25; }
.sq:focus-visible { outline: 2px solid var(--oak); outline-offset: 1px; z-index: 20; }
.sq.cursor { outline: 1px dashed #c9bab088; outline-offset: -3px; }
.sq.hint { animation: hint 1.2s ease-in-out 3; }
@keyframes hint { 50% { box-shadow: inset 0 0 0 2px var(--working), 0 0 14px #d4b07a66; } }

/* glint: a hard bright spot; glow: a lamp's warm pool */
.glintmark { position: absolute; inset: 0; z-index: 7; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, #fffaf5 0 3%, #f1e6dccc 6%, #f1e6dc44 22%, transparent 50%),
    linear-gradient(45deg, transparent 47%, #f1e6dc55 50%, transparent 53%), linear-gradient(-45deg, transparent 47%, #f1e6dc55 50%, transparent 53%); animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .7; transform: scale(.92); } }
.glowmark { position: absolute; inset: -2px; z-index: 7; pointer-events: none; border-radius: inherit; background: radial-gradient(circle at 50% 50%, #e8a06a33, #e07a6214 60%, transparent 80%); }

/* the parts, as drawn on top of a square */
.part { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
/* raised plates: a top face with grain and a lit top-left edge, sides falling away to the bottom right */
.raised { position: absolute; inset: 4px; border-radius: 3px; z-index: 8;
  background: #262a2b repeating-linear-gradient(0deg, #c9bab006 0 1px, transparent 1px 3px);
  box-shadow: inset 0 1px 0 #c9bab03a, inset 1px 0 0 #c9bab022, inset 0 -1px 0 #000000a0, inset -1px 0 0 #00000080, var(--ext); }
.raised.h1 { --lift: 3px; --ext: 1px 1px 0 #101212, 2px 2px 0 #0c0d0d, 3px 3px 0 #090a0a, 4px 5px 8px #000000c0; transform: translate(-2px, -2px); }
.raised.h2 { --ext: 1px 1px 0 #101212, 2px 2px 0 #0e0f0f, 3px 3px 0 #0c0d0d, 4px 4px 0 #0a0b0b, 5px 5px 0 #08090a, 6px 7px 12px #000000c8; transform: translate(-3px, -3px); }
.raised.h3 { --ext: 1px 1px 0 #101212, 2px 2px 0 #0f1010, 3px 3px 0 #0d0e0e, 4px 4px 0 #0c0d0d, 5px 5px 0 #0a0b0b, 6px 6px 0 #090a0a, 7px 7px 0 #08090a, 8px 9px 16px #000000d0; transform: translate(-4px, -4px); }
.raised .hnum { position: absolute; left: 6px; top: 3px; font-size: 11px; line-height: 14px; color: var(--dusty); }
.raised .pips { position: absolute; right: 6px; bottom: 5px; display: flex; gap: 3px; }
.raised .pips i { width: 4px; height: 4px; border-radius: 1px; background: #0b0c0c; box-shadow: inset 0 1px 0 #000, 0 1px 0 #c9bab015; }
.raised.bolted .bolt { position: absolute; width: 5px; height: 5px; border-radius: 99px; background: radial-gradient(circle at 35% 35%, #5d5a56, #2a2a29 70%); box-shadow: 0 1px 0 #c9bab018, inset 0 -1px 0 #000; }
.raised.bolted .bolt:nth-of-type(1) { left: 4px; bottom: 4px; } .raised.bolted .bolt:nth-of-type(2) { right: 4px; top: 4px; }
.raised.mine { background: #2b2827 repeating-linear-gradient(0deg, #c9bab007 0 1px, transparent 1px 3px); }
.raised.mine::after { content: ""; position: absolute; right: 5px; top: 5px; width: 4px; height: 4px; border-radius: 99px; background: var(--clay); box-shadow: 0 0 0 1px #050606, 0 0 4px #e07a6288; }
.raised.ghost { opacity: .5; outline: 1px dashed var(--rose); outline-offset: 1px; }

/* pocket: below the bench, its own lip shades it */
.sq.pit { background: #070808; box-shadow: inset 5px 5px 8px -2px #000, inset 2px 2px 0 #000, inset -1px -1px 0 var(--mocha), inset 0 0 0 1px #000; cursor: default; }
.sq.pit::before { inset: 4px; }
/* rivet */
.rivet { width: 30%; height: 30%; border-radius: 99px; background: radial-gradient(circle at 35% 30%, #6b6762, #34322f 55%, #1c1b1a); box-shadow: 0 1px 0 #c9bab015, 1px 2px 3px #000000c0, inset 0 -1px 1px #000; }
.rivet::after { content: ""; display: block; width: 60%; height: 1px; margin: 45% auto 0; background: #111; transform: rotate(-35deg); }
/* photocell: a lens in a drilled socket; it lights when light reaches it */
.cell { position: relative; width: 52%; height: 52%; border-radius: 99px; background: radial-gradient(circle at 50% 50%, #0b0c0c 0 40%, #141616 41% 55%, #070808 56%);
  box-shadow: inset 0 2px 3px #000, 0 1px 0 #c9bab015, 0 0 0 2px #0e1010, 0 0 0 3px #232627; }
.cell i { position: absolute; inset: 30%; border-radius: 99px; background: #151313; box-shadow: inset 0 1px 1px #000; transition: background .2s, box-shadow .2s; }
.cell.ok i { background: radial-gradient(circle at 35% 35%, #f6c9b8 0%, #e07a62 55%, #a46f67 100%); box-shadow: 0 0 6px 2px #e07a6299, 0 0 14px 4px #e07a6233; animation: led-on .28s var(--ease); }
.cell::after { content: ""; position: absolute; inset: 0; border-radius: 99px; background: radial-gradient(120% 90% at 25% 15%, #c9bab022, transparent 50%); }
/* burner: a coil that wants the glint */
.burner { width: 60%; height: 60%; border-radius: 99px; background: repeating-radial-gradient(circle, #241a18 0 2px, #0d0909 2px 4px); box-shadow: inset 0 2px 4px #000, 0 0 0 2px #0e1010, 0 0 0 3px #3a2523; transition: box-shadow .3s; }
.burner.ok { background: repeating-radial-gradient(circle, #e07a62 0 2px, #6e2e22 2px 4px); box-shadow: 0 0 10px 3px #e07a6288, 0 0 0 2px #0e1010, 0 0 0 3px #a46f67; animation: led-on .28s var(--ease); }
/* display: a little window under glass, one character cell; it only reads in shade */
.disp { position: relative; width: 74%; height: 74%; border-radius: 4px; background: var(--onyx); border: 1px solid var(--mocha);
  box-shadow: inset 0 1px 0 #c9bab01f, inset 0 -2px 6px #00000099, 0 1px 2px #000; display: grid; place-items: center; overflow: hidden; }
.disp .ch { font-size: calc(var(--sq) * .42); line-height: 1; color: #c9bab014; text-shadow: none; transition: color .25s, text-shadow .25s;
  background-image: linear-gradient(90deg, #c9bab00c, #c9bab00c); background-size: 1ch 78%; background-position: center; background-repeat: no-repeat; padding: 0 2px; }
.disp.ok .ch { color: var(--oak); text-shadow: 0 0 1px currentColor, 0 0 8px #c9bab066; }
.disp.washed { border-color: #6b4c40; }
.disp.washed::after { content: ""; position: absolute; inset: 0; background: linear-gradient(116deg, transparent 10%, #f1e6dc33 30%, #f1e6dc66 42%, #f1e6dc22 55%, transparent 70%); }
.disp .gl { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(130% 90% at 12% -10%, #c9bab017 0%, transparent 60%), linear-gradient(116deg, transparent 6%, #c9bab00c 20%, #c9bab012 26%, transparent 46%); }
/* glass piece: a pane on a stand; the glint path shows where it lands */
.pane-glass { position: relative; width: 70%; height: 70%; border-radius: 4px; z-index: 8;
  background: linear-gradient(135deg, #c9bab022 0%, #c9bab008 45%, #9ea3c80d 100%); border: 1px solid #c9bab040;
  box-shadow: inset 0 1px 0 #e6d8cd66, inset 1px 0 0 #e6d8cd33, inset -1px -1px 0 #00000080, 2px 3px 6px #000000a0; }
.pane-glass::before { content: ""; position: absolute; top: 12%; left: 14%; width: 40%; height: 2px; background: linear-gradient(90deg, transparent, #f1e6dcaa, transparent); transform: rotate(-35deg); }
.pane-glass.lit { box-shadow: inset 0 1px 0 #e6d8cd88, inset 1px 0 0 #e6d8cd44, inset -1px -1px 0 #00000080, 2px 3px 6px #000000a0, 0 0 12px #f1e6dc33; }
/* lamp piece */
.lamp-part { width: 46%; height: 46%; border-radius: 99px; z-index: 8; position: relative; background: radial-gradient(circle at 38% 35%, #fff1e6 0%, #f0b48a 35%, #e07a62 65%, #7a3f33 100%);
  box-shadow: 0 0 0 3px #1a1716, 0 0 0 4px #4a3a33, 0 0 16px 6px #e8a06a55, 2px 3px 6px #000; }
.mine-led { position: absolute; right: 5px; top: 5px; width: 4px; height: 4px; border-radius: 99px; background: var(--clay); box-shadow: 0 0 0 1px #050606, 0 0 4px #e07a6288; z-index: 9; }
.ghost { opacity: .55; }

/* the glint path, drawn over the bench */
.paths { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: visible; filter: none; }
.paths line { stroke: #f1e6dc; stroke-width: 1.2; stroke-dasharray: 3 4; opacity: .5; }
.paths line.blocked { stroke: var(--failed); opacity: .6; }
.paths circle { fill: none; stroke: #f1e6dc; stroke-width: 1; opacity: .5; }

/* the readout under the bench */
.readout { display: flex; align-items: center; gap: 18px; }
.readout .window { padding: 6px 14px; min-width: 12ch; display: flex; justify-content: center; }
.wordro { font-size: 22px; line-height: 30px; }
.wordro .w { color: #c9bab03a; text-shadow: none; transition: color .2s, text-shadow .2s; }
.wordro .w.on { color: var(--oak); text-shadow: 0 0 1px currentColor, 0 0 8px #c9bab066; }
.wordro .w.solved { color: var(--rose); }
.rating { display: flex; gap: 10px; }
.rating .led { width: 9px; height: 9px; }
.keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* tray */
.tray { min-height: 80px; }
.it.piece { min-height: 48px; }
.it.piece .swatch { width: 30px; height: 30px; flex: none; position: relative; border-radius: 3px; background: #1a1d1d; box-shadow: inset 0 1px 0 #c9bab014; display: grid; place-items: center; }
.it.piece .swatch .raised { inset: 4px; }
.it.piece .swatch .pane-glass { width: 66%; height: 66%; }
.it.piece .swatch .lamp-part { width: 50%; height: 50%; }
.it.piece .n { font-size: 14px; color: var(--oak); }
.it.piece[aria-pressed="true"] { background: #232727; box-shadow: 0 0 0 1px var(--rose), 0 2px 4px #000000b3, inset 0 1px 0 #c9bab01f; }
.it.piece.empty { opacity: .4; }

/* checks */
.checks { max-height: 260px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--mocha) transparent; }
.checks .tr { grid-template-columns: 16px 1fr auto; }
.checks .ic.done { color: var(--done); } .checks .ic.failed { color: var(--failed); } .checks .ic.wait { color: var(--dusty); }
#checkSum.done { color: var(--done); }
.traceList { min-height: 90px; max-height: 200px; flex: none; }
.traceList > .sc { max-height: 200px; }
.trace-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; font-size: 12px; line-height: 18px; padding: 3px 4px; color: var(--rose); }
.trace-row .n { color: var(--dusty); }
.trace-row .r { color: var(--done); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.legend { font-size: 12px; line-height: 18px; }
.legend summary { cursor: pointer; padding: 6px 4px; list-style: none; }
.legend summary::-webkit-details-marker { display: none; }
.legend dl { display: grid; grid-template-columns: 34px 1fr; gap: 8px 10px; align-items: center; padding: 6px 4px; }
.legend dt { position: relative; width: 30px; height: 30px; border-radius: 3px; background: #1a1d1d; display: grid; place-items: center; }
.legend dd { color: var(--rose); }

/* the finale */
.finalcard { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; padding: 20px; }
.finalcard .word { font-size: clamp(22px, 4vw, 40px); }
.finalsay { color: var(--rose); max-width: 46ch; }
.finalkeys { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* smaller screens: the benches tuck behind a key; on phones the tray follows the bench */
#menuKey { display: none; }
@media (max-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr) 300px; }
  .left { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .35s var(--ease); box-shadow: 10px 0 30px #000000c0; }
  .left.open { transform: none; }
  #menuKey { display: inline-flex; align-items: center; }
  .tk { width: 30ch; }
}
@media (max-width: 860px) {
  #app { height: auto; }
  .bar { grid-template-columns: 1fr auto; }
  .bar > .c { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .babble .window { width: 100%; } .tk { flex: 1; width: auto; }
  .bar .instr:not(.r .instr) .ro:nth-child(n+3) { display: none; }
  .bar > .r .instr { display: none; }
  .shell { grid-template-columns: 1fr; }
  .well { overflow: visible; }
  .right { overflow: visible; }
  .stage { padding: 44px 12px 20px; }
  .lightsrc .cap { display: none; }
}
@media (max-width: 520px) {
  .bar .brand span { display: none; }
  .keys .btn { padding: 0 12px; } .btn kbd { display: none; }
  .name b { width: 40px; } .word { font-size: 26px; }
}

/* parts that emit light sit above the shade; the top of a plate standing in a taller plate's shade goes dark */
.part.over { z-index: 7; }
.raised.shaded::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, #000000c8, #00000090); }
.sq.pit .part.over .cell { width: 46%; height: 46%; }
span.pocket { display: inline-flex; vertical-align: middle; }
span.pocket > .window { flex: 1; }
/* the finale: the seal fills the top of the screen, the card sits under it */
#finale { place-items: end center; }
#finale .finalcard { margin-bottom: max(6vh, 30px); }
#finale .word { animation-delay: .9s; }
#finale .name b { animation-delay: 1s; }
#finale .house { animation-delay: 1.5s; }
#finale .finalsay { animation: fade .8s 2s both; }
#finale .finalkeys { animation: fade .6s 2.6s both; }
#finale .finalcard::before { content: ""; position: absolute; inset: -60px -120px -40px; z-index: -1; background: radial-gradient(ellipse 50% 50% at 50% 55%, #000000ee 30%, #000000b0 60%, transparent 100%); }

/* the leaderboard: public, in plain sight */
.board { display: flex; flex-direction: column; gap: 8px; }
.board h2 { color: var(--oak); }
.boardlist { max-height: 210px; }
.boardlist > .sc { max-height: 210px; margin: 0; list-style: none; padding: 8px; gap: 3px; }
.brow { display: grid; grid-template-columns: 3ch 1fr auto; gap: 10px; align-items: center; padding: 5px 8px; font-size: 12px; line-height: 18px; border-radius: 3px; background: var(--plate); box-shadow: 0 1px 0 #000, inset 0 1px 0 #c9bab00f; }
.brow .rk { color: var(--dusty); }
.brow .sw { color: var(--oak); }
.brow.you { box-shadow: 0 1px 0 #000, inset 0 1px 0 #c9bab01f, inset 2px 0 0 var(--clay); }
.brow.you .nm::after { content: " · you"; color: var(--dusty); }
.right .board { order: -1; }

.legend .pitmark { position: absolute; inset: 3px; border-radius: 3px; background: #070808; box-shadow: inset 3px 3px 5px #000, inset -1px -1px 0 #412828; }
.measure { position: absolute; visibility: hidden; font-size: 13px; }
@media (max-width: 860px) { .bar > .c .pocket { display: flex; width: 100%; } .bar > .c .window { flex: 1; min-width: 0; } }
/* the boot card reads over the rain */
#boot::before { content: ""; position: absolute; inset: -50px -70px; z-index: -1; background: radial-gradient(ellipse 60% 60% at 50% 50%, #000000e8 40%, #000000a0 70%, transparent 100%); }

a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.acct { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; line-height: 18px; color: var(--dusty); }
.acct a { color: var(--rose); }
@media (max-width: 520px) { #homeKey { padding: 0 10px; } }
/* phones: the bar keeps the mark and the keys; the bench and its pieces are named right under it anyway */
@media (max-width: 860px) { .bar > .l .instr { display: none; } .bar > .r { gap: 6px; } .bar .btn.half { padding: 0 10px; } }

/* ---- resizing: everything scales with the window; nothing collapses or wraps ---- */
.btn { white-space: nowrap; }
.shell { grid-template-columns: clamp(220px, 17vw, 300px) minmax(0, 1fr) clamp(270px, 22vw, 360px); }
.pane { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--mocha) transparent; }
.pane > * { flex: none; }
.left .chapters { flex: 1 1 auto; min-height: 220px; }
.boardlist { max-height: clamp(110px, 22vh, 260px); }
.boardlist > .sc { max-height: clamp(110px, 22vh, 260px); }
.checks { max-height: clamp(140px, 30vh, 320px); min-height: 60px; }
.traceList { max-height: clamp(90px, 20vh, 220px); }
.traceList > .sc { max-height: clamp(90px, 20vh, 220px); }
.tray { min-height: 0; }
/* the bar: the narrator gives way first, then the extra instruments */
.bar { grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); }
.bar > .c { min-width: 0; }
.bar > .c .pocket { max-width: 100%; }
.babble .window { min-width: 0; }
.tk { width: clamp(14ch, 28vw, 46ch); }
@media (max-width: 1500px) { .bar > .r .instr { display: none; } }
@media (max-width: 1300px) { .bar > .l .instr .ro:nth-child(3) { display: none; } }
@media (max-width: 1180px) { .shell { grid-template-columns: minmax(0, 1fr) clamp(260px, 30vw, 340px); } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .pane { overflow: visible; } .tk { width: auto; } }
/* short windows: tighten the stage */
@media (max-height: 720px) { .stage { padding-top: 40px; gap: 12px; } .titleline h2 { font-size: 20px; line-height: 26px; } }
@media (max-width: 1180px) { .bar > .l .instr { display: none; } }
.acct .codebox { display: inline-flex; }
.acct .codebox .window { padding: 4px 12px; }
.acct .code { font-size: 20px; line-height: 28px; letter-spacing: 0; color: var(--working); }
/* phones: the mark shrinks to the sigil first, then the keys tighten; they wrap rather than slide under each other */
@media (max-width: 700px) {
  .bar .brand span { display: none; }
  .bar { grid-template-columns: auto minmax(0, 1fr); }
  .bar > .r { justify-self: end; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; min-width: 0; }
  .bar .btn.half { padding: 0 9px; letter-spacing: .05em; }
}
@media (max-width: 380px) { .bar .btn.half { padding: 0 7px; font-size: 11px; letter-spacing: .02em; } }
/* short landscape phones: keep the bench and its keys on one screen */
@media (max-height: 500px) and (orientation: landscape) {
  .stage { padding-top: 34px; gap: 8px; }
  .titleline h2 { font-size: 18px; line-height: 24px; }
  .readout .window { padding: 2px 10px; }
  .keys .btn { min-height: 36px; }
}
