/* Original pixel-art instrument // Synergon Solutions */
.dgm{
  /* Additional LCD tones are derived from the shared display tokens. */
  --dgm-ink:var(--text-primary);
  --dgm-deep:color-mix(in srgb,var(--text-primary) 78%,var(--surface-raised));
  --dgm-mid:color-mix(in srgb,var(--text-primary) 48%,var(--surface-raised));
  --dgm-soft:color-mix(in srgb,var(--text-primary) 23%,var(--surface-raised));
  --dgm-light:color-mix(in srgb,var(--surface-raised) 76%,#fff4ce);
  --dgm-skin:color-mix(in srgb,var(--surface-raised) 64%,#f6deb1);
  --dgm-highlight:color-mix(in srgb,var(--surface-raised) 50%,#fff8de);
  --dgm-monster-mid:color-mix(in srgb,var(--text-primary) 38%,var(--surface-raised));
  margin-top:clamp(26px,4vw,44px);min-width:0;
  border:2px solid var(--border-strong);background:var(--surface-panel);
  box-shadow:3px 3px 0 var(--crystal-shadow);
}
.dgm-header{display:flex;justify-content:space-between;align-items:start;gap:16px;padding:clamp(16px,2.5vw,26px);border-bottom:1px solid var(--border-strong)}
.dgm-heading{min-width:0}
.dgm-heading .kicker{display:block;margin-bottom:7px}
.dgm-heading h3{font-size:clamp(2rem,3.2vw,3rem);margin-bottom:9px;line-height:.97}
.dgm-heading p{font-size:14px;line-height:1.6}
.dgm-tag{flex:none;white-space:nowrap}
.dgm-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(180px,24%);gap:0;min-width:0}
.dgm-stage{min-width:0;padding:12px}
.dgm-scene{
  display:block;width:100%;height:auto;border:1.5px solid var(--border-strong);
  background:var(--surface-recessed);color:var(--text-primary);
  shape-rendering:crispEdges;
}
.dgm-scene text{fill:currentColor;font-family:var(--font-display);font-size:12px}
.dgm-scene .dgm-scene-label{font-size:10px;letter-spacing:.2px}
.dgm-scene .dgm-speech,.dgm-scene .dgm-machine-name{fill:var(--text-inverse);font-size:13px}
.dgm-scene .dgm-machine-name{font-size:15px}
.dgm-stage-caption{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:8px}
.dgm-stage-caption .label{font-size:10px}
.dgm-readout{min-width:0;display:grid;grid-template-columns:1fr;align-content:stretch;border-left:1px solid var(--border-strong)}
.dgm-readout-cell{min-width:0;padding:12px 14px;display:grid;gap:4px;align-content:center}
.dgm-readout-cell+.dgm-readout-cell{border-top:1px solid var(--border-subtle)}
.dgm-readout-cell .label{font-size:10px}
.dgm-readout-cell strong{font:clamp(23px,2.7vw,32px)/.95 var(--font-display);overflow-wrap:anywhere}
.dgm-readout-cell .dgm-count{font-size:clamp(40px,5vw,64px);font-variant-numeric:tabular-nums;line-height:.8}
.dgm-appetite strong{font-size:20px}
.dgm-meter{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;height:11px;margin-block:3px}
.dgm-meter i{background:var(--surface-inverse);border:1px solid var(--border-strong)}
.dgm-meter i:last-child{background:transparent}
.dgm[data-chew="true"] .dgm-meter i:nth-child(n+5){background:transparent}
.dgm-panel{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;border-top:1px solid var(--border-strong);padding:14px;gap:14px}
.dgm-instruction{flex:1 1 260px;min-width:0;display:grid;gap:3px}
.dgm-status{font-size:13px;font-weight:600;line-height:1.5}
.dgm-instruction .small{font-size:11px}
.dgm-controls{display:flex;gap:7px;flex-wrap:wrap}
.dgm-controls .control{font-size:11px;min-height:44px;white-space:nowrap;padding-inline:12px}
.dgm-noscript{padding:12px}
.dgm-auto-props{display:none}
.dgm[data-mode="auto"] .dgm-manual-props{display:none}
.dgm[data-mode="auto"] .dgm-auto-props{display:inline}
@media(max-width:780px){
  .dgm-header{flex-wrap:wrap;gap:10px}
  .dgm-body{grid-template-columns:1fr}
  .dgm-readout{grid-template-columns:repeat(2,minmax(0,1fr));border-top:1px solid var(--border-strong);border-left:0}
  .dgm-readout-cell+.dgm-readout-cell{border-top:0}
  .dgm-readout-cell:nth-child(even){border-left:1px solid var(--border-subtle)}
  .dgm-readout-cell:nth-child(n+3){border-top:1px solid var(--border-subtle)}
  .dgm-readout-cell{padding:11px}
  .dgm-readout-cell strong{font-size:25px}
  .dgm-readout-cell .dgm-count{font-size:40px}
  .dgm-appetite strong{font-size:19px}
  .dgm-controls{width:100%}
}
@media(max-width:490px){
  .dgm-header{padding:13px}
  .dgm-heading h3{font-size:2rem}
  .dgm-heading p{font-size:13px}
  .dgm-stage{padding:7px}
  .dgm-stage-caption .label{font-size:8px}
  .dgm-panel{padding:10px}
  .dgm-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .dgm-controls .control{padding:8px 5px;white-space:normal;font-size:10px}
  .dgm-controls #dgm-reset{grid-column:1/-1}
}
@media(prefers-reduced-motion:reduce){
  .dgm *, .dgm *::before, .dgm *::after{animation:none!important;transition:none!important}
}

/* Exact same-frame palette switching. Both raster atlases remain at identical
   offsets; CSS selects the variant without restarting the animation clock. */
.dgm-sprite-window,.dgm-sprite-window image{image-rendering:crisp-edges;image-rendering:pixelated}
.dgm-sprite-off{opacity:0}
html[data-lcd-mode="daylight"] .dgm-sprite-on{opacity:0}
html[data-lcd-mode="daylight"] .dgm-sprite-off{opacity:1}
#dgm-sprite-motion{transform-box:view-box;transform-origin:327px 140px}
.dgm[data-visible="true"][data-pose="idle"] #dgm-sprite-motion{animation:dgm-breathe 2.8s steps(2,end) infinite}
@keyframes dgm-breathe{0%,100%{transform:scaleY(1)}50%{transform:scaleY(.985)}}
@media(prefers-reduced-motion:reduce){#dgm-sprite-motion{animation:none!important;transform:none!important}}

/* Designer idle breathing is anchored to the shoes on the shared ground. */
#dgm-designer-motion{transform-box:view-box;transform-origin:51.5px 140px}
.dgm[data-visible="true"][data-designer-pose="idle"] #dgm-designer-motion{animation:dgm-designer-breathe 3.2s steps(2,end) infinite}
@keyframes dgm-designer-breathe{0%,100%{transform:scaleY(1)}50%{transform:scaleY(.986)}}
@media(prefers-reduced-motion:reduce){#dgm-designer-motion{animation:none!important;transform:none!important}}
