.hand-page { --hand-paper: #eeebe5; --hand-muted: #a5a1a5; --hand-line: #ffffff17; --hand-accent: #dea978; background: #101014; color: var(--hand-paper); }
.hand-page .masthead { background: #101014; border-bottom-color: var(--hand-line); }
.hand-shell { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 0; width: 100%; max-width: none; margin: 0; padding: 0 0 16px; }
.hand-performance { min-width: 0; padding: 0; }
.hand-page button, .hand-page select { font: inherit; }
.hand-shell button, .hand-shell select { min-height: 34px; color: var(--hand-paper); background: #ffffff06; border: 1px solid #ffffff20; border-radius: 5px; padding: 6px 11px; cursor: pointer; }
.hand-shell .instrument-picker-next { padding: 0; }
.hand-shell button:hover { background: #ffffff12; border-color: #ffffff45; }
.hand-shell button[aria-pressed="true"] { background: #dea97820; border-color: #dea97880; color: #f3cfab; }
.hand-shell input[type="range"] { width: 100%; accent-color: var(--hand-accent); margin: 3px 0; min-width: 0; cursor: ew-resize; }
.hand-shell output { font-variant-numeric: tabular-nums; color: var(--hand-paper); font-size: 11px; }
.hand-viewport { height: clamp(420px, calc(100dvh - 330px), 780px); position: relative; min-width: 0; overflow: hidden; border-radius: 8px; background: #141418; }
.hand-viewport h1 { position: absolute; left: 25px; top: 22px; z-index: 2; margin: 0; font-family: inherit; font-weight: 500; font-size: clamp(22px, 2.55vw, 40px); letter-spacing: -.055em; color: var(--hand-paper); pointer-events: none; }
#handCanvas { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -3px; }
.hand-model-status { position: absolute; z-index: 3; top: 43%; left: 15%; right: 15%; text-align: center; background: #101014da; padding: 12px; border-radius: 6px; font-size: 12px; }
.hand-model-status[hidden] { display: none; }
.hand-camera { display: flex; gap: 5px; position: absolute; z-index: 2; bottom: 52px; left: 20px; }
.hand-camera button { background: #131319db; backdrop-filter: blur(8px); font-size: 11px; padding: 5px 9px; min-width: 32px; }
.hand-stage-footer { position: absolute; left: 22px; right: 20px; bottom: 18px; display: flex; justify-content: space-between; gap: 10px; align-items: center; pointer-events: none; }
.hand-stage-footer output { font-size: 12px; }
.hand-stage-footer label { color: var(--hand-muted); font-size: 11px; display: inline-flex; align-items: center; gap: 5px; pointer-events: auto; }
.hand-stage-footer input { accent-color: var(--hand-accent); }
.hand-gesture-help { color: var(--hand-muted); margin: 10px 0; font-size: 11px; }
.hand-notice { color: #edbf8d; font-size: 12px; margin: 6px 0; min-height: 0; }
.hand-notice:empty { display: none; }
.hand-panel { padding: 0; border-left: 1px solid var(--hand-line); min-width: 0; }
/* Use Shape's shared section bars, typography, palette and native disclosures. */
.hand-control-block { margin: 0; }
.hand-shell .hand-section-action { display: block; margin: 10px 0 0 auto; border: 0; font-size: 10px; min-height: 28px; padding: 2px 5px; background: transparent; color: var(--hand-muted); }
.hand-panel > .group > .group-summary { padding-inline: 8px; }
.hand-panel > .group > .group-body { padding: 10px 8px 12px; }
.hand-panel > .instrument-preset-controls { padding: 8px; flex-wrap: wrap; row-gap: 6px; }
.hand-preset-scope { flex: 0 0 100%; display: flex; align-items: center; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.hand-scope-label { margin-right: 4px; font-size: 10px; color: var(--hand-muted); }
.hand-preset-scope label { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.hand-preset-scope input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.hand-preset-scope label > span { display: flex; align-items: center; justify-content: center; min-height: 28px; padding: 2px 8px; border: 1px solid var(--hand-line); border-radius: 5px; font-size: 11px; color: var(--hand-muted); }
.hand-preset-scope input:checked + span { border-color: #dea97880; color: #f3cfab; background: #dea97820; }
.hand-preset-scope input:focus-visible + span { outline: 2px solid var(--hand-accent); outline-offset: 2px; }
.hand-preset-scope label:hover > span { border-color: #ffffff45; }
@media (pointer: coarse) { .hand-preset-scope label > span { min-height: 36px; } }
.hand-control-block > .group-body > :first-child { margin-top: 0; }
.hand-control, .hand-select { display: grid; gap: 5px; margin: 12px 0 0; min-width: 0; }
.hand-control > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--hand-muted); }
.hand-select > span { color: var(--hand-muted); font-size: 11px; }
.hand-select select { width: 100%; min-width: 0; font-size: 12px; background-color: #1b1b21; }
.hand-finger-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.hand-finger-tabs button { padding: 7px 2px; font-size: 10px; border-color: transparent; position: relative; }
.hand-finger-tabs button::before { content: ''; display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--finger-color); margin: 0 auto 6px; }
.hand-check { display: flex; gap: 7px; align-items: flex-start; font-size: 10px; color: var(--hand-muted); margin-top: 14px; line-height: 1.6; }
.hand-check input { accent-color: var(--hand-accent); }
.hand-control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hand-notes { font-size: 11px; color: var(--hand-muted); }
.hand-notes > .group-body { line-height: 1.7; }
.hand-notes a { color: #e2bc99; }
.hand-voices { --hand-voice-controls: 175px; --hand-voice-gap: 12px; --hand-voice-inset: 11px; padding-top: 16px; }
.hand-finger-mixer { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.hand-voice { min-width: 0; padding-top: 10px; border-top: 2px solid var(--finger-color); }
.hand-voice-name { width: 100%; text-align: left; padding: 0 !important; border: 0 !important; background: transparent !important; font-size: 12px !important; min-height: 28px !important; }
.hand-voice-name[aria-pressed="true"] { color: var(--finger-color) !important; }
.hand-voice select { width: 100%; padding: 5px 6px; min-width: 0; font-size: 11px; background: #1b1b21; }
.hand-voice .hand-mix-actions { display: flex; gap: 4px; margin-top: 7px; }
.hand-mix-actions button { flex: 1; padding: 4px 2px; font-size: 10px; min-height: 29px; }
.hand-voice input { accent-color: var(--finger-color) !important; }
.hand-voice label { display: block; font-size: 10px; color: var(--hand-muted); margin-top: 8px; }
.hand-voice meter { display: block; width: 100%; height: 4px; margin: 8px 0 0; opacity: .7; }
@media (min-width: 1050px) { .hand-panel { max-height: calc(100dvh - 78px); overflow-y: auto; scrollbar-width: thin; } .hand-performance { position: sticky; align-self: start; top: 0; } }
@media (max-width: 1049px) { .hand-shell { grid-template-columns: minmax(0, 1fr) 280px; } .hand-finger-mixer { gap: 6px; } .hand-viewport { height: 530px; } }
@media (max-width: 760px) { .hand-shell { display: block; padding: 0 0 24px; } .hand-performance { padding: 0; } .hand-viewport { height: min(63dvh, 590px); min-height: 365px; } .hand-viewport h1 { left: 18px; top: 18px; font-size: clamp(23px, 5.6vw, 36px); } .hand-panel { border-left: 0; border-top: 1px solid var(--hand-line); margin-top: 22px; padding: 20px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } .hand-control-block { margin: 0; } .hand-notes { grid-column: 1 / -1; } .hand-camera { left: 13px; } .hand-stage-footer { left: 16px; } }
@media (max-width: 450px) { .hand-panel { display: block; } .hand-finger-mixer { gap: 5px; } .hand-voice select { font-size: 10px; padding: 4px 1px; } .hand-voice-name { font-size: 11px !important; } .hand-mix-actions { flex-wrap: wrap; } .hand-mix-actions button { min-width: 26px; } .hand-gesture-help { font-size: 10px; } }
@media (max-height: 500px) and (orientation: landscape) { .hand-shell { grid-template-columns: minmax(0, 1fr) 265px; } .hand-viewport { height: 360px; min-height: 0; } .hand-viewport h1 { font-size: 23px; top: 14px; left: 16px; } .hand-camera { bottom: 45px; } }
@media (pointer: coarse) { .hand-page #audioButton, .hand-page [data-primary-transport], .hand-page #soundPlayButton { min-width: 48px; min-height: 48px; } .hand-shell input[type="range"] { min-height: 28px; } .hand-finger-tabs button { min-height: 44px; } .hand-camera button { min-height: 40px; } }
@media (prefers-reduced-motion: reduce) { .hand-shell * { scroll-behavior: auto; transition: none !important; } }

.hand-joint-note { font-size: 10px; line-height: 1.5; color: var(--hand-muted); margin: 12px 0 0; }

/* One pinned stage; both parameter groups keep the same native page scroller. */
@media (max-width: 960px) {
  html.hand-document { height: auto; min-height: 100%; overflow-x: clip; overflow-y: auto; scroll-padding-top: calc(var(--hand-sticky-offset, 440px) + 12px); }
  body.hand-page { height: auto; min-height: 100svh; overflow: visible; }
  .hand-page > .masthead { position: sticky; top: 0; }
  .hand-shell { display: flex; flex-direction: column; flex: none; width: 100%; padding: 0 env(safe-area-inset-right) max(24px, env(safe-area-inset-bottom)) env(safe-area-inset-left); }
  .hand-performance { display: contents; }
  .hand-stage { position: sticky; top: var(--hand-header-height, 109px); z-index: 20; display: grid; grid-template-rows: minmax(0, 1fr) auto; flex: none; height: min(52svh, calc(100svh - var(--hand-header-height, 109px) - 170px)); padding-bottom: 8px; background: #101014; box-shadow: 0 10px 12px #101014; }
  .hand-viewport { height: auto; min-height: 0; }
  .hand-viewport h1 { left: 16px; top: 14px; font-size: clamp(22px, 5.6vw, 32px); }
  .hand-camera { left: 12px; bottom: 46px; }
  .hand-stage-footer { left: 16px; bottom: 13px; }
  .hand-notice { margin: 4px 0 0; font-size: 11px; }
  .hand-panel { display: block; max-height: none; overflow: visible; border-left: 0; border-top: 1px solid var(--hand-line); margin-top: 0; padding: 0; }
  .hand-panel > .instrument-preset-controls { position: relative; top: auto; z-index: 0; }
  .hand-voices :is(button,input,select,summary), .hand-panel :is(button,input,select,summary) { scroll-margin-bottom: 16px; }
}
@media (max-width: 960px) and (max-height: 500px) and (orientation: landscape) {
  .hand-stage { height: min(55svh, calc(100svh - var(--hand-header-height, 58px) - 110px)); }
  .hand-viewport h1 { top: 10px; font-size: 21px; }
  .hand-camera { left: 12px; bottom: 10px; }
  .hand-stage-footer { left: auto; right: 12px; bottom: 12px; }
}

/* Shape's play/pause slots and labelled ranges, with independent hand players. */
.hand-transport-row { --hand-play-size: 44px; display: grid; grid-template-columns: var(--hand-play-size) var(--hand-play-size) minmax(0, 1fr); align-items: end; gap: 14px; }
.hand-player { display: grid; gap: 5px; justify-items: center; font-size: 11px; color: var(--hand-muted); }
.hand-shell .hand-player .play-button { width: var(--hand-play-size); height: var(--hand-play-size); min-width: var(--hand-play-size); min-height: var(--hand-play-size); padding: 0; border-radius: 50%; }
.hand-transports .hand-control { margin-top: 0; }
.hand-page .hand-tempo input[type="range"] { height: var(--hand-play-size); min-height: var(--hand-play-size); margin: 0; }
@media (pointer: coarse) { .hand-transport-row { --hand-play-size: 48px; } }

.hand-transports .hand-form { margin: 0 0 14px; }

.hand-control-block[hidden] { display: none; }

/* The shared loop control and beat ruler stay with the contour sequencer. */
.hand-contour-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.hand-loop-control { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 330px; }
.hand-loop-control > span { display: flex; gap: 6px; flex: none; align-items: baseline; font-size: 11px; white-space: nowrap; }
.hand-loop-control output { color: var(--hand-accent); }
.hand-shell .hand-loop-control input[type="range"] { flex: 1; width: 100%; min-width: 50px; height: 28px; min-height: 28px; margin: 0; }
.hand-loop-duration { flex: none; min-width: 48px; text-align: right; white-space: nowrap; }
.hand-contour-header .hand-gesture-help { flex: 1; min-width: 0; }
.hand-contour-ruler { position: relative; height: 16px; margin: 0 0 1px calc(var(--hand-voice-controls) + var(--hand-voice-gap) + var(--hand-voice-inset)); border-bottom: 1px solid var(--hand-line); }
.hand-loop-tick { position: absolute; top: 0; transform: translateX(-50%); color: var(--hand-muted); font-size: 9px; line-height: 13px; }
.hand-loop-start { transform: none; }
.hand-loop-end { transform: translateX(-100%); }
.hand-loop-playhead { position: absolute; bottom: -2px; width: 1px; height: 5px; background: var(--hand-paper); pointer-events: none; }

/* Compact voice rows with overlaid joint contours. */
.hand-finger-mixer { grid-template-columns: minmax(0,1fr); gap: 5px; }
.hand-voice { display: grid; grid-template-columns: var(--hand-voice-controls) minmax(0,1fr); align-items: center; gap: var(--hand-voice-gap); padding: 6px 0 6px 9px; border-top: 0; border-left: 2px solid var(--finger-color); }
.hand-voice-controls { display: grid; grid-template-columns: minmax(0,1fr) 58px; gap: 3px 6px; align-items: center; }
.hand-voice-name { grid-column: 1 / -1; font-size: 11px !important; min-height: 20px !important; }
.hand-voice-controls > select { grid-column: 1 / -1; min-height: 26px; padding: 2px 4px; }
.hand-voice label, .hand-voice .hand-mix-actions { margin: 0; }
.hand-voice-level { --accent: var(--finger-color); --bg-deep: #1b1b21; justify-self: center; }
.hand-voice-level > input[type="range"] { height: 100%; margin: 0; cursor: ns-resize; }
.hand-voice-level output { font-size: 10px; }
.hand-mix-actions { flex-wrap: nowrap; }
.hand-mix-actions button { min-width: 25px; min-height: 27px; }
.hand-contour-lane { min-width: 0; }
.hand-contour-tools { display: flex; align-items: center; gap: 8px; min-height: 32px; margin-bottom: 3px; }
.hand-contour-tools .hand-contour-joint { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 0 1 185px; font-size: 11px; }
.hand-contour-joint > span { flex: none; }
.hand-contour-tools select { width: 100%; min-width: 0; min-height: 32px; height: 32px; padding: 3px 5px; border: 1px solid #ffffff35; background: #222229; font-size: 11px; appearance: auto; -webkit-appearance: menulist; }
.hand-contour-tools select:focus-visible { outline: 2px solid var(--finger-color); outline-offset: 2px; }
.hand-contour-tools .hand-contour-value { margin-left: auto; white-space: nowrap; font-size: 10px; color: var(--hand-muted); }
.hand-contour { display: block; width: 100%; height: 57px; background: #ffffff04; border-radius: 3px; touch-action: none; cursor: crosshair; }
.hand-contour:focus-visible { outline: 2px solid var(--finger-color); outline-offset: 2px; }
.hand-voices .hand-gesture-help { margin: 0; font-size: 10px; }

/* Body lanes share the animation timeline without adding extra sound voices. */
.hand-voice[hidden] { display: none; }
.hand-body-lane > .hand-voice-name { grid-column: 1; text-align: left; align-self: center; }

@media(min-width:961px) { .hand-viewport { height: clamp(330px,calc(100dvh - 530px),650px); } }
@media(max-width:960px) {
  .hand-voices { --hand-voice-controls: 120px; --hand-voice-gap: 8px; padding-top: 0; margin-bottom: 22px; }
  .hand-contour-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; }
  .hand-loop-control { display: grid; gap: 2px; }
  .hand-loop-duration { align-self: end; padding-bottom: 7px; }
  .hand-contour-header .hand-gesture-help { grid-column: 1 / -1; }
}
@media(max-width:450px) {
  .hand-voices { --hand-voice-controls: 108px; --hand-voice-gap: 6px; --hand-voice-inset: 8px; }
  .hand-voice { padding-left: 6px; }
  .hand-voice-controls { grid-template-columns: 48px minmax(0,1fr); gap: 2px 4px; }
  .hand-contour { height: 66px; }
  .hand-contour-tools { gap: 4px; }
  .hand-contour-tools .hand-contour-joint { gap: 4px; }
}
@media(pointer:coarse) {
  .hand-shell .hand-loop-control input[type="range"] { height: 44px; min-height: 44px; }
  .hand-contour-tools, .hand-contour-tools select { min-height: 44px; }
  .hand-contour-tools select { height: 44px; }
  .hand-voice .hand-mix-actions button { min-height: 32px; }
}
@media(min-width:961px) and (pointer:fine) {
  .hand-viewport { height: clamp(304px,calc(100dvh - 620px),620px); }
  .hand-voices { padding-top: 0; }
  .hand-voice { padding-top: 2px; padding-bottom: 2px; }
  .hand-voice-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 3px 6px; }
  .hand-voice-name { grid-column: 1; }
  .hand-voice-controls > select { grid-column: 2; }
  .hand-contour { height: 38px; }
}

/* Sound shaping stays beside playback, ahead of movement and appearance. */
.hand-voice-sound .hand-select { margin-top: 8px; }
.hand-voice-sound-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px 6px; margin-top: 12px; }
.hand-sound-param { min-width: 0; display: grid; justify-items: center; gap: 3px; }
.hand-sound-param > label { font-size: 11px; color: var(--hand-muted); }
.hand-sound-knob { --accent: var(--voice-color); --bg-deep: #1b1b21; width: 100%; }
.hand-sound-knob > input[type="range"] { height: 100%; margin: 0; cursor: ns-resize; }
.hand-sound-knob output { font-size: 10px; }
.hand-sound-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: end; gap: 10px 12px; }
.hand-sound-grid > label { margin: 0; }
.hand-sound-grid input[type="range"] { min-height: 28px; }

.hand-voice-name[aria-controls="voiceSound"]::after { content: '↗'; margin-left: 6px; font-size: 10px; color: var(--hand-muted); }
@media(min-width:600px) and (max-width:960px) { .hand-voice-sound-grid { grid-template-columns: repeat(6, minmax(0,1fr)); } }
