/* FarmDew Farmhand V8 presentation.
   The server owns bounded appearance IDs; this sidecar owns only final sprite
   atlas selection plus the mobile creator sheet. Movement/timing stay tilemap-owned. */

html.farmdew-root .farmdew-farmer,
html.farmdew-root .farmdew-farmhand-preview-sprite{
  --farmdew-farmhand-skin-idle:url("/farmdew/pixel/v1/farmhand/phase1/skin-idle-south.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-clothes-idle:url("/farmdew/pixel/v1/farmhand/phase1/clothes-idle-south.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-eyes-idle:url("/farmdew/pixel/v1/farmhand/phase3/eyes-idle-atlas.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-hair-idle:url("/farmdew/pixel/v1/farmhand/phase3/hair-idle-atlas.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-accessory-idle:url("/farmdew/pixel/v1/farmhand/phase3/accessory-idle-atlas.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-skin-walk:url("/farmdew/pixel/v1/farmhand/phase1/skin-walk.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-clothes-walk:url("/farmdew/pixel/v1/farmhand/phase1/clothes-walk.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-eyes-walk:url("/farmdew/pixel/v1/farmhand/phase3/eyes-walk-atlas.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-hair-walk:url("/farmdew/pixel/v1/farmhand/phase3/hair-walk-atlas.png?v=3210-farmdew-session-2b");
  --farmdew-farmhand-accessory-walk:url("/farmdew/pixel/v1/farmhand/phase3/accessory-walk-atlas.png?v=3210-farmdew-session-2b");
}

html.farmdew-root .farmdew-farmer{
  --farmdew-farmhand-hair-idle-y:-384px;
  --farmdew-farmhand-eyes-idle-y:-192px;
  --farmdew-farmhand-accessory-idle-y:0px;
  --farmdew-farmhand-hair-walk-y:-1152px;
  --farmdew-farmhand-eyes-walk-y:-576px;
  --farmdew-farmhand-accessory-walk-y:0px;
}
html.farmdew-root .farmdew-farmhand-preview-sprite{
  --farmdew-farmhand-hair-idle-y:-768px;
  --farmdew-farmhand-eyes-idle-y:-384px;
  --farmdew-farmhand-accessory-idle-y:0px;
}

html.farmdew-root .farmdew-tilemap-farmer-sprite{
  background-image:
    var(--farmdew-farmhand-accessory-idle),
    var(--farmdew-farmhand-hair-idle),
    var(--farmdew-farmhand-eyes-idle),
    var(--farmdew-farmhand-clothes-idle),
    var(--farmdew-farmhand-skin-idle);
  background-size:
    192px 384px,
    192px 1344px,
    192px 384px,
    192px 48px,
    192px 48px;
  background-position-y:
    var(--farmdew-farmhand-accessory-idle-y),
    var(--farmdew-farmhand-hair-idle-y),
    var(--farmdew-farmhand-eyes-idle-y),
    0,
    0;
  background-repeat:no-repeat;
}

html.farmdew-root.farmdew-tilemap-preview .farmdew-farmer.is-tilemap-walking .farmdew-tilemap-farmer-sprite{
  background-image:
    var(--farmdew-farmhand-accessory-walk),
    var(--farmdew-farmhand-hair-walk),
    var(--farmdew-farmhand-eyes-walk),
    var(--farmdew-farmhand-clothes-walk),
    var(--farmdew-farmhand-skin-walk);
  background-size:
    288px 1152px,
    288px 4032px,
    288px 1152px,
    288px 144px,
    288px 144px;
}
html.farmdew-root.farmdew-tilemap-preview .farmdew-farmer[data-tilemap-direction="south"].is-tilemap-walking .farmdew-tilemap-farmer-sprite{
  background-position-y:
    var(--farmdew-farmhand-accessory-walk-y),
    var(--farmdew-farmhand-hair-walk-y),
    var(--farmdew-farmhand-eyes-walk-y),
    0,
    0;
}
html.farmdew-root.farmdew-tilemap-preview .farmdew-farmer[data-tilemap-direction="north"].is-tilemap-walking .farmdew-tilemap-farmer-sprite{
  background-position-y:
    calc(var(--farmdew-farmhand-accessory-walk-y) - 48px),
    calc(var(--farmdew-farmhand-hair-walk-y) - 48px),
    calc(var(--farmdew-farmhand-eyes-walk-y) - 48px),
    -48px,
    -48px;
}
html.farmdew-root.farmdew-tilemap-preview .farmdew-farmer[data-tilemap-direction="east"].is-tilemap-walking .farmdew-tilemap-farmer-sprite,
html.farmdew-root.farmdew-tilemap-preview .farmdew-farmer[data-tilemap-direction="west"].is-tilemap-walking .farmdew-tilemap-farmer-sprite{
  background-position-y:
    calc(var(--farmdew-farmhand-accessory-walk-y) - 96px),
    calc(var(--farmdew-farmhand-hair-walk-y) - 96px),
    calc(var(--farmdew-farmhand-eyes-walk-y) - 96px),
    -96px,
    -96px;
}

html.farmdew-root.farmdew-farmhand-pending.farmdew-tilemap-preview .farmdew-farmer{opacity:0!important}

.farmdew-farmhand-sheet{
  width:min(94vw,430px);
  max-height:min(86dvh,720px);
  padding-bottom:max(16px,env(safe-area-inset-bottom));
}
.farmdew-farmhand-sheet .farmdew-sheet-copy{margin-bottom:10px}
.farmdew-farmhand-preview-card{
  display:grid;
  grid-template-columns:104px minmax(0,1fr);
  align-items:center;
  gap:12px;
  margin:0 0 12px;
  padding:10px 12px;
  border:2px solid #604629;
  border-radius:12px;
  background:linear-gradient(180deg,#e8d3a0,#d4b879);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35);
}
.farmdew-farmhand-preview-stage{
  display:grid;
  place-items:center;
  width:104px;
  height:112px;
  border:2px solid #49321f;
  border-radius:10px;
  background:linear-gradient(#8ab867 0 68%,#c79b60 68% 100%);
  overflow:hidden;
}
.farmdew-farmhand-preview-sprite{
  width:96px;
  height:96px;
  background-image:
    var(--farmdew-farmhand-accessory-idle),
    var(--farmdew-farmhand-hair-idle),
    var(--farmdew-farmhand-eyes-idle),
    var(--farmdew-farmhand-clothes-idle),
    var(--farmdew-farmhand-skin-idle);
  background-position-y:
    var(--farmdew-farmhand-accessory-idle-y),
    var(--farmdew-farmhand-hair-idle-y),
    var(--farmdew-farmhand-eyes-idle-y),
    0,
    0;
  background-repeat:no-repeat;
  background-size:
    384px 768px,
    384px 2688px,
    384px 768px,
    384px 96px,
    384px 96px;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  animation:farmdew-farmhand-preview-idle .9s linear infinite;
  filter:drop-shadow(0 4px 0 rgba(30,42,24,.16));
}
.farmdew-farmhand-preview-copy strong{display:block;color:#3c2c1d;font-size:.96rem}
.farmdew-farmhand-preview-copy small{display:block;margin-top:4px;color:#67533b;font-size:.72rem;line-height:1.35}
.farmdew-farmhand-controls{display:grid;gap:12px;overflow:auto;padding:2px 1px 6px}
.farmdew-farmhand-group{display:grid;gap:6px}
.farmdew-farmhand-group h3{margin:0;color:#f7e6b8;font-size:.76rem;letter-spacing:.03em;text-transform:uppercase}
.farmdew-farmhand-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.farmdew-farmhand-choice{
  display:grid;
  grid-template-columns:32px minmax(0,1fr);
  align-items:center;
  gap:7px;
  min-height:48px;
  padding:6px 8px;
  border:2px solid #664a2d;
  border-radius:9px;
  background:#f0dca8;
  color:#3e2d1d;
  text-align:left;
  touch-action:manipulation;
}
.farmdew-farmhand-choice strong{overflow:hidden;font-size:.72rem;line-height:1.1;text-overflow:ellipsis;white-space:nowrap}
.farmdew-farmhand-choice.is-selected{border-color:#f4d66d;background:#705333;color:#fff3c3;box-shadow:0 0 0 1px rgba(244,214,109,.3)}
.farmdew-farmhand-swatch{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border:2px solid rgba(49,34,22,.55);
  border-radius:7px;
  background:#7b5a39;
  overflow:hidden;
  font-size:.8rem;
  font-weight:800;
  line-height:1;
}
.farmdew-farmhand-swatch.is-pixel-preview{
  background-color:#91bb72;
  background-repeat:no-repeat;
  border-radius:5px;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
}
.farmdew-farmhand-swatch[data-farmhand-swatch="tone_1"]{background:#f0c0a0}
.farmdew-farmhand-swatch[data-farmhand-swatch="tone_2"]{background:#c78a63}
.farmdew-farmhand-swatch[data-farmhand-swatch="tone_3"]{background:#9a5c40}
.farmdew-farmhand-swatch[data-farmhand-swatch="tone_4"]{background:#70432f}
.farmdew-farmhand-swatch[data-farmhand-field="hairColorId"][data-farmhand-swatch="black"]{background:#24232b}
.farmdew-farmhand-swatch[data-farmhand-field="hairColorId"][data-farmhand-swatch="blonde"]{background:#e2b52d}
.farmdew-farmhand-swatch[data-farmhand-field="hairColorId"][data-farmhand-swatch="brown"]{background:#75442d}
.farmdew-farmhand-swatch[data-farmhand-field="hairColorId"][data-farmhand-swatch="ginger"]{background:#c85a20}
.farmdew-farmhand-swatch[data-farmhand-field="outfitId"][data-farmhand-swatch="blue"]{background:#3b83a8}
.farmdew-farmhand-swatch[data-farmhand-field="outfitId"][data-farmhand-swatch="green"]{background:#649554}
.farmdew-farmhand-swatch[data-farmhand-field="outfitId"][data-farmhand-swatch="pink"]{background:#d77c91}
.farmdew-farmhand-swatch[data-farmhand-field="outfitId"][data-farmhand-swatch="purple"]{background:#865c9f}
.farmdew-farmhand-swatch[data-farmhand-field="outfitId"][data-farmhand-swatch="red"]{background:#b83c3f}
.farmdew-farmhand-actions{display:grid;grid-template-columns:1fr 1.35fr;gap:8px;margin-top:12px}
.farmdew-farmhand-actions .farmdew-button{min-height:48px;margin:0}

@keyframes farmdew-farmhand-preview-idle{
  0%,24.99%{background-position-x:0}
  25%,49.99%{background-position-x:-96px}
  50%,74.99%{background-position-x:-192px}
  75%,100%{background-position-x:-288px}
}

@media(max-width:360px){
  .farmdew-farmhand-sheet{width:96vw}
  .farmdew-farmhand-preview-card{grid-template-columns:88px minmax(0,1fr);gap:9px;padding-inline:9px}
  .farmdew-farmhand-preview-stage{width:88px;height:96px}
  .farmdew-farmhand-preview-sprite{transform:scale(.833333);transform-origin:center bottom}
  .farmdew-farmhand-choice{grid-template-columns:28px minmax(0,1fr);padding-inline:6px}
  .farmdew-farmhand-swatch{width:26px;height:26px}
  .farmdew-farmhand-choice strong{font-size:.66rem}
}
@media(prefers-reduced-motion:reduce){
  .farmdew-farmhand-preview-sprite{animation:none!important;transition:none!important}
}
