:root{
  --bg:#fbfbf8;
  --panel:#ffffff;
  --muted:#666;
  --accent-1:#e6f2ff;
}
*{box-sizing:border-box}
html,body,#app{height:100%;margin:0;background:var(--bg);font-family:Inter,system-ui,Arial;color:#222}
.topbar{height:56px;display:flex;align-items:center;padding:8px 12px;gap:8px;background:linear-gradient(180deg,#fff, #fcfcfc);border-bottom:1px solid #eee}
.controls{display:flex;gap:8px;align-items:center;width:100%}
.controls button{padding:8px 10px;border-radius:8px;border:1px solid #ddd;background:#fff;min-width:56px}
.controls .label{display:flex;align-items:center;gap:8px;color:var(--muted);margin-left:auto;font-size:13px}

/* spawn input styling */
.spawn-label{display:flex;align-items:center;gap:6px;margin-left:8px}
.spawn-label input[type="number"]{
  width:80px;padding:6px 8px;border-radius:8px;border:1px solid #e6e6e6;background:#fff;font-size:13px
}
.spawn-label button{
  padding:6px 8px;border-radius:8px;border:1px solid #ddd;background:#fff;min-width:48px;font-size:13px
}
.main{display:flex;gap:12px;height:calc(100% - 56px - 44px);padding:12px}
.palette{width:84px;background:var(--panel);border-radius:12px;padding:10px;overflow:auto;border:1px solid #eee;display:flex;flex-direction:column;gap:10px;align-items:center}
.stage{flex:1;background:linear-gradient(180deg,#fff,#fbfbfb);border-radius:12px;border:1px solid #eee;position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center}
.hint{position:absolute;top:12px;left:12px;color:#999;font-size:13px}
.footer{height:44px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-top:1px solid #eee;background:transparent;font-size:13px;color:var(--muted)}
.block{
  width:64px;height:64px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:20px;
  touch-action:none; user-select:none; position:relative; box-shadow:0 6px 14px rgba(20,20,20,0.08);
}
.block .content{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.block .numlabel{font-weight:800;font-size:20px;color:#fff}
.dots{display:flex;flex-wrap:wrap;gap:4px;justify-content:center;align-items:center;width:72%;height:72%}
.dot{width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,0.95);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.06)}

/* face elements */
.face{
  position:absolute;
  width:60%;
  height:60%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  pointer-events:none;
}
.face .eyes{
  width:100%;
  display:flex;
  justify-content:space-between;
  padding:0 12%;
  box-sizing:border-box;
}
.face .eye{
  width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,0.98);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.06)
}
.face .mouth{
  width:40px;height:8px;border-radius:6px;background:rgba(0,0,0,0.12);transform-origin:center;transition:all 160ms ease;
}

/* smaller block face tweaks */
.block.small .face{width:70%;height:70%;gap:4px}
.block.small .face .eye{width:8px;height:8px}
.block.small .face .mouth{width:32px;height:6px;border-radius:5px}
.block.small{width:48px;height:48px;border-radius:10px;font-size:16px}
.palette .block{cursor:grab}
.stage .block{position:absolute;cursor:grab}
.block.selected{outline:3px solid rgba(0,0,0,0.08);box-shadow:0 10px 24px rgba(20,20,20,0.12);transform:scale(1.03)}
.legend{
  position:absolute;right:12px;bottom:12px;background:rgba(255,255,255,0.85);padding:8px;border-radius:8px;border:1px solid #eee;font-size:12px;color:#666
}

/* responsive for narrow screens (mobile iframe rules) */
@media (max-width:520px){
  .main{padding:8px;gap:8px}
  .palette{width:72px;padding:8px;gap:8px}
  .block{width:56px;height:56px;font-size:18px}
  .stage .block{transform-origin:center}
  .topbar{padding:6px}
}